mirror of
https://codeberg.org/Freeyourgadget/Gadgetbridge
synced 2024-11-29 13:26:50 +01:00
Setting the signal types is written to the watch now.
This commit is contained in:
parent
2df8dfed18
commit
6fa2dc04f3
@ -113,6 +113,16 @@ public class ZeTimeConstants {
|
||||
public static final byte NOTIFICATION_SKYPE = (byte) 0x15;
|
||||
// reminders types
|
||||
public static final byte REMINDER_ALARM = (byte) 0x04;
|
||||
// signaling types
|
||||
public static final byte ANTI_LOSS_TYPE = (byte) 0x00;
|
||||
public static final byte CALL_TYPE = (byte) 0x02;
|
||||
public static final byte MISSED_CALL_TYPE = (byte) 0x03;
|
||||
public static final byte SMS_TYPE = (byte) 0x04;
|
||||
public static final byte SOCIAL_TYPE = (byte) 0x05;
|
||||
public static final byte EMAIL_TYPE = (byte) 0x06;
|
||||
public static final byte CALENDAR_TYPE = (byte) 0x07;
|
||||
public static final byte INACTIVITY_TYPE = (byte) 0x08;
|
||||
public static final byte LOW_POWER_TYPE = (byte) 0x09;
|
||||
// watch settings
|
||||
public static final String PREF_WRIST = "zetime_wrist";
|
||||
public static final byte WEAR_ON_LEFT_WRIST = (byte) 0x00;
|
||||
@ -153,7 +163,16 @@ public class ZeTimeConstants {
|
||||
public static final String PREF_DATE_FORMAT = "zetime_date_format";
|
||||
|
||||
public static final String PREF_ALARM_SIGNALING = "zetime_alarm_signaling";
|
||||
public static final String PREF_SMS_SIGNALING = "zetime_sms_signaling";
|
||||
public static final String PREF_SMS_SIGNALING = "zetime_vibration_profile_sms";
|
||||
public static final String PREF_CALL_SIGNALING = "zetime_vibration_profile_incoming_call";
|
||||
public static final String PREF_MISSED_CALL_SIGNALING = "zetime_vibration_profile_missed_call";
|
||||
public static final String PREF_EMAIL_SIGNALING = "zetime_vibration_profile_generic_email";
|
||||
public static final String PREF_SOCIAL_SIGNALING = "zetime_vibration_profile_generic_social";
|
||||
public static final String PREF_CALENDAR_SIGNALING = "zetime_vibration_profile_calendar";
|
||||
public static final String PREF_INACTIVITY_SIGNALING = "zetime_vibration_profile_inactivity";
|
||||
public static final String PREF_LOW_POWER_SIGNALING = "zetime_vibration_profile_lowpower";
|
||||
public static final String PREF_ANTI_LOSS_SIGNALING = "zetime_vibration_profile_antiloss";
|
||||
|
||||
public static final String PREF_SHOCK_STRENGTH = "zetime_shock_strength";
|
||||
|
||||
}
|
||||
|
@ -293,6 +293,70 @@ public class ZeTimePreferenceActivity extends AbstractSettingsActivity {
|
||||
return true;
|
||||
}
|
||||
});
|
||||
final Preference antiSignaling = findPreference(ZeTimeConstants.PREF_ANTI_LOSS_SIGNALING);
|
||||
antiSignaling.setOnPreferenceChangeListener(new Preference.OnPreferenceChangeListener() {
|
||||
@Override
|
||||
public boolean onPreferenceChange(Preference preference, Object newVal) {
|
||||
GBApplication.deviceService().onSendConfiguration(ZeTimeConstants.PREF_ANTI_LOSS_SIGNALING);
|
||||
return true;
|
||||
}
|
||||
});
|
||||
final Preference calendarSignaling = findPreference(ZeTimeConstants.PREF_CALENDAR_SIGNALING);
|
||||
calendarSignaling.setOnPreferenceChangeListener(new Preference.OnPreferenceChangeListener() {
|
||||
@Override
|
||||
public boolean onPreferenceChange(Preference preference, Object newVal) {
|
||||
GBApplication.deviceService().onSendConfiguration(ZeTimeConstants.PREF_CALENDAR_SIGNALING);
|
||||
return true;
|
||||
}
|
||||
});
|
||||
final Preference callSignaling = findPreference(ZeTimeConstants.PREF_CALL_SIGNALING);
|
||||
callSignaling.setOnPreferenceChangeListener(new Preference.OnPreferenceChangeListener() {
|
||||
@Override
|
||||
public boolean onPreferenceChange(Preference preference, Object newVal) {
|
||||
GBApplication.deviceService().onSendConfiguration(ZeTimeConstants.PREF_CALL_SIGNALING);
|
||||
return true;
|
||||
}
|
||||
});
|
||||
final Preference missedSignaling = findPreference(ZeTimeConstants.PREF_MISSED_CALL_SIGNALING);
|
||||
missedSignaling.setOnPreferenceChangeListener(new Preference.OnPreferenceChangeListener() {
|
||||
@Override
|
||||
public boolean onPreferenceChange(Preference preference, Object newVal) {
|
||||
GBApplication.deviceService().onSendConfiguration(ZeTimeConstants.PREF_MISSED_CALL_SIGNALING);
|
||||
return true;
|
||||
}
|
||||
});
|
||||
final Preference emailSignaling = findPreference(ZeTimeConstants.PREF_EMAIL_SIGNALING);
|
||||
emailSignaling.setOnPreferenceChangeListener(new Preference.OnPreferenceChangeListener() {
|
||||
@Override
|
||||
public boolean onPreferenceChange(Preference preference, Object newVal) {
|
||||
GBApplication.deviceService().onSendConfiguration(ZeTimeConstants.PREF_EMAIL_SIGNALING);
|
||||
return true;
|
||||
}
|
||||
});
|
||||
final Preference inactivitySignaling = findPreference(ZeTimeConstants.PREF_INACTIVITY_SIGNALING);
|
||||
inactivitySignaling.setOnPreferenceChangeListener(new Preference.OnPreferenceChangeListener() {
|
||||
@Override
|
||||
public boolean onPreferenceChange(Preference preference, Object newVal) {
|
||||
GBApplication.deviceService().onSendConfiguration(ZeTimeConstants.PREF_INACTIVITY_SIGNALING);
|
||||
return true;
|
||||
}
|
||||
});
|
||||
final Preference powerSignaling = findPreference(ZeTimeConstants.PREF_LOW_POWER_SIGNALING);
|
||||
powerSignaling.setOnPreferenceChangeListener(new Preference.OnPreferenceChangeListener() {
|
||||
@Override
|
||||
public boolean onPreferenceChange(Preference preference, Object newVal) {
|
||||
GBApplication.deviceService().onSendConfiguration(ZeTimeConstants.PREF_LOW_POWER_SIGNALING);
|
||||
return true;
|
||||
}
|
||||
});
|
||||
final Preference socialSignaling = findPreference(ZeTimeConstants.PREF_SOCIAL_SIGNALING);
|
||||
socialSignaling.setOnPreferenceChangeListener(new Preference.OnPreferenceChangeListener() {
|
||||
@Override
|
||||
public boolean onPreferenceChange(Preference preference, Object newVal) {
|
||||
GBApplication.deviceService().onSendConfiguration(ZeTimeConstants.PREF_SOCIAL_SIGNALING);
|
||||
return true;
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -174,7 +174,15 @@ public class ZeTimeDeviceSupport extends AbstractBTLEDeviceSupport {
|
||||
setInactivityAlert(builder);
|
||||
break;
|
||||
case ZeTimeConstants.PREF_SMS_SIGNALING:
|
||||
setSMSSignaling(builder);
|
||||
case ZeTimeConstants.PREF_CALL_SIGNALING:
|
||||
case ZeTimeConstants.PREF_MISSED_CALL_SIGNALING:
|
||||
case ZeTimeConstants.PREF_EMAIL_SIGNALING:
|
||||
case ZeTimeConstants.PREF_SOCIAL_SIGNALING:
|
||||
case ZeTimeConstants.PREF_CALENDAR_SIGNALING:
|
||||
case ZeTimeConstants.PREF_INACTIVITY_SIGNALING:
|
||||
case ZeTimeConstants.PREF_LOW_POWER_SIGNALING:
|
||||
case ZeTimeConstants.PREF_ANTI_LOSS_SIGNALING:
|
||||
setSignaling(builder, config);
|
||||
break;
|
||||
case ZeTimeConstants.PREF_SHOCK_STRENGTH:
|
||||
setShockStrength(builder);
|
||||
@ -1773,10 +1781,10 @@ public class ZeTimeDeviceSupport extends AbstractBTLEDeviceSupport {
|
||||
sendMsgToWatch(builder, strength);
|
||||
}
|
||||
|
||||
private void setSMSSignaling(TransactionBuilder builder)
|
||||
private void setSignaling(TransactionBuilder builder, String signalingType)
|
||||
{
|
||||
Prefs prefs = GBApplication.getPrefs();
|
||||
int signalType = prefs.getInt(ZeTimeConstants.PREF_SMS_SIGNALING, 0);
|
||||
int signalType = prefs.getInt(signalingType, 0);
|
||||
|
||||
byte[] signaling = {
|
||||
ZeTimeConstants.CMD_PREAMBLE,
|
||||
@ -1784,11 +1792,42 @@ public class ZeTimeDeviceSupport extends AbstractBTLEDeviceSupport {
|
||||
ZeTimeConstants.CMD_SEND,
|
||||
(byte)0x2,
|
||||
(byte)0x0,
|
||||
(byte)0x4,
|
||||
(byte)0x0,
|
||||
(byte)signalType,
|
||||
ZeTimeConstants.CMD_END
|
||||
};
|
||||
|
||||
switch(signalingType)
|
||||
{
|
||||
case ZeTimeConstants.PREF_SMS_SIGNALING:
|
||||
signaling[5] = ZeTimeConstants.SMS_TYPE;
|
||||
break;
|
||||
case ZeTimeConstants.PREF_CALL_SIGNALING:
|
||||
signaling[5] = ZeTimeConstants.CALL_TYPE;
|
||||
break;
|
||||
case ZeTimeConstants.PREF_MISSED_CALL_SIGNALING:
|
||||
signaling[5] = ZeTimeConstants.MISSED_CALL_TYPE;
|
||||
break;
|
||||
case ZeTimeConstants.PREF_EMAIL_SIGNALING:
|
||||
signaling[5] = ZeTimeConstants.EMAIL_TYPE;
|
||||
break;
|
||||
case ZeTimeConstants.PREF_SOCIAL_SIGNALING:
|
||||
signaling[5] = ZeTimeConstants.SOCIAL_TYPE;
|
||||
break;
|
||||
case ZeTimeConstants.PREF_CALENDAR_SIGNALING:
|
||||
signaling[5] = ZeTimeConstants.CALENDAR_TYPE;
|
||||
break;
|
||||
case ZeTimeConstants.PREF_INACTIVITY_SIGNALING:
|
||||
signaling[5] = ZeTimeConstants.INACTIVITY_TYPE;
|
||||
break;
|
||||
case ZeTimeConstants.PREF_LOW_POWER_SIGNALING:
|
||||
signaling[5] = ZeTimeConstants.LOW_POWER_TYPE;
|
||||
break;
|
||||
case ZeTimeConstants.PREF_ANTI_LOSS_SIGNALING:
|
||||
signaling[5] = ZeTimeConstants.ANTI_LOSS_TYPE;
|
||||
break;
|
||||
}
|
||||
|
||||
sendMsgToWatch(builder, signaling);
|
||||
}
|
||||
}
|
||||
|
@ -491,7 +491,6 @@
|
||||
<item>3</item>
|
||||
</string-array>
|
||||
<string-array name="zetime_signaling_types">
|
||||
<item name="0">@string/zetime_signaling_none</item>
|
||||
<item name="2">@string/zetime_signaling_vibrate_once</item>
|
||||
<item name="4">@string/zetime_signaling_vibrate_twice</item>
|
||||
<item name="7">@string/zetime_signaling_vibrate</item>
|
||||
@ -500,9 +499,9 @@
|
||||
<item name="11">@string/zetime_signaling_beep</item>
|
||||
<item name="12">@string/zetime_signaling_vibrate_beep_once</item>
|
||||
<item name="13">@string/zetime_signaling_vibrate_beep</item>
|
||||
<item name="14">@string/zetime_signaling_none</item>
|
||||
</string-array>
|
||||
<string-array name="zetime_signaling_types_values">
|
||||
<item>0</item>
|
||||
<item>2</item>
|
||||
<item>4</item>
|
||||
<item>7</item>
|
||||
@ -511,6 +510,7 @@
|
||||
<item>11</item>
|
||||
<item>12</item>
|
||||
<item>13</item>
|
||||
<item>14</item>
|
||||
</string-array>
|
||||
|
||||
</resources>
|
||||
|
@ -233,7 +233,7 @@
|
||||
android:defaultValue="2"
|
||||
android:entries="@array/zetime_signaling_types"
|
||||
android:entryValues="@array/zetime_signaling_types_values"
|
||||
android:key="zetime_sms_signaling"
|
||||
android:key="zetime_vibration_profile_sms"
|
||||
android:title="@string/miband_prefs_vibration"
|
||||
android:summary="%s" />
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user