From b7820fdbcd650706e62953e4112ad801f4627a7d Mon Sep 17 00:00:00 2001 From: Vitaliy Date: Fri, 29 May 2020 20:16:13 +0300 Subject: [PATCH] Disable power button pref in UI --- OsmAnd/res/xml/turn_screen_on.xml | 1 + .../osmand/plus/settings/fragments/TurnScreenOnFragment.java | 3 ++- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/OsmAnd/res/xml/turn_screen_on.xml b/OsmAnd/res/xml/turn_screen_on.xml index 94b0242ba8..e7a5508d01 100644 --- a/OsmAnd/res/xml/turn_screen_on.xml +++ b/OsmAnd/res/xml/turn_screen_on.xml @@ -58,6 +58,7 @@ diff --git a/OsmAnd/src/net/osmand/plus/settings/fragments/TurnScreenOnFragment.java b/OsmAnd/src/net/osmand/plus/settings/fragments/TurnScreenOnFragment.java index 96631cbfd3..28deeb65af 100644 --- a/OsmAnd/src/net/osmand/plus/settings/fragments/TurnScreenOnFragment.java +++ b/OsmAnd/src/net/osmand/plus/settings/fragments/TurnScreenOnFragment.java @@ -97,11 +97,12 @@ public class TurnScreenOnFragment extends BaseSettingsFragment implements OnPref private void setupTurnScreenOnPowerButtonPref() { 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()); turnScreenOnPowerButton.setEnabled(enabled); turnScreenOnPowerButton.setDescription(R.string.turn_screen_on_power_button_descr); turnScreenOnPowerButton.setIcon(getPersistentPrefIcon(R.drawable.ic_action_power_button)); + turnScreenOnPowerButton.setChecked(enabled && settings.TURN_SCREEN_ON_POWER_BUTTON.getModeValue(appMode)); } @Override