1
0
mirror of https://codeberg.org/Freeyourgadget/Gadgetbridge synced 2024-11-05 17:57:03 +01:00

makibes hr3.

added fakeBattery.
fixed string comparison using operator.
This commit is contained in:
Cre3per 2019-10-08 17:18:41 +02:00 committed by Andreas Shimokawa
parent 1262970494
commit 5570ac8349
2 changed files with 20 additions and 4 deletions

View File

@ -55,14 +55,14 @@ public class MakibesHR3Coordinator extends AbstractDeviceCoordinator {
String liftMode = sharedPrefs.getString(MakibesHR3Constants.PREF_HEADS_UP_SCREEN, getContext().getString(R.string.p_on)); String liftMode = sharedPrefs.getString(MakibesHR3Constants.PREF_HEADS_UP_SCREEN, getContext().getString(R.string.p_on));
// Makibes HR3 doesn't support scheduled intervals. Treat it as "on". // Makibes HR3 doesn't support scheduled intervals. Treat it as "on".
return (liftMode != getContext().getString(R.string.p_off)); return !liftMode.equals(getContext().getString(R.string.p_off));
} }
public static boolean shouldEnableLostReminder(SharedPreferences sharedPrefs) { public static boolean shouldEnableLostReminder(SharedPreferences sharedPrefs) {
String lostReminder = sharedPrefs.getString(MakibesHR3Constants.PREF_LOST_REMINDER, getContext().getString(R.string.p_on)); String lostReminder = sharedPrefs.getString(MakibesHR3Constants.PREF_LOST_REMINDER, getContext().getString(R.string.p_on));
// Makibes HR3 doesn't support scheduled intervals. Treat it as "on". // Makibes HR3 doesn't support scheduled intervals. Treat it as "on".
return (lostReminder != getContext().getString(R.string.p_off)); return !lostReminder.equals(getContext().getString(R.string.p_off));
} }
public static byte getTimeMode(SharedPreferences sharedPrefs) { public static byte getTimeMode(SharedPreferences sharedPrefs) {

View File

@ -4,8 +4,6 @@
// TODO: All the commands that aren't supported by GB should be added to device specific settings. // TODO: All the commands that aren't supported by GB should be added to device specific settings.
// TODO: GB doesn't always display the step count even though there's a sample in the db.
// TODO: It'd be cool if we could change the language. There's no official way to do so, but the // TODO: It'd be cool if we could change the language. There's no official way to do so, but the
// TODO: watch is sold as chinese/english. Screen-on-time would be nice too. // TODO: watch is sold as chinese/english. Screen-on-time would be nice too.
@ -560,8 +558,26 @@ public class MakibesHR3DeviceSupport extends AbstractBTLEDeviceSupport implement
} }
} }
/**
* Use to show the battery icon in the device card.
* If the icon shows up later, the user might be trying to tap one thing but the battery icon
* will shift everything.
* This is hacky. There should be a "supportsBattery" function in the coordinator that displays
* the battery icon before the battery level is received.
*/
private void fakeBattery() {
GBDeviceEventBatteryInfo batteryInfo = new GBDeviceEventBatteryInfo();
batteryInfo.level = 100;
batteryInfo.state = BatteryState.UNKNOWN;
this.handleGBDeviceEvent(batteryInfo);
}
@Override @Override
protected TransactionBuilder initializeDevice(TransactionBuilder builder) { protected TransactionBuilder initializeDevice(TransactionBuilder builder) {
this.fakeBattery();
GB.updateTransferNotification(null, getContext().getString(R.string.busy_task_fetch_activity_data), true, 0, getContext()); GB.updateTransferNotification(null, getContext().getString(R.string.busy_task_fetch_activity_data), true, 0, getContext());
gbDevice.setState(GBDevice.State.INITIALIZING); gbDevice.setState(GBDevice.State.INITIALIZING);