From b61ce4a67b239adc6e4583042db01d686a76385d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andr=C3=A9s=20Miguel=20Rubio?= Date: Thu, 8 Feb 2024 11:25:13 +0100 Subject: [PATCH] update version code (#191) * update version code * downgrade AGP to 8.2.0 --- android/build.gradle.kts | 2 - .../parameter/ParameterSelectorScreen.kt | 179 ++++++------------ designsystem/build.gradle.kts | 2 +- .../component/parameter/ParameterSelector.kt | 7 +- .../model/ParameterSelectorItemModel.kt | 4 +- gradle.properties | 2 +- 6 files changed, 68 insertions(+), 128 deletions(-) diff --git a/android/build.gradle.kts b/android/build.gradle.kts index 05a28ff72..9167d9999 100644 --- a/android/build.gradle.kts +++ b/android/build.gradle.kts @@ -24,8 +24,6 @@ android { applicationId = "org.hisp.dhis.android" minSdk = (findProperty("android.minSdk") as String).toInt() targetSdk = (findProperty("android.targetSdk") as String).toInt() - versionCode = 1 - versionName = "1.0.1-SNAPSHOT" } compileOptions { sourceCompatibility = JavaVersion.VERSION_17 diff --git a/common/src/commonMain/kotlin/org/hisp/dhis/common/screens/parameter/ParameterSelectorScreen.kt b/common/src/commonMain/kotlin/org/hisp/dhis/common/screens/parameter/ParameterSelectorScreen.kt index 18c9a1e3f..ef054e05f 100644 --- a/common/src/commonMain/kotlin/org/hisp/dhis/common/screens/parameter/ParameterSelectorScreen.kt +++ b/common/src/commonMain/kotlin/org/hisp/dhis/common/screens/parameter/ParameterSelectorScreen.kt @@ -32,81 +32,90 @@ import org.hisp.dhis.mobile.ui.designsystem.component.InputOrgUnit import org.hisp.dhis.mobile.ui.designsystem.component.InputPhoneNumber import org.hisp.dhis.mobile.ui.designsystem.component.InputQRCode import org.hisp.dhis.mobile.ui.designsystem.component.InputRadioButton -import org.hisp.dhis.mobile.ui.designsystem.component.InputSequential import org.hisp.dhis.mobile.ui.designsystem.component.InputShellState import org.hisp.dhis.mobile.ui.designsystem.component.InputStyle import org.hisp.dhis.mobile.ui.designsystem.component.InputText -import org.hisp.dhis.mobile.ui.designsystem.component.InputYesNoField -import org.hisp.dhis.mobile.ui.designsystem.component.InputYesOnlyCheckBox -import org.hisp.dhis.mobile.ui.designsystem.component.InputYesOnlySwitch import org.hisp.dhis.mobile.ui.designsystem.component.RadioButtonData import org.hisp.dhis.mobile.ui.designsystem.component.internal.IconCardData import org.hisp.dhis.mobile.ui.designsystem.component.parameter.ParameterSelectorItem import org.hisp.dhis.mobile.ui.designsystem.component.parameter.model.ParameterSelectorItemModel import org.hisp.dhis.mobile.ui.designsystem.component.parameter.model.ParameterSelectorItemModel.Status.CLOSED -import org.hisp.dhis.mobile.ui.designsystem.component.parameter.model.ParameterSelectorItemModel.Status.OPENED +import org.hisp.dhis.mobile.ui.designsystem.component.parameter.model.ParameterSelectorItemModel.Status.FOCUSED +import org.hisp.dhis.mobile.ui.designsystem.component.parameter.model.ParameterSelectorItemModel.Status.UNFOCUSED @Composable fun ParameterSelectorScreen() { var inputTextValue by rememberSaveable(stateSaver = TextFieldValue.Saver) { mutableStateOf(TextFieldValue("")) } - var ageInputType by remember { - mutableStateOf(AgeInputType.None) - } - var inputBarcodeValue by rememberSaveable(stateSaver = TextFieldValue.Saver) { + var inputTextStatus by remember(inputTextValue.text) { mutableStateOf( - TextFieldValue("889026a1-d01e-4d34-8209-81e8ed5c614b"), + if (inputTextValue.text.isEmpty()) { + CLOSED + } else { + UNFOCUSED + }, ) } + var inputQRCodeValue by rememberSaveable(stateSaver = TextFieldValue.Saver) { mutableStateOf( TextFieldValue("889026a1-d01e-4d34-8209-81e8ed5c614b"), ) } - var checkBoxSelected: Boolean by remember { mutableStateOf(false) } + var inputQRStatus by remember(inputQRCodeValue.text) { + mutableStateOf( + if (inputQRCodeValue.text.isEmpty()) { + CLOSED + } else { + UNFOCUSED + }, + ) + } + + var ageInputType by remember { + mutableStateOf(AgeInputType.None) + } val items = listOf( ParameterSelectorItemModel( - icon = Icons.Outlined.QrCode2, - label = "QRCode parameter", + label = "Text parameter", helper = "Optional", inputField = { - InputQRCode( - title = "QRCode parameter", + InputText( + title = "Text parameter", state = InputShellState.UNFOCUSED, - inputTextFieldValue = inputQRCodeValue, + inputTextFieldValue = inputTextValue, inputStyle = InputStyle.ParameterInputStyle(), - onQRButtonClicked = {}, onValueChanged = { - inputQRCodeValue = it ?: TextFieldValue() + inputTextValue = it ?: TextFieldValue() }, ) }, - status = if (inputQRCodeValue.text.isEmpty()) { - CLOSED - } else { - OPENED + status = inputTextStatus, + onExpand = { + inputTextStatus = FOCUSED }, ), ParameterSelectorItemModel( - label = "Text parameter", + icon = Icons.Outlined.QrCode2, + label = "QRCode parameter", helper = "Optional", inputField = { - InputText( - title = "Text parameter", + InputQRCode( + title = "QRCode parameter", state = InputShellState.UNFOCUSED, - inputTextFieldValue = inputTextValue, + inputTextFieldValue = inputQRCodeValue, inputStyle = InputStyle.ParameterInputStyle(), + onQRButtonClicked = {}, onValueChanged = { - inputTextValue = it ?: TextFieldValue() + inputQRCodeValue = it ?: TextFieldValue() }, ) }, - status = if (inputTextValue.text.isEmpty()) { - CLOSED - } else { - OPENED + status = inputQRStatus, + onExpand = { + inputQRStatus = FOCUSED }, ), ParameterSelectorItemModel( @@ -125,8 +134,9 @@ fun ParameterSelectorScreen() { }, status = when (ageInputType) { AgeInputType.None -> CLOSED - else -> OPENED + else -> UNFOCUSED }, + onExpand = {}, ), ParameterSelectorItemModel( label = "Barcode parameter", @@ -134,19 +144,13 @@ fun ParameterSelectorScreen() { inputField = { InputBarCode( title = "Barcode parameter", - inputTextFieldValue = inputBarcodeValue, + inputTextFieldValue = TextFieldValue("12345678900"), inputStyle = InputStyle.ParameterInputStyle(), onActionButtonClicked = {}, - onValueChanged = { - inputBarcodeValue = it ?: TextFieldValue() - }, + onValueChanged = {}, ) }, - status = if (inputBarcodeValue.text.isEmpty()) { - CLOSED - } else { - OPENED - }, + onExpand = {}, ), ParameterSelectorItemModel( label = "CheckBox parameter", @@ -170,19 +174,11 @@ fun ParameterSelectorScreen() { textInput = "option 2", ), ), - onClearSelection = { - checkBoxSelected = false - }, - onItemChange = { - checkBoxSelected = true - }, + onClearSelection = {}, + onItemChange = {}, ) }, - status = if (checkBoxSelected) { - OPENED - } else { - CLOSED - }, + onExpand = {}, ), ParameterSelectorItemModel( label = "DateTime parameter", @@ -196,6 +192,7 @@ fun ParameterSelectorScreen() { onValueChanged = {}, ) }, + onExpand = {}, ), ParameterSelectorItemModel( label = "DropDown parameter", @@ -213,6 +210,7 @@ fun ParameterSelectorScreen() { onResetButtonClicked = {}, ) }, + onExpand = {}, ), ParameterSelectorItemModel( label = "Email parameter", @@ -226,6 +224,7 @@ fun ParameterSelectorScreen() { onEmailActionCLicked = {}, ) }, + onExpand = {}, ), ParameterSelectorItemModel( label = "Link parameter", @@ -239,6 +238,7 @@ fun ParameterSelectorScreen() { onLinkActionCLicked = {}, ) }, + onExpand = {}, ), ParameterSelectorItemModel( label = "Integer parameter", @@ -251,6 +251,7 @@ fun ParameterSelectorScreen() { inputStyle = InputStyle.ParameterInputStyle(), ) }, + onExpand = {}, ), ParameterSelectorItemModel( label = "Long text parameter", @@ -263,6 +264,7 @@ fun ParameterSelectorScreen() { inputStyle = InputStyle.ParameterInputStyle(), ) }, + onExpand = {}, ), ParameterSelectorItemModel( label = "Matrix parameter", @@ -289,6 +291,7 @@ fun ParameterSelectorScreen() { onSelectionChanged = {}, ) }, + onExpand = {}, ), ParameterSelectorItemModel( label = "Not supported parameter", @@ -300,6 +303,7 @@ fun ParameterSelectorScreen() { inputStyle = InputStyle.ParameterInputStyle(), ) }, + onExpand = {}, ), ParameterSelectorItemModel( label = "Org unit parameter", @@ -311,6 +315,7 @@ fun ParameterSelectorScreen() { onOrgUnitActionCLicked = {}, ) }, + onExpand = {}, ), ParameterSelectorItemModel( label = "Phone number parameter", @@ -324,6 +329,7 @@ fun ParameterSelectorScreen() { onCallActionClicked = {}, ) }, + onExpand = {}, ), ParameterSelectorItemModel( label = "Radio button parameter", @@ -350,74 +356,7 @@ fun ParameterSelectorScreen() { onItemChange = {}, ) }, - ), - ParameterSelectorItemModel( - label = "Sequential parameter", - helper = "Optional", - inputField = { - InputSequential( - title = "Sequential parameter", - state = InputShellState.UNFOCUSED, - inputStyle = InputStyle.ParameterInputStyle(), - data = listOf( - IconCardData( - uid = "7e0cb105-c276-4f12-9f56-a26af8314121", - label = "Stethoscope", - iconRes = "dhis2_stethoscope_positive", - iconTint = Color(0xFFFF8400), - ), - IconCardData( - uid = "72269f6b-6b99-4d2e-a667-09f20c2097e0", - label = "Medicines", - iconRes = "dhis2_medicines_positive", - iconTint = Color(0xFFEB0085), - ), - ), - onSelectionChanged = {}, - ) - }, - ), - ParameterSelectorItemModel( - label = "Yes No parameter", - helper = "Optional", - inputField = { - InputYesNoField( - title = "Yes No parameter", - state = InputShellState.UNFOCUSED, - inputStyle = InputStyle.ParameterInputStyle(), - onItemChange = {}, - ) - }, - ), - ParameterSelectorItemModel( - label = "Yes only check box parameter", - helper = "Optional", - inputField = { - InputYesOnlyCheckBox( - state = InputShellState.UNFOCUSED, - inputStyle = InputStyle.ParameterInputStyle(), - checkBoxData = CheckBoxData( - uid = "uid1", - checked = true, - enabled = true, - textInput = "option 1", - ), - onClick = {}, - ) - }, - ), - ParameterSelectorItemModel( - label = "Yes only switch parameter", - helper = "Optional", - inputField = { - InputYesOnlySwitch( - title = "Yes only switch parameter", - state = InputShellState.UNFOCUSED, - inputStyle = InputStyle.ParameterInputStyle(), - isChecked = true, - onClick = {}, - ) - }, + onExpand = {}, ), ) diff --git a/designsystem/build.gradle.kts b/designsystem/build.gradle.kts index 7771229e8..eceb35a1b 100644 --- a/designsystem/build.gradle.kts +++ b/designsystem/build.gradle.kts @@ -1,5 +1,5 @@ group = "org.hisp.dhis.mobile" -version = "1.0.1-SNAPSHOT" +version = "0.2-SNAPSHOT" plugins { kotlin("multiplatform") diff --git a/designsystem/src/commonMain/kotlin/org/hisp/dhis/mobile/ui/designsystem/component/parameter/ParameterSelector.kt b/designsystem/src/commonMain/kotlin/org/hisp/dhis/mobile/ui/designsystem/component/parameter/ParameterSelector.kt index f478f205e..f009ef652 100644 --- a/designsystem/src/commonMain/kotlin/org/hisp/dhis/mobile/ui/designsystem/component/parameter/ParameterSelector.kt +++ b/designsystem/src/commonMain/kotlin/org/hisp/dhis/mobile/ui/designsystem/component/parameter/ParameterSelector.kt @@ -32,7 +32,7 @@ import androidx.compose.ui.semantics.Role import org.hisp.dhis.mobile.ui.designsystem.component.IconButton import org.hisp.dhis.mobile.ui.designsystem.component.parameter.model.ParameterSelectorItemModel import org.hisp.dhis.mobile.ui.designsystem.component.parameter.model.ParameterSelectorItemModel.Status.CLOSED -import org.hisp.dhis.mobile.ui.designsystem.component.parameter.model.ParameterSelectorItemModel.Status.OPENED +import org.hisp.dhis.mobile.ui.designsystem.component.parameter.model.ParameterSelectorItemModel.Status.FOCUSED import org.hisp.dhis.mobile.ui.designsystem.theme.Border import org.hisp.dhis.mobile.ui.designsystem.theme.Spacing import org.hisp.dhis.mobile.ui.designsystem.theme.SurfaceColor @@ -53,12 +53,13 @@ fun ParameterSelectorItem( EmptyParameterField( model = model, ) { - status = OPENED + status = FOCUSED + model.onExpand() } } AnimatedVisibility( - visible = status == OPENED, + visible = status != CLOSED, enter = fadeIn() + expandVertically(), exit = shrinkVertically() + fadeOut(), ) { diff --git a/designsystem/src/commonMain/kotlin/org/hisp/dhis/mobile/ui/designsystem/component/parameter/model/ParameterSelectorItemModel.kt b/designsystem/src/commonMain/kotlin/org/hisp/dhis/mobile/ui/designsystem/component/parameter/model/ParameterSelectorItemModel.kt index 9ba9e7f0a..8370ecbd0 100644 --- a/designsystem/src/commonMain/kotlin/org/hisp/dhis/mobile/ui/designsystem/component/parameter/model/ParameterSelectorItemModel.kt +++ b/designsystem/src/commonMain/kotlin/org/hisp/dhis/mobile/ui/designsystem/component/parameter/model/ParameterSelectorItemModel.kt @@ -11,9 +11,11 @@ data class ParameterSelectorItemModel( val helper: String, val inputField: @Composable () -> Unit, val status: Status = Status.CLOSED, + val onExpand: () -> Unit, ) { enum class Status { - OPENED, + FOCUSED, + UNFOCUSED, CLOSED, } } diff --git a/gradle.properties b/gradle.properties index 211a6361a..5e7a93fe7 100644 --- a/gradle.properties +++ b/gradle.properties @@ -22,5 +22,5 @@ android.minSdk=21 #Versions kotlin.version=1.9.22 -agp.version=8.2.2 +agp.version=8.2.0 compose.version=1.5.12 \ No newline at end of file