Fossil HR: added feature to light up screen on new notification

This commit is contained in:
Daniel Dakhno 2022-02-15 18:01:33 +01:00
parent 15f5d6ba9d
commit 77becb7702
8 changed files with 27 additions and 0 deletions

View File

@ -456,6 +456,9 @@ public class HybridHRWatchfaceDesignerActivity extends AbstractGBActivity implem
if (watchfaceConfig.has("powersave_hands")) {
watchfaceSettings.setPowersaveHands(watchfaceConfig.getBoolean("powersave_hands"));
}
if (watchfaceConfig.has("light_up_on_notification")) {
watchfaceSettings.setLightUpOnNotification(watchfaceConfig.getBoolean("light_up_on_notification"));
}
} catch (JSONException e) {
LOG.warn("JSON parsing error", e);
}

View File

@ -247,6 +247,7 @@ public class HybridHRWatchfaceFactory {
config.put("wrist_flick_duration", settings.getWristFlickDuration());
config.put("wrist_flick_move_hour", settings.getWristFlickMoveHour());
config.put("wrist_flick_move_minute", settings.getWristFlickMoveMinute());
config.put("light_up_on_notification", settings.getLightUpOnNotification());
config.put("powersave_display", settings.getPowersaveDisplay());
config.put("powersave_hands", settings.getPowersaveHands());
configuration.put("config", config);

View File

@ -27,6 +27,7 @@ public class HybridHRWatchfaceSettings implements Serializable {
private int wristFlickMoveMinute = -360;
private boolean powersaveDisplay = false;
private boolean powersaveHands = false;
private boolean lightUpOnNotification = false;
public HybridHRWatchfaceSettings() {
}
@ -63,6 +64,14 @@ public class HybridHRWatchfaceSettings implements Serializable {
this.wristFlickDuration = wristFlickDuration;
}
public boolean getLightUpOnNotification() {
return lightUpOnNotification;
}
public void setLightUpOnNotification(boolean lightUpOnNotification) {
this.lightUpOnNotification = lightUpOnNotification;
}
public int getWristFlickMoveHour() {
return wristFlickMoveHour;
}

View File

@ -111,6 +111,10 @@ public class HybridHRWatchfaceSettingsActivity extends AbstractSettingsActivity
SwitchPreference power_saving_hands = (SwitchPreference) findPreference("pref_hybridhr_watchface_power_saving_hands");
power_saving_hands.setOnPreferenceChangeListener(new PreferenceChangeListener());
power_saving_hands.setChecked(settings.getPowersaveHands());
SwitchPreference light_up_on_notification = (SwitchPreference) findPreference("pref_hybridhr_watchface_light_up_on_notification");
light_up_on_notification.setOnPreferenceChangeListener(new PreferenceChangeListener());
light_up_on_notification.setChecked(settings.getLightUpOnNotification());
}
private static class PreferenceChangeListener implements Preference.OnPreferenceChangeListener {
@ -136,6 +140,9 @@ public class HybridHRWatchfaceSettingsActivity extends AbstractSettingsActivity
settings.setWristFlickMoveMinute(Integer.parseInt(newValue.toString()));
preference.setSummary(newValue.toString());
break;
case "pref_hybridhr_watchface_light_up_on_notification":
settings.setLightUpOnNotification((boolean) newValue);
break;
case "pref_hybridhr_watchface_wrist_flick_duration":
settings.setWristFlickDuration(Integer.parseInt(newValue.toString()));
preference.setSummary(newValue.toString());

View File

@ -1589,4 +1589,5 @@
<string name="sony_anc_optimize_confirmation_description">Verwende den Kopfhörer wie gewohnt. Wenn sich die Tragebedingungen oder der Luftdruck ändern, führe den Optimierer erneut aus.</string>
<string name="devicetype_amazfit_pop">Amazfit Pop</string>
<string name="devicetype_amazfit_pop_pro">Amazfit Pop Pro</string>
<string name="watchface_setting_light_up_on_notification">Bei neuen Benachrichtigungen aufleuchten</string>
</resources>

View File

@ -1516,4 +1516,5 @@
<string name="menuitem_menu">Menu</string>
<string name="fossil_hr_button_config_info">Some buttons cannot be configured because their functions are hard-coded in the watch firmware.\n\nWarning: long-pressing the upper button when a watchface from the official Fossil app is installed will also toggle between showing/hiding widgets.</string>
<string name="watchface_dialog_widget_width">Width:</string>
<string name="watchface_setting_light_up_on_notification">Light up on new notification</string>
</resources>

View File

@ -57,6 +57,11 @@
android:key="pref_hybridhr_watchface_power_saving_hands"
android:title="@string/watchface_setting_power_saving_hands"
android:singleLineTitle="false" />
<SwitchPreference
android:persistent="false"
android:key="pref_hybridhr_watchface_light_up_on_notification"
android:title="@string/watchface_setting_light_up_on_notification"
android:singleLineTitle="false" />
</PreferenceCategory>
</PreferenceScreen>