@@ -692,18 +692,19 @@ class PatientSummaryScreen :
692692 }
693693
694694 override fun showTobaccoStatusDialog () {
695- val options = if (country.isoCountryCode == Country .ETHIOPIA ) {
696- arrayOf(
697- getString(R .string.tobacco_status_dialog_option_smokes),
698- getString(R .string.tobacco_status_dialog_option_no)
699- )
695+ if (country.isoCountryCode == Country .ETHIOPIA ) {
696+ showTobaccoUseDialogWithoutSmokelessTobacco()
700697 } else {
701- arrayOf(
702- getString(R .string.tobacco_status_dialog_option_smokes),
703- getString(R .string.tobacco_status_dialog_option_smokeless),
704- getString(R .string.tobacco_status_dialog_option_no)
705- )
698+ showTobaccoUseDialogWithSmokelessTobacco()
706699 }
700+ }
701+
702+ fun showTobaccoUseDialogWithSmokelessTobacco () {
703+ val options = arrayOf(
704+ getString(R .string.tobacco_status_dialog_option_smokes),
705+ getString(R .string.tobacco_status_dialog_option_smokeless),
706+ getString(R .string.tobacco_status_dialog_option_no)
707+ )
707708
708709 val checkedItems = BooleanArray (options.size)
709710
@@ -723,6 +724,29 @@ class PatientSummaryScreen :
723724 .show()
724725 }
725726
727+ fun showTobaccoUseDialogWithoutSmokelessTobacco () {
728+ val options = arrayOf(
729+ getString(R .string.tobacco_status_dialog_option_smokes),
730+ getString(R .string.tobacco_status_dialog_option_no))
731+
732+ var selectedOption = 1
733+
734+ MaterialAlertDialogBuilder (requireContext(), R .style.ThemeOverlay_Simple_MaterialAlertDialog_CheckedItem )
735+ .setTitle(R .string.tobacco_status_dialog_title)
736+ .setSingleChoiceItems(options, selectedOption) { _, indexSelected ->
737+ selectedOption = indexSelected
738+ }
739+ .setPositiveButton(R .string.tobacco_status_dialog_title_positive_button) { _, _ ->
740+ when (selectedOption) {
741+ 0 -> hotEvents.onNext(SmokingStatusAnswered (Answer .Yes ))
742+ 1 -> hotEvents.onNext(SmokingStatusAnswered (Answer .No ))
743+ else -> {}
744+ }
745+ }
746+ .setNegativeButton(R .string.tobacco_status_dialog_title_negative_button, null )
747+ .show()
748+ }
749+
726750 override fun openCholesterolEntrySheet (patientUuid : UUID ) {
727751 router.pushExpectingResult(ScreenRequest .CholesterolEntrySheet , CholesterolEntrySheet .Key (patientUuid))
728752 }
0 commit comments