1
0
mirror of https://codeberg.org/Freeyourgadget/Gadgetbridge synced 2024-12-26 18:45:49 +01:00

Move settings to per device (gear icon)

Add missing files
This commit is contained in:
mamutcho 2020-04-22 23:36:09 +03:00
parent 61da55e0de
commit 7dab1cb0f7
18 changed files with 400 additions and 521 deletions

View File

@ -75,10 +75,6 @@
android:name=".devices.zetime.ZeTimePreferenceActivity"
android:label="@string/zetime_title_settings"
android:parentActivityName=".activities.SettingsActivity" />
<activity
android:name=".devices.lenovo.watchxplus.WatchXPlusPreferenceActivity"
android:label="@string/preferences_watchxplus_settings"
android:parentActivityName=".activities.SettingsActivity" />
<activity
android:name=".activities.ActivitySummariesActivity"
android:label="@string/activity_summaries"
@ -414,7 +410,7 @@
android:label="@string/title_activity_watch9_pairing" />
<activity
android:name=".devices.lenovo.LenovoWatchCalibrationActivity"
android:label="@string/title_activity_watchXplus_calibration" />
android:label="@string/title_activity_LenovoWatch_calibration" />
<activity
android:name=".activities.charts.ChartsActivity"
android:label="@string/title_activity_charts"

View File

@ -54,14 +54,11 @@ import nodomain.freeyourgadget.gadgetbridge.GBApplication;
import nodomain.freeyourgadget.gadgetbridge.R;
import nodomain.freeyourgadget.gadgetbridge.database.PeriodicExporter;
import nodomain.freeyourgadget.gadgetbridge.devices.DeviceManager;
import nodomain.freeyourgadget.gadgetbridge.devices.lenovo.watchxplus.WatchXPlusConstants;
import nodomain.freeyourgadget.gadgetbridge.devices.lenovo.watchxplus.WatchXPlusPreferenceActivity;
import nodomain.freeyourgadget.gadgetbridge.devices.miband.MiBandPreferencesActivity;
import nodomain.freeyourgadget.gadgetbridge.devices.qhybrid.ConfigActivity;
import nodomain.freeyourgadget.gadgetbridge.devices.zetime.ZeTimePreferenceActivity;
import nodomain.freeyourgadget.gadgetbridge.activities.charts.ChartsPreferencesActivity;
import nodomain.freeyourgadget.gadgetbridge.model.CannedMessagesSpec;
import nodomain.freeyourgadget.gadgetbridge.service.devices.lenovo.watchxplus.WatchXPlusDeviceSupport;
import nodomain.freeyourgadget.gadgetbridge.util.AndroidUtils;
import nodomain.freeyourgadget.gadgetbridge.util.FileUtils;
import nodomain.freeyourgadget.gadgetbridge.util.GB;
@ -138,15 +135,6 @@ public class SettingsActivity extends AbstractSettingsActivity {
}
});
pref = findPreference("pref_key_watchxplus");
pref.setOnPreferenceClickListener(new Preference.OnPreferenceClickListener() {
public boolean onPreferenceClick(Preference preference) {
Intent enableIntent = new Intent(SettingsActivity.this, WatchXPlusPreferenceActivity.class);
startActivity(enableIntent);
return true;
}
});
pref = findPreference("pref_key_blacklist");
pref.setOnPreferenceClickListener(new Preference.OnPreferenceClickListener() {
public boolean onPreferenceClick(Preference preference) {

View File

@ -33,4 +33,13 @@ public class DeviceSettingsPreferenceConst {
public static final String PREF_HYBRID_HR_FORCE_WHITE_COLOR = "force_white_color_scheme";
public static final String PREF_HYBRID_HR_DRAW_WIDGET_CIRCLES = "widget_draw_circles";
public static final String PREF_LIFTWRIST_NOSHED = "activate_display_on_lift_wrist_noshed";
public static final String PREF_DISCONNECTNOTIF_NOSHED = "disconnect_notification_noshed";
public static final String PREF_POWER_MODE = "power_mode";
public static final String PREF_BUTTON_BP_CALIBRATE = "prefs_sensors_button_bp_calibration";
public static final String PREF_ALTITUDE_CALIBRATE = "pref_sensors_altitude";
public static final String PREF_LONGSIT_PERIOD = "pref_longsit_period";
public static final String PREF_LONGSIT_SWITCH = "pref_longsit_switch";
public static final String PREF_DO_NOT_DISTURB_NOAUTO = "do_not_disturb_no_auto";
}

View File

@ -45,10 +45,18 @@ import static nodomain.freeyourgadget.gadgetbridge.activities.devicesettings.Dev
import static nodomain.freeyourgadget.gadgetbridge.activities.devicesettings.DeviceSettingsPreferenceConst.PREF_DATEFORMAT;
import static nodomain.freeyourgadget.gadgetbridge.activities.devicesettings.DeviceSettingsPreferenceConst.PREF_HYBRID_HR_DRAW_WIDGET_CIRCLES;
import static nodomain.freeyourgadget.gadgetbridge.activities.devicesettings.DeviceSettingsPreferenceConst.PREF_HYBRID_HR_FORCE_WHITE_COLOR;
import static nodomain.freeyourgadget.gadgetbridge.activities.devicesettings.DeviceSettingsPreferenceConst.PREF_LIFTWRIST_NOSHED;
import static nodomain.freeyourgadget.gadgetbridge.activities.devicesettings.DeviceSettingsPreferenceConst.PREF_DISCONNECTNOTIF_NOSHED;
import static nodomain.freeyourgadget.gadgetbridge.activities.devicesettings.DeviceSettingsPreferenceConst.PREF_POWER_MODE;
import static nodomain.freeyourgadget.gadgetbridge.activities.devicesettings.DeviceSettingsPreferenceConst.PREF_BUTTON_BP_CALIBRATE;
import static nodomain.freeyourgadget.gadgetbridge.activities.devicesettings.DeviceSettingsPreferenceConst.PREF_ALTITUDE_CALIBRATE;
import static nodomain.freeyourgadget.gadgetbridge.activities.devicesettings.DeviceSettingsPreferenceConst.PREF_LONGSIT_PERIOD;
import static nodomain.freeyourgadget.gadgetbridge.activities.devicesettings.DeviceSettingsPreferenceConst.PREF_LONGSIT_SWITCH;
import static nodomain.freeyourgadget.gadgetbridge.activities.devicesettings.DeviceSettingsPreferenceConst.PREF_SCREEN_ORIENTATION;
import static nodomain.freeyourgadget.gadgetbridge.activities.devicesettings.DeviceSettingsPreferenceConst.PREF_TIMEFORMAT;
import static nodomain.freeyourgadget.gadgetbridge.activities.devicesettings.DeviceSettingsPreferenceConst.PREF_VIBRATION_STRENGH_PERCENTAGE;
import static nodomain.freeyourgadget.gadgetbridge.activities.devicesettings.DeviceSettingsPreferenceConst.PREF_WEARLOCATION;
import static nodomain.freeyourgadget.gadgetbridge.activities.devicesettings.DeviceSettingsPreferenceConst.PREF_DO_NOT_DISTURB_NOAUTO;
import static nodomain.freeyourgadget.gadgetbridge.devices.huami.HuamiConst.PREF_ACTIVATE_DISPLAY_ON_LIFT;
import static nodomain.freeyourgadget.gadgetbridge.devices.huami.HuamiConst.PREF_DISCONNECT_NOTIFICATION;
import static nodomain.freeyourgadget.gadgetbridge.devices.huami.HuamiConst.PREF_DISCONNECT_NOTIFICATION_END;
@ -323,10 +331,19 @@ public class DeviceSpecificSettingsFragment extends PreferenceFragmentCompat {
addPreferenceHandlerFor(PREF_BUTTON_2_FUNCTION);
addPreferenceHandlerFor(PREF_BUTTON_3_FUNCTION);
addPreferenceHandlerFor(PREF_VIBRATION_STRENGH_PERCENTAGE);
addPreferenceHandlerFor(PREF_POWER_MODE);
addPreferenceHandlerFor(PREF_LIFTWRIST_NOSHED);
addPreferenceHandlerFor(PREF_DISCONNECTNOTIF_NOSHED);
addPreferenceHandlerFor(PREF_BUTTON_BP_CALIBRATE);
addPreferenceHandlerFor(PREF_ALTITUDE_CALIBRATE);
addPreferenceHandlerFor(PREF_LONGSIT_PERIOD);
addPreferenceHandlerFor(PREF_LONGSIT_SWITCH);
addPreferenceHandlerFor(PREF_DO_NOT_DISTURB_NOAUTO);
addPreferenceHandlerFor(PREF_HYBRID_HR_DRAW_WIDGET_CIRCLES);
addPreferenceHandlerFor(PREF_HYBRID_HR_FORCE_WHITE_COLOR);
String displayOnLiftState = prefs.getString(PREF_ACTIVATE_DISPLAY_ON_LIFT, PREF_DO_NOT_DISTURB_OFF);
boolean displayOnLiftScheduled = displayOnLiftState.equals(PREF_DO_NOT_DISTURB_SCHEDULED);

View File

@ -30,29 +30,31 @@ public final class WatchXPlusConstants extends LenovoWatchConstants {
public static final UUID UUID_CHARACTERISTIC_UNKNOWN_3 = UUID.fromString("0000a803-0000-1000-8000-00805f9b34fb");
public static final UUID UUID_CHARACTERISTIC_UNKNOWN_4 = UUID.fromString("0000a804-0000-1000-8000-00805f9b34fb");
public static final String PREF_ACTIVATE_DISPLAY = "activate_display_on_lift_wrist";
public static final String PREF_DISCONNECT_REMIND = "disconnect_notification";
public static final String PREF_FIND_PHONE = "prefs_find_phone";
public static final String PREF_FIND_PHONE_DURATION = "prefs_find_phone_duration";
public static final String PREF_ALTITUDE = "pref_watchxplus_altitude";
public static final String PREF_REPEAT = "watchxplus_repeat";
public static final String PREF_CONTINIOUS = "watchxplus_continious";
public static final String PREF_MISSED_CALL = "watchxplus_missed";
public static final String PREF_MISSED_CALL_REPEAT = "watchxplus_repeat_missedcall";
public static final String PREF_IS_BP_CALIBRATED = "watchxplus_is_bp_calibrated";
public static final String PREF_BUTTON_REJECT = "watchxplus_button_reject";
public static final String PREF_SHAKE_REJECT = "watchxplus_shake_reject";
public static final String PREF_BP_CAL_LOW = "pref_wxp_bp_calibration_low";
public static final String PREF_BP_CAL_HIGH = "pref_wxp_bp_calibration_high";
public static final String PREF_BP_CAL_SWITCH = "wxp_button_BP_calibration_list";
// new
public static final String PREF_CONTINIOUS_RING = "notification_enable_continious_ring";
public static final String PREF_REPEAT_RING = "notification_repeat_ring";
public static final String PREF_MISSED_CALL_ENABLE = "notification_enable_missed_call";
public static final String PREF_MISSED_CALL_REPEAT = "notification_repeat_missed_call";
public static final String PREF_BUTTON_REJECT = "notification_button_reject";
public static final String PREF_SHAKE_REJECT = "notification_shake_reject";
public static final String PREF_FORCE_TIME = "pref_device_spec_settings_force_time";
public static final String PREF_BP_CAL_LOW = "pref_sensors_bp_calibration_low";
public static final String PREF_BP_CAL_HIGH = "pref_sensors_bp_calibration_high";
public static final String PREF_DO_NOT_DISTURB = "do_not_disturb_no_auto";
public static final String PREF_DO_NOT_DISTURB_START = "do_not_disturb_no_auto_start";
public static final String PREF_DO_NOT_DISTURB_END = "do_not_disturb_no_auto_end";
public static final String PREF_LONGSIT_SWITCH = "pref_watchxplus_longsit_switch";
public static final String PREF_LONGSIT_PERIOD = "pref_watchxplus_longsit_period";
public static final String PREF_WXP_LANGUAGE = "pref_wxp_language";
public static final String PREF_POWER_MODE = "pref_wxp_power";
public static final String PREF_FORCE_TIME = "pref_wxp_force_time";
public static final String PREF_LONGSIT_START = "pref_longsit_start";
public static final String PREF_LONGSIT_END = "pref_longsit_end";
// moved to gear icon (per device settings)
public static final String PREF_LANGUAGE = "language";
// time format constants
public static final byte ARG_SET_TIMEMODE_24H = 0x00;

View File

@ -170,50 +170,17 @@ public class WatchXPlusDeviceCoordinator extends AbstractDeviceCoordinator {
@Override
public int[] getSupportedDeviceSpecificSettings(GBDevice device) {
return new int[]{
R.xml.devicesettings_liftwrist_display,
R.xml.devicesettings_disconnectnotification,
R.xml.devicesettings_liftwrist_display_noshed,
R.xml.devicesettings_disconnectnotification_noshed,
R.xml.devicesettings_donotdisturb_no_auto,
R.xml.devicesettings_longsit,
R.xml.devicesettings_find_phone,
R.xml.devicesettings_timeformat,
R.xml.devicesettings_donotdisturb_no_auto
R.xml.devicesettings_power_mode,
R.xml.devicesettings_watchxplus
};
}
/*
Prefs from device settings on main page
*/
// return time format pref
public static byte getTimeMode(SharedPreferences sharedPrefs) {
String timeMode = sharedPrefs.getString(DeviceSettingsPreferenceConst.PREF_TIMEFORMAT, getContext().getString(R.string.p_timeformat_24h));
assert timeMode != null;
if (timeMode.equals(getContext().getString(R.string.p_timeformat_24h))) {
return WatchXPlusConstants.ARG_SET_TIMEMODE_24H;
} else {
return WatchXPlusConstants.ARG_SET_TIMEMODE_12H;
}
}
// return watch language pref
public static byte getLanguage() {
int settingRead = prefs.getInt(WatchXPlusConstants.PREF_WXP_LANGUAGE, 1);
return (byte) settingRead;
}
// check if it is needed to toggle Lift Wrist to Sreen on
public static boolean shouldEnableHeadsUpScreen(SharedPreferences sharedPrefs) {
String liftMode = sharedPrefs.getString(WatchXPlusConstants.PREF_ACTIVATE_DISPLAY, getContext().getString(R.string.p_on));
// WatchXPlus doesn't support scheduled intervals. Treat it as "on".
assert liftMode != null;
return !liftMode.equals(getContext().getString(R.string.p_off));
}
// check if it is needed to toggle Disconnect reminder
public static boolean shouldEnableDisconnectReminder(SharedPreferences sharedPrefs) {
String lostReminder = sharedPrefs.getString(WatchXPlusConstants.PREF_DISCONNECT_REMIND, getContext().getString(R.string.p_on));
// WatchXPlus doesn't support scheduled intervals. Treat it as "on".
assert lostReminder != null;
return !lostReminder.equals(getContext().getString(R.string.p_off));
}
// find phone settings
/**
* @return {@link #FindPhone_OFF}, {@link #FindPhone_ON}, or the duration
@ -246,21 +213,24 @@ Prefs from device settings on main page
}
}
/**
* @param startOut out Only hour/minute are used.
* @param endOut out Only hour/minute are used.
* @return True if DND hours are enabled.
*/
public static boolean getDNDHours(SharedPreferences sharedPrefs, Calendar startOut, Calendar endOut) {
String doNotDisturb = sharedPrefs.getString(WatchXPlusConstants.PREF_DO_NOT_DISTURB, getContext().getString(R.string.p_off));
public static boolean getDNDHours(String deviceAddress, Calendar startOut, Calendar endOut) {
SharedPreferences prefs = GBApplication.getDeviceSpecificSharedPrefs(deviceAddress);
String doNotDisturb = prefs.getString(WatchXPlusConstants.PREF_DO_NOT_DISTURB, getContext().getString(R.string.p_off));
assert doNotDisturb != null;
if (doNotDisturb.equals(getContext().getString(R.string.p_off))) {
LOG.info(" DND is disabled ");
return false;
} else {
String start = sharedPrefs.getString(WatchXPlusConstants.PREF_DO_NOT_DISTURB_START, "00:00");
String end = sharedPrefs.getString(WatchXPlusConstants.PREF_DO_NOT_DISTURB_END, "00:00");
String start = prefs.getString(WatchXPlusConstants.PREF_DO_NOT_DISTURB_START, "01:00");
String end = prefs.getString(WatchXPlusConstants.PREF_DO_NOT_DISTURB_END, "06:00");
DateFormat df = new SimpleDateFormat("HH:mm");
@ -280,15 +250,16 @@ Prefs from device settings on main page
* @param endOut out Only hour/minute are used.
* @return True if DND hours are enabled.
*/
public static boolean getLongSitHours(SharedPreferences sharedPrefs, Calendar startOut, Calendar endOut) {
boolean enabled = prefs.getBoolean(WatchXPlusConstants.PREF_LONGSIT_SWITCH, false);
public static boolean getLongSitHours(String deviceAddress, Calendar startOut, Calendar endOut) {
SharedPreferences prefs = GBApplication.getDeviceSpecificSharedPrefs(deviceAddress);
boolean enabled = prefs.getBoolean(DeviceSettingsPreferenceConst.PREF_LONGSIT_SWITCH, false);
if (!enabled) {
LOG.info(" DND is disabled ");
LOG.info(" Long sit reminder is disabled ");
return false;
} else {
String start = sharedPrefs.getString(WatchXPlusConstants.PREF_DO_NOT_DISTURB_START, "00:00");
String end = sharedPrefs.getString(WatchXPlusConstants.PREF_DO_NOT_DISTURB_END, "00:00");
String end = prefs.getString(WatchXPlusConstants.PREF_LONGSIT_START, "06:00");
String start = prefs.getString(WatchXPlusConstants.PREF_LONGSIT_END, "23:00");
DateFormat df = new SimpleDateFormat("HH:mm");
@ -303,49 +274,5 @@ Prefs from device settings on main page
}
}
/*
Values from device specific settings page
*/
// read altitude from preferences
public static int getAltitude() {
return prefs.getInt(WatchXPlusConstants.PREF_ALTITUDE, 200);
}
// read repeat call notification
public static int getRepeatOnCall() {
return prefs.getInt(WatchXPlusConstants.PREF_REPEAT, 1);
}
//read continious call notification
public static boolean getContiniousVibrationOnCall() {
return prefs.getBoolean(WatchXPlusConstants.PREF_CONTINIOUS, false);
}
//read missed call notification
public static boolean getMissedCallReminder() {
return prefs.getBoolean(WatchXPlusConstants.PREF_MISSED_CALL, false);
}
//read missed call notification
public static int getMissedCallRepeat() {
return prefs.getInt(WatchXPlusConstants.PREF_MISSED_CALL_REPEAT, 0);
}
//read button reject call settings
public static boolean getButtonReject() {
return prefs.getBoolean(WatchXPlusConstants.PREF_BUTTON_REJECT, false);
}
//read shake wrist reject call settings
public static boolean getShakeReject() {
return prefs.getBoolean(WatchXPlusConstants.PREF_SHAKE_REJECT, false);
}
/*
Other saved preferences
*/
}

View File

@ -1,64 +0,0 @@
/* Copyright (C) 2018-2019 Sebastian Kranz
This file is part of Gadgetbridge.
Gadgetbridge is free software: you can redistribute it and/or modify
it under the terms of the GNU Affero General Public License as published
by the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
Gadgetbridge is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU Affero General Public License for more details.
You should have received a copy of the GNU Affero General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>. */
package nodomain.freeyourgadget.gadgetbridge.devices.lenovo.watchxplus;
import android.os.Bundle;
import android.preference.Preference;
import nodomain.freeyourgadget.gadgetbridge.GBApplication;
import nodomain.freeyourgadget.gadgetbridge.R;
import nodomain.freeyourgadget.gadgetbridge.activities.AbstractSettingsActivity;
public class WatchXPlusPreferenceActivity extends AbstractSettingsActivity {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
addPreferencesFromResource(R.xml.watchxplus_preferences);
// notifications
//addPreferenceHandlerFor(WatchXPlusConstants.PREF_REPEAT);
//addPreferenceHandlerFor(WatchXPlusConstants.PREF_CONTINIOUS);
//addPreferenceHandlerFor(WatchXPlusConstants.PREF_MISSED_CALL);
//addPreferenceHandlerFor(WatchXPlusConstants.PREF_MISSED_CALL_REPEAT);
//addPreferenceHandlerFor(WatchXPlusConstants.PREF_BUTTON_REJECT);
//addPreferenceHandlerFor(WatchXPlusConstants.PREF_SHAKE_REJECT);
// settings
addPreferenceHandlerFor(WatchXPlusConstants.PREF_POWER_MODE);
addPreferenceHandlerFor(WatchXPlusConstants.PREF_WXP_LANGUAGE);
addPreferenceHandlerFor(WatchXPlusConstants.PREF_LONGSIT_PERIOD);
addPreferenceHandlerFor(WatchXPlusConstants.PREF_LONGSIT_SWITCH);
// calibration
addPreferenceHandlerFor(WatchXPlusConstants.PREF_ALTITUDE);
addPreferenceHandlerFor(WatchXPlusConstants.PREF_BP_CAL_LOW);
addPreferenceHandlerFor(WatchXPlusConstants.PREF_BP_CAL_HIGH);
addPreferenceHandlerFor(WatchXPlusConstants.PREF_BP_CAL_SWITCH);
}
private void addPreferenceHandlerFor(final String preferenceKey) {
Preference pref = findPreference(preferenceKey);
pref.setOnPreferenceChangeListener(new Preference.OnPreferenceChangeListener() {
@Override public boolean onPreferenceChange(Preference preference, Object newVal) {
GBApplication.deviceService().onSendConfiguration(preferenceKey);
return true;
}
});
}
}

View File

@ -90,6 +90,9 @@ import nodomain.freeyourgadget.gadgetbridge.util.GB;
import nodomain.freeyourgadget.gadgetbridge.util.Prefs;
import nodomain.freeyourgadget.gadgetbridge.util.StringUtils;
import static nodomain.freeyourgadget.gadgetbridge.GBApplication.getContext;
import static nodomain.freeyourgadget.gadgetbridge.devices.huami.HuamiConst.PREF_LANGUAGE;
public class WatchXPlusDeviceSupport extends AbstractBTLEDeviceSupport {
private static final Prefs prefs = GBApplication.getPrefs();
@ -476,7 +479,7 @@ public class WatchXPlusDeviceSupport extends AbstractBTLEDeviceSupport {
LOG.info(" Time diff is too big ");
GB.toast("Manual time calibration needed!", Toast.LENGTH_LONG, GB.WARN);
sendNotification(WatchXPlusConstants.NOTIFICATION_CHANNEL_DEFAULT, "Calibrate time");
boolean forceTime = prefs.getBoolean(WatchXPlusConstants.PREF_FORCE_TIME, false);
boolean forceTime = GBApplication.getDeviceSpecificSharedPrefs(gbDevice.getAddress()).getBoolean(WatchXPlusConstants.PREF_FORCE_TIME, false);
if (forceTime) {
LOG.info(" Force set time ");
enableCalibration(true);
@ -626,14 +629,12 @@ public class WatchXPlusDeviceSupport extends AbstractBTLEDeviceSupport {
final int repeatDelay = 5000; // repeat delay of 5 sec (watch show call notifications for about 5 sec.)
final int repeatMissedDelay = 60000; // repeat missed call delay of 60 sec
// set settings for missed call
int repeatCount = WatchXPlusDeviceCoordinator.getRepeatOnCall();
int repeatCountMissed = WatchXPlusDeviceCoordinator.getMissedCallRepeat();
// check if repeatCount is in boundaries min=0, max=10
if (repeatCount < 0) repeatCount = 0;
if (repeatCount > 10) repeatCount = 10; // limit repeats to 10
// check if repeatCountMissed is in boundaries min=0, max=10
if (repeatCountMissed < 0) repeatCountMissed = 0;
if (repeatCountMissed > 10) repeatCountMissed = 10; // limit repeats to 10
//int repeatCount = WatchXPlusDeviceCoordinator.getRepeatOnCall();
final boolean continuousRing = GBApplication.getDeviceSpecificSharedPrefs(gbDevice.getAddress()).getBoolean(WatchXPlusConstants.PREF_CONTINIOUS_RING, false);
int repeatCount = GBApplication.getDeviceSpecificSharedPrefs(gbDevice.getAddress()).getInt(WatchXPlusConstants.PREF_REPEAT_RING, 0);
final boolean enableMissedCall = GBApplication.getDeviceSpecificSharedPrefs(gbDevice.getAddress()).getBoolean(WatchXPlusConstants.PREF_MISSED_CALL_ENABLE, false);
int repeatCountMissed = GBApplication.getDeviceSpecificSharedPrefs(gbDevice.getAddress()).getInt(WatchXPlusConstants.PREF_MISSED_CALL_REPEAT, 0);
switch (callSpec.command) {
case CallSpec.CALL_INCOMING:
@ -652,7 +653,7 @@ public class WatchXPlusDeviceSupport extends AbstractBTLEDeviceSupport {
handler.postDelayed(new Runnable() {
public void run() {
// Actions to do after repeatDelay seconds
if (((isRinging) && (remainingRepeats > 0)) || ((isRinging) && (WatchXPlusDeviceCoordinator.getContiniousVibrationOnCall()))) {
if (((isRinging) && (remainingRepeats > 0)) || ((isRinging) && (continuousRing))) {
remainingRepeats = remainingRepeats - 1;
sendNotification(WatchXPlusConstants.NOTIFICATION_CHANNEL_PHONE_CALL, callSpec.name);
// re-run handler
@ -698,7 +699,7 @@ public class WatchXPlusDeviceSupport extends AbstractBTLEDeviceSupport {
if (isMissedCall) {
remainingMissedRepeats = repeatCountMissed;
// send missed call notification if enabled in settings
if (WatchXPlusDeviceCoordinator.getMissedCallReminder()) {
if (enableMissedCall) {
LOG.info(" Missed call reminder ");
sendNotification(WatchXPlusConstants.NOTIFICATION_CHANNEL_PHONE_CALL, "Missed call");
// repeat missed call notification
@ -748,7 +749,7 @@ public class WatchXPlusDeviceSupport extends AbstractBTLEDeviceSupport {
private void handleButtonWhenRing() {
GBDeviceEventCallControl callCmd = new GBDeviceEventCallControl();
// get saved settings if true - reject call, otherwise ignore call
boolean buttonReject = WatchXPlusDeviceCoordinator.getButtonReject();
boolean buttonReject = GBApplication.getDeviceSpecificSharedPrefs(gbDevice.getAddress()).getBoolean(WatchXPlusConstants.PREF_BUTTON_REJECT, false);
if (buttonReject) {
LOG.info(" call rejected ");
isRinging = false;
@ -945,6 +946,7 @@ public class WatchXPlusDeviceSupport extends AbstractBTLEDeviceSupport {
public void onSendConfiguration(String config) {
TransactionBuilder builder;
SharedPreferences sharedPreferences = GBApplication.getDeviceSpecificSharedPrefs(this.getDevice().getAddress());
LOG.info(" onSendConfiguration: " + config);
try {
builder = performInitialized("sendConfig: " + config);
switch (config) {
@ -956,39 +958,37 @@ public class WatchXPlusDeviceSupport extends AbstractBTLEDeviceSupport {
setFitnessGoal(builder);
break;
// settings from App Settings -> WatchXPlus settings
case WatchXPlusConstants.PREF_POWER_MODE:
case DeviceSettingsPreferenceConst.PREF_POWER_MODE:
setPowerMode();
break;
case WatchXPlusConstants.PREF_WXP_LANGUAGE:
setLanguageAndTimeFormat(builder, sharedPreferences);
case WatchXPlusConstants.PREF_LANGUAGE:
setLanguageAndTimeFormat(builder);
break;
case WatchXPlusConstants.PREF_LONGSIT_PERIOD:
case WatchXPlusConstants.PREF_LONGSIT_SWITCH:
setLongSitHours(builder, sharedPreferences);
case DeviceSettingsPreferenceConst.PREF_LONGSIT_PERIOD:
case DeviceSettingsPreferenceConst.PREF_LONGSIT_SWITCH:
setLongSitHours(builder);
break;
// calibrations
case WatchXPlusConstants.PREF_ALTITUDE:
case DeviceSettingsPreferenceConst.PREF_ALTITUDE_CALIBRATE:
setAltitude(builder);
break;
case WatchXPlusConstants.PREF_BP_CAL_SWITCH:
case DeviceSettingsPreferenceConst.PREF_BUTTON_BP_CALIBRATE:
sendBloodPressureCalibration();
break;
// settings from device card
case WatchXPlusConstants.PREF_ACTIVATE_DISPLAY:
setHeadsUpScreen(builder, sharedPreferences);
case DeviceSettingsPreferenceConst.PREF_LIFTWRIST_NOSHED:
setHeadsUpScreen(builder);
getShakeStatus(builder);
break;
case WatchXPlusConstants.PREF_DISCONNECT_REMIND:
setDisconnectReminder(builder, sharedPreferences);
getDisconnectReminderStatus(builder);
case DeviceSettingsPreferenceConst.PREF_DISCONNECTNOTIF_NOSHED:
setDisconnectReminder(builder);
break;
case DeviceSettingsPreferenceConst.PREF_TIMEFORMAT:
setLanguageAndTimeFormat(builder, sharedPreferences);
setLanguageAndTimeFormat(builder);
break;
case WatchXPlusConstants.PREF_DO_NOT_DISTURB:
case WatchXPlusConstants.PREF_DO_NOT_DISTURB_START:
case WatchXPlusConstants.PREF_DO_NOT_DISTURB_END:
setDNDHours(builder, sharedPreferences);
setDNDHours(builder);
break;
}
builder.queue(getQueue());
@ -999,7 +999,7 @@ public class WatchXPlusDeviceSupport extends AbstractBTLEDeviceSupport {
@Override
public void onReadConfiguration(String config) {
LOG.info(" onReadConfiguration : " + config);
}
@Override
@ -1019,7 +1019,6 @@ public class WatchXPlusDeviceSupport extends AbstractBTLEDeviceSupport {
private void setLongSitHours(TransactionBuilder builder, boolean enable, int hourStart, int minuteStart, int hourEnd, int minuteEnd, int period) {
LOG.info(" Setting Long sit reminder... Enabled:"+enable+" Period:"+period);
LOG.info(" Setting Long sit time... Hs:"+hourEnd+" Ms:"+minuteEnd+" He:"+hourStart+" Me:"+minuteStart);
LOG.info(" Setting Long sit DND time... Hs:"+hourStart+" Ms:"+minuteStart+" He:"+hourEnd+" Me:"+minuteEnd);
// set Long Sit reminder time
byte[] command = WatchXPlusConstants.CMD_INACTIVITY_REMINDER_SET;
@ -1043,14 +1042,15 @@ public class WatchXPlusDeviceSupport extends AbstractBTLEDeviceSupport {
/** get Long sit settings from app, and send it to watch
* @param builder - transaction builder
* @param sharedPreferences - shared preferences
*/
private void setLongSitHours(TransactionBuilder builder, SharedPreferences sharedPreferences) {
private void setLongSitHours(TransactionBuilder builder) {
Calendar start = new GregorianCalendar();
Calendar end = new GregorianCalendar();
boolean enable = WatchXPlusDeviceCoordinator.getLongSitHours(sharedPreferences, start, end);
boolean enable = WatchXPlusDeviceCoordinator.getLongSitHours(gbDevice.getAddress(), start, end);
if (enable) {
int period = prefs.getInt(WatchXPlusConstants.PREF_LONGSIT_PERIOD, 60);
String periodString = GBApplication.getDeviceSpecificSharedPrefs(gbDevice.getAddress()).getString(DeviceSettingsPreferenceConst.PREF_LONGSIT_PERIOD, "60");
int period = Integer.parseInt(periodString);
this.setLongSitHours(builder, enable,
start.get(Calendar.HOUR_OF_DAY), start.get(Calendar.MINUTE),
end.get(Calendar.HOUR_OF_DAY), end.get(Calendar.MINUTE),
@ -1114,12 +1114,11 @@ public class WatchXPlusDeviceSupport extends AbstractBTLEDeviceSupport {
/** get DND settings from app, and send it to watch
* @param builder - transaction builder
* @param sharedPreferences - shared preferences
*/
private void setDNDHours(TransactionBuilder builder, SharedPreferences sharedPreferences) {
private void setDNDHours(TransactionBuilder builder) {
Calendar start = new GregorianCalendar();
Calendar end = new GregorianCalendar();
boolean enable = WatchXPlusDeviceCoordinator.getDNDHours(sharedPreferences, start, end);
boolean enable = WatchXPlusDeviceCoordinator.getDNDHours(gbDevice.getAddress(), start, end);
if (enable) {
this.setDNDHours(builder, enable,
start.get(Calendar.HOUR_OF_DAY), start.get(Calendar.MINUTE),
@ -1136,12 +1135,21 @@ public class WatchXPlusDeviceSupport extends AbstractBTLEDeviceSupport {
* modes (0- normal, 1- energysaving, 2- only watch)
*/
private void setPowerMode() {
int settingRead = prefs.getInt(WatchXPlusConstants.PREF_POWER_MODE, 0);
byte setWatchPowerMode = 0x00;
String powermodeStr = GBApplication.getDeviceSpecificSharedPrefs(gbDevice.getAddress()).getString(DeviceSettingsPreferenceConst.PREF_POWER_MODE, "0");
if (powermodeStr.equals("0")) {
setWatchPowerMode = 0x00;
} else if (powermodeStr.equals("1")) {
setWatchPowerMode = 0x01;
} else if (powermodeStr.equals("2")) {
setWatchPowerMode = 0x02;
}
byte[] bArr = new byte[1];
bArr[0] = (byte) settingRead;
LOG.info(" setting power mode to: " + settingRead);
bArr[0] = (byte) setWatchPowerMode;
LOG.info(" setting power mode to: " + setWatchPowerMode);
try {
TransactionBuilder builder = performInitialized("setPowerMode");
TransactionBuilder builder = performInitialized("setWatchPowerMode");
builder.write(getCharacteristic(WatchXPlusConstants.UUID_CHARACTERISTIC_WRITE),
buildCommand(WatchXPlusConstants.CMD_POWER_MODE,
WatchXPlusConstants.TASK,
@ -1212,18 +1220,18 @@ public class WatchXPlusDeviceSupport extends AbstractBTLEDeviceSupport {
*/
private void sendBloodPressureCalibration() {
try {
int beginCalibration = prefs.getInt(WatchXPlusConstants.PREF_BP_CAL_SWITCH, 0);
if (beginCalibration == 1) {
String beginCalibration = GBApplication.getDeviceSpecificSharedPrefs(gbDevice.getAddress()).getString(DeviceSettingsPreferenceConst.PREF_BUTTON_BP_CALIBRATE, "0");
if (beginCalibration.equals("1")) {
LOG.info(" Calibrating BP - cancel " + beginCalibration);
return;
}
int mLowP = prefs.getInt(WatchXPlusConstants.PREF_BP_CAL_LOW, 80);
int mHighP = prefs.getInt(WatchXPlusConstants.PREF_BP_CAL_HIGH, 130);
String mLowPString = GBApplication.getDeviceSpecificSharedPrefs(gbDevice.getAddress()).getString(WatchXPlusConstants.PREF_BP_CAL_LOW, "80");
int mLowP = Integer.parseInt(mLowPString);
String mHighPString = GBApplication.getDeviceSpecificSharedPrefs(gbDevice.getAddress()).getString(WatchXPlusConstants.PREF_BP_CAL_HIGH, "130");
int mHighP = Integer.parseInt(mHighPString);
LOG.warn(" Calibrating BP ... LowP=" + mLowP + " HighP="+mHighP);
GB.toast("Calibrating BP...", Toast.LENGTH_LONG, GB.INFO);
TransactionBuilder builder = performInitialized("bpCalibrate");
TransactionBuilder builder = performInitialized("bpCalibrate");
byte[] command = WatchXPlusConstants.CMD_BP_CALIBRATION;
byte mStart = 0x01; // initiate calibration
@ -1290,29 +1298,6 @@ public class WatchXPlusDeviceSupport extends AbstractBTLEDeviceSupport {
}
}
// not working!!!
private void testNewCommands() {
try {
TransactionBuilder builder = performInitialized("test");
int first = prefs.getInt("wxp_newcmd_first", 0);
int second = prefs.getInt("wxp_newcmd_second", 0);
byte[] command = new byte[]{(byte) first, (byte) second};
LOG.info(" testing new command " + Arrays.toString(command));
builder.write(getCharacteristic(WatchXPlusConstants.UUID_CHARACTERISTIC_WRITE),
buildCommand(command,
WatchXPlusConstants.READ_VALUE));
builder.queue(getQueue());
} catch (IOException e) {
LOG.warn(" Unable to request new command ", e);
}
}
@Override
public void onSendWeather(WeatherSpec weatherSpec) {
try {
@ -2020,13 +2005,12 @@ public class WatchXPlusDeviceSupport extends AbstractBTLEDeviceSupport {
// read preferences
private void syncPreferences(TransactionBuilder transaction) {
SharedPreferences sharedPreferences = GBApplication.getDeviceSpecificSharedPrefs(this.getDevice().getAddress());
this.setHeadsUpScreen(transaction, sharedPreferences); // lift wirst to screen on
this.setDNDHours(transaction, sharedPreferences); // DND
this.setDisconnectReminder(transaction, sharedPreferences); // disconnect reminder
this.setLanguageAndTimeFormat(transaction, sharedPreferences); // set time mode 12/24h
this.setHeadsUpScreen(transaction); // lift wirst to screen on
this.setDNDHours(transaction); // DND
this.setDisconnectReminder(transaction); // disconnect reminder
this.setLanguageAndTimeFormat(transaction); // set time mode 12/24h
this.setAltitude(transaction); // set altitude calibration
this.setLongSitHours(transaction, sharedPreferences); // set Long sit reminder
this.setLongSitHours(transaction); // set Long sit reminder
ActivityUser activityUser = new ActivityUser();
this.setPersonalInformation(transaction, activityUser.getHeightCm(), activityUser.getWeightKg(),
activityUser.getAge(),activityUser.getGender());
@ -2066,15 +2050,11 @@ public class WatchXPlusDeviceSupport extends AbstractBTLEDeviceSupport {
evaluateGBDeviceEvent(findPhoneEvent);
}
}
// Set Lift Wrist to Light Screen based on saved preferences
private void setHeadsUpScreen(TransactionBuilder transactionBuilder, SharedPreferences sharedPreferences) {
this.setHeadsUpScreen(transactionBuilder,
WatchXPlusDeviceCoordinator.shouldEnableHeadsUpScreen(sharedPreferences));
}
// Command to toggle Lift Wrist to Light Screen, and shake to ignore/reject call
private void setHeadsUpScreen(TransactionBuilder transactionBuilder, boolean enable) {
boolean shakeReject = WatchXPlusDeviceCoordinator.getShakeReject();
private void setHeadsUpScreen(TransactionBuilder transactionBuilder) {
boolean enable = GBApplication.getDeviceSpecificSharedPrefs(gbDevice.getAddress()).getBoolean(DeviceSettingsPreferenceConst.PREF_LIFTWRIST_NOSHED, false);
boolean shakeReject = GBApplication.getDeviceSpecificSharedPrefs(gbDevice.getAddress()).getBoolean(WatchXPlusConstants.PREF_SHAKE_REJECT, false);
byte refuseCall = 0x00; // force shake wrist to ignore/reject call to OFF
// returned characteristic is equal with button press while ringing
if (shakeReject) refuseCall = 0x01;
@ -2094,24 +2074,15 @@ public class WatchXPlusDeviceSupport extends AbstractBTLEDeviceSupport {
liftScreen));
}
private void setDisconnectReminder(TransactionBuilder transactionBuilder, SharedPreferences sharedPreferences) {
this.setDisconnectReminder(transactionBuilder,
WatchXPlusDeviceCoordinator.shouldEnableDisconnectReminder(sharedPreferences));
}
private void setDisconnectReminder(TransactionBuilder transactionBuilder, boolean enable) {
// command to set disconnect reminder
private void setDisconnectReminder(TransactionBuilder transactionBuilder) {
boolean enable = GBApplication.getDeviceSpecificSharedPrefs(gbDevice.getAddress()).getBoolean(DeviceSettingsPreferenceConst.PREF_DISCONNECTNOTIF_NOSHED, false);
transactionBuilder.write(getCharacteristic(WatchXPlusConstants.UUID_CHARACTERISTIC_WRITE),
buildCommand(WatchXPlusConstants.CMD_DISCONNECT_REMIND,
WatchXPlusConstants.WRITE_VALUE,
new byte[]{(byte) (enable ? 0x01 : 0x00)}));
}
// Request status of Disconnect reminder
private void getDisconnectReminderStatus(TransactionBuilder transactionBuilder) {
transactionBuilder.write(getCharacteristic(WatchXPlusConstants.UUID_CHARACTERISTIC_WRITE),
buildCommand(WatchXPlusConstants.CMD_DISCONNECT_REMIND,
WatchXPlusConstants.READ_VALUE));
}
// Request status of Lift Wrist to Light Screen, and Shake to Ignore/Reject Call
private void getShakeStatus(TransactionBuilder transactionBuilder) {
transactionBuilder.write(getCharacteristic(WatchXPlusConstants.UUID_CHARACTERISTIC_WRITE),
@ -2121,7 +2092,8 @@ public class WatchXPlusDeviceSupport extends AbstractBTLEDeviceSupport {
// calibrate altitude
private void setAltitude(TransactionBuilder transactionBuilder) {
int mAltitude = WatchXPlusDeviceCoordinator.getAltitude();
String altitudeString = GBApplication.getDeviceSpecificSharedPrefs(gbDevice.getAddress()).getString(DeviceSettingsPreferenceConst.PREF_ALTITUDE_CALIBRATE, "200");
int mAltitude = Integer.parseInt(altitudeString);
if (mAltitude < 0) {
mAltitude = (Math.abs(mAltitude) ^ 65535) + 1;
}
@ -2139,22 +2111,32 @@ public class WatchXPlusDeviceSupport extends AbstractBTLEDeviceSupport {
}
// set time format
private void setLanguageAndTimeFormat(TransactionBuilder transactionBuilder, byte timeMode, byte language) {
private void setLanguageAndTimeFormat(TransactionBuilder transactionBuilder) {
byte setLanguage, setTimeMode;
String languageString = GBApplication.getDeviceSpecificSharedPrefs(gbDevice.getAddress()).getString(WatchXPlusConstants.PREF_LANGUAGE, "1");
if (languageString == null || languageString.equals("1")) {
setLanguage = 0x01;
} else {
setLanguage = 0x00;
}
String timeformatString = GBApplication.getDeviceSpecificSharedPrefs(gbDevice.getAddress()).getString(DeviceSettingsPreferenceConst.PREF_TIMEFORMAT, "1");
assert timeformatString != null;
if (timeformatString.equals(getContext().getString(R.string.p_timeformat_24h))) {
setTimeMode = WatchXPlusConstants.ARG_SET_TIMEMODE_24H;
} else {
setTimeMode = WatchXPlusConstants.ARG_SET_TIMEMODE_12H;
}
byte[] bArr = new byte[2];
bArr[0] = language; //byte[08] language
bArr[1] = timeMode; //byte[09] time
bArr[0] = setLanguage; //byte[08] language
bArr[1] = setTimeMode; //byte[09] time
transactionBuilder.write(getCharacteristic(WatchXPlusConstants.UUID_CHARACTERISTIC_WRITE),
buildCommand(WatchXPlusConstants.CMD_TIME_LANGUAGE,
WatchXPlusConstants.WRITE_VALUE,
bArr));
}
private void setLanguageAndTimeFormat(TransactionBuilder transactionBuilder, SharedPreferences sharedPreferences) {
this.setLanguageAndTimeFormat(transactionBuilder,
WatchXPlusDeviceCoordinator.getTimeMode(sharedPreferences),
WatchXPlusDeviceCoordinator.getLanguage());
}
@Override
public void dispose() {
LocalBroadcastManager broadcastManager = LocalBroadcastManager.getInstance(getContext());

View File

@ -283,43 +283,42 @@
<string name="watch9_calibration_button">Сверяване</string>
<string name="title_activity_watch9_pairing">Watch 9 свързване</string>
<string name="title_activity_watch9_calibration">Watch 9 сверяване</string>
<string name="title_activity_watchXplus_calibration">Watch X Plus сверяване</string>
<string name="pref_wxp_title_unit_system">Единици</string>
<string name="pref_wxp_title_timeformat">Формат на часа</string>
<string name="pref_wxp_title_altitude">Калибриране на височината</string>
<string name="pref_wxp_title_repeat_on_call">Повтаряй известие за позвъняване</string>
<string name="pref_wxp_title_repeat_on_call_summary">Възможни стойности min=0, max=10</string>
<string name="prefs_wxp_continious">Известявай докато телефона звъни</string>
<string name="preferences_watchxplus_settings">Watch X Plus настройки</string>
<string name="pref_wxp_title_reject_summary">Изкл. - заглуши, Вкл. - откажи</string>
<string name="prefs_wxp_reject">Бутона заглушава/отказва повикване</string>
<string name="pref_wxp_title_shake_reject_summary">Повтаря действието на бутона</string>
<string name="prefs_wxp_shake_reject">Разклати за заглушаване/отказване на повикването</string>
<string name="wxp_bp_calibration_prefs">Калибриране на кръвно налягане</string>
<string name="pref_wxp_bp_calibration_low">Кръвно налягане DIASTOLIC (ниска)</string>
<string name="pref_wxp_bp_calibration_high">Кръвно налягане SYSTOLIC (висока)</string>
<string name="prefs_wxp_button_bp_calibration">Калибриране</string>
<string name="prefs_wxp_button_bp_calibration_sum">Натисни тук за калибриране</string>
<string name="pref_header_wxp_calibration">Калибриране на сензорите</string>
<string name="pref_header_wxp_settings">Настройки на устройството</string>
<string name="wxp_power_mode_title">Режим на часовника</string>
<string name="wxp_mode_normal">Нормален</string>
<string name="wxp_mode_saving">Икономичен</string>
<string name="wxp_mode_watch">Само часовник</string>
<string name="pref_wxp_title_repeat_on_misscall_summary">Повтаряй известие за пропуснато повикване всяка минута за X пъти</string>
<string name="pref_wxp_title_repeat_on_misscall">Повтаряй известието за пропуснато повикване</string>
<string name="pref_wxp_enable_misscall">Известявай за пропуснато повикване</string>
<string name="pref_header_wxp_notification_callhandling">Управление на обажданията</string>
<string name="pref_header_wxp_longsit">Напомняне за бездействие</string>
<string name="pref_wxp_longsit_period_summary">Напомняй ако няма активност за повече от X минути</string>
<string name="pref_wxp_longsit_switch_summary">Времевия интервал е от настройката за DND</string>
<string name="prefs_wxp_longsit_switch">Включи напомняне за активност</string>
<string name="pref_wxp_title_longsit">Период на неактивност (минути)</string>
<string name="wxp_language_title">Език</string>
<string name="pref_wxp_title_force_time">Принудително синхронизирай часа</string>
<string name="pref_wxp_title_force_time_sum">Принудително синхронизирай дата и час при свързване. Стрелките може да показват грешно време.</string>
<string name="pref_header_wxp_call_notification">Известия и Обаждания</string>
<string name="mi2_prefs_do_not_disturb_summary">Няма да се получават известия докато е активно</string>
<!-- WatchXPlus Preferences -->
<string name="title_activity_LenovoWatch_calibration">Watch X Plus сверяване</string>
<!-- Device Settings - Notifications and Calls - Used in devicesettings_watchxplus.xml -->
<string name="pref_header_notifications_and_calls">Известия и Обаждания</string>
<string name="pref_title_notifications_and_calls_repeat_on_call">Повтаряй известие за позвъняване</string>
<string name="prefs_notifications_and_calls_continious_ring">Известявай докато телефона звъни</string>
<string name="pref_notifications_and_calls_enable_misscall">Известявай за пропуснато повикване</string>
<string name="pref_summary_notifications_and_calls_enable_misscall">Повтаря се на всяка минута</string>
<string name="pref_title_notifications_and_calls_repeat_on_misscall">Повтаряй за Х минути</string>
<string name="pref_header_notifications_and_calls_callhandling">Управление на обажданията</string>
<string name="prefs_notifications_and_calls_reject">Бутона заглушава/отказва повикване</string>
<string name="pref_summary_notifications_and_calls_title_reject">Изкл. - заглуши, Вкл. - откажи</string>
<string name="prefs_notifications_and_calls_shake_reject">Разклати за заглушаване/отказване на повикването</string>
<string name="pref_summary_notifications_and_calls_title_shake_reject">Повтаря действието на бутона</string>
<!-- Device Settings - Device Settings - Used in devicesettings_watchxplus.xml -->
<string name="pref_header_device_spec_settings">Настройки на устройството</string>
<string name="pref_title_device_spec_settings_force_time">Принудително синхронизирай часа</string>
<string name="pref_summary_device_spec_settings_title_force_time">Принудително синхронизирай дата и час при свързване. Стрелките може да показват грешно време.</string>
<!-- Device Settings - Calibration - Used in devicesettings_watchxplus.xml -->
<string name="pref_header_sensors_calibration">Калибриране на сензорите</string>
<string name="pref_title_sensors_altitude">Калибриране на височината</string>
<string name="pref_sensors_bp_calibration">Калибриране на кръвно налягане</string>
<string name="pref_sensors_bp_calibration_low">Кръвно налягане DIASTOLIC (ниска)</string>
<string name="pref_sensors_bp_calibration_high">Кръвно налягане SYSTOLIC (висока)</string>
<string name="prefs_sensors_button_bp_calibration">Калибриране</string>
<string name="prefs_sensors_button_bp_calibration_sum">Натисни тук за калибриране</string>
<!-- Device Settings - Long Sit Reminder -->
<string name="pref_summary_longsit">Напомни ако няма активност за повече от X минути</string>
<string name="prefs_longsit_switch">Напомняне за бездействие</string>
<string name="pref_title_longsit">Период на неактивност (минути)</string>
<!-- Device Settings - Power Mode -->
<string name="power_mode_title">Режим на часовника</string>
<string name="power_mode_normal">Нормален</string>
<string name="power_mode_saving">Икономичен</string>
<string name="power_mode_watch">Само часовник</string>
<string name="title_activity_sleepmonitor">Наблюдение/анализ на съня</string>
<string name="pref_write_logfiles">Съхраняване на log файлове</string>
<string name="initializing">Инициализиране</string>

View File

@ -69,28 +69,29 @@
<item>never</item>
</string-array>
<string-array name="wxp_language">
<string-array name="language_only_EN_CH">
<item name="0">@string/simplified_chinese</item>
<item name="1">@string/english</item>
</string-array>
<string-array name="wxp_language_values">
<string-array name="language_only_EN_CH_values">
<item>0</item>
<item>1</item>
</string-array>
<string-array name="wxp_bp_cal">
<item name="0">@string/prefs_wxp_button_bp_calibration</item>
<string-array name="sensors_bp_cal">
<item name="0">@string/prefs_sensors_button_bp_calibration</item>
<item name="1">@string/Cancel</item>
</string-array>
<string-array name="wxp_bp_cal_values">
<string-array name="sensors_bp_cal_values">
<item>0</item>
<item>1</item>
</string-array>
<string-array name="wxp_mode">
<item name="0">@string/wxp_mode_normal</item>
<item name="1">@string/wxp_mode_saving</item>
<item name="2">@string/wxp_mode_watch</item>
<string-array name="power_mode">
<item name="0">@string/power_mode_normal</item>
<item name="1">@string/power_mode_saving</item>
<item name="2">@string/power_mode_watch</item>
</string-array>
<string-array name="wxp_mode_values">
<string-array name="power_mode_values">
<item>0</item>
<item>1</item>
<item>2</item>

View File

@ -199,43 +199,40 @@
<string name="prefs_title_all_day_heart_rate">All day heart rate measurement</string>
<string name="preferences_hplus_settings">HPlus/Makibes settings</string>
<!-- WatchXPlus Preferences -->
<string name="title_activity_watchXplus_calibration">Watch X Plus calibration</string>
<string name="pref_wxp_title_unit_system">Units</string>
<string name="pref_wxp_title_timeformat">Time format</string>
<string name="pref_wxp_title_altitude">Altitude calibration</string>
<string name="pref_wxp_title_repeat_on_call">Repeat call notification</string>
<string name="pref_wxp_title_repeat_on_call_summary">Possible values min=0, max=10</string>
<string name="prefs_wxp_continious">Vibration during phone ring</string>
<string name="preferences_watchxplus_settings">Watch X Plus settings</string>
<string name="pref_header_wxp_call_notification">Notifications and Calls</string>
<string name="pref_wxp_title_reject_summary">Off - ignore, On - reject</string>
<string name="prefs_wxp_reject">Button ignore/reject call</string>
<string name="pref_wxp_title_shake_reject_summary">Duplicates watch button action</string>
<string name="prefs_wxp_shake_reject">Shake wrist ignore/reject call</string>
<string name="wxp_bp_calibration_prefs">Blood Pressure calibration</string>
<string name="pref_wxp_bp_calibration_low">Blood Pressure DIASTOLIC (low)</string>
<string name="pref_wxp_bp_calibration_high">Blood Pressure SYSTOLIC (high)</string>
<string name="prefs_wxp_button_bp_calibration">Calibration</string>
<string name="prefs_wxp_button_bp_calibration_sum">Press here to begin calibration</string>
<string name="pref_header_wxp_calibration">Sensors Calibration</string>
<string name="pref_header_wxp_settings">Device settings</string>
<string name="wxp_power_mode_title">Watch mode</string>
<string name="wxp_mode_normal">Normal</string>
<string name="wxp_mode_saving">Power saving</string>
<string name="wxp_mode_watch">Only watch</string>
<string name="pref_wxp_title_repeat_on_misscall_summary">Repeat missed call notification every minute for X times</string>
<string name="pref_wxp_title_repeat_on_misscall">Repeat missed call notification</string>
<string name="pref_wxp_enable_misscall">Notify for missed call</string>
<string name="pref_header_wxp_notification_callhandling">Call Handling</string>
<string name="pref_header_wxp_longsit">Inactivity reminder</string>
<string name="pref_wxp_longsit_period_summary">Remind if there is no activity for more than X minutes</string>
<string name="pref_wxp_longsit_switch_summary">Inactivity time interval is from DND setting</string>
<string name="prefs_wxp_longsit_switch">Enable inactivity reminder</string>
<string name="pref_wxp_title_longsit">Inactivity period (minutes)</string>
<string name="pref_wxp_title_force_time">Force synchronize time</string>
<string name="pref_wxp_title_force_time_sum">Force auto synchronize time on reconnect. Analog hands may show incorrect time!</string>
<string name="wxp_language_title">Language</string>
<string name="title_activity_LenovoWatch_calibration">Watch X Plus calibration</string>
<!-- Device Settings - Notifications and Calls - Used in devicesettings_watchxplus.xml -->
<string name="pref_header_notifications_and_calls">Notifications and Calls</string>
<string name="pref_title_notifications_and_calls_repeat_on_call">Repeat call notification</string>
<string name="prefs_notifications_and_calls_continious_ring">Notification during phone ring</string>
<string name="pref_notifications_and_calls_enable_misscall">Notify for missed call</string>
<string name="pref_summary_notifications_and_calls_enable_misscall">Repeats on every minute</string>
<string name="pref_title_notifications_and_calls_repeat_on_misscall">Repeat for X minutes</string>
<string name="pref_header_notifications_and_calls_callhandling">Call Handling</string>
<string name="prefs_notifications_and_calls_reject">Button ignore/reject call</string>
<string name="pref_summary_notifications_and_calls_title_reject">Off - ignore, On - reject</string>
<string name="prefs_notifications_and_calls_shake_reject">Shake wrist ignore/reject call</string>
<string name="pref_summary_notifications_and_calls_title_shake_reject">Duplicates watch button action</string>
<!-- Device Settings - Device Settings - Used in devicesettings_watchxplus.xml -->
<string name="pref_header_device_spec_settings">Device settings</string>
<string name="pref_title_device_spec_settings_force_time">Force synchronize time</string>
<string name="pref_summary_device_spec_settings_title_force_time">Force auto synchronize time on reconnect. Analog hands may show incorrect time!</string>
<!-- Device Settings - Calibration - Used in devicesettings_watchxplus.xml -->
<string name="pref_header_sensors_calibration">Sensors Calibration</string>
<string name="pref_title_sensors_altitude">Altitude calibration</string>
<string name="pref_sensors_bp_calibration">Blood Pressure calibration</string>
<string name="pref_sensors_bp_calibration_low">Blood Pressure DIASTOLIC (low)</string>
<string name="pref_sensors_bp_calibration_high">Blood Pressure SYSTOLIC (high)</string>
<string name="prefs_sensors_button_bp_calibration">Calibration</string>
<string name="prefs_sensors_button_bp_calibration_sum">Press here to begin calibration</string>
<!-- Device Settings - Long Sit Reminder -->
<string name="pref_summary_longsit">Remind if there are inactivity for X minutes</string>
<string name="prefs_longsit_switch">Inactivity reminder</string>
<string name="pref_title_longsit">Inactivity period (minutes)</string>
<!-- Device Settings - Power Mode -->
<string name="power_mode_title">Watch power mode</string>
<string name="power_mode_normal">Normal</string>
<string name="power_mode_saving">Power saving</string>
<string name="power_mode_watch">Only watch</string>
<!-- Makibes HR3 Preferences -->
<string name="preferences_makibes_hr3_settings">Makibes HR3 settings</string>
<!-- ID115 Preferences -->

View File

@ -0,0 +1,8 @@
<?xml version="1.0" encoding="utf-8"?>
<androidx.preference.PreferenceScreen xmlns:android="http://schemas.android.com/apk/res/android">
<SwitchPreference
android:icon="@drawable/ic_signal_cellular_connected_no_internet_0_bar"
android:defaultValue="false"
android:key="disconnect_notification_noshed"
android:title="@string/prefs_disconnect_notification" />
</androidx.preference.PreferenceScreen>

View File

@ -0,0 +1,8 @@
<?xml version="1.0" encoding="utf-8"?>
<androidx.preference.PreferenceScreen xmlns:android="http://schemas.android.com/apk/res/android">
<SwitchPreference
android:icon="@drawable/ic_arrow_upward"
android:defaultValue="false"
android:key="activate_display_on_lift_wrist_noshed"
android:title="@string/mi2_prefs_activate_display_on_lift" />
</androidx.preference.PreferenceScreen>

View File

@ -0,0 +1,35 @@
<?xml version="1.0" encoding="utf-8"?>
<androidx.preference.PreferenceScreen xmlns:android="http://schemas.android.com/apk/res/android">
<PreferenceScreen
android:icon="@drawable/ic_activity_sleep"
android:key="screen_longsit"
android:persistent="false"
android:summary="@string/pref_summary_longsit"
android:title="@string/prefs_longsit_switch">
<!-- workaround for missing toolbar -->
<PreferenceCategory android:title="@string/pref_summary_longsit" />
<SwitchPreference
android:defaultValue="false"
android:key="pref_longsit_switch"
android:title="@string/prefs_longsit_switch" />
<EditTextPreference
android:defaultValue="60"
android:key="pref_longsit_period"
android:summary="@string/pref_summary_longsit"
android:title="@string/pref_title_longsit"/>
<nodomain.freeyourgadget.gadgetbridge.util.XTimePreference
android:defaultValue="06:00"
android:key="pref_longsit_start"
android:title="@string/mi2_prefs_do_not_disturb_start" />
<nodomain.freeyourgadget.gadgetbridge.util.XTimePreference
android:defaultValue="23:00"
android:key="pref_longsit_end"
android:title="@string/mi2_prefs_do_not_disturb_end" />
</PreferenceScreen>
</androidx.preference.PreferenceScreen>

View File

@ -0,0 +1,11 @@
<?xml version="1.0" encoding="utf-8"?>
<androidx.preference.PreferenceScreen xmlns:android="http://schemas.android.com/apk/res/android">
<ListPreference
android:icon="@drawable/ic_quit"
android:defaultValue="0"
android:entries="@array/power_mode"
android:entryValues="@array/power_mode_values"
android:key="power_mode"
android:summary="%s"
android:title="@string/power_mode_title" />
</androidx.preference.PreferenceScreen>

View File

@ -0,0 +1,102 @@
<?xml version="1.0" encoding="utf-8"?>
<androidx.preference.PreferenceScreen xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto">
<PreferenceScreen
android:icon="@drawable/ic_find_lost_phone"
android:key="pref_category_notifications_and_calls"
android:title="@string/pref_header_notifications_and_calls">
<PreferenceCategory
android:title="@string/pref_screen_notification_profile_incoming_call"/>
<SeekBarPreference
android:icon="@drawable/ic_rotate_left"
android:defaultValue="0"
android:key="notification_repeat_ring"
android:max="10"
android:title="@string/pref_title_notifications_and_calls_repeat_on_call"
app:showSeekBarValue="true" />
<SwitchPreference
android:defaultValue="false"
android:key="notification_enable_continious_ring"
android:title="@string/prefs_notifications_and_calls_continious_ring" />
<PreferenceCategory
android:title="@string/pref_screen_notification_profile_missed_call"/>
<SwitchPreference
android:defaultValue="false"
android:key="notification_enable_missed_call"
android:title="@string/pref_notifications_and_calls_enable_misscall"
android:summary="@string/pref_summary_notifications_and_calls_enable_misscall"/>
<SeekBarPreference
android:icon="@drawable/ic_rotate_left"
android:defaultValue="0"
android:dependency="notification_enable_missed_call"
android:key="notification_repeat_missed_call"
android:max="10"
android:title="@string/pref_title_notifications_and_calls_repeat_on_misscall"
app:showSeekBarValue="true" />
<PreferenceCategory
android:title="@string/pref_header_notifications_and_calls_callhandling"/>
<SwitchPreference
android:defaultValue="false"
android:key="notification_button_reject"
android:summary="@string/pref_summary_notifications_and_calls_title_reject"
android:title="@string/prefs_notifications_and_calls_reject" />
<SwitchPreference
android:defaultValue="false"
android:key="notification_shake_reject"
android:summary="@string/pref_summary_notifications_and_calls_title_shake_reject"
android:title="@string/prefs_notifications_and_calls_shake_reject" />
</PreferenceScreen>
<PreferenceScreen
android:icon="@drawable/ic_widgets"
android:key="pref_category_device_spec_settings"
android:title="@string/pref_header_device_spec_settings">
<ListPreference
android:icon="@drawable/ic_language"
android:defaultValue="1"
android:title="@string/pref_title_language"
android:entries="@array/language_only_EN_CH"
android:entryValues="@array/language_only_EN_CH_values"
android:key="language"
android:summary="%s" />
<SwitchPreference
android:icon="@drawable/ic_access_time"
android:defaultValue="false"
android:key="pref_device_spec_settings_force_time"
android:summary="@string/pref_summary_device_spec_settings_title_force_time"
android:title="@string/pref_title_device_spec_settings_force_time" />
</PreferenceScreen>
<PreferenceScreen
android:icon="@drawable/ic_activity_unknown"
android:key="pref_sensors_calibration"
android:title="@string/pref_header_sensors_calibration">
<EditTextPreference
android:icon="@drawable/ic_arrow_upward"
android:defaultValue="200"
android:key="pref_sensors_altitude"
android:title="@string/pref_title_sensors_altitude"/>
<PreferenceScreen
android:key="pref_sensors_bp_calibration"
android:title="@string/pref_sensors_bp_calibration">
<PreferenceCategory
android:title="@string/pref_sensors_bp_calibration"/>
<EditTextPreference
android:inputType="number"
android:key="pref_sensors_bp_calibration_high"
android:defaultValue="130"
android:title="@string/pref_sensors_bp_calibration_high" />
<EditTextPreference
android:inputType="number"
android:key="pref_sensors_bp_calibration_low"
android:defaultValue="80"
android:title="@string/pref_sensors_bp_calibration_low" />
<ListPreference
android:defaultValue="1"
android:title="@string/prefs_sensors_button_bp_calibration"
android:entries="@array/sensors_bp_cal"
android:entryValues="@array/sensors_bp_cal_values"
android:key="prefs_sensors_button_bp_calibration"
android:summary="@string/prefs_sensors_button_bp_calibration_sum" />
</PreferenceScreen>
</PreferenceScreen>
</androidx.preference.PreferenceScreen>

View File

@ -580,12 +580,6 @@
android:icon="@drawable/ic_device_zetime"
android:key="pref_key_zetime"
android:title="@string/zetime_title_settings"/>
<Preference
android:icon="@drawable/ic_device_watchxplus"
android:key="pref_key_watchxplus"
android:title="@string/preferences_watchxplus_settings"/>
</PreferenceCategory>
<PreferenceCategory

View File

@ -1,133 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<PreferenceScreen xmlns:android="http://schemas.android.com/apk/res/android">
<PreferenceCategory
android:key="pref_category_watchxplus_notification"
android:title="@string/pref_header_wxp_call_notification">
<PreferenceScreen
android:key="pref_category_watchxplus_ringing"
android:title="@string/pref_screen_notification_profile_incoming_call">
<PreferenceCategory
android:title="@string/pref_screen_notification_profile_incoming_call"/>
<EditTextPreference
android:defaultValue="0"
android:key="watchxplus_repeat"
android:summary="@string/pref_wxp_title_repeat_on_call_summary"
android:title="@string/pref_wxp_title_repeat_on_call"/>
<CheckBoxPreference
android:layout="@layout/preference_checkbox"
android:defaultValue="false"
android:key="watchxplus_continious"
android:title="@string/prefs_wxp_continious" />
</PreferenceScreen>
<PreferenceScreen
android:key="pref_category_watchxplus_miss"
android:title="@string/pref_screen_notification_profile_missed_call">
<PreferenceCategory
android:title="@string/pref_screen_notification_profile_missed_call"/>
<CheckBoxPreference
android:layout="@layout/preference_checkbox"
android:defaultValue="false"
android:key="watchxplus_missed"
android:title="@string/pref_wxp_enable_misscall" />
<EditTextPreference
android:defaultValue="0"
android:key="watchxplus_repeat_missedcall"
android:dependency="watchxplus_missed"
android:summary="@string/pref_wxp_title_repeat_on_misscall_summary"
android:title="@string/pref_wxp_title_repeat_on_misscall"/>
</PreferenceScreen>
<PreferenceScreen
android:key="pref_category_watchxplus_callhandling"
android:title="@string/pref_header_wxp_notification_callhandling">
<PreferenceCategory
android:title="@string/pref_header_wxp_notification_callhandling"/>
<CheckBoxPreference
android:layout="@layout/preference_checkbox"
android:defaultValue="false"
android:key="watchxplus_button_reject"
android:summary="@string/pref_wxp_title_reject_summary"
android:title="@string/prefs_wxp_reject" />
<CheckBoxPreference
android:layout="@layout/preference_checkbox"
android:defaultValue="false"
android:key="watchxplus_shake_reject"
android:summary="@string/pref_wxp_title_shake_reject_summary"
android:title="@string/prefs_wxp_shake_reject" />
</PreferenceScreen>
</PreferenceCategory>
<PreferenceCategory
android:key="pref_category_watchxplus_settings"
android:title="@string/pref_header_wxp_settings">
<ListPreference
android:defaultValue="0"
android:title="@string/wxp_power_mode_title"
android:entries="@array/wxp_mode"
android:entryValues="@array/wxp_mode_values"
android:key="pref_wxp_power"
android:summary="%s" />
<ListPreference
android:defaultValue="1"
android:title="@string/pref_title_language"
android:entries="@array/wxp_language"
android:entryValues="@array/wxp_language_values"
android:key="pref_wxp_language"
android:summary="%s" />
<PreferenceScreen
android:key="pref_category_watchxplus_longsit_settings"
android:title="@string/pref_header_wxp_longsit">
<PreferenceCategory
android:title="@string/pref_header_wxp_longsit"/>
<EditTextPreference
android:defaultValue="60"
android:key="pref_watchxplus_longsit_period"
android:summary="@string/pref_wxp_longsit_period_summary"
android:title="@string/pref_wxp_title_longsit"/>
<CheckBoxPreference
android:layout="@layout/preference_checkbox"
android:defaultValue="false"
android:key="pref_watchxplus_longsit_switch"
android:summary="@string/pref_wxp_longsit_switch_summary"
android:title="@string/prefs_wxp_longsit_switch" />
</PreferenceScreen>
<CheckBoxPreference
android:layout="@layout/preference_checkbox"
android:defaultValue="false"
android:key="pref_wxp_force_time"
android:summary="@string/pref_wxp_title_force_time_sum"
android:title="@string/pref_wxp_title_force_time" />
</PreferenceCategory>
<PreferenceCategory
android:key="pref_category_watchxplus_calibration"
android:title="@string/pref_header_wxp_calibration">
<EditTextPreference
android:defaultValue="200"
android:key="pref_watchxplus_altitude"
android:title="@string/pref_wxp_title_altitude"/>
<PreferenceScreen
android:key="wxp_bp_calibration"
android:title="@string/wxp_bp_calibration_prefs">
<PreferenceCategory
android:title="@string/wxp_bp_calibration_prefs"/>
<EditTextPreference
android:inputType="number"
android:key="pref_wxp_bp_calibration_low"
android:defaultValue="80"
android:title="@string/pref_wxp_bp_calibration_low" />
<EditTextPreference
android:inputType="number"
android:key="pref_wxp_bp_calibration_high"
android:defaultValue="130"
android:title="@string/pref_wxp_bp_calibration_high" />
<ListPreference
android:defaultValue="1"
android:title="@string/prefs_wxp_button_bp_calibration"
android:entries="@array/wxp_bp_cal"
android:entryValues="@array/wxp_bp_cal_values"
android:key="wxp_button_BP_calibration_list"
android:summary="@string/prefs_wxp_button_bp_calibration_sum" />
</PreferenceScreen>
</PreferenceCategory>
</PreferenceScreen>