diff --git a/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/activities/AbstractPreferenceFragment.java b/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/activities/AbstractPreferenceFragment.java index bf1e5ae2b..07b4de95e 100644 --- a/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/activities/AbstractPreferenceFragment.java +++ b/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/activities/AbstractPreferenceFragment.java @@ -29,7 +29,7 @@ import androidx.preference.PreferenceFragmentCompat; import androidx.preference.PreferenceGroup; import androidx.preference.PreferenceScreen; import androidx.preference.SeekBarPreference; -import androidx.preference.SwitchPreference; +import androidx.preference.SwitchPreferenceCompat; import com.mobeta.android.dslv.DragSortListPreference; import com.mobeta.android.dslv.DragSortListPreferenceFragment; @@ -183,8 +183,8 @@ public abstract class AbstractPreferenceFragment extends PreferenceFragmentCompa if (preference instanceof SeekBarPreference) { final SeekBarPreference seekBarPreference = (SeekBarPreference) preference; seekBarPreference.setValue(prefs.getInt(key, seekBarPreference.getValue())); - } else if (preference instanceof SwitchPreference) { - final SwitchPreference switchPreference = (SwitchPreference) preference; + } else if (preference instanceof SwitchPreferenceCompat) { + final SwitchPreferenceCompat switchPreference = (SwitchPreferenceCompat) preference; switchPreference.setChecked(prefs.getBoolean(key, switchPreference.isChecked())); } else if (preference instanceof ListPreference) { final ListPreference listPreference = (ListPreference) preference; diff --git a/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/capabilities/HeartRateCapability.java b/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/capabilities/HeartRateCapability.java index c855c6203..6fd390d25 100644 --- a/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/capabilities/HeartRateCapability.java +++ b/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/capabilities/HeartRateCapability.java @@ -28,7 +28,7 @@ import android.content.Context; import androidx.preference.ListPreference; import androidx.preference.Preference; -import androidx.preference.SwitchPreference; +import androidx.preference.SwitchPreferenceCompat; import java.util.List; @@ -109,9 +109,9 @@ public class HeartRateCapability { heartrateMeasurementInterval.setEntries(entries); heartrateMeasurementInterval.setEntryValues(values); - final SwitchPreference activityMonitoring = handler.findPreference(PREF_HEARTRATE_ACTIVITY_MONITORING); - final SwitchPreference heartrateAlertEnabled = handler.findPreference(PREF_HEARTRATE_ALERT_ENABLED); - final SwitchPreference stressMonitoring = handler.findPreference(PREF_HEARTRATE_STRESS_MONITORING); + final SwitchPreferenceCompat activityMonitoring = handler.findPreference(PREF_HEARTRATE_ACTIVITY_MONITORING); + final SwitchPreferenceCompat heartrateAlertEnabled = handler.findPreference(PREF_HEARTRATE_ALERT_ENABLED); + final SwitchPreferenceCompat stressMonitoring = handler.findPreference(PREF_HEARTRATE_STRESS_MONITORING); heartrateMeasurementInterval.setOnPreferenceChangeListener(new Preference.OnPreferenceChangeListener() { public boolean onPreferenceChange(final Preference preference, final Object newVal) { diff --git a/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/devices/qhybrid/HybridHRWatchfaceSettingsActivity.java b/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/devices/qhybrid/HybridHRWatchfaceSettingsActivity.java index fd72ab140..8e43162ee 100644 --- a/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/devices/qhybrid/HybridHRWatchfaceSettingsActivity.java +++ b/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/devices/qhybrid/HybridHRWatchfaceSettingsActivity.java @@ -25,7 +25,7 @@ import androidx.preference.EditTextPreference; import androidx.preference.ListPreference; import androidx.preference.Preference; import androidx.preference.PreferenceFragmentCompat; -import androidx.preference.SwitchPreference; +import androidx.preference.SwitchPreferenceCompat; import nodomain.freeyourgadget.gadgetbridge.R; import nodomain.freeyourgadget.gadgetbridge.activities.AbstractPreferenceFragment; @@ -99,7 +99,7 @@ public class HybridHRWatchfaceSettingsActivity extends AbstractSettingsActivityV refresh_partial.setSummary(Integer.toString(settings.getDisplayTimeoutPartial())); setInputTypeFor("pref_hybridhr_watchface_refresh_partial", InputType.TYPE_CLASS_NUMBER); - SwitchPreference wrist_flick_relative = findPreference("pref_hybridhr_watchface_wrist_flick_relative"); + SwitchPreferenceCompat wrist_flick_relative = findPreference("pref_hybridhr_watchface_wrist_flick_relative"); wrist_flick_relative.setOnPreferenceChangeListener(this); wrist_flick_relative.setChecked(settings.isWristFlickHandsMoveRelative()); @@ -136,15 +136,15 @@ public class HybridHRWatchfaceSettingsActivity extends AbstractSettingsActivityV move_hands.setValue(settings.getMoveHandsEvent()); move_hands.setSummary(move_hands.getEntry()); - SwitchPreference power_saving_display = findPreference("pref_hybridhr_watchface_power_saving_display"); + SwitchPreferenceCompat power_saving_display = findPreference("pref_hybridhr_watchface_power_saving_display"); power_saving_display.setOnPreferenceChangeListener(this); power_saving_display.setChecked(settings.getPowersaveDisplay()); - SwitchPreference power_saving_hands = findPreference("pref_hybridhr_watchface_power_saving_hands"); + SwitchPreferenceCompat power_saving_hands = findPreference("pref_hybridhr_watchface_power_saving_hands"); power_saving_hands.setOnPreferenceChangeListener(this); power_saving_hands.setChecked(settings.getPowersaveHands()); - SwitchPreference light_up_on_notification = findPreference("pref_hybridhr_watchface_light_up_on_notification"); + SwitchPreferenceCompat light_up_on_notification = findPreference("pref_hybridhr_watchface_light_up_on_notification"); light_up_on_notification.setOnPreferenceChangeListener(this); light_up_on_notification.setChecked(settings.getLightUpOnNotification()); } diff --git a/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/devices/qhybrid/HybridHRWatchfaceWidgetActivity.java b/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/devices/qhybrid/HybridHRWatchfaceWidgetActivity.java index e7bdfbc35..a8fca2b59 100644 --- a/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/devices/qhybrid/HybridHRWatchfaceWidgetActivity.java +++ b/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/devices/qhybrid/HybridHRWatchfaceWidgetActivity.java @@ -26,7 +26,7 @@ import androidx.preference.ListPreference; import androidx.preference.Preference; import androidx.preference.PreferenceCategory; import androidx.preference.PreferenceFragmentCompat; -import androidx.preference.SwitchPreference; +import androidx.preference.SwitchPreferenceCompat; import java.util.LinkedHashMap; import java.util.TimeZone; @@ -173,11 +173,11 @@ public class HybridHRWatchfaceWidgetActivity extends AbstractSettingsActivityV2 customWidgetTimeout.setSummary(Integer.toString(widget.getExtraConfigInt("update_timeout", WIDGET_CUSTOM_DEFAULT_TIMEOUT))); setInputTypeFor("pref_hybridhr_widget_custom_timeout", InputType.TYPE_CLASS_NUMBER); - SwitchPreference customWidgetHideText = findPreference("pref_hybridhr_widget_custom_hide_text"); + SwitchPreferenceCompat customWidgetHideText = findPreference("pref_hybridhr_widget_custom_hide_text"); customWidgetHideText.setOnPreferenceChangeListener(this); customWidgetHideText.setChecked(widget.getExtraConfigBoolean("timeout_hide_text", WIDGET_CUSTOM_DEFAULT_HIDE_TEXT)); - SwitchPreference customWidgetShowCircle = findPreference("pref_hybridhr_widget_custom_show_circle"); + SwitchPreferenceCompat customWidgetShowCircle = findPreference("pref_hybridhr_widget_custom_show_circle"); customWidgetShowCircle.setOnPreferenceChangeListener(this); customWidgetShowCircle.setChecked(widget.getExtraConfigBoolean("timeout_show_circle", WIDGET_CUSTOM_DEFAULT_SHOW_CIRCLE)); } diff --git a/app/src/main/res/layout/preference_material_switch.xml b/app/src/main/res/layout/preference_material_switch.xml new file mode 100644 index 000000000..af3272ec5 --- /dev/null +++ b/app/src/main/res/layout/preference_material_switch.xml @@ -0,0 +1,10 @@ + + + + \ No newline at end of file diff --git a/app/src/main/res/values/styles.xml b/app/src/main/res/values/styles.xml index 303953358..efbac57ed 100644 --- a/app/src/main/res/values/styles.xml +++ b/app/src/main/res/values/styles.xml @@ -18,6 +18,7 @@ @style/GadgetbridgeTheme.DrawerButtonStyle @style/GadgetbridgeTheme.NavigationButtonStyle @style/GadgetbridgeTheme.OverflowMenuButton + @style/AppPreferenceThemeOverlay ?attr/colorPrimaryDark @android:color/white @@ -51,6 +52,7 @@ @style/GadgetbridgeTheme.DrawerButtonStyle @style/GadgetbridgeTheme.NavigationButtonStyle @style/GadgetbridgeTheme.OverflowMenuButton + @style/AppPreferenceThemeOverlay ?attr/colorPrimaryDark @android:color/white @@ -84,6 +86,7 @@ ?attr/colorOnSurface ?attr/colorSecondaryContainer ?attr/colorSurface + @style/AppPreferenceThemeOverlay + + + + diff --git a/app/src/main/res/xml/charts_preferences.xml b/app/src/main/res/xml/charts_preferences.xml index 17eb110df..8d12ffa0a 100644 --- a/app/src/main/res/xml/charts_preferences.xml +++ b/app/src/main/res/xml/charts_preferences.xml @@ -24,7 +24,7 @@ app:iconSpaceReserved="false" app:useSimpleSummaryProvider="true" /> - - - - - - - diff --git a/app/src/main/res/xml/devicesettings_antilost.xml b/app/src/main/res/xml/devicesettings_antilost.xml index a4c9dc705..491daf709 100644 --- a/app/src/main/res/xml/devicesettings_antilost.xml +++ b/app/src/main/res/xml/devicesettings_antilost.xml @@ -1,6 +1,6 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/app/src/main/res/xml/devicesettings_inactivity.xml b/app/src/main/res/xml/devicesettings_inactivity.xml index a5cddd42c..55f33896b 100644 --- a/app/src/main/res/xml/devicesettings_inactivity.xml +++ b/app/src/main/res/xml/devicesettings_inactivity.xml @@ -7,7 +7,7 @@ android:summary="@string/mi2_prefs_inactivity_warnings_summary" android:title="@string/mi2_prefs_inactivity_warnings"> - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/app/src/main/res/xml/devicesettings_wena3.xml b/app/src/main/res/xml/devicesettings_wena3.xml index 549a3b20c..914770bef 100644 --- a/app/src/main/res/xml/devicesettings_wena3.xml +++ b/app/src/main/res/xml/devicesettings_wena3.xml @@ -3,7 +3,7 @@ - - - - - - - diff --git a/app/src/main/res/xml/devicesettings_workout_detection.xml b/app/src/main/res/xml/devicesettings_workout_detection.xml index 3b58eb98c..00930b394 100644 --- a/app/src/main/res/xml/devicesettings_workout_detection.xml +++ b/app/src/main/res/xml/devicesettings_workout_detection.xml @@ -17,7 +17,7 @@ android:summary="@string/pref_workout_detection_categories_summary" android:title="@string/pref_workout_detection_categories_title" /> - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - > - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -