1
0
mirror of https://codeberg.org/Freeyourgadget/Gadgetbridge synced 2024-11-04 09:17:29 +01:00

New Amazfit GTS 2 Mini activity Outdoor Trekking/Hiking (#2528)

New Huami Amazfit GTS 2 Mini activity for Outdoor Trekking/Hiking.

Reviewed-on: https://codeberg.org/Freeyourgadget/Gadgetbridge/pulls/2528
Co-authored-by: Sebastian Krey <skrey@noreply.codeberg.org>
Co-committed-by: Sebastian Krey <skrey@noreply.codeberg.org>
This commit is contained in:
Sebastian Krey 2021-12-28 13:46:17 +01:00 committed by Andreas Shimokawa
parent 7e2ac49cfc
commit 2bf4f14b98
5 changed files with 18 additions and 2 deletions

View File

@ -181,7 +181,7 @@ public class HuamiActivitySummaryParser implements ActivitySummaryParser {
averageStride = buffer.getShort();
maxHR = buffer.getShort();
if (activityKind == ActivityKind.TYPE_CYCLING || activityKind == ActivityKind.TYPE_RUNNING) {
if (activityKind == ActivityKind.TYPE_CYCLING || activityKind == ActivityKind.TYPE_RUNNING || activityKind == ActivityKind.TYPE_HIKING) {
// this had nonsense data with treadmill on bip s, need to test it with running
// for cycling it seems to work... hmm...
// 28 bytes

View File

@ -51,8 +51,9 @@ public class ActivityKind {
public static final int TYPE_PINGPONG = 0x00080000;
public static final int TYPE_BADMINTON = 0x00100000;
public static final int TYPE_STRENGTH_TRAINING = 0x00200000;
public static final int TYPE_HIKING = 0x00400000;
private static final int TYPES_COUNT = 24;
private static final int TYPES_COUNT = 25;
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;
@ -78,6 +79,9 @@ public class ActivityKind {
if ((types & ActivityKind.TYPE_WALKING) != 0) {
result[i++] = provider.toRawActivityKind(TYPE_WALKING);
}
if ((types & ActivityKind.TYPE_HIKING) != 0) {
result[i++] = provider.toRawActivityKind(TYPE_HIKING);
}
if ((types & ActivityKind.TYPE_SWIMMING) != 0) {
result[i++] = provider.toRawActivityKind(TYPE_SWIMMING);
}
@ -143,6 +147,8 @@ public class ActivityKind {
return context.getString(R.string.activity_type_running);
case TYPE_WALKING:
return context.getString(R.string.activity_type_walking);
case TYPE_HIKING:
return context.getString(R.string.activity_type_hiking);
case TYPE_SWIMMING:
return context.getString(R.string.activity_type_swimming);
case TYPE_CYCLING:
@ -193,6 +199,7 @@ public class ActivityKind {
case TYPE_RUNNING:
return R.drawable.ic_activity_running;
case TYPE_WALKING:
case TYPE_HIKING:
return R.drawable.ic_activity_walking;
case TYPE_CYCLING:
return R.drawable.ic_activity_biking;

View File

@ -28,6 +28,7 @@ public enum HuamiSportsActivityType {
OpenWaterSwimming(7),
IndoorCycling(8),
EllipticalTrainer(9),
OutdoorHiking(15),
Soccer(0x12),
JumpRope(0x15),
RowingMachine(0x17),
@ -49,6 +50,8 @@ public enum HuamiSportsActivityType {
switch (this) {
case OutdoorRunning:
return ActivityKind.TYPE_RUNNING;
case OutdoorHiking:
return ActivityKind.TYPE_HIKING;
case Treadmill:
return ActivityKind.TYPE_TREADMILL;
case Cycling:
@ -100,6 +103,8 @@ public enum HuamiSportsActivityType {
switch (activityKind) {
case ActivityKind.TYPE_RUNNING:
return OutdoorRunning;
case ActivityKind.TYPE_HIKING:
return OutdoorHiking;
case ActivityKind.TYPE_TREADMILL:
return Treadmill;
case ActivityKind.TYPE_CYCLING:

View File

@ -102,6 +102,9 @@ public class FetchSportsDetailsOperation extends AbstractFetchOperation {
case ActivityKind.TYPE_WALKING:
trackType = getContext().getString(R.string.activity_type_walking);
break;
case ActivityKind.TYPE_HIKING:
trackType = getContext().getString(R.string.activity_type_hiking);
break;
case ActivityKind.TYPE_SWIMMING:
trackType = getContext().getString(R.string.activity_type_swimming);
break;

View File

@ -826,6 +826,7 @@
<string name="activity_type_not_worn">Device not worn</string>
<string name="activity_type_running">Running</string>
<string name="activity_type_walking">Walking</string>
<string name="activity_type_hiking">Hiking</string>
<string name="activity_type_swimming">Swimming</string>
<string name="activity_type_swimming_openwater">Swimming (Open water)</string>
<string name="activity_type_indoor_cycling">Indoor Cycling</string>