summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDavid van Tonder <david.vantonder@gmail.com>2013-07-30 23:49:16 +0000
committerGerrit Code Review <gerrit@cyanogenmod.org>2013-07-30 23:49:16 +0000
commit003a4a6fdff34b7a8a9951cb954ee326694e4136 (patch)
tree70cf241a16c80175c70341217816983584c9c544
parent51b64b36122ea0bc4beab813ec3b85b4899e9899 (diff)
parent0e9d44b7e6059de610e4488538b4c5584b2e502d (diff)
downloadpackages_apps_settings-003a4a6fdff34b7a8a9951cb954ee326694e4136.zip
packages_apps_settings-003a4a6fdff34b7a8a9951cb954ee326694e4136.tar.gz
packages_apps_settings-003a4a6fdff34b7a8a9951cb954ee326694e4136.tar.bz2
Merge "Fix app selection when adding apps to app groups." into cm-10.1
-rw-r--r--src/com/android/settings/profiles/AppGroupConfig.java23
1 files changed, 13 insertions, 10 deletions
diff --git a/src/com/android/settings/profiles/AppGroupConfig.java b/src/com/android/settings/profiles/AppGroupConfig.java
index b5ea87c..8fbcfd0 100644
--- a/src/com/android/settings/profiles/AppGroupConfig.java
+++ b/src/com/android/settings/profiles/AppGroupConfig.java
@@ -74,8 +74,6 @@ public class AppGroupConfig extends SettingsPreferenceFragment
private PackageManager mPackageManager;
- private List<PackageInfo> mInstalledPackages;
-
private NotificationGroup mNotificationGroup;
private ProfileManager mProfileManager;
@@ -99,8 +97,7 @@ public class AppGroupConfig extends SettingsPreferenceFragment
if (args != null) {
mNotificationGroup = (NotificationGroup) args.getParcelable("NotificationGroup");
mPackageManager = getPackageManager();
- mInstalledPackages = mPackageManager.getInstalledPackages(0);
- mAppAdapter = new PackageAdaptor(mInstalledPackages);
+ mAppAdapter = new PackageAdaptor(mPackageManager.getInstalledPackages(0));
mAppAdapter.update();
updatePackages();
@@ -323,15 +320,21 @@ public class AppGroupConfig extends SettingsPreferenceFragment
}
class PackageItem implements Comparable<PackageItem> {
- CharSequence title;
-
+ String title;
String packageName;
-
Drawable icon;
+ boolean enabled;
@Override
public int compareTo(PackageItem another) {
- return this.title.toString().compareTo(another.title.toString());
+ if (enabled != another.enabled) {
+ return enabled ? -1 : 1;
+ }
+ int titleResult = title.compareToIgnoreCase(another.title);
+ if (titleResult != 0) {
+ return titleResult;
+ }
+ return packageName.compareTo(another.packageName);
}
}
@@ -352,11 +355,11 @@ public class AppGroupConfig extends SettingsPreferenceFragment
for (PackageInfo info : mInstalledPackageInfo) {
final PackageItem item = new PackageItem();
ApplicationInfo applicationInfo = info.applicationInfo;
- item.title = applicationInfo.loadLabel(mPackageManager);
+ item.title = applicationInfo.loadLabel(mPackageManager).toString();
item.icon = applicationInfo.loadIcon(mPackageManager);
item.packageName = applicationInfo.packageName;
+ item.enabled = applicationInfo.enabled;
handler.post(new Runnable() {
-
@Override
public void run() {
int index = Collections.binarySearch(mInstalledPackages, item);