Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 8331303f authored by Gabriele M's avatar Gabriele M Committed by Gerrit Code Review
Browse files

Settings: Always enable the per-app pulse light settings

All the per-app light settings, including the pulse light settings,
were made dependent on config_multiColorNotificationLed.

The code to enable the notification color settings depending on the
value of config_multiColorNotificationLed is already in place, so
enable the advanced light settings unconditionally.

Change-Id: Ie396f5e6e190c6d3f08c83dd0b38b038f0653b85
parent 050c08bd
Loading
Loading
Loading
Loading
+6 −27
Original line number Diff line number Diff line
@@ -67,8 +67,6 @@ public class NotificationLightSettings extends SettingsPreferenceFragment implem
    private static final int MENU_ADD = 0;
    private static final int DIALOG_APPS = 0;

    private boolean mAdjustableNotificationLedBrightness;
    private boolean mMultiColorNotificationLed;
    private int mDefaultColor;
    private int mDefaultLedOn;
    private int mDefaultLedOff;
@@ -95,14 +93,7 @@ public class NotificationLightSettings extends SettingsPreferenceFragment implem
        PreferenceScreen prefSet = getPreferenceScreen();
        Resources resources = getResources();

        PreferenceGroup mGeneralPrefs = (PreferenceGroup) prefSet.findPreference("general_section");
        PreferenceGroup mAdvancedPrefs = (PreferenceGroup) prefSet.findPreference("advanced_section");
        PreferenceGroup mPhonePrefs = (PreferenceGroup) prefSet.findPreference("phone_list");

        mAdjustableNotificationLedBrightness = resources.getBoolean(
                org.cyanogenmod.platform.internal.R.bool.config_adjustableNotificationLedBrightness);
        mMultiColorNotificationLed = resources.getBoolean(
                com.android.internal.R.bool.config_multiColorNotificationLed);

        // Get the system defined default notification color
        mDefaultColor = resources.getColor(com.android.internal.R.color.config_defaultNotificationColor);
@@ -134,7 +125,8 @@ public class NotificationLightSettings extends SettingsPreferenceFragment implem
        mCustomEnabledPref = (CMSystemSettingSwitchPreference)
                findPreference(CMSettings.System.NOTIFICATION_LIGHT_PULSE_CUSTOM_ENABLE);
        mCustomEnabledPref.setOnPreferenceChangeListener(this);
        if (!mAdjustableNotificationLedBrightness) {
        if (!resources.getBoolean(
                org.cyanogenmod.platform.internal.R.bool.config_adjustableNotificationLedBrightness)) {
            mAdvancedPrefs.removePreference(mNotificationLedBrightnessPref);
        } else {
            mNotificationLedBrightnessPref.setOnPreferenceChangeListener(this);
@@ -166,13 +158,9 @@ public class NotificationLightSettings extends SettingsPreferenceFragment implem
        mPackageAdapter = new PackageListAdapter(getActivity());

        mPackages = new HashMap<String, Package>();

        if (mMultiColorNotificationLed) {
        setHasOptionsMenu(true);
        } else {
            mAdvancedPrefs.removePreference(mCustomEnabledPref);
            prefSet.removePreference(mPhonePrefs);
            prefSet.removePreference(mApplicationPrefList);

        if (!resources.getBoolean(com.android.internal.R.bool.config_multiColorNotificationLed)) {
            resetColors();
        }
    }
@@ -254,11 +242,9 @@ public class NotificationLightSettings extends SettingsPreferenceFragment implem
            mVoicemailPref.setAllValues(vmailColor, vmailTimeOn, vmailTimeOff);
        }

        if (mMultiColorNotificationLed) {
        mApplicationPrefList = (PreferenceGroup) findPreference("applications_list");
        mApplicationPrefList.setOrderingAsAdded(false);
    }
    }

    private void refreshCustomApplicationPrefs() {
        Context context = getActivity();
@@ -398,13 +384,6 @@ public class NotificationLightSettings extends SettingsPreferenceFragment implem
        CMSettings.System.putInt(resolver, CMSettings.System.NOTIFICATION_LIGHT_PULSE_CALL_COLOR, mDefaultColor);
        CMSettings.System.putInt(resolver, CMSettings.System.NOTIFICATION_LIGHT_PULSE_VMAIL_COLOR, mDefaultColor);

        // Reset to the framework default custom pulse length & speed
        CMSettings.System.putInt(resolver, CMSettings.System.NOTIFICATION_LIGHT_PULSE_CALL_LED_ON, mDefaultLedOn);
        CMSettings.System.putInt(resolver, CMSettings.System.NOTIFICATION_LIGHT_PULSE_CALL_LED_OFF, mDefaultLedOff);

        CMSettings.System.putInt(resolver, CMSettings.System.NOTIFICATION_LIGHT_PULSE_VMAIL_LED_ON, mDefaultLedOn);
        CMSettings.System.putInt(resolver, CMSettings.System.NOTIFICATION_LIGHT_PULSE_VMAIL_LED_OFF, mDefaultLedOff);

        refreshDefault();
    }