use of com.android.launcher3.widget.model.WidgetListSpaceEntry in project android_packages_apps_Launcher3 by AOSPA.
the class WidgetsListAdapter method setWidgets.
/**
* Updates the widget list based on {@code tempEntries}.
*/
public void setWidgets(List<WidgetsListBaseEntry> tempEntries) {
mAllEntries.clear();
mAllEntries.add(new WidgetListSpaceEntry());
tempEntries.stream().sorted(mRowComparator).forEach(mAllEntries::add);
if (shouldClearVisibleEntries()) {
mVisibleEntries.clear();
}
updateVisibleEntries();
}
use of com.android.launcher3.widget.model.WidgetListSpaceEntry in project android_packages_apps_Launcher3 by ArrowOS.
the class WidgetsListAdapter method setWidgets.
/**
* Updates the widget list based on {@code tempEntries}.
*/
public void setWidgets(List<WidgetsListBaseEntry> tempEntries) {
mAllEntries.clear();
mAllEntries.add(new WidgetListSpaceEntry());
tempEntries.stream().sorted(mRowComparator).forEach(mAllEntries::add);
if (shouldClearVisibleEntries()) {
mVisibleEntries.clear();
}
updateVisibleEntries();
}
use of com.android.launcher3.widget.model.WidgetListSpaceEntry in project android_packages_apps_Launcher3 by ProtonAOSP.
the class WidgetsListAdapter method setWidgets.
/**
* Updates the widget list based on {@code tempEntries}.
*/
public void setWidgets(List<WidgetsListBaseEntry> tempEntries) {
mAllEntries.clear();
mAllEntries.add(new WidgetListSpaceEntry());
tempEntries.stream().sorted(mRowComparator).forEach(mAllEntries::add);
if (shouldClearVisibleEntries()) {
mVisibleEntries.clear();
}
updateVisibleEntries();
}
use of com.android.launcher3.widget.model.WidgetListSpaceEntry in project android_packages_apps_404Launcher by P-404.
the class WidgetsListAdapter method updateVisibleEntries.
private void updateVisibleEntries() {
// Get the current top of the header with the matching key before adjusting the visible
// entries.
OptionalInt previousPositionForPackageUserKey = getPositionForPackageUserKey(mPendingClickHeader);
OptionalInt topForPackageUserKey = getOffsetForPosition(previousPositionForPackageUserKey);
List<WidgetsListBaseEntry> newVisibleEntries = mAllEntries.stream().filter(entry -> ((mFilter == null || mFilter.test(entry)) && mHeaderAndSelectedContentFilter.test(entry)) || entry instanceof WidgetListSpaceEntry).map(entry -> {
if (entry instanceof WidgetsListBaseEntry.Header<?> && matchesKey(entry, mWidgetsContentVisiblePackageUserKey)) {
// Adjust the original entries to expand headers for the selected content.
return ((WidgetsListBaseEntry.Header<?>) entry).withWidgetListShown();
} else if (entry instanceof WidgetsListContentEntry) {
// maxSpanSize.
return ((WidgetsListContentEntry) entry).withMaxSpanSize(mMaxSpanSize);
}
return entry;
}).collect(Collectors.toList());
mDiffReporter.process(mVisibleEntries, newVisibleEntries, mRowComparator);
if (mPendingClickHeader != null) {
// Get the position for the clicked header after adjusting the visible entries. The
// position may have changed if another header had previously been expanded.
OptionalInt positionForPackageUserKey = getPositionForPackageUserKey(mPendingClickHeader);
scrollToPositionAndMaintainOffset(positionForPackageUserKey, topForPackageUserKey);
mPendingClickHeader = null;
}
}
use of com.android.launcher3.widget.model.WidgetListSpaceEntry in project android_packages_apps_404Launcher by P-404.
the class WidgetsListAdapter method setWidgets.
/**
* Updates the widget list based on {@code tempEntries}.
*/
public void setWidgets(List<WidgetsListBaseEntry> tempEntries) {
mAllEntries.clear();
mAllEntries.add(new WidgetListSpaceEntry());
tempEntries.stream().sorted(mRowComparator).forEach(mAllEntries::add);
if (shouldClearVisibleEntries()) {
mVisibleEntries.clear();
}
updateVisibleEntries();
}
Aggregations