Skip to content

Commit

Permalink
fix: [ANDROAPP-6137] femove unused methods and variable
Browse files Browse the repository at this point in the history
  • Loading branch information
xavimolloy committed May 29, 2024
1 parent d54faec commit a74e61e
Showing 1 changed file with 5 additions and 28 deletions.
33 changes: 5 additions & 28 deletions form/src/main/java/org/dhis2/form/ui/Form.kt
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand Down Expand Up @@ -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(
Expand All @@ -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()) {
Expand Down Expand Up @@ -144,7 +138,6 @@ fun Form(
resources = resources,
focusManager = focusManager,
onNextClicked = {
focusNext.value = (index == section.fields.size - 1)
manageOnNextEvent(focusManager, index, section, onNextSection)
},
)
Expand Down Expand Up @@ -233,22 +226,6 @@ fun NoFieldsWarning(resources: ResourceManager) {
}
}

private fun FocusManager.moveFocusNext(focusNext: MutableState<Boolean>) {
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>): FormSection? {
val currentIndex = sections.indexOf(section)
if (currentIndex != -1 && currentIndex < sections.size - 1) {
Expand Down

0 comments on commit a74e61e

Please sign in to comment.