فهرست منبع

Save new workouts to sqlite

Lee Morgan 3 هفته پیش
والد
کامیت
fb2af50a32

+ 1 - 1
app/src/androidTest/java/com/example/torus/WorkoutRepositoryTest.kt

@@ -65,7 +65,7 @@ class WorkoutRepositoryTest {
         assertEquals("Bench", exercises[0].name)
         assertEquals("weights", exercises[0].type)
         assertTrue(exercises[0].isActive)
-        assertEquals("pause reps", exercises[0].notes)
+        assertEquals("", exercises[0].notes)
         assertEquals("Easy run", exercises[1].name)
         assertEquals("run", exercises[1].type)
         assertTrue(exercises[1].isActive)

+ 1 - 1
app/src/main/java/com/example/torus/data/WorkoutRepository.kt

@@ -25,7 +25,7 @@ class WorkoutRepository(private val database: TorusDatabase) {
                             name = exercise.name.trim(),
                             type = exercise.type.storageValue,
                             isActive = exercise.isActive,
-                            notes = exercise.notes.trim()
+                            notes = ""
                         )
                     }
                 )

+ 3 - 19
app/src/main/java/com/example/torus/ui/CreateWorkoutScreen.kt

@@ -85,12 +85,8 @@ fun CreateWorkoutScreen(
                         number = index + 1,
                         typeLabel = stringResource(exercise.type.labelRes),
                         name = exercise.name,
-                        notes = exercise.notes,
                         onNameChange = { name ->
                             updateExercise(exercises, exercise.id) { it.copy(name = name) }
-                        },
-                        onNotesChange = { notes ->
-                            updateExercise(exercises, exercise.id) { it.copy(notes = notes) }
                         }
                     )
                 }
@@ -163,9 +159,7 @@ private fun NamedExerciseEditor(
     number: Int,
     typeLabel: String,
     name: String,
-    notes: String,
-    onNameChange: (String) -> Unit,
-    onNotesChange: (String) -> Unit
+    onNameChange: (String) -> Unit
 ) {
     val shape = RoundedCornerShape(14.dp)
     Column(
@@ -196,13 +190,6 @@ private fun NamedExerciseEditor(
             onValueChange = onNameChange,
             label = stringResource(R.string.exercise_name)
         )
-        TorusTextField(
-            value = notes,
-            onValueChange = onNotesChange,
-            label = stringResource(R.string.exercise_notes),
-            singleLine = false,
-            minLines = 3
-        )
     }
 }
 
@@ -259,17 +246,14 @@ private fun TorusTextField(
     value: String,
     onValueChange: (String) -> Unit,
     label: String,
-    modifier: Modifier = Modifier,
-    singleLine: Boolean = true,
-    minLines: Int = 1
+    modifier: Modifier = Modifier
 ) {
     OutlinedTextField(
         value = value,
         onValueChange = onValueChange,
         modifier = modifier.fillMaxWidth(),
         label = { Text(text = label) },
-        singleLine = singleLine,
-        minLines = minLines,
+        singleLine = true,
         shape = RoundedCornerShape(14.dp),
         colors = torusTextFieldColors()
     )

+ 0 - 1
app/src/main/res/values/strings.xml

@@ -8,6 +8,5 @@
     <string name="exercise_type_weights">Weights</string>
     <string name="exercise_type_run">Run</string>
     <string name="exercise_name">Exercise name</string>
-    <string name="exercise_notes">Notes</string>
     <string name="save_workout">Save Workout</string>
 </resources>