diff --git a/app/src/main/java/com/ankitsuda/rebound/ui/navigation/AppNavigation.kt b/app/src/main/java/com/ankitsuda/rebound/ui/navigation/AppNavigation.kt index ff690f4d..e2ddaf22 100644 --- a/app/src/main/java/com/ankitsuda/rebound/ui/navigation/AppNavigation.kt +++ b/app/src/main/java/com/ankitsuda/rebound/ui/navigation/AppNavigation.kt @@ -24,33 +24,32 @@ import androidx.navigation.NavGraphBuilder import androidx.navigation.NavHostController import com.ankitsuda.common.compose.collectEvent import com.ankitsuda.navigation.* -import com.ankitsuda.rebound.ui.measure.MeasureScreen -import com.ankitsuda.rebound.ui.exercise_details.ExerciseDetailScreen -import com.ankitsuda.rebound.ui.exercises.ExercisesScreen import com.ankitsuda.rebound.ui.calendar.CalendarScreen -import com.ankitsuda.rebound.ui.components.workouteditor.rpeselector.RpeSelectorBottomSheet import com.ankitsuda.rebound.ui.components.workouteditor.supersetselector.SupersetSelectorBottomSheet import com.ankitsuda.rebound.ui.create_exercise.CreateExerciseScreen import com.ankitsuda.rebound.ui.customizeplates.CustomizePlatesScreen import com.ankitsuda.rebound.ui.customizeplates.edit.PlateEditBottomSheet +import com.ankitsuda.rebound.ui.exercise_details.ExerciseDetailScreen +import com.ankitsuda.rebound.ui.exercises.ExercisesScreen import com.ankitsuda.rebound.ui.history.HistoryScreen import com.ankitsuda.rebound.ui.home.HomeScreen import com.ankitsuda.rebound.ui.keyboard.ReboundSetKeyboardDemoScreen +import com.ankitsuda.rebound.ui.measure.MeasureScreen +import com.ankitsuda.rebound.ui.measure.part.add_sheet.AddPartMeasurementBottomSheet +import com.ankitsuda.rebound.ui.measure.part.overview.PartMeasurementsScreen import com.ankitsuda.rebound.ui.more.MoreScreen +import com.ankitsuda.rebound.ui.resttimer.RestTimerScreen +import com.ankitsuda.rebound.ui.settings.SettingsScreen import com.ankitsuda.rebound.ui.settings.personalization.ColorPickerDemoScreen import com.ankitsuda.rebound.ui.settings.personalization.PersonalizationScreen import com.ankitsuda.rebound.ui.settings.personalization.botom_bar.BottomBarPersonalizationScreen import com.ankitsuda.rebound.ui.settings.personalization.card.CardPersonalizationScreen import com.ankitsuda.rebound.ui.settings.personalization.charts.ChartsPersonalizationScreen +import com.ankitsuda.rebound.ui.settings.personalization.keyboard.KeyboardPersonalizationScreen import com.ankitsuda.rebound.ui.settings.personalization.main_colors.MainColorsPersonalizationScreen +import com.ankitsuda.rebound.ui.settings.personalization.presets.ThemePresetsPersonalizationScreen import com.ankitsuda.rebound.ui.settings.personalization.shapes.ShapesPersonalizationScreen import com.ankitsuda.rebound.ui.settings.personalization.top_bar.TopBarPersonalizationScreen -import com.ankitsuda.rebound.ui.measure.part.add_sheet.AddPartMeasurementBottomSheet -import com.ankitsuda.rebound.ui.measure.part.overview.PartMeasurementsScreen -import com.ankitsuda.rebound.ui.resttimer.RestTimerScreen -import com.ankitsuda.rebound.ui.settings.SettingsScreen -import com.ankitsuda.rebound.ui.settings.personalization.keyboard.KeyboardPersonalizationScreen -import com.ankitsuda.rebound.ui.settings.personalization.presets.ThemePresetsPersonalizationScreen import com.ankitsuda.rebound.ui.workout.WorkoutScreen import com.ankitsuda.rebound.ui.workout.addfolder.TemplatesFolderEditBottomSheet import com.ankitsuda.rebound.ui.workout_details.SessionScreen @@ -128,7 +127,6 @@ internal fun AppNavigation( addExercisesBottomSheet(navController) addRestTimer(navController) addSupersetSelector(navController) - addRpeSelector(navController) } } @@ -403,13 +401,6 @@ private fun NavGraphBuilder.addSupersetSelector(navController: NavController) { } } -private fun NavGraphBuilder.addRpeSelector(navController: NavController) { - bottomSheetScreen(LeafScreen.RpeSelector()) { - RpeSelectorBottomSheet(navController) - } -} - - /** * Adds an [NavController.OnDestinationChangedListener] to this [NavController] and updates the * returned [State] which is updated as the destination changes. diff --git a/modules/common-ui-components-workout-editor/src/main/java/com/ankitsuda/rebound/ui/components/workouteditor/WorkoutEditorComponent.kt b/modules/common-ui-components-workout-editor/src/main/java/com/ankitsuda/rebound/ui/components/workouteditor/WorkoutEditorComponent.kt index 6a699447..f6611cef 100644 --- a/modules/common-ui-components-workout-editor/src/main/java/com/ankitsuda/rebound/ui/components/workouteditor/WorkoutEditorComponent.kt +++ b/modules/common-ui-components-workout-editor/src/main/java/com/ankitsuda/rebound/ui/components/workouteditor/WorkoutEditorComponent.kt @@ -26,7 +26,6 @@ import androidx.compose.material.icons.outlined.Close import androidx.compose.runtime.Composable import androidx.compose.runtime.LaunchedEffect import androidx.compose.runtime.collectAsState -import androidx.compose.runtime.livedata.observeAsState import androidx.compose.ui.ExperimentalComposeUiApi import androidx.compose.ui.Modifier import androidx.compose.ui.graphics.Color @@ -42,14 +41,11 @@ import com.ankitsuda.rebound.domain.entities.ExerciseSetGroupNote import com.ankitsuda.rebound.domain.entities.ExerciseWorkoutJunction import com.ankitsuda.rebound.domain.entities.LogEntriesWithExerciseJunction import com.ankitsuda.rebound.ui.components.AppTextField -import com.ankitsuda.rebound.ui.components.workouteditor.rpeselector.models.RpeSelectorResult import com.ankitsuda.rebound.ui.components.workouteditor.supersetselector.models.SupersetSelectorResult import com.ankitsuda.rebound.ui.components.workouteditor.warmupcalculator.toExerciseLogEntries import com.ankitsuda.rebound.ui.keyboard.LocalReboundSetKeyboard import com.ankitsuda.rebound.ui.theme.ReboundTheme import com.google.accompanist.insets.LocalWindowInsets -import timber.log.Timber -import kotlin.math.log @OptIn(ExperimentalComposeUiApi::class, ExperimentalFoundationApi::class) @Composable @@ -89,12 +85,6 @@ fun WorkoutEditorComponent( ?.getStateFlow(RESULT_SUPERSET_SELECTOR_SUPERSET_ID_KEY, null) ?.collectAsState() - // Observes results when RPE Selector changes value of arg - val rpeSelectorResult = navController.currentBackStackEntry - ?.savedStateHandle - ?.getStateFlow(RESULT_RPE_SELECTOR_KEY, null) - ?.collectAsState() - val navigationBarHeight = with(LocalDensity.current) { if (addNavigationBarPadding) LocalWindowInsets.current.navigationBars.bottom.toDp() else 0.dp } @@ -125,26 +115,6 @@ fun WorkoutEditorComponent( } } - LaunchedEffect(key1 = rpeSelectorResult?.value) { - rpeSelectorResult?.value?.let { result -> - - logEntriesWithJunction.flatMap { it.logEntries }.find { - it.entryId == result.entryId - }?.let { - onUpdateLogEntry( - it.copy( - rpe = result.rpe - ) - ) - } - - navController.currentBackStackEntry?.savedStateHandle?.set( - RESULT_RPE_SELECTOR_KEY, - null - ) - } - } - val keyboardController = LocalSoftwareKeyboardController.current val reboundKeyboard = LocalReboundSetKeyboard.current fun hideKeyboard() { @@ -249,15 +219,6 @@ fun WorkoutEditorComponent( junctionId = logEntriesWithJunctionItem.junction.id, ) ) - }, - onRequestRpeSelector = { - hideKeyboard() - navigator.navigate( - LeafScreen.RpeSelector.createRoute( - it.entryId, - it.rpe - ) - ) } ) } diff --git a/modules/common-ui-components-workout-editor/src/main/java/com/ankitsuda/rebound/ui/components/workouteditor/WorkoutExerciseItem.kt b/modules/common-ui-components-workout-editor/src/main/java/com/ankitsuda/rebound/ui/components/workouteditor/WorkoutExerciseItem.kt index cae34684..aa153cf2 100644 --- a/modules/common-ui-components-workout-editor/src/main/java/com/ankitsuda/rebound/ui/components/workouteditor/WorkoutExerciseItem.kt +++ b/modules/common-ui-components-workout-editor/src/main/java/com/ankitsuda/rebound/ui/components/workouteditor/WorkoutExerciseItem.kt @@ -14,7 +14,6 @@ package com.ankitsuda.rebound.ui.components.workouteditor -import android.view.inputmethod.InputConnection import androidx.compose.animation.* import androidx.compose.animation.core.* import androidx.compose.foundation.ExperimentalFoundationApi @@ -25,7 +24,6 @@ import androidx.compose.foundation.lazy.LazyItemScope import androidx.compose.foundation.lazy.LazyListScope import androidx.compose.foundation.lazy.items import androidx.compose.foundation.shape.CircleShape -import androidx.compose.foundation.shape.RoundedCornerShape import androidx.compose.material.* import androidx.compose.material.icons.Icons import androidx.compose.material.icons.outlined.* @@ -33,7 +31,6 @@ import androidx.compose.runtime.* import androidx.compose.runtime.saveable.rememberSaveable import androidx.compose.ui.Alignment import androidx.compose.ui.Modifier -import androidx.compose.ui.draw.clip import androidx.compose.ui.draw.scale import androidx.compose.ui.graphics.Color import androidx.compose.ui.res.stringResource @@ -57,9 +54,7 @@ import com.ankitsuda.rebound.ui.components.workouteditor.warmupcalculator.WarmUp import com.ankitsuda.rebound.ui.components.workouteditor.warmupcalculator.WarmUpSet import com.ankitsuda.rebound.ui.keyboard.enums.ReboundKeyboardType import com.ankitsuda.rebound.ui.keyboard.field.ReboundSetTextField -import com.ankitsuda.rebound.ui.keyboard.getText import com.ankitsuda.rebound.ui.theme.ReboundTheme -import timber.log.Timber import java.util.* private val ExerciseLogEntryComparator = Comparator { left, right -> @@ -80,7 +75,6 @@ fun LazyListScope.workoutExerciseItemAlt( onChangeNote: (ExerciseSetGroupNote) -> Unit, onAddToSuperset: () -> Unit, onRemoveFromSuperset: () -> Unit, - onRequestRpeSelector: (ExerciseLogEntry) -> Unit, ) { val supersetId = logEntriesWithJunction.junction.supersetId @@ -321,7 +315,6 @@ fun LazyListScope.workoutExerciseItemAlt( onSwipeDelete = { onSwipeDelete(it) }, - onRequestRpeSelector = onRequestRpeSelector ) } } @@ -361,7 +354,6 @@ private fun LazyItemScope.SetItem( exerciseLogEntry: ExerciseLogEntry, onChange: (ExerciseLogEntry) -> Unit, onSwipeDelete: (ExerciseLogEntry) -> Unit, - onRequestRpeSelector: (ExerciseLogEntry) -> Unit, ) { var mLogEntry by rememberSaveable { mutableStateOf(exerciseLogEntry) @@ -491,7 +483,6 @@ private fun LazyItemScope.SetItem( onRpeChange = { _, value -> handleOnChange(mLogEntry.copy(rpe = value)) }, - onRequestRpeSelector = onRequestRpeSelector ) } } @@ -511,7 +502,6 @@ private fun SetItemLayout( onCompleteChange: (ExerciseLogEntry, Boolean) -> Unit, onSetTypeChange: (ExerciseLogEntry, LogSetType) -> Unit, onRpeChange: (ExerciseLogEntry, Float?) -> Unit, - onRequestRpeSelector: (ExerciseLogEntry) -> Unit, ) { val typeOfSet = exerciseLogEntry.setType ?: LogSetType.NORMAL var isSetTypeChangerExpanded by rememberSaveable { @@ -662,27 +652,6 @@ private fun SetItemLayout( bgColor = bgColor, reboundKeyboardType = ReboundKeyboardType.RPE ) -// Box( -// modifier = Modifier -// .defaultMinSize(minHeight = 32.dp) -// .padding(start = 8.dp, end = 8.dp) -// .weight(0.75f) -// .clip(RoundedCornerShape(12.dp)) -// .background(bgColor.lighterOrDarkerColor(0.10f)) -// .clickable { -// onRequestRpeSelector(exerciseLogEntry) -// }, -// contentAlignment = Alignment.Center -// ) { -// Text( -// exerciseLogEntry.rpe?.toReadableString() ?: "", -// style = LocalTextStyle.current.copy( -// textAlign = TextAlign.Center, -// fontSize = 14.sp, -// color = contentColor -// ) -// ) -// } } IconButton( diff --git a/modules/common-ui-components-workout-editor/src/main/java/com/ankitsuda/rebound/ui/components/workouteditor/rpeselector/RpeSelectorBottomSheet.kt b/modules/common-ui-components-workout-editor/src/main/java/com/ankitsuda/rebound/ui/components/workouteditor/rpeselector/RpeSelectorBottomSheet.kt deleted file mode 100644 index 6326a502..00000000 --- a/modules/common-ui-components-workout-editor/src/main/java/com/ankitsuda/rebound/ui/components/workouteditor/rpeselector/RpeSelectorBottomSheet.kt +++ /dev/null @@ -1,123 +0,0 @@ -/* - * Copyright (c) 2022 Ankit Suda. - * - * Licensed under the GNU General Public License v3 - * - * This is free software: you can redistribute it and/or modify it - * under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or (at your option) any later version. - * - * This software is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; - * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. - * See the GNU General Public License for more details. - */ - -package com.ankitsuda.rebound.ui.components.workouteditor.rpeselector - -import androidx.compose.foundation.layout.* -import androidx.compose.material.Text -import androidx.compose.runtime.Composable -import androidx.compose.runtime.getValue -import androidx.compose.runtime.mutableStateOf -import androidx.compose.runtime.saveable.rememberSaveable -import androidx.compose.runtime.setValue -import androidx.compose.ui.Alignment -import androidx.compose.ui.Modifier -import androidx.compose.ui.res.stringResource -import androidx.compose.ui.unit.dp -import androidx.navigation.NavController -import com.ankitsuda.navigation.ENTRY_ID_KEY -import com.ankitsuda.navigation.RESULT_RPE_SELECTOR_KEY -import com.ankitsuda.navigation.RPE_KEY -import com.ankitsuda.rebound.ui.components.BottomSheetRButton -import com.ankitsuda.rebound.ui.components.BottomSheetSecondaryRButton -import com.ankitsuda.rebound.ui.components.BottomSheetSurface -import com.ankitsuda.rebound.ui.components.TopBar -import com.ankitsuda.rebound.ui.components.workouteditor.R -import com.ankitsuda.rebound.ui.components.workouteditor.rpeselector.components.RpeSlider -import com.ankitsuda.rebound.ui.components.workouteditor.rpeselector.components.SelectedRpeOverview -import com.ankitsuda.rebound.ui.components.workouteditor.rpeselector.models.RpeSelectorResult - -@Composable -fun RpeSelectorBottomSheet( - navController: NavController -) { - val initialRpe: Float? = with( - navController.currentBackStackEntry?.arguments - ?.getFloat(RPE_KEY) - ) { - if (this == -1f) null else this - } - - var rpe: Float? by rememberSaveable { - mutableStateOf(initialRpe) - } - - fun handleSelectClick() { - - navController.currentBackStackEntry?.arguments?.getString(ENTRY_ID_KEY)?.let { - navController.previousBackStackEntry?.savedStateHandle?.set( - RESULT_RPE_SELECTOR_KEY, - RpeSelectorResult( - entryId = it, - rpe = rpe, - ) - ) - } - - navController.popBackStack() - - } - - BottomSheetSurface { - Column( - modifier = Modifier - .fillMaxWidth() - .navigationBarsPadding(), - ) { - TopBar( - title = stringResource(id = R.string.rpe), - statusBarEnabled = false, - elevationEnabled = false - ) - Column( - modifier = Modifier - .fillMaxWidth() - .padding(16.dp), - verticalArrangement = Arrangement.spacedBy(16.dp) - ) { - SelectedRpeOverview( - modifier = Modifier.fillMaxWidth(), - rpe = rpe, - ) - RpeSlider( - modifier = Modifier.fillMaxWidth(), - value = rpe, - onValueChange = { - rpe = it - } - ) - } - Row( - Modifier - .padding(end = 16.dp, start = 16.dp, bottom = 16.dp, top = 16.dp) - .align(Alignment.End) - ) { - BottomSheetSecondaryRButton( - modifier = Modifier.padding(end = 16.dp), - onClick = { - navController.popBackStack() - }) { - Text(stringResource(id = R.string.cancel)) - } - - BottomSheetRButton( - onClick = ::handleSelectClick, - modifier = Modifier.width(88.dp) - ) { - Text(stringResource(id = R.string.select)) - } - } - } - } -} \ No newline at end of file diff --git a/modules/common-ui-components-workout-editor/src/main/java/com/ankitsuda/rebound/ui/components/workouteditor/rpeselector/components/RpeSlider.kt b/modules/common-ui-components-workout-editor/src/main/java/com/ankitsuda/rebound/ui/components/workouteditor/rpeselector/components/RpeSlider.kt deleted file mode 100644 index f62c6e3b..00000000 --- a/modules/common-ui-components-workout-editor/src/main/java/com/ankitsuda/rebound/ui/components/workouteditor/rpeselector/components/RpeSlider.kt +++ /dev/null @@ -1,109 +0,0 @@ -/* - * Copyright (c) 2022 Ankit Suda. - * - * Licensed under the GNU General Public License v3 - * - * This is free software: you can redistribute it and/or modify it - * under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or (at your option) any later version. - * - * This software is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; - * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. - * See the GNU General Public License for more details. - */ - -package com.ankitsuda.rebound.ui.components.workouteditor.rpeselector.components - -import androidx.compose.foundation.Canvas -import androidx.compose.foundation.isSystemInDarkTheme -import androidx.compose.foundation.layout.Box -import androidx.compose.foundation.layout.fillMaxWidth -import androidx.compose.foundation.layout.height -import androidx.compose.foundation.layout.padding -import androidx.compose.material.Slider -import androidx.compose.material.SliderDefaults -import androidx.compose.runtime.* -import androidx.compose.ui.Alignment -import androidx.compose.ui.Modifier -import androidx.compose.ui.geometry.Offset -import androidx.compose.ui.graphics.Color -import androidx.compose.ui.graphics.nativeCanvas -import androidx.compose.ui.platform.LocalDensity -import androidx.compose.ui.unit.dp -import com.ankitsuda.base.util.toLegacyInt -import com.ankitsuda.base.util.toReadableString -import com.ankitsuda.rebound.ui.theme.ReboundTheme -import timber.log.Timber -import kotlin.math.roundToInt - -@Composable -internal fun RpeSlider( - modifier: Modifier, - value: Float?, - onValueChange: (Float?) -> Unit, -) { - val allRPEs = listOf(null, 6f, 7f, 7.5f, 8f, 8.5f, 9f, 9.5f, 10f) - - var mValue by remember { - mutableStateOf(with(allRPEs.indexOf(value)) { - if (this == -1) 0f else this.toFloat() - }) - } - - val drawPadding = with(LocalDensity.current) { 10.dp.toPx() } - val textSize = with(LocalDensity.current) { 10.dp.toPx() } - val lineHeightDp = 10.dp - val lineHeightPx = with(LocalDensity.current) { lineHeightDp.toPx() } - val canvasHeight = 50.dp - val textPaint = android.graphics.Paint().apply { - color = ReboundTheme.colors.onBackground.toLegacyInt() - textAlign = android.graphics.Paint.Align.CENTER - this.textSize = textSize - } - Box( - modifier = modifier, - contentAlignment = Alignment.Center - ) { - Canvas( - modifier = Modifier - .height(canvasHeight) - .fillMaxWidth() - .padding( - top = canvasHeight - .div(2) - .minus(lineHeightDp.div(2)) - ) - ) { - val yStart = 0f - val distance = (size.width.minus(2 * drawPadding)).div(allRPEs.size.minus(1)) - allRPEs.forEachIndexed { index, rpe -> - drawLine( - color = Color.DarkGray, - start = Offset(x = drawPadding + index.times(distance), y = yStart), - end = Offset(x = drawPadding + index.times(distance), y = lineHeightPx) - ) -// if (index.rem(2) == 1) { - this.drawContext.canvas.nativeCanvas.drawText( - rpe?.toReadableString() ?: "?", - drawPadding + index.times(distance), - size.height, - textPaint - ) -// } - } - } - Slider( - modifier = Modifier.fillMaxWidth(), - value = mValue, - valueRange = 0f..(allRPEs.size - 1).toFloat(), - steps = allRPEs.size - 2, - colors = SliderDefaults.colors( - activeTickColor = Color.Transparent, - inactiveTickColor = Color.Transparent - ), - onValueChange = { - mValue = it - onValueChange(allRPEs.getOrNull(it.roundToInt())) - }) - } -} \ No newline at end of file diff --git a/modules/common-ui-components-workout-editor/src/main/java/com/ankitsuda/rebound/ui/components/workouteditor/rpeselector/components/SelectedRpeOverview.kt b/modules/common-ui-components-workout-editor/src/main/java/com/ankitsuda/rebound/ui/components/workouteditor/rpeselector/components/SelectedRpeOverview.kt deleted file mode 100644 index c2c8b0da..00000000 --- a/modules/common-ui-components-workout-editor/src/main/java/com/ankitsuda/rebound/ui/components/workouteditor/rpeselector/components/SelectedRpeOverview.kt +++ /dev/null @@ -1,125 +0,0 @@ -/* - * Copyright (c) 2022 Ankit Suda. - * - * Licensed under the GNU General Public License v3 - * - * This is free software: you can redistribute it and/or modify it - * under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or (at your option) any later version. - * - * This software is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; - * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. - * See the GNU General Public License for more details. - */ - -package com.ankitsuda.rebound.ui.components.workouteditor.rpeselector.components - -import androidx.compose.animation.* -import androidx.compose.animation.core.tween -import androidx.compose.foundation.layout.Arrangement -import androidx.compose.foundation.layout.Column -import androidx.compose.material.Text -import androidx.compose.runtime.* -import androidx.compose.ui.Alignment -import androidx.compose.ui.Modifier -import androidx.compose.ui.res.stringResource -import androidx.compose.ui.unit.dp -import com.ankitsuda.base.util.toReadableString -import com.ankitsuda.rebound.ui.components.workouteditor.R -import com.ankitsuda.rebound.ui.theme.ReboundTheme - -@OptIn(ExperimentalAnimationApi::class) -@Composable -internal fun SelectedRpeOverview(modifier: Modifier, rpe: Float?) { - var lastRpe by remember { mutableStateOf(rpe) } - var mRpe by remember { mutableStateOf(rpe) } - - SideEffect { - if (mRpe != rpe) { - lastRpe = mRpe - mRpe = rpe - } - } - - AnimatedContent( - targetState = mRpe, - transitionSpec = { - if ((targetState ?: 0f) > (lastRpe ?: 0f)) { - // If the target number is larger, it slides up and fades in - // while the initial (smaller) number slides up and fades out. - slideInHorizontally { width -> width } + fadeIn() with - slideOutHorizontally { width -> -width } + fadeOut() - } else { - // If the target number is smaller, it slides down and fades in - // while the initial number slides down and fades out. - slideInHorizontally { width -> -width } + fadeIn() with - slideOutHorizontally { width -> width } + fadeOut() - }.using( - // Disable clipping since the faded slide-in/out should - // be displayed out of bounds. - SizeTransform(clip = false) - ) - }, - ) { - - var title = stringResource(id = R.string.rpe) - var description: String? = null - - when (it) { - 6f -> { - title = stringResource(id = R.string.rpe_6_title) - description = stringResource(id = R.string.rpe_6_description) - } - 7f -> { - title = stringResource(id = R.string.rpe_7_title) - description = stringResource(id = R.string.rpe_7_description) - } - 7.5f -> { - title = stringResource(id = R.string.rpe_7_5_title) - description = stringResource(id = R.string.rpe_7_5_description) - } - 8f -> { - title = stringResource(id = R.string.rpe_8_title) - description = stringResource(id = R.string.rpe_8_description) - } - 8.5f -> { - title = stringResource(id = R.string.rpe_8_5_title) - description = stringResource(id = R.string.rpe_8_5_description) - } - 9f -> { - title = stringResource(id = R.string.rpe_9_title) - description = stringResource(id = R.string.rpe_9_description) - } - 9.5f -> { - title = stringResource(id = R.string.rpe_9_5_title) - description = stringResource(id = R.string.rpe_9_5_description) - } - 10f -> { - title = stringResource(id = R.string.rpe_10_title) - description = stringResource(id = R.string.rpe_10_description) - } - } - - Column( - modifier = modifier, - verticalArrangement = Arrangement.spacedBy(8.dp), - horizontalAlignment = Alignment.CenterHorizontally - ) { - Text( - text = if (it != null) it.toReadableString() else "?", - style = ReboundTheme.typography.h3 - ) - Text( - text = title, - style = ReboundTheme.typography.subtitle1.copy(color = ReboundTheme.colors.onBackground) - ) - - Text( - text = description ?: "", - style = ReboundTheme.typography.subtitle1.copy( - color = ReboundTheme.colors.onBackground.copy(alpha = 0.75f) - ) - ) - } - } -} \ No newline at end of file diff --git a/modules/common-ui-components-workout-editor/src/main/java/com/ankitsuda/rebound/ui/components/workouteditor/rpeselector/models/RpeSelectorResult.kt b/modules/common-ui-components-workout-editor/src/main/java/com/ankitsuda/rebound/ui/components/workouteditor/rpeselector/models/RpeSelectorResult.kt deleted file mode 100644 index 2379bb31..00000000 --- a/modules/common-ui-components-workout-editor/src/main/java/com/ankitsuda/rebound/ui/components/workouteditor/rpeselector/models/RpeSelectorResult.kt +++ /dev/null @@ -1,25 +0,0 @@ -/* - * Copyright (c) 2022 Ankit Suda. - * - * Licensed under the GNU General Public License v3 - * - * This is free software: you can redistribute it and/or modify it - * under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or (at your option) any later version. - * - * This software is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; - * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. - * See the GNU General Public License for more details. - */ - -package com.ankitsuda.rebound.ui.components.workouteditor.rpeselector.models - -import android.os.Parcelable -import kotlinx.parcelize.Parcelize - -@Parcelize -data class RpeSelectorResult( - val entryId: String, - val rpe: Float? -) : Parcelable - diff --git a/modules/navigation/src/main/java/com/ankitsuda/navigation/Screens.kt b/modules/navigation/src/main/java/com/ankitsuda/navigation/Screens.kt index 80423f95..44d8ff3d 100644 --- a/modules/navigation/src/main/java/com/ankitsuda/navigation/Screens.kt +++ b/modules/navigation/src/main/java/com/ankitsuda/navigation/Screens.kt @@ -41,11 +41,9 @@ const val FOLDER_ID_KEY = "folder_id" const val SUPERSET_ID_KEY = "superset_id" const val JUNCTION_ID_KEY = "junction_id" const val ENTRY_ID_KEY = "entry_id" -const val RPE_KEY = "rpe" const val RESULT_EXERCISES_SCREEN_EXERCISE_ID = "result_exercises_screen_exercise_id" const val RESULT_SUPERSET_SELECTOR_SUPERSET_ID_KEY = "result_superset_selector_superset_id" -const val RESULT_RPE_SELECTOR_KEY = "result_rpe_selector" interface Screen { val route: String @@ -441,32 +439,6 @@ sealed class LeafScreen( "superset_selector?$WORKOUT_ID_KEY=$workoutId&$JUNCTION_ID_KEY=$junctionId" } } - - data class RpeSelector( - override val route: String = - "rpe_selector?$ENTRY_ID_KEY={$ENTRY_ID_KEY}&$RPE_KEY={$RPE_KEY}" - ) : - LeafScreen( - route = route, - arguments = listOf( - navArgument(ENTRY_ID_KEY) { - type = NavType.StringType - nullable = false - }, - navArgument(RPE_KEY) { - type = NavType.FloatType - nullable = false - } - ) - ) { - companion object { - fun createRoute( - entryId: String, - initialRpe: Float? - ) = "rpe_selector?$ENTRY_ID_KEY=$entryId&$RPE_KEY=${initialRpe ?: -1f}" - } - } - } @OptIn(ExperimentalAnimationApi::class)