mirror of
https://codeberg.org/Freeyourgadget/Gadgetbridge
synced 2024-11-28 04:46:51 +01:00
Change user goal distance preference to use meters instead of km.
This commit is contained in:
parent
71a1605445
commit
0da866f70a
@ -177,7 +177,7 @@ public class ZeTimeConstants {
|
||||
public static final String PREF_USER_FITNESS_GOAL = "mi_fitness_goal";
|
||||
public static final String PREF_USER_SLEEP_GOAL = "activity_user_sleep_duration";
|
||||
public static final String PREF_USER_CALORIES_GOAL = "activity_user_calories_burnt";
|
||||
public static final String PREF_USER_DISTANCE_GOAL = "activity_user_distance_kmeters";
|
||||
public static final String PREF_USER_DISTANCE_GOAL = "activity_user_distance_meters";
|
||||
public static final String PREF_USER_ACTIVETIME_GOAL = "activity_user_activetime_minutes";
|
||||
|
||||
public static final String PREF_SHOCK_STRENGTH = "zetime_shock_strength";
|
||||
|
@ -42,7 +42,7 @@ public class ActivityUser {
|
||||
private int activityUserSleepDuration;
|
||||
private int activityUserStepsGoal;
|
||||
private int activityUserCaloriesBurnt;
|
||||
private int activityUserDistanceKMeters;
|
||||
private int activityUserDistanceMeters;
|
||||
private int activityUserActiveTimeMinutes;
|
||||
|
||||
private static final String defaultUserName = "gadgetbridge-user";
|
||||
@ -54,7 +54,7 @@ public class ActivityUser {
|
||||
public static final int defaultUserSleepDuration = 7;
|
||||
public static final int defaultUserStepsGoal = 8000;
|
||||
public static final int defaultUserCaloriesBurnt = 2000;
|
||||
public static final int defaultUserDistanceKMeters = 5;
|
||||
public static final int defaultUserDistanceMeters = 5000;
|
||||
public static final int defaultUserActiveTimeMinutes = 60;
|
||||
|
||||
public static final String PREF_USER_NAME = "mi_user_alias";
|
||||
@ -65,7 +65,7 @@ public class ActivityUser {
|
||||
public static final String PREF_USER_SLEEP_DURATION = "activity_user_sleep_duration";
|
||||
public static final String PREF_USER_STEPS_GOAL = "mi_fitness_goal"; // FIXME: for compatibility
|
||||
public static final String PREF_USER_CALORIES_BURNT = "activity_user_calories_burnt";
|
||||
public static final String PREF_USER_DISTANCE_KMETERS = "activity_user_distance_kmeters";
|
||||
public static final String PREF_USER_DISTANCE_METERS = "activity_user_distance_meters";
|
||||
public static final String PREF_USER_ACTIVETIME_MINUTES = "activity_user_activetime_minutes";
|
||||
|
||||
public ActivityUser() {
|
||||
@ -137,7 +137,7 @@ public class ActivityUser {
|
||||
activityUserSleepDuration = prefs.getInt(PREF_USER_SLEEP_DURATION, defaultUserSleepDuration);
|
||||
activityUserStepsGoal = prefs.getInt(PREF_USER_STEPS_GOAL, defaultUserStepsGoal);
|
||||
activityUserCaloriesBurnt = prefs.getInt(PREF_USER_CALORIES_BURNT, defaultUserCaloriesBurnt);
|
||||
activityUserDistanceKMeters = prefs.getInt(PREF_USER_DISTANCE_KMETERS, defaultUserDistanceKMeters);
|
||||
activityUserDistanceMeters = prefs.getInt(PREF_USER_DISTANCE_METERS, defaultUserDistanceMeters);
|
||||
activityUserActiveTimeMinutes = prefs.getInt(PREF_USER_ACTIVETIME_MINUTES, defaultUserActiveTimeMinutes);
|
||||
}
|
||||
|
||||
@ -155,12 +155,12 @@ public class ActivityUser {
|
||||
return activityUserCaloriesBurnt;
|
||||
}
|
||||
|
||||
public int getDistanceKMeters()
|
||||
public int getDistanceMeters()
|
||||
{
|
||||
if (activityUserDistanceKMeters < 0) {
|
||||
activityUserDistanceKMeters = defaultUserDistanceKMeters;
|
||||
if (activityUserDistanceMeters < 0) {
|
||||
activityUserDistanceMeters = defaultUserDistanceMeters;
|
||||
}
|
||||
return activityUserDistanceKMeters;
|
||||
return activityUserDistanceMeters;
|
||||
}
|
||||
|
||||
public int getActiveTimeMinutes()
|
||||
|
@ -1537,7 +1537,7 @@ public class ZeTimeDeviceSupport extends AbstractBTLEDeviceSupport {
|
||||
ActivityUser activityUser = new ActivityUser();
|
||||
int steps = activityUser.getStepsGoal() / 100; // ZeTime expect the steps in 100 increment
|
||||
int calories = activityUser.getCaloriesBurnt();
|
||||
int distance = activityUser.getDistanceKMeters();
|
||||
int distance = activityUser.getDistanceMeters() / 1000; // ZeTime only accepts km goals
|
||||
int sleep = activityUser.getSleepDuration();
|
||||
int activeTime = activityUser.getActiveTimeMinutes();
|
||||
|
||||
@ -2193,6 +2193,7 @@ public class ZeTimeDeviceSupport extends AbstractBTLEDeviceSupport {
|
||||
if (getDevice().isBusy()) {
|
||||
getDevice().unsetBusyTask();
|
||||
getDevice().sendDeviceUpdateIntent(getContext());
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -647,7 +647,7 @@
|
||||
|
||||
|
||||
<string name="activity_prefs_calories_burnt">Tägliches Ziel: verbrannte Kalorien</string>
|
||||
<string name="activity_prefs_distance_km">Tägliches Ziel: zurückgelegte Strecke in km</string>
|
||||
<string name="activity_prefs_distance_meters">Tägliches Ziel: zurückgelegte Strecke in Meter</string>
|
||||
<string name="activity_prefs_activetime_minutes">Tägliches Ziel: aktive Zeit in Minuten</string>
|
||||
|
||||
<!-- ZeTime Preferences -->
|
||||
|
@ -558,7 +558,7 @@
|
||||
<string name="live_activity_heart_rate">Heart rate</string>
|
||||
|
||||
<string name="activity_prefs_calories_burnt">Daily target: calories burnt</string>
|
||||
<string name="activity_prefs_distance_km">Daily target: distance in km</string>
|
||||
<string name="activity_prefs_distance_meters">Daily target: distance in meters</string>
|
||||
<string name="activity_prefs_activetime_minutes">Daily target: active time in minutes</string>
|
||||
|
||||
<string name="pref_title_pebble_health_store_raw">Store raw record in the database</string>
|
||||
|
@ -146,9 +146,9 @@
|
||||
<EditTextPreference
|
||||
android:defaultValue="5"
|
||||
android:inputType="number"
|
||||
android:key="activity_user_distance_kmeters"
|
||||
android:maxLength="3"
|
||||
android:title="@string/activity_prefs_distance_km" />
|
||||
android:key="activity_user_distance_meters"
|
||||
android:maxLength="5"
|
||||
android:title="@string/activity_prefs_distance_meters" />
|
||||
|
||||
<EditTextPreference
|
||||
android:defaultValue="60"
|
||||
|
Loading…
Reference in New Issue
Block a user