mirror of
https://codeberg.org/Freeyourgadget/Gadgetbridge
synced 2024-11-28 12:56:49 +01:00
Mi Band 3: Enable fetching sports activities and add "Exercise" type to generic code
This commit is contained in:
parent
d3fa99e8a3
commit
dad7ba7aaa
@ -76,6 +76,11 @@ public class MiBand3Coordinator extends HuamiCoordinator {
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean supportsActivityTracks() {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
public static boolean getBandScreenUnlock() {
|
public static boolean getBandScreenUnlock() {
|
||||||
Prefs prefs = GBApplication.getPrefs();
|
Prefs prefs = GBApplication.getPrefs();
|
||||||
return prefs.getBoolean(MiBandConst.PREF_MI3_BAND_SCREEN_UNLOCK, false);
|
return prefs.getBoolean(MiBandConst.PREF_MI3_BAND_SCREEN_UNLOCK, false);
|
||||||
|
@ -37,8 +37,9 @@ public class ActivityKind {
|
|||||||
public static final int TYPE_SWIMMING = 64;
|
public static final int TYPE_SWIMMING = 64;
|
||||||
public static final int TYPE_CYCLING = 128;
|
public static final int TYPE_CYCLING = 128;
|
||||||
public static final int TYPE_TREADMILL = 256;
|
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_SLEEP = TYPE_LIGHT_SLEEP | TYPE_DEEP_SLEEP;
|
||||||
public static final int TYPE_ALL = TYPE_ACTIVITY | TYPE_SLEEP | TYPE_NOT_WORN;
|
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) {
|
if ((types & ActivityKind.TYPE_TREADMILL) != 0) {
|
||||||
result[i++] = provider.toRawActivityKind(TYPE_TREADMILL);
|
result[i++] = provider.toRawActivityKind(TYPE_TREADMILL);
|
||||||
}
|
}
|
||||||
|
if ((types & ActivityKind.TYPE_EXERCISE) != 0) {
|
||||||
|
result[i++] = provider.toRawActivityKind(TYPE_EXERCISE);
|
||||||
|
}
|
||||||
return Arrays.copyOf(result, i);
|
return Arrays.copyOf(result, i);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -98,6 +102,8 @@ public class ActivityKind {
|
|||||||
return context.getString(R.string.activity_type_biking);
|
return context.getString(R.string.activity_type_biking);
|
||||||
case TYPE_TREADMILL:
|
case TYPE_TREADMILL:
|
||||||
return context.getString(R.string.activity_type_treadmill);
|
return context.getString(R.string.activity_type_treadmill);
|
||||||
|
case TYPE_EXERCISE:
|
||||||
|
return context.getString(R.string.activity_type_exercise);
|
||||||
case TYPE_UNKNOWN:
|
case TYPE_UNKNOWN:
|
||||||
default:
|
default:
|
||||||
return context.getString(R.string.activity_type_unknown);
|
return context.getString(R.string.activity_type_unknown);
|
||||||
@ -121,6 +127,7 @@ public class ActivityKind {
|
|||||||
return R.drawable.ic_activity_biking;
|
return R.drawable.ic_activity_biking;
|
||||||
case TYPE_TREADMILL:
|
case TYPE_TREADMILL:
|
||||||
return R.drawable.ic_activity_walking;
|
return R.drawable.ic_activity_walking;
|
||||||
|
case TYPE_EXERCISE: // fall through
|
||||||
case TYPE_SWIMMING: // fall through
|
case TYPE_SWIMMING: // fall through
|
||||||
case TYPE_NOT_WORN: // fall through
|
case TYPE_NOT_WORN: // fall through
|
||||||
case TYPE_ACTIVITY: // fall through
|
case TYPE_ACTIVITY: // fall through
|
||||||
|
@ -22,7 +22,8 @@ public enum BipActivityType {
|
|||||||
Outdoor(1),
|
Outdoor(1),
|
||||||
Treadmill(2),
|
Treadmill(2),
|
||||||
Walking(3),
|
Walking(3),
|
||||||
Cycling(4);
|
Cycling(4),
|
||||||
|
Exercise(5);
|
||||||
|
|
||||||
private final int code;
|
private final int code;
|
||||||
|
|
||||||
@ -40,6 +41,8 @@ public enum BipActivityType {
|
|||||||
return ActivityKind.TYPE_CYCLING;
|
return ActivityKind.TYPE_CYCLING;
|
||||||
case Walking:
|
case Walking:
|
||||||
return ActivityKind.TYPE_WALKING;
|
return ActivityKind.TYPE_WALKING;
|
||||||
|
case Exercise:
|
||||||
|
return ActivityKind.TYPE_EXERCISE;
|
||||||
}
|
}
|
||||||
throw new RuntimeException("Not mapped activity kind for: " + this);
|
throw new RuntimeException("Not mapped activity kind for: " + this);
|
||||||
}
|
}
|
||||||
@ -63,6 +66,8 @@ public enum BipActivityType {
|
|||||||
return Cycling;
|
return Cycling;
|
||||||
case ActivityKind.TYPE_WALKING:
|
case ActivityKind.TYPE_WALKING:
|
||||||
return Walking;
|
return Walking;
|
||||||
|
case ActivityKind.TYPE_EXERCISE:
|
||||||
|
return Exercise;
|
||||||
}
|
}
|
||||||
throw new RuntimeException("No matching activity activityKind: " + activityKind);
|
throw new RuntimeException("No matching activity activityKind: " + activityKind);
|
||||||
}
|
}
|
||||||
|
@ -593,6 +593,7 @@
|
|||||||
<string name="activity_summaries">Activities</string>
|
<string name="activity_summaries">Activities</string>
|
||||||
<string name="activity_type_biking">Biking</string>
|
<string name="activity_type_biking">Biking</string>
|
||||||
<string name="activity_type_treadmill">Treadmill</string>
|
<string name="activity_type_treadmill">Treadmill</string>
|
||||||
|
<string name="activity_type_exercise">Exercise</string>
|
||||||
<string name="select_all">Select all</string>
|
<string name="select_all">Select all</string>
|
||||||
<string name="share">Share</string>
|
<string name="share">Share</string>
|
||||||
<string name="reset_index">Reset fetch date</string>
|
<string name="reset_index">Reset fetch date</string>
|
||||||
|
Loading…
Reference in New Issue
Block a user