summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRaj Yengisetty <rajesh@cyngn.com>2014-11-10 18:35:01 (GMT)
committerAdnan <adnan@cyngn.com>2014-11-19 23:53:58 (GMT)
commit370a0a6c6fce3768bb64deb0ef88d23dc4719d8a (patch)
tree33c28c0c601e456312e91c4230ecba5e3719eef6
parenta251402a9c16fb95414138c3f50dbcdf40d9d869 (diff)
downloadandroid_packages_apps_Trebuchet-370a0a6c6fce3768bb64deb0ef88d23dc4719d8a.zip
android_packages_apps_Trebuchet-370a0a6c6fce3768bb64deb0ef88d23dc4719d8a.tar.gz
android_packages_apps_Trebuchet-370a0a6c6fce3768bb64deb0ef88d23dc4719d8a.tar.bz2
Fix: Sort apps before opening AppDrawer to reflect the most recent counts.
Repro: Clear Trebuchet data Drawer Sorting mode of Launch Count Launch App1 twice Launch App2 once Open drawer, note App1 ordered before App2 Launcher App2 two more times Open drawer, note position hasn't updated Change-Id: I9d85627f5dc86bc753a1e6f22911ee39a8d78b5e
-rw-r--r--src/com/android/launcher3/AppsCustomizePagedView.java82
-rw-r--r--src/com/android/launcher3/Launcher.java1
2 files changed, 48 insertions, 35 deletions
diff --git a/src/com/android/launcher3/AppsCustomizePagedView.java b/src/com/android/launcher3/AppsCustomizePagedView.java
index 0a125e6..5c298ef 100644
--- a/src/com/android/launcher3/AppsCustomizePagedView.java
+++ b/src/com/android/launcher3/AppsCustomizePagedView.java
@@ -210,7 +210,6 @@ public class AppsCustomizePagedView extends PagedViewWithDraggableItems implemen
private ArrayList<AppInfo> mApps;
private ArrayList<Object> mWidgets;
- private ArrayList<AppInfo> mFilteredApps;
private ArrayList<Object> mFilteredWidgets;
private ArrayList<ComponentName> mProtectedApps;
private ArrayList<String> mProtectedPackages;
@@ -1502,6 +1501,53 @@ public class AppsCustomizePagedView extends PagedViewWithDraggableItems implemen
mSaveInstanceStateItemIndex = -1;
}
+ private void onTransitionPrepare() {
+ mIsSwitchingState = true;
+
+ // Invalidate here to ensure that the pages are rendered during the state change transition.
+ invalidate();
+
+ enableHwLayersOnVisiblePages();
+ }
+
+ private void onTransitionEnd() {
+ mIsSwitchingState = false;
+ }
+
+ public Comparator<AppInfo> getComparatorForSortMode() {
+ switch (mSortMode) {
+ case Title:
+ return LauncherModel.getAppNameComparator();
+ case LaunchCount:
+ return LauncherModel.getAppLaunchCountComparator(mLauncher.getStats());
+ case InstallTime:
+ return LauncherModel.APP_INSTALL_TIME_COMPARATOR;
+ }
+ return LauncherModel.getAppNameComparator();
+ }
+
+ public void setSortMode(SortMode sortMode) {
+ if (mSortMode == sortMode) return;
+
+ mSortMode = sortMode;
+
+ sortApps();
+ }
+
+ public void sortApps() {
+ Collections.sort(mApps, getComparatorForSortMode());
+
+ if (mContentType == ContentType.Applications) {
+ for (int i = 0; i < getChildCount(); i++) {
+ syncAppsPageItems(i, true);
+ }
+ }
+ }
+
+ public SortMode getSortMode() {
+ return mSortMode;
+ }
+
/*
* AllAppsView implementation
*/
@@ -1713,38 +1759,4 @@ public class AppsCustomizePagedView extends PagedViewWithDraggableItems implemen
return String.format(getContext().getString(stringId), page + 1, count);
}
-
- public Comparator<AppInfo> getComparatorForSortMode() {
- switch (mSortMode) {
- case Title:
- return LauncherModel.getAppNameComparator();
- case LaunchCount:
- return LauncherModel.getAppLaunchCountComparator(mLauncher.getStats());
- case InstallTime:
- return LauncherModel.APP_INSTALL_TIME_COMPARATOR;
- }
- return LauncherModel.getAppNameComparator();
- }
-
- public void setSortMode(SortMode sortMode) {
- if (mSortMode == sortMode) return;
-
- mSortMode = sortMode;
-
- sortApps();
- }
-
- public void sortApps() {
- Collections.sort(new ArrayList<AppInfo>(), getComparatorForSortMode());
-
- if (mContentType == ContentType.Applications) {
- for (int i = 0; i < getChildCount(); i++) {
- syncAppsPageItems(i, true);
- }
- }
- }
-
- public SortMode getSortMode() {
- return mSortMode;
- }
}
diff --git a/src/com/android/launcher3/Launcher.java b/src/com/android/launcher3/Launcher.java
index 28a9881..27ae670 100644
--- a/src/com/android/launcher3/Launcher.java
+++ b/src/com/android/launcher3/Launcher.java
@@ -4061,6 +4061,7 @@ public class Launcher extends Activity
if (resetPageToZero) {
mAppsCustomizeTabHost.reset();
}
+ mAppsCustomizeContent.sortApps();
showAppsCustomizeHelper(animated, false, contentType);
mAppsCustomizeTabHost.post(new Runnable() {
@Override