am 78403fee: Changing downloads tab to my apps and making most recent first. (3377455)

* commit '78403feedcf6d61a527cf0c904cb55ca43c0f3cb':
  Changing downloads tab to my apps and making most recent first. (3377455)
This commit is contained in:
Winson Chung
2011-01-21 16:31:34 -08:00
committed by Android Git Automerger
4 changed files with 22 additions and 5 deletions
+4 -4
View File
@@ -60,12 +60,12 @@
<!-- Labels for the tabs in All Apps -->
<!-- Title of the tab for all applications (includes games and non-games) [CHAR_LIMIT=12] -->
<string name="all_apps_tab_all">All</string>
<!-- Title of the tab for all applications *except* games [CHAR_LIMIT=12] -->
<!-- Title of the tab for all applications *except* games [CHAR_LIMIT=24] -->
<string name="all_apps_tab_apps">Apps</string>
<!-- Title of the tab for applications labeled as games [CHAR_LIMIT=12] -->
<!-- Title of the tab for applications labeled as games [CHAR_LIMIT=24] -->
<string name="all_apps_tab_games">Games</string>
<!-- Tile of the tab for applications that were downloaded from market [CHAR_LIMIT=12] -->
<string name="all_apps_tab_downloaded">Downloaded</string>
<!-- Tile of the tab for applications that were downloaded from market [CHAR_LIMIT=24] -->
<string name="all_apps_tab_downloaded">My Apps</string>
<!-- All Apps pane -->
<!-- Message to show when there are no games [CHAR_LIMIT=25] -->
@@ -314,6 +314,7 @@ public class AllAppsPagedView extends PagedViewWithDraggableItems implements All
filteredApps.add(info);
}
}
Collections.sort(filteredApps, LauncherModel.APP_INSTALL_TIME_COMPARATOR);
}
return filteredApps;
}
@@ -52,6 +52,11 @@ class ApplicationInfo extends ItemInfo {
*/
Bitmap iconBitmap;
/**
* The time at which the app was first installed.
*/
long firstInstallTime;
ComponentName componentName;
static final int APP_FLAG = 1;
@@ -82,6 +87,7 @@ class ApplicationInfo extends ItemInfo {
if ((appFlags & android.content.pm.ApplicationInfo.FLAG_UPDATED_SYSTEM_APP) != 0) {
flags |= DOWNLOADED_FLAG;
}
firstInstallTime = pm.getPackageInfo(packageName, 0).firstInstallTime;
// TODO: Figure out how to determine what is a game
// If it's not a game, it's an app
@@ -101,6 +107,7 @@ class ApplicationInfo extends ItemInfo {
title = info.title.toString();
intent = new Intent(info.intent);
flags = info.flags;
firstInstallTime = info.firstInstallTime;
}
/**
@@ -128,7 +135,8 @@ class ApplicationInfo extends ItemInfo {
Log.d(tag, label + " size=" + list.size());
for (ApplicationInfo info: list) {
Log.d(tag, " title=\"" + info.title + "\" titleBitmap=" + info.titleBitmap
+ " iconBitmap=" + info.iconBitmap);
+ " iconBitmap=" + info.iconBitmap + " firstInstallTime="
+ info.firstInstallTime);
}
}
@@ -1747,6 +1747,14 @@ public class LauncherModel extends BroadcastReceiver {
return sCollator.compare(a.title.toString(), b.title.toString());
}
};
public static final Comparator<ApplicationInfo> APP_INSTALL_TIME_COMPARATOR
= new Comparator<ApplicationInfo>() {
public final int compare(ApplicationInfo a, ApplicationInfo b) {
if (a.firstInstallTime < b.firstInstallTime) return 1;
if (a.firstInstallTime > b.firstInstallTime) return -1;
return 0;
}
};
public void dumpState() {
Log.d(TAG, "mCallbacks=" + mCallbacks);