*unchecked* Storing activity values in the DB.

This commit is contained in:
Daniele Gobbetti 2015-06-01 10:15:19 +02:00 committed by cpfeiffer
parent 8b268a676c
commit ea97a902d1
1 changed files with 9 additions and 0 deletions

View File

@ -16,6 +16,8 @@ import java.util.UUID;
import java.text.DateFormat; import java.text.DateFormat;
import nodomain.freeyourgadget.gadgetbridge.GBActivitySample;
import nodomain.freeyourgadget.gadgetbridge.GBApplication;
import nodomain.freeyourgadget.gadgetbridge.GBCommand; import nodomain.freeyourgadget.gadgetbridge.GBCommand;
import nodomain.freeyourgadget.gadgetbridge.GBDevice.State; import nodomain.freeyourgadget.gadgetbridge.GBDevice.State;
import nodomain.freeyourgadget.gadgetbridge.btle.AbstractBTLEDeviceSupport; import nodomain.freeyourgadget.gadgetbridge.btle.AbstractBTLEDeviceSupport;
@ -497,6 +499,13 @@ public class MiBandSupport extends AbstractBTLEDeviceSupport {
private void flushActivityDataHolder() { private void flushActivityDataHolder() {
GregorianCalendar timestamp = this.activityDataTimestampProgress; GregorianCalendar timestamp = this.activityDataTimestampProgress;
for (int i=0; i<this.activityDataHolder.length; i+=3) { for (int i=0; i<this.activityDataHolder.length; i+=3) {
GBApplication.getActivityDatabaseHandler().addGBActivitySample(
(int) timestamp.getTimeInMillis() / 1000,
GBActivitySample.PROVIDER_MIBAND,
this.activityDataHolder[i+1],
this.activityDataHolder[i+2],
this.activityDataHolder[i]);
ACTIVITYLOG.info( ACTIVITYLOG.info(
" timestamp:"+DateFormat.getDateTimeInstance().format(timestamp.getTime()).toString() + " timestamp:"+DateFormat.getDateTimeInstance().format(timestamp.getTime()).toString() +
" category:"+ this.activityDataHolder[i]+ " category:"+ this.activityDataHolder[i]+