mirror of
https://github.com/atsunatsu/Look4Sat.git
synced 2026-10-04 11:37:22 +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()
|
||||
|
||||
Reference in new issue
Block a user