mirror of
https://codeberg.org/Freeyourgadget/Gadgetbridge
synced 2024-12-27 02:55:50 +01:00
Reduce stutters on device changes / data fetch
This commit is contained in:
parent
7d9f8704c9
commit
2db88c63db
@ -93,11 +93,13 @@ public class DashboardFragment extends Fragment {
|
|||||||
String action = intent.getAction();
|
String action = intent.getAction();
|
||||||
if (action == null) return;
|
if (action == null) return;
|
||||||
switch (action) {
|
switch (action) {
|
||||||
case GBDevice.ACTION_DEVICE_CHANGED:
|
case GBApplication.ACTION_NEW_DATA:
|
||||||
GBDevice dev = intent.getParcelableExtra(GBDevice.EXTRA_DEVICE);
|
final GBDevice dev = intent.getParcelableExtra(GBDevice.EXTRA_DEVICE);
|
||||||
if (dev != null && !dev.isBusy()) {
|
if (dev != null && !dev.isBusy()) {
|
||||||
|
if (dashboardData.showAllDevices || dashboardData.showDeviceList.contains(dev.getAddress())) {
|
||||||
refresh();
|
refresh();
|
||||||
}
|
}
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
case ACTION_CONFIG_CHANGE:
|
case ACTION_CONFIG_CHANGE:
|
||||||
isConfigChanged = true;
|
isConfigChanged = true;
|
||||||
@ -140,6 +142,7 @@ public class DashboardFragment extends Fragment {
|
|||||||
|
|
||||||
IntentFilter filterLocal = new IntentFilter();
|
IntentFilter filterLocal = new IntentFilter();
|
||||||
filterLocal.addAction(GBDevice.ACTION_DEVICE_CHANGED);
|
filterLocal.addAction(GBDevice.ACTION_DEVICE_CHANGED);
|
||||||
|
filterLocal.addAction(GBApplication.ACTION_NEW_DATA);
|
||||||
filterLocal.addAction(ACTION_CONFIG_CHANGE);
|
filterLocal.addAction(ACTION_CONFIG_CHANGE);
|
||||||
LocalBroadcastManager.getInstance(requireContext()).registerReceiver(mReceiver, filterLocal);
|
LocalBroadcastManager.getInstance(requireContext()).registerReceiver(mReceiver, filterLocal);
|
||||||
|
|
||||||
|
@ -75,9 +75,17 @@ public class DevicesFragment extends Fragment {
|
|||||||
switch (Objects.requireNonNull(action)) {
|
switch (Objects.requireNonNull(action)) {
|
||||||
case DeviceManager.ACTION_DEVICES_CHANGED:
|
case DeviceManager.ACTION_DEVICES_CHANGED:
|
||||||
case GBApplication.ACTION_NEW_DATA:
|
case GBApplication.ACTION_NEW_DATA:
|
||||||
createRefreshTask("get activity data", requireContext()).execute();
|
final GBDevice device = intent.getParcelableExtra(GBDevice.EXTRA_DEVICE);
|
||||||
mGBDeviceAdapter.rebuildFolders();
|
if (action.equals(GBApplication.ACTION_NEW_DATA)) {
|
||||||
|
createRefreshTask("get activity data", requireContext(), device).execute();
|
||||||
|
}
|
||||||
|
if (device != null) {
|
||||||
|
// Refresh only this device
|
||||||
|
refreshSingleDevice(device);
|
||||||
|
} else {
|
||||||
refreshPairedDevices();
|
refreshPairedDevices();
|
||||||
|
}
|
||||||
|
|
||||||
break;
|
break;
|
||||||
case DeviceService.ACTION_REALTIME_SAMPLES:
|
case DeviceService.ACTION_REALTIME_SAMPLES:
|
||||||
handleRealtimeSample(intent.getSerializableExtra(DeviceService.EXTRA_REALTIME_SAMPLE));
|
handleRealtimeSample(intent.getSerializableExtra(DeviceService.EXTRA_REALTIME_SAMPLE));
|
||||||
@ -117,7 +125,7 @@ public class DevicesFragment extends Fragment {
|
|||||||
@Override
|
@Override
|
||||||
public void run() {
|
public void run() {
|
||||||
if (getContext() != null) {
|
if (getContext() != null) {
|
||||||
createRefreshTask("get activity data", getContext()).execute();
|
createRefreshTask("get activity data", getContext(), null).execute();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
@ -216,36 +224,56 @@ public class DevicesFragment extends Fragment {
|
|||||||
|
|
||||||
public void refreshPairedDevices() {
|
public void refreshPairedDevices() {
|
||||||
if (mGBDeviceAdapter != null) {
|
if (mGBDeviceAdapter != null) {
|
||||||
mGBDeviceAdapter.notifyDataSetChanged();
|
|
||||||
mGBDeviceAdapter.rebuildFolders();
|
mGBDeviceAdapter.rebuildFolders();
|
||||||
|
mGBDeviceAdapter.notifyDataSetChanged();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public RefreshTask createRefreshTask(String task, Context context) {
|
public void refreshSingleDevice(final GBDevice device) {
|
||||||
return new RefreshTask(task, context);
|
if (mGBDeviceAdapter != null) {
|
||||||
|
mGBDeviceAdapter.refreshSingleDevice(device);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public RefreshTask createRefreshTask(String task, Context context, GBDevice device) {
|
||||||
|
return new RefreshTask(task, context, device);
|
||||||
}
|
}
|
||||||
|
|
||||||
public class RefreshTask extends DBAccess {
|
public class RefreshTask extends DBAccess {
|
||||||
public RefreshTask(String task, Context context) {
|
private final GBDevice device;
|
||||||
|
|
||||||
|
public RefreshTask(final String task, final Context context, final GBDevice device) {
|
||||||
super(task, context);
|
super(task, context);
|
||||||
|
this.device = device;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void doInBackground(DBHandler db) {
|
protected void doInBackground(final DBHandler db) {
|
||||||
|
if (device != null) {
|
||||||
|
updateDevice(db, device);
|
||||||
|
} else {
|
||||||
for (GBDevice gbDevice : deviceList) {
|
for (GBDevice gbDevice : deviceList) {
|
||||||
|
updateDevice(db, gbDevice);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void updateDevice(final DBHandler db, final GBDevice gbDevice) {
|
||||||
final DeviceCoordinator coordinator = gbDevice.getDeviceCoordinator();
|
final DeviceCoordinator coordinator = gbDevice.getDeviceCoordinator();
|
||||||
boolean showActivityCard = GBApplication.getDevicePrefs(gbDevice.getAddress()).getBoolean(DeviceSettingsPreferenceConst.PREFS_ACTIVITY_IN_DEVICE_CARD, true);
|
final boolean showActivityCard = GBApplication.getDevicePrefs(gbDevice.getAddress()).getBoolean(DeviceSettingsPreferenceConst.PREFS_ACTIVITY_IN_DEVICE_CARD, true);
|
||||||
if (coordinator.supportsActivityTracking() && showActivityCard) {
|
if (coordinator.supportsActivityTracking() && showActivityCard) {
|
||||||
long[] stepsAndSleepData = getSteps(gbDevice, db);
|
final long[] stepsAndSleepData = getSteps(gbDevice, db);
|
||||||
deviceActivityHashMap.put(gbDevice.getAddress(), stepsAndSleepData);
|
deviceActivityHashMap.put(gbDevice.getAddress(), stepsAndSleepData);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void onPostExecute(Object o) {
|
protected void onPostExecute(final Object o) {
|
||||||
|
if (device != null) {
|
||||||
|
refreshSingleDevice(device);
|
||||||
|
} else {
|
||||||
refreshPairedDevices();
|
refreshPairedDevices();
|
||||||
}
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -21,6 +21,7 @@ package nodomain.freeyourgadget.gadgetbridge.adapter;
|
|||||||
|
|
||||||
import static nodomain.freeyourgadget.gadgetbridge.model.DeviceService.ACTION_CONNECT;
|
import static nodomain.freeyourgadget.gadgetbridge.model.DeviceService.ACTION_CONNECT;
|
||||||
|
|
||||||
|
import android.annotation.SuppressLint;
|
||||||
import android.app.Activity;
|
import android.app.Activity;
|
||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
import android.content.DialogInterface;
|
import android.content.DialogInterface;
|
||||||
@ -143,7 +144,7 @@ public class GBDeviceAdapterv2 extends ListAdapter<GBDevice, GBDeviceAdapterv2.V
|
|||||||
private String expandedFolderName = "";
|
private String expandedFolderName = "";
|
||||||
private ViewGroup parent;
|
private ViewGroup parent;
|
||||||
private HashMap<String, long[]> deviceActivityMap = new HashMap();
|
private HashMap<String, long[]> deviceActivityMap = new HashMap();
|
||||||
private StableIdGenerator idGenerator = new StableIdGenerator();
|
private final StableIdGenerator idGenerator = new StableIdGenerator();
|
||||||
|
|
||||||
public GBDeviceAdapterv2(Context context, List<GBDevice> deviceList, HashMap<String,long[]> deviceMap) {
|
public GBDeviceAdapterv2(Context context, List<GBDevice> deviceList, HashMap<String,long[]> deviceMap) {
|
||||||
super(new GBDeviceDiffUtil());
|
super(new GBDeviceDiffUtil());
|
||||||
@ -153,10 +154,22 @@ public class GBDeviceAdapterv2 extends ListAdapter<GBDevice, GBDeviceAdapterv2.V
|
|||||||
this.deviceActivityMap = deviceMap;
|
this.deviceActivityMap = deviceMap;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void rebuildFolders(){
|
public void rebuildFolders() {
|
||||||
this.devicesListWithFolders = enrichDeviceListWithFolder(deviceList);
|
this.devicesListWithFolders = enrichDeviceListWithFolder(deviceList);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@SuppressLint("NotifyDataSetChanged")
|
||||||
|
public final void refreshSingleDevice(final GBDevice device) {
|
||||||
|
final int i = devicesListWithFolders.indexOf(device);
|
||||||
|
if (i > 0) {
|
||||||
|
notifyItemChanged(i);
|
||||||
|
} else {
|
||||||
|
// Somehow the device was not on the list - rebuild everything
|
||||||
|
rebuildFolders();
|
||||||
|
notifyDataSetChanged();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
private List<GBDevice> enrichDeviceListWithFolder(List<GBDevice> deviceList) {
|
private List<GBDevice> enrichDeviceListWithFolder(List<GBDevice> deviceList) {
|
||||||
final Map<String, List<GBDevice>> devicesPerFolder = new LinkedHashMap<>();
|
final Map<String, List<GBDevice>> devicesPerFolder = new LinkedHashMap<>();
|
||||||
final List<GBDevice> enrichedList = new ArrayList<>();
|
final List<GBDevice> enrichedList = new ArrayList<>();
|
||||||
@ -221,10 +234,10 @@ public class GBDeviceAdapterv2 extends ListAdapter<GBDevice, GBDeviceAdapterv2.V
|
|||||||
holder.container.setOnClickListener(new View.OnClickListener() {
|
holder.container.setOnClickListener(new View.OnClickListener() {
|
||||||
@Override
|
@Override
|
||||||
public void onClick(View v) {
|
public void onClick(View v) {
|
||||||
if(expandedFolderName.equals(folder.getName())){
|
if (expandedFolderName.equals(folder.getName())){
|
||||||
// collapse open folder
|
// collapse open folder
|
||||||
expandedFolderName = "";
|
expandedFolderName = "";
|
||||||
}else {
|
} else {
|
||||||
expandedFolderName = folder.getName();
|
expandedFolderName = folder.getName();
|
||||||
}
|
}
|
||||||
rebuildFolders();
|
rebuildFolders();
|
||||||
|
@ -297,7 +297,7 @@ public final class BtLEQueue {
|
|||||||
|
|
||||||
private void setDeviceConnectionState(final State newState) {
|
private void setDeviceConnectionState(final State newState) {
|
||||||
new Handler(Looper.getMainLooper()).post(() -> {
|
new Handler(Looper.getMainLooper()).post(() -> {
|
||||||
LOG.debug("new device connection state: " + newState);
|
LOG.debug("new device connection state: {}", newState);
|
||||||
mGbDevice.setState(newState);
|
mGbDevice.setState(newState);
|
||||||
mGbDevice.sendDeviceUpdateIntent(mContext, GBDevice.DeviceUpdateSubject.CONNECTION_STATE);
|
mGbDevice.sendDeviceUpdateIntent(mContext, GBDevice.DeviceUpdateSubject.CONNECTION_STATE);
|
||||||
});
|
});
|
||||||
|
@ -668,6 +668,7 @@ class BangleJSActivityTrack {
|
|||||||
resetPacketCount();
|
resetPacketCount();
|
||||||
device.unsetBusyTask();
|
device.unsetBusyTask();
|
||||||
device.sendDeviceUpdateIntent(context);
|
device.sendDeviceUpdateIntent(context);
|
||||||
|
GB.signalActivityDataFinish(device);
|
||||||
GB.updateTransferNotification(null, "", false, 100, context);
|
GB.updateTransferNotification(null, "", false, 100, context);
|
||||||
GB.toast(context.getString(R.string.activity_detail_end_label) + " : " + context.getString(R.string.busy_task_fetch_sports_details), Toast.LENGTH_SHORT, GB.INFO);
|
GB.toast(context.getString(R.string.activity_detail_end_label) + " : " + context.getString(R.string.busy_task_fetch_sports_details), Toast.LENGTH_SHORT, GB.INFO);
|
||||||
}
|
}
|
||||||
|
@ -495,8 +495,8 @@ public class CmfActivitySync {
|
|||||||
|
|
||||||
activitiesWithGps.clear();
|
activitiesWithGps.clear();
|
||||||
|
|
||||||
GB.signalActivityDataFinish();
|
|
||||||
getDevice().unsetBusyTask();
|
getDevice().unsetBusyTask();
|
||||||
|
GB.signalActivityDataFinish(getDevice());
|
||||||
GB.updateTransferNotification(null, "", false, 100, getContext());
|
GB.updateTransferNotification(null, "", false, 100, getContext());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -572,10 +572,10 @@ public class ColmiR0xDeviceSupport extends AbstractBTLEDeviceSupport {
|
|||||||
|
|
||||||
private void fetchRecordedDataFinished() {
|
private void fetchRecordedDataFinished() {
|
||||||
GB.updateTransferNotification(null, "", false, 100, getContext());
|
GB.updateTransferNotification(null, "", false, 100, getContext());
|
||||||
GB.signalActivityDataFinish();
|
|
||||||
LOG.info("Sync finished!");
|
LOG.info("Sync finished!");
|
||||||
getDevice().unsetBusyTask();
|
getDevice().unsetBusyTask();
|
||||||
getDevice().sendDeviceUpdateIntent(getContext());
|
getDevice().sendDeviceUpdateIntent(getContext());
|
||||||
|
GB.signalActivityDataFinish(getDevice());
|
||||||
}
|
}
|
||||||
|
|
||||||
private void fetchHistoryActivity() {
|
private void fetchHistoryActivity() {
|
||||||
|
@ -365,7 +365,7 @@ public class FitProDeviceSupport extends AbstractBTLEDeviceSupport {
|
|||||||
public void indicateFinishedFetchingOperation() {
|
public void indicateFinishedFetchingOperation() {
|
||||||
//LOG.debug("download finish announced");
|
//LOG.debug("download finish announced");
|
||||||
GB.updateTransferNotification(null, "", false, 100, getContext());
|
GB.updateTransferNotification(null, "", false, 100, getContext());
|
||||||
GB.signalActivityDataFinish();
|
GB.signalActivityDataFinish(getDevice());
|
||||||
unsetBusy();
|
unsetBusy();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1354,7 +1354,7 @@ public class FitProDeviceSupport extends AbstractBTLEDeviceSupport {
|
|||||||
|
|
||||||
addGBActivitySample(sample);
|
addGBActivitySample(sample);
|
||||||
broadcastSample(sample);
|
broadcastSample(sample);
|
||||||
GB.signalActivityDataFinish();
|
GB.signalActivityDataFinish(getDevice());
|
||||||
}
|
}
|
||||||
|
|
||||||
public void handleDayTotalsData(int steps, int distance, int calories) {
|
public void handleDayTotalsData(int steps, int distance, int calories) {
|
||||||
|
@ -541,8 +541,8 @@ public class GarminSupport extends AbstractBTLEDeviceSupport implements ICommuni
|
|||||||
LOG.debug("No pending files to process");
|
LOG.debug("No pending files to process");
|
||||||
// No downloaded fit files to process
|
// No downloaded fit files to process
|
||||||
if (gbDevice.isBusy() && isBusyFetching) {
|
if (gbDevice.isBusy() && isBusyFetching) {
|
||||||
GB.signalActivityDataFinish();
|
|
||||||
getDevice().unsetBusyTask();
|
getDevice().unsetBusyTask();
|
||||||
|
GB.signalActivityDataFinish(getDevice());
|
||||||
GB.updateTransferNotification(null, "", false, 100, getContext());
|
GB.updateTransferNotification(null, "", false, 100, getContext());
|
||||||
getDevice().sendDeviceUpdateIntent(getContext());
|
getDevice().sendDeviceUpdateIntent(getContext());
|
||||||
}
|
}
|
||||||
@ -570,8 +570,8 @@ public class GarminSupport extends AbstractBTLEDeviceSupport implements ICommuni
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onFinish() {
|
public void onFinish() {
|
||||||
GB.signalActivityDataFinish();
|
|
||||||
getDevice().unsetBusyTask();
|
getDevice().unsetBusyTask();
|
||||||
|
GB.signalActivityDataFinish(getDevice());
|
||||||
GB.updateTransferNotification(null, "", false, 100, getContext());
|
GB.updateTransferNotification(null, "", false, 100, getContext());
|
||||||
getDevice().sendDeviceUpdateIntent(getContext());
|
getDevice().sendDeviceUpdateIntent(getContext());
|
||||||
isBusyFetching = false;
|
isBusyFetching = false;
|
||||||
@ -903,7 +903,7 @@ public class GarminSupport extends AbstractBTLEDeviceSupport implements ICommuni
|
|||||||
public void onFinish() {
|
public void onFinish() {
|
||||||
parsingFitFilesFromStorage = false;
|
parsingFitFilesFromStorage = false;
|
||||||
GB.updateTransferNotification("", "", false, 100, getContext());
|
GB.updateTransferNotification("", "", false, 100, getContext());
|
||||||
GB.signalActivityDataFinish();
|
GB.signalActivityDataFinish(getDevice());
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
@ -155,7 +155,7 @@ public abstract class AbstractFetchOperation extends AbstractHuamiOperation {
|
|||||||
LOG.debug("All operations finished");
|
LOG.debug("All operations finished");
|
||||||
|
|
||||||
GB.updateTransferNotification(null, "", false, 100, getContext());
|
GB.updateTransferNotification(null, "", false, 100, getContext());
|
||||||
GB.signalActivityDataFinish();
|
GB.signalActivityDataFinish(getDevice());
|
||||||
operationFinished();
|
operationFinished();
|
||||||
unsetBusy();
|
unsetBusy();
|
||||||
}
|
}
|
||||||
|
@ -810,7 +810,7 @@ public class HuaweiSupportProvider {
|
|||||||
|
|
||||||
// Properly update the device card
|
// Properly update the device card
|
||||||
gbDevice.sendDeviceUpdateIntent(GBApplication.getContext());
|
gbDevice.sendDeviceUpdateIntent(GBApplication.getContext());
|
||||||
GB.signalActivityDataFinish();
|
GB.signalActivityDataFinish(getDevice());
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setProtocolVersion(byte protocolVersion) {
|
public void setProtocolVersion(byte protocolVersion) {
|
||||||
@ -1289,7 +1289,7 @@ public class HuaweiSupportProvider {
|
|||||||
gbDevice.unsetBusyTask();
|
gbDevice.unsetBusyTask();
|
||||||
gbDevice.sendDeviceUpdateIntent(context);
|
gbDevice.sendDeviceUpdateIntent(context);
|
||||||
}
|
}
|
||||||
GB.signalActivityDataFinish();
|
GB.signalActivityDataFinish(getDevice());
|
||||||
}
|
}
|
||||||
|
|
||||||
public void onReset(int flags) {
|
public void onReset(int flags) {
|
||||||
@ -2118,7 +2118,7 @@ public class HuaweiSupportProvider {
|
|||||||
for (HuaweiTruSleepParser.TruSleepStatus status : results)
|
for (HuaweiTruSleepParser.TruSleepStatus status : results)
|
||||||
addSleepActivity(status.startTime, status.endTime, (byte) 0x06, (byte) 0x0a);
|
addSleepActivity(status.startTime, status.endTime, (byte) 0x06, (byte) 0x0a);
|
||||||
// This should only be called once per sync - also if we start downloading more sleep data
|
// This should only be called once per sync - also if we start downloading more sleep data
|
||||||
GB.signalActivityDataFinish();
|
GB.signalActivityDataFinish(getDevice());
|
||||||
// Unsetting busy is done at the end of all downloads
|
// Unsetting busy is done at the end of all downloads
|
||||||
} // "sleep_data.bin" later as well
|
} // "sleep_data.bin" later as well
|
||||||
}
|
}
|
||||||
|
@ -200,7 +200,7 @@ public class FetchActivityOperation extends AbstractMiBand1Operation {
|
|||||||
activityStruct = null;
|
activityStruct = null;
|
||||||
operationFinished();
|
operationFinished();
|
||||||
unsetBusy();
|
unsetBusy();
|
||||||
GB.signalActivityDataFinish();
|
GB.signalActivityDataFinish(getDevice());
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -514,7 +514,7 @@ public class No1F1Support extends AbstractBTLEDeviceSupport {
|
|||||||
GB.updateTransferNotification(null,"", false, 100, getContext());
|
GB.updateTransferNotification(null,"", false, 100, getContext());
|
||||||
if (getDevice().isBusy()) {
|
if (getDevice().isBusy()) {
|
||||||
getDevice().unsetBusyTask();
|
getDevice().unsetBusyTask();
|
||||||
GB.signalActivityDataFinish();
|
GB.signalActivityDataFinish(getDevice());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} catch (Exception ex) {
|
} catch (Exception ex) {
|
||||||
|
@ -70,7 +70,7 @@ class AppMessageHandlerMisfit extends AppMessageHandler {
|
|||||||
LOG.info("incoming data start");
|
LOG.info("incoming data start");
|
||||||
break;
|
break;
|
||||||
case KEY_INCOMING_DATA_END:
|
case KEY_INCOMING_DATA_END:
|
||||||
GB.signalActivityDataFinish();
|
GB.signalActivityDataFinish(getDevice());
|
||||||
LOG.info("incoming data end");
|
LOG.info("incoming data end");
|
||||||
break;
|
break;
|
||||||
case KEY_INCOMING_DATA:
|
case KEY_INCOMING_DATA:
|
||||||
|
@ -109,7 +109,7 @@ class AppMessageHandlerMorpheuz extends AppMessageHandler {
|
|||||||
for (Pair<Integer, Object> pair : pairs) {
|
for (Pair<Integer, Object> pair : pairs) {
|
||||||
if (Objects.equals(pair.first, keyTransmit)) {
|
if (Objects.equals(pair.first, keyTransmit)) {
|
||||||
ctrl_message |= CTRL_TRANSMIT_DONE;
|
ctrl_message |= CTRL_TRANSMIT_DONE;
|
||||||
GB.signalActivityDataFinish();
|
GB.signalActivityDataFinish(getDevice());
|
||||||
} else if (pair.first.equals(keyGoneoff)) {
|
} else if (pair.first.equals(keyGoneoff)) {
|
||||||
alarm_gone_off = (int) pair.second;
|
alarm_gone_off = (int) pair.second;
|
||||||
LOG.info("got gone off: " + alarm_gone_off / 60 + ":" + alarm_gone_off % 60);
|
LOG.info("got gone off: " + alarm_gone_off / 60 + ":" + alarm_gone_off % 60);
|
||||||
|
@ -2320,7 +2320,7 @@ public class PebbleProtocol extends GBDeviceProtocol {
|
|||||||
devEvtsDataLogging = new GBDeviceEvent[]{dataLogging, null};
|
devEvtsDataLogging = new GBDeviceEvent[]{dataLogging, null};
|
||||||
}
|
}
|
||||||
if (datalogSession.uuid.equals(UUID_ZERO) && (datalogSession.tag == 81 || datalogSession.tag == 83 || datalogSession.tag == 84)) {
|
if (datalogSession.uuid.equals(UUID_ZERO) && (datalogSession.tag == 81 || datalogSession.tag == 83 || datalogSession.tag == 84)) {
|
||||||
GB.signalActivityDataFinish();
|
GB.signalActivityDataFinish(getDevice());
|
||||||
}
|
}
|
||||||
mDatalogSessions.remove(id);
|
mDatalogSessions.remove(id);
|
||||||
}
|
}
|
||||||
|
@ -1240,7 +1240,7 @@ public class PineTimeJFSupport extends AbstractBTLEDeviceSupport implements DfuL
|
|||||||
provider.addGBActivitySample(sample);
|
provider.addGBActivitySample(sample);
|
||||||
}
|
}
|
||||||
|
|
||||||
GB.signalActivityDataFinish();
|
GB.signalActivityDataFinish(getDevice());
|
||||||
|
|
||||||
} catch (Exception ex) {
|
} catch (Exception ex) {
|
||||||
GB.toast(getContext(), "Error saving samples: " + ex.getLocalizedMessage(), Toast.LENGTH_LONG, GB.ERROR);
|
GB.toast(getContext(), "Error saving samples: " + ex.getLocalizedMessage(), Toast.LENGTH_LONG, GB.ERROR);
|
||||||
|
@ -565,7 +565,7 @@ public class FossilWatchAdapter extends WatchAdapter {
|
|||||||
|
|
||||||
queueWrite(new FileDeleteRequest(getHandle()));
|
queueWrite(new FileDeleteRequest(getHandle()));
|
||||||
GB.updateTransferNotification(null, "", false, 100, getContext());
|
GB.updateTransferNotification(null, "", false, 100, getContext());
|
||||||
GB.signalActivityDataFinish();
|
GB.signalActivityDataFinish(getDeviceSupport().getDevice());
|
||||||
LOG.debug("Synchronized activity data");
|
LOG.debug("Synchronized activity data");
|
||||||
} catch (Exception ex) {
|
} catch (Exception ex) {
|
||||||
GB.toast(getContext(), "Error saving steps data: " + ex.getLocalizedMessage(), Toast.LENGTH_LONG, GB.ERROR);
|
GB.toast(getContext(), "Error saving steps data: " + ex.getLocalizedMessage(), Toast.LENGTH_LONG, GB.ERROR);
|
||||||
|
@ -1251,7 +1251,7 @@ public class FossilHRWatchAdapter extends FossilWatchAdapter {
|
|||||||
}
|
}
|
||||||
queueWrite(new FileDeleteRequest(fileHandle));
|
queueWrite(new FileDeleteRequest(fileHandle));
|
||||||
GB.updateTransferNotification(null, "", false, 100, getContext());
|
GB.updateTransferNotification(null, "", false, 100, getContext());
|
||||||
GB.signalActivityDataFinish();
|
GB.signalActivityDataFinish(getDeviceSupport().getDevice());
|
||||||
LOG.debug("Synchronized activity data");
|
LOG.debug("Synchronized activity data");
|
||||||
} catch (Exception ex) {
|
} catch (Exception ex) {
|
||||||
GB.toast(getContext(), "Error saving steps data: " + ex.getLocalizedMessage(), Toast.LENGTH_LONG, GB.ERROR);
|
GB.toast(getContext(), "Error saving steps data: " + ex.getLocalizedMessage(), Toast.LENGTH_LONG, GB.ERROR);
|
||||||
|
@ -468,7 +468,7 @@ public class MisfitWatchAdapter extends WatchAdapter {
|
|||||||
getDeviceSupport().getDevice().unsetBusyTask();
|
getDeviceSupport().getDevice().unsetBusyTask();
|
||||||
GB.updateTransferNotification(null, "", false, 100, getContext());
|
GB.updateTransferNotification(null, "", false, 100, getContext());
|
||||||
getDeviceSupport().getDevice().sendDeviceUpdateIntent(getContext());
|
getDeviceSupport().getDevice().sendDeviceUpdateIntent(getContext());
|
||||||
GB.signalActivityDataFinish();
|
GB.signalActivityDataFinish(getDeviceSupport().getDevice());
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -543,7 +543,7 @@ public class TLW64Support extends AbstractBTLEDeviceSupport {
|
|||||||
if (getDevice().isBusy()) {
|
if (getDevice().isBusy()) {
|
||||||
getDevice().unsetBusyTask();
|
getDevice().unsetBusyTask();
|
||||||
getDevice().sendDeviceUpdateIntent(getContext());
|
getDevice().sendDeviceUpdateIntent(getContext());
|
||||||
GB.signalActivityDataFinish();
|
GB.signalActivityDataFinish(getDevice());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} catch (Exception ex) {
|
} catch (Exception ex) {
|
||||||
|
@ -146,8 +146,8 @@ public class XiaomiActivityFileFetcher {
|
|||||||
if (fileId == null) {
|
if (fileId == null) {
|
||||||
LOG.debug("Nothing more to fetch");
|
LOG.debug("Nothing more to fetch");
|
||||||
isFetching = false;
|
isFetching = false;
|
||||||
GB.signalActivityDataFinish();
|
|
||||||
mHealthService.getSupport().getDevice().unsetBusyTask();
|
mHealthService.getSupport().getDevice().unsetBusyTask();
|
||||||
|
GB.signalActivityDataFinish(mHealthService.getSupport().getDevice());
|
||||||
GB.updateTransferNotification(null, "", false, 100, mHealthService.getSupport().getContext());
|
GB.updateTransferNotification(null, "", false, 100, mHealthService.getSupport().getContext());
|
||||||
mHealthService.getSupport().getDevice().sendDeviceUpdateIntent(mHealthService.getSupport().getContext());
|
mHealthService.getSupport().getDevice().sendDeviceUpdateIntent(mHealthService.getSupport().getContext());
|
||||||
return;
|
return;
|
||||||
|
@ -1033,6 +1033,8 @@ public class ZeTimeDeviceSupport extends AbstractBTLEDeviceSupport {
|
|||||||
getHeartRateData();
|
getHeartRateData();
|
||||||
} else if (availableSleepData > 0) {
|
} else if (availableSleepData > 0) {
|
||||||
getSleepData();
|
getSleepData();
|
||||||
|
} else {
|
||||||
|
GB.signalActivityDataFinish(getDevice());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1179,6 +1181,8 @@ public class ZeTimeDeviceSupport extends AbstractBTLEDeviceSupport {
|
|||||||
getHeartRateData();
|
getHeartRateData();
|
||||||
} else if (availableSleepData > 0) {
|
} else if (availableSleepData > 0) {
|
||||||
getSleepData();
|
getSleepData();
|
||||||
|
} else {
|
||||||
|
GB.signalActivityDataFinish(getDevice());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1217,7 +1221,7 @@ public class ZeTimeDeviceSupport extends AbstractBTLEDeviceSupport {
|
|||||||
GB.updateTransferNotification(null, "", false, 100, getContext());
|
GB.updateTransferNotification(null, "", false, 100, getContext());
|
||||||
if (getDevice().isBusy()) {
|
if (getDevice().isBusy()) {
|
||||||
getDevice().unsetBusyTask();
|
getDevice().unsetBusyTask();
|
||||||
GB.signalActivityDataFinish();
|
GB.signalActivityDataFinish(getDevice());
|
||||||
}
|
}
|
||||||
if (!prefs.getBoolean(ZeTimeConstants.PREF_ZETIME_DONT_DEL_ACTDATA, false)) {
|
if (!prefs.getBoolean(ZeTimeConstants.PREF_ZETIME_DONT_DEL_ACTDATA, false)) {
|
||||||
deleteSleepData();
|
deleteSleepData();
|
||||||
@ -1283,6 +1287,8 @@ public class ZeTimeDeviceSupport extends AbstractBTLEDeviceSupport {
|
|||||||
}
|
}
|
||||||
if (availableSleepData > 0) {
|
if (availableSleepData > 0) {
|
||||||
getSleepData();
|
getSleepData();
|
||||||
|
} else {
|
||||||
|
GB.signalActivityDataFinish(getDevice());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -677,8 +677,10 @@ public class GB {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void signalActivityDataFinish() {
|
public static void signalActivityDataFinish(final GBDevice device) {
|
||||||
final Intent intent = new Intent(GBApplication.ACTION_NEW_DATA);
|
final Intent intent = new Intent(GBApplication.ACTION_NEW_DATA);
|
||||||
|
intent.putExtra(GBDevice.EXTRA_DEVICE, device);
|
||||||
|
|
||||||
LocalBroadcastManager.getInstance(GBApplication.getContext()).sendBroadcast(intent);
|
LocalBroadcastManager.getInstance(GBApplication.getContext()).sendBroadcast(intent);
|
||||||
|
|
||||||
if (!GBApplication.getPrefs().getBoolean("intent_api_broadcast_activity_sync", false)) {
|
if (!GBApplication.getPrefs().getBoolean("intent_api_broadcast_activity_sync", false)) {
|
||||||
|
Loading…
Reference in New Issue
Block a user