Fit progress slider jumps
This commit is contained in:
parent
e2f3f1569a
commit
fc7c3b30f5
31 changed files with 758 additions and 678 deletions
|
@ -8,6 +8,7 @@ import androidx.annotation.IntDef
|
|||
import androidx.appcompat.app.AppCompatActivity
|
||||
import androidx.appcompat.widget.AppCompatTextView
|
||||
import androidx.recyclerview.widget.GridLayoutManager
|
||||
import androidx.recyclerview.widget.LinearLayoutManager
|
||||
import androidx.recyclerview.widget.RecyclerView
|
||||
import code.name.monkey.retromusic.R
|
||||
import code.name.monkey.retromusic.adapter.album.AlbumFullWidthAdapter
|
||||
|
@ -22,7 +23,7 @@ import code.name.monkey.retromusic.model.Playlist
|
|||
import code.name.monkey.retromusic.util.PreferenceUtil
|
||||
|
||||
class HomeAdapter(
|
||||
private val activity: AppCompatActivity, private val displayMetrics: DisplayMetrics
|
||||
private val activity: AppCompatActivity, private val displayMetrics: DisplayMetrics
|
||||
) : RecyclerView.Adapter<RecyclerView.ViewHolder>() {
|
||||
|
||||
private var list = ArrayList<Home>()
|
||||
|
@ -33,12 +34,18 @@ class HomeAdapter(
|
|||
|
||||
override fun onCreateViewHolder(parent: ViewGroup, viewType: Int): RecyclerView.ViewHolder {
|
||||
val layout = LayoutInflater.from(activity)
|
||||
.inflate(R.layout.section_recycler_view, parent, false)
|
||||
.inflate(R.layout.section_recycler_view, parent, false)
|
||||
return when (viewType) {
|
||||
RECENT_ARTISTS, TOP_ARTISTS -> ArtistViewHolder(layout)
|
||||
PLAYLISTS -> PlaylistViewHolder(layout)
|
||||
else -> {
|
||||
AlbumViewHolder(LayoutInflater.from(activity).inflate(R.layout.metal_section_recycler_view, parent, false))
|
||||
AlbumViewHolder(
|
||||
LayoutInflater.from(activity).inflate(
|
||||
R.layout.metal_section_recycler_view,
|
||||
parent,
|
||||
false
|
||||
)
|
||||
)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -89,7 +96,6 @@ class HomeAdapter(
|
|||
const val RECENT_ARTISTS = 2
|
||||
const val TOP_ARTISTS = 0
|
||||
const val PLAYLISTS = 4
|
||||
|
||||
}
|
||||
|
||||
private inner class AlbumViewHolder(view: View) : AbsHomeViewItem(view) {
|
||||
|
@ -109,15 +115,13 @@ class HomeAdapter(
|
|||
if (list.isNotEmpty()) {
|
||||
recyclerView.apply {
|
||||
show()
|
||||
layoutManager = GridLayoutManager(
|
||||
activity, 1, GridLayoutManager.HORIZONTAL, false
|
||||
)
|
||||
layoutManager = LinearLayoutManager(activity, LinearLayoutManager.HORIZONTAL, false)
|
||||
val artistAdapter = ArtistAdapter(
|
||||
activity,
|
||||
list,
|
||||
PreferenceUtil.getInstance(activity).getHomeGridStyle(activity),
|
||||
false,
|
||||
null
|
||||
activity,
|
||||
list,
|
||||
PreferenceUtil.getInstance(activity).getHomeGridStyle(activity),
|
||||
false,
|
||||
null
|
||||
)
|
||||
adapter = artistAdapter
|
||||
}
|
||||
|
@ -134,10 +138,10 @@ class HomeAdapter(
|
|||
recyclerView.apply {
|
||||
show()
|
||||
val songAdapter = SongAdapter(
|
||||
activity, songs, R.layout.item_album_card, false, null
|
||||
activity, songs, R.layout.item_album_card, false, null
|
||||
)
|
||||
layoutManager = GridLayoutManager(
|
||||
activity, 1, GridLayoutManager.HORIZONTAL, false
|
||||
activity, 1, GridLayoutManager.HORIZONTAL, false
|
||||
)
|
||||
adapter = songAdapter
|
||||
|
||||
|
@ -159,7 +163,7 @@ private fun <E> ArrayList<E>.toAlbums(): ArrayList<Album> {
|
|||
for (x in this) {
|
||||
arrayList.add(x as Album)
|
||||
}
|
||||
return arrayList;
|
||||
return arrayList
|
||||
}
|
||||
|
||||
private fun <E> ArrayList<E>.toArtists(): ArrayList<Artist> {
|
||||
|
@ -167,7 +171,7 @@ private fun <E> ArrayList<E>.toArtists(): ArrayList<Artist> {
|
|||
for (x in this) {
|
||||
arrayList.add(x as Artist)
|
||||
}
|
||||
return arrayList;
|
||||
return arrayList
|
||||
}
|
||||
|
||||
private fun <E> ArrayList<E>.toPlaylist(): ArrayList<Playlist> {
|
||||
|
@ -175,6 +179,6 @@ private fun <E> ArrayList<E>.toPlaylist(): ArrayList<Playlist> {
|
|||
for (x in this) {
|
||||
arrayList.add(x as Playlist)
|
||||
}
|
||||
return arrayList;
|
||||
return arrayList
|
||||
}
|
||||
|
||||
|
|
|
@ -101,7 +101,6 @@ class AlbumCoverPagerAdapter(
|
|||
val view = inflater.inflate(finalLayout, container, false)
|
||||
albumCover = view.findViewById(R.id.player_image)
|
||||
albumCover.setOnClickListener {
|
||||
|
||||
NavigationUtil.goToLyrics(requireActivity())
|
||||
}
|
||||
return view
|
||||
|
|
|
@ -13,6 +13,7 @@ import code.name.monkey.appthemehelper.util.MaterialValueHelper
|
|||
import code.name.monkey.retromusic.R
|
||||
import code.name.monkey.retromusic.adapter.base.AbsMultiSelectAdapter
|
||||
import code.name.monkey.retromusic.adapter.base.MediaEntryViewHolder
|
||||
import code.name.monkey.retromusic.extensions.hide
|
||||
import code.name.monkey.retromusic.glide.ArtistGlideRequest
|
||||
import code.name.monkey.retromusic.glide.RetroMusicColoredTarget
|
||||
import code.name.monkey.retromusic.helper.menu.SongsMenuHelper
|
||||
|
@ -63,13 +64,13 @@ class ArtistAdapter(
|
|||
val isChecked = isChecked(artist)
|
||||
holder.itemView.isActivated = isChecked
|
||||
holder.title?.text = artist.name
|
||||
holder.text?.visibility = View.GONE
|
||||
holder.text?.hide()
|
||||
loadArtistImage(artist, holder)
|
||||
}
|
||||
|
||||
fun setColors(color: Int, holder: ViewHolder) {
|
||||
if (holder.paletteColorContainer != null) {
|
||||
holder.paletteColorContainer?.setBackgroundColor(color)
|
||||
holder.paletteColorContainer?.backgroundTintList = ColorStateList.valueOf(color)
|
||||
holder.title?.setTextColor(
|
||||
MaterialValueHelper.getPrimaryTextColor(
|
||||
activity, ColorUtil.isColorLight(
|
||||
|
@ -78,7 +79,7 @@ class ArtistAdapter(
|
|||
)
|
||||
)
|
||||
}
|
||||
|
||||
holder.imageContainerCard?.setCardBackgroundColor(color)
|
||||
holder.mask?.backgroundTintList = ColorStateList.valueOf(color)
|
||||
}
|
||||
|
||||
|
|
|
@ -151,8 +151,7 @@ class BannerHomeFragment : AbsMainActivityFragment(), MainActivityFragmentCallba
|
|||
private fun setupToolbar() {
|
||||
|
||||
toolbar.apply {
|
||||
backgroundTintList =
|
||||
ColorStateList.valueOf(ATHUtil.resolveColor(requireContext(), R.attr.colorSurface))
|
||||
backgroundTintList = ColorStateList.valueOf(ATHUtil.resolveColor(requireContext(), R.attr.colorSurface))
|
||||
setNavigationIcon(R.drawable.ic_menu_white_24dp)
|
||||
setOnClickListener {
|
||||
val options = ActivityOptions.makeSceneTransitionAnimation(
|
||||
|
|
|
@ -14,7 +14,7 @@ import code.name.monkey.retromusic.helper.MusicPlayerRemote
|
|||
import code.name.monkey.retromusic.transform.CarousalPagerTransformer
|
||||
import code.name.monkey.retromusic.transform.ParallaxPagerTransformer
|
||||
import code.name.monkey.retromusic.util.PreferenceUtil
|
||||
import kotlinx.android.synthetic.main.fragment_player_album_cover.*
|
||||
import kotlinx.android.synthetic.main.fragment_player_album_cover.viewPager
|
||||
|
||||
|
||||
class PlayerAlbumCoverFragment : AbsMusicServiceFragment(), ViewPager.OnPageChangeListener {
|
||||
|
@ -44,8 +44,6 @@ class PlayerAlbumCoverFragment : AbsMusicServiceFragment(), ViewPager.OnPageChan
|
|||
|
||||
override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
|
||||
super.onViewCreated(view, savedInstanceState)
|
||||
|
||||
|
||||
viewPager.addOnPageChangeListener(this)
|
||||
//noinspection ConstantConditions
|
||||
if (PreferenceUtil.getInstance(requireContext()).carouselEffect() &&
|
||||
|
@ -60,8 +58,6 @@ class PlayerAlbumCoverFragment : AbsMusicServiceFragment(), ViewPager.OnPageChan
|
|||
viewPager.offscreenPageLimit = 2
|
||||
viewPager.setPageTransformer(true, PreferenceUtil.getInstance(requireContext()).albumCoverTransform)
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
override fun onDestroyView() {
|
||||
|
|
|
@ -132,6 +132,7 @@ class BlurPlaybackControlsFragment : AbsPlayerControlsFragment() {
|
|||
updatePrevNextColor()
|
||||
|
||||
text.setTextColor(lastDisabledPlaybackControlsColor)
|
||||
songInfo.setTextColor(lastDisabledPlaybackControlsColor)
|
||||
|
||||
TintHelper.setTintAuto(progressSlider, lastPlaybackControlsColor, false)
|
||||
volumeFragment?.setTintableColor(lastPlaybackControlsColor)
|
||||
|
|
|
@ -90,6 +90,7 @@ class CardBlurPlaybackControlsFragment : AbsPlayerControlsFragment() {
|
|||
val color = MaterialValueHelper.getPrimaryTextColor(context, false)
|
||||
songTotalTime.setTextColor(color)
|
||||
songCurrentProgress.setTextColor(color)
|
||||
songInfo.setTextColor(color)
|
||||
}
|
||||
|
||||
override fun onResume() {
|
||||
|
|
|
@ -107,7 +107,6 @@ class PlayerPlaybackControlsFragment : AbsPlayerControlsFragment(), OnSharedPref
|
|||
updatePrevNextColor()
|
||||
}
|
||||
|
||||
|
||||
private fun updateSong() {
|
||||
val song = MusicPlayerRemote.currentSong
|
||||
title.text = song.title
|
||||
|
|
|
@ -30,9 +30,9 @@ import code.name.monkey.retromusic.util.RippleUtils
|
|||
import com.google.android.material.bottomnavigation.BottomNavigationView
|
||||
|
||||
class BottomNavigationBarTinted @JvmOverloads constructor(
|
||||
context: Context,
|
||||
attrs: AttributeSet? = null,
|
||||
defStyleAttr: Int = 0
|
||||
context: Context,
|
||||
attrs: AttributeSet? = null,
|
||||
defStyleAttr: Int = 0
|
||||
) : BottomNavigationView(context, attrs, defStyleAttr) {
|
||||
|
||||
init {
|
||||
|
@ -43,13 +43,21 @@ class BottomNavigationBarTinted @JvmOverloads constructor(
|
|||
val accentColor = ThemeStore.accentColor(context)
|
||||
NavigationViewUtil.setItemIconColors(this, ColorUtil.withAlpha(iconColor, 0.5f), accentColor)
|
||||
NavigationViewUtil.setItemTextColors(this, ColorUtil.withAlpha(iconColor, 0.5f), accentColor)
|
||||
itemBackground = RippleDrawable(RippleUtils.convertToRippleDrawableColor(ColorStateList.valueOf(ThemeStore.accentColor(context).addAlpha())), ContextCompat.getDrawable(context, R.drawable.bottom_navigation_item_background), ContextCompat.getDrawable(context, R.drawable.bottom_navigation_item_background_mask))
|
||||
itemBackground = RippleDrawable(
|
||||
RippleUtils.convertToRippleDrawableColor(
|
||||
ColorStateList.valueOf(
|
||||
ThemeStore.accentColor(context).addAlpha()
|
||||
)
|
||||
),
|
||||
ContextCompat.getDrawable(context, R.drawable.bottom_navigation_item_background),
|
||||
ContextCompat.getDrawable(context, R.drawable.bottom_navigation_item_background_mask)
|
||||
)
|
||||
setOnApplyWindowInsetsListener(null)
|
||||
//itemRippleColor = ColorStateList.valueOf(accentColor)
|
||||
background = ColorDrawable(ATHUtil.resolveColor(context, R.attr.colorSurface))
|
||||
}
|
||||
}
|
||||
|
||||
private fun Int.addAlpha(): Int {
|
||||
fun Int.addAlpha(): Int {
|
||||
return ColorUtil.withAlpha(this, 0.12f)
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue