Merge branch 'master' into db-refactoring

This commit is contained in:
cpfeiffer 2016-05-05 10:19:19 +02:00
commit cc5941f7eb
10 changed files with 39 additions and 4 deletions

View File

@ -61,6 +61,8 @@ For more information read [this wiki article](https://github.com/Freeyourgadget/
* Generic Android notifications
* Synchronize the time to the Mi Band
* Display firmware version and battery state
* Firmware Update
* Heartrate Measurement (alpha)
* Synchronize activity data
* Display sleep data (alpha)
* Display sports data (step count) (alpha)

View File

@ -390,7 +390,8 @@ public class ControlCenter extends GBActivity {
}
if (connected) {
hintTextView.setText(R.string.tap_connected_device_for_app_mananger);
DeviceCoordinator coordinator = DeviceHelper.getInstance().getCoordinator(selectedDevice);
hintTextView.setText(coordinator.getTapString());
} else if (!deviceList.isEmpty()) {
hintTextView.setText(R.string.tap_a_device_to_connect);
}

View File

@ -107,4 +107,6 @@ public interface DeviceCoordinator {
* @return
*/
boolean supportsAlarmConfiguration();
int getTapString();
}

View File

@ -88,4 +88,9 @@ public class UnknownDeviceCoordinator extends AbstractDeviceCoordinator {
public boolean supportsAlarmConfiguration() {
return false;
}
@Override
public int getTapString() {
return 0;
}
}

View File

@ -8,6 +8,7 @@ import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import nodomain.freeyourgadget.gadgetbridge.GBApplication;
import nodomain.freeyourgadget.gadgetbridge.R;
import nodomain.freeyourgadget.gadgetbridge.activities.charts.ChartsActivity;
import nodomain.freeyourgadget.gadgetbridge.devices.AbstractDeviceCoordinator;
import nodomain.freeyourgadget.gadgetbridge.devices.InstallHandler;
@ -78,6 +79,11 @@ public class MiBandCoordinator extends AbstractDeviceCoordinator {
return true;
}
@Override
public int getTapString() {
return R.string.tap_connected_device_for_activity;
}
public static boolean hasValidUserInfo() {
String dummyMacAddress = MiBandService.MAC_ADDRESS_FILTER_1_1A + ":00:00:00";
try {

View File

@ -61,7 +61,6 @@ public class MiBandPreferencesActivity extends AbstractSettingsActivity {
PREF_USER_ALIAS,
PREF_MIBAND_ADDRESS,
PREF_MIBAND_FITNESS_GOAL,
PREF_MIBAND_DONT_ACK_TRANSFER,
PREF_MIBAND_RESERVE_ALARM_FOR_CALENDAR,
getNotificationPrefKey(VIBRATION_COUNT, ORIGIN_SMS),
getNotificationPrefKey(VIBRATION_COUNT, ORIGIN_INCOMING_CALL),

View File

@ -5,6 +5,7 @@ import android.content.Context;
import android.net.Uri;
import nodomain.freeyourgadget.gadgetbridge.GBApplication;
import nodomain.freeyourgadget.gadgetbridge.R;
import nodomain.freeyourgadget.gadgetbridge.activities.AppManagerActivity;
import nodomain.freeyourgadget.gadgetbridge.devices.AbstractDeviceCoordinator;
import nodomain.freeyourgadget.gadgetbridge.devices.InstallHandler;
@ -80,4 +81,9 @@ public class PebbleCoordinator extends AbstractDeviceCoordinator {
public boolean supportsAlarmConfiguration() {
return false;
}
@Override
public int getTapString() {
return R.string.tap_connected_device_for_app_mananger;
}
}

View File

@ -13,6 +13,7 @@ import java.io.IOException;
import java.util.Arrays;
import java.util.UUID;
import nodomain.freeyourgadget.gadgetbridge.GBApplication;
import nodomain.freeyourgadget.gadgetbridge.R;
import nodomain.freeyourgadget.gadgetbridge.deviceevents.GBDeviceEventDisplayMessage;
import nodomain.freeyourgadget.gadgetbridge.devices.miband.MiBandFWHelper;
@ -25,6 +26,7 @@ import nodomain.freeyourgadget.gadgetbridge.service.devices.miband.AbstractMiFir
import nodomain.freeyourgadget.gadgetbridge.service.devices.miband.MiBandSupport;
import nodomain.freeyourgadget.gadgetbridge.util.CheckSums;
import nodomain.freeyourgadget.gadgetbridge.util.GB;
import nodomain.freeyourgadget.gadgetbridge.util.Prefs;
public class UpdateFirmwareOperation extends AbstractMiBandOperation {
private static final Logger LOG = LoggerFactory.getLogger(UpdateFirmwareOperation.class);
@ -32,6 +34,7 @@ public class UpdateFirmwareOperation extends AbstractMiBandOperation {
private final Uri uri;
private boolean firmwareInfoSent = false;
private UpdateCoordinator updateCoordinator;
final Prefs prefs = GBApplication.getPrefs();
public UpdateFirmwareOperation(Uri uri, MiBandSupport support) {
super(support);
@ -285,7 +288,9 @@ public class UpdateFirmwareOperation extends AbstractMiBandOperation {
int firmwareProgress = 0;
TransactionBuilder builder = performInitialized("send firmware packet");
// getSupport().setLowLatency(builder);
if (prefs.getBoolean("mi_low_latency_fw_update", false)) {
getSupport().setLowLatency(builder);
}
for (int i = 0; i < packets; i++) {
byte[] fwChunk = Arrays.copyOfRange(fwbytes, i * packetLength, i * packetLength + packetLength);

View File

@ -87,6 +87,7 @@
<string name="bluetooth_is_not_supported_">Bluetooth is not supported.</string>
<string name="bluetooth_is_disabled_">Bluetooth is disabled.</string>
<string name="tap_connected_device_for_app_mananger">Tap connected device for App Manager</string>
<string name="tap_connected_device_for_activity">Tap connected device for Activiy</string>
<string name="tap_a_device_to_connect">Tap a device to connect</string>
<string name="cannot_connect_bt_address_invalid_">Cannot connect. BT address invalid?</string>
<string name="gadgetbridge_running">Gadgetbridge running</string>
@ -198,9 +199,12 @@
<string name="chart_steps">Steps</string>
<string name="liveactivity_live_activity">Live Activity</string>
<string name="weeksteps_today_steps_description">Steps today, target: %1$s</string>
<string name="pref_title_dont_ack_transfer">Do not ack activity data transfer</string>
<string name="pref_summary_dont_ack_transfers">If the activity data are not acked to the band, they will not be cleared. Useful if GB is used together with other apps.</string>
<string name="pref_summary_keep_data_on_device">Will keep activity data on the Mi Band even after synchronization. Useful if GB is used together with other apps.</string>
<string name="pref_title_dont_ack_transfer">Do not ack activity data transfer</string>
<string name="pref_title_low_latency_fw_update">Use low-latency mode for FW updates</string>
<string name="pref_summary_low_latency_fw_update">This might help on devices where firmware updates fail</string>
<string name="live_activity_steps_history">Steps History</string>
<string name="live_activity_current_steps_per_minute">Current steps/min</string>
<string name="live_activity_total_steps">Total Steps</string>

View File

@ -161,5 +161,10 @@
android:title="@string/pref_title_keep_data_on_device"
android:summary="@string/pref_summary_keep_data_on_device"
android:defaultValue="false" />
<CheckBoxPreference
android:key="mi_low_latency_fw_update"
android:title="@string/pref_title_low_latency_fw_update"
android:summary="@string/pref_summary_low_latency_fw_update"
android:defaultValue="false" />
</PreferenceCategory>
</PreferenceScreen>