From c64e91f5555b6d81df3c3926995243efcadf0db7 Mon Sep 17 00:00:00 2001 From: Vishwajith-Shettigar Date: Tue, 9 Jul 2024 08:41:24 +0530 Subject: [PATCH] fix checkbox state clearing when setting tint --- .../state/itemviewmodel/SelectionInteractionViewModel.kt | 4 +++- app/src/main/res/layout/item_selection_interaction_items.xml | 5 +++-- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/app/src/main/java/org/oppia/android/app/player/state/itemviewmodel/SelectionInteractionViewModel.kt b/app/src/main/java/org/oppia/android/app/player/state/itemviewmodel/SelectionInteractionViewModel.kt index 68ebf63cf75..32c0e4a16ac 100644 --- a/app/src/main/java/org/oppia/android/app/player/state/itemviewmodel/SelectionInteractionViewModel.kt +++ b/app/src/main/java/org/oppia/android/app/player/state/itemviewmodel/SelectionInteractionViewModel.kt @@ -113,9 +113,11 @@ class SelectionInteractionViewModel private constructor( if (userAnswerState.itemSelection.selectedIndexesCount != 0) { userAnswerState.itemSelection.selectedIndexesList.forEach { selectedIndex -> selectedItems += selectedIndex - updateIsAnswerAvailable() choiceItems[selectedIndex].isAnswerSelected.set(true) } + updateItemSelectability() + updateSelectionText() + updateIsAnswerAvailable() } } diff --git a/app/src/main/res/layout/item_selection_interaction_items.xml b/app/src/main/res/layout/item_selection_interaction_items.xml index d94e5311ad1..ac4434d55d1 100755 --- a/app/src/main/res/layout/item_selection_interaction_items.xml +++ b/app/src/main/res/layout/item_selection_interaction_items.xml @@ -27,12 +27,13 @@ android:id="@+id/item_selection_checkbox" android:layout_width="wrap_content" android:layout_height="wrap_content" - android:checked="@{viewModel.answerSelected}" android:clickable="false" android:enabled="@{viewModel.isEnabled}" android:focusable="false" android:labelFor="@id/item_selection_contents_text_view" - app:buttonTint="@{viewModel.isEnabled ? @color/component_color_shared_item_selection_interaction_enabled_color : @color/component_color_shared_item_selection_interaction_disabled_color}" /> + app:buttonTint="@{viewModel.isEnabled ? @color/component_color_shared_item_selection_interaction_enabled_color : @color/component_color_shared_item_selection_interaction_disabled_color}" + android:checked="@{viewModel.answerSelected}" + />