Code Cleanup
This commit is contained in:
parent
350cba2042
commit
9af80592b3
4 changed files with 21 additions and 16 deletions
|
@ -34,6 +34,7 @@ import code.name.monkey.retromusic.extensions.accentColor
|
|||
import code.name.monkey.retromusic.extensions.dip
|
||||
import code.name.monkey.retromusic.extensions.drawNextToNavbar
|
||||
import code.name.monkey.retromusic.helper.MusicPlayerRemote
|
||||
import code.name.monkey.retromusic.interfaces.IScrollHelper
|
||||
import code.name.monkey.retromusic.util.ThemedFastScroller.create
|
||||
import com.google.android.material.shape.MaterialShapeDrawable
|
||||
import com.google.android.material.transition.MaterialFadeThrough
|
||||
|
@ -42,7 +43,7 @@ import me.zhanghai.android.fastscroll.FastScroller
|
|||
import me.zhanghai.android.fastscroll.FastScrollerBuilder
|
||||
|
||||
abstract class AbsRecyclerViewFragment<A : RecyclerView.Adapter<*>, LM : RecyclerView.LayoutManager> :
|
||||
AbsMainActivityFragment(R.layout.fragment_main_recycler) {
|
||||
AbsMainActivityFragment(R.layout.fragment_main_recycler), IScrollHelper {
|
||||
|
||||
private var _binding: FragmentMainRecyclerBinding? = null
|
||||
private val binding get() = _binding!!
|
||||
|
@ -200,7 +201,7 @@ abstract class AbsRecyclerViewFragment<A : RecyclerView.Adapter<*>, LM : Recycle
|
|||
|
||||
val container get() = binding.root
|
||||
|
||||
fun scrollToTop() {
|
||||
override fun scrollToTop() {
|
||||
recyclerView.scrollToPosition(0)
|
||||
binding.appBarLayout.setExpanded(true, true)
|
||||
}
|
||||
|
|
|
@ -40,6 +40,7 @@ import code.name.monkey.retromusic.extensions.drawNextToNavbar
|
|||
import code.name.monkey.retromusic.fragments.base.AbsMainActivityFragment
|
||||
import code.name.monkey.retromusic.glide.GlideApp
|
||||
import code.name.monkey.retromusic.glide.RetroGlideExtension
|
||||
import code.name.monkey.retromusic.interfaces.IScrollHelper
|
||||
import code.name.monkey.retromusic.util.PreferenceUtil
|
||||
import com.google.android.gms.cast.framework.CastButtonFactory
|
||||
import com.google.android.material.shape.MaterialShapeDrawable
|
||||
|
@ -47,7 +48,7 @@ import com.google.android.material.transition.MaterialFadeThrough
|
|||
import com.google.android.material.transition.MaterialSharedAxis
|
||||
|
||||
class HomeFragment :
|
||||
AbsMainActivityFragment(if (PreferenceUtil.isHomeBanner) R.layout.fragment_banner_home else R.layout.fragment_home) {
|
||||
AbsMainActivityFragment(if (PreferenceUtil.isHomeBanner) R.layout.fragment_banner_home else R.layout.fragment_home), IScrollHelper {
|
||||
|
||||
private var _binding: HomeBindingAdapter? = null
|
||||
private val binding get() = _binding!!
|
||||
|
@ -189,7 +190,7 @@ class HomeFragment :
|
|||
CastButtonFactory.setUpMediaRouteButton(requireContext(), menu, R.id.action_cast)
|
||||
}
|
||||
|
||||
fun scrollToTop() {
|
||||
override fun scrollToTop() {
|
||||
binding.container.scrollTo(0, 0)
|
||||
binding.appBarLayout.setExpanded(true)
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue