Search in sources :

Example 1 with IconItemInfo

use of org.adw.launcher2.IconItemInfo in project ADWLauncher2 by boombuler.

the class Preferences method getLaunchCountComparator.

private Comparator<IconItemInfo> getLaunchCountComparator() {
    final AppDB myAppDB = mLauncher.getAppDB();
    return new Comparator<IconItemInfo>() {

        @Override
        public int compare(IconItemInfo a, IconItemInfo b) {
            int valA = Integer.MAX_VALUE;
            int valB = Integer.MAX_VALUE;
            if (a instanceof ShortcutInfo)
                valA = myAppDB.getLaunchCounter((ShortcutInfo) a);
            if (b instanceof ShortcutInfo)
                valB = myAppDB.getLaunchCounter((ShortcutInfo) b);
            return valB - valA;
        }
    };
}
Also used : ShortcutInfo(org.adw.launcher2.ShortcutInfo) AppDB(org.adw.launcher2.appdb.AppDB) IconItemInfo(org.adw.launcher2.IconItemInfo) Comparator(java.util.Comparator)

Example 2 with IconItemInfo

use of org.adw.launcher2.IconItemInfo in project ADWLauncher2 by boombuler.

the class Preferences method getAppNameComparator.

private Comparator<IconItemInfo> getAppNameComparator() {
    final IconCache myIconCache = mLauncher.getIconCache();
    final Collator sCollator = Collator.getInstance();
    return new Comparator<IconItemInfo>() {

        @Override
        public final int compare(IconItemInfo a, IconItemInfo b) {
            return sCollator.compare(a.getTitle(myIconCache), b.getTitle(myIconCache));
        }
    };
}
Also used : IconCache(org.adw.launcher2.IconCache) IconItemInfo(org.adw.launcher2.IconItemInfo) Collator(java.text.Collator) Comparator(java.util.Comparator)

Aggregations

Comparator (java.util.Comparator)2 IconItemInfo (org.adw.launcher2.IconItemInfo)2 Collator (java.text.Collator)1 IconCache (org.adw.launcher2.IconCache)1 ShortcutInfo (org.adw.launcher2.ShortcutInfo)1 AppDB (org.adw.launcher2.appdb.AppDB)1