Search in sources :

Example 1 with AlphabeticIndexCompat

use of com.android.launcher3.compat.AlphabeticIndexCompat in project android_packages_apps_Launcher3 by crdroidandroid.

the class AllAppsList method clear.

public void clear() {
    data.clear();
    mDataChanged = false;
    // Reset the index as locales might have changed
    mIndex = new AlphabeticIndexCompat(LocaleList.getDefault());
}
Also used : AlphabeticIndexCompat(com.android.launcher3.compat.AlphabeticIndexCompat)

Example 2 with AlphabeticIndexCompat

use of com.android.launcher3.compat.AlphabeticIndexCompat in project android_packages_apps_Launcher3 by crdroidandroid.

the class WidgetsModel method getWidgetsListForPicker.

/**
 * Returns a list of {@link WidgetsListBaseEntry}. All {@link WidgetItem} in a single row
 * are sorted (based on label and user), but the overall list of
 * {@link WidgetsListBaseEntry}s is not sorted. This list is sorted at the UI when using
 * {@link WidgetsDiffReporter}
 *
 * @see com.android.launcher3.widget.picker.WidgetsListAdapter#setWidgets(List)
 */
public synchronized ArrayList<WidgetsListBaseEntry> getWidgetsListForPicker(Context context) {
    ArrayList<WidgetsListBaseEntry> result = new ArrayList<>();
    AlphabeticIndexCompat indexer = new AlphabeticIndexCompat(context);
    for (Map.Entry<PackageItemInfo, List<WidgetItem>> entry : mWidgetsList.entrySet()) {
        PackageItemInfo pkgItem = entry.getKey();
        List<WidgetItem> widgetItems = entry.getValue();
        String sectionName = (pkgItem.title == null) ? "" : indexer.computeSectionName(pkgItem.title);
        result.add(new WidgetsListHeaderEntry(pkgItem, sectionName, widgetItems));
        result.add(new WidgetsListContentEntry(pkgItem, sectionName, widgetItems));
    }
    return result;
}
Also used : AlphabeticIndexCompat(com.android.launcher3.compat.AlphabeticIndexCompat) WidgetsListBaseEntry(com.android.launcher3.widget.model.WidgetsListBaseEntry) ArrayList(java.util.ArrayList) WidgetsListContentEntry(com.android.launcher3.widget.model.WidgetsListContentEntry) PackageItemInfo(com.android.launcher3.model.data.PackageItemInfo) ArrayList(java.util.ArrayList) ShortcutConfigActivityInfo.queryList(com.android.launcher3.pm.ShortcutConfigActivityInfo.queryList) Collectors.toList(java.util.stream.Collectors.toList) List(java.util.List) HashMap(java.util.HashMap) Map(java.util.Map) ArrayMap(androidx.collection.ArrayMap) WidgetsListHeaderEntry(com.android.launcher3.widget.model.WidgetsListHeaderEntry)

Aggregations

AlphabeticIndexCompat (com.android.launcher3.compat.AlphabeticIndexCompat)2 ArrayMap (androidx.collection.ArrayMap)1 PackageItemInfo (com.android.launcher3.model.data.PackageItemInfo)1 ShortcutConfigActivityInfo.queryList (com.android.launcher3.pm.ShortcutConfigActivityInfo.queryList)1 WidgetsListBaseEntry (com.android.launcher3.widget.model.WidgetsListBaseEntry)1 WidgetsListContentEntry (com.android.launcher3.widget.model.WidgetsListContentEntry)1 WidgetsListHeaderEntry (com.android.launcher3.widget.model.WidgetsListHeaderEntry)1 ArrayList (java.util.ArrayList)1 HashMap (java.util.HashMap)1 List (java.util.List)1 Map (java.util.Map)1 Collectors.toList (java.util.stream.Collectors.toList)1