diff --git a/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/devices/AbstractSampleProvider.java b/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/devices/AbstractSampleProvider.java index 4df87cc4..127df254 100644 --- a/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/devices/AbstractSampleProvider.java +++ b/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/devices/AbstractSampleProvider.java @@ -98,15 +98,21 @@ public abstract class AbstractSampleProvider i // public void changeStoredSamplesType(int timestampFrom, int timestampTo, int kind) { - // TODO: implement + List samples = getAllActivitySamples(timestampFrom, timestampTo); + for (T sample : samples) { + sample.setRawKind(kind); + } + getSampleDao().updateInTx(samples); } public void changeStoredSamplesType(int timestampFrom, int timestampTo, int fromKind, int toKind) { - // TODO: implement + List samples = getGBActivitySamples(timestampFrom, timestampTo, fromKind); + for (T sample : samples) { + sample.setRawKind(toKind); + } + getSampleDao().updateInTx(samples); } -//// SQLiteDatabase getWritableDatabase(); - protected List getGBActivitySamples(int timestamp_from, int timestamp_to, int activityType) { QueryBuilder qb = getSampleDao().queryBuilder(); qb.where(MiBandActivitySampleDao.Properties.Timestamp.ge(timestamp_from)) diff --git a/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/entities/AbstractActivitySample.java b/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/entities/AbstractActivitySample.java index 81474e5b..e9956665 100644 --- a/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/entities/AbstractActivitySample.java +++ b/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/entities/AbstractActivitySample.java @@ -26,6 +26,10 @@ public abstract class AbstractActivitySample implements ActivitySample { return getProvider().normalizeIntensity(getRawIntensity()); } + public abstract void setRawKind(int kind); + + public abstract void setRawIntensity(int intensity); + @Override public String toString() { return getClass().getSimpleName() + "{" +