mirror of
https://codeberg.org/Freeyourgadget/Gadgetbridge
synced 2024-11-28 04:46:51 +01:00
Huami: Add new activity types found in recent Bip S firmware
This commit is contained in:
parent
2aa55aeb2f
commit
ce8021ec9b
@ -44,8 +44,14 @@ public class ActivityKind {
|
||||
public static final int TYPE_ELLIPTICAL_TRAINER = 0x00001000;
|
||||
public static final int TYPE_JUMP_ROPING = 0x00002000;
|
||||
public static final int TYPE_YOGA = 0x00004000;
|
||||
public static final int TYPE_SOCCER = 0x00008000;
|
||||
public static final int TYPE_ROWING_MACHINE = 0x00010000;
|
||||
public static final int TYPE_CRICKET = 0x00020000;
|
||||
public static final int TYPE_BASKETBALL = 0x00040000;
|
||||
public static final int TYPE_PINGPONG = 0x00080000;
|
||||
public static final int TYPE_BADMINTON = 0x00100000;
|
||||
|
||||
private static final int TYPES_COUNT = 17;
|
||||
private static final int TYPES_COUNT = 23;
|
||||
|
||||
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;
|
||||
@ -135,6 +141,18 @@ public class ActivityKind {
|
||||
return context.getString(R.string.activity_type_jump_roping);
|
||||
case TYPE_YOGA:
|
||||
return context.getString(R.string.activity_type_yoga);
|
||||
case TYPE_SOCCER:
|
||||
return context.getString(R.string.activity_type_soccer);
|
||||
case TYPE_ROWING_MACHINE:
|
||||
return context.getString(R.string.activity_type_rowing_machine);
|
||||
case TYPE_CRICKET:
|
||||
return context.getString(R.string.activity_type_cricket);
|
||||
case TYPE_BASKETBALL:
|
||||
return context.getString(R.string.activity_type_basketball);
|
||||
case TYPE_PINGPONG:
|
||||
return context.getString(R.string.activity_type_pingpong);
|
||||
case TYPE_BADMINTON:
|
||||
return context.getString(R.string.activity_type_badminton);
|
||||
case TYPE_UNKNOWN:
|
||||
default:
|
||||
return context.getString(R.string.activity_type_unknown);
|
||||
@ -171,6 +189,15 @@ public class ActivityKind {
|
||||
return R.drawable.ic_activity_rope_jump;
|
||||
case TYPE_YOGA:
|
||||
return R.drawable.ic_activity_yoga;
|
||||
|
||||
// TODO: find icons
|
||||
case TYPE_SOCCER:
|
||||
case TYPE_ROWING_MACHINE:
|
||||
case TYPE_CRICKET:
|
||||
case TYPE_BASKETBALL:
|
||||
case TYPE_PINGPONG:
|
||||
case TYPE_BADMINTON:
|
||||
|
||||
case TYPE_NOT_WORN: // fall through
|
||||
case TYPE_ACTIVITY: // fall through
|
||||
case TYPE_UNKNOWN: // fall through
|
||||
|
@ -19,7 +19,7 @@ package nodomain.freeyourgadget.gadgetbridge.service.devices.huami;
|
||||
import nodomain.freeyourgadget.gadgetbridge.model.ActivityKind;
|
||||
|
||||
public enum HuamiSportsActivityType {
|
||||
Outdoor(1),
|
||||
OutdoorRunning(1),
|
||||
Treadmill(2),
|
||||
Walking(3),
|
||||
Cycling(4),
|
||||
@ -28,8 +28,15 @@ public enum HuamiSportsActivityType {
|
||||
OpenWaterSwimming(7),
|
||||
IndoorCycling(8),
|
||||
EllipticalTrainer(9),
|
||||
JumpRope(21),
|
||||
Yoga(60);
|
||||
Soccer(0x12),
|
||||
JumpRope(0x15),
|
||||
RowingMachine(0x17),
|
||||
Yoga(0x3c),
|
||||
Cricket(0x4e),
|
||||
Basketball(0x55),
|
||||
PingPong(0x59),
|
||||
Badminton(0x5c);
|
||||
|
||||
|
||||
private final int code;
|
||||
|
||||
@ -39,7 +46,7 @@ public enum HuamiSportsActivityType {
|
||||
|
||||
public int toActivityKind() {
|
||||
switch (this) {
|
||||
case Outdoor:
|
||||
case OutdoorRunning:
|
||||
return ActivityKind.TYPE_RUNNING;
|
||||
case Treadmill:
|
||||
return ActivityKind.TYPE_TREADMILL;
|
||||
@ -57,10 +64,22 @@ public enum HuamiSportsActivityType {
|
||||
return ActivityKind.TYPE_INDOOR_CYCLING;
|
||||
case EllipticalTrainer:
|
||||
return ActivityKind.TYPE_ELLIPTICAL_TRAINER;
|
||||
case Soccer:
|
||||
return ActivityKind.TYPE_SOCCER;
|
||||
case JumpRope:
|
||||
return ActivityKind.TYPE_JUMP_ROPING;
|
||||
case RowingMachine:
|
||||
return ActivityKind.TYPE_ROWING_MACHINE;
|
||||
case Yoga:
|
||||
return ActivityKind.TYPE_YOGA;
|
||||
case Cricket:
|
||||
return ActivityKind.TYPE_CRICKET;
|
||||
case Basketball:
|
||||
return ActivityKind.TYPE_BASKETBALL;
|
||||
case PingPong:
|
||||
return ActivityKind.TYPE_PINGPONG;
|
||||
case Badminton:
|
||||
return ActivityKind.TYPE_BADMINTON;
|
||||
}
|
||||
throw new RuntimeException("Not mapped activity kind for: " + this);
|
||||
}
|
||||
@ -77,7 +96,7 @@ public enum HuamiSportsActivityType {
|
||||
public static HuamiSportsActivityType fromActivityKind(int activityKind) {
|
||||
switch (activityKind) {
|
||||
case ActivityKind.TYPE_RUNNING:
|
||||
return Outdoor;
|
||||
return OutdoorRunning;
|
||||
case ActivityKind.TYPE_TREADMILL:
|
||||
return Treadmill;
|
||||
case ActivityKind.TYPE_CYCLING:
|
||||
@ -94,10 +113,23 @@ public enum HuamiSportsActivityType {
|
||||
return IndoorCycling;
|
||||
case ActivityKind.TYPE_ELLIPTICAL_TRAINER:
|
||||
return EllipticalTrainer;
|
||||
case ActivityKind.TYPE_SOCCER:
|
||||
return Soccer;
|
||||
case ActivityKind.TYPE_JUMP_ROPING:
|
||||
return JumpRope;
|
||||
case ActivityKind.TYPE_ROWING_MACHINE:
|
||||
return RowingMachine;
|
||||
case ActivityKind.TYPE_YOGA:
|
||||
return Yoga;
|
||||
case ActivityKind.TYPE_CRICKET:
|
||||
return Cricket;
|
||||
case ActivityKind.TYPE_BASKETBALL:
|
||||
return Basketball;
|
||||
case ActivityKind.TYPE_PINGPONG:
|
||||
return PingPong;
|
||||
case ActivityKind.TYPE_BADMINTON:
|
||||
return Badminton;
|
||||
|
||||
}
|
||||
throw new RuntimeException("No matching activity activityKind: " + activityKind);
|
||||
}
|
||||
|
@ -703,6 +703,12 @@
|
||||
<string name="activity_type_elliptical_trainer">Elliptical Trainer</string>
|
||||
<string name="activity_type_jump_roping">Jumping Rope</string>
|
||||
<string name="activity_type_yoga">Yoga</string>
|
||||
<string name="activity_type_soccer">Soccer</string>
|
||||
<string name="activity_type_rowing_machine">Rowing Machine</string>
|
||||
<string name="activity_type_cricket">Cricket</string>
|
||||
<string name="activity_type_basketball">Basketball</string>
|
||||
<string name="activity_type_pingpong">Ping Pong</string>
|
||||
<string name="activity_type_badminton">Badminton</string>
|
||||
<string name="activity_type_unknown">Unknown activity</string>
|
||||
<string name="activity_summaries">Sport Activities</string>
|
||||
<string name="activity_summary_detail">Sport Activity Detail</string>
|
||||
|
Loading…
Reference in New Issue
Block a user