Skip to content

Satellite tracker and pass predictor for Android, inspired by Gpredict

Added a basic default fragment transition animation

Arty Bishop20306ec83ec6
diff --git a/app/src/main/java/com/rtbishop/look4sat/presentation/entriesScreen/EntriesFragment.kt b/app/src/main/java/com/rtbishop/look4sat/presentation/entriesScreen/EntriesFragment.kt
index 6bf3b143..89ed0103 100644
--- a/app/src/main/java/com/rtbishop/look4sat/presentation/entriesScreen/EntriesFragment.kt
+++ b/app/src/main/java/com/rtbishop/look4sat/presentation/entriesScreen/EntriesFragment.kt
@@ -84,11 +84,9 @@ class EntriesFragment : Fragment(R.layout.fragment_entries) {
is DataState.Success -> {
entriesAdapter.submitList(dataState.data)
binding.entriesProgress.visibility = View.INVISIBLE
- binding.entriesRecycler.visibility = View.VISIBLE
}
is DataState.Loading -> {
binding.entriesProgress.visibility = View.VISIBLE
- binding.entriesRecycler.visibility = View.INVISIBLE
}
else -> {}
}
diff --git a/app/src/main/java/com/rtbishop/look4sat/presentation/entriesScreen/EntriesViewModel.kt b/app/src/main/java/com/rtbishop/look4sat/presentation/entriesScreen/EntriesViewModel.kt
index fe3ca302..807a4502 100644
--- a/app/src/main/java/com/rtbishop/look4sat/presentation/entriesScreen/EntriesViewModel.kt
+++ b/app/src/main/java/com/rtbishop/look4sat/presentation/entriesScreen/EntriesViewModel.kt
@@ -23,6 +23,7 @@ import com.rtbishop.look4sat.domain.ISettings
import com.rtbishop.look4sat.domain.model.DataState
import com.rtbishop.look4sat.domain.model.SatItem
import dagger.hilt.android.lifecycle.HiltViewModel
+import kotlinx.coroutines.delay
import java.util.*
import javax.inject.Inject
@@ -34,7 +35,10 @@ class EntriesViewModel @Inject constructor(
private val transModes = MutableLiveData(settings.loadModesSelection())
private val currentQuery = MutableLiveData(String())
- private val itemsFromRepo = liveData { emit(loadEntriesWithSelection()) } as MutableLiveData
+ private val itemsFromRepo = liveData {
+ delay(125)
+ emit(loadEntriesWithSelection())
+ } as MutableLiveData
private val itemsWithModes = transModes.switchMap { modes ->
itemsFromRepo.map { items -> filterByModes(items, modes) }
}
diff --git a/app/src/main/res/layout/fragment_entries.xml b/app/src/main/res/layout/fragment_entries.xml
index ff1ea97f..f9c1c689 100644
--- a/app/src/main/res/layout/fragment_entries.xml
+++ b/app/src/main/res/layout/fragment_entries.xml
@@ -2,7 +2,8 @@
<androidx.coordinatorlayout.widget.CoordinatorLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
- android:layout_height="match_parent">
+ android:layout_height="match_parent"
+ android:transitionGroup="true">
<androidx.cardview.widget.CardView
android:id="@+id/entries_toolbar"
diff --git a/app/src/main/res/layout/fragment_map.xml b/app/src/main/res/layout/fragment_map.xml
index ba96105e..563e5a25 100644
--- a/app/src/main/res/layout/fragment_map.xml
+++ b/app/src/main/res/layout/fragment_map.xml
@@ -3,6 +3,7 @@
xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
android:layout_height="match_parent"
+ android:transitionGroup="true"
android:keepScreenOn="true">
<androidx.cardview.widget.CardView
diff --git a/app/src/main/res/layout/fragment_passes.xml b/app/src/main/res/layout/fragment_passes.xml
index c52e3547..a569e1e1 100644
--- a/app/src/main/res/layout/fragment_passes.xml
+++ b/app/src/main/res/layout/fragment_passes.xml
@@ -3,7 +3,8 @@
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:layout_height="match_parent"
+ android:transitionGroup="true">
<androidx.cardview.widget.CardView
android:id="@+id/passes_toolbar"
diff --git a/app/src/main/res/layout/fragment_radar.xml b/app/src/main/res/layout/fragment_radar.xml
index 74b847f1..ae64bd61 100644
--- a/app/src/main/res/layout/fragment_radar.xml
+++ b/app/src/main/res/layout/fragment_radar.xml
@@ -3,6 +3,7 @@
xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
android:layout_height="match_parent"
+ android:transitionGroup="true"
android:keepScreenOn="true">
<androidx.cardview.widget.CardView
diff --git a/app/src/main/res/layout/fragment_settings.xml b/app/src/main/res/layout/fragment_settings.xml
index c5941d0b..3cfa5139 100644
--- a/app/src/main/res/layout/fragment_settings.xml
+++ b/app/src/main/res/layout/fragment_settings.xml
@@ -2,7 +2,8 @@
<androidx.coordinatorlayout.widget.CoordinatorLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
- android:layout_height="match_parent">
+ android:layout_height="match_parent"
+ android:transitionGroup="true">
<androidx.cardview.widget.CardView
android:id="@+id/settings_toolbar"
diff --git a/app/src/main/res/navigation/nav_graph.xml b/app/src/main/res/navigation/nav_graph.xml
index a32c5a98..bce3cb07 100644
--- a/app/src/main/res/navigation/nav_graph.xml
+++ b/app/src/main/res/navigation/nav_graph.xml
@@ -10,7 +10,11 @@
tools:layout="@layout/fragment_entries">
<action
android:id="@+id/entries_to_modes"
- app:destination="@id/nav_modes" />
+ app:destination="@id/nav_modes"
+ app:enterAnim="@anim/nav_default_enter_anim"
+ app:exitAnim="@anim/nav_default_exit_anim"
+ app:popEnterAnim="@anim/nav_default_pop_enter_anim"
+ app:popExitAnim="@anim/nav_default_pop_exit_anim" />
</fragment>
<fragment
android:id="@+id/nav_passes"
@@ -18,7 +22,11 @@
tools:layout="@layout/fragment_passes">
<action
android:id="@+id/passes_to_filter"
- app:destination="@id/nav_filter" />
+ app:destination="@id/nav_filter"
+ app:enterAnim="@anim/nav_default_enter_anim"
+ app:exitAnim="@anim/nav_default_exit_anim"
+ app:popEnterAnim="@anim/nav_default_pop_enter_anim"
+ app:popExitAnim="@anim/nav_default_pop_exit_anim" />
</fragment>
<fragment
android:id="@+id/nav_radar"
@@ -48,7 +56,11 @@
tools:layout="@layout/fragment_settings">
<action
android:id="@+id/settings_to_sources"
- app:destination="@id/nav_sources" />
+ app:destination="@id/nav_sources"
+ app:enterAnim="@anim/nav_default_enter_anim"
+ app:exitAnim="@anim/nav_default_exit_anim"
+ app:popEnterAnim="@anim/nav_default_pop_enter_anim"
+ app:popExitAnim="@anim/nav_default_pop_exit_anim" />
</fragment>
<dialog
android:id="@+id/nav_modes"
@@ -72,23 +84,51 @@
tools:layout="@layout/dialog_locator" />
<action
android:id="@+id/global_to_entries"
- app:destination="@id/nav_entries" />
+ app:destination="@id/nav_entries"
+ app:enterAnim="@anim/nav_default_enter_anim"
+ app:exitAnim="@anim/nav_default_exit_anim"
+ app:popEnterAnim="@anim/nav_default_pop_enter_anim"
+ app:popExitAnim="@anim/nav_default_pop_exit_anim" />
<action
android:id="@+id/global_to_passes"
- app:destination="@id/nav_passes" />
+ app:destination="@id/nav_passes"
+ app:enterAnim="@anim/nav_default_enter_anim"
+ app:exitAnim="@anim/nav_default_exit_anim"
+ app:popEnterAnim="@anim/nav_default_pop_enter_anim"
+ app:popExitAnim="@anim/nav_default_pop_exit_anim" />
<action
android:id="@+id/global_to_radar"
- app:destination="@id/nav_radar" />
+ app:destination="@id/nav_radar"
+ app:enterAnim="@anim/nav_default_enter_anim"
+ app:exitAnim="@anim/nav_default_exit_anim"
+ app:popEnterAnim="@anim/nav_default_pop_enter_anim"
+ app:popExitAnim="@anim/nav_default_pop_exit_anim" />
<action
android:id="@+id/global_to_map"
- app:destination="@id/nav_map" />
+ app:destination="@id/nav_map"
+ app:enterAnim="@anim/nav_default_enter_anim"
+ app:exitAnim="@anim/nav_default_exit_anim"
+ app:popEnterAnim="@anim/nav_default_pop_enter_anim"
+ app:popExitAnim="@anim/nav_default_pop_exit_anim" />
<action
android:id="@+id/global_to_settings"
- app:destination="@id/nav_settings" />
+ app:destination="@id/nav_settings"
+ app:enterAnim="@anim/nav_default_enter_anim"
+ app:exitAnim="@anim/nav_default_exit_anim"
+ app:popEnterAnim="@anim/nav_default_pop_enter_anim"
+ app:popExitAnim="@anim/nav_default_pop_exit_anim" />
<action
android:id="@+id/global_to_position"
- app:destination="@id/nav_position" />
+ app:destination="@id/nav_position"
+ app:enterAnim="@anim/nav_default_enter_anim"
+ app:exitAnim="@anim/nav_default_exit_anim"
+ app:popEnterAnim="@anim/nav_default_pop_enter_anim"
+ app:popExitAnim="@anim/nav_default_pop_exit_anim" />
<action
android:id="@+id/global_to_locator"
- app:destination="@id/nav_locator" />
+ app:destination="@id/nav_locator"
+ app:enterAnim="@anim/nav_default_enter_anim"
+ app:exitAnim="@anim/nav_default_exit_anim"
+ app:popEnterAnim="@anim/nav_default_pop_enter_anim"
+ app:popExitAnim="@anim/nav_default_pop_exit_anim" />
</navigation>