Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Androapp 6259 mobile UI adapt showcase app for release #280

Merged
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Fix Group components drop down
Siddharth Agarwal committed Jul 23, 2024
commit 0ffaa6356ffbfb27a7ac0247ce5edbc282f6ccff
Original file line number Diff line number Diff line change
@@ -6,8 +6,8 @@ import androidx.compose.runtime.mutableStateOf
import androidx.compose.runtime.remember
import androidx.compose.ui.Modifier
import org.hisp.dhis.common.screens.NoComponentSelectedScreen
import org.hisp.dhis.common.screens.components.GroupComponentDropDown
import org.hisp.dhis.mobile.ui.designsystem.component.DropdownItem
import org.hisp.dhis.mobile.ui.designsystem.component.InputDropDown
import org.hisp.dhis.mobile.ui.designsystem.component.InputShellState
import org.hisp.dhis.mobile.ui.designsystem.theme.Spacing

@@ -21,14 +21,11 @@ fun ActionInputsScreen() {
screenDropdownItemList.add(DropdownItem(it.label))
}
}
InputDropDown(
modifier = Modifier.padding(horizontal = Spacing.Spacing16),
title = "Component",
GroupComponentDropDown(
dropdownItems = screenDropdownItemList.toList(),
onItemSelected = { currentScreen.value = getCurrentScreen(it.label) },
onResetButtonClicked = { currentScreen.value = ActionInputs.NO_COMPONENT_SELECTED },
selectedItem = DropdownItem(currentScreen.value.label),
state = InputShellState.UNFOCUSED,
)
when (currentScreen.value) {
ActionInputs.INPUT_QR_CODE -> InputQRCodeScreen()
Original file line number Diff line number Diff line change
@@ -4,27 +4,24 @@ import androidx.compose.runtime.Composable
import androidx.compose.runtime.mutableStateOf
import androidx.compose.runtime.remember
import org.hisp.dhis.common.screens.NoComponentSelectedScreen
import org.hisp.dhis.common.screens.components.GroupComponentDropDown
import org.hisp.dhis.mobile.ui.designsystem.component.DropdownItem
import org.hisp.dhis.mobile.ui.designsystem.component.InputDropDown
import org.hisp.dhis.mobile.ui.designsystem.component.InputShellState

@Composable
fun BasicTextInputsScreen() {
val currentScreen = remember { mutableStateOf(BasicTextInputs.INPUT_TEXT) }
val currentScreen = remember { mutableStateOf(BasicTextInputs.NO_COMPONENT_SELECTED) }

val screenDropdownItemList = mutableListOf<DropdownItem>()
BasicTextInputs.entries.forEach {
if (it != BasicTextInputs.NO_COMPONENT_SELECTED) {
screenDropdownItemList.add(DropdownItem(it.label))
}
}
InputDropDown(
"Display",
GroupComponentDropDown(
dropdownItems = screenDropdownItemList.toList(),
onItemSelected = { currentScreen.value = getCurrentScreen(it.label) },
onResetButtonClicked = { currentScreen.value = BasicTextInputs.NO_COMPONENT_SELECTED },
selectedItem = DropdownItem(currentScreen.value.label),
state = InputShellState.UNFOCUSED,
)
when (currentScreen.value) {
BasicTextInputs.FORM_SHELLS -> FormShellsScreen()
Original file line number Diff line number Diff line change
@@ -4,27 +4,24 @@ import androidx.compose.runtime.Composable
import androidx.compose.runtime.mutableStateOf
import androidx.compose.runtime.remember
import org.hisp.dhis.common.screens.NoComponentSelectedScreen
import org.hisp.dhis.common.screens.components.GroupComponentDropDown
import org.hisp.dhis.mobile.ui.designsystem.component.DropdownItem
import org.hisp.dhis.mobile.ui.designsystem.component.InputDropDown
import org.hisp.dhis.mobile.ui.designsystem.component.InputShellState

@Composable
fun BottomSheetsScreen() {
val currentScreen = remember { mutableStateOf(BottomSheets.BOTTOM_SHEET) }
val currentScreen = remember { mutableStateOf(BottomSheets.NO_COMPONENT_SELECTED) }

val screenDropdownItemList = mutableListOf<DropdownItem>()
BottomSheets.entries.forEach {
if (it != BottomSheets.BOTTOM_SHEET) {
screenDropdownItemList.add(DropdownItem(it.label))
}
}
InputDropDown(
"Display",
GroupComponentDropDown(
dropdownItems = screenDropdownItemList.toList(),
onItemSelected = { currentScreen.value = getCurrentScreen(it.label) },
onResetButtonClicked = { currentScreen.value = BottomSheets.NO_COMPONENT_SELECTED },
selectedItem = DropdownItem(currentScreen.value.label),
state = InputShellState.UNFOCUSED,
)
when (currentScreen.value) {
BottomSheets.BOTTOM_SHEET -> BottomSheetScreen()
Original file line number Diff line number Diff line change
@@ -4,27 +4,24 @@ import androidx.compose.runtime.Composable
import androidx.compose.runtime.mutableStateOf
import androidx.compose.runtime.remember
import org.hisp.dhis.common.screens.NoComponentSelectedScreen
import org.hisp.dhis.common.screens.components.GroupComponentDropDown
import org.hisp.dhis.mobile.ui.designsystem.component.DropdownItem
import org.hisp.dhis.mobile.ui.designsystem.component.InputDropDown
import org.hisp.dhis.mobile.ui.designsystem.component.InputShellState

@Composable
fun ButtonsScreen() {
val currentScreen = remember { mutableStateOf(ButtonScreens.BUTTON) }
val currentScreen = remember { mutableStateOf(ButtonScreens.NO_COMPONENT_SELECTED) }

val screenDropdownItemList = mutableListOf<DropdownItem>()
ButtonScreens.entries.forEach {
if (it != ButtonScreens.NO_COMPONENT_SELECTED) {
screenDropdownItemList.add(DropdownItem(it.label))
}
}
InputDropDown(
"Display",
GroupComponentDropDown(
dropdownItems = screenDropdownItemList.toList(),
onItemSelected = { currentScreen.value = getCurrentScreen(it.label) },
onResetButtonClicked = { currentScreen.value = ButtonScreens.NO_COMPONENT_SELECTED },
selectedItem = DropdownItem(currentScreen.value.label),
state = InputShellState.UNFOCUSED,
)
when (currentScreen.value) {
ButtonScreens.BUTTON -> ButtonScreen()
Original file line number Diff line number Diff line change
@@ -4,27 +4,24 @@ import androidx.compose.runtime.Composable
import androidx.compose.runtime.mutableStateOf
import androidx.compose.runtime.remember
import org.hisp.dhis.common.screens.NoComponentSelectedScreen
import org.hisp.dhis.common.screens.components.GroupComponentDropDown
import org.hisp.dhis.mobile.ui.designsystem.component.DropdownItem
import org.hisp.dhis.mobile.ui.designsystem.component.InputDropDown
import org.hisp.dhis.mobile.ui.designsystem.component.InputShellState

@Composable
fun CardsScreen() {
val currentScreen = remember { mutableStateOf(Cards.CARD_DETAIL) }
val currentScreen = remember { mutableStateOf(Cards.NO_COMPONENT_SELECTED) }

val screenDropdownItemList = mutableListOf<DropdownItem>()
Cards.entries.forEach {
if (it != Cards.NO_COMPONENT_SELECTED) {
screenDropdownItemList.add(DropdownItem(it.label))
}
}
InputDropDown(
"Display",
GroupComponentDropDown(
dropdownItems = screenDropdownItemList.toList(),
onItemSelected = { currentScreen.value = getCurrentScreen(it.label) },
onResetButtonClicked = { currentScreen.value = Cards.NO_COMPONENT_SELECTED },
selectedItem = DropdownItem(currentScreen.value.label),
state = InputShellState.UNFOCUSED,
)
when (currentScreen.value) {
Cards.CARD_DETAIL -> CardDetailScreen()
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
package org.hisp.dhis.common.screens.components

import androidx.compose.foundation.layout.padding
import androidx.compose.runtime.Composable
import androidx.compose.ui.Modifier
import org.hisp.dhis.mobile.ui.designsystem.component.DropdownItem
import org.hisp.dhis.mobile.ui.designsystem.component.InputDropDown
import org.hisp.dhis.mobile.ui.designsystem.component.InputShellState
import org.hisp.dhis.mobile.ui.designsystem.theme.Spacing

@Composable
fun GroupComponentDropDown(
modifier: Modifier = Modifier,
dropdownItems: List<DropdownItem>,
onItemSelected: (DropdownItem) -> Unit,
onResetButtonClicked: () -> Unit,
selectedItem: DropdownItem? = null,
) {
InputDropDown(
modifier = modifier.padding(horizontal = Spacing.Spacing16),
title = "Component",
dropdownItems = dropdownItems,
onItemSelected = onItemSelected,
onResetButtonClicked = onResetButtonClicked,
selectedItem = selectedItem,
state = InputShellState.UNFOCUSED,
)
}
Original file line number Diff line number Diff line change
@@ -5,27 +5,24 @@ import androidx.compose.runtime.mutableStateOf
import androidx.compose.runtime.remember
import androidx.compose.ui.graphics.ImageBitmap
import org.hisp.dhis.common.screens.NoComponentSelectedScreen
import org.hisp.dhis.common.screens.components.GroupComponentDropDown
import org.hisp.dhis.mobile.ui.designsystem.component.DropdownItem
import org.hisp.dhis.mobile.ui.designsystem.component.InputDropDown
import org.hisp.dhis.mobile.ui.designsystem.component.InputShellState

@Composable
fun ToggleableInputsScreen(imageBitmapLoader: (() -> ImageBitmap)?) {
val currentScreen = remember { mutableStateOf(ToggleableInputs.INPUT_RADIO_BUTTON) }
val currentScreen = remember { mutableStateOf(ToggleableInputs.NO_COMPONENT_SELECTED) }

val screenDropdownItemList = mutableListOf<DropdownItem>()
ToggleableInputs.entries.forEach {
if (it != ToggleableInputs.NO_COMPONENT_SELECTED) {
screenDropdownItemList.add(DropdownItem(it.label))
}
}
InputDropDown(
"Display",
GroupComponentDropDown(
dropdownItems = screenDropdownItemList.toList(),
onItemSelected = { currentScreen.value = getCurrentScreen(it.label) },
onResetButtonClicked = { currentScreen.value = ToggleableInputs.NO_COMPONENT_SELECTED },
selectedItem = DropdownItem(currentScreen.value.label),
state = InputShellState.UNFOCUSED,
)
when (currentScreen.value) {
ToggleableInputs.INPUT_RADIO_BUTTON -> InputRadioButtonScreen()