-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'main' into ANDROAPP-5575-mobile-ui-Create-InputFileReso…
…urce-component
- Loading branch information
Showing
42 changed files
with
1,866 additions
and
195 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
129 changes: 129 additions & 0 deletions
129
common/src/commonMain/kotlin/org/hisp/dhis/common/screens/InputBarCodeScreen.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,129 @@ | ||
package org.hisp.dhis.common.screens | ||
|
||
import androidx.compose.foundation.layout.Arrangement | ||
import androidx.compose.foundation.layout.Row | ||
import androidx.compose.foundation.layout.Spacer | ||
import androidx.compose.foundation.layout.size | ||
import androidx.compose.material.icons.Icons | ||
import androidx.compose.material.icons.outlined.Info | ||
import androidx.compose.material3.Icon | ||
import androidx.compose.runtime.Composable | ||
import androidx.compose.runtime.getValue | ||
import androidx.compose.runtime.mutableStateOf | ||
import androidx.compose.runtime.saveable.rememberSaveable | ||
import androidx.compose.runtime.setValue | ||
import androidx.compose.ui.Modifier | ||
import androidx.compose.ui.platform.testTag | ||
import org.hisp.dhis.common.screens.previews.threeButtonCarousel | ||
import org.hisp.dhis.mobile.ui.designsystem.component.BarcodeBlock | ||
import org.hisp.dhis.mobile.ui.designsystem.component.BottomSheetShell | ||
import org.hisp.dhis.mobile.ui.designsystem.component.ButtonCarousel | ||
import org.hisp.dhis.mobile.ui.designsystem.component.ColumnComponentContainer | ||
import org.hisp.dhis.mobile.ui.designsystem.component.Description | ||
import org.hisp.dhis.mobile.ui.designsystem.component.InputBarCode | ||
import org.hisp.dhis.mobile.ui.designsystem.component.InputShellState | ||
import org.hisp.dhis.mobile.ui.designsystem.component.SupportingTextData | ||
import org.hisp.dhis.mobile.ui.designsystem.component.SupportingTextState | ||
import org.hisp.dhis.mobile.ui.designsystem.resource.provideStringResource | ||
import org.hisp.dhis.mobile.ui.designsystem.theme.Spacing | ||
import org.hisp.dhis.mobile.ui.designsystem.theme.SurfaceColor | ||
import org.hisp.dhis.mobile.ui.designsystem.theme.TextColor | ||
|
||
@Composable | ||
fun InputBarCodeScreen() { | ||
ColumnComponentContainer { | ||
var inputValue1 by rememberSaveable { mutableStateOf("889026a1-d01e-4d34-8209-81e8ed5c614b") } | ||
var showEnabledBarCodeBottomSheet by rememberSaveable { mutableStateOf(false) } | ||
|
||
Description("Default Input Barcode", textColor = TextColor.OnSurfaceVariant) | ||
InputBarCode( | ||
"label", | ||
state = InputShellState.UNFOCUSED, | ||
onActionButtonClicked = { | ||
showEnabledBarCodeBottomSheet = !showEnabledBarCodeBottomSheet | ||
}, | ||
inputText = inputValue1, | ||
onValueChanged = { | ||
if (it != null) { | ||
inputValue1 = it | ||
} | ||
}, | ||
) | ||
|
||
if (showEnabledBarCodeBottomSheet) { | ||
BottomSheetShell( | ||
modifier = Modifier.testTag("LEGEND_BOTTOM_SHEET"), | ||
title = provideStringResource("qr_code"), | ||
icon = { | ||
Icon( | ||
imageVector = Icons.Outlined.Info, | ||
contentDescription = "Button", | ||
tint = SurfaceColor.Primary, | ||
) | ||
}, | ||
content = { | ||
Row(horizontalArrangement = Arrangement.Center) { | ||
BarcodeBlock(data = inputValue1) | ||
} | ||
}, | ||
buttonBlock = { | ||
ButtonCarousel( | ||
carouselButtonList = threeButtonCarousel, | ||
) | ||
}, | ||
) { | ||
showEnabledBarCodeBottomSheet = false | ||
} | ||
} | ||
Spacer(Modifier.size(Spacing.Spacing18)) | ||
|
||
var inputValue2 by rememberSaveable { mutableStateOf("") } | ||
Description("Required field Input Barcode", textColor = TextColor.OnSurfaceVariant) | ||
InputBarCode( | ||
"label", | ||
state = InputShellState.ERROR, | ||
onActionButtonClicked = { | ||
}, | ||
inputText = inputValue2, | ||
onValueChanged = { | ||
if (it != null) { | ||
inputValue2 = it | ||
} | ||
}, | ||
isRequiredField = true, | ||
supportingText = listOf(SupportingTextData("Required", SupportingTextState.ERROR)), | ||
) | ||
|
||
Spacer(Modifier.size(Spacing.Spacing18)) | ||
var inputValue by rememberSaveable { mutableStateOf("") } | ||
Description("Disabled Input Barcode", textColor = TextColor.OnSurfaceVariant) | ||
InputBarCode( | ||
"label", | ||
state = InputShellState.DISABLED, | ||
onActionButtonClicked = { | ||
}, | ||
inputText = inputValue, | ||
onValueChanged = { | ||
if (it != null) { | ||
inputValue = it | ||
} | ||
}, | ||
) | ||
|
||
Spacer(Modifier.size(Spacing.Spacing18)) | ||
var inputValue3 by rememberSaveable { mutableStateOf("889026a1-d01e-4d34-8209-81e8ed5c614b") } | ||
Description("Disabled Input Barcode with content", textColor = TextColor.OnSurfaceVariant) | ||
InputBarCode( | ||
"label", | ||
state = InputShellState.DISABLED, | ||
onActionButtonClicked = { | ||
}, | ||
inputText = inputValue3, | ||
onValueChanged = { | ||
if (it != null) { | ||
inputValue3 = it | ||
} | ||
}, | ||
) | ||
} | ||
} |
81 changes: 81 additions & 0 deletions
81
common/src/commonMain/kotlin/org/hisp/dhis/common/screens/InputDateTimeScreen.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,81 @@ | ||
package org.hisp.dhis.common.screens | ||
|
||
import androidx.compose.runtime.Composable | ||
import androidx.compose.runtime.getValue | ||
import androidx.compose.runtime.mutableStateOf | ||
import androidx.compose.runtime.remember | ||
import androidx.compose.runtime.setValue | ||
import org.hisp.dhis.mobile.ui.designsystem.component.ColumnComponentContainer | ||
import org.hisp.dhis.mobile.ui.designsystem.component.DateTimeActionIconType | ||
import org.hisp.dhis.mobile.ui.designsystem.component.InputDateTime | ||
import org.hisp.dhis.mobile.ui.designsystem.component.InputShellState | ||
import org.hisp.dhis.mobile.ui.designsystem.component.internal.DateTimeTransformation | ||
import org.hisp.dhis.mobile.ui.designsystem.component.internal.DateTransformation | ||
import org.hisp.dhis.mobile.ui.designsystem.component.internal.TimeTransformation | ||
|
||
@Composable | ||
fun InputDateTimeScreen() { | ||
ColumnComponentContainer { | ||
var date by remember { mutableStateOf("") } | ||
var time by remember { mutableStateOf("") } | ||
var dateTime by remember { mutableStateOf("") } | ||
|
||
InputDateTime( | ||
title = "Label", | ||
value = date, | ||
visualTransformation = DateTransformation(), | ||
actionIconType = DateTimeActionIconType.DATE, | ||
onActionClicked = { | ||
// no-op | ||
}, | ||
onValueChanged = { date = it }, | ||
) | ||
|
||
InputDateTime( | ||
title = "Label", | ||
value = time, | ||
visualTransformation = TimeTransformation(), | ||
actionIconType = DateTimeActionIconType.TIME, | ||
onActionClicked = { | ||
// no-op | ||
}, | ||
onValueChanged = { time = it }, | ||
) | ||
|
||
InputDateTime( | ||
title = "Label", | ||
value = dateTime, | ||
visualTransformation = DateTimeTransformation(), | ||
actionIconType = DateTimeActionIconType.DATE_TIME, | ||
onActionClicked = { | ||
// no-op | ||
}, | ||
onValueChanged = { dateTime = it }, | ||
) | ||
|
||
InputDateTime( | ||
title = "Label", | ||
value = "", | ||
state = InputShellState.DISABLED, | ||
onActionClicked = { | ||
// no-op | ||
}, | ||
onValueChanged = { | ||
// no-op | ||
}, | ||
) | ||
|
||
InputDateTime( | ||
title = "Label", | ||
value = "", | ||
isRequired = true, | ||
state = InputShellState.ERROR, | ||
onActionClicked = { | ||
// no-op | ||
}, | ||
onValueChanged = { | ||
// no-op | ||
}, | ||
) | ||
} | ||
} |
Oops, something went wrong.