summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMichael W <baddaemon87@gmail.com>2018-04-16 19:07:10 (GMT)
committerMichael W <baddaemon87@gmail.com>2018-04-16 19:07:10 (GMT)
commit84853ab563f3276098b0226857ec88325a1bee2d (patch)
treefc9be8d6d43ac0e4b6d5c7ab076cfd4b7bc0ed77
parent1e78f070ddeff35ce557f9ce6b08de515f54141a (diff)
downloadpackages_apps_Settings-84853ab563f3276098b0226857ec88325a1bee2d.zip
packages_apps_Settings-84853ab563f3276098b0226857ec88325a1bee2d.tar.gz
packages_apps_Settings-84853ab563f3276098b0226857ec88325a1bee2d.tar.bz2
Settings: Fix notification light app hint
* The old code doesn't work when the entry in the database is not available, because it will cause parsePackageList() to return false, resulting in no execution of the code taking care of displaying the hint * Move the hint to a new function and call it at the appropriate places to display the hint when no entry to the database was ever made Thanks to @mikeioannina for noticing the missing hint Change-Id: Ie3fb39cfa7e7b04a3536f98e93e2168d7367961d
-rw-r--r--src/com/android/settings/notificationlight/NotificationLightSettings.java28
1 files changed, 17 insertions, 11 deletions
diff --git a/src/com/android/settings/notificationlight/NotificationLightSettings.java b/src/com/android/settings/notificationlight/NotificationLightSettings.java
index 3b02d36..f0b546a 100644
--- a/src/com/android/settings/notificationlight/NotificationLightSettings.java
+++ b/src/com/android/settings/notificationlight/NotificationLightSettings.java
@@ -276,6 +276,7 @@ public class NotificationLightSettings extends SettingsPreferenceFragment implem
Context context = getActivity();
if (!parsePackageList()) {
+ maybeDisplayApplicationHint(context);
return;
}
@@ -302,17 +303,22 @@ public class NotificationLightSettings extends SettingsPreferenceFragment implem
}
}
- /* Display a pref explaining how to add apps */
- if (mApplicationPrefList.getPreferenceCount() == 0) {
- String summary = getResources().getString(
- R.string.notification_light_no_apps_summary);
- String useCustom = getResources().getString(
- R.string.notification_light_use_custom);
- Preference pref = new Preference(context);
- pref.setSummary(String.format(summary, useCustom));
- pref.setEnabled(false);
- mApplicationPrefList.addPreference(pref);
- }
+ maybeDisplayApplicationHint(context);
+ }
+ }
+
+ private void maybeDisplayApplicationHint(Context context)
+ {
+ /* Display a pref explaining how to add apps */
+ if (mApplicationPrefList != null && mApplicationPrefList.getPreferenceCount() == 0) {
+ String summary = getResources().getString(
+ R.string.notification_light_no_apps_summary);
+ String useCustom = getResources().getString(
+ R.string.notification_light_use_custom);
+ Preference pref = new Preference(context);
+ pref.setSummary(String.format(summary, useCustom));
+ pref.setEnabled(false);
+ mApplicationPrefList.addPreference(pref);
}
}