mirror of
https://github.com/libre-tube/LibreTube.git
synced 2025-01-06 01:20:29 +05:30
cleanup
This commit is contained in:
parent
d9c7e937c6
commit
1ff7306063
@ -1,19 +0,0 @@
|
|||||||
package com.github.libretube.constants
|
|
||||||
|
|
||||||
import com.github.libretube.R
|
|
||||||
import com.github.libretube.obj.NavBarItem
|
|
||||||
|
|
||||||
val navBarItems = listOf(
|
|
||||||
NavBarItem(
|
|
||||||
R.id.homeFragment,
|
|
||||||
R.string.startpage
|
|
||||||
),
|
|
||||||
NavBarItem(
|
|
||||||
R.id.subscriptionsFragment,
|
|
||||||
R.string.subscriptions
|
|
||||||
),
|
|
||||||
NavBarItem(
|
|
||||||
R.id.libraryFragment,
|
|
||||||
R.string.library
|
|
||||||
)
|
|
||||||
)
|
|
@ -2,7 +2,6 @@ package com.github.libretube.dialogs
|
|||||||
|
|
||||||
import android.app.Dialog
|
import android.app.Dialog
|
||||||
import android.os.Bundle
|
import android.os.Bundle
|
||||||
import android.util.Log
|
|
||||||
import androidx.fragment.app.DialogFragment
|
import androidx.fragment.app.DialogFragment
|
||||||
import androidx.recyclerview.widget.ItemTouchHelper
|
import androidx.recyclerview.widget.ItemTouchHelper
|
||||||
import androidx.recyclerview.widget.LinearLayoutManager
|
import androidx.recyclerview.widget.LinearLayoutManager
|
||||||
@ -64,6 +63,8 @@ class NavBarOptionsDialog : DialogFragment() {
|
|||||||
.setView(binding.root)
|
.setView(binding.root)
|
||||||
.setPositiveButton(R.string.okay) { _, _ ->
|
.setPositiveButton(R.string.okay) { _, _ ->
|
||||||
NavBarHelper.setNavBarItems(adapter.items)
|
NavBarHelper.setNavBarItems(adapter.items)
|
||||||
|
RequireRestartDialog()
|
||||||
|
.show(requireParentFragment().childFragmentManager, null)
|
||||||
}
|
}
|
||||||
.setNegativeButton(R.string.cancel, null)
|
.setNegativeButton(R.string.cancel, null)
|
||||||
.show()
|
.show()
|
||||||
|
@ -1,19 +1,33 @@
|
|||||||
package com.github.libretube.util
|
package com.github.libretube.util
|
||||||
|
|
||||||
import android.util.Log
|
|
||||||
import android.view.Menu
|
import android.view.Menu
|
||||||
import android.view.MenuItem
|
import android.view.MenuItem
|
||||||
import com.fasterxml.jackson.core.type.TypeReference
|
import com.fasterxml.jackson.core.type.TypeReference
|
||||||
import com.fasterxml.jackson.databind.ObjectMapper
|
import com.fasterxml.jackson.databind.ObjectMapper
|
||||||
|
import com.github.libretube.R
|
||||||
import com.github.libretube.constants.PreferenceKeys
|
import com.github.libretube.constants.PreferenceKeys
|
||||||
import com.github.libretube.constants.navBarItems
|
|
||||||
import com.github.libretube.extensions.TAG
|
|
||||||
import com.github.libretube.obj.NavBarItem
|
import com.github.libretube.obj.NavBarItem
|
||||||
import com.google.android.material.bottomnavigation.BottomNavigationView
|
import com.google.android.material.bottomnavigation.BottomNavigationView
|
||||||
import com.google.android.material.navigation.NavigationBarView
|
import com.google.android.material.navigation.NavigationBarView
|
||||||
|
|
||||||
object NavBarHelper {
|
object NavBarHelper {
|
||||||
val preferenceKey = "nav_bar_items"
|
val preferenceKey = "nav_bar_items"
|
||||||
|
|
||||||
|
val defaultNavBarItems = listOf(
|
||||||
|
NavBarItem(
|
||||||
|
R.id.homeFragment,
|
||||||
|
R.string.startpage
|
||||||
|
),
|
||||||
|
NavBarItem(
|
||||||
|
R.id.subscriptionsFragment,
|
||||||
|
R.string.subscriptions
|
||||||
|
),
|
||||||
|
NavBarItem(
|
||||||
|
R.id.libraryFragment,
|
||||||
|
R.string.library
|
||||||
|
)
|
||||||
|
)
|
||||||
|
|
||||||
val mapper = ObjectMapper()
|
val mapper = ObjectMapper()
|
||||||
|
|
||||||
fun getNavBarItems(): List<NavBarItem> {
|
fun getNavBarItems(): List<NavBarItem> {
|
||||||
@ -27,7 +41,7 @@ object NavBarHelper {
|
|||||||
type
|
type
|
||||||
)
|
)
|
||||||
} catch (e: Exception) {
|
} catch (e: Exception) {
|
||||||
return navBarItems
|
return defaultNavBarItems
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user