mirror of
https://github.com/libre-tube/LibreTube.git
synced 2024-12-14 06:10:31 +05:30
Added default tab on app startup
This commit is contained in:
parent
079fc949f1
commit
d9b5c18cac
@ -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 -> {
|
||||
|
@ -470,6 +470,19 @@
|
||||
<item>L</item>
|
||||
<item>D</item>
|
||||
</string-array>
|
||||
|
||||
<string-array name="tabs">
|
||||
<item>@string/startpage</item>
|
||||
<item>@string/subscriptions</item>
|
||||
<item>@string/library</item>
|
||||
</string-array>
|
||||
|
||||
<string-array name="tabsValue">
|
||||
<item>home</item>
|
||||
<item>subscriptions</item>
|
||||
<item>library</item>
|
||||
</string-array>
|
||||
|
||||
<string-array name="defres">
|
||||
<item>HLS</item>
|
||||
<item>1080p</item>
|
||||
|
@ -72,4 +72,5 @@
|
||||
<string name="noInternet">No Internet Connection</string>
|
||||
<string name="retry">Retry</string>
|
||||
<string name="comments">Comments</string>
|
||||
<string name="defaultTab">Default Tab</string>
|
||||
</resources>
|
||||
|
@ -71,6 +71,15 @@
|
||||
android:icon="@drawable/ic_theme"
|
||||
/>
|
||||
|
||||
<ListPreference
|
||||
app:title="@string/defaultTab"
|
||||
app:key="default_tab"
|
||||
app:entries="@array/tabs"
|
||||
app:entryValues="@array/tabsValue"
|
||||
app:defaultValue="home"
|
||||
android:icon="@drawable/ic_home"
|
||||
/>
|
||||
|
||||
<ListPreference
|
||||
app:title="@string/defres"
|
||||
app:key="default_res"
|
||||
|
Loading…
Reference in New Issue
Block a user