Skip to content

Commit

Permalink
Added an empty list message to the Radar screen
Browse files Browse the repository at this point in the history
  • Loading branch information
rt-bishop committed Mar 1, 2022
1 parent 20306ec commit 3b761f9
Show file tree
Hide file tree
Showing 7 changed files with 40 additions and 20 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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 -> {
Expand Down Expand Up @@ -175,6 +171,8 @@ class PassesFragment : Fragment(R.layout.fragment_passes), PassesAdapter.PassesC
} else {
passesTimer.text = 0L.toTimerString()
}
passesBtnRefresh.isEnabled = true
refreshAnimator?.cancel()
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -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()
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand Down
2 changes: 1 addition & 1 deletion app/src/main/res/layout/fragment_entries.xml
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@
android:layout_width="@dimen/button_width_max"
android:layout_marginEnd="@dimen/button_margin_side"
android:layout_gravity="end|center_vertical"
android:text="@string/btn_clear" />
android:text="@string/btn_clear_all" />

</com.google.android.material.bottomappbar.BottomAppBar>

Expand Down
39 changes: 29 additions & 10 deletions app/src/main/res/layout/fragment_radar.xml
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
<?xml version="1.0" encoding="utf-8"?>
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:transitionGroup="true"
Expand Down Expand Up @@ -144,19 +145,37 @@

<ProgressBar
android:id="@+id/radar_progress"
style="@style/RecyclerProgress"
android:visibility="invisible" />
style="@style/RecyclerProgress" />

<TextView
android:id="@+id/radar_empty_msg"
android:layout_width="wrap_content"
<LinearLayout
android:id="@+id/radar_empty_layout"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:gravity="center"
android:includeFontPadding="false"
android:text="@string/radio_no_data"
android:textSize="@dimen/text_size_medium"
android:visibility="invisible" />
android:orientation="vertical"
android:visibility="invisible"
tools:ignore="UseCompoundDrawables">

<ImageView
android:id="@+id/radar_empty_img"
android:layout_width="64dp"
android:layout_height="64dp"
android:layout_gravity="center"
android:layout_marginBottom="24dp"
android:contentDescription="@string/radio_no_data"
android:src="@drawable/ic_modes" />

<TextView
android:id="@+id/radar_empty_msg"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:gravity="center"
android:includeFontPadding="false"
android:text="@string/radio_no_data"
android:textSize="@dimen/text_size_mediumLarge" />

</LinearLayout>

</androidx.cardview.widget.CardView>

Expand Down
2 changes: 1 addition & 1 deletion app/src/main/res/values-ru/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@
<string name="radio_link_low">%.4f</string>
<string name="radio_link_lowHigh">%.4f - %.4f</string>
<string name="radio_data">Трансиверы спутника:</string>
<string name="radio_no_data">Не найдены трансиверы для этого спутника</string>
<string name="radio_no_data">У этого спутника нет трансиверов</string>
<string name="radio_string_yes">Да</string>
<string name="radio_string_no">Нет</string>
<string name="radio_downlink">Даунлинк</string>
Expand Down
5 changes: 3 additions & 2 deletions app/src/main/res/values/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,10 @@
<string name="btn_cancel">Cancel</string>
<string name="btn_back">Back</string>
<string name="btn_modes">Modes</string>
<string name="btn_select">Select</string>
<string name="btn_select">Select all</string>
<string name="btn_done">Done</string>
<string name="btn_clear">Clear</string>
<string name="btn_clear_all">Clear all</string>
<string name="btn_refresh">Refresh</string>
<string name="btn_map">Map</string>
<string name="btn_filter">Filter</string>
Expand Down Expand Up @@ -90,7 +91,7 @@
<string name="radio_link_low">%.4f</string>
<string name="radio_link_lowHigh">%.4f - %.4f</string>
<string name="radio_data">Satellite transceivers:</string>
<string name="radio_no_data">No transceivers found for this satellite</string>
<string name="radio_no_data">This satellite has no transceivers</string>
<string name="radio_string_yes">Yes</string>
<string name="radio_string_no">No</string>
<string name="radio_downlink">Downlink</string>
Expand Down

0 comments on commit 3b761f9

Please sign in to comment.