summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDanny Baumann <dannybaumann@web.de>2013-07-17 13:59:42 +0200
committerDanny Baumann <dannybaumann@web.de>2013-07-30 09:39:32 +0200
commit0e9d44b7e6059de610e4488538b4c5584b2e502d (patch)
tree2eae8ae72ef6f998a762039ef314354de8ac2594
parentbd78e709b2f9460db82d11005b99072202ac56f9 (diff)
downloadpackages_apps_settings-0e9d44b7e6059de610e4488538b4c5584b2e502d.zip
packages_apps_settings-0e9d44b7e6059de610e4488538b4c5584b2e502d.tar.gz
packages_apps_settings-0e9d44b7e6059de610e4488538b4c5584b2e502d.tar.bz2
Fix app selection when adding apps to app groups.
- Don't drop separate apps with the same title - Sort case-insensitive - Sort disabled apps to the end of the list Change-Id: Iffadca4896468aaee5fcfd60f8776c2bb1a8ce7f
-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);