OSDN Git Service

Add explanation for customizing apps
authorMichael W <baddaemon87@gmail.com>
Wed, 6 Apr 2016 22:59:38 +0000 (00:59 +0200)
committerGerrit Code Review <gerrit@cyanogenmod.org>
Thu, 7 Apr 2016 20:08:21 +0000 (13:08 -0700)
Settings->Display & LEDs->Notification light->Apps

Currently this is header only if no apps are added yet.
Populate it with an explanation when it's empty.

Change-Id: I83193dfdd01f05bcd1d597033ef710a1b0eb7e82

res/values/cm_strings.xml
src/com/android/settings/notificationlight/NotificationLightSettings.java

index 44c7548..a390a9a 100644 (file)
     <!-- Lights settings, LED notification -->
     <string name="led_notification_title">Light settings</string>
     <string name="led_notification_text">LED light enabled by settings</string>
+    <string name="notification_light_no_apps_summary">To add per app control, activate \'%1$s\' and press \'\u002b\' on the menu bar</string>
 
     <!-- Setting checkbox title for Whether to enable Android debugging support on the phone. -->
     <string name="enable_adb_cm">Android debugging</string>
index 95a354d..c4b55d4 100644 (file)
@@ -284,6 +284,18 @@ public class NotificationLightSettings extends SettingsPreferenceFragment implem
                     // Do nothing
                 }
             }
+
+            /* Display a pref explaining how to add apps */
+            if (mPackages.size() == 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);
+            }
         }
     }