OmniGears: support for devices without notification LED configs

Hide useless options for devices that only have a single color
led and also dont allow changing the blinking frequency
e.g. find7

Change-Id: Id87dd7a0caf802c6ee0817b0b937cb0c1d94252e
diff --git a/res/values/config.xml b/res/values/config.xml
index 07f9d3f..e89dca1 100644
--- a/res/values/config.xml
+++ b/res/values/config.xml
@@ -30,4 +30,7 @@
     <!-- Whether device has hardware buttons -->
     <bool name="config_has_hardware_buttons">false</bool>
 
+    <!-- does the device supports different notification led configs
+    e.g. color and pulse frequency or just a single -->
+    <bool name="config_notificationLedConfig">true</bool>
 </resources>
diff --git a/res/xml/notification_light_settings.xml b/res/xml/notification_light_settings.xml
index f38f4f0..4ffebf7 100644
--- a/res/xml/notification_light_settings.xml
+++ b/res/xml/notification_light_settings.xml
@@ -29,7 +29,8 @@
         <CheckBoxPreference
             android:key="notification_light_screen_on"
             android:title="@string/notification_light_screen_on_title"
-            android:persistent="false" />
+            android:persistent="false"
+            android:dependency="notification_light_pulse" />
 
         <org.omnirom.omnigears.notificationlight.ApplicationLightPreference
             android:key="default"
diff --git a/src/org/omnirom/omnigears/notificationlight/NotificationLightSettings.java b/src/org/omnirom/omnigears/notificationlight/NotificationLightSettings.java
index 44031ba..c0c3285 100644
--- a/src/org/omnirom/omnigears/notificationlight/NotificationLightSettings.java
+++ b/src/org/omnirom/omnigears/notificationlight/NotificationLightSettings.java
@@ -104,6 +104,7 @@
     private PackageAdapter mPackageAdapter;
     private String mPackageList;
     private Map<String, Package> mPackages;
+    private boolean mNotificationPulseConfig = true;
 
     @Override
     public void onCreate(Bundle savedInstanceState) {
@@ -119,6 +120,7 @@
                 com.android.internal.R.integer.config_defaultNotificationLedOff);
         mNotificationPulseEnabled = resources.getBoolean(
                 com.android.internal.R.bool.config_intrusiveNotificationLed);
+        mNotificationPulseConfig = resources.getBoolean(R.bool.config_notificationLedConfig);
 
         mEnabledPref = (SwitchPreference)
                 findPreference(Settings.System.NOTIFICATION_LIGHT_PULSE);
@@ -160,7 +162,15 @@
 
         mPackages = new HashMap<String, Package>();
 
-        setHasOptionsMenu(true);
+        if (!mNotificationPulseConfig) {
+            removePreference("phone_list");
+            removePreference("applications_list");
+            PreferenceGroup generalGroup = (PreferenceGroup) findPreference("general_section");
+            generalGroup.removePreference(mDefaultPref);
+            removePreference(Settings.System.NOTIFICATION_LIGHT_PULSE_CUSTOM_ENABLE);
+        } else {
+            setHasOptionsMenu(true);
+        }
     }
 
     @Override
@@ -205,9 +215,6 @@
 
             mVoicemailPref.setAllValues(vmailColor, vmailTimeOn, vmailTimeOff);
         }
-
-        mApplicationPrefList = (PreferenceGroup) findPreference("applications_list");
-        mApplicationPrefList.setOrderingAsAdded(false);
     }
 
     private void refreshCustomApplicationPrefs() {