From 979a44a0775f809efd3a806fcf60d5f7337e0b31 Mon Sep 17 00:00:00 2001 From: Andreas Shimokawa Date: Sun, 24 Jun 2018 22:05:45 +0200 Subject: [PATCH] Mi Band 2: Grey out "rotate wrist to switch info" when "activate display upon lift" in not enabled in preferences Closes #1124 --- .../devices/miband/MiBandPreferencesActivity.java | 9 +++++---- app/src/main/res/xml/miband_preferences.xml | 3 --- 2 files changed, 5 insertions(+), 7 deletions(-) diff --git a/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/devices/miband/MiBandPreferencesActivity.java b/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/devices/miband/MiBandPreferencesActivity.java index b557dedf1..485dae7aa 100644 --- a/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/devices/miband/MiBandPreferencesActivity.java +++ b/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/devices/miband/MiBandPreferencesActivity.java @@ -151,7 +151,11 @@ public class MiBandPreferencesActivity extends AbstractSettingsActivity { } }); + String displayOnLiftState = prefs.getString(MiBandConst.PREF_ACTIVATE_DISPLAY_ON_LIFT, PREF_MI2_DO_NOT_DISTURB_OFF); + boolean displayOnLiftScheduled = displayOnLiftState.equals(PREF_MI2_DO_NOT_DISTURB_SCHEDULED); + final Preference rotateWristCycleInfo = findPreference(PREF_MI2_ROTATE_WRIST_TO_SWITCH_INFO); + rotateWristCycleInfo.setEnabled(!PREF_MI2_DO_NOT_DISTURB_OFF.equals(displayOnLiftState)); rotateWristCycleInfo.setOnPreferenceChangeListener(new Preference.OnPreferenceChangeListener() { @Override public boolean onPreferenceChange(Preference preference, Object newVal) { @@ -315,9 +319,6 @@ public class MiBandPreferencesActivity extends AbstractSettingsActivity { } }); - String displayOnLiftState = prefs.getString(MiBandConst.PREF_ACTIVATE_DISPLAY_ON_LIFT, PREF_MI2_DO_NOT_DISTURB_OFF); - boolean displayOnLiftScheduled = displayOnLiftState.equals(PREF_MI2_DO_NOT_DISTURB_SCHEDULED); - final Preference displayOnLiftStart = findPreference(PREF_DISPLAY_ON_LIFT_START); displayOnLiftStart.setEnabled(displayOnLiftScheduled); displayOnLiftStart.setOnPreferenceChangeListener(new Preference.OnPreferenceChangeListener() { @@ -358,7 +359,7 @@ public class MiBandPreferencesActivity extends AbstractSettingsActivity { displayOnLiftStart.setEnabled(scheduled); displayOnLiftEnd.setEnabled(scheduled); - + rotateWristCycleInfo.setEnabled(!PREF_MI2_DO_NOT_DISTURB_OFF.equals(newVal.toString())); invokeLater(new Runnable() { @Override public void run() { diff --git a/app/src/main/res/xml/miband_preferences.xml b/app/src/main/res/xml/miband_preferences.xml index 1ce4aec98..9ebefb84e 100644 --- a/app/src/main/res/xml/miband_preferences.xml +++ b/app/src/main/res/xml/miband_preferences.xml @@ -139,20 +139,17 @@