summaryrefslogtreecommitdiffstats
path: root/src/com/android
diff options
context:
space:
mode:
authorWinson Chung <winsonc@google.com>2011-01-21 15:38:02 -0800
committerWinson Chung <winsonc@google.com>2011-01-21 15:48:45 -0800
commit78403feedcf6d61a527cf0c904cb55ca43c0f3cb (patch)
tree452797138b0496a56a0e69882cb97c35d5d9de68 /src/com/android
parent7bccb42f88cbbaf8cf180a876e8c5d5e306ce62a (diff)
downloadandroid_packages_apps_Trebuchet-78403feedcf6d61a527cf0c904cb55ca43c0f3cb.tar.gz
android_packages_apps_Trebuchet-78403feedcf6d61a527cf0c904cb55ca43c0f3cb.tar.bz2
android_packages_apps_Trebuchet-78403feedcf6d61a527cf0c904cb55ca43c0f3cb.zip
Changing downloads tab to my apps and making most recent first. (3377455)
Change-Id: I75ae46ad601457ecfc9555aff7f7ff5284440317
Diffstat (limited to 'src/com/android')
-rw-r--r--src/com/android/launcher2/AllAppsPagedView.java1
-rw-r--r--src/com/android/launcher2/ApplicationInfo.java10
-rw-r--r--src/com/android/launcher2/LauncherModel.java8
3 files changed, 18 insertions, 1 deletions
diff --git a/src/com/android/launcher2/AllAppsPagedView.java b/src/com/android/launcher2/AllAppsPagedView.java
index fe7312d69..59065996e 100644
--- a/src/com/android/launcher2/AllAppsPagedView.java
+++ b/src/com/android/launcher2/AllAppsPagedView.java
@@ -314,6 +314,7 @@ public class AllAppsPagedView extends PagedViewWithDraggableItems implements All
filteredApps.add(info);
}
}
+ Collections.sort(filteredApps, LauncherModel.APP_INSTALL_TIME_COMPARATOR);
}
return filteredApps;
}
diff --git a/src/com/android/launcher2/ApplicationInfo.java b/src/com/android/launcher2/ApplicationInfo.java
index 0851cd350..3adea373e 100644
--- a/src/com/android/launcher2/ApplicationInfo.java
+++ b/src/com/android/launcher2/ApplicationInfo.java
@@ -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);
}
}
diff --git a/src/com/android/launcher2/LauncherModel.java b/src/com/android/launcher2/LauncherModel.java
index 7e7261038..005273749 100644
--- a/src/com/android/launcher2/LauncherModel.java
+++ b/src/com/android/launcher2/LauncherModel.java
@@ -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);