Skip to content

Satellite tracker and pass predictor for Android, inspired by Gpredict

Altered bottom navigation view back stack saving

Arty Bishop80ba3644f790
diff --git a/app/build.gradle b/app/build.gradle
index 3473edfb..a246932f 100644
--- a/app/build.gradle
+++ b/app/build.gradle
@@ -56,10 +56,11 @@ android {
dependencies {
implementation project(":core")
+ implementation "com.google.android.material:material:1.5.0"
+ implementation "androidx.appcompat:appcompat:1.4.1"
+ implementation "androidx.fragment:fragment-ktx:1.4.1"
implementation "androidx.core:core-ktx:1.7.0"
implementation "androidx.core:core-splashscreen:1.0.0-beta01"
- implementation "androidx.appcompat:appcompat:1.4.1"
- implementation "com.google.android.material:material:1.5.0"
implementation "androidx.constraintlayout:constraintlayout:2.1.3"
implementation "androidx.swiperefreshlayout:swiperefreshlayout:1.1.0"
implementation "androidx.lifecycle:lifecycle-livedata-ktx:2.4.1"
diff --git a/app/src/main/java/com/rtbishop/look4sat/presentation/MainActivity.kt b/app/src/main/java/com/rtbishop/look4sat/presentation/MainActivity.kt
index 62e95517..166dd566 100644
--- a/app/src/main/java/com/rtbishop/look4sat/presentation/MainActivity.kt
+++ b/app/src/main/java/com/rtbishop/look4sat/presentation/MainActivity.kt
@@ -24,6 +24,7 @@ import androidx.activity.viewModels
import androidx.appcompat.app.AppCompatActivity
import androidx.core.splashscreen.SplashScreen.Companion.installSplashScreen
import androidx.navigation.fragment.NavHostFragment
+import androidx.navigation.ui.NavigationUI
import androidx.navigation.ui.setupWithNavController
import com.rtbishop.look4sat.R
import com.rtbishop.look4sat.databinding.ActivityMainBinding
@@ -42,7 +43,14 @@ class MainActivity : AppCompatActivity() {
val binding = ActivityMainBinding.inflate(layoutInflater)
val host = supportFragmentManager.findFragmentById(R.id.navigation_host) as NavHostFragment
setContentView(binding.root)
- binding.navigationBar.setupWithNavController(host.navController)
+ binding.navigationBar.apply {
+ setupWithNavController(host.navController)
+ setOnItemSelectedListener { item ->
+ NavigationUI.onNavDestinationSelected(item, host.navController)
+ host.navController.popBackStack(item.itemId, inclusive = false)
+ true
+ }
+ }
mainViewModel.calculatePasses()
}
}
diff --git a/app/src/main/res/layout/fragment_radar.xml b/app/src/main/res/layout/fragment_radar.xml
index 5f68e22f..07d02fe6 100644
--- a/app/src/main/res/layout/fragment_radar.xml
+++ b/app/src/main/res/layout/fragment_radar.xml
@@ -37,6 +37,7 @@
<TextView
android:id="@+id/radar_name"
android:layout_width="0dp"
+ android:visibility="gone"
android:layout_height="wrap_content"
android:layout_marginStart="8dp"
android:layout_marginTop="2dp"
@@ -54,7 +55,7 @@
android:layout_width="0dp"
android:layout_height="0dp"
android:layout_marginStart="8dp"
- android:layout_marginTop="2dp"
+ android:layout_marginTop="8dp"
android:layout_marginEnd="8dp"
app:layout_constraintDimensionRatio="1:1"
app:layout_constraintEnd_toEndOf="parent"
@@ -111,7 +112,7 @@
android:layout_width="0dp"
android:layout_height="0dp"
android:layout_marginStart="8dp"
- android:layout_marginTop="2dp"
+ android:layout_marginTop="8dp"
android:layout_marginEnd="8dp"
android:layout_marginBottom="8dp"
app:layout_constraintBottom_toBottomOf="parent"
@@ -130,6 +131,7 @@
<TextView
android:id="@+id/radar_recycler_msg"
android:layout_width="0dp"
+ android:visibility="gone"
android:layout_height="wrap_content"
android:layout_marginStart="8dp"
android:layout_marginTop="2dp"
diff --git a/app/src/main/res/menu/navigation_menu.xml b/app/src/main/res/menu/navigation_menu.xml
index 65d48d70..21410e15 100644
--- a/app/src/main/res/menu/navigation_menu.xml
+++ b/app/src/main/res/menu/navigation_menu.xml
@@ -8,10 +8,10 @@
android:id="@+id/nav_passes"
android:icon="@drawable/ic_list"
android:title="@string/menu_passes" />
-<!-- <item-->
-<!-- android:id="@+id/nav_radar"-->
-<!-- android:icon="@drawable/ic_support"-->
-<!-- android:title="@string/menu_radar" />-->
+ <item
+ android:id="@+id/nav_radar"
+ android:icon="@drawable/ic_support"
+ android:title="@string/menu_radar" />
<item
android:id="@+id/nav_map"
android:icon="@drawable/ic_world"