1
0
mirror of https://codeberg.org/Freeyourgadget/Gadgetbridge synced 2024-11-28 21:06:50 +01:00

Fixed timestamp conversion for DB, added local variables to make the code clearer

This commit is contained in:
Daniele Gobbetti 2015-06-01 14:17:35 +02:00 committed by cpfeiffer
parent ea97a902d1
commit 9e2d32c33f

View File

@ -498,19 +498,25 @@ public class MiBandSupport extends AbstractBTLEDeviceSupport {
private void flushActivityDataHolder() {
GregorianCalendar timestamp = this.activityDataTimestampProgress;
byte category, intensity, steps;
for (int i=0; i<this.activityDataHolder.length; i+=3) {
category = this.activityDataHolder[i];
intensity = this.activityDataHolder[i+1];
steps = this.activityDataHolder[i+2];
GBApplication.getActivityDatabaseHandler().addGBActivitySample(
(int) timestamp.getTimeInMillis() / 1000,
(int) (timestamp.getTimeInMillis() / 1000),
GBActivitySample.PROVIDER_MIBAND,
this.activityDataHolder[i+1],
this.activityDataHolder[i+2],
this.activityDataHolder[i]);
intensity,
steps,
category);
ACTIVITYLOG.info(
" timestamp:"+DateFormat.getDateTimeInstance().format(timestamp.getTime()).toString() +
" category:"+ this.activityDataHolder[i]+
" intensity:"+this.activityDataHolder[i+1]+
" steps:"+this.activityDataHolder[i+2]
" category:"+ category+
" intensity:"+intensity+
" steps:"+steps
);
timestamp.add(Calendar.MINUTE, 1);
}