kopia lustrzana https://github.com/rt-bishop/Look4Sat
Showing error message in passes fragment when no satellites selected
rodzic
628a01b530
commit
9930fc9bde
|
@ -59,11 +59,19 @@ class PassesFragment : Fragment(R.layout.fragment_passes) {
|
|||
private fun setupObservers() {
|
||||
viewModel.getPasses().observe(viewLifecycleOwner, { result ->
|
||||
if (result is Result.Success) {
|
||||
binding.passesProgress.visibility = View.INVISIBLE
|
||||
binding.passesRecycler.visibility = View.VISIBLE
|
||||
passes = result.data
|
||||
passesAdapter.setList(passes)
|
||||
if (result.data.isEmpty()) {
|
||||
binding.passesProgress.visibility = View.INVISIBLE
|
||||
binding.passesRecycler.visibility = View.INVISIBLE
|
||||
binding.passesError.visibility = View.VISIBLE
|
||||
} else {
|
||||
passes = result.data
|
||||
passesAdapter.setList(passes)
|
||||
binding.passesError.visibility = View.INVISIBLE
|
||||
binding.passesProgress.visibility = View.INVISIBLE
|
||||
binding.passesRecycler.visibility = View.VISIBLE
|
||||
}
|
||||
} else if (result is Result.InProgress) {
|
||||
binding.passesError.visibility = View.INVISIBLE
|
||||
binding.passesRecycler.visibility = View.INVISIBLE
|
||||
binding.passesProgress.visibility = View.VISIBLE
|
||||
}
|
||||
|
|
|
@ -1,9 +0,0 @@
|
|||
<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:width="24dp"
|
||||
android:height="24dp"
|
||||
android:viewportWidth="24"
|
||||
android:viewportHeight="24">
|
||||
<path
|
||||
android:fillColor="@color/themeLight"
|
||||
android:pathData="M4,18l8.5,-6L4,6v12zM13,6v12l8.5,-6L13,6z" />
|
||||
</vector>
|
|
@ -5,5 +5,5 @@
|
|||
android:viewportHeight="24">
|
||||
<path
|
||||
android:fillColor="@color/themeLight"
|
||||
android:pathData="M12,6v3l4,-4 -4,-4v3c-4.42,0 -8,3.58 -8,8 0,1.57 0.46,3.03 1.24,4.26L6.7,14.8c-0.45,-0.83 -0.7,-1.79 -0.7,-2.8 0,-3.31 2.69,-6 6,-6zM18.76,7.74L17.3,9.2c0.44,0.84 0.7,1.79 0.7,2.8 0,3.31 -2.69,6 -6,6v-3l-4,4 4,4v-3c4.42,0 8,-3.58 8,-8 0,-1.57 -0.46,-3.03 -1.24,-4.26z" />
|
||||
android:pathData="M17.65,6.35C16.2,4.9 14.21,4 12,4c-4.42,0 -7.99,3.58 -7.99,8s3.57,8 7.99,8c3.73,0 6.84,-2.55 7.73,-6h-2.08c-0.82,2.33 -3.04,4 -5.65,4 -3.31,0 -6,-2.69 -6,-6s2.69,-6 6,-6c1.66,0 3.14,0.69 4.22,1.78L13,11h7V4l-2.35,2.35z" />
|
||||
</vector>
|
||||
|
|
|
@ -130,9 +130,9 @@
|
|||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="bottom|center"
|
||||
android:layout_margin="24dp"
|
||||
android:layout_margin="32dp"
|
||||
android:contentDescription="@string/placeholder"
|
||||
android:src="@drawable/ic_proceed"
|
||||
android:src="@drawable/ic_arrow"
|
||||
app:fabSize="mini" />
|
||||
|
||||
</androidx.coordinatorlayout.widget.CoordinatorLayout>
|
||||
|
|
|
@ -98,6 +98,18 @@
|
|||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@+id/passes_bar" />
|
||||
|
||||
<com.google.android.material.textview.MaterialTextView
|
||||
android:id="@+id/passes_error"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="@string/passes_error"
|
||||
android:textSize="20sp"
|
||||
android:visibility="invisible"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@+id/passes_bar" />
|
||||
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||
|
||||
<com.google.android.material.floatingactionbutton.FloatingActionButton
|
||||
|
@ -105,9 +117,9 @@
|
|||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="bottom|center"
|
||||
android:layout_marginBottom="24dp"
|
||||
android:layout_marginBottom="32dp"
|
||||
android:contentDescription="@string/placeholder"
|
||||
app:fabSize="mini"
|
||||
app:srcCompat="@drawable/ic_refresh" />
|
||||
android:src="@drawable/ic_refresh"
|
||||
app:fabSize="mini" />
|
||||
|
||||
</androidx.coordinatorlayout.widget.CoordinatorLayout>
|
||||
|
|
|
@ -106,4 +106,5 @@
|
|||
<string name="https_only">Используйте HTTPS</string>
|
||||
<string name="entries_update">Обновить данные TLE:</string>
|
||||
<string name="entries_error">Пожалуйста, обновите данные TLE</string>
|
||||
<string name="passes_error">Нет выбранных спутников</string>
|
||||
</resources>
|
||||
|
|
|
@ -122,4 +122,5 @@
|
|||
<string name="timer_placeholder" translatable="false">-</string>
|
||||
<string name="entries_update">TLE data update:</string>
|
||||
<string name="entries_error">Please update TLE data</string>
|
||||
<string name="passes_error">No satellites were selected</string>
|
||||
</resources>
|
||||
|
|
Ładowanie…
Reference in New Issue