From 3d406414538a431cb254b1f8c34439b787b88a70 Mon Sep 17 00:00:00 2001 From: Danny Baumann Date: Wed, 17 Jul 2013 13:12:59 +0200 Subject: Sort disabled apps to the end of the list in privacy guard manager. JIRA: CYAN-1703 Change-Id: Ie3c1cf0339d66405d27c06dba07cc80e4001d669 --- .../settings/cyanogenmod/privacyguard/PrivacyGuardManager.java | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/com/android/settings/cyanogenmod/privacyguard/PrivacyGuardManager.java b/src/com/android/settings/cyanogenmod/privacyguard/PrivacyGuardManager.java index 51942ae..4b49cf5 100644 --- a/src/com/android/settings/cyanogenmod/privacyguard/PrivacyGuardManager.java +++ b/src/com/android/settings/cyanogenmod/privacyguard/PrivacyGuardManager.java @@ -94,6 +94,7 @@ public class PrivacyGuardManager extends Fragment public static final class AppInfo { String title; String packageName; + boolean enabled; boolean privacyGuardEnabled; } @@ -245,14 +246,18 @@ public class PrivacyGuardManager extends Fragment AppInfo app = new AppInfo(); app.title = appInfo.loadLabel(mPm).toString(); app.packageName = info.packageName; + app.enabled = appInfo.enabled; app.privacyGuardEnabled = mPm.getPrivacyGuardSetting(app.packageName); apps.add(app); } - // sort the apps by title + // sort the apps by their enabled state, then by title Collections.sort(apps, new Comparator() { @Override public int compare(AppInfo lhs, AppInfo rhs) { + if (lhs.enabled != rhs.enabled) { + return lhs.enabled ? -1 : 1; + } return lhs.title.compareToIgnoreCase(rhs.title); } }); -- cgit v1.1