forked from dhis2/dhis2-android-capture-app
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request dhis2#3504 from dhis2/ANDROAPP-5919
feat: [ANDROAPP-5919] multiselection on dataset
- Loading branch information
Showing
10 changed files
with
92 additions
and
105 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
96 changes: 0 additions & 96 deletions
96
app/src/main/java/org/dhis2/utils/customviews/OptionSetCellPopUp.java
This file was deleted.
Oops, something went wrong.
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
43 changes: 43 additions & 0 deletions
43
compose-table/src/main/java/org/dhis2/composetable/ui/MultiOptionSelector.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,43 @@ | ||
package org.dhis2.composetable.ui | ||
|
||
import androidx.compose.runtime.Composable | ||
import androidx.compose.ui.res.stringResource | ||
import org.dhis2.composetable.R | ||
import org.dhis2.composetable.model.TableCell | ||
import org.hisp.dhis.mobile.ui.designsystem.component.CheckBoxData | ||
import org.hisp.dhis.mobile.ui.designsystem.component.MultiSelectBottomSheet | ||
|
||
@Composable | ||
fun MultiOptionSelector( | ||
options: List<String>, | ||
cell: TableCell, | ||
title: String, | ||
onSave: (String, String) -> Unit, | ||
onDismiss: () -> Unit, | ||
) { | ||
MultiSelectBottomSheet( | ||
items = options.map { option -> | ||
val code = option.split("_")[0] | ||
val label = option.split("_")[1] | ||
CheckBoxData( | ||
uid = code, | ||
checked = cell.value?.contains(label) == true, | ||
enabled = cell.editable, | ||
textInput = label, | ||
) | ||
}, | ||
title = title, | ||
noResultsFoundString = stringResource(R.string.no_results_found), | ||
doneButtonText = stringResource(id = R.string.done), | ||
onItemsSelected = { checkBoxes -> | ||
val checkedCodes = checkBoxes | ||
.filter { item -> item.checked } | ||
.joinToString(", ") { it.uid } | ||
val checkedValues = checkBoxes | ||
.filter { item -> item.checked } | ||
.joinToString(", ") { it.textInput?.text.orEmpty() } | ||
onSave(checkedCodes, checkedValues) | ||
}, | ||
onDismiss = onDismiss, | ||
) | ||
} |
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