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

Commit 224d27a4 authored by Dave Kessler's avatar Dave Kessler Committed by Steve Kondik
Browse files

Power Menu: remove power as an option

This is the only way to power the device off. Also, if the user
toggles all the options off an empty dialog will open.  Lets make
this feature a little more user-friendly and remove power as an
optional entry.

Change-Id: I10b2d7c844fa40ae9583d3114ec99b0825c21cd9
parent bb8ed7d3
Loading
Loading
Loading
Loading
+0 −1
Original line number Diff line number Diff line
@@ -181,7 +181,6 @@

    <!-- Power menu -->
    <string name="power_menu_title">Power menu</string>
    <string name="power_menu_power_title">Power off</string>
    <string name="power_menu_reboot_title">Reboot menu</string>
    <string name="power_menu_screenshot_title">Screenshot</string>
    <string name="power_menu_profiles_title">Profile switcher</string>
+0 −5
Original line number Diff line number Diff line
@@ -19,11 +19,6 @@
    android:title="@string/power_menu_title"
    xmlns:settings="http://schemas.android.com/apk/res/com.android.settings">

    <CheckBoxPreference
        android:key="power"
        android:title="@string/power_menu_power_title"
        android:defaultValue="true" />

    <CheckBoxPreference
        android:key="reboot"
        android:title="@string/power_menu_reboot_title"
+2 −13
Original line number Diff line number Diff line
@@ -44,7 +44,6 @@ import java.util.List;
public class PowerMenuActions extends SettingsPreferenceFragment {
    final static String TAG = "PowerMenuActions";

    private CheckBoxPreference mPowerPref;
    private CheckBoxPreference mRebootPref;
    private CheckBoxPreference mScreenshotPref;
    private CheckBoxPreference mProfilePref;
@@ -78,9 +77,7 @@ public class PowerMenuActions extends SettingsPreferenceFragment {
                continue;
            }

            if (action.equals(GLOBAL_ACTION_KEY_POWER)) {
                mPowerPref = (CheckBoxPreference) findPreference(GLOBAL_ACTION_KEY_POWER);
            } else if (action.equals(GLOBAL_ACTION_KEY_REBOOT)) {
            if (action.equals(GLOBAL_ACTION_KEY_REBOOT)) {
                mRebootPref = (CheckBoxPreference) findPreference(GLOBAL_ACTION_KEY_REBOOT);
            } else if (action.equals(GLOBAL_ACTION_KEY_SCREENSHOT)) {
                mScreenshotPref = (CheckBoxPreference) findPreference(GLOBAL_ACTION_KEY_SCREENSHOT);
@@ -108,10 +105,6 @@ public class PowerMenuActions extends SettingsPreferenceFragment {
    public void onStart() {
        super.onStart();

        if (mPowerPref != null) {
            mPowerPref.setChecked(settingsArrayContains(GLOBAL_ACTION_KEY_POWER));
        }

        if (mRebootPref != null) {
            mRebootPref.setChecked(settingsArrayContains(GLOBAL_ACTION_KEY_REBOOT));
        }
@@ -169,11 +162,7 @@ public class PowerMenuActions extends SettingsPreferenceFragment {
    public boolean onPreferenceTreeClick(PreferenceScreen preferenceScreen, Preference preference) {
        boolean value;

        if (preference == mPowerPref) {
            value = mPowerPref.isChecked();
            updateUserConfig(value, GLOBAL_ACTION_KEY_POWER);

        } else if (preference == mRebootPref) {
        if (preference == mRebootPref) {
            value = mRebootPref.isChecked();
            updateUserConfig(value, GLOBAL_ACTION_KEY_REBOOT);