added scroll helper to main activity
This commit is contained in:
parent
967c6fb5ac
commit
5d34055fd0
20 changed files with 187 additions and 134 deletions
|
@ -176,6 +176,8 @@ dependencies {
|
||||||
|
|
||||||
implementation 'com.github.AdrienPoupa:jaudiotagger:2.2.3'
|
implementation 'com.github.AdrienPoupa:jaudiotagger:2.2.3'
|
||||||
|
|
||||||
|
implementation 'com.github.ologe:scroll-helper:2.0.0-beta01'
|
||||||
|
|
||||||
implementation 'com.anjlab.android.iab.v3:library:1.1.0'
|
implementation 'com.anjlab.android.iab.v3:library:1.1.0'
|
||||||
implementation 'com.r0adkll:slidableactivity:2.1.0'
|
implementation 'com.r0adkll:slidableactivity:2.1.0'
|
||||||
implementation 'com.heinrichreimersoftware:material-intro:1.6'
|
implementation 'com.heinrichreimersoftware:material-intro:1.6'
|
||||||
|
|
|
@ -0,0 +1,67 @@
|
||||||
|
package code.name.monkey.retromusic
|
||||||
|
|
||||||
|
import android.view.View
|
||||||
|
import androidx.fragment.app.Fragment
|
||||||
|
import androidx.fragment.app.FragmentActivity
|
||||||
|
import androidx.recyclerview.widget.RecyclerView
|
||||||
|
import androidx.viewpager2.widget.ViewPager2
|
||||||
|
import code.name.monkey.retromusic.fragments.player.normal.PlayerFragment
|
||||||
|
import dev.olog.scrollhelper.ScrollHelper
|
||||||
|
|
||||||
|
class RetroScrollHelper(
|
||||||
|
private val activity: FragmentActivity
|
||||||
|
) : ScrollHelper(activity,
|
||||||
|
true,
|
||||||
|
false // TODO when true, scrolls both bottomsheet and bottom navigation
|
||||||
|
) {
|
||||||
|
|
||||||
|
private val skipFragment = listOf(
|
||||||
|
PlayerFragment::class.java.name
|
||||||
|
)
|
||||||
|
|
||||||
|
// TODO every fragment has to have it's unique tag in order to work correctly
|
||||||
|
// here you can decide what fragment will be processed by the library
|
||||||
|
// probably you want to skip player fragments, ecc ..
|
||||||
|
override fun shouldSkipFragment(fragment: Fragment): Boolean {
|
||||||
|
return fragment::class.java.name in skipFragment
|
||||||
|
}
|
||||||
|
|
||||||
|
override fun findBottomNavigation(): View? {
|
||||||
|
return activity.findViewById(R.id.bottomNavigationView)
|
||||||
|
}
|
||||||
|
|
||||||
|
override fun findBottomSheet(): View? {
|
||||||
|
return activity.findViewById(R.id.slidingPanel)
|
||||||
|
}
|
||||||
|
|
||||||
|
override fun findFab(fragment: Fragment): View? {
|
||||||
|
return null
|
||||||
|
}
|
||||||
|
|
||||||
|
override fun findRecyclerView(fragment: Fragment): RecyclerView? {
|
||||||
|
return fragment.requireView().findViewById(R.id.recyclerView)
|
||||||
|
}
|
||||||
|
|
||||||
|
override fun findToolbar(fragment: Fragment): View? {
|
||||||
|
return fragment.requireActivity().findViewById(R.id.toolbarContainer)
|
||||||
|
}
|
||||||
|
|
||||||
|
override fun findTabLayout(fragment: Fragment): View? {
|
||||||
|
return null
|
||||||
|
}
|
||||||
|
|
||||||
|
override fun findViewPager(fragment: Fragment): ViewPager2? {
|
||||||
|
return null
|
||||||
|
}
|
||||||
|
|
||||||
|
// TODO override this if you want to apply custom padding
|
||||||
|
override fun updateRecyclerViewPadding(
|
||||||
|
fragment: Fragment,
|
||||||
|
recyclerView: RecyclerView,
|
||||||
|
topPadding: Int,
|
||||||
|
bottomPadding: Int
|
||||||
|
) {
|
||||||
|
super.updateRecyclerViewPadding(fragment, recyclerView, topPadding, bottomPadding)
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -55,6 +55,7 @@ import java.util.List;
|
||||||
import code.name.monkey.appthemehelper.util.ATHUtil;
|
import code.name.monkey.appthemehelper.util.ATHUtil;
|
||||||
import code.name.monkey.appthemehelper.util.ToolbarContentTintHelper;
|
import code.name.monkey.appthemehelper.util.ToolbarContentTintHelper;
|
||||||
import code.name.monkey.retromusic.R;
|
import code.name.monkey.retromusic.R;
|
||||||
|
import code.name.monkey.retromusic.RetroScrollHelper;
|
||||||
import code.name.monkey.retromusic.activities.base.AbsSlidingMusicPanelActivity;
|
import code.name.monkey.retromusic.activities.base.AbsSlidingMusicPanelActivity;
|
||||||
import code.name.monkey.retromusic.dialogs.CreatePlaylistDialog;
|
import code.name.monkey.retromusic.dialogs.CreatePlaylistDialog;
|
||||||
import code.name.monkey.retromusic.fragments.base.AbsLibraryPagerRecyclerViewCustomGridSizeFragment;
|
import code.name.monkey.retromusic.fragments.base.AbsLibraryPagerRecyclerViewCustomGridSizeFragment;
|
||||||
|
@ -83,6 +84,7 @@ import code.name.monkey.retromusic.util.NavigationUtil;
|
||||||
import code.name.monkey.retromusic.util.PreferenceUtil;
|
import code.name.monkey.retromusic.util.PreferenceUtil;
|
||||||
import code.name.monkey.retromusic.util.RetroColorUtil;
|
import code.name.monkey.retromusic.util.RetroColorUtil;
|
||||||
import code.name.monkey.retromusic.util.RetroUtil;
|
import code.name.monkey.retromusic.util.RetroUtil;
|
||||||
|
import dev.olog.scrollhelper.ScrollHelper;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Created by hemanths on 2020-02-19.
|
* Created by hemanths on 2020-02-19.
|
||||||
|
@ -119,6 +121,9 @@ public class MainActivity extends AbsSlidingMusicPanelActivity
|
||||||
private Toolbar mToolbar;
|
private Toolbar mToolbar;
|
||||||
private MaterialCardView mToolbarContainer;
|
private MaterialCardView mToolbarContainer;
|
||||||
|
|
||||||
|
@SuppressWarnings("FieldCanBeLocal")
|
||||||
|
private ScrollHelper scrollHelper;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void onCreate(@Nullable final Bundle savedInstanceState) {
|
protected void onCreate(@Nullable final Bundle savedInstanceState) {
|
||||||
setDrawUnderStatusBar();
|
setDrawUnderStatusBar();
|
||||||
|
@ -151,6 +156,8 @@ public class MainActivity extends AbsSlidingMusicPanelActivity
|
||||||
checkShowChangelog();
|
checkShowChangelog();
|
||||||
AppRater.appLaunched(this);
|
AppRater.appLaunched(this);
|
||||||
setupToolbar();
|
setupToolbar();
|
||||||
|
|
||||||
|
scrollHelper = new RetroScrollHelper(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -111,10 +111,14 @@ abstract class AbsSlidingMusicPanelActivity : AbsMusicServiceActivity(),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
override fun onPause() {
|
||||||
|
super.onPause()
|
||||||
|
bottomSheetBehavior.removeBottomSheetCallback(bottomSheetCallbackList)
|
||||||
|
}
|
||||||
|
|
||||||
override fun onDestroy() {
|
override fun onDestroy() {
|
||||||
super.onDestroy()
|
super.onDestroy()
|
||||||
bottomSheetBehavior.removeBottomSheetCallback(bottomSheetCallbackList)
|
navigationBarColorAnimator?.cancel() // just in case
|
||||||
if (navigationBarColorAnimator != null) navigationBarColorAnimator?.cancel() // just in case
|
|
||||||
}
|
}
|
||||||
|
|
||||||
protected fun wrapSlidingMusicPanel(@LayoutRes resId: Int): View {
|
protected fun wrapSlidingMusicPanel(@LayoutRes resId: Int): View {
|
||||||
|
@ -217,8 +221,8 @@ abstract class AbsSlidingMusicPanelActivity : AbsMusicServiceActivity(),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
fun setBottomBarVisibility(gone: Int) {
|
fun setBottomBarVisibility(visibility: Int) {
|
||||||
bottomNavigationView.visibility = gone
|
bottomNavigationView.visibility = visibility
|
||||||
hideBottomBar(false)
|
hideBottomBar(false)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -0,0 +1,10 @@
|
||||||
|
package code.name.monkey.retromusic.extensions
|
||||||
|
|
||||||
|
import android.content.Context
|
||||||
|
import androidx.annotation.DimenRes
|
||||||
|
|
||||||
|
@Suppress("NOTHING_TO_INLINE")
|
||||||
|
inline fun Context.dip(value: Int): Int = (value * resources.displayMetrics.density).toInt()
|
||||||
|
|
||||||
|
@Suppress("NOTHING_TO_INLINE")
|
||||||
|
inline fun Context.dimen(@DimenRes resource: Int): Int = resources.getDimensionPixelSize(resource)
|
|
@ -8,17 +8,13 @@ import androidx.annotation.NonNull
|
||||||
import androidx.annotation.StringRes
|
import androidx.annotation.StringRes
|
||||||
import androidx.recyclerview.widget.RecyclerView
|
import androidx.recyclerview.widget.RecyclerView
|
||||||
import code.name.monkey.retromusic.R
|
import code.name.monkey.retromusic.R
|
||||||
import code.name.monkey.retromusic.helper.MusicPlayerRemote
|
|
||||||
import code.name.monkey.retromusic.util.DensityUtil
|
|
||||||
import code.name.monkey.retromusic.util.ThemedFastScroller.create
|
import code.name.monkey.retromusic.util.ThemedFastScroller.create
|
||||||
import code.name.monkey.retromusic.views.ScrollingViewOnApplyWindowInsetsListener
|
|
||||||
import com.google.android.material.appbar.AppBarLayout
|
|
||||||
import kotlinx.android.synthetic.main.fragment_main_activity_recycler_view.*
|
import kotlinx.android.synthetic.main.fragment_main_activity_recycler_view.*
|
||||||
import me.zhanghai.android.fastscroll.FastScroller
|
import me.zhanghai.android.fastscroll.FastScroller
|
||||||
import me.zhanghai.android.fastscroll.FastScrollerBuilder
|
import me.zhanghai.android.fastscroll.FastScrollerBuilder
|
||||||
|
|
||||||
abstract class AbsLibraryPagerRecyclerViewFragment<A : RecyclerView.Adapter<*>, LM : RecyclerView.LayoutManager> :
|
abstract class AbsLibraryPagerRecyclerViewFragment<A : RecyclerView.Adapter<*>, LM : RecyclerView.LayoutManager> :
|
||||||
AbsLibraryPagerFragment(), AppBarLayout.OnOffsetChangedListener {
|
AbsLibraryPagerFragment() {
|
||||||
|
|
||||||
protected var adapter: A? = null
|
protected var adapter: A? = null
|
||||||
protected var layoutManager: LM? = null
|
protected var layoutManager: LM? = null
|
||||||
|
@ -31,7 +27,6 @@ abstract class AbsLibraryPagerRecyclerViewFragment<A : RecyclerView.Adapter<*>,
|
||||||
|
|
||||||
override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
|
override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
|
||||||
super.onViewCreated(view, savedInstanceState)
|
super.onViewCreated(view, savedInstanceState)
|
||||||
mainActivity.addOnAppBarOffsetChangedListener(this)
|
|
||||||
initLayoutManager()
|
initLayoutManager()
|
||||||
initAdapter()
|
initAdapter()
|
||||||
setUpRecyclerView()
|
setUpRecyclerView()
|
||||||
|
@ -41,13 +36,6 @@ abstract class AbsLibraryPagerRecyclerViewFragment<A : RecyclerView.Adapter<*>,
|
||||||
recyclerView.layoutManager = layoutManager
|
recyclerView.layoutManager = layoutManager
|
||||||
recyclerView.adapter = adapter
|
recyclerView.adapter = adapter
|
||||||
val fastScroller = create(recyclerView)
|
val fastScroller = create(recyclerView)
|
||||||
recyclerView.setOnApplyWindowInsetsListener(
|
|
||||||
ScrollingViewOnApplyWindowInsetsListener(
|
|
||||||
recyclerView,
|
|
||||||
fastScroller
|
|
||||||
)
|
|
||||||
)
|
|
||||||
checkForPadding()
|
|
||||||
}
|
}
|
||||||
|
|
||||||
protected open fun createFastScroller(recyclerView: RecyclerView): FastScroller {
|
protected open fun createFastScroller(recyclerView: RecyclerView): FastScroller {
|
||||||
|
@ -60,7 +48,6 @@ abstract class AbsLibraryPagerRecyclerViewFragment<A : RecyclerView.Adapter<*>,
|
||||||
override fun onChanged() {
|
override fun onChanged() {
|
||||||
super.onChanged()
|
super.onChanged()
|
||||||
checkIsEmpty()
|
checkIsEmpty()
|
||||||
checkForPadding()
|
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
@ -78,18 +65,6 @@ abstract class AbsLibraryPagerRecyclerViewFragment<A : RecyclerView.Adapter<*>,
|
||||||
empty.visibility = if (adapter!!.itemCount == 0) View.VISIBLE else View.GONE
|
empty.visibility = if (adapter!!.itemCount == 0) View.VISIBLE else View.GONE
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun checkForPadding() {
|
|
||||||
val itemCount: Int = adapter?.itemCount ?: 0
|
|
||||||
val params = container.layoutParams as ViewGroup.MarginLayoutParams
|
|
||||||
if (itemCount > 0 && MusicPlayerRemote.playingQueue.isNotEmpty()) {
|
|
||||||
val height = DensityUtil.dip2px(requireContext(), 104f)
|
|
||||||
params.bottomMargin = height
|
|
||||||
} else {
|
|
||||||
val height = DensityUtil.dip2px(requireContext(), 52f)
|
|
||||||
params.bottomMargin = height
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private fun initLayoutManager() {
|
private fun initLayoutManager() {
|
||||||
layoutManager = createLayoutManager()
|
layoutManager = createLayoutManager()
|
||||||
}
|
}
|
||||||
|
@ -99,25 +74,6 @@ abstract class AbsLibraryPagerRecyclerViewFragment<A : RecyclerView.Adapter<*>,
|
||||||
@NonNull
|
@NonNull
|
||||||
protected abstract fun createAdapter(): A
|
protected abstract fun createAdapter(): A
|
||||||
|
|
||||||
override fun onOffsetChanged(p0: AppBarLayout?, i: Int) {
|
|
||||||
container.setPadding(
|
|
||||||
container.paddingLeft,
|
|
||||||
container.paddingTop,
|
|
||||||
container.paddingRight,
|
|
||||||
mainActivity.totalAppBarScrollingRange + i
|
|
||||||
)
|
|
||||||
}
|
|
||||||
|
|
||||||
override fun onQueueChanged() {
|
|
||||||
super.onQueueChanged()
|
|
||||||
checkForPadding()
|
|
||||||
}
|
|
||||||
|
|
||||||
override fun onServiceConnected() {
|
|
||||||
super.onServiceConnected()
|
|
||||||
checkForPadding()
|
|
||||||
}
|
|
||||||
|
|
||||||
protected fun invalidateLayoutManager() {
|
protected fun invalidateLayoutManager() {
|
||||||
initLayoutManager()
|
initLayoutManager()
|
||||||
recyclerView.layoutManager = layoutManager
|
recyclerView.layoutManager = layoutManager
|
||||||
|
@ -129,11 +85,6 @@ abstract class AbsLibraryPagerRecyclerViewFragment<A : RecyclerView.Adapter<*>,
|
||||||
recyclerView.adapter = adapter
|
recyclerView.adapter = adapter
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun onDestroyView() {
|
|
||||||
super.onDestroyView()
|
|
||||||
mainActivity.removeOnAppBarOffsetChangedListener(this)
|
|
||||||
}
|
|
||||||
|
|
||||||
fun recyclerView(): RecyclerView {
|
fun recyclerView(): RecyclerView {
|
||||||
return recyclerView
|
return recyclerView
|
||||||
}
|
}
|
||||||
|
|
|
@ -12,6 +12,7 @@ import code.name.monkey.retromusic.model.Album
|
||||||
import code.name.monkey.retromusic.mvp.presenter.AlbumsPresenter
|
import code.name.monkey.retromusic.mvp.presenter.AlbumsPresenter
|
||||||
import code.name.monkey.retromusic.mvp.presenter.AlbumsView
|
import code.name.monkey.retromusic.mvp.presenter.AlbumsView
|
||||||
import code.name.monkey.retromusic.util.PreferenceUtil
|
import code.name.monkey.retromusic.util.PreferenceUtil
|
||||||
|
import dev.olog.scrollhelper.layoutmanagers.OverScrollGridLayoutManager
|
||||||
import javax.inject.Inject
|
import javax.inject.Inject
|
||||||
|
|
||||||
class AlbumsFragment :
|
class AlbumsFragment :
|
||||||
|
@ -51,7 +52,7 @@ class AlbumsFragment :
|
||||||
get() = R.string.no_albums
|
get() = R.string.no_albums
|
||||||
|
|
||||||
override fun createLayoutManager(): GridLayoutManager {
|
override fun createLayoutManager(): GridLayoutManager {
|
||||||
return GridLayoutManager(requireActivity(), getGridSize())
|
return OverScrollGridLayoutManager(requireActivity(), getGridSize())
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun createAdapter(): AlbumAdapter {
|
override fun createAdapter(): AlbumAdapter {
|
||||||
|
|
|
@ -12,6 +12,7 @@ import code.name.monkey.retromusic.model.Artist
|
||||||
import code.name.monkey.retromusic.mvp.presenter.ArtistsPresenter
|
import code.name.monkey.retromusic.mvp.presenter.ArtistsPresenter
|
||||||
import code.name.monkey.retromusic.mvp.presenter.ArtistsView
|
import code.name.monkey.retromusic.mvp.presenter.ArtistsView
|
||||||
import code.name.monkey.retromusic.util.PreferenceUtil
|
import code.name.monkey.retromusic.util.PreferenceUtil
|
||||||
|
import dev.olog.scrollhelper.layoutmanagers.OverScrollGridLayoutManager
|
||||||
import javax.inject.Inject
|
import javax.inject.Inject
|
||||||
|
|
||||||
class ArtistsFragment :
|
class ArtistsFragment :
|
||||||
|
@ -63,7 +64,7 @@ class ArtistsFragment :
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun createLayoutManager(): GridLayoutManager {
|
override fun createLayoutManager(): GridLayoutManager {
|
||||||
return GridLayoutManager(requireActivity(), getGridSize())
|
return OverScrollGridLayoutManager(requireActivity(), getGridSize())
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun createAdapter(): ArtistAdapter {
|
override fun createAdapter(): ArtistAdapter {
|
||||||
|
|
|
@ -41,6 +41,7 @@ import code.name.monkey.retromusic.util.NavigationUtil
|
||||||
import code.name.monkey.retromusic.util.PreferenceUtil
|
import code.name.monkey.retromusic.util.PreferenceUtil
|
||||||
import com.bumptech.glide.Glide
|
import com.bumptech.glide.Glide
|
||||||
import com.bumptech.glide.load.engine.DiskCacheStrategy
|
import com.bumptech.glide.load.engine.DiskCacheStrategy
|
||||||
|
import dev.olog.scrollhelper.layoutmanagers.OverScrollLinearLayoutManager
|
||||||
import kotlinx.android.synthetic.main.abs_playlists.*
|
import kotlinx.android.synthetic.main.abs_playlists.*
|
||||||
import kotlinx.android.synthetic.main.fragment_banner_home.*
|
import kotlinx.android.synthetic.main.fragment_banner_home.*
|
||||||
import kotlinx.android.synthetic.main.home_content.*
|
import kotlinx.android.synthetic.main.home_content.*
|
||||||
|
@ -141,7 +142,7 @@ class BannerHomeFragment : AbsMainActivityFragment(), MainActivityFragmentCallba
|
||||||
homeAdapter = HomeAdapter(mainActivity, displayMetrics)
|
homeAdapter = HomeAdapter(mainActivity, displayMetrics)
|
||||||
|
|
||||||
recyclerView.apply {
|
recyclerView.apply {
|
||||||
layoutManager = LinearLayoutManager(mainActivity)
|
layoutManager = OverScrollLinearLayoutManager(mainActivity)
|
||||||
adapter = homeAdapter
|
adapter = homeAdapter
|
||||||
}
|
}
|
||||||
homePresenter.attachView(this)
|
homePresenter.attachView(this)
|
||||||
|
|
|
@ -74,6 +74,7 @@ import code.name.monkey.retromusic.util.RetroColorUtil;
|
||||||
import code.name.monkey.retromusic.util.ThemedFastScroller;
|
import code.name.monkey.retromusic.util.ThemedFastScroller;
|
||||||
import code.name.monkey.retromusic.views.BreadCrumbLayout;
|
import code.name.monkey.retromusic.views.BreadCrumbLayout;
|
||||||
import code.name.monkey.retromusic.views.ScrollingViewOnApplyWindowInsetsListener;
|
import code.name.monkey.retromusic.views.ScrollingViewOnApplyWindowInsetsListener;
|
||||||
|
import dev.olog.scrollhelper.layoutmanagers.OverScrollLinearLayoutManager;
|
||||||
import me.zhanghai.android.fastscroll.FastScroller;
|
import me.zhanghai.android.fastscroll.FastScroller;
|
||||||
|
|
||||||
public class FoldersFragment extends AbsMainActivityFragment implements
|
public class FoldersFragment extends AbsMainActivityFragment implements
|
||||||
|
@ -478,7 +479,7 @@ public class FoldersFragment extends AbsMainActivityFragment implements
|
||||||
}
|
}
|
||||||
|
|
||||||
private void setUpRecyclerView() {
|
private void setUpRecyclerView() {
|
||||||
recyclerView.setLayoutManager(new LinearLayoutManager(getActivity()));
|
recyclerView.setLayoutManager(new OverScrollLinearLayoutManager(getActivity()));
|
||||||
FastScroller fastScroller = ThemedFastScroller.INSTANCE.create(recyclerView);
|
FastScroller fastScroller = ThemedFastScroller.INSTANCE.create(recyclerView);
|
||||||
recyclerView.setOnApplyWindowInsetsListener(
|
recyclerView.setOnApplyWindowInsetsListener(
|
||||||
new ScrollingViewOnApplyWindowInsetsListener(recyclerView, fastScroller));
|
new ScrollingViewOnApplyWindowInsetsListener(recyclerView, fastScroller));
|
||||||
|
|
|
@ -25,6 +25,7 @@ import code.name.monkey.retromusic.interfaces.MainActivityFragmentCallbacks
|
||||||
import code.name.monkey.retromusic.model.Genre
|
import code.name.monkey.retromusic.model.Genre
|
||||||
import code.name.monkey.retromusic.mvp.presenter.GenresPresenter
|
import code.name.monkey.retromusic.mvp.presenter.GenresPresenter
|
||||||
import code.name.monkey.retromusic.mvp.presenter.GenresView
|
import code.name.monkey.retromusic.mvp.presenter.GenresView
|
||||||
|
import dev.olog.scrollhelper.layoutmanagers.OverScrollLinearLayoutManager
|
||||||
import javax.inject.Inject
|
import javax.inject.Inject
|
||||||
|
|
||||||
class GenresFragment : AbsLibraryPagerRecyclerViewFragment<GenreAdapter, LinearLayoutManager>(),
|
class GenresFragment : AbsLibraryPagerRecyclerViewFragment<GenreAdapter, LinearLayoutManager>(),
|
||||||
|
@ -42,7 +43,7 @@ class GenresFragment : AbsLibraryPagerRecyclerViewFragment<GenreAdapter, LinearL
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun createLayoutManager(): LinearLayoutManager {
|
override fun createLayoutManager(): LinearLayoutManager {
|
||||||
return LinearLayoutManager(activity)
|
return OverScrollLinearLayoutManager(activity)
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun createAdapter(): GenreAdapter {
|
override fun createAdapter(): GenreAdapter {
|
||||||
|
|
|
@ -28,6 +28,7 @@ import com.h6ah4i.android.widget.advrecyclerview.draggable.RecyclerViewDragDropM
|
||||||
import com.h6ah4i.android.widget.advrecyclerview.swipeable.RecyclerViewSwipeManager
|
import com.h6ah4i.android.widget.advrecyclerview.swipeable.RecyclerViewSwipeManager
|
||||||
import com.h6ah4i.android.widget.advrecyclerview.touchguard.RecyclerViewTouchActionGuardManager
|
import com.h6ah4i.android.widget.advrecyclerview.touchguard.RecyclerViewTouchActionGuardManager
|
||||||
import com.h6ah4i.android.widget.advrecyclerview.utils.WrapperAdapterUtils
|
import com.h6ah4i.android.widget.advrecyclerview.utils.WrapperAdapterUtils
|
||||||
|
import dev.olog.scrollhelper.layoutmanagers.OverScrollLinearLayoutManager
|
||||||
import kotlinx.android.synthetic.main.activity_playing_queue.*
|
import kotlinx.android.synthetic.main.activity_playing_queue.*
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -73,7 +74,7 @@ class PlayingQueueFragment :
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun createLayoutManager(): LinearLayoutManager {
|
override fun createLayoutManager(): LinearLayoutManager {
|
||||||
return LinearLayoutManager(requireContext())
|
return OverScrollLinearLayoutManager(requireContext())
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun createAdapter(): PlayingQueueAdapter {
|
override fun createAdapter(): PlayingQueueAdapter {
|
||||||
|
|
|
@ -13,6 +13,7 @@ import code.name.monkey.retromusic.interfaces.MainActivityFragmentCallbacks
|
||||||
import code.name.monkey.retromusic.model.Playlist
|
import code.name.monkey.retromusic.model.Playlist
|
||||||
import code.name.monkey.retromusic.mvp.presenter.PlaylistView
|
import code.name.monkey.retromusic.mvp.presenter.PlaylistView
|
||||||
import code.name.monkey.retromusic.mvp.presenter.PlaylistsPresenter
|
import code.name.monkey.retromusic.mvp.presenter.PlaylistsPresenter
|
||||||
|
import dev.olog.scrollhelper.layoutmanagers.OverScrollGridLayoutManager
|
||||||
import javax.inject.Inject
|
import javax.inject.Inject
|
||||||
|
|
||||||
class PlaylistsFragment :
|
class PlaylistsFragment :
|
||||||
|
@ -40,7 +41,7 @@ class PlaylistsFragment :
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun createLayoutManager(): GridLayoutManager {
|
override fun createLayoutManager(): GridLayoutManager {
|
||||||
return GridLayoutManager(requireContext(), 1)
|
return OverScrollGridLayoutManager(requireContext(), 1)
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun createAdapter(): PlaylistAdapter {
|
override fun createAdapter(): PlaylistAdapter {
|
||||||
|
|
|
@ -14,6 +14,7 @@ import code.name.monkey.retromusic.model.Song
|
||||||
import code.name.monkey.retromusic.mvp.presenter.SongPresenter
|
import code.name.monkey.retromusic.mvp.presenter.SongPresenter
|
||||||
import code.name.monkey.retromusic.mvp.presenter.SongView
|
import code.name.monkey.retromusic.mvp.presenter.SongView
|
||||||
import code.name.monkey.retromusic.util.PreferenceUtil
|
import code.name.monkey.retromusic.util.PreferenceUtil
|
||||||
|
import dev.olog.scrollhelper.layoutmanagers.OverScrollGridLayoutManager
|
||||||
import java.util.*
|
import java.util.*
|
||||||
import javax.inject.Inject
|
import javax.inject.Inject
|
||||||
|
|
||||||
|
@ -39,7 +40,7 @@ class SongsFragment :
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun createLayoutManager(): GridLayoutManager {
|
override fun createLayoutManager(): GridLayoutManager {
|
||||||
return GridLayoutManager(requireActivity(), getGridSize()).apply {
|
return OverScrollGridLayoutManager(requireActivity(), getGridSize()).apply {
|
||||||
spanSizeLookup = object : GridLayoutManager.SpanSizeLookup() {
|
spanSizeLookup = object : GridLayoutManager.SpanSizeLookup() {
|
||||||
override fun getSpanSize(position: Int): Int {
|
override fun getSpanSize(position: Int): Int {
|
||||||
return if (position == 0) {
|
return if (position == 0) {
|
||||||
|
|
|
@ -18,11 +18,13 @@ import code.name.monkey.appthemehelper.ThemeStore.Companion.accentColor
|
||||||
import code.name.monkey.appthemehelper.util.ColorUtil.isColorLight
|
import code.name.monkey.appthemehelper.util.ColorUtil.isColorLight
|
||||||
import code.name.monkey.appthemehelper.util.MaterialValueHelper.getPrimaryTextColor
|
import code.name.monkey.appthemehelper.util.MaterialValueHelper.getPrimaryTextColor
|
||||||
import code.name.monkey.appthemehelper.util.TintHelper
|
import code.name.monkey.appthemehelper.util.TintHelper
|
||||||
|
import code.name.monkey.retromusic.R
|
||||||
|
import code.name.monkey.retromusic.extensions.dimen
|
||||||
|
import code.name.monkey.retromusic.extensions.dip
|
||||||
import code.name.monkey.retromusic.views.PopupBackground
|
import code.name.monkey.retromusic.views.PopupBackground
|
||||||
import me.zhanghai.android.fastscroll.FastScroller
|
import me.zhanghai.android.fastscroll.FastScroller
|
||||||
import me.zhanghai.android.fastscroll.FastScrollerBuilder
|
import me.zhanghai.android.fastscroll.FastScrollerBuilder
|
||||||
import me.zhanghai.android.fastscroll.PopupStyles
|
import me.zhanghai.android.fastscroll.PopupStyles
|
||||||
import me.zhanghai.android.fastscroll.R
|
|
||||||
|
|
||||||
object ThemedFastScroller {
|
object ThemedFastScroller {
|
||||||
fun create(view: ViewGroup): FastScroller {
|
fun create(view: ViewGroup): FastScroller {
|
||||||
|
@ -37,6 +39,13 @@ object ThemedFastScroller {
|
||||||
popupText.setTextColor(textColor)
|
popupText.setTextColor(textColor)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
fastScrollerBuilder.setPadding(
|
||||||
|
0,
|
||||||
|
view.context.dimen(R.dimen.toolbar_height) + view.context.dip(8),
|
||||||
|
0,
|
||||||
|
view.context.dimen(R.dimen.mini_player_height)
|
||||||
|
)
|
||||||
|
|
||||||
fastScrollerBuilder.setThumbDrawable(
|
fastScrollerBuilder.setThumbDrawable(
|
||||||
TintHelper.createTintedDrawable(
|
TintHelper.createTintedDrawable(
|
||||||
context,
|
context,
|
||||||
|
|
|
@ -1,79 +1,71 @@
|
||||||
<?xml version="1.0" encoding="utf-8"?>
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||||
xmlns:tools="http://schemas.android.com/tools"
|
xmlns:tools="http://schemas.android.com/tools"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="match_parent"
|
android:layout_height="match_parent"
|
||||||
android:background="?colorSurface"
|
android:background="?colorSurface">
|
||||||
android:orientation="vertical">
|
|
||||||
|
<!-- TODO in order to work, children has to be defined in reverse drawing order-->
|
||||||
|
<!-- TODO so: first fragment_container, than toolbar, than statusbar -->
|
||||||
|
|
||||||
<FrameLayout
|
<FrameLayout
|
||||||
android:layout_width="match_parent"
|
android:id="@+id/fragment_container"
|
||||||
|
android:layout_width="0dp"
|
||||||
|
android:layout_height="0dp"
|
||||||
|
app:layout_constraintTop_toBottomOf="@+id/status_bar"
|
||||||
|
app:layout_constraintStart_toStartOf="parent"
|
||||||
|
app:layout_constraintEnd_toEndOf="parent"
|
||||||
|
app:layout_constraintBottom_toBottomOf="parent"/>
|
||||||
|
|
||||||
|
<com.google.android.material.card.MaterialCardView
|
||||||
|
android:id="@+id/toolbarContainer"
|
||||||
|
app:layout_constraintTop_toBottomOf="@+id/status_bar"
|
||||||
|
app:layout_constraintStart_toStartOf="parent"
|
||||||
|
app:layout_constraintEnd_toEndOf="parent"
|
||||||
|
android:layout_width="0dp"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:elevation="0dp"
|
app:cardCornerRadius="8dp"
|
||||||
tools:ignore="UnusedAttribute">
|
app:cardUseCompatPadding="true"
|
||||||
|
app:layout_scrollFlags="scroll|enterAlways">
|
||||||
<include layout="@layout/status_bar" />
|
|
||||||
|
|
||||||
</FrameLayout>
|
|
||||||
|
|
||||||
<androidx.coordinatorlayout.widget.CoordinatorLayout
|
|
||||||
android:layout_width="match_parent"
|
|
||||||
android:layout_height="match_parent">
|
|
||||||
|
|
||||||
<com.google.android.material.appbar.AppBarLayout
|
|
||||||
android:id="@+id/appBarLayout"
|
|
||||||
android:layout_width="match_parent"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:background="@android:color/transparent"
|
|
||||||
android:elevation="0dp"
|
|
||||||
app:elevation="0dp"
|
|
||||||
app:liftOnScroll="true">
|
|
||||||
|
|
||||||
<com.google.android.material.card.MaterialCardView
|
|
||||||
android:id="@+id/toolbarContainer"
|
|
||||||
android:layout_width="match_parent"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
app:cardCornerRadius="8dp"
|
|
||||||
app:cardUseCompatPadding="true"
|
|
||||||
app:layout_scrollFlags="scroll|enterAlways">
|
|
||||||
|
|
||||||
<FrameLayout
|
|
||||||
android:layout_width="match_parent"
|
|
||||||
android:layout_height="wrap_content">
|
|
||||||
|
|
||||||
<androidx.appcompat.widget.Toolbar
|
|
||||||
android:id="@+id/toolbar"
|
|
||||||
android:layout_width="match_parent"
|
|
||||||
android:layout_height="@dimen/toolbar_height"
|
|
||||||
android:background="?attr/colorSurface"
|
|
||||||
app:popupTheme="?attr/toolbarPopupTheme"
|
|
||||||
app:titleTextColor="?attr/colorControlNormal"
|
|
||||||
app:titleTextAppearance="@style/TextViewHeadline6"
|
|
||||||
tools:ignore="UnusedAttribute">
|
|
||||||
|
|
||||||
<com.google.android.material.textview.MaterialTextView
|
|
||||||
android:id="@+id/appTitle"
|
|
||||||
android:layout_width="wrap_content"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:gravity="center"
|
|
||||||
android:text="@string/app_name"
|
|
||||||
android:textColor="?attr/colorControlNormal"
|
|
||||||
android:textAppearance="@style/TextViewHeadline6" />
|
|
||||||
</androidx.appcompat.widget.Toolbar>
|
|
||||||
|
|
||||||
<ViewStub
|
|
||||||
android:id="@+id/cab_stub"
|
|
||||||
android:layout_width="match_parent"
|
|
||||||
android:layout_height="@dimen/toolbar_height" />
|
|
||||||
</FrameLayout>
|
|
||||||
</com.google.android.material.card.MaterialCardView>
|
|
||||||
</com.google.android.material.appbar.AppBarLayout>
|
|
||||||
|
|
||||||
<FrameLayout
|
<FrameLayout
|
||||||
android:id="@+id/fragment_container"
|
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="match_parent"
|
android:layout_height="wrap_content">
|
||||||
app:layout_behavior="com.google.android.material.appbar.AppBarLayout$ScrollingViewBehavior" />
|
|
||||||
</androidx.coordinatorlayout.widget.CoordinatorLayout>
|
<androidx.appcompat.widget.Toolbar
|
||||||
</LinearLayout>
|
android:id="@+id/toolbar"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="@dimen/toolbar_height"
|
||||||
|
android:background="?attr/colorSurface"
|
||||||
|
app:popupTheme="?attr/toolbarPopupTheme"
|
||||||
|
app:titleTextColor="?attr/colorControlNormal"
|
||||||
|
app:titleTextAppearance="@style/TextViewHeadline6"
|
||||||
|
tools:ignore="UnusedAttribute">
|
||||||
|
|
||||||
|
<com.google.android.material.textview.MaterialTextView
|
||||||
|
android:id="@+id/appTitle"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:gravity="center"
|
||||||
|
android:text="@string/app_name"
|
||||||
|
android:textColor="?attr/colorControlNormal"
|
||||||
|
android:textAppearance="@style/TextViewHeadline6" />
|
||||||
|
</androidx.appcompat.widget.Toolbar>
|
||||||
|
|
||||||
|
<ViewStub
|
||||||
|
android:id="@+id/cab_stub"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="@dimen/toolbar_height" />
|
||||||
|
</FrameLayout>
|
||||||
|
</com.google.android.material.card.MaterialCardView>
|
||||||
|
|
||||||
|
<include layout="@layout/status_bar"
|
||||||
|
app:layout_constraintTop_toTopOf="parent"
|
||||||
|
app:layout_constraintStart_toStartOf="parent"
|
||||||
|
app:layout_constraintEnd_toEndOf="parent"
|
||||||
|
android:layout_width="0dp"
|
||||||
|
tools:layout_height="24dp"
|
||||||
|
android:layout_height="wrap_content"/>
|
||||||
|
|
||||||
|
</androidx.constraintlayout.widget.ConstraintLayout>
|
|
@ -17,6 +17,7 @@
|
||||||
android:id="@+id/container"
|
android:id="@+id/container"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_marginTop="@dimen/toolbar_height"
|
||||||
app:layout_behavior="com.google.android.material.appbar.AppBarLayout$ScrollingViewBehavior">
|
app:layout_behavior="com.google.android.material.appbar.AppBarLayout$ScrollingViewBehavior">
|
||||||
|
|
||||||
<androidx.constraintlayout.widget.ConstraintLayout
|
<androidx.constraintlayout.widget.ConstraintLayout
|
||||||
|
|
|
@ -17,6 +17,7 @@
|
||||||
android:id="@+id/container"
|
android:id="@+id/container"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_marginTop="@dimen/toolbar_height"
|
||||||
app:layout_behavior="com.google.android.material.appbar.AppBarLayout$ScrollingViewBehavior">
|
app:layout_behavior="com.google.android.material.appbar.AppBarLayout$ScrollingViewBehavior">
|
||||||
|
|
||||||
<androidx.constraintlayout.widget.ConstraintLayout
|
<androidx.constraintlayout.widget.ConstraintLayout
|
||||||
|
|
|
@ -6,15 +6,16 @@
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="match_parent">
|
android:layout_height="match_parent">
|
||||||
|
|
||||||
|
<!-- TODO note that recycler view has to cover the entire screen -->
|
||||||
|
<!-- TODO so has to be drawn under bottom navigation, toolbar, ecc, but has to be below statusbar-->
|
||||||
<androidx.recyclerview.widget.RecyclerView
|
<androidx.recyclerview.widget.RecyclerView
|
||||||
android:id="@+id/recyclerView"
|
android:id="@+id/recyclerView"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="match_parent"
|
||||||
android:clipToPadding="false"
|
android:clipToPadding="false"
|
||||||
android:layoutAnimation="@anim/layout_animation_fall_down"
|
android:layoutAnimation="@anim/layout_animation_fall_down"
|
||||||
android:overScrollMode="never"
|
android:overScrollMode="never"
|
||||||
android:scrollbars="none"
|
android:scrollbars="none"
|
||||||
app:layout_dodgeInsetEdges="bottom"
|
|
||||||
tools:listitem="@layout/item_list" />
|
tools:listitem="@layout/item_list" />
|
||||||
|
|
||||||
<LinearLayout
|
<LinearLayout
|
||||||
|
|
|
@ -37,7 +37,7 @@
|
||||||
android:id="@+id/miniPlayerFragment"
|
android:id="@+id/miniPlayerFragment"
|
||||||
android:name="code.name.monkey.retromusic.fragments.MiniPlayerFragment"
|
android:name="code.name.monkey.retromusic.fragments.MiniPlayerFragment"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="48dp"
|
android:layout_height="@dimen/mini_player_height"
|
||||||
tools:layout="@layout/fragment_mini_player" />
|
tools:layout="@layout/fragment_mini_player" />
|
||||||
|
|
||||||
</FrameLayout>
|
</FrameLayout>
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue