mirror of
https://codeberg.org/Freeyourgadget/Gadgetbridge
synced 2024-12-29 12:05:53 +01:00
Use ActivityUser.defaultUserStepsGoal instead of hardcoded values
ActivityUser has room for improvement, though.
This commit is contained in:
parent
226ae54ae6
commit
934f36f45a
@ -442,7 +442,7 @@ public class LiveActivityFragment extends AbstractChartFragment {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private BarDataSet setupTotalStepsChart(CustomBarChart chart, BarEntry entry, String label) {
|
private BarDataSet setupTotalStepsChart(CustomBarChart chart, BarEntry entry, String label) {
|
||||||
mTotalStepsChart.getAxisLeft().addLimitLine(new LimitLine(GBApplication.getPrefs().getInt(ActivityUser.PREF_USER_STEPS_GOAL, 10000), "ss")); // TODO: use daily goal - already reached steps
|
mTotalStepsChart.getAxisLeft().addLimitLine(new LimitLine(GBApplication.getPrefs().getInt(ActivityUser.PREF_USER_STEPS_GOAL, ActivityUser.defaultUserStepsGoal), "ss")); // TODO: use daily goal - already reached steps
|
||||||
mTotalStepsChart.getAxisLeft().setAxisMinimum(0);
|
mTotalStepsChart.getAxisLeft().setAxisMinimum(0);
|
||||||
mTotalStepsChart.setAutoScaleMinMaxEnabled(true);
|
mTotalStepsChart.setAutoScaleMinMaxEnabled(true);
|
||||||
return setupCommonChart(chart, entry, label); // at the moment, these look the same
|
return setupCommonChart(chart, entry, label); // at the moment, these look the same
|
||||||
|
@ -40,7 +40,7 @@ public class WeekStepsChartFragment extends AbstractWeekChartFragment {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
int getGoal() {
|
int getGoal() {
|
||||||
return GBApplication.getPrefs().getInt(ActivityUser.PREF_USER_STEPS_GOAL, 10000);
|
return GBApplication.getPrefs().getInt(ActivityUser.PREF_USER_STEPS_GOAL, ActivityUser.defaultUserStepsGoal);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -377,7 +377,7 @@ public class HuamiSupport extends AbstractBTLEDeviceSupport {
|
|||||||
LOG.info("Attempting to set Fitness Goal...");
|
LOG.info("Attempting to set Fitness Goal...");
|
||||||
BluetoothGattCharacteristic characteristic = getCharacteristic(HuamiService.UUID_CHARACTERISTIC_8_USER_SETTINGS);
|
BluetoothGattCharacteristic characteristic = getCharacteristic(HuamiService.UUID_CHARACTERISTIC_8_USER_SETTINGS);
|
||||||
if (characteristic != null) {
|
if (characteristic != null) {
|
||||||
int fitnessGoal = GBApplication.getPrefs().getInt(ActivityUser.PREF_USER_STEPS_GOAL, 10000);
|
int fitnessGoal = GBApplication.getPrefs().getInt(ActivityUser.PREF_USER_STEPS_GOAL, ActivityUser.defaultUserStepsGoal);
|
||||||
byte[] bytes = ArrayUtils.addAll(
|
byte[] bytes = ArrayUtils.addAll(
|
||||||
HuamiService.COMMAND_SET_FITNESS_GOAL_START,
|
HuamiService.COMMAND_SET_FITNESS_GOAL_START,
|
||||||
BLETypeConversions.fromUint16(fitnessGoal));
|
BLETypeConversions.fromUint16(fitnessGoal));
|
||||||
|
@ -389,7 +389,7 @@ public class MiBandSupport extends AbstractBTLEDeviceSupport {
|
|||||||
LOG.info("Attempting to set Fitness Goal...");
|
LOG.info("Attempting to set Fitness Goal...");
|
||||||
BluetoothGattCharacteristic characteristic = getCharacteristic(MiBandService.UUID_CHARACTERISTIC_CONTROL_POINT);
|
BluetoothGattCharacteristic characteristic = getCharacteristic(MiBandService.UUID_CHARACTERISTIC_CONTROL_POINT);
|
||||||
if (characteristic != null) {
|
if (characteristic != null) {
|
||||||
int fitnessGoal = GBApplication.getPrefs().getInt(ActivityUser.PREF_USER_STEPS_GOAL, 10000);
|
int fitnessGoal = GBApplication.getPrefs().getInt(ActivityUser.PREF_USER_STEPS_GOAL, ActivityUser.defaultUserStepsGoal);
|
||||||
transaction.write(characteristic, new byte[]{
|
transaction.write(characteristic, new byte[]{
|
||||||
MiBandService.COMMAND_SET_FITNESS_GOAL,
|
MiBandService.COMMAND_SET_FITNESS_GOAL,
|
||||||
0,
|
0,
|
||||||
|
Loading…
Reference in New Issue
Block a user