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

Commit 3cf8ef85 authored by Steve Kondik's avatar Steve Kondik Committed by Gerrit Code Review
Browse files

Merge "Add settings for binary amber/green LEDs." into froyo

parents fbbaaf39 c24cff7f
Loading
Loading
Loading
Loading
+12 −0
Original line number Diff line number Diff line
@@ -1043,6 +1043,18 @@
    <string name="notification_pulse_title">Pulse notification light</string>
    <!-- Sound settings screen, notification light repeat pulsing summary -->
    <string name="notification_pulse_summary">Pulse trackball light repeatedly for new notifications</string>
    <!-- Display settings screen, notification light repeat blinking title -->
    <string name="notification_blink_title">Blink notification light</string>
    <!-- Display settings screen, notification light repeat blinking summary -->
    <string name="notification_blink_summary">Blink the green notifications repeatedly</string>
    <!-- Display settings screen, notification light always on title -->
    <string name="notification_always_on_title">Always enable notification light</string>
    <!-- Display settings screen, notification light always on summary -->
    <string name="notification_always_on_summary">Enable notification light while screen is on</string>
    <!-- Display settings screen, notification light while charging title -->
    <string name="notification_charging_title">Charging light</string>
    <!-- Display settings screen, notification light while charging summary -->
    <string name="notification_charging_summary">Enable the amber light while charging</string>
    <!-- Sound settings screen, the title of the volume bar to adjust the incoming call volume -->
    <string name="incoming_call_volume_title">Ringtone</string>
    <!-- Sound settings screen, the title of the volume bar to adjust the notification volume -->
+18 −0
Original line number Diff line number Diff line
@@ -75,6 +75,24 @@
            android:summary="@string/notification_pulse_summary"
            android:persistent="false" />

    <CheckBoxPreference
            android:key="notification_blink"
            android:title="@string/notification_blink_title"
            android:summary="@string/notification_blink_summary"
            android:persistent="false" />

    <CheckBoxPreference
            android:key="notification_always_on"
            android:title="@string/notification_always_on_title"
            android:summary="@string/notification_always_on_summary"
            android:persistent="false" />

    <CheckBoxPreference
            android:key="notification_charging"
            android:title="@string/notification_charging_title"
            android:summary="@string/notification_charging_summary"
            android:persistent="false" />

    <PreferenceCategory
            android:title="@string/sound_category_feedback_title"/>

+69 −8
Original line number Diff line number Diff line
@@ -55,6 +55,9 @@ public class SoundSettings extends PreferenceActivity implements
    private static final String KEY_EMERGENCY_TONE = "emergency_tone";
    private static final String KEY_SOUND_SETTINGS = "sound_settings";
    private static final String KEY_NOTIFICATION_PULSE = "notification_pulse";
    private static final String KEY_NOTIFICATION_BLINK = "notification_blink";
    private static final String KEY_NOTIFICATION_ALWAYS_ON = "notification_always_on";
    private static final String KEY_NOTIFICATION_CHARGING = "notification_charging";
    private static final String KEY_LOCK_SOUNDS = "lock_sounds";

    private static final String VALUE_VIBRATE_NEVER = "never";
@@ -76,6 +79,9 @@ public class SoundSettings extends PreferenceActivity implements
    private CheckBoxPreference mSoundEffects;
    private CheckBoxPreference mHapticFeedback;
    private CheckBoxPreference mNotificationPulse;
    private CheckBoxPreference mNotificationBlink;
    private CheckBoxPreference mNotificationAlwaysOn;
    private CheckBoxPreference mNotificationCharging;
    private CheckBoxPreference mLockSounds;

    private AudioManager mAudioManager;
@@ -139,6 +145,46 @@ public class SoundSettings extends PreferenceActivity implements
        mSoundSettings = (PreferenceGroup) findPreference(KEY_SOUND_SETTINGS);
        mNotificationPulse = (CheckBoxPreference)
                mSoundSettings.findPreference(KEY_NOTIFICATION_PULSE);
        mNotificationBlink = (CheckBoxPreference)
                mSoundSettings.findPreference(KEY_NOTIFICATION_BLINK);
        mNotificationAlwaysOn = (CheckBoxPreference)
                mSoundSettings.findPreference(KEY_NOTIFICATION_ALWAYS_ON);
        mNotificationCharging = (CheckBoxPreference)
                mSoundSettings.findPreference(KEY_NOTIFICATION_CHARGING);

        boolean amberGreenLight = getResources().getBoolean(
                com.android.internal.R.bool.config_amber_green_light);

        if (amberGreenLight) {
            mSoundSettings.removePreference(mNotificationPulse);

            try {
                mNotificationBlink.setChecked(Settings.System.getInt(resolver,
                        Settings.System.NOTIFICATION_LIGHT_BLINK) == 1);
                mNotificationBlink.setOnPreferenceChangeListener(this);
            } catch (SettingNotFoundException snfe) {
                Log.e(TAG, Settings.System.NOTIFICATION_LIGHT_BLINK + " not found");
            }
            try {
                mNotificationAlwaysOn.setChecked(Settings.System.getInt(resolver,
                        Settings.System.NOTIFICATION_LIGHT_ALWAYS_ON) == 1);
                mNotificationAlwaysOn.setOnPreferenceChangeListener(this);
            } catch (SettingNotFoundException snfe) {
                Log.e(TAG, Settings.System.NOTIFICATION_LIGHT_ALWAYS_ON + " not found");
            }
            try {
                mNotificationCharging.setChecked(Settings.System.getInt(resolver,
                        Settings.System.NOTIFICATION_LIGHT_CHARGING) == 1);
                mNotificationCharging.setOnPreferenceChangeListener(this);
            } catch (SettingNotFoundException snfe) {
                Log.e(TAG, Settings.System.NOTIFICATION_LIGHT_CHARGING + " not found");
            }

        } else {
            mSoundSettings.removePreference(mNotificationBlink);
            mSoundSettings.removePreference(mNotificationAlwaysOn);
            mSoundSettings.removePreference(mNotificationCharging);

            if (mNotificationPulse != null &&
                    getResources().getBoolean(R.bool.has_intrusive_led) == false) {
                mSoundSettings.removePreference(mNotificationPulse);
@@ -151,6 +197,7 @@ public class SoundSettings extends PreferenceActivity implements
                    Log.e(TAG, Settings.System.NOTIFICATION_LIGHT_PULSE + " not found");
                }
            }
        }

    }

@@ -312,8 +359,22 @@ public class SoundSettings extends PreferenceActivity implements
            boolean value = mNotificationPulse.isChecked();
            Settings.System.putInt(getContentResolver(),
                    Settings.System.NOTIFICATION_LIGHT_PULSE, value ? 1 : 0);
        }

        } else if (preference == mNotificationBlink) {
            boolean value = mNotificationBlink.isChecked();
            Settings.System.putInt(getContentResolver(),
                    Settings.System.NOTIFICATION_LIGHT_BLINK, value ? 1 : 0);

        } else if (preference == mNotificationAlwaysOn) {
            boolean value = mNotificationAlwaysOn.isChecked();
            Settings.System.putInt(getContentResolver(),
                    Settings.System.NOTIFICATION_LIGHT_ALWAYS_ON, value ? 1 : 0);

        } else if (preference == mNotificationCharging) {
            boolean value = mNotificationCharging.isChecked();
            Settings.System.putInt(getContentResolver(),
                    Settings.System.NOTIFICATION_LIGHT_CHARGING, value ? 1 : 0);
        }
        return true;
    }