Skip to content

Commit

Permalink
fix checkbox state clearing when setting tint
Browse files Browse the repository at this point in the history
  • Loading branch information
Vishwajith-Shettigar committed Jul 9, 2024
1 parent 673ba94 commit c64e91f
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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()
}
}

Expand Down
5 changes: 3 additions & 2 deletions app/src/main/res/layout/item_selection_interaction_items.xml
Original file line number Diff line number Diff line change
Expand Up @@ -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}"
/>

<TextView
android:id="@+id/item_selection_contents_text_view"
Expand Down

0 comments on commit c64e91f

Please sign in to comment.