Implement changeStoredSamplesType()
This commit is contained in:
parent
876bdac918
commit
4b374e3f7e
|
@ -98,15 +98,21 @@ public abstract class AbstractSampleProvider<T extends AbstractActivitySample> i
|
||||||
//
|
//
|
||||||
|
|
||||||
public void changeStoredSamplesType(int timestampFrom, int timestampTo, int kind) {
|
public void changeStoredSamplesType(int timestampFrom, int timestampTo, int kind) {
|
||||||
// TODO: implement
|
List<T> 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) {
|
public void changeStoredSamplesType(int timestampFrom, int timestampTo, int fromKind, int toKind) {
|
||||||
// TODO: implement
|
List<T> samples = getGBActivitySamples(timestampFrom, timestampTo, fromKind);
|
||||||
|
for (T sample : samples) {
|
||||||
|
sample.setRawKind(toKind);
|
||||||
|
}
|
||||||
|
getSampleDao().updateInTx(samples);
|
||||||
}
|
}
|
||||||
|
|
||||||
//// SQLiteDatabase getWritableDatabase();
|
|
||||||
|
|
||||||
protected List<T> getGBActivitySamples(int timestamp_from, int timestamp_to, int activityType) {
|
protected List<T> getGBActivitySamples(int timestamp_from, int timestamp_to, int activityType) {
|
||||||
QueryBuilder<T> qb = getSampleDao().queryBuilder();
|
QueryBuilder<T> qb = getSampleDao().queryBuilder();
|
||||||
qb.where(MiBandActivitySampleDao.Properties.Timestamp.ge(timestamp_from))
|
qb.where(MiBandActivitySampleDao.Properties.Timestamp.ge(timestamp_from))
|
||||||
|
|
|
@ -26,6 +26,10 @@ public abstract class AbstractActivitySample implements ActivitySample {
|
||||||
return getProvider().normalizeIntensity(getRawIntensity());
|
return getProvider().normalizeIntensity(getRawIntensity());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public abstract void setRawKind(int kind);
|
||||||
|
|
||||||
|
public abstract void setRawIntensity(int intensity);
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String toString() {
|
public String toString() {
|
||||||
return getClass().getSimpleName() + "{" +
|
return getClass().getSimpleName() + "{" +
|
||||||
|
|
Loading…
Reference in New Issue