Disable power button pref in UI
This commit is contained in:
parent
cbead067b7
commit
b7820fdbcd
2 changed files with 3 additions and 1 deletions
|
@ -58,6 +58,7 @@
|
||||||
<net.osmand.plus.settings.preferences.SwitchPreferenceEx
|
<net.osmand.plus.settings.preferences.SwitchPreferenceEx
|
||||||
android:key="turn_screen_on_power_button"
|
android:key="turn_screen_on_power_button"
|
||||||
android:layout="@layout/preference_with_descr_dialog_and_switch"
|
android:layout="@layout/preference_with_descr_dialog_and_switch"
|
||||||
|
android:persistent="false"
|
||||||
android:summaryOff="@string/shared_string_disabled"
|
android:summaryOff="@string/shared_string_disabled"
|
||||||
android:summaryOn="@string/shared_string_enabled"
|
android:summaryOn="@string/shared_string_enabled"
|
||||||
android:title="@string/turn_screen_on_power_button" />
|
android:title="@string/turn_screen_on_power_button" />
|
||||||
|
|
|
@ -97,11 +97,12 @@ public class TurnScreenOnFragment extends BaseSettingsFragment implements OnPref
|
||||||
|
|
||||||
private void setupTurnScreenOnPowerButtonPref() {
|
private void setupTurnScreenOnPowerButtonPref() {
|
||||||
ApplicationMode appMode = getSelectedAppMode();
|
ApplicationMode appMode = getSelectedAppMode();
|
||||||
boolean enabled = settings.TURN_SCREEN_ON_TIME_INT.getModeValue(appMode) == 0 || settings.USE_SYSTEM_SCREEN_TIMEOUT.getModeValue(appMode);
|
boolean enabled = settings.TURN_SCREEN_ON_TIME_INT.get() == 0 || settings.USE_SYSTEM_SCREEN_TIMEOUT.get();
|
||||||
SwitchPreferenceEx turnScreenOnPowerButton = (SwitchPreferenceEx) findPreference(settings.TURN_SCREEN_ON_POWER_BUTTON.getId());
|
SwitchPreferenceEx turnScreenOnPowerButton = (SwitchPreferenceEx) findPreference(settings.TURN_SCREEN_ON_POWER_BUTTON.getId());
|
||||||
turnScreenOnPowerButton.setEnabled(enabled);
|
turnScreenOnPowerButton.setEnabled(enabled);
|
||||||
turnScreenOnPowerButton.setDescription(R.string.turn_screen_on_power_button_descr);
|
turnScreenOnPowerButton.setDescription(R.string.turn_screen_on_power_button_descr);
|
||||||
turnScreenOnPowerButton.setIcon(getPersistentPrefIcon(R.drawable.ic_action_power_button));
|
turnScreenOnPowerButton.setIcon(getPersistentPrefIcon(R.drawable.ic_action_power_button));
|
||||||
|
turnScreenOnPowerButton.setChecked(enabled && settings.TURN_SCREEN_ON_POWER_BUTTON.getModeValue(appMode));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
Loading…
Reference in a new issue