mirror of
https://codeberg.org/Freeyourgadget/Gadgetbridge.git
synced 2025-01-10 17:11:56 +01:00
Compare commits
2 Commits
539579c98e
...
0383169767
Author | SHA1 | Date | |
---|---|---|---|
|
0383169767 | ||
|
28e0914330 |
@ -71,7 +71,7 @@ public class HybridHRActivitySampleProvider extends AbstractSampleProvider<Hybri
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public float normalizeIntensity(int rawIntensity) {
|
public float normalizeIntensity(int rawIntensity) {
|
||||||
return rawIntensity / 63f;
|
return Math.min(rawIntensity / 128f, 1f);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -27,7 +27,7 @@ public abstract class AbstractHybridHRActivitySample extends AbstractActivitySam
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int getRawIntensity() {
|
public int getRawIntensity() {
|
||||||
return getCalories();
|
return getSteps();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -549,6 +549,9 @@ public class QHybridSupport extends QHybridBaseSupport {
|
|||||||
@Override
|
@Override
|
||||||
public void onFetchRecordedData(int dataTypes) {
|
public void onFetchRecordedData(int dataTypes) {
|
||||||
if ((dataTypes & RecordedDataTypes.TYPE_ACTIVITY) != 0) {
|
if ((dataTypes & RecordedDataTypes.TYPE_ACTIVITY) != 0) {
|
||||||
|
GB.updateTransferNotification(getContext().getString(R.string.busy_task_fetch_activity_data), "", true, 0, getContext());
|
||||||
|
getDevice().setBusyTask(getContext().getString(R.string.busy_task_fetch_activity_data));
|
||||||
|
getDevice().sendDeviceUpdateIntent(getContext());
|
||||||
this.watchAdapter.onFetchActivityData();
|
this.watchAdapter.onFetchActivityData();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -554,20 +554,25 @@ public class FossilWatchAdapter extends WatchAdapter {
|
|||||||
provider.addGBActivitySamples(samples);
|
provider.addGBActivitySamples(samples);
|
||||||
|
|
||||||
queueWrite(new FileDeleteRequest(getHandle()));
|
queueWrite(new FileDeleteRequest(getHandle()));
|
||||||
|
GB.updateTransferNotification(null, "", false, 100, getContext());
|
||||||
if (BuildConfig.DEBUG)
|
if (BuildConfig.DEBUG)
|
||||||
GB.toast("synced activity data", Toast.LENGTH_SHORT, GB.INFO);
|
GB.toast(getContext().getString(R.string.fossil_hr_synced_activity_data), Toast.LENGTH_SHORT, GB.INFO);
|
||||||
} 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);
|
||||||
GB.updateTransferNotification(null, "Data transfer failed", false, 0, getContext());
|
GB.updateTransferNotification(null, "Data transfer failed", false, 0, getContext());
|
||||||
}
|
}
|
||||||
|
getDeviceSupport().getDevice().unsetBusyTask();
|
||||||
getDeviceSupport().getDevice().sendDeviceUpdateIntent(getContext());
|
getDeviceSupport().getDevice().sendDeviceUpdateIntent(getContext());
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void handleFileLookupError(FILE_LOOKUP_ERROR error) {
|
public void handleFileLookupError(FILE_LOOKUP_ERROR error) {
|
||||||
if(error == FILE_LOOKUP_ERROR.FILE_EMPTY && BuildConfig.DEBUG){
|
if(error == FILE_LOOKUP_ERROR.FILE_EMPTY && BuildConfig.DEBUG){
|
||||||
GB.toast("activity file empty", Toast.LENGTH_SHORT, GB.INFO);
|
GB.toast("No activity data to sync", Toast.LENGTH_SHORT, GB.INFO);
|
||||||
}
|
}
|
||||||
|
getDeviceSupport().getDevice().unsetBusyTask();
|
||||||
|
GB.updateTransferNotification(null, "", false, 100, getContext());
|
||||||
|
getDeviceSupport().getDevice().sendDeviceUpdateIntent(getContext());
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
@ -1250,12 +1250,14 @@ public class FossilHRWatchAdapter extends FossilWatchAdapter {
|
|||||||
writeFile(String.valueOf(System.currentTimeMillis()), fileData);
|
writeFile(String.valueOf(System.currentTimeMillis()), fileData);
|
||||||
}
|
}
|
||||||
queueWrite(new FileDeleteRequest(fileHandle));
|
queueWrite(new FileDeleteRequest(fileHandle));
|
||||||
|
GB.updateTransferNotification(null, "", false, 100, getContext());
|
||||||
if (BuildConfig.DEBUG)
|
if (BuildConfig.DEBUG)
|
||||||
GB.toast(getContext().getString(R.string.fossil_hr_synced_activity_data), Toast.LENGTH_SHORT, GB.INFO);
|
GB.toast(getContext().getString(R.string.fossil_hr_synced_activity_data), Toast.LENGTH_SHORT, GB.INFO);
|
||||||
} 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);
|
||||||
GB.updateTransferNotification(null, "Data transfer failed", false, 0, getContext());
|
GB.updateTransferNotification(null, "Data transfer failed", false, 0, getContext());
|
||||||
}
|
}
|
||||||
|
getDeviceSupport().getDevice().unsetBusyTask();
|
||||||
getDeviceSupport().getDevice().sendDeviceUpdateIntent(getContext());
|
getDeviceSupport().getDevice().sendDeviceUpdateIntent(getContext());
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
@ -1265,10 +1267,12 @@ public class FossilHRWatchAdapter extends FossilWatchAdapter {
|
|||||||
public void handleFileLookupError(FILE_LOOKUP_ERROR error) {
|
public void handleFileLookupError(FILE_LOOKUP_ERROR error) {
|
||||||
if (error == FILE_LOOKUP_ERROR.FILE_EMPTY) {
|
if (error == FILE_LOOKUP_ERROR.FILE_EMPTY) {
|
||||||
if (BuildConfig.DEBUG)
|
if (BuildConfig.DEBUG)
|
||||||
GB.toast("activity file empty yet", Toast.LENGTH_LONG, GB.ERROR);
|
GB.toast("No activity data to sync", Toast.LENGTH_SHORT, GB.INFO);
|
||||||
} else {
|
} else {
|
||||||
throw new RuntimeException("strange lookup stuff");
|
throw new RuntimeException("strange lookup stuff");
|
||||||
}
|
}
|
||||||
|
getDeviceSupport().getDevice().unsetBusyTask();
|
||||||
|
GB.updateTransferNotification(null, "", false, 100, getContext());
|
||||||
getDeviceSupport().getDevice().sendDeviceUpdateIntent(getContext());
|
getDeviceSupport().getDevice().sendDeviceUpdateIntent(getContext());
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
@ -467,6 +467,9 @@ public class MisfitWatchAdapter extends WatchAdapter {
|
|||||||
requestQueue.add(new GetCurrentStepCountRequest());
|
requestQueue.add(new GetCurrentStepCountRequest());
|
||||||
// requestQueue.add(new ListFilesRequest());
|
// requestQueue.add(new ListFilesRequest());
|
||||||
queueWrite(new ActivityPointGetRequest());
|
queueWrite(new ActivityPointGetRequest());
|
||||||
|
getDeviceSupport().getDevice().unsetBusyTask();
|
||||||
|
GB.updateTransferNotification(null, "", false, 100, getContext());
|
||||||
|
getDeviceSupport().getDevice().sendDeviceUpdateIntent(getContext());
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
Loading…
Reference in New Issue
Block a user