mirror of
https://github.com/libre-tube/LibreTube.git
synced 2024-12-15 06:40:30 +05:30
navbar label visibility option
This commit is contained in:
parent
9cbf9f2155
commit
7fa6e846be
@ -38,6 +38,7 @@ import com.github.libretube.util.RetrofitInstance
|
||||
import com.github.libretube.util.ThemeHelper
|
||||
import com.google.android.material.color.DynamicColors
|
||||
import com.google.android.material.elevation.SurfaceColors
|
||||
import com.google.android.material.navigation.NavigationBarView
|
||||
|
||||
class MainActivity : AppCompatActivity() {
|
||||
val TAG = "MainActivity"
|
||||
@ -124,6 +125,16 @@ class MainActivity : AppCompatActivity() {
|
||||
// navigate to the default fragment
|
||||
navController.navigate(startFragmentId)
|
||||
|
||||
val labelVisibilityMode = when (
|
||||
PreferenceHelper.getString(this, "label_visibility", "always")
|
||||
) {
|
||||
"always" -> NavigationBarView.LABEL_VISIBILITY_LABELED
|
||||
"selected" -> NavigationBarView.LABEL_VISIBILITY_SELECTED
|
||||
"never" -> NavigationBarView.LABEL_VISIBILITY_UNLABELED
|
||||
else -> NavigationBarView.LABEL_VISIBILITY_AUTO
|
||||
}
|
||||
binding.bottomNav.labelVisibilityMode = labelVisibilityMode
|
||||
|
||||
binding.bottomNav.setOnItemSelectedListener {
|
||||
// clear backstack if it's the start fragment
|
||||
if (startFragmentId == it.itemId) navController.backQueue.clear()
|
||||
|
10
app/src/main/res/drawable/ic_label.xml
Normal file
10
app/src/main/res/drawable/ic_label.xml
Normal file
@ -0,0 +1,10 @@
|
||||
<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:width="24dp"
|
||||
android:height="24dp"
|
||||
android:tint="?android:attr/colorControlNormal"
|
||||
android:viewportWidth="320"
|
||||
android:viewportHeight="320">
|
||||
<path
|
||||
android:fillColor="#FF000000"
|
||||
android:pathData="M311.34,8.67c-5.61,-5.61 -13.24,-8.73 -21.18,-8.66L194.28,0.85c-7.76,0.07 -15.17,3.18 -20.66,8.66L8.66,174.47c-11.55,11.55 -11.55,30.28 0,41.83l95.03,95.03c11.55,11.56 30.28,11.56 41.83,0l164.96,-164.96c5.48,-5.49 8.59,-12.9 8.66,-20.66l0.85,-95.88C320.07,21.91 316.95,14.27 311.34,8.67zM254.04,113.77c-13.2,13.21 -34.61,13.2 -47.81,0c-13.2,-13.2 -13.2,-34.6 0,-47.81c13.2,-13.2 34.61,-13.2 47.81,0C267.24,79.16 267.24,100.57 254.04,113.77z" />
|
||||
</vector>
|
@ -709,4 +709,16 @@
|
||||
<item>portrait</item>
|
||||
</string-array>
|
||||
|
||||
<string-array name="labelVisibility">
|
||||
<item>@string/always</item>
|
||||
<item>@string/selected</item>
|
||||
<item>@string/never</item>
|
||||
</string-array>
|
||||
|
||||
<string-array name="labelVisibilityValues">
|
||||
<item>always</item>
|
||||
<item>selected</item>
|
||||
<item>never</item>
|
||||
</string-array>
|
||||
|
||||
</resources>
|
@ -233,4 +233,8 @@
|
||||
<string name="change_playback_speed">Playback speed</string>
|
||||
<string name="require_restart">Restart required</string>
|
||||
<string name="require_restart_message">This change requires an app restart. Do you want to restart the app now? Otherwise the changes will be applied on the next app restart.</string>
|
||||
<string name="navLabelVisibility">Navbar label visibility</string>
|
||||
<string name="always">Always</string>
|
||||
<string name="selected">Selected</string>
|
||||
<string name="never">Never</string>
|
||||
</resources>
|
@ -51,6 +51,15 @@
|
||||
app:title="@string/hideTrendingPage"
|
||||
app:useSimpleSummaryProvider="true" />
|
||||
|
||||
<ListPreference
|
||||
android:icon="@drawable/ic_label"
|
||||
app:defaultValue="always"
|
||||
app:entries="@array/labelVisibility"
|
||||
app:entryValues="@array/labelVisibilityValues"
|
||||
app:key="label_visibility"
|
||||
app:title="@string/navLabelVisibility"
|
||||
app:useSimpleSummaryProvider="true" />
|
||||
|
||||
<ListPreference
|
||||
android:icon="@drawable/ic_grid"
|
||||
app:defaultValue="@integer/grid_items"
|
||||
|
Loading…
Reference in New Issue
Block a user