From d9b5c18cac796965e16cec54a397c805d54fbd85 Mon Sep 17 00:00:00 2001 From: Bnyro Date: Sat, 14 May 2022 00:09:33 +0200 Subject: [PATCH] Added default tab on app startup --- .../main/java/com/github/libretube/MainActivity.kt | 7 +++++++ app/src/main/res/values/array.xml | 13 +++++++++++++ app/src/main/res/values/strings.xml | 1 + app/src/main/res/xml/settings.xml | 9 +++++++++ 4 files changed, 30 insertions(+) diff --git a/app/src/main/java/com/github/libretube/MainActivity.kt b/app/src/main/java/com/github/libretube/MainActivity.kt index 7cd322ee4..5678469bc 100644 --- a/app/src/main/java/com/github/libretube/MainActivity.kt +++ b/app/src/main/java/com/github/libretube/MainActivity.kt @@ -18,6 +18,7 @@ import android.view.* import android.view.inputmethod.InputMethodManager import android.widget.Button import android.widget.LinearLayout +import android.widget.Toast import androidx.appcompat.app.AppCompatDelegate import androidx.appcompat.widget.Toolbar import androidx.constraintlayout.motion.widget.MotionLayout @@ -86,6 +87,12 @@ class MainActivity : AppCompatActivity() { navController = findNavController(R.id.fragment) bottomNavigationView.setupWithNavController(navController) + when (sharedPreferences.getString("default_tab", "home")!!) { + "home" -> navController.navigate(R.id.home2) + "subscriptions" -> navController.navigate(R.id.subscriptions) + "library" -> navController.navigate(R.id.library) + } + bottomNavigationView.setOnItemSelectedListener { when (it.itemId) { R.id.home2 -> { diff --git a/app/src/main/res/values/array.xml b/app/src/main/res/values/array.xml index a68fe1239..05860585e 100644 --- a/app/src/main/res/values/array.xml +++ b/app/src/main/res/values/array.xml @@ -470,6 +470,19 @@ L D + + + @string/startpage + @string/subscriptions + @string/library + + + + home + subscriptions + library + + HLS 1080p diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml index 51d9d8b8e..82c632a45 100644 --- a/app/src/main/res/values/strings.xml +++ b/app/src/main/res/values/strings.xml @@ -72,4 +72,5 @@ No Internet Connection Retry Comments + Default Tab diff --git a/app/src/main/res/xml/settings.xml b/app/src/main/res/xml/settings.xml index 56ae14456..dccf89391 100644 --- a/app/src/main/res/xml/settings.xml +++ b/app/src/main/res/xml/settings.xml @@ -71,6 +71,15 @@ android:icon="@drawable/ic_theme" /> + +