Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: Nutrition edition: no listener was set on unit/"data per" #4579

Merged
merged 1 commit into from
Mar 21, 2022
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,12 @@ class ProductEditNutritionFactsFragment : ProductEditFragment() {
binding.btnAddImageNutritionFacts.setOnClickListener { addNutritionFactsImage() }
binding.btnEditImageNutritionFacts.setOnClickListener { newNutritionFactsImage() }
binding.btnAdd.setOnClickListener { next() }
binding.for100g100ml.setOnClickListener { checkAllValues() }
binding.radioGroup.setOnCheckedChangeListener { _, checkedId ->
if (checkedId >= 0) {
viewModel.dataFormat.postValue(checkedId)
}
}

binding.btnAddANutrient.setOnClickListener { displayAddNutrientDialog() }

binding.salt.doAfterTextChanged { updateSodiumValue() }
Expand All @@ -134,7 +139,6 @@ class ProductEditNutritionFactsFragment : ProductEditFragment() {
binding.spinnerSaltComp.setSelection(binding.spinnerSodiumComp.selectedItemPosition)
}


val bundle = arguments
lastEditText = binding.alcohol

Expand Down Expand Up @@ -375,11 +379,13 @@ class ProductEditNutritionFactsFragment : ProductEditFragment() {
*/
private fun updateSelectedDataPer(value: String) {
binding.radioGroup.clearCheck()

when (value) {
NUTRITION_DATA_PER_100G -> binding.radioGroup.check(R.id.for100g_100ml)
NUTRITION_DATA_PER_SERVING -> binding.radioGroup.check(R.id.per_serving)
else -> throw IllegalArgumentException("Value is neither $NUTRITION_DATA_PER_100G nor $NUTRITION_DATA_PER_SERVING")
}

binding.radioGroup.jumpDrawablesToCurrentState()
}

Expand Down