Amazfit Active 2: Add vibration intensity config

This commit is contained in:
José Rebelo
2025-03-20 00:12:57 +00:00
parent bcf3c317a9
commit 329514d04d
6 changed files with 32 additions and 0 deletions
@@ -158,6 +158,7 @@ public class DeviceSettingsPreferenceConst {
public static final String PREF_ALERT_TONE = "alert_tone";
public static final String PREF_COVER_TO_MUTE = "cover_to_mute";
public static final String PREF_VIBRATE_FOR_ALERT = "vibrate_for_alert";
public static final String PREF_VIBRATION_INTENSITY = "vibration_intensity";
public static final String PREF_TEXT_TO_SPEECH = "text_to_speech";
public static final String PREF_OFFLINE_VOICE_RESPOND_TURN_WRIST = "offline_voice_respond_turn_wrist";
@@ -853,6 +853,7 @@ public class DeviceSpecificSettingsFragment extends AbstractPreferenceFragment i
addPreferenceHandlerFor(PREF_ALERT_TONE);
addPreferenceHandlerFor(PREF_COVER_TO_MUTE);
addPreferenceHandlerFor(PREF_VIBRATE_FOR_ALERT);
addPreferenceHandlerFor(PREF_VIBRATION_INTENSITY);
addPreferenceHandlerFor(PREF_TEXT_TO_SPEECH);
addPreferenceHandlerFor(PREF_OFFLINE_VOICE_RESPOND_TURN_WRIST);
@@ -361,6 +361,7 @@ public class ZeppOsConfigService extends AbstractZeppOsService {
COVER_TO_MUTE(ConfigGroup.SOUND_AND_VIBRATION, ConfigType.BOOL, 0x08, PREF_COVER_TO_MUTE),
VIBRATE_FOR_ALERT(ConfigGroup.SOUND_AND_VIBRATION, ConfigType.BOOL, 0x09, PREF_VIBRATE_FOR_ALERT),
TEXT_TO_SPEECH(ConfigGroup.SOUND_AND_VIBRATION, ConfigType.BOOL, 0x0a, PREF_TEXT_TO_SPEECH),
VIBRATION_INTENSITY(ConfigGroup.SOUND_AND_VIBRATION, ConfigType.BYTE, 0x12, PREF_VIBRATION_INTENSITY),
// Wearing Direction
WEARING_DIRECTION_BUTTONS(ConfigGroup.WEARING_DIRECTION, ConfigType.BYTE, 0x02, PREF_WEARDIRECTION),
@@ -664,6 +665,8 @@ public class ZeppOsConfigService extends AbstractZeppOsService {
return encodeEnum(WORKOUT_DETECTION_CATEGORY_MAP, value);
case WORKOUT_DETECTION_SENSITIVITY:
return encodeEnum(WORKOUT_DETECTION_SENSITIVITY_MAP, value);
case VIBRATION_INTENSITY:
return encodeString(VIBRATION_INTENSITY_MAP, value);
}
LOG.error("No encoder for {}", configArg);
@@ -1260,6 +1263,9 @@ public class ZeppOsConfigService extends AbstractZeppOsService {
case WORKOUT_DETECTION_SENSITIVITY:
decoder = b -> decodeEnum(WORKOUT_DETECTION_SENSITIVITY_MAP, b);
break;
case VIBRATION_INTENSITY:
decoder = b -> decodeString(VIBRATION_INTENSITY_MAP, b);
break;
default:
decoder = null;
}
@@ -1829,6 +1835,11 @@ public class ZeppOsConfigService extends AbstractZeppOsService {
put((byte) 0x02, WorkoutDetectionCapability.Sensitivity.LOW);
}};
private static final Map<Byte, String> VIBRATION_INTENSITY_MAP = new HashMap<Byte, String>() {{
put((byte) 0x00, "normal");
put((byte) 0x01, "enhanced");
}};
public static String decodeEnum(final Map<Byte, Enum<?>> map, final byte b) {
if (map.containsKey(b)) {
return map.get(b).name().toLowerCase(Locale.ROOT);
+9
View File
@@ -867,6 +867,15 @@
<item>low</item>
</string-array>
<string-array name="vibration_intensity">
<item>@string/normal</item>
<item>@string/enhanced</item>
</string-array>
<string-array name="vibration_intensity_values">
<item>normal</item>
<item>enhanced</item>
</string-array>
<string-array name="pref_zepp_os_watchfaces">
<!-- GTR 4 -->
<item>@string/zepp_os_watchface_red_fantasy</item>
+2
View File
@@ -555,6 +555,7 @@
<string name="pref_wearing_tone_summary">Plays a tone when the earbud is inserted</string>
<string name="pref_cover_to_mute">Cover to Mute</string>
<string name="pref_vibrate_for_alert">Vibrate for Alert</string>
<string name="pref_vibration_intensity">Vibration intensity</string>
<string name="pref_text_to_speech">Text to Speech</string>
<string name="offline_voice_respond_turn_wrist">Respond when turning the wrist</string>
<string name="offline_voice_respond_screen_on">Respond when screen on</string>
@@ -1354,6 +1355,7 @@
<string name="off">Off</string>
<string name="normal">Normal</string>
<string name="sensitive">Sensitive</string>
<string name="enhanced">Enhanced</string>
<string name="mi2_dnd_off">Off</string>
<string name="mi2_dnd_always">Always</string>
<string name="mi3_night_mode_sunset">At sunset</string>
@@ -41,6 +41,14 @@
android:layout="@layout/preference_checkbox"
android:title="@string/pref_vibrate_for_alert" />
<ListPreference
android:defaultValue="normal"
android:entries="@array/vibration_intensity"
android:entryValues="@array/vibration_intensity_values"
android:key="vibration_intensity"
android:summary="%s"
android:title="@string/pref_vibration_intensity" />
<SwitchPreferenceCompat
android:defaultValue="false"
android:icon="@drawable/ic_voice"