Search in sources :

Example 1 with AppDB

use of org.adw.launcher2.appdb.AppDB in project ADWLauncher2 by boombuler.

the class LauncherApplication method onCreate.

@Override
public void onCreate() {
    //VMRuntime.getRuntime().setMinimumHeapSize(4 * 1024 * 1024);
    super.onCreate();
    mIconCache = new IconCache(this);
    mAppDB = new AppDB(this, mIconCache);
    mModel = new LauncherModel(this, mIconCache);
    // Register intent receivers
    IntentFilter filter = new IntentFilter(AppDB.INTENT_DB_CHANGED);
    registerReceiver(mModel, filter);
    filter = new IntentFilter();
    filter.addAction(ACTION_EXTERNAL_APPLICATIONS_AVAILABLE);
    filter.addAction(ACTION_EXTERNAL_APPLICATIONS_UNAVAILABLE);
    registerReceiver(mModel, filter);
    // Register for changes to the favorites
    ContentResolver resolver = getContentResolver();
    resolver.registerContentObserver(LauncherSettings.Favorites.CONTENT_URI, true, mFavoritesObserver);
}
Also used : IntentFilter(android.content.IntentFilter) AppDB(org.adw.launcher2.appdb.AppDB) ContentResolver(android.content.ContentResolver)

Example 2 with AppDB

use of org.adw.launcher2.appdb.AppDB 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)

Aggregations

AppDB (org.adw.launcher2.appdb.AppDB)2 ContentResolver (android.content.ContentResolver)1 IntentFilter (android.content.IntentFilter)1 Comparator (java.util.Comparator)1 IconItemInfo (org.adw.launcher2.IconItemInfo)1 ShortcutInfo (org.adw.launcher2.ShortcutInfo)1