From a74e61e31b87573cd43e2523535f269d315a0673 Mon Sep 17 00:00:00 2001 From: Xavier Molloy Date: Wed, 29 May 2024 10:52:40 +0200 Subject: [PATCH] fix: [ANDROAPP-6137] femove unused methods and variable --- form/src/main/java/org/dhis2/form/ui/Form.kt | 33 +++----------------- 1 file changed, 5 insertions(+), 28 deletions(-) diff --git a/form/src/main/java/org/dhis2/form/ui/Form.kt b/form/src/main/java/org/dhis2/form/ui/Form.kt index 3c91e79577..ad2ea55870 100644 --- a/form/src/main/java/org/dhis2/form/ui/Form.kt +++ b/form/src/main/java/org/dhis2/form/ui/Form.kt @@ -20,9 +20,6 @@ import androidx.compose.material.Icon import androidx.compose.material.icons.Icons import androidx.compose.material.icons.outlined.ErrorOutline import androidx.compose.runtime.Composable -import androidx.compose.runtime.LaunchedEffect -import androidx.compose.runtime.MutableState -import androidx.compose.runtime.mutableStateOf import androidx.compose.runtime.remember import androidx.compose.runtime.rememberCoroutineScope import androidx.compose.ui.Modifier @@ -31,8 +28,6 @@ import androidx.compose.ui.focus.FocusDirection import androidx.compose.ui.focus.FocusManager import androidx.compose.ui.graphics.Color import androidx.compose.ui.platform.LocalFocusManager -import androidx.compose.ui.unit.dp -import kotlinx.coroutines.CoroutineScope import kotlinx.coroutines.launch import org.dhis2.commons.resources.ResourceManager import org.dhis2.form.R @@ -72,17 +67,16 @@ fun Form( } } } - val focusNext = remember { mutableStateOf(false) } LazyColumn( modifier = Modifier .fillMaxSize() .background( Color.White, shape = RoundedCornerShape( - topStart = 16.dp, - topEnd = 16.dp, - bottomStart = 0.dp, - bottomEnd = 0.dp, + topStart = Spacing.Spacing16, + topEnd = Spacing.Spacing16, + bottomStart = Spacing.Spacing0, + bottomEnd = Spacing.Spacing0, ), ) .clickable( @@ -92,7 +86,7 @@ fun Form( indication = null, onClick = { focusManager.clearFocus() }, ), - contentPadding = PaddingValues(horizontal = 16.dp, vertical = 16.dp), + contentPadding = PaddingValues(horizontal = Spacing.Spacing16, vertical = Spacing.Spacing16), state = scrollState, ) { if (sections.isNotEmpty()) { @@ -144,7 +138,6 @@ fun Form( resources = resources, focusManager = focusManager, onNextClicked = { - focusNext.value = (index == section.fields.size - 1) manageOnNextEvent(focusManager, index, section, onNextSection) }, ) @@ -233,22 +226,6 @@ fun NoFieldsWarning(resources: ResourceManager) { } } -private fun FocusManager.moveFocusNext(focusNext: MutableState) { - if (focusNext.value) { - this.moveFocus(FocusDirection.Next) - focusNext.value = false - } -} - -@Composable -private fun LaunchIfTrue(key: Boolean, block: suspend CoroutineScope.() -> Unit) { - LaunchedEffect(key) { - if (key) { - block() - } - } -} - private fun getNextSection(section: FormSection, sections: List): FormSection? { val currentIndex = sections.indexOf(section) if (currentIndex != -1 && currentIndex < sections.size - 1) {