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 {
|
signingConfigs {
|
||||||
release {
|
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'))
|
storeFile file(getProperty(properties, 'storeFile'))
|
||||||
keyAlias getProperty(properties, 'keyAlias')
|
keyAlias getProperty(properties, 'keyAlias')
|
||||||
storePassword getProperty(properties, 'storePassword')
|
storePassword getProperty(properties, 'storePassword')
|
||||||
|
|
|
@ -51,8 +51,7 @@ fun EditText.appHandleColor(): EditText {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
fun View.translateXAnimate(value: Float) {
|
fun View.translateXAnimate(value: Float) {
|
||||||
println("translateXAnimate $value")
|
|
||||||
ObjectAnimator.ofFloat(this, "translationY", value)
|
ObjectAnimator.ofFloat(this, "translationY", value)
|
||||||
.apply {
|
.apply {
|
||||||
duration = 300
|
duration = 300
|
||||||
|
|
|
@ -27,9 +27,6 @@ open class AbsMusicServiceFragment(@LayoutRes layout: Int) : Fragment(layout),
|
||||||
|
|
||||||
val navOptions by lazy {
|
val navOptions by lazy {
|
||||||
navOptions {
|
navOptions {
|
||||||
popUpTo(R.id.action_home) {
|
|
||||||
inclusive = false
|
|
||||||
}
|
|
||||||
launchSingleTop = false
|
launchSingleTop = false
|
||||||
anim {
|
anim {
|
||||||
enter = R.anim.retro_fragment_open_enter
|
enter = R.anim.retro_fragment_open_enter
|
||||||
|
|
|
@ -5,6 +5,7 @@ import android.view.Menu
|
||||||
import android.view.MenuInflater
|
import android.view.MenuInflater
|
||||||
import android.view.MenuItem
|
import android.view.MenuItem
|
||||||
import androidx.core.text.HtmlCompat
|
import androidx.core.text.HtmlCompat
|
||||||
|
import androidx.navigation.fragment.NavHostFragment
|
||||||
import androidx.navigation.fragment.findNavController
|
import androidx.navigation.fragment.findNavController
|
||||||
import androidx.navigation.ui.NavigationUI
|
import androidx.navigation.ui.NavigationUI
|
||||||
import code.name.monkey.appthemehelper.ThemeStore
|
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.R
|
||||||
import code.name.monkey.retromusic.dialogs.CreatePlaylistDialog
|
import code.name.monkey.retromusic.dialogs.CreatePlaylistDialog
|
||||||
import code.name.monkey.retromusic.dialogs.ImportPlaylistDialog
|
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.LibraryViewModel
|
||||||
import code.name.monkey.retromusic.fragments.base.AbsMainActivityFragment
|
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.state.NowPlayingPanelState
|
||||||
|
import code.name.monkey.retromusic.util.PreferenceUtil
|
||||||
import kotlinx.android.synthetic.main.fragment_library.*
|
import kotlinx.android.synthetic.main.fragment_library.*
|
||||||
import org.koin.androidx.viewmodel.ext.android.sharedViewModel
|
import org.koin.androidx.viewmodel.ext.android.sharedViewModel
|
||||||
|
|
||||||
|
@ -53,10 +56,19 @@ class LibraryFragment : AbsMainActivityFragment(R.layout.fragment_library) {
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun setupNavigationController() {
|
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)
|
NavigationUI.setupWithNavController(mainActivity.getBottomNavigationView(), navController)
|
||||||
navController.addOnDestinationChangedListener { controller, destination, arguments ->
|
navController.addOnDestinationChangedListener { _, _, _ ->
|
||||||
appBarLayout.setExpanded(true,true)
|
appBarLayout.setExpanded(true, true)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -39,5 +39,4 @@ data class CategoryInfo(
|
||||||
Genres(R.id.action_genre, R.string.genres, R.drawable.ic_guitar),
|
Genres(R.id.action_genre, R.string.genres, R.drawable.ic_guitar),
|
||||||
Folder(R.id.action_folder, R.string.folders, R.drawable.ic_folder);
|
Folder(R.id.action_folder, R.string.folders, R.drawable.ic_folder);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
|
@ -28,10 +28,10 @@
|
||||||
tools:ignore="UnusedAttribute">
|
tools:ignore="UnusedAttribute">
|
||||||
|
|
||||||
<com.google.android.material.textview.MaterialTextView
|
<com.google.android.material.textview.MaterialTextView
|
||||||
|
android:id="@+id/appNameText"
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:layout_gravity="center"
|
android:layout_gravity="center"
|
||||||
android:id="@+id/appNameText"
|
|
||||||
android:textAppearance="@style/TextViewHeadline6"
|
android:textAppearance="@style/TextViewHeadline6"
|
||||||
android:textStyle="bold" />
|
android:textStyle="bold" />
|
||||||
</androidx.appcompat.widget.Toolbar>
|
</androidx.appcompat.widget.Toolbar>
|
||||||
|
@ -48,7 +48,5 @@
|
||||||
android:name="androidx.navigation.fragment.NavHostFragment"
|
android:name="androidx.navigation.fragment.NavHostFragment"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="match_parent"
|
android:layout_height="match_parent"
|
||||||
app:defaultNavHost="true"
|
app:layout_behavior="com.google.android.material.appbar.AppBarLayout$ScrollingViewBehavior" />
|
||||||
app:layout_behavior="com.google.android.material.appbar.AppBarLayout$ScrollingViewBehavior"
|
|
||||||
app:navGraph="@navigation/library_graph" />
|
|
||||||
</androidx.coordinatorlayout.widget.CoordinatorLayout>
|
</androidx.coordinatorlayout.widget.CoordinatorLayout>
|
|
@ -59,15 +59,6 @@
|
||||||
android:title="@string/pref_keep_screen_on_title"
|
android:title="@string/pref_keep_screen_on_title"
|
||||||
app:icon="@drawable/ic_settings_brigntness" />
|
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.ATEPreferenceCategory>
|
||||||
<code.name.monkey.appthemehelper.common.prefs.supportv7.ATEListPreference
|
<code.name.monkey.appthemehelper.common.prefs.supportv7.ATEListPreference
|
||||||
|
|
Loading…
Reference in a new issue