use of com.android.launcher3.widget.WidgetItemComparator in project Neo-Launcher by NeoApplications.
the class WidgetsModel method getWidgetsList.
/**
* 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 = (row.pkgItem.title == null) ? "" : indexer.computeSectionName(row.pkgItem.title);
Collections.sort(row.widgets, widgetComparator);
result.add(row);
}
return result;
}
use of com.android.launcher3.widget.WidgetItemComparator in project android_packages_apps_Trebuchet by LineageOS.
the class WidgetsModel method getWidgetsList.
/**
* 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 = (row.pkgItem.title == null) ? "" : indexer.computeSectionName(row.pkgItem.title);
Collections.sort(row.widgets, widgetComparator);
result.add(row);
}
return result;
}
Aggregations