Dynamic navigation
This commit is contained in:
parent
a4bbc9ce5a
commit
76389c45f9
7 changed files with 20 additions and 24 deletions
|
@ -25,7 +25,7 @@ android {
|
|||
}
|
||||
signingConfigs {
|
||||
release {
|
||||
Properties properties = getProperties('/Users/apple/Documents/Github/retro.properties ')
|
||||
Properties properties = getProperties('C:/Users/h4h13/Documents/GitHub/retro.properties ')
|
||||
storeFile file(getProperty(properties, 'storeFile'))
|
||||
keyAlias getProperty(properties, 'keyAlias')
|
||||
storePassword getProperty(properties, 'storePassword')
|
||||
|
|
|
@ -51,8 +51,7 @@ fun EditText.appHandleColor(): EditText {
|
|||
}
|
||||
|
||||
|
||||
fun View.translateXAnimate(value: Float) {
|
||||
println("translateXAnimate $value")
|
||||
fun View.translateXAnimate(value: Float) {
|
||||
ObjectAnimator.ofFloat(this, "translationY", value)
|
||||
.apply {
|
||||
duration = 300
|
||||
|
|
|
@ -27,9 +27,6 @@ open class AbsMusicServiceFragment(@LayoutRes layout: Int) : Fragment(layout),
|
|||
|
||||
val navOptions by lazy {
|
||||
navOptions {
|
||||
popUpTo(R.id.action_home) {
|
||||
inclusive = false
|
||||
}
|
||||
launchSingleTop = false
|
||||
anim {
|
||||
enter = R.anim.retro_fragment_open_enter
|
||||
|
|
|
@ -5,6 +5,7 @@ import android.view.Menu
|
|||
import android.view.MenuInflater
|
||||
import android.view.MenuItem
|
||||
import androidx.core.text.HtmlCompat
|
||||
import androidx.navigation.fragment.NavHostFragment
|
||||
import androidx.navigation.fragment.findNavController
|
||||
import androidx.navigation.ui.NavigationUI
|
||||
import code.name.monkey.appthemehelper.ThemeStore
|
||||
|
@ -13,10 +14,12 @@ import code.name.monkey.appthemehelper.util.ToolbarContentTintHelper
|
|||
import code.name.monkey.retromusic.R
|
||||
import code.name.monkey.retromusic.dialogs.CreatePlaylistDialog
|
||||
import code.name.monkey.retromusic.dialogs.ImportPlaylistDialog
|
||||
import code.name.monkey.retromusic.extensions.findNavController
|
||||
import code.name.monkey.retromusic.extensions.whichFragment
|
||||
import code.name.monkey.retromusic.fragments.LibraryViewModel
|
||||
import code.name.monkey.retromusic.fragments.base.AbsMainActivityFragment
|
||||
import code.name.monkey.retromusic.model.CategoryInfo
|
||||
import code.name.monkey.retromusic.state.NowPlayingPanelState
|
||||
import code.name.monkey.retromusic.util.PreferenceUtil
|
||||
import kotlinx.android.synthetic.main.fragment_library.*
|
||||
import org.koin.androidx.viewmodel.ext.android.sharedViewModel
|
||||
|
||||
|
@ -53,10 +56,19 @@ class LibraryFragment : AbsMainActivityFragment(R.layout.fragment_library) {
|
|||
}
|
||||
|
||||
private fun setupNavigationController() {
|
||||
val navController = findNavController(R.id.fragment_container)
|
||||
val navHostFragment = whichFragment<NavHostFragment>(R.id.fragment_container)
|
||||
val navController = navHostFragment.navController
|
||||
val navInflater = navController.navInflater
|
||||
val navGraph = navInflater.inflate(R.navigation.library_graph)
|
||||
|
||||
val categoryInfo: CategoryInfo = PreferenceUtil.libraryCategory.first { it.visible }
|
||||
if (categoryInfo.visible) {
|
||||
navGraph.startDestination = categoryInfo.category.id
|
||||
}
|
||||
navController.graph = navGraph
|
||||
NavigationUI.setupWithNavController(mainActivity.getBottomNavigationView(), navController)
|
||||
navController.addOnDestinationChangedListener { controller, destination, arguments ->
|
||||
appBarLayout.setExpanded(true,true)
|
||||
navController.addOnDestinationChangedListener { _, _, _ ->
|
||||
appBarLayout.setExpanded(true, true)
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -39,5 +39,4 @@ data class CategoryInfo(
|
|||
Genres(R.id.action_genre, R.string.genres, R.drawable.ic_guitar),
|
||||
Folder(R.id.action_folder, R.string.folders, R.drawable.ic_folder);
|
||||
}
|
||||
|
||||
}
|
|
@ -28,10 +28,10 @@
|
|||
tools:ignore="UnusedAttribute">
|
||||
|
||||
<com.google.android.material.textview.MaterialTextView
|
||||
android:id="@+id/appNameText"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center"
|
||||
android:id="@+id/appNameText"
|
||||
android:textAppearance="@style/TextViewHeadline6"
|
||||
android:textStyle="bold" />
|
||||
</androidx.appcompat.widget.Toolbar>
|
||||
|
@ -48,7 +48,5 @@
|
|||
android:name="androidx.navigation.fragment.NavHostFragment"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
app:defaultNavHost="true"
|
||||
app:layout_behavior="com.google.android.material.appbar.AppBarLayout$ScrollingViewBehavior"
|
||||
app:navGraph="@navigation/library_graph" />
|
||||
app:layout_behavior="com.google.android.material.appbar.AppBarLayout$ScrollingViewBehavior" />
|
||||
</androidx.coordinatorlayout.widget.CoordinatorLayout>
|
|
@ -59,15 +59,6 @@
|
|||
android:title="@string/pref_keep_screen_on_title"
|
||||
app:icon="@drawable/ic_settings_brigntness" />
|
||||
|
||||
<code.name.monkey.appthemehelper.common.prefs.supportv7.ATESeekBarPreference
|
||||
android:defaultValue="16"
|
||||
android:key="dialog_corner"
|
||||
android:layout="@layout/list_item_view_seekbar"
|
||||
android:max="50"
|
||||
android:summary="@string/pref_dialog_corner_summary"
|
||||
android:title="@string/pref_dialog_corner_title"
|
||||
app:icon="@drawable/ic_rounded_corner"
|
||||
app:showSeekBarValue="true" />
|
||||
|
||||
</code.name.monkey.appthemehelper.common.prefs.supportv7.ATEPreferenceCategory>
|
||||
<code.name.monkey.appthemehelper.common.prefs.supportv7.ATEListPreference
|
||||
|
|
Loading…
Reference in a new issue