mirror of
https://github.com/LawnchairLauncher/lawnchair.git
synced 2026-02-27 23:36:47 +00:00
Converting widget panel into a floating view
> The widget panel is only inflated when needed > Using the swipe up/down interaction for widgets tray > Removing additional view wrappers from all-apps > Widget tray is preserved across activity recreation > Launcher no longer has WIDGET state, the actual code around the states will be removed in a follow-up cl Bug: 67678570 Bug: 67585158 Change-Id: Ia29a7c33ec81e6c53cc24e2906b7022b6f41755b
This commit is contained in:
@@ -15,6 +15,7 @@ import com.android.launcher3.InvariantDeviceProfile;
|
||||
import com.android.launcher3.LauncherAppState;
|
||||
import com.android.launcher3.LauncherAppWidgetProviderInfo;
|
||||
import com.android.launcher3.Utilities;
|
||||
import com.android.launcher3.compat.AlphabeticIndexCompat;
|
||||
import com.android.launcher3.compat.AppWidgetManagerCompat;
|
||||
import com.android.launcher3.compat.LauncherAppsCompat;
|
||||
import com.android.launcher3.compat.ShortcutConfigActivityInfo;
|
||||
@@ -22,10 +23,14 @@ import com.android.launcher3.config.FeatureFlags;
|
||||
import com.android.launcher3.util.MultiHashMap;
|
||||
import com.android.launcher3.util.PackageUserKey;
|
||||
import com.android.launcher3.util.Preconditions;
|
||||
import com.android.launcher3.widget.WidgetItemComparator;
|
||||
import com.android.launcher3.widget.WidgetListRowEntry;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
import java.util.HashMap;
|
||||
import java.util.Iterator;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* Widgets data model that is used by the adapters of the widget views and controllers.
|
||||
@@ -42,8 +47,26 @@ public class WidgetsModel {
|
||||
|
||||
private AppFilter mAppFilter;
|
||||
|
||||
public synchronized MultiHashMap<PackageItemInfo, WidgetItem> getWidgetsMap() {
|
||||
return mWidgetsList.clone();
|
||||
/**
|
||||
* Returns a list of {@link WidgetListRowEntry}. All {@link WidgetItem} in a single row
|
||||
* are sorted (based on label and user), but the overall list of {@link WidgetListRowEntry}s
|
||||
* is not sorted. This list is sorted at the UI when using
|
||||
* {@link com.android.launcher3.widget.WidgetsDiffReporter}
|
||||
*
|
||||
* @see com.android.launcher3.widget.WidgetsListAdapter#setWidgets(ArrayList)
|
||||
*/
|
||||
public synchronized ArrayList<WidgetListRowEntry> getWidgetsList(Context context) {
|
||||
ArrayList<WidgetListRowEntry> result = new ArrayList<>();
|
||||
AlphabeticIndexCompat indexer = new AlphabeticIndexCompat(context);
|
||||
|
||||
WidgetItemComparator widgetComparator = new WidgetItemComparator();
|
||||
for (Map.Entry<PackageItemInfo, ArrayList<WidgetItem>> entry : mWidgetsList.entrySet()) {
|
||||
WidgetListRowEntry row = new WidgetListRowEntry(entry.getKey(), entry.getValue());
|
||||
row.titleSectionName = indexer.computeSectionName(row.pkgItem.title);
|
||||
Collections.sort(row.widgets, widgetComparator);
|
||||
result.add(row);
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user