Skip to content

Commit

Permalink
Update develop with main (#140)
Browse files Browse the repository at this point in the history
* Add fixed size for key parameter in KeyValue component for list card and card detail (#122)

* ANDROAPP-5557-mobile-ui-Create-Custom-shadow-for-scroll-behavior-in-BottomSheetShell-component (#120)

* Center align buttons vertically in `ButtonBlock`

* Show bottom shadow if the content is scrollable

* Remove default padding in `ButtonBlock`

* Update spacing in `BottomSheet`

* Update bottom sheet shadow specs

* Run code format

* ANDROAPP-5650-mobile-ui-Rectify-Input-Signature-and-Image-button-component-height (#121)

* update: [ANDROAPP-5650] height fixed, button height matches with progress indicator

* update: [ANDROAPP-5650] code formatted

* [ANDROAPP-5668] update compose version to 1.5.10-rc02 (#123)

* fix: [ANDROAPP-5550] longtext bottom line (#124)

* Add `InputNotSupported` component (#129)

* [ANDROAPP-5679] Modify style for auto complete dropdown items (#126)

* ANDROAPP-5692-mobile-ui-Add-onImageClick-callback-to-ImageBlock-component (#128)

* [ANDROAPP-5692] add clickable event and parameter to Input Image and Input Signature

* Fix tests

* add focus request on click events

* ktlint fix

* [ANDROAPP-5682] add DataMatrix support for QR Code generator, fix BottomSheetShell title and content visibility (#125)

* [ANDROAPP-5718] Update compose to 1.5.10 (#133)

* [ANDROAPP-5678] Refactor Additional Info column in Card detail and correct spacing (#127)

* ANDROAPP-5684-mobile-ui-legend-component-info-icon-visibility (#131)

* Hide legend info icon when there is no popup description data

* Disable click when legend doesn't contain popup description data

* Fix broken tests

* Add test for legend click action

* Request focus when input shell is tapped (#130)

* fix: [ANDROAPP-5596] form fields spacing (#135)

* [ANDROAPP-5720] correct supporting text padding for input age and input date time (#137)

* update: [ANDROAPP-5705] chip text color modified (#134)

---------

Co-authored-by: Sasikanth Miriyampalli <[email protected]>
Co-authored-by: DavidAparicioAlbaAsenjo <[email protected]>
Co-authored-by: Andrés Miguel Rubio <[email protected]>
Co-authored-by: Manu Muñoz <[email protected]>
  • Loading branch information
5 people authored Nov 6, 2023
1 parent fef6b4f commit 1038305
Show file tree
Hide file tree
Showing 59 changed files with 423 additions and 157 deletions.
2 changes: 2 additions & 0 deletions common/src/commonMain/kotlin/org/hisp/dhis/common/App.kt
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@ import org.hisp.dhis.common.screens.InputLinkScreen
import org.hisp.dhis.common.screens.InputLongTextScreen
import org.hisp.dhis.common.screens.InputMatrixScreen
import org.hisp.dhis.common.screens.InputNegativeIntegerScreen
import org.hisp.dhis.common.screens.InputNotSupportedScreen
import org.hisp.dhis.common.screens.InputNumberScreen
import org.hisp.dhis.common.screens.InputOrgUnitScreen
import org.hisp.dhis.common.screens.InputPercentageScreen
Expand Down Expand Up @@ -191,6 +192,7 @@ fun Main() {
Components.INPUT_SIGNATURE -> InputSignatureScreen()
Components.INPUT_UNIT_INTERVAL -> InputUnitIntervalScreen()
Components.INPUT_IMAGE -> InputImageScreen()
Components.INPUT_NOT_SUPPORTED -> InputNotSupportedScreen()
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -56,4 +56,5 @@ enum class Components(val label: String) {
INPUT_SIGNATURE("Input Signature"),
INPUT_UNIT_INTERVAL("Input Unit Interval"),
INPUT_IMAGE("Input Image"),
INPUT_NOT_SUPPORTED("Input Not Supported"),
}
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ fun ImageBlockScreen() {
load = { sampleImage },
painterFor = { remember { it } },
onClick = {},
onImageClick = {},
)
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@ fun InputImageScreen() {
uploadState = UploadState.LOADED
}
},
onImageClick = {},
)
Spacer(Modifier.size(Spacing.Spacing18))

Expand All @@ -60,6 +61,7 @@ fun InputImageScreen() {
onDownloadButtonClick = {},
onResetButtonClicked = {},
onAddButtonClicked = {},
onImageClick = {},
)
Spacer(Modifier.size(Spacing.Spacing18))

Expand All @@ -75,6 +77,7 @@ fun InputImageScreen() {
onDownloadButtonClick = {},
onResetButtonClicked = { },
onAddButtonClicked = {},
onImageClick = {},
)
}
}
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
package org.hisp.dhis.common.screens

import androidx.compose.runtime.Composable
import org.hisp.dhis.mobile.ui.designsystem.component.ColumnComponentContainer
import org.hisp.dhis.mobile.ui.designsystem.component.InputNotSupported

@Composable
fun InputNotSupportedScreen() {
ColumnComponentContainer {
InputNotSupported(title = "Label")
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@ fun InputSignatureScreen() {
uploadState = UploadState.LOADED
}
},
onImageClick = {},
)
Spacer(Modifier.size(Spacing.Spacing18))

Expand All @@ -60,6 +61,7 @@ fun InputSignatureScreen() {
onDownloadButtonClick = {},
onResetButtonClicked = {},
onAddButtonClicked = {},
onImageClick = {},
)
Spacer(Modifier.size(Spacing.Spacing18))

Expand All @@ -75,6 +77,7 @@ fun InputSignatureScreen() {
onDownloadButtonClick = {},
onResetButtonClicked = { },
onAddButtonClicked = {},
onImageClick = {},
)
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import androidx.compose.ui.Modifier
import org.hisp.dhis.mobile.ui.designsystem.component.ColumnComponentContainer
import org.hisp.dhis.mobile.ui.designsystem.component.Legend
import org.hisp.dhis.mobile.ui.designsystem.component.LegendData
import org.hisp.dhis.mobile.ui.designsystem.component.LegendDescriptionData
import org.hisp.dhis.mobile.ui.designsystem.component.SubTitle
import org.hisp.dhis.mobile.ui.designsystem.theme.Spacing
import org.hisp.dhis.mobile.ui.designsystem.theme.SurfaceColor
Expand All @@ -33,5 +34,25 @@ fun LegendScreen() {
" consectetur adipiscing elit. Maecenas dolor lacus,",
),
)

SubTitle("Legend with popup description")
Legend(
LegendData(
color = SurfaceColor.CustomGreen,
title = "Legend with popup",
popUpLegendDescriptionData = listOf(
LegendDescriptionData(
color = SurfaceColor.CustomGreen,
text = "Item 1",
range = 0..300,
),
LegendDescriptionData(
color = SurfaceColor.CustomGreen,
text = "Item 2",
range = 301..600,
),
),
),
)
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -74,12 +74,7 @@ fun ListCardScreen() {
)

CardDetail(
avatar = {
Avatar(
imagePainter = provideDHIS2Icon("dhis2_microscope_outline"),
style = AvatarStyle.IMAGE,
)
},
avatar = null,
title = "Narayan Khanna, M, 32",
additionalInfoList = teiDetailList,
expandLabelText = "Show more",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ val enrollmentCompletedList = listOf(
AdditionalInfoItem(key = "Address:", value = "134 Main Road, Behind the temple, Citytown, Basil District, Granite State"),
AdditionalInfoItem(key = "Enrolled in:", value = "12/12/1945"),
AdditionalInfoItem(
key = "Programs:",
key = lorem,
value = "Tuberculosis, Nutrition \n" +
"Assistance Program, Malaria Diagnosis",
),
Expand Down Expand Up @@ -60,7 +60,7 @@ val teiDetailList = listOf(
AdditionalInfoItem(key = "Address:", value = "134 Main Road, Behind the temple, Citytown, Basil District, Granite State"),
AdditionalInfoItem(key = "Enrolled in:", value = "PHC Blueberry"),
AdditionalInfoItem(
key = "Programs:",
key = lorem,
value = "Tuberculosis, Nutrition," +
"Assistance Program, Malaria Diagnosis",
action = {},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,15 +9,16 @@ import com.google.zxing.EncodeHintType
import com.google.zxing.MultiFormatWriter
import com.google.zxing.WriterException
import com.google.zxing.common.BitMatrix
import com.google.zxing.datamatrix.DataMatrixWriter

internal actual class QrCodeGenerator {

actual fun generate(data: String): ImageBitmap? {
actual fun generate(data: String, isDataMatrix: Boolean): ImageBitmap? {
return try {
val writer = MultiFormatWriter()
val writer = if (!isDataMatrix) MultiFormatWriter() else DataMatrixWriter()
val bitMatrix = writer.encode(
data,
BarcodeFormat.QR_CODE,
if (isDataMatrix) BarcodeFormat.DATA_MATRIX else BarcodeFormat.QR_CODE,
QR_CODE_SIZE,
QR_CODE_SIZE,
mapOf(Pair(EncodeHintType.MARGIN, 1)),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,11 @@ import androidx.compose.material.icons.Icons
import androidx.compose.material.icons.outlined.Cancel
import androidx.compose.material3.Icon
import androidx.compose.runtime.Composable
import androidx.compose.runtime.remember
import androidx.compose.ui.Alignment
import androidx.compose.ui.Modifier
import androidx.compose.ui.focus.FocusRequester
import androidx.compose.ui.focus.focusRequester
import androidx.compose.ui.graphics.painter.Painter
import androidx.compose.ui.graphics.vector.ImageVector
import androidx.compose.ui.platform.testTag
Expand Down Expand Up @@ -56,11 +59,14 @@ internal fun <T> BasicInputImage(
addButtonIcon: ImageVector,
modifier: Modifier = Modifier,
onDownloadButtonClick: () -> Unit,
onImageClick: () -> Unit,
onResetButtonClicked: () -> Unit,
onAddButtonClicked: () -> Unit,
) {
val focusRequester = remember { FocusRequester() }

InputShell(
modifier = modifier.testTag("INPUT_$testTag"),
modifier = modifier.testTag("INPUT_$testTag").focusRequester(focusRequester),
title = title,
state = state,
isRequiredField = isRequired,
Expand All @@ -81,35 +87,39 @@ internal fun <T> BasicInputImage(
inputField = {
when (uploadState) {
UploadState.ADD -> {
Button(
enabled = state != InputShellState.DISABLED,
style = ButtonStyle.KEYBOARDKEY,
text = addButtonText,
icon = {
Icon(
imageVector = addButtonIcon,
contentDescription = "Icon Button",
tint = if (state != InputShellState.DISABLED) SurfaceColor.Primary else TextColor.OnDisabledSurface,
)
ButtonBlock(
primaryButton = {
Button(
enabled = state != InputShellState.DISABLED,
style = ButtonStyle.KEYBOARDKEY,
text = addButtonText,
icon = {
Icon(
imageVector = addButtonIcon,
contentDescription = "Icon Button",
tint = if (state != InputShellState.DISABLED) SurfaceColor.Primary else TextColor.OnDisabledSurface,
)
},
modifier = Modifier
.fillMaxWidth()
.padding(end = Spacing.Spacing16)
.testTag("INPUT_" + testTag + "_ADD_BUTTON"),
) {
onAddButtonClicked.invoke()
focusRequester.requestFocus()
}
},
modifier = Modifier
.fillMaxWidth()
.padding(end = Spacing.Spacing12, top = Spacing.Spacing8, bottom = Spacing.Spacing8)
.testTag("INPUT_" + testTag + "_ADD_BUTTON"),
) {
onAddButtonClicked.invoke()
}
)
}

UploadState.UPLOADING -> {
Row(
modifier = Modifier
.fillMaxWidth()
.padding(vertical = Spacing.Spacing4),
.fillMaxWidth(),
horizontalArrangement = Arrangement.Center,
) {
Box(
modifier = Modifier.size(InternalSizeValues.Size48),
modifier = Modifier.padding(top = Spacing.Spacing8, bottom = Spacing.Spacing8).size(InternalSizeValues.Size48),
contentAlignment = Alignment.Center,
) {
ProgressIndicator(
Expand All @@ -124,7 +134,10 @@ internal fun <T> BasicInputImage(
ImageBlock(
load = load,
painterFor = painterFor,
onClick = onDownloadButtonClick,
onClick = {
onDownloadButtonClick.invoke()
focusRequester.requestFocus()
},
downloadButtonVisible = downloadButtonVisible,
modifier = Modifier.padding(
end = if (state == InputShellState.DISABLED) {
Expand All @@ -133,6 +146,10 @@ internal fun <T> BasicInputImage(
Spacing.Spacing0
},
),
onImageClick = {
onImageClick.invoke()
focusRequester.requestFocus()
},
)
}
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
package org.hisp.dhis.mobile.ui.designsystem.component

import androidx.compose.foundation.background
import androidx.compose.foundation.layout.fillMaxWidth
import androidx.compose.foundation.layout.heightIn
import androidx.compose.foundation.layout.padding
import androidx.compose.foundation.text.KeyboardOptions
import androidx.compose.material.icons.Icons
Expand All @@ -26,7 +28,9 @@ import androidx.compose.ui.unit.DpOffset
import androidx.compose.ui.unit.dp
import androidx.compose.ui.window.PopupProperties
import org.hisp.dhis.mobile.ui.designsystem.component.internal.RegExValidations
import org.hisp.dhis.mobile.ui.designsystem.theme.InternalSizeValues
import org.hisp.dhis.mobile.ui.designsystem.theme.Spacing
import org.hisp.dhis.mobile.ui.designsystem.theme.SurfaceColor
import java.util.Locale

/**
Expand Down Expand Up @@ -132,7 +136,10 @@ internal fun BasicTextInput(
},
inputField = {
BasicTextField(
modifier = Modifier.testTag("INPUT_" + testTag + "_FIELD").fillMaxWidth(),
modifier = Modifier
.testTag("INPUT_" + testTag + "_FIELD")
.fillMaxWidth()
.heightIn(Spacing.Spacing0, InternalSizeValues.Size300),
inputText = inputValue ?: "",
helper = helper,
isSingleLine = isSingleLine,
Expand Down Expand Up @@ -171,7 +178,7 @@ internal fun BasicTextInput(
)
if (expanded && !filteredList.isNullOrEmpty()) {
DropdownMenu(
modifier = Modifier.exposedDropdownSize(),
modifier = Modifier.exposedDropdownSize().background(SurfaceColor.SurfaceBright),
expanded = expanded,
onDismissRequest = { expanded = false },
offset = DpOffset(x = -16.dp, y = Spacing.Spacing12),
Expand Down
Loading

0 comments on commit 1038305

Please sign in to comment.