1
0
mirror of https://codeberg.org/Freeyourgadget/Gadgetbridge synced 2024-11-24 19:06:53 +01:00

Mi Band 3: Enable fetching sports activities and add "Exercise" type to generic code

This commit is contained in:
Andreas Shimokawa 2019-01-28 00:22:11 +01:00
parent d3fa99e8a3
commit dad7ba7aaa
4 changed files with 20 additions and 2 deletions

View File

@ -76,6 +76,11 @@ public class MiBand3Coordinator extends HuamiCoordinator {
return true;
}
@Override
public boolean supportsActivityTracks() {
return true;
}
public static boolean getBandScreenUnlock() {
Prefs prefs = GBApplication.getPrefs();
return prefs.getBoolean(MiBandConst.PREF_MI3_BAND_SCREEN_UNLOCK, false);

View File

@ -37,8 +37,9 @@ public class ActivityKind {
public static final int TYPE_SWIMMING = 64;
public static final int TYPE_CYCLING = 128;
public static final int TYPE_TREADMILL = 256;
public static final int TYPE_EXERCISE = 512;
private static final int TYPES_COUNT = 11;
private static final int TYPES_COUNT = 12;
public static final int TYPE_SLEEP = TYPE_LIGHT_SLEEP | TYPE_DEEP_SLEEP;
public static final int TYPE_ALL = TYPE_ACTIVITY | TYPE_SLEEP | TYPE_NOT_WORN;
@ -73,6 +74,9 @@ public class ActivityKind {
if ((types & ActivityKind.TYPE_TREADMILL) != 0) {
result[i++] = provider.toRawActivityKind(TYPE_TREADMILL);
}
if ((types & ActivityKind.TYPE_EXERCISE) != 0) {
result[i++] = provider.toRawActivityKind(TYPE_EXERCISE);
}
return Arrays.copyOf(result, i);
}
@ -98,6 +102,8 @@ public class ActivityKind {
return context.getString(R.string.activity_type_biking);
case TYPE_TREADMILL:
return context.getString(R.string.activity_type_treadmill);
case TYPE_EXERCISE:
return context.getString(R.string.activity_type_exercise);
case TYPE_UNKNOWN:
default:
return context.getString(R.string.activity_type_unknown);
@ -121,6 +127,7 @@ public class ActivityKind {
return R.drawable.ic_activity_biking;
case TYPE_TREADMILL:
return R.drawable.ic_activity_walking;
case TYPE_EXERCISE: // fall through
case TYPE_SWIMMING: // fall through
case TYPE_NOT_WORN: // fall through
case TYPE_ACTIVITY: // fall through

View File

@ -22,7 +22,8 @@ public enum BipActivityType {
Outdoor(1),
Treadmill(2),
Walking(3),
Cycling(4);
Cycling(4),
Exercise(5);
private final int code;
@ -40,6 +41,8 @@ public enum BipActivityType {
return ActivityKind.TYPE_CYCLING;
case Walking:
return ActivityKind.TYPE_WALKING;
case Exercise:
return ActivityKind.TYPE_EXERCISE;
}
throw new RuntimeException("Not mapped activity kind for: " + this);
}
@ -63,6 +66,8 @@ public enum BipActivityType {
return Cycling;
case ActivityKind.TYPE_WALKING:
return Walking;
case ActivityKind.TYPE_EXERCISE:
return Exercise;
}
throw new RuntimeException("No matching activity activityKind: " + activityKind);
}

View File

@ -593,6 +593,7 @@
<string name="activity_summaries">Activities</string>
<string name="activity_type_biking">Biking</string>
<string name="activity_type_treadmill">Treadmill</string>
<string name="activity_type_exercise">Exercise</string>
<string name="select_all">Select all</string>
<string name="share">Share</string>
<string name="reset_index">Reset fetch date</string>