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);
}
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;
}
};
}
Aggregations