Compare maxSpanSize for WidgetsListContentEntries when updating visible

entries in widget picker.

This is so that widgets are rearranged according to maxSpanSize in
widget table

Bug: 191336852
Test: Manually rotated widget picker with one of the headers expanded
and checked that widgets in widget table adjust according to screen's
horizontal size.

Change-Id: I2406ca9eccd18f4bb32b396acaa188c37f0059ee
This commit is contained in:
Alina Zaidi committed 2021-06-25 13:46:03 +01:00
1 parent 8db306f3c5
commit 0b320545f8
7 files changed
+197 -36

No files matched your search

@@ -115,7 +115,7 @@ public class WidgetsDiffReporter {
// or did the widget size and desc, span, etc change?
if (!isSamePackageItemInfo(orgRowEntry.mPkgItem, newRowEntry.mPkgItem)
|| hasHeaderUpdated(orgRowEntry, newRowEntry)
|| hasWidgetsListChanged(orgRowEntry, newRowEntry)) {
|| hasWidgetsListContentChanged(orgRowEntry, newRowEntry)) {
index = currentEntries.indexOf(orgRowEntry);
currentEntries.set(index, newRowEntry);
mListener.notifyItemChanged(index);
@@ -158,17 +158,15 @@ public class WidgetsDiffReporter {
/**
* Returns {@code true} if both {@code curRow} & {@code newRow} are
* {@link WidgetsListContentEntry}s with a different list of widgets.
* {@link WidgetsListContentEntry}s with a different list or arrangement of widgets.
*/
private boolean hasWidgetsListChanged(WidgetsListBaseEntry curRow,
private boolean hasWidgetsListContentChanged(WidgetsListBaseEntry curRow,
WidgetsListBaseEntry newRow) {
if (!(curRow instanceof WidgetsListContentEntry)
|| !(newRow instanceof WidgetsListContentEntry)) {
return false;
}
WidgetsListContentEntry orgRowEntry = (WidgetsListContentEntry) curRow;
WidgetsListContentEntry newRowEntry = (WidgetsListContentEntry) newRow;
return !orgRowEntry.mWidgets.equals(newRowEntry.mWidgets);
return !curRow.equals(newRow);
}
/**