mirror of
https://github.com/rt-bishop/Look4Sat.git
synced 2026-10-02 03:15:37 +00:00
Added PassPrefs dialog entered values sanity check
This commit is contained in:
1 parent
5737023389
commit
ba7f3f432e
2 files changed
+17
-3
No files matched your search
@@ -132,8 +132,22 @@ class SkyFragment : Fragment() {
|
||||
.setPositiveButton(getString(R.string.btn_ok)) { _, _ ->
|
||||
val hoursAhead = etHoursAhead.text.toString().toInt()
|
||||
val minEl = etMinEl.text.toString().toDouble()
|
||||
viewModel.setPassPrefs(hoursAhead, minEl)
|
||||
calculatePasses()
|
||||
if (hoursAhead < 1 || hoursAhead > 168) {
|
||||
Toast.makeText(
|
||||
mainActivity,
|
||||
"Value should be within 1-168 hours",
|
||||
Toast.LENGTH_SHORT
|
||||
).show()
|
||||
} else if (minEl < 0 || minEl > 90) {
|
||||
Toast.makeText(
|
||||
mainActivity,
|
||||
"Value should be within 0-90 deg",
|
||||
Toast.LENGTH_SHORT
|
||||
).show()
|
||||
} else {
|
||||
viewModel.setPassPrefs(hoursAhead, minEl)
|
||||
calculatePasses()
|
||||
}
|
||||
}
|
||||
.setNegativeButton(getString(R.string.btn_cancel)) { dialog, _ ->
|
||||
dialog.cancel()
|
||||
|
||||
@@ -42,7 +42,7 @@
|
||||
android:layout_height="wrap_content"
|
||||
android:hint="@string/pref_min_el_hint"
|
||||
android:importantForAutofill="no"
|
||||
android:inputType="number"
|
||||
android:inputType="number|numberDecimal"
|
||||
app:layout_constraintEnd_toEndOf="@+id/pref_min_el_tv"
|
||||
app:layout_constraintStart_toStartOf="@+id/pref_min_el_tv"
|
||||
app:layout_constraintTop_toBottomOf="@+id/pref_min_el_tv" />
|
||||
|
||||
Reference in new issue
Block a user