diff --git a/libraries/designsystem/src/main/kotlin/io/element/android/libraries/designsystem/components/ExpandableBottomSheetLayout.kt b/libraries/designsystem/src/main/kotlin/io/element/android/libraries/designsystem/components/ExpandableBottomSheetLayout.kt index 433c38102d..85307823f6 100644 --- a/libraries/designsystem/src/main/kotlin/io/element/android/libraries/designsystem/components/ExpandableBottomSheetLayout.kt +++ b/libraries/designsystem/src/main/kotlin/io/element/android/libraries/designsystem/components/ExpandableBottomSheetLayout.kt @@ -77,28 +77,9 @@ fun ExpandableBottomSheetLayout( var calculatedMaxBottomContentHeightPx by remember(maxBottomContentHeightPx) { mutableIntStateOf(maxBottomContentHeightPx) } val animatable = remember { Animatable(0f) } - fun calculatePercentage(currentPos: Int, minPos: Int, maxPos: Int): Float { - val currentProgress = currentPos - minPos - if (currentProgress < 0) { - Timber.e("Invalid current progress: $currentProgress, minPos: $minPos, maxPos: $maxPos") - return 0f - } - val total = (maxPos - minPos).toFloat() - if (total <= 0) { - Timber.e("Invalid total space: $total, minPos: $minPos, maxPos: $maxPos") - return 0f - } - return currentProgress / total - } - LaunchedEffect(animatable.value) { if (animatable.isRunning && animatable.value != animatable.targetValue) { currentBottomContentHeightPx = animatable.value.roundToInt() - state.internalDraggingPercentage = calculatePercentage( - currentPos = currentBottomContentHeightPx, - minPos = minBottomContentHeightPx, - maxPos = calculatedMaxBottomContentHeightPx, - ) } } @@ -122,11 +103,6 @@ fun ExpandableBottomSheetLayout( minBottomContentHeightPx -> ExpandableBottomSheetLayoutState.Position.COLLAPSED else -> ExpandableBottomSheetLayoutState.Position.DRAGGING } - state.internalDraggingPercentage = calculatePercentage( - currentPos = newHeight, - minPos = minBottomContentHeightPx, - maxPos = calculatedMaxBottomContentHeightPx, - ) currentBottomContentHeightPx = newHeight }, onDragEnd = { diff --git a/libraries/designsystem/src/main/kotlin/io/element/android/libraries/designsystem/components/ExpandableBottomSheetLayoutState.kt b/libraries/designsystem/src/main/kotlin/io/element/android/libraries/designsystem/components/ExpandableBottomSheetLayoutState.kt index 1b17ec544b..ad6828aed3 100644 --- a/libraries/designsystem/src/main/kotlin/io/element/android/libraries/designsystem/components/ExpandableBottomSheetLayoutState.kt +++ b/libraries/designsystem/src/main/kotlin/io/element/android/libraries/designsystem/components/ExpandableBottomSheetLayoutState.kt @@ -32,21 +32,12 @@ fun rememberExpandableBottomSheetLayoutState(): ExpandableBottomSheetLayoutState @Stable class ExpandableBottomSheetLayoutState { internal var internalPosition: Position by mutableStateOf(Position.COLLAPSED) - internal var internalDraggingPercentage: Float by mutableFloatStateOf( - if (internalPosition == Position.EXPANDED) 1f else 0f - ) /** * The current position of the bottom sheet layout. */ val position get() = internalPosition - /** - * The percentage of the bottom sheet layout that is currently being dragged. - * This value ranges from `0f` for [Position.COLLAPSED] to `1f` for [Position.EXPANDED]. - */ - val draggingPercentage = internalDraggingPercentage - /** * The position of the bottom sheet layout. */