2015-07-14 00:29:32 +02:00
|
|
|
package nodomain.freeyourgadget.gadgetbridge.charts;
|
|
|
|
|
|
|
|
import java.util.Arrays;
|
|
|
|
|
2015-07-27 23:49:53 +02:00
|
|
|
import nodomain.freeyourgadget.gadgetbridge.model.SampleProvider;
|
2015-07-14 00:29:32 +02:00
|
|
|
|
|
|
|
public class ActivityKind {
|
2015-07-27 23:49:53 +02:00
|
|
|
public static final int TYPE_UNKNOWN = 0;
|
2015-07-14 00:29:32 +02:00
|
|
|
public static final int TYPE_ACTIVITY = 1;
|
|
|
|
public static final int TYPE_LIGHT_SLEEP = 2;
|
|
|
|
public static final int TYPE_DEEP_SLEEP = 4;
|
|
|
|
public static final int TYPE_SLEEP = TYPE_LIGHT_SLEEP | TYPE_DEEP_SLEEP;
|
|
|
|
public static final int TYPE_ALL = TYPE_ACTIVITY | TYPE_SLEEP;
|
|
|
|
|
2015-07-27 23:49:53 +02:00
|
|
|
public static byte[] mapToDBActivityTypes(int types, SampleProvider provider) {
|
2015-07-14 00:29:32 +02:00
|
|
|
byte[] result = new byte[3];
|
|
|
|
int i = 0;
|
|
|
|
if ((types & ActivityKind.TYPE_ACTIVITY) != 0) {
|
2015-07-27 23:49:53 +02:00
|
|
|
result[i++] = provider.toRawActivityKind(TYPE_ACTIVITY);
|
2015-07-14 00:29:32 +02:00
|
|
|
}
|
|
|
|
if ((types & ActivityKind.TYPE_DEEP_SLEEP) != 0) {
|
2015-07-27 23:49:53 +02:00
|
|
|
result[i++] = provider.toRawActivityKind(TYPE_DEEP_SLEEP);
|
2015-07-14 00:29:32 +02:00
|
|
|
}
|
|
|
|
if ((types & ActivityKind.TYPE_LIGHT_SLEEP) != 0) {
|
2015-07-27 23:49:53 +02:00
|
|
|
result[i++] = provider.toRawActivityKind(TYPE_LIGHT_SLEEP);
|
2015-07-14 00:29:32 +02:00
|
|
|
}
|
|
|
|
return Arrays.copyOf(result, i);
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|