Skip to content

Commit

Permalink
Fixed issue google#2399
Browse files Browse the repository at this point in the history
Fixed this issue: Disabling "other" option doesn't hide/disable "Other" text
  • Loading branch information
NudurupatiSurya committed Jun 28, 2024
1 parent 1ef7dea commit 8186ac9
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -147,6 +147,9 @@ class MultipleChoiceTaskViewModel @Inject constructor(resources: Resources) :
}
}

fun isOtherOptionAndSelected(item: MultipleChoiceItem): Boolean =
item.isOtherOption && item.isSelected

companion object {
private const val OTHER_ID: String = "OTHER_ID"
private const val OTHER_PREFIX: String = "[ "
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,7 @@
android:inputType="text"
android:text="@{item.otherText}"
android:visibility="@{item.isOtherOption ? View.VISIBLE: View.GONE}"
android:enabled="@{viewModel.isOtherOptionAndSelected(item)}"
app:textChangedListener="@{viewModel.otherTextWatcher}" />
</com.google.android.material.textfield.TextInputLayout>
</androidx.constraintlayout.widget.ConstraintLayout>
Expand Down

0 comments on commit 8186ac9

Please sign in to comment.