Commit 5d29ffca authored by Joey's avatar Joey

glucose: insulin dialog: refactor layout change

Signed-off-by: Joey's avatarJoey <bevilacquajoey@gmail.com>
Change-Id: Ic026558d7ada86d134c34777b6ff325970b16dd5
parent 392d1945
Pipeline #66405025 passed with stage
in 11 minutes and 10 seconds
......@@ -99,33 +99,7 @@ class InsulinDialogFragment : BottomSheetDialogFragmentExt() {
}
private fun setupEmpty() {
ConstraintSet().apply {
clone(constraint)
connect(
R.id.glucose_editor_insulin_positive,
ConstraintSet.TOP,
R.id.glucose_editor_insulin_empty,
ConstraintSet.BOTTOM
)
connect(
R.id.glucose_editor_insulin_positive,
ConstraintSet.START,
ConstraintSet.PARENT_ID,
ConstraintSet.START
)
connect(
R.id.glucose_editor_insulin_positive,
ConstraintSet.END,
ConstraintSet.PARENT_ID,
ConstraintSet.END
)
constrainPercentWidth(
R.id.glucose_editor_insulin_positive,
0.8f
)
applyTo(constraint)
}
applyEmptyLayout()
emptyText.visibility = View.VISIBLE
valueEditText.visibility = View.GONE
......@@ -167,6 +141,29 @@ class InsulinDialogFragment : BottomSheetDialogFragmentExt() {
}
}
private fun applyEmptyLayout() {
ConstraintSet().apply {
clone(constraint)
connect(
R.id.glucose_editor_insulin_positive, ConstraintSet.TOP,
R.id.glucose_editor_insulin_empty, ConstraintSet.BOTTOM
)
connect(
R.id.glucose_editor_insulin_positive, ConstraintSet.START,
ConstraintSet.PARENT_ID, ConstraintSet.START
)
connect(
R.id.glucose_editor_insulin_positive, ConstraintSet.END,
ConstraintSet.PARENT_ID, ConstraintSet.END
)
constrainPercentWidth(
R.id.glucose_editor_insulin_positive,
0.8f
)
applyTo(constraint)
}
}
private fun onSave() {
val currentValue = valueEditText.text.toString().toFloatOrNull() ?: 0f
viewModel.apply {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment