Added an empty list message to the Radar screen

This commit is contained in:
Arty Bishop committed 2022-03-01 18:49:32 +00:00
1 parent 20306ec83e
commit 3b761f9589
7 files changed
+40 -20

No files matched your search

@@ -141,12 +141,8 @@ class PassesFragment : Fragment(R.layout.fragment_passes), PassesAdapter.PassesC
tickMainTimer(state.data)
if (state.data.isNotEmpty()) { // show new passes list
passesEmpty.visibility = View.INVISIBLE
passesBtnRefresh.isEnabled = true
refreshAnimator?.cancel()
} else { // show no passes message
passesEmpty.visibility = View.VISIBLE
passesBtnRefresh.isEnabled = true
refreshAnimator?.cancel()
}
}
is DataState.Loading -> {
@@ -175,6 +171,8 @@ class PassesFragment : Fragment(R.layout.fragment_passes), PassesAdapter.PassesC
} else {
passesTimer.text = 0L.toTimerString()
}
passesBtnRefresh.isEnabled = true
refreshAnimator?.cancel()
}
}
}
@@ -89,9 +89,10 @@ class RadarFragment : Fragment(R.layout.fragment_radar) {
viewModel.transmitters.observe(viewLifecycleOwner) { list ->
if (list.isNotEmpty()) {
radioAdapter.submitList(list)
radarEmptyMsg.text = getString(R.string.radio_data)
radarProgress.visibility = View.INVISIBLE
} else {
radarEmptyMsg.text = getString(R.string.radio_no_data)
radarProgress.visibility = View.INVISIBLE
radarEmptyLayout.visibility = View.VISIBLE
}
radarView?.invalidate()
}
@@ -111,6 +111,7 @@ class RadarViewModel @Inject constructor(
private fun processTransmitters(pass: SatPass) {
viewModelScope.launch {
delay(125)
val transmitters = repository.getRadiosWithId(pass.catNum)
while (isActive) {
val time = System.currentTimeMillis()