Add scroll helper
This commit is contained in:
parent
b42303f33a
commit
1c0a426805
37 changed files with 312 additions and 268 deletions
|
@ -183,4 +183,5 @@ dependencies {
|
|||
implementation 'com.google.android.play:core:1.7.2'
|
||||
implementation 'me.jorgecastillo:androidcolorx:0.2.0'
|
||||
debugImplementation 'com.amitshekhar.android:debug-db:1.0.4'
|
||||
implementation 'com.github.ologe:scroll-helper:2.0.0-beta01'
|
||||
}
|
|
@ -0,0 +1,66 @@
|
|||
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.toolbar)
|
||||
}
|
||||
|
||||
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)
|
||||
}
|
||||
}
|
|
@ -39,7 +39,6 @@ import androidx.fragment.app.Fragment;
|
|||
|
||||
import com.afollestad.materialcab.MaterialCab;
|
||||
import com.afollestad.materialcab.MaterialCab.Callback;
|
||||
import com.google.android.material.appbar.AppBarLayout;
|
||||
import com.google.android.material.snackbar.Snackbar;
|
||||
import com.google.android.play.core.appupdate.AppUpdateInfo;
|
||||
import com.google.android.play.core.appupdate.AppUpdateManager;
|
||||
|
@ -61,14 +60,15 @@ import code.name.monkey.appthemehelper.ThemeStore;
|
|||
import code.name.monkey.appthemehelper.util.ATHUtil;
|
||||
import code.name.monkey.appthemehelper.util.ToolbarContentTintHelper;
|
||||
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.dialogs.CreatePlaylistDialog;
|
||||
import code.name.monkey.retromusic.fragments.albums.AlbumsFragment;
|
||||
import code.name.monkey.retromusic.fragments.artists.ArtistsFragment;
|
||||
import code.name.monkey.retromusic.fragments.base.AbsLibraryPagerRecyclerViewCustomGridSizeFragment;
|
||||
import code.name.monkey.retromusic.fragments.folder.FoldersFragment;
|
||||
import code.name.monkey.retromusic.fragments.genres.GenresFragment;
|
||||
import code.name.monkey.retromusic.fragments.home.BannerHomeFragment;
|
||||
import code.name.monkey.retromusic.fragments.mainactivity.FoldersFragment;
|
||||
import code.name.monkey.retromusic.fragments.playlists.PlaylistsFragment;
|
||||
import code.name.monkey.retromusic.fragments.queue.PlayingQueueFragment;
|
||||
import code.name.monkey.retromusic.fragments.songs.SongsFragment;
|
||||
|
@ -89,13 +89,13 @@ import code.name.monkey.retromusic.util.NavigationUtil;
|
|||
import code.name.monkey.retromusic.util.PreferenceUtil;
|
||||
import code.name.monkey.retromusic.util.RetroColorUtil;
|
||||
import code.name.monkey.retromusic.util.RetroUtil;
|
||||
import dev.olog.scrollhelper.ScrollHelper;
|
||||
|
||||
/**
|
||||
* Created by hemanths on 2020-02-19.
|
||||
*/
|
||||
public class MainActivity extends AbsSlidingMusicPanelActivity
|
||||
implements CabHolder, SharedPreferences.OnSharedPreferenceChangeListener {
|
||||
|
||||
public static final String TAG = MainActivity.class.getSimpleName();
|
||||
public static final int APP_INTRO_REQUEST = 100;
|
||||
public static final String EXPAND_PANEL = "expand_panel";
|
||||
|
@ -115,10 +115,11 @@ public class MainActivity extends AbsSlidingMusicPanelActivity
|
|||
}
|
||||
}
|
||||
};
|
||||
@SuppressWarnings("FieldCanBeLocal")
|
||||
private ScrollHelper scrollHelper;
|
||||
private MainActivityFragmentCallbacks currentFragment;
|
||||
private boolean blockRequestPermissions = false;
|
||||
private MaterialCab cab;
|
||||
private AppBarLayout mAppBarLayout;
|
||||
private Toolbar mToolbar;
|
||||
private AppUpdateManager appUpdateManager;
|
||||
InstallStateUpdatedListener listener = new InstallStateUpdatedListener() {
|
||||
|
@ -163,7 +164,6 @@ public class MainActivity extends AbsSlidingMusicPanelActivity
|
|||
}
|
||||
|
||||
mToolbar = findViewById(R.id.toolbar);
|
||||
mAppBarLayout = findViewById(R.id.appBarLayout);
|
||||
|
||||
//checkShowChangelog();
|
||||
AppRater.appLaunched(this);
|
||||
|
@ -177,7 +177,7 @@ public class MainActivity extends AbsSlidingMusicPanelActivity
|
|||
selectedFragment(item.getItemId());
|
||||
return true;
|
||||
});
|
||||
mIntentFilter.addAction(MusicService.MEDIA_STORE_CHANGED);
|
||||
scrollHelper = new RetroScrollHelper(this);
|
||||
}
|
||||
|
||||
|
||||
|
@ -253,14 +253,6 @@ public class MainActivity extends AbsSlidingMusicPanelActivity
|
|||
PreferenceUtil.getInstance(this).unregisterOnSharedPreferenceChangedListener(this);
|
||||
}
|
||||
|
||||
public void addOnAppBarOffsetChangedListener(
|
||||
@NonNull AppBarLayout.OnOffsetChangedListener onOffsetChangedListener) {
|
||||
mAppBarLayout.addOnOffsetChangedListener(onOffsetChangedListener);
|
||||
}
|
||||
|
||||
public int getTotalAppBarScrollingRange() {
|
||||
return mAppBarLayout.getTotalScrollRange();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean handleBackPress() {
|
||||
|
@ -405,11 +397,6 @@ public class MainActivity extends AbsSlidingMusicPanelActivity
|
|||
return cab;
|
||||
}
|
||||
|
||||
public void removeOnAppBarOffsetChangedListener(
|
||||
@NonNull AppBarLayout.OnOffsetChangedListener onOffsetChangedListener) {
|
||||
mAppBarLayout.removeOnOffsetChangedListener(onOffsetChangedListener);
|
||||
}
|
||||
|
||||
public void setCurrentFragment(@NonNull Fragment fragment, @NonNull String tag) {
|
||||
String currentTag = null;
|
||||
if (getSupportFragmentManager().findFragmentByTag(tag) != null) {
|
||||
|
@ -830,7 +817,6 @@ public class MainActivity extends AbsSlidingMusicPanelActivity
|
|||
private void setupToolbar() {
|
||||
setTitle(null);
|
||||
mToolbar.setBackgroundColor(ATHUtil.INSTANCE.resolveColor(this, R.attr.colorSurface));
|
||||
mAppBarLayout.setBackgroundColor(ATHUtil.INSTANCE.resolveColor(this, R.attr.colorSurface));
|
||||
setSupportActionBar(mToolbar);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -212,9 +212,9 @@ class SkuDetailsAdapter(
|
|||
val titleTextColor = if (purchased) ATHUtil.resolveColor(
|
||||
donationsDialog,
|
||||
android.R.attr.textColorHint
|
||||
) else textColorPrimary(donationsDialog)
|
||||
) else donationsDialog.textColorPrimary()
|
||||
val contentTextColor =
|
||||
if (purchased) titleTextColor else textColorSecondary(donationsDialog)
|
||||
if (purchased) titleTextColor else donationsDialog.textColorSecondary()
|
||||
|
||||
viewHolder.title.setTextColor(titleTextColor)
|
||||
viewHolder.text.setTextColor(contentTextColor)
|
||||
|
|
|
@ -127,10 +127,14 @@ abstract class AbsSlidingMusicPanelActivity : AbsMusicServiceActivity(),
|
|||
}
|
||||
}
|
||||
|
||||
override fun onPause() {
|
||||
super.onPause()
|
||||
behavior.removeBottomSheetCallback(bottomSheetCallbackList)
|
||||
}
|
||||
|
||||
override fun onDestroy() {
|
||||
super.onDestroy()
|
||||
behavior.removeBottomSheetCallback(bottomSheetCallbackList)
|
||||
if (navigationBarColorAnimator != null) navigationBarColorAnimator?.cancel() // just in case
|
||||
navigationBarColorAnimator?.cancel()
|
||||
}
|
||||
|
||||
protected fun wrapSlidingMusicPanel(@LayoutRes resId: Int): View {
|
||||
|
@ -158,7 +162,7 @@ abstract class AbsSlidingMusicPanelActivity : AbsMusicServiceActivity(),
|
|||
// necessary to make the views below clickable
|
||||
miniPlayerFragment?.view?.visibility = if (alpha == 0f) View.GONE else View.VISIBLE
|
||||
|
||||
bottomNavigationView.translationY = progress * 500
|
||||
//bottomNavigationView.translationY = progress * 500
|
||||
//bottomNavigationView.alpha = alpha
|
||||
}
|
||||
|
||||
|
@ -387,4 +391,5 @@ abstract class AbsSlidingMusicPanelActivity : AbsMusicServiceActivity(),
|
|||
bottomNavigationView.hide()
|
||||
}
|
||||
}
|
||||
|
||||
}
|
|
@ -17,7 +17,9 @@ package code.name.monkey.retromusic.extensions
|
|||
import android.content.Context
|
||||
import android.content.res.ColorStateList
|
||||
import android.graphics.Color
|
||||
import android.view.View
|
||||
import androidx.appcompat.widget.Toolbar
|
||||
import androidx.fragment.app.Fragment
|
||||
import code.name.monkey.appthemehelper.ThemeStore
|
||||
import code.name.monkey.appthemehelper.util.ATHUtil
|
||||
import code.name.monkey.appthemehelper.util.ColorUtil
|
||||
|
@ -31,10 +33,26 @@ fun Context.accentColor(): Int {
|
|||
return ThemeStore.accentColor(this)
|
||||
}
|
||||
|
||||
fun View.accentColor(): Int {
|
||||
return ThemeStore.accentColor(context)
|
||||
}
|
||||
|
||||
fun Fragment.accentColor(): Int {
|
||||
return ThemeStore.accentColor(requireContext())
|
||||
}
|
||||
|
||||
fun Context.surfaceColor(): Int {
|
||||
return ATHUtil.resolveColor(this, R.attr.colorSurface, Color.WHITE)
|
||||
}
|
||||
|
||||
fun View.surfaceColor(): Int {
|
||||
return ATHUtil.resolveColor(context, R.attr.colorSurface, Color.WHITE)
|
||||
}
|
||||
|
||||
fun Fragment.surfaceColor(): Int {
|
||||
return ATHUtil.resolveColor(requireContext(), R.attr.colorSurface, Color.WHITE)
|
||||
}
|
||||
|
||||
fun Toolbar.backgroundTintList() {
|
||||
val surfaceColor = ATHUtil.resolveColor(context, R.attr.colorSurface, Color.BLACK)
|
||||
val colorStateList = ColorStateList.valueOf(surfaceColor)
|
||||
|
@ -45,10 +63,26 @@ fun Context.textColorSecondary(): Int {
|
|||
return ATHUtil.resolveColor(this, android.R.attr.textColorSecondary)
|
||||
}
|
||||
|
||||
fun Fragment.textColorSecondary(): Int {
|
||||
return ATHUtil.resolveColor(requireContext(), android.R.attr.textColorSecondary)
|
||||
}
|
||||
|
||||
fun Context.colorControlNormal(): Int {
|
||||
return ATHUtil.resolveColor(this, android.R.attr.colorControlNormal)
|
||||
}
|
||||
|
||||
fun View.colorControlNormal(): Int {
|
||||
return ATHUtil.resolveColor(context, android.R.attr.colorControlNormal)
|
||||
}
|
||||
|
||||
fun Context.textColorPrimary(): Int {
|
||||
return ATHUtil.resolveColor(this, android.R.attr.textColorPrimary)
|
||||
}
|
||||
|
||||
fun View.textColorPrimary(): Int {
|
||||
return ATHUtil.resolveColor(context, android.R.attr.textColorPrimary)
|
||||
}
|
||||
|
||||
fun Fragment.textColorPrimary(): Int {
|
||||
return ATHUtil.resolveColor(requireContext(), android.R.attr.textColorPrimary)
|
||||
}
|
|
@ -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)
|
|
@ -84,10 +84,10 @@ open class MiniPlayerFragment : AbsMusicServiceFragment(), MusicProgressViewUpda
|
|||
|
||||
val song = MusicPlayerRemote.currentSong
|
||||
val title = SpannableString(song.title)
|
||||
title.setSpan(ForegroundColorSpan(textColorPrimary(requireContext())), 0, title.length, 0)
|
||||
title.setSpan(ForegroundColorSpan(textColorPrimary()), 0, title.length, 0)
|
||||
|
||||
val text = SpannableString(song.artistName)
|
||||
text.setSpan(ForegroundColorSpan(textColorSecondary(requireContext())), 0, text.length, 0)
|
||||
text.setSpan(ForegroundColorSpan(textColorSecondary()), 0, text.length, 0)
|
||||
|
||||
builder.append(title).append(" • ").append(text)
|
||||
|
||||
|
|
|
@ -10,6 +10,7 @@ import code.name.monkey.retromusic.adapter.album.AlbumAdapter
|
|||
import code.name.monkey.retromusic.fragments.base.AbsLibraryPagerRecyclerViewCustomGridSizeFragment
|
||||
import code.name.monkey.retromusic.interfaces.MainActivityFragmentCallbacks
|
||||
import code.name.monkey.retromusic.util.PreferenceUtil
|
||||
import dev.olog.scrollhelper.layoutmanagers.OverScrollGridLayoutManager
|
||||
|
||||
class AlbumsFragment :
|
||||
AbsLibraryPagerRecyclerViewCustomGridSizeFragment<AlbumAdapter, GridLayoutManager>(),
|
||||
|
@ -32,7 +33,7 @@ class AlbumsFragment :
|
|||
get() = R.string.no_albums
|
||||
|
||||
override fun createLayoutManager(): GridLayoutManager {
|
||||
return GridLayoutManager(requireActivity(), getGridSize())
|
||||
return OverScrollGridLayoutManager(requireActivity(), getGridSize())
|
||||
}
|
||||
|
||||
override fun createAdapter(): AlbumAdapter {
|
||||
|
|
|
@ -10,12 +10,13 @@ import code.name.monkey.retromusic.adapter.artist.ArtistAdapter
|
|||
import code.name.monkey.retromusic.fragments.base.AbsLibraryPagerRecyclerViewCustomGridSizeFragment
|
||||
import code.name.monkey.retromusic.interfaces.MainActivityFragmentCallbacks
|
||||
import code.name.monkey.retromusic.util.PreferenceUtil
|
||||
import dev.olog.scrollhelper.layoutmanagers.OverScrollGridLayoutManager
|
||||
|
||||
class ArtistsFragment :
|
||||
AbsLibraryPagerRecyclerViewCustomGridSizeFragment<ArtistAdapter, GridLayoutManager>(),
|
||||
MainActivityFragmentCallbacks {
|
||||
|
||||
lateinit var artistViewModel: ArtistViewModel
|
||||
private lateinit var artistViewModel: ArtistViewModel
|
||||
|
||||
|
||||
override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
|
||||
|
@ -46,7 +47,7 @@ class ArtistsFragment :
|
|||
}
|
||||
|
||||
override fun createLayoutManager(): GridLayoutManager {
|
||||
return GridLayoutManager(requireActivity(), getGridSize())
|
||||
return OverScrollGridLayoutManager(requireActivity(), getGridSize())
|
||||
}
|
||||
|
||||
override fun createAdapter(): ArtistAdapter {
|
||||
|
|
|
@ -8,17 +8,13 @@ import androidx.annotation.NonNull
|
|||
import androidx.annotation.StringRes
|
||||
import androidx.recyclerview.widget.RecyclerView
|
||||
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.views.ScrollingViewOnApplyWindowInsetsListener
|
||||
import com.google.android.material.appbar.AppBarLayout
|
||||
import kotlinx.android.synthetic.main.fragment_main_activity_recycler_view.*
|
||||
import me.zhanghai.android.fastscroll.FastScroller
|
||||
import me.zhanghai.android.fastscroll.FastScrollerBuilder
|
||||
|
||||
abstract class AbsLibraryPagerRecyclerViewFragment<A : RecyclerView.Adapter<*>, LM : RecyclerView.LayoutManager> :
|
||||
AbsLibraryPagerFragment(), AppBarLayout.OnOffsetChangedListener {
|
||||
AbsLibraryPagerFragment() {
|
||||
|
||||
protected var adapter: A? = null
|
||||
protected var layoutManager: LM? = null
|
||||
|
@ -31,7 +27,6 @@ abstract class AbsLibraryPagerRecyclerViewFragment<A : RecyclerView.Adapter<*>,
|
|||
|
||||
override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
|
||||
super.onViewCreated(view, savedInstanceState)
|
||||
mainActivity.addOnAppBarOffsetChangedListener(this)
|
||||
initLayoutManager()
|
||||
initAdapter()
|
||||
setUpRecyclerView()
|
||||
|
@ -41,13 +36,6 @@ abstract class AbsLibraryPagerRecyclerViewFragment<A : RecyclerView.Adapter<*>,
|
|||
recyclerView.layoutManager = layoutManager
|
||||
recyclerView.adapter = adapter
|
||||
val fastScroller = create(recyclerView)
|
||||
recyclerView.setOnApplyWindowInsetsListener(
|
||||
ScrollingViewOnApplyWindowInsetsListener(
|
||||
recyclerView,
|
||||
fastScroller
|
||||
)
|
||||
)
|
||||
checkForPadding()
|
||||
}
|
||||
|
||||
protected open fun createFastScroller(recyclerView: RecyclerView): FastScroller {
|
||||
|
@ -60,7 +48,6 @@ abstract class AbsLibraryPagerRecyclerViewFragment<A : RecyclerView.Adapter<*>,
|
|||
override fun onChanged() {
|
||||
super.onChanged()
|
||||
checkIsEmpty()
|
||||
checkForPadding()
|
||||
}
|
||||
})
|
||||
}
|
||||
|
@ -78,18 +65,6 @@ abstract class AbsLibraryPagerRecyclerViewFragment<A : RecyclerView.Adapter<*>,
|
|||
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() {
|
||||
layoutManager = createLayoutManager()
|
||||
}
|
||||
|
@ -99,25 +74,6 @@ abstract class AbsLibraryPagerRecyclerViewFragment<A : RecyclerView.Adapter<*>,
|
|||
@NonNull
|
||||
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() {
|
||||
initLayoutManager()
|
||||
recyclerView.layoutManager = layoutManager
|
||||
|
@ -129,11 +85,6 @@ abstract class AbsLibraryPagerRecyclerViewFragment<A : RecyclerView.Adapter<*>,
|
|||
recyclerView.adapter = adapter
|
||||
}
|
||||
|
||||
override fun onDestroyView() {
|
||||
super.onDestroyView()
|
||||
mainActivity.removeOnAppBarOffsetChangedListener(this)
|
||||
}
|
||||
|
||||
fun recyclerView(): RecyclerView {
|
||||
return recyclerView
|
||||
}
|
||||
|
|
|
@ -12,7 +12,7 @@
|
|||
* See the GNU General Public License for more details.
|
||||
*/
|
||||
|
||||
package code.name.monkey.retromusic.fragments.mainactivity;
|
||||
package code.name.monkey.retromusic.fragments.folder;
|
||||
|
||||
import android.app.Dialog;
|
||||
import android.content.Context;
|
||||
|
@ -73,6 +73,7 @@ import code.name.monkey.retromusic.util.RetroColorUtil;
|
|||
import code.name.monkey.retromusic.util.ThemedFastScroller;
|
||||
import code.name.monkey.retromusic.views.BreadCrumbLayout;
|
||||
import code.name.monkey.retromusic.views.ScrollingViewOnApplyWindowInsetsListener;
|
||||
import dev.olog.scrollhelper.layoutmanagers.OverScrollLinearLayoutManager;
|
||||
import me.zhanghai.android.fastscroll.FastScroller;
|
||||
|
||||
public class FoldersFragment extends AbsMainActivityFragment implements
|
||||
|
@ -478,7 +479,7 @@ public class FoldersFragment extends AbsMainActivityFragment implements
|
|||
}
|
||||
|
||||
private void setUpRecyclerView() {
|
||||
recyclerView.setLayoutManager(new LinearLayoutManager(getActivity()));
|
||||
recyclerView.setLayoutManager(new OverScrollLinearLayoutManager(getActivity()));
|
||||
FastScroller fastScroller = ThemedFastScroller.INSTANCE.create(recyclerView);
|
||||
recyclerView.setOnApplyWindowInsetsListener(
|
||||
new ScrollingViewOnApplyWindowInsetsListener(recyclerView, fastScroller));
|
|
@ -24,11 +24,12 @@ import code.name.monkey.retromusic.R
|
|||
import code.name.monkey.retromusic.adapter.GenreAdapter
|
||||
import code.name.monkey.retromusic.fragments.base.AbsLibraryPagerRecyclerViewFragment
|
||||
import code.name.monkey.retromusic.interfaces.MainActivityFragmentCallbacks
|
||||
import dev.olog.scrollhelper.layoutmanagers.OverScrollLinearLayoutManager
|
||||
|
||||
class GenresFragment : AbsLibraryPagerRecyclerViewFragment<GenreAdapter, LinearLayoutManager>(),
|
||||
MainActivityFragmentCallbacks {
|
||||
|
||||
lateinit var genreViewModel: GenreViewModel
|
||||
private lateinit var genreViewModel: GenreViewModel
|
||||
|
||||
override fun onCreate(savedInstanceState: Bundle?) {
|
||||
super.onCreate(savedInstanceState)
|
||||
|
@ -52,7 +53,7 @@ class GenresFragment : AbsLibraryPagerRecyclerViewFragment<GenreAdapter, LinearL
|
|||
}
|
||||
|
||||
override fun createLayoutManager(): LinearLayoutManager {
|
||||
return LinearLayoutManager(activity)
|
||||
return OverScrollLinearLayoutManager(activity)
|
||||
}
|
||||
|
||||
override fun createAdapter(): GenreAdapter {
|
||||
|
|
|
@ -21,7 +21,6 @@ import android.view.LayoutInflater
|
|||
import android.view.View
|
||||
import android.view.ViewGroup
|
||||
import androidx.lifecycle.ViewModelProvider
|
||||
import androidx.recyclerview.widget.LinearLayoutManager
|
||||
import code.name.monkey.appthemehelper.ThemeStore
|
||||
import code.name.monkey.appthemehelper.util.TintHelper
|
||||
import code.name.monkey.retromusic.Constants
|
||||
|
@ -39,6 +38,7 @@ import code.name.monkey.retromusic.util.NavigationUtil
|
|||
import code.name.monkey.retromusic.util.PreferenceUtil
|
||||
import com.bumptech.glide.Glide
|
||||
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.fragment_banner_home.*
|
||||
import kotlinx.android.synthetic.main.home_content.*
|
||||
|
@ -63,6 +63,7 @@ class BannerHomeFragment : AbsMainActivityFragment(), MainActivityFragmentCallba
|
|||
}
|
||||
|
||||
private fun loadImageFromStorage() {
|
||||
|
||||
Glide.with(requireContext())
|
||||
.load(
|
||||
File(
|
||||
|
@ -144,7 +145,7 @@ class BannerHomeFragment : AbsMainActivityFragment(), MainActivityFragmentCallba
|
|||
|
||||
homeAdapter = HomeAdapter(mainActivity, displayMetrics)
|
||||
recyclerView.apply {
|
||||
layoutManager = LinearLayoutManager(mainActivity)
|
||||
layoutManager = OverScrollLinearLayoutManager(mainActivity)
|
||||
adapter = homeAdapter
|
||||
}
|
||||
homeModel = ViewModelProvider(this).get(HomeViewModel::class.java)
|
||||
|
|
|
@ -159,8 +159,8 @@ class AdaptiveFragment : AbsPlayerFragment(), MusicProgressViewUpdateHelper.Call
|
|||
inflateMenu(R.menu.menu_player)
|
||||
setNavigationOnClickListener { requireActivity().onBackPressed() }
|
||||
ToolbarContentTintHelper.colorizeToolbar(this, primaryColor, requireActivity())
|
||||
setTitleTextColor(textColorPrimary(requireContext()))
|
||||
setSubtitleTextColor(textColorSecondary(requireContext()))
|
||||
setTitleTextColor(textColorPrimary())
|
||||
setSubtitleTextColor(textColorSecondary())
|
||||
setOnMenuItemClickListener(this@AdaptiveFragment)
|
||||
}
|
||||
}
|
||||
|
|
|
@ -124,7 +124,7 @@ class LockScreenPlayerControlsFragment : AbsPlayerControlsFragment() {
|
|||
val colorFinal = if (PreferenceUtil.getInstance(requireContext()).adaptiveColor) {
|
||||
color.primaryTextColor
|
||||
} else {
|
||||
textColorSecondary(requireContext())
|
||||
textColorSecondary()
|
||||
}.ripAlpha()
|
||||
|
||||
volumeFragment?.setTintable(colorFinal)
|
||||
|
|
|
@ -104,7 +104,7 @@ class MaterialControlsFragment : AbsPlayerControlsFragment() {
|
|||
MaterialValueHelper.getPrimaryTextColor(requireContext(), false)
|
||||
lastDisabledPlaybackControlsColor =
|
||||
MaterialValueHelper.getPrimaryDisabledTextColor(requireContext(), false)
|
||||
}else{
|
||||
} else {
|
||||
lastPlaybackControlsColor =
|
||||
MaterialValueHelper.getSecondaryTextColor(requireContext(), true)
|
||||
lastDisabledPlaybackControlsColor =
|
||||
|
@ -116,7 +116,7 @@ class MaterialControlsFragment : AbsPlayerControlsFragment() {
|
|||
val colorFinal = if (PreferenceUtil.getInstance(requireContext()).adaptiveColor) {
|
||||
lastPlaybackControlsColor
|
||||
} else {
|
||||
textColorSecondary(requireContext())
|
||||
textColorSecondary()
|
||||
}.ripAlpha()
|
||||
|
||||
text.setTextColor(colorFinal)
|
||||
|
|
|
@ -11,6 +11,7 @@ import code.name.monkey.retromusic.R
|
|||
import code.name.monkey.retromusic.adapter.playlist.PlaylistAdapter
|
||||
import code.name.monkey.retromusic.fragments.base.AbsLibraryPagerRecyclerViewFragment
|
||||
import code.name.monkey.retromusic.interfaces.MainActivityFragmentCallbacks
|
||||
import dev.olog.scrollhelper.layoutmanagers.OverScrollGridLayoutManager
|
||||
|
||||
class PlaylistsFragment :
|
||||
AbsLibraryPagerRecyclerViewFragment<PlaylistAdapter, GridLayoutManager>(),
|
||||
|
@ -38,7 +39,7 @@ class PlaylistsFragment :
|
|||
get() = R.string.no_playlists
|
||||
|
||||
override fun createLayoutManager(): GridLayoutManager {
|
||||
return GridLayoutManager(requireContext(), 1)
|
||||
return OverScrollGridLayoutManager(requireContext(), 1)
|
||||
}
|
||||
|
||||
override fun createAdapter(): PlaylistAdapter {
|
||||
|
|
|
@ -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.touchguard.RecyclerViewTouchActionGuardManager
|
||||
import com.h6ah4i.android.widget.advrecyclerview.utils.WrapperAdapterUtils
|
||||
import dev.olog.scrollhelper.layoutmanagers.OverScrollLinearLayoutManager
|
||||
import kotlinx.android.synthetic.main.activity_playing_queue.*
|
||||
|
||||
/**
|
||||
|
@ -73,7 +74,7 @@ class PlayingQueueFragment :
|
|||
}
|
||||
|
||||
override fun createLayoutManager(): LinearLayoutManager {
|
||||
return LinearLayoutManager(requireContext())
|
||||
return OverScrollLinearLayoutManager(requireContext())
|
||||
}
|
||||
|
||||
override fun createAdapter(): PlayingQueueAdapter {
|
||||
|
|
|
@ -68,7 +68,9 @@ class MainSettingsFragment : Fragment(), View.OnClickListener {
|
|||
|
||||
override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
|
||||
super.onViewCreated(view, savedInstanceState)
|
||||
scrollView.setOnScrollChangeListener(View.OnScrollChangeListener { v, scrollX, scrollY, oldScrollX, oldScrollY ->
|
||||
|
||||
})
|
||||
generalSettings.setOnClickListener(this)
|
||||
audioSettings.setOnClickListener(this)
|
||||
nowPlayingSettings.setOnClickListener(this)
|
||||
|
|
|
@ -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.SongView
|
||||
import code.name.monkey.retromusic.util.PreferenceUtil
|
||||
import dev.olog.scrollhelper.layoutmanagers.OverScrollGridLayoutManager
|
||||
import java.util.*
|
||||
import javax.inject.Inject
|
||||
|
||||
|
@ -38,8 +39,7 @@ class SongsFragment :
|
|||
}
|
||||
|
||||
override fun createLayoutManager(): GridLayoutManager {
|
||||
println("createLayoutManager: ${getGridSize()}")
|
||||
return GridLayoutManager(requireActivity(), getGridSize()).apply {
|
||||
return OverScrollGridLayoutManager(requireActivity(), getGridSize()).apply {
|
||||
spanSizeLookup = object : GridLayoutManager.SpanSizeLookup() {
|
||||
override fun getSpanSize(position: Int): Int {
|
||||
return if (position == 0) {
|
||||
|
|
|
@ -57,9 +57,10 @@ class AlbumCoverStylePreference @JvmOverloads constructor(
|
|||
}
|
||||
|
||||
init {
|
||||
|
||||
icon?.colorFilter =
|
||||
BlendModeColorFilterCompat.createBlendModeColorFilterCompat(
|
||||
colorControlNormal(context),
|
||||
context.colorControlNormal(),
|
||||
SRC_IN
|
||||
)
|
||||
}
|
||||
|
|
|
@ -43,7 +43,7 @@ class BlacklistPreference @JvmOverloads constructor(
|
|||
init {
|
||||
icon?.colorFilter =
|
||||
BlendModeColorFilterCompat.createBlendModeColorFilterCompat(
|
||||
colorControlNormal(context),
|
||||
context.colorControlNormal( ),
|
||||
SRC_IN
|
||||
)
|
||||
}
|
||||
|
|
|
@ -45,7 +45,7 @@ class LibraryPreference @JvmOverloads constructor(
|
|||
init {
|
||||
icon?.colorFilter =
|
||||
BlendModeColorFilterCompat.createBlendModeColorFilterCompat(
|
||||
colorControlNormal(context),
|
||||
context.colorControlNormal(),
|
||||
SRC_IN
|
||||
)
|
||||
}
|
||||
|
|
|
@ -43,7 +43,7 @@ class MaterialListPreference @JvmOverloads constructor(
|
|||
|
||||
init {
|
||||
icon?.colorFilter = BlendModeColorFilterCompat.createBlendModeColorFilterCompat(
|
||||
colorControlNormal(context),
|
||||
context.colorControlNormal(),
|
||||
SRC_IN
|
||||
)
|
||||
}
|
||||
|
|
|
@ -57,7 +57,7 @@ class NowPlayingScreenPreference @JvmOverloads constructor(
|
|||
|
||||
init {
|
||||
icon?.colorFilter = BlendModeColorFilterCompat.createBlendModeColorFilterCompat(
|
||||
colorControlNormal(context),
|
||||
context.colorControlNormal(),
|
||||
SRC_IN
|
||||
)
|
||||
}
|
||||
|
|
|
@ -44,7 +44,7 @@ import java.util.Objects;
|
|||
import code.name.monkey.retromusic.R;
|
||||
import code.name.monkey.retromusic.fragments.AlbumCoverStyle;
|
||||
import code.name.monkey.retromusic.fragments.NowPlayingScreen;
|
||||
import code.name.monkey.retromusic.fragments.mainactivity.FoldersFragment;
|
||||
import code.name.monkey.retromusic.fragments.folder.FoldersFragment;
|
||||
import code.name.monkey.retromusic.helper.SortOrder.AlbumSongSortOrder;
|
||||
import code.name.monkey.retromusic.model.CategoryInfo;
|
||||
import code.name.monkey.retromusic.model.CategoryInfo.Category;
|
||||
|
|
|
@ -14,21 +14,23 @@
|
|||
package code.name.monkey.retromusic.util
|
||||
|
||||
import android.view.ViewGroup
|
||||
import code.name.monkey.appthemehelper.ThemeStore.Companion.accentColor
|
||||
import code.name.monkey.appthemehelper.util.ColorUtil.isColorLight
|
||||
import code.name.monkey.appthemehelper.util.MaterialValueHelper.getPrimaryTextColor
|
||||
import code.name.monkey.appthemehelper.util.TintHelper
|
||||
import code.name.monkey.retromusic.R
|
||||
import code.name.monkey.retromusic.extensions.accentColor
|
||||
import code.name.monkey.retromusic.extensions.dimen
|
||||
import code.name.monkey.retromusic.extensions.dip
|
||||
import code.name.monkey.retromusic.views.PopupBackground
|
||||
import me.zhanghai.android.fastscroll.FastScroller
|
||||
import me.zhanghai.android.fastscroll.FastScrollerBuilder
|
||||
import me.zhanghai.android.fastscroll.PopupStyles
|
||||
import me.zhanghai.android.fastscroll.R
|
||||
|
||||
|
||||
object ThemedFastScroller {
|
||||
fun create(view: ViewGroup): FastScroller {
|
||||
val context = view.context
|
||||
val color = accentColor(context)
|
||||
val textColor = getPrimaryTextColor(context, isColorLight(color))
|
||||
val textColor = getPrimaryTextColor(context, isColorLight(context.accentColor()))
|
||||
val fastScrollerBuilder = FastScrollerBuilder(view)
|
||||
fastScrollerBuilder.useMd2Style()
|
||||
fastScrollerBuilder.setPopupStyle { popupText ->
|
||||
|
@ -36,12 +38,17 @@ object ThemedFastScroller {
|
|||
popupText.background = PopupBackground(context)
|
||||
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(
|
||||
TintHelper.createTintedDrawable(
|
||||
context,
|
||||
R.drawable.afs_md2_thumb,
|
||||
color
|
||||
context.accentColor()
|
||||
)
|
||||
)
|
||||
return fastScrollerBuilder.build()
|
||||
|
|
|
@ -1,59 +0,0 @@
|
|||
/*
|
||||
* Copyright (c) 2019 Hemanth Savarala.
|
||||
*
|
||||
* Licensed under the GNU General Public License v3
|
||||
*
|
||||
* This is free software: you can redistribute it and/or modify it under
|
||||
* the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation either version 3 of the License, or (at your option) any later version.
|
||||
*
|
||||
* This software is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
|
||||
* without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
||||
* See the GNU General Public License for more details.
|
||||
*/
|
||||
|
||||
package code.name.monkey.retromusic.views;
|
||||
|
||||
import android.content.Context;
|
||||
import android.content.res.Resources;
|
||||
import android.util.AttributeSet;
|
||||
import android.view.View;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
|
||||
public class StatusBarView extends View {
|
||||
|
||||
|
||||
public StatusBarView(@NonNull Context context) {
|
||||
super(context);
|
||||
init(context);
|
||||
}
|
||||
|
||||
public StatusBarView(@NonNull Context context, @NonNull AttributeSet attrs) {
|
||||
super(context, attrs);
|
||||
init(context);
|
||||
}
|
||||
|
||||
public StatusBarView(@NonNull Context context, @NonNull AttributeSet attrs, int defStyleAttr) {
|
||||
super(context, attrs, defStyleAttr);
|
||||
init(context);
|
||||
}
|
||||
|
||||
public static int getStatusBarHeight(@NonNull Resources r) {
|
||||
int result = 0;
|
||||
int resourceId = r.getIdentifier("status_bar_height", "dimen", "android");
|
||||
if (resourceId > 0) {
|
||||
result = r.getDimensionPixelSize(resourceId);
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
private void init(Context context) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) {
|
||||
setMeasuredDimension(MeasureSpec.getSize(widthMeasureSpec), getStatusBarHeight(getResources()));
|
||||
}
|
||||
}
|
|
@ -0,0 +1,42 @@
|
|||
/*
|
||||
* Copyright (c) 2019 Hemanth Savarala.
|
||||
*
|
||||
* Licensed under the GNU General Public License v3
|
||||
*
|
||||
* This is free software: you can redistribute it and/or modify it under
|
||||
* the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation either version 3 of the License, or (at your option) any later version.
|
||||
*
|
||||
* This software is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
|
||||
* without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
||||
* See the GNU General Public License for more details.
|
||||
*/
|
||||
package code.name.monkey.retromusic.views
|
||||
|
||||
import android.content.Context
|
||||
import android.util.AttributeSet
|
||||
import android.view.View
|
||||
|
||||
class StatusBarView(
|
||||
context: Context,
|
||||
attrs: AttributeSet
|
||||
) : View(context, attrs) {
|
||||
|
||||
override fun onAttachedToWindow() {
|
||||
super.onAttachedToWindow()
|
||||
if (isInEditMode) {
|
||||
return
|
||||
}
|
||||
setOnApplyWindowInsetsListener { _, insets ->
|
||||
val height = insets?.systemWindowInsetTop ?: 0
|
||||
setHeight(height)
|
||||
insets
|
||||
}
|
||||
}
|
||||
|
||||
private fun setHeight(px: Int) {
|
||||
val params = layoutParams ?: return
|
||||
params.height = px
|
||||
layoutParams = params
|
||||
}
|
||||
}
|
|
@ -1,60 +1,55 @@
|
|||
<?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:tools="http://schemas.android.com/tools"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:background="?colorSurface"
|
||||
android:orientation="vertical">
|
||||
android:background="?colorSurface">
|
||||
|
||||
<!-- TODO in order to work, children has to be defined in reverse drawing order-->
|
||||
<!-- TODO so: first fragment_container, than toolbar, than statusbar -->
|
||||
|
||||
<FrameLayout
|
||||
android:id="@+id/fragment_container"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="0dp"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@+id/status_bar" />
|
||||
|
||||
<FrameLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:elevation="0dp"
|
||||
tools:ignore="UnusedAttribute">
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@+id/status_bar">
|
||||
|
||||
<include layout="@layout/status_bar" />
|
||||
<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:title="@string/app_name"
|
||||
app:titleTextAppearance="@style/TextViewHeadline6"
|
||||
app:titleTextColor="?attr/colorControlNormal"
|
||||
tools:ignore="UnusedAttribute" />
|
||||
|
||||
<ViewStub
|
||||
android:id="@+id/cab_stub"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="@dimen/toolbar_height" />
|
||||
</FrameLayout>
|
||||
|
||||
<androidx.coordinatorlayout.widget.CoordinatorLayout
|
||||
android:id="@+id/mainContent"
|
||||
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"
|
||||
app:liftOnScroll="true">
|
||||
<include
|
||||
layout="@layout/status_bar"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent"
|
||||
tools:layout_height="24dp" />
|
||||
|
||||
<FrameLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
app:layout_scrollFlags="scroll|enterAlways">
|
||||
|
||||
<androidx.appcompat.widget.Toolbar
|
||||
android:id="@+id/toolbar"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:background="?attr/colorSurface"
|
||||
app:popupTheme="?attr/toolbarPopupTheme"
|
||||
app:title="@string/app_name"
|
||||
app:titleTextAppearance="@style/ToolbarTextAppearanceNormal.Library"
|
||||
app:titleTextColor="?attr/colorControlNormal"
|
||||
tools:ignore="UnusedAttribute" />
|
||||
|
||||
<ViewStub
|
||||
android:id="@+id/cab_stub"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="@dimen/toolbar_height" />
|
||||
</FrameLayout>
|
||||
</com.google.android.material.appbar.AppBarLayout>
|
||||
|
||||
<FrameLayout
|
||||
android:id="@+id/fragment_container"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
app:layout_behavior="com.google.android.material.appbar.AppBarLayout$ScrollingViewBehavior" />
|
||||
</androidx.coordinatorlayout.widget.CoordinatorLayout>
|
||||
</LinearLayout>
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
|
@ -15,9 +15,10 @@
|
|||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
android:id="@+id/container"
|
||||
android:overScrollMode="never"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="@dimen/toolbar_height"
|
||||
android:overScrollMode="never"
|
||||
app:layout_behavior="com.google.android.material.appbar.AppBarLayout$ScrollingViewBehavior">
|
||||
|
||||
<androidx.constraintlayout.widget.ConstraintLayout
|
||||
|
|
|
@ -11,64 +11,59 @@
|
|||
~ without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
||||
~ See the GNU General Public License for more details.
|
||||
-->
|
||||
<androidx.core.widget.NestedScrollView 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:tools="http://schemas.android.com/tools"
|
||||
android:id="@+id/container"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="@dimen/toolbar_height"
|
||||
android:overScrollMode="never"
|
||||
app:layout_behavior="com.google.android.material.appbar.AppBarLayout$ScrollingViewBehavior">
|
||||
|
||||
<androidx.constraintlayout.widget.ConstraintLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content">
|
||||
<code.name.monkey.retromusic.views.RetroShapeableImageView
|
||||
android:id="@+id/userImage"
|
||||
android:layout_width="42dp"
|
||||
android:layout_height="42dp"
|
||||
android:layout_marginStart="16dp"
|
||||
android:layout_marginTop="16dp"
|
||||
android:layout_marginBottom="8dp"
|
||||
android:scaleType="centerCrop"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent"
|
||||
app:retroCornerSize="21dp"
|
||||
tools:srcCompat="@tools:sample/avatars" />
|
||||
|
||||
<code.name.monkey.retromusic.views.RetroShapeableImageView
|
||||
android:id="@+id/userImage"
|
||||
android:layout_width="42dp"
|
||||
android:layout_height="42dp"
|
||||
android:layout_marginStart="16dp"
|
||||
android:layout_marginTop="16dp"
|
||||
android:layout_marginBottom="8dp"
|
||||
android:scaleType="centerCrop"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent"
|
||||
app:retroCornerSize="21dp"
|
||||
tools:srcCompat="@tools:sample/avatars" />
|
||||
<com.google.android.material.textview.MaterialTextView
|
||||
android:id="@+id/text"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginStart="16dp"
|
||||
android:ellipsize="end"
|
||||
android:text="@string/welcome"
|
||||
app:layout_constraintStart_toEndOf="@+id/userImage"
|
||||
app:layout_constraintTop_toTopOf="@+id/userImage"
|
||||
tools:text="@tools:sample/lorem" />
|
||||
|
||||
<com.google.android.material.textview.MaterialTextView
|
||||
android:id="@+id/text"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginStart="16dp"
|
||||
android:ellipsize="end"
|
||||
android:text="@string/welcome"
|
||||
app:layout_constraintStart_toEndOf="@+id/userImage"
|
||||
app:layout_constraintTop_toTopOf="@+id/userImage"
|
||||
tools:text="@tools:sample/lorem" />
|
||||
<com.google.android.material.textview.MaterialTextView
|
||||
android:id="@+id/titleWelcome"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginStart="16dp"
|
||||
android:padding="0dp"
|
||||
android:textAppearance="@style/TextViewHeadline5"
|
||||
android:textColor="?android:attr/textColorPrimary"
|
||||
android:textStyle="bold"
|
||||
app:layout_constraintBottom_toBottomOf="@+id/userImage"
|
||||
app:layout_constraintStart_toEndOf="@+id/userImage"
|
||||
app:layout_constraintTop_toBottomOf="@+id/text"
|
||||
tools:text="@tools:sample/lorem" />
|
||||
|
||||
<com.google.android.material.textview.MaterialTextView
|
||||
android:id="@+id/titleWelcome"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginStart="16dp"
|
||||
android:padding="0dp"
|
||||
android:textAppearance="@style/TextViewHeadline5"
|
||||
android:textColor="?android:attr/textColorPrimary"
|
||||
android:textStyle="bold"
|
||||
app:layout_constraintBottom_toBottomOf="@+id/userImage"
|
||||
app:layout_constraintStart_toEndOf="@+id/userImage"
|
||||
app:layout_constraintTop_toBottomOf="@+id/text"
|
||||
tools:text="@tools:sample/lorem" />
|
||||
|
||||
<include
|
||||
layout="@layout/home_content"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@id/titleWelcome" />
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||
|
||||
</androidx.core.widget.NestedScrollView>
|
||||
<include
|
||||
layout="@layout/home_content"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@id/titleWelcome" />
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
|
@ -5,11 +5,12 @@
|
|||
android:id="@+id/container"
|
||||
android:layout_width="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
|
||||
android:id="@+id/recyclerView"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_height="match_parent"
|
||||
android:clipToPadding="false"
|
||||
android:layoutAnimation="@anim/layout_animation_fall_down"
|
||||
android:overScrollMode="never"
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<androidx.core.widget.NestedScrollView xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
<ScrollView xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||
android:id="@+id/scrollView"
|
||||
android:layout_width="match_parent"
|
||||
|
@ -162,4 +162,4 @@
|
|||
app:settingListItemTitle="@string/action_about" />
|
||||
|
||||
</LinearLayout>
|
||||
</androidx.core.widget.NestedScrollView>
|
||||
</ScrollView>
|
|
@ -4,7 +4,7 @@
|
|||
xmlns:tools="http://schemas.android.com/tools"
|
||||
android:id="@+id/miniPlayerContent"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="@dimen/bottom_sheet_peek_1_height"
|
||||
android:layout_height="@dimen/mini_player_height"
|
||||
android:background="?attr/colorSurface"
|
||||
android:clickable="true"
|
||||
android:focusable="true"
|
||||
|
|
|
@ -5,5 +5,4 @@
|
|||
android:layout_width="match_parent"
|
||||
android:layout_height="0dp"
|
||||
android:background="@android:color/transparent"
|
||||
android:elevation="@dimen/toolbar_elevation"
|
||||
tools:ignore="UnusedAttribute" />
|
Loading…
Add table
Add a link
Reference in a new issue