mirror of
https://codeberg.org/Freeyourgadget/Gadgetbridge
synced 2024-11-29 13:26:50 +01:00
Add a submenu to choose between different signal types.
This commit is contained in:
parent
bc20db44f4
commit
2df8dfed18
@ -153,4 +153,7 @@ public class ZeTimeConstants {
|
|||||||
public static final String PREF_DATE_FORMAT = "zetime_date_format";
|
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_ALARM_SIGNALING = "zetime_alarm_signaling";
|
||||||
|
public static final String PREF_SMS_SIGNALING = "zetime_sms_signaling";
|
||||||
|
public static final String PREF_SHOCK_STRENGTH = "zetime_shock_strength";
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -284,6 +284,15 @@ public class ZeTimePreferenceActivity extends AbstractSettingsActivity {
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
final Preference smsSignaling = findPreference(ZeTimeConstants.PREF_SMS_SIGNALING);
|
||||||
|
smsSignaling.setOnPreferenceChangeListener(new Preference.OnPreferenceChangeListener() {
|
||||||
|
@Override
|
||||||
|
public boolean onPreferenceChange(Preference preference, Object newVal) {
|
||||||
|
GBApplication.deviceService().onSendConfiguration(ZeTimeConstants.PREF_SMS_SIGNALING);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -173,6 +173,12 @@ public class ZeTimeDeviceSupport extends AbstractBTLEDeviceSupport {
|
|||||||
case ZeTimeConstants.PREF_INACTIVITY_KEY:
|
case ZeTimeConstants.PREF_INACTIVITY_KEY:
|
||||||
setInactivityAlert(builder);
|
setInactivityAlert(builder);
|
||||||
break;
|
break;
|
||||||
|
case ZeTimeConstants.PREF_SMS_SIGNALING:
|
||||||
|
setSMSSignaling(builder);
|
||||||
|
break;
|
||||||
|
case ZeTimeConstants.PREF_SHOCK_STRENGTH:
|
||||||
|
setShockStrength(builder);
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
builder.queue(getQueue());
|
builder.queue(getQueue());
|
||||||
} catch (IOException e) {
|
} catch (IOException e) {
|
||||||
@ -426,7 +432,22 @@ public class ZeTimeDeviceSupport extends AbstractBTLEDeviceSupport {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onTestNewFunction() {
|
public void onTestNewFunction() {
|
||||||
|
byte[] strength = {
|
||||||
|
ZeTimeConstants.CMD_PREAMBLE,
|
||||||
|
ZeTimeConstants.CMD_SHOCK_STRENGTH,
|
||||||
|
ZeTimeConstants.CMD_REQUEST,
|
||||||
|
(byte)0x1,
|
||||||
|
(byte)0x0,
|
||||||
|
(byte)0x0,
|
||||||
|
ZeTimeConstants.CMD_END
|
||||||
|
};
|
||||||
|
try {
|
||||||
|
TransactionBuilder builder = performInitialized("testNewFunction");
|
||||||
|
sendMsgToWatch(builder, strength);
|
||||||
|
builder.queue(getQueue());
|
||||||
|
} catch (IOException e) {
|
||||||
|
GB.toast(getContext(), "Error on testing new function: " + e.getLocalizedMessage(), Toast.LENGTH_LONG, GB.ERROR);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@ -1733,4 +1754,41 @@ public class ZeTimeDeviceSupport extends AbstractBTLEDeviceSupport {
|
|||||||
|
|
||||||
sendMsgToWatch(builder, inactivity);
|
sendMsgToWatch(builder, inactivity);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void setShockStrength(TransactionBuilder builder)
|
||||||
|
{
|
||||||
|
Prefs prefs = GBApplication.getPrefs();
|
||||||
|
int shockStrength = prefs.getInt(ZeTimeConstants.PREF_SHOCK_STRENGTH, 255);
|
||||||
|
|
||||||
|
byte[] strength = {
|
||||||
|
ZeTimeConstants.CMD_PREAMBLE,
|
||||||
|
ZeTimeConstants.CMD_SHOCK_STRENGTH,
|
||||||
|
ZeTimeConstants.CMD_SEND,
|
||||||
|
(byte)0x1,
|
||||||
|
(byte)0x0,
|
||||||
|
(byte)shockStrength,
|
||||||
|
ZeTimeConstants.CMD_END
|
||||||
|
};
|
||||||
|
|
||||||
|
sendMsgToWatch(builder, strength);
|
||||||
|
}
|
||||||
|
|
||||||
|
private void setSMSSignaling(TransactionBuilder builder)
|
||||||
|
{
|
||||||
|
Prefs prefs = GBApplication.getPrefs();
|
||||||
|
int signalType = prefs.getInt(ZeTimeConstants.PREF_SMS_SIGNALING, 0);
|
||||||
|
|
||||||
|
byte[] signaling = {
|
||||||
|
ZeTimeConstants.CMD_PREAMBLE,
|
||||||
|
ZeTimeConstants.CMD_SHOCK_MODE,
|
||||||
|
ZeTimeConstants.CMD_SEND,
|
||||||
|
(byte)0x2,
|
||||||
|
(byte)0x0,
|
||||||
|
(byte)0x4,
|
||||||
|
(byte)signalType,
|
||||||
|
ZeTimeConstants.CMD_END
|
||||||
|
};
|
||||||
|
|
||||||
|
sendMsgToWatch(builder, signaling);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -491,13 +491,25 @@
|
|||||||
<item>3</item>
|
<item>3</item>
|
||||||
</string-array>
|
</string-array>
|
||||||
<string-array name="zetime_signaling_types">
|
<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>
|
<item name="7">@string/zetime_signaling_vibrate</item>
|
||||||
<item name="11">@string/zetime_signaling_buzzer</item>
|
<item name="9">@string/zetime_signaling_beep_once</item>
|
||||||
<item name="13">@string/zetime_signaling_vibrate_buzzer</item>
|
<item name="10">@string/zetime_signaling_beep_twice</item>
|
||||||
|
<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>
|
||||||
</string-array>
|
</string-array>
|
||||||
<string-array name="zetime_signaling_types_values">
|
<string-array name="zetime_signaling_types_values">
|
||||||
|
<item>0</item>
|
||||||
|
<item>2</item>
|
||||||
|
<item>4</item>
|
||||||
<item>7</item>
|
<item>7</item>
|
||||||
|
<item>9</item>
|
||||||
|
<item>10</item>
|
||||||
<item>11</item>
|
<item>11</item>
|
||||||
|
<item>12</item>
|
||||||
<item>13</item>
|
<item>13</item>
|
||||||
</string-array>
|
</string-array>
|
||||||
|
|
||||||
|
@ -240,9 +240,15 @@
|
|||||||
<string name="zetime_prefs_inactivity_sa">Saturday</string>
|
<string name="zetime_prefs_inactivity_sa">Saturday</string>
|
||||||
<string name="zetime_prefs_inactivity_su">Sunday</string>
|
<string name="zetime_prefs_inactivity_su">Sunday</string>
|
||||||
<string name="zetime_title_alarm_signaling">Set type of signaling for the alarm</string>
|
<string name="zetime_title_alarm_signaling">Set type of signaling for the alarm</string>
|
||||||
<string name="zetime_signaling_vibrate">Vibrate</string>
|
<string name="zetime_signaling_none">Silent</string>
|
||||||
<string name="zetime_signaling_buzzer">Buzzer</string>
|
<string name="zetime_signaling_vibrate">Continuous vibration</string>
|
||||||
<string name="zetime_signaling_vibrate_buzzer">Vibrate and Buzzer</string>
|
<string name="zetime_signaling_beep">Continuous beeping</string>
|
||||||
|
<string name="zetime_signaling_vibrate_beep">Continuous vibration and beeping</string>
|
||||||
|
<string name="zetime_signaling_vibrate_once">Vibrate once</string>
|
||||||
|
<string name="zetime_signaling_vibrate_twice">Vibrate twice</string>
|
||||||
|
<string name="zetime_signaling_beep_once">Beep once</string>
|
||||||
|
<string name="zetime_signaling_beep_twice">Beep twice</string>
|
||||||
|
<string name="zetime_signaling_vibrate_beep_once">Vibrate and beep once</string>
|
||||||
|
|
||||||
<!-- Auto export preferences -->
|
<!-- Auto export preferences -->
|
||||||
<string name="pref_header_auto_export">Auto export</string>
|
<string name="pref_header_auto_export">Auto export</string>
|
||||||
@ -342,9 +348,14 @@
|
|||||||
<string name="pref_screen_notification_profile_generic">Generic notification</string>
|
<string name="pref_screen_notification_profile_generic">Generic notification</string>
|
||||||
<string name="pref_screen_notification_profile_email">E-mail notification</string>
|
<string name="pref_screen_notification_profile_email">E-mail notification</string>
|
||||||
<string name="pref_screen_notification_profile_incoming_call">Incoming call notification</string>
|
<string name="pref_screen_notification_profile_incoming_call">Incoming call notification</string>
|
||||||
|
<string name="pref_screen_notification_profile_missed_call">Missed call notification</string>
|
||||||
<string name="pref_screen_notification_profile_generic_chat">Chat</string>
|
<string name="pref_screen_notification_profile_generic_chat">Chat</string>
|
||||||
<string name="pref_screen_notification_profile_generic_navigation">Navigation</string>
|
<string name="pref_screen_notification_profile_generic_navigation">Navigation</string>
|
||||||
<string name="pref_screen_notification_profile_generic_social">Social network</string>
|
<string name="pref_screen_notification_profile_generic_social">Social network</string>
|
||||||
|
<string name="pref_screen_notification_profile_calendar">Calendar notification</string>
|
||||||
|
<string name="pref_screen_notification_profile_inactivity">Inactivity notification</string>
|
||||||
|
<string name="pref_screen_notification_profile_low_power">Low power warning</string>
|
||||||
|
<string name="pref_screen_notification_profile_anti_loss">Anti-loss warning</string>
|
||||||
|
|
||||||
<string name="prefs_title_heartrate_measurement_interval">Whole day HR measurement</string>
|
<string name="prefs_title_heartrate_measurement_interval">Whole day HR measurement</string>
|
||||||
<string name="interval_one_minute">once a minute</string>
|
<string name="interval_one_minute">once a minute</string>
|
||||||
|
@ -18,14 +18,6 @@
|
|||||||
android:key="zetime_screentime"
|
android:key="zetime_screentime"
|
||||||
android:title="@string/zetime_title_screentime"/>
|
android:title="@string/zetime_title_screentime"/>
|
||||||
|
|
||||||
<ListPreference
|
|
||||||
android:defaultValue="11"
|
|
||||||
android:entries="@array/zetime_signaling_types"
|
|
||||||
android:entryValues="@array/zetime_signaling_types_values"
|
|
||||||
android:key="zetime_alarm_signaling"
|
|
||||||
android:title="@string/zetime_title_alarm_signaling"
|
|
||||||
android:summary="%s" />
|
|
||||||
|
|
||||||
<CheckBoxPreference
|
<CheckBoxPreference
|
||||||
android:defaultValue="false"
|
android:defaultValue="false"
|
||||||
android:key="zetime_activity_tracking"
|
android:key="zetime_activity_tracking"
|
||||||
@ -222,4 +214,240 @@
|
|||||||
android:title="@string/activity_prefs_alarm_min_heart_rate" />
|
android:title="@string/activity_prefs_alarm_min_heart_rate" />
|
||||||
</PreferenceScreen>
|
</PreferenceScreen>
|
||||||
</PreferenceCategory>
|
</PreferenceCategory>
|
||||||
|
|
||||||
|
<PreferenceCategory
|
||||||
|
android:key="pref_category_miband_notification"
|
||||||
|
android:title="@string/pref_header_vibration_settings">
|
||||||
|
|
||||||
|
<PreferenceScreen
|
||||||
|
android:key="vibration_profile_key"
|
||||||
|
android:title="@string/pref_screen_notification_profile_sms"
|
||||||
|
android:persistent="false">
|
||||||
|
|
||||||
|
<!-- workaround for missing toolbar -->
|
||||||
|
<PreferenceCategory
|
||||||
|
android:title="@string/pref_screen_notification_profile_sms"
|
||||||
|
/>
|
||||||
|
|
||||||
|
<ListPreference
|
||||||
|
android:defaultValue="2"
|
||||||
|
android:entries="@array/zetime_signaling_types"
|
||||||
|
android:entryValues="@array/zetime_signaling_types_values"
|
||||||
|
android:key="zetime_sms_signaling"
|
||||||
|
android:title="@string/miband_prefs_vibration"
|
||||||
|
android:summary="%s" />
|
||||||
|
|
||||||
|
<Preference
|
||||||
|
android:key="zetime_try_generic_sms"
|
||||||
|
android:persistent="false"
|
||||||
|
android:title="@string/vibration_try"/>
|
||||||
|
</PreferenceScreen>
|
||||||
|
|
||||||
|
<PreferenceScreen
|
||||||
|
android:key="vibration_profile_key"
|
||||||
|
android:title="@string/pref_screen_notification_profile_incoming_call"
|
||||||
|
android:persistent="false">
|
||||||
|
|
||||||
|
<!-- workaround for missing toolbar -->
|
||||||
|
<PreferenceCategory
|
||||||
|
android:title="@string/pref_screen_notification_profile_incoming_call"
|
||||||
|
/>
|
||||||
|
|
||||||
|
<ListPreference
|
||||||
|
android:defaultValue="13"
|
||||||
|
android:entries="@array/zetime_signaling_types"
|
||||||
|
android:entryValues="@array/zetime_signaling_types_values"
|
||||||
|
android:key="zetime_vibration_profile_incoming_call"
|
||||||
|
android:title="@string/miband_prefs_vibration"
|
||||||
|
android:summary="%s" />
|
||||||
|
</PreferenceScreen>
|
||||||
|
|
||||||
|
<PreferenceScreen
|
||||||
|
android:key="vibration_profile_key"
|
||||||
|
android:title="@string/pref_screen_notification_profile_missed_call"
|
||||||
|
android:persistent="false">
|
||||||
|
|
||||||
|
<!-- workaround for missing toolbar -->
|
||||||
|
<PreferenceCategory
|
||||||
|
android:title="@string/pref_screen_notification_profile_missed_call"
|
||||||
|
/>
|
||||||
|
|
||||||
|
<ListPreference
|
||||||
|
android:defaultValue="12"
|
||||||
|
android:entries="@array/zetime_signaling_types"
|
||||||
|
android:entryValues="@array/zetime_signaling_types_values"
|
||||||
|
android:key="zetime_vibration_profile_missed_call"
|
||||||
|
android:title="@string/miband_prefs_vibration"
|
||||||
|
android:summary="%s" />
|
||||||
|
</PreferenceScreen>
|
||||||
|
|
||||||
|
<PreferenceScreen
|
||||||
|
android:key="vibration_profile_key"
|
||||||
|
android:title="@string/pref_screen_notification_profile_email"
|
||||||
|
android:persistent="false">
|
||||||
|
|
||||||
|
<!-- workaround for missing toolbar -->
|
||||||
|
<PreferenceCategory
|
||||||
|
android:title="@string/pref_screen_notification_profile_email"
|
||||||
|
/>
|
||||||
|
|
||||||
|
<ListPreference
|
||||||
|
android:defaultValue="12"
|
||||||
|
android:entries="@array/zetime_signaling_types"
|
||||||
|
android:entryValues="@array/zetime_signaling_types_values"
|
||||||
|
android:key="zetime_vibration_profile_generic_email"
|
||||||
|
android:title="@string/miband_prefs_vibration"
|
||||||
|
android:summary="%s" />
|
||||||
|
|
||||||
|
<Preference
|
||||||
|
android:key="zetime_try_generic_email"
|
||||||
|
android:persistent="false"
|
||||||
|
android:title="@string/vibration_try"/>
|
||||||
|
</PreferenceScreen>
|
||||||
|
|
||||||
|
<PreferenceScreen
|
||||||
|
android:key="vibration_profile_key"
|
||||||
|
android:title="@string/pref_screen_notification_profile_generic_social"
|
||||||
|
android:persistent="false">
|
||||||
|
|
||||||
|
<!-- workaround for missing toolbar -->
|
||||||
|
<PreferenceCategory
|
||||||
|
android:title="@string/pref_screen_notification_profile_generic_social"
|
||||||
|
/>
|
||||||
|
|
||||||
|
<ListPreference
|
||||||
|
android:defaultValue="12"
|
||||||
|
android:entries="@array/zetime_signaling_types"
|
||||||
|
android:entryValues="@array/zetime_signaling_types_values"
|
||||||
|
android:key="zetime_vibration_profile_generic_social"
|
||||||
|
android:title="@string/miband_prefs_vibration"
|
||||||
|
android:summary="%s" />
|
||||||
|
|
||||||
|
<Preference
|
||||||
|
android:key="zetime_try_generic_social"
|
||||||
|
android:persistent="false"
|
||||||
|
android:title="@string/vibration_try"/>
|
||||||
|
</PreferenceScreen>
|
||||||
|
|
||||||
|
<PreferenceScreen
|
||||||
|
android:key="vibration_profile_key"
|
||||||
|
android:title="@string/pref_screen_notification_profile_alarm_clock"
|
||||||
|
android:persistent="false">
|
||||||
|
|
||||||
|
<!-- workaround for missing toolbar -->
|
||||||
|
<PreferenceCategory
|
||||||
|
android:title="@string/pref_screen_notification_profile_alarm_clock"
|
||||||
|
/>
|
||||||
|
|
||||||
|
<ListPreference
|
||||||
|
android:defaultValue="11"
|
||||||
|
android:entries="@array/zetime_signaling_types"
|
||||||
|
android:entryValues="@array/zetime_signaling_types_values"
|
||||||
|
android:key="zetime_alarm_signaling"
|
||||||
|
android:title="@string/miband_prefs_vibration"
|
||||||
|
android:summary="%s" />
|
||||||
|
|
||||||
|
<Preference
|
||||||
|
android:key="zetime_try_generic_alarm_clock"
|
||||||
|
android:persistent="false"
|
||||||
|
android:title="@string/vibration_try"/>
|
||||||
|
</PreferenceScreen>
|
||||||
|
|
||||||
|
<PreferenceScreen
|
||||||
|
android:key="vibration_profile_key"
|
||||||
|
android:title="@string/pref_screen_notification_profile_calendar"
|
||||||
|
android:persistent="false">
|
||||||
|
|
||||||
|
<!-- workaround for missing toolbar -->
|
||||||
|
<PreferenceCategory
|
||||||
|
android:title="@string/pref_screen_notification_profile_calendar"
|
||||||
|
/>
|
||||||
|
|
||||||
|
<ListPreference
|
||||||
|
android:defaultValue="12"
|
||||||
|
android:entries="@array/zetime_signaling_types"
|
||||||
|
android:entryValues="@array/zetime_signaling_types_values"
|
||||||
|
android:key="zetime_vibration_profile_calendar"
|
||||||
|
android:title="@string/miband_prefs_vibration"
|
||||||
|
android:summary="%s" />
|
||||||
|
|
||||||
|
<Preference
|
||||||
|
android:key="zetime_try_calendar"
|
||||||
|
android:persistent="false"
|
||||||
|
android:title="@string/vibration_try"/>
|
||||||
|
</PreferenceScreen>
|
||||||
|
|
||||||
|
<PreferenceScreen
|
||||||
|
android:key="vibration_profile_key"
|
||||||
|
android:title="@string/pref_screen_notification_profile_inactivity"
|
||||||
|
android:persistent="false">
|
||||||
|
|
||||||
|
<!-- workaround for missing toolbar -->
|
||||||
|
<PreferenceCategory
|
||||||
|
android:title="@string/pref_screen_notification_profile_inactivity"
|
||||||
|
/>
|
||||||
|
|
||||||
|
<ListPreference
|
||||||
|
android:defaultValue="12"
|
||||||
|
android:entries="@array/zetime_signaling_types"
|
||||||
|
android:entryValues="@array/zetime_signaling_types_values"
|
||||||
|
android:key="zetime_vibration_profile_inactivity"
|
||||||
|
android:title="@string/miband_prefs_vibration"
|
||||||
|
android:summary="%s" />
|
||||||
|
|
||||||
|
<Preference
|
||||||
|
android:key="zetime_try_inactivity"
|
||||||
|
android:persistent="false"
|
||||||
|
android:title="@string/vibration_try"/>
|
||||||
|
</PreferenceScreen>
|
||||||
|
|
||||||
|
<PreferenceScreen
|
||||||
|
android:key="vibration_profile_key"
|
||||||
|
android:title="@string/pref_screen_notification_profile_low_power"
|
||||||
|
android:persistent="false">
|
||||||
|
|
||||||
|
<!-- workaround for missing toolbar -->
|
||||||
|
<PreferenceCategory
|
||||||
|
android:title="@string/pref_screen_notification_profile_low_power"
|
||||||
|
/>
|
||||||
|
|
||||||
|
<ListPreference
|
||||||
|
android:defaultValue="4"
|
||||||
|
android:entries="@array/zetime_signaling_types"
|
||||||
|
android:entryValues="@array/zetime_signaling_types_values"
|
||||||
|
android:key="zetime_vibration_profile_lowpower"
|
||||||
|
android:title="@string/miband_prefs_vibration"
|
||||||
|
android:summary="%s" />
|
||||||
|
|
||||||
|
<Preference
|
||||||
|
android:key="zetime_try_lowpower"
|
||||||
|
android:persistent="false"
|
||||||
|
android:title="@string/vibration_try"/>
|
||||||
|
</PreferenceScreen>
|
||||||
|
|
||||||
|
<PreferenceScreen
|
||||||
|
android:key="vibration_profile_key"
|
||||||
|
android:title="@string/pref_screen_notification_profile_anti_loss"
|
||||||
|
android:persistent="false">
|
||||||
|
|
||||||
|
<!-- workaround for missing toolbar -->
|
||||||
|
<PreferenceCategory
|
||||||
|
android:title="@string/pref_screen_notification_profile_anti_loss"
|
||||||
|
/>
|
||||||
|
|
||||||
|
<ListPreference
|
||||||
|
android:defaultValue="13"
|
||||||
|
android:entries="@array/zetime_signaling_types"
|
||||||
|
android:entryValues="@array/zetime_signaling_types_values"
|
||||||
|
android:key="zetime_vibration_profile_antiloss"
|
||||||
|
android:title="@string/miband_prefs_vibration"
|
||||||
|
android:summary="%s" />
|
||||||
|
|
||||||
|
<Preference
|
||||||
|
android:key="zetime_try_antiloss"
|
||||||
|
android:persistent="false"
|
||||||
|
android:title="@string/vibration_try"/>
|
||||||
|
</PreferenceScreen>
|
||||||
|
|
||||||
|
</PreferenceCategory>
|
||||||
</PreferenceScreen>
|
</PreferenceScreen>
|
Loading…
Reference in New Issue
Block a user