ui: add fade through transitions to main ui
Add fade through transitions to the main navigation. This just looks nicer. This currently excludes the search menu, however.
This commit is contained in:
parent
114d355011
commit
00dec358ab
8 changed files with 27 additions and 17 deletions
|
@ -25,6 +25,7 @@ import androidx.activity.OnBackPressedCallback
|
||||||
import androidx.fragment.app.activityViewModels
|
import androidx.fragment.app.activityViewModels
|
||||||
import androidx.navigation.findNavController
|
import androidx.navigation.findNavController
|
||||||
import androidx.navigation.fragment.findNavController
|
import androidx.navigation.fragment.findNavController
|
||||||
|
import com.google.android.material.transition.MaterialFadeThrough
|
||||||
import org.oxycblt.auxio.databinding.FragmentMainBinding
|
import org.oxycblt.auxio.databinding.FragmentMainBinding
|
||||||
import org.oxycblt.auxio.music.Music
|
import org.oxycblt.auxio.music.Music
|
||||||
import org.oxycblt.auxio.music.Song
|
import org.oxycblt.auxio.music.Song
|
||||||
|
@ -46,6 +47,12 @@ class MainFragment : ViewBindingFragment<FragmentMainBinding>() {
|
||||||
private val navModel: NavigationViewModel by activityViewModels()
|
private val navModel: NavigationViewModel by activityViewModels()
|
||||||
private var callback: DynamicBackPressedCallback? = null
|
private var callback: DynamicBackPressedCallback? = null
|
||||||
|
|
||||||
|
override fun onCreate(savedInstanceState: Bundle?) {
|
||||||
|
super.onCreate(savedInstanceState)
|
||||||
|
enterTransition = MaterialFadeThrough()
|
||||||
|
exitTransition = MaterialFadeThrough()
|
||||||
|
}
|
||||||
|
|
||||||
override fun onCreateBinding(inflater: LayoutInflater) = FragmentMainBinding.inflate(inflater)
|
override fun onCreateBinding(inflater: LayoutInflater) = FragmentMainBinding.inflate(inflater)
|
||||||
|
|
||||||
override fun onBindingCreated(binding: FragmentMainBinding, savedInstanceState: Bundle?) {
|
override fun onBindingCreated(binding: FragmentMainBinding, savedInstanceState: Bundle?) {
|
||||||
|
|
|
@ -27,6 +27,7 @@ import androidx.core.net.toUri
|
||||||
import androidx.core.view.updatePadding
|
import androidx.core.view.updatePadding
|
||||||
import androidx.navigation.fragment.findNavController
|
import androidx.navigation.fragment.findNavController
|
||||||
import com.google.android.material.bottomsheet.BottomSheetDialogFragment
|
import com.google.android.material.bottomsheet.BottomSheetDialogFragment
|
||||||
|
import com.google.android.material.transition.MaterialFadeThrough
|
||||||
import org.oxycblt.auxio.BuildConfig
|
import org.oxycblt.auxio.BuildConfig
|
||||||
import org.oxycblt.auxio.R
|
import org.oxycblt.auxio.R
|
||||||
import org.oxycblt.auxio.databinding.FragmentAboutBinding
|
import org.oxycblt.auxio.databinding.FragmentAboutBinding
|
||||||
|
@ -51,6 +52,12 @@ import org.oxycblt.auxio.util.textSafe
|
||||||
class AboutFragment : ViewBindingFragment<FragmentAboutBinding>() {
|
class AboutFragment : ViewBindingFragment<FragmentAboutBinding>() {
|
||||||
private val homeModel: HomeViewModel by androidActivityViewModels()
|
private val homeModel: HomeViewModel by androidActivityViewModels()
|
||||||
|
|
||||||
|
override fun onCreate(savedInstanceState: Bundle?) {
|
||||||
|
super.onCreate(savedInstanceState)
|
||||||
|
enterTransition = MaterialFadeThrough()
|
||||||
|
exitTransition = MaterialFadeThrough()
|
||||||
|
}
|
||||||
|
|
||||||
override fun onCreateBinding(inflater: LayoutInflater) = FragmentAboutBinding.inflate(inflater)
|
override fun onCreateBinding(inflater: LayoutInflater) = FragmentAboutBinding.inflate(inflater)
|
||||||
|
|
||||||
override fun onBindingCreated(binding: FragmentAboutBinding, savedInstanceState: Bundle?) {
|
override fun onBindingCreated(binding: FragmentAboutBinding, savedInstanceState: Bundle?) {
|
||||||
|
|
|
@ -21,6 +21,7 @@ import android.os.Bundle
|
||||||
import android.view.LayoutInflater
|
import android.view.LayoutInflater
|
||||||
import androidx.fragment.app.Fragment
|
import androidx.fragment.app.Fragment
|
||||||
import androidx.navigation.fragment.findNavController
|
import androidx.navigation.fragment.findNavController
|
||||||
|
import com.google.android.material.transition.MaterialFadeThrough
|
||||||
import org.oxycblt.auxio.databinding.FragmentSettingsBinding
|
import org.oxycblt.auxio.databinding.FragmentSettingsBinding
|
||||||
import org.oxycblt.auxio.ui.fragment.ViewBindingFragment
|
import org.oxycblt.auxio.ui.fragment.ViewBindingFragment
|
||||||
|
|
||||||
|
@ -29,6 +30,12 @@ import org.oxycblt.auxio.ui.fragment.ViewBindingFragment
|
||||||
* @author OxygenCobalt
|
* @author OxygenCobalt
|
||||||
*/
|
*/
|
||||||
class SettingsFragment : ViewBindingFragment<FragmentSettingsBinding>() {
|
class SettingsFragment : ViewBindingFragment<FragmentSettingsBinding>() {
|
||||||
|
override fun onCreate(savedInstanceState: Bundle?) {
|
||||||
|
super.onCreate(savedInstanceState)
|
||||||
|
enterTransition = MaterialFadeThrough()
|
||||||
|
exitTransition = MaterialFadeThrough()
|
||||||
|
}
|
||||||
|
|
||||||
override fun onCreateBinding(inflater: LayoutInflater) =
|
override fun onCreateBinding(inflater: LayoutInflater) =
|
||||||
FragmentSettingsBinding.inflate(inflater)
|
FragmentSettingsBinding.inflate(inflater)
|
||||||
|
|
||||||
|
|
|
@ -6,7 +6,6 @@
|
||||||
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"
|
||||||
android:background="?attr/colorSurface"
|
|
||||||
app:defaultNavHost="true"
|
app:defaultNavHost="true"
|
||||||
app:navGraph="@navigation/nav_main"
|
app:navGraph="@navigation/nav_main"
|
||||||
tools:layout="@layout/fragment_main" />
|
tools:layout="@layout/fragment_main" />
|
|
@ -5,6 +5,7 @@
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:orientation="vertical"
|
android:orientation="vertical"
|
||||||
|
android:background="?attr/colorSurface"
|
||||||
tools:context=".settings.AboutFragment">
|
tools:context=".settings.AboutFragment">
|
||||||
|
|
||||||
<org.oxycblt.auxio.ui.coordinator.EdgeAppBarLayout
|
<org.oxycblt.auxio.ui.coordinator.EdgeAppBarLayout
|
||||||
|
|
|
@ -4,7 +4,8 @@
|
||||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="match_parent"
|
android:layout_height="match_parent"
|
||||||
android:orientation="vertical">
|
android:orientation="vertical"
|
||||||
|
android:background="?attr/colorSurface">
|
||||||
|
|
||||||
<org.oxycblt.auxio.ui.coordinator.EdgeAppBarLayout
|
<org.oxycblt.auxio.ui.coordinator.EdgeAppBarLayout
|
||||||
android:id="@+id/settings_appbar"
|
android:id="@+id/settings_appbar"
|
||||||
|
|
|
@ -78,11 +78,7 @@
|
||||||
tools:layout="@layout/fragment_home">
|
tools:layout="@layout/fragment_home">
|
||||||
<action
|
<action
|
||||||
android:id="@+id/action_show_search"
|
android:id="@+id/action_show_search"
|
||||||
app:destination="@id/search_fragment"
|
app:destination="@id/search_fragment" />
|
||||||
app:enterAnim="@anim/nav_default_enter_anim"
|
|
||||||
app:exitAnim="@anim/nav_default_exit_anim"
|
|
||||||
app:popEnterAnim="@anim/nav_default_pop_enter_anim"
|
|
||||||
app:popExitAnim="@anim/nav_default_pop_exit_anim" />
|
|
||||||
<action
|
<action
|
||||||
android:id="@+id/action_show_genre"
|
android:id="@+id/action_show_genre"
|
||||||
app:destination="@id/genre_detail_fragment" />
|
app:destination="@id/genre_detail_fragment" />
|
||||||
|
|
|
@ -10,21 +10,13 @@
|
||||||
tools:layout="@layout/fragment_main">
|
tools:layout="@layout/fragment_main">
|
||||||
<action
|
<action
|
||||||
android:id="@+id/action_show_queue"
|
android:id="@+id/action_show_queue"
|
||||||
app:destination="@id/queue_fragment"
|
app:destination="@id/queue_fragment" />
|
||||||
app:enterAnim="@anim/nav_slide_enter_anim"
|
|
||||||
app:exitAnim="@anim/nav_slide_exit_anim"
|
|
||||||
app:popEnterAnim="@anim/nav_slide_pop_enter_anim"
|
|
||||||
app:popExitAnim="@anim/nav_slide_pop_exit_anim" />
|
|
||||||
<action
|
<action
|
||||||
android:id="@+id/action_show_settings"
|
android:id="@+id/action_show_settings"
|
||||||
app:destination="@id/settings_fragment" />
|
app:destination="@id/settings_fragment" />
|
||||||
<action
|
<action
|
||||||
android:id="@+id/action_show_about"
|
android:id="@+id/action_show_about"
|
||||||
app:destination="@id/about_fragment"
|
app:destination="@id/about_fragment" />
|
||||||
app:enterAnim="@anim/nav_default_enter_anim"
|
|
||||||
app:exitAnim="@anim/nav_default_exit_anim"
|
|
||||||
app:popEnterAnim="@anim/nav_default_pop_enter_anim"
|
|
||||||
app:popExitAnim="@anim/nav_default_pop_exit_anim" />
|
|
||||||
<action
|
<action
|
||||||
android:id="@+id/action_show_details"
|
android:id="@+id/action_show_details"
|
||||||
app:destination="@id/song_detail_dialog" />
|
app:destination="@id/song_detail_dialog" />
|
||||||
|
|
Loading…
Reference in a new issue