1 /**
2  * Copyright (C) 2024 The Android Open Source Project
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except
5  * in compliance with the License. You may obtain a copy of the License at
6  *
7  * ```
8  *      http://www.apache.org/licenses/LICENSE-2.0
9  * ```
10  *
11  * Unless required by applicable law or agreed to in writing, software distributed under the License
12  * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
13  * or implied. See the License for the specific language governing permissions and limitations under
14  * the License.
15  */
16 package com.android.healthconnect.controller.dataentries.formatters
17 
18 import android.content.Context
19 import android.health.connect.datatypes.ExerciseSegmentType
20 import com.android.healthconnect.controller.R
21 import dagger.hilt.android.qualifiers.ApplicationContext
22 import javax.inject.Inject
23 
24 /** Formatter for ExerciseSegmentType data. */
25 class ExerciseSegmentTypeFormatter
26 @Inject
27 constructor(@ApplicationContext private val context: Context) {
getSegmentTypenull28     fun getSegmentType(segmentType: Int): String {
29         return when (segmentType) {
30             ExerciseSegmentType.EXERCISE_SEGMENT_TYPE_BACK_EXTENSION ->
31                 context.getString(R.string.back_extension)
32             ExerciseSegmentType.EXERCISE_SEGMENT_TYPE_BARBELL_SHOULDER_PRESS ->
33                 context.getString(R.string.barbell_shoulder_press)
34             ExerciseSegmentType.EXERCISE_SEGMENT_TYPE_BENCH_PRESS ->
35                 context.getString(R.string.bench_press)
36             ExerciseSegmentType.EXERCISE_SEGMENT_TYPE_BENCH_SIT_UP ->
37                 context.getString(R.string.bench_sit_up)
38             ExerciseSegmentType.EXERCISE_SEGMENT_TYPE_BURPEE -> context.getString(R.string.burpee)
39             ExerciseSegmentType.EXERCISE_SEGMENT_TYPE_CRUNCH -> context.getString(R.string.crunch)
40             ExerciseSegmentType.EXERCISE_SEGMENT_TYPE_DEADLIFT ->
41                 context.getString(R.string.deadlift)
42             ExerciseSegmentType.EXERCISE_SEGMENT_TYPE_DUMBBELL_CURL_LEFT_ARM ->
43                 context.getString(R.string.dumbbell_curl_left_arm)
44             ExerciseSegmentType.EXERCISE_SEGMENT_TYPE_DUMBBELL_CURL_RIGHT_ARM ->
45                 context.getString(R.string.dumbbell_curl_right_arm)
46             ExerciseSegmentType.EXERCISE_SEGMENT_TYPE_DUMBBELL_FRONT_RAISE ->
47                 context.getString(R.string.dumbbell_front_raise)
48             ExerciseSegmentType.EXERCISE_SEGMENT_TYPE_DUMBBELL_LATERAL_RAISE ->
49                 context.getString(R.string.dumbbell_lateral_raise)
50             ExerciseSegmentType.EXERCISE_SEGMENT_TYPE_DUMBBELL_TRICEPS_EXTENSION_LEFT_ARM ->
51                 context.getString(R.string.dumbbell_triceps_extension_left_arm)
52             ExerciseSegmentType.EXERCISE_SEGMENT_TYPE_DUMBBELL_TRICEPS_EXTENSION_RIGHT_ARM ->
53                 context.getString(R.string.dumbbell_triceps_extension_right_arm)
54             ExerciseSegmentType.EXERCISE_SEGMENT_TYPE_DUMBBELL_TRICEPS_EXTENSION_TWO_ARM ->
55                 context.getString(R.string.dumbbell_triceps_extension_two_arm)
56             ExerciseSegmentType.EXERCISE_SEGMENT_TYPE_FORWARD_TWIST ->
57                 context.getString(R.string.forward_twist)
58             ExerciseSegmentType.EXERCISE_SEGMENT_TYPE_JUMPING_JACK ->
59                 context.getString(R.string.jumping_jack)
60             ExerciseSegmentType.EXERCISE_SEGMENT_TYPE_JUMP_ROPE ->
61                 context.getString(R.string.jump_rope)
62             ExerciseSegmentType.EXERCISE_SEGMENT_TYPE_LAT_PULL_DOWN ->
63                 context.getString(R.string.lat_pull_down)
64             ExerciseSegmentType.EXERCISE_SEGMENT_TYPE_LUNGE -> context.getString(R.string.lunge)
65             ExerciseSegmentType.EXERCISE_SEGMENT_TYPE_PLANK -> context.getString(R.string.plank)
66             ExerciseSegmentType.EXERCISE_SEGMENT_TYPE_SQUAT -> context.getString(R.string.squat)
67             ExerciseSegmentType.EXERCISE_SEGMENT_TYPE_BIKING -> context.getString(R.string.biking)
68             ExerciseSegmentType.EXERCISE_SEGMENT_TYPE_BIKING_STATIONARY ->
69                 context.getString(R.string.biking_stationary)
70             ExerciseSegmentType.EXERCISE_SEGMENT_TYPE_PILATES -> context.getString(R.string.pilates)
71             ExerciseSegmentType.EXERCISE_SEGMENT_TYPE_ELLIPTICAL ->
72                 context.getString(R.string.elliptical)
73             ExerciseSegmentType.EXERCISE_SEGMENT_TYPE_ROWING_MACHINE ->
74                 context.getString(R.string.rowing_machine)
75             ExerciseSegmentType.EXERCISE_SEGMENT_TYPE_RUNNING -> context.getString(R.string.running)
76             ExerciseSegmentType.EXERCISE_SEGMENT_TYPE_RUNNING_TREADMILL ->
77                 context.getString(R.string.running_treadmill)
78             ExerciseSegmentType.EXERCISE_SEGMENT_TYPE_STAIR_CLIMBING ->
79                 context.getString(R.string.stair_climbing)
80             ExerciseSegmentType.EXERCISE_SEGMENT_TYPE_STAIR_CLIMBING_MACHINE ->
81                 context.getString(R.string.stair_climbing_machine)
82             ExerciseSegmentType.EXERCISE_SEGMENT_TYPE_STRETCHING ->
83                 context.getString(R.string.stretching)
84             ExerciseSegmentType.EXERCISE_SEGMENT_TYPE_SWIMMING_OPEN_WATER ->
85                 context.getString(R.string.swimming_open_water)
86             ExerciseSegmentType.EXERCISE_SEGMENT_TYPE_SWIMMING_BACKSTROKE ->
87                 context.getString(R.string.swimming_backstroke)
88             ExerciseSegmentType.EXERCISE_SEGMENT_TYPE_SWIMMING_BREASTSTROKE ->
89                 context.getString(R.string.swimming_breaststroke)
90             ExerciseSegmentType.EXERCISE_SEGMENT_TYPE_SWIMMING_BUTTERFLY ->
91                 context.getString(R.string.swimming_butterfly)
92             ExerciseSegmentType.EXERCISE_SEGMENT_TYPE_SWIMMING_FREESTYLE ->
93                 context.getString(R.string.swimming_freestyle)
94             ExerciseSegmentType.EXERCISE_SEGMENT_TYPE_SWIMMING_MIXED ->
95                 context.getString(R.string.swimming_mixed)
96             ExerciseSegmentType.EXERCISE_SEGMENT_TYPE_SWIMMING_POOL ->
97                 context.getString(R.string.swimming_pool)
98             ExerciseSegmentType.EXERCISE_SEGMENT_TYPE_SWIMMING_OTHER ->
99                 context.getString(R.string.swimming_other)
100             ExerciseSegmentType.EXERCISE_SEGMENT_TYPE_WALKING -> context.getString(R.string.walking)
101             ExerciseSegmentType.EXERCISE_SEGMENT_TYPE_WHEELCHAIR ->
102                 context.getString(R.string.wheelchair)
103             ExerciseSegmentType.EXERCISE_SEGMENT_TYPE_WEIGHTLIFTING ->
104                 context.getString(R.string.weightlifting)
105             ExerciseSegmentType.EXERCISE_SEGMENT_TYPE_YOGA -> context.getString(R.string.yoga)
106             ExerciseSegmentType.EXERCISE_SEGMENT_TYPE_ARM_CURL ->
107                 context.getString(R.string.arm_curl)
108             ExerciseSegmentType.EXERCISE_SEGMENT_TYPE_BALL_SLAM ->
109                 context.getString(R.string.ball_slam)
110             ExerciseSegmentType.EXERCISE_SEGMENT_TYPE_DOUBLE_ARM_TRICEPS_EXTENSION ->
111                 context.getString(R.string.double_arm_triceps_extension)
112             ExerciseSegmentType.EXERCISE_SEGMENT_TYPE_DUMBBELL_ROW ->
113                 context.getString(R.string.dumbbell_row)
114             ExerciseSegmentType.EXERCISE_SEGMENT_TYPE_FRONT_RAISE ->
115                 context.getString(R.string.front_raise)
116             ExerciseSegmentType.EXERCISE_SEGMENT_TYPE_HIP_THRUST ->
117                 context.getString(R.string.hip_thrust)
118             ExerciseSegmentType.EXERCISE_SEGMENT_TYPE_HULA_HOOP ->
119                 context.getString(R.string.hula_hoop)
120             ExerciseSegmentType.EXERCISE_SEGMENT_TYPE_KETTLEBELL_SWING ->
121                 context.getString(R.string.kettlebell_swing)
122             ExerciseSegmentType.EXERCISE_SEGMENT_TYPE_LATERAL_RAISE ->
123                 context.getString(R.string.lateral_raise)
124             ExerciseSegmentType.EXERCISE_SEGMENT_TYPE_LEG_CURL ->
125                 context.getString(R.string.leg_curl)
126             ExerciseSegmentType.EXERCISE_SEGMENT_TYPE_LEG_EXTENSION ->
127                 context.getString(R.string.leg_extension)
128             ExerciseSegmentType.EXERCISE_SEGMENT_TYPE_LEG_PRESS ->
129                 context.getString(R.string.leg_press)
130             ExerciseSegmentType.EXERCISE_SEGMENT_TYPE_LEG_RAISE ->
131                 context.getString(R.string.leg_raise)
132             ExerciseSegmentType.EXERCISE_SEGMENT_TYPE_MOUNTAIN_CLIMBER ->
133                 context.getString(R.string.mountain_climber)
134             ExerciseSegmentType.EXERCISE_SEGMENT_TYPE_PULL_UP -> context.getString(R.string.pull_up)
135             ExerciseSegmentType.EXERCISE_SEGMENT_TYPE_PUNCH -> context.getString(R.string.punch)
136             ExerciseSegmentType.EXERCISE_SEGMENT_TYPE_SHOULDER_PRESS ->
137                 context.getString(R.string.shoulder_press)
138             ExerciseSegmentType.EXERCISE_SEGMENT_TYPE_SINGLE_ARM_TRICEPS_EXTENSION ->
139                 context.getString(R.string.single_arm_triceps_extension)
140             ExerciseSegmentType.EXERCISE_SEGMENT_TYPE_HIGH_INTENSITY_INTERVAL_TRAINING ->
141                 context.getString(R.string.high_intensity_interval_training)
142             ExerciseSegmentType.EXERCISE_SEGMENT_TYPE_REST -> context.getString(R.string.rest)
143             ExerciseSegmentType.EXERCISE_SEGMENT_TYPE_PAUSE -> context.getString(R.string.pause)
144             ExerciseSegmentType.EXERCISE_SEGMENT_TYPE_OTHER_WORKOUT ->
145                 context.getString(R.string.workout)
146             ExerciseSegmentType.EXERCISE_SEGMENT_TYPE_SIT_UP -> context.getString(R.string.sit_up)
147             ExerciseSegmentType.EXERCISE_SEGMENT_TYPE_UPPER_TWIST ->
148                 context.getString(R.string.upper_twist)
149             else -> throw IllegalArgumentException("Unknown exercise segment type $segmentType")
150         }
151     }
152 }
153