From ae63b6798f37ff3f8dacfe9b7dfff5d9170febeb Mon Sep 17 00:00:00 2001 From: Hemanth S Date: Thu, 21 May 2020 23:52:48 +0530 Subject: [PATCH] Update mini player for tablet --- .../fragments/MiniPlayerFragment.kt | 16 ++ .../fragments/songs/SongsFragment.kt | 2 - .../layout-xlarge-land/fragment_player.xml | 2 +- .../layout-xlarge/fragment_mini_player.xml | 153 ++++++++++-------- 4 files changed, 103 insertions(+), 70 deletions(-) diff --git a/app/src/main/java/code/name/monkey/retromusic/fragments/MiniPlayerFragment.kt b/app/src/main/java/code/name/monkey/retromusic/fragments/MiniPlayerFragment.kt index 337e257d..f1325b2b 100644 --- a/app/src/main/java/code/name/monkey/retromusic/fragments/MiniPlayerFragment.kt +++ b/app/src/main/java/code/name/monkey/retromusic/fragments/MiniPlayerFragment.kt @@ -14,12 +14,14 @@ import code.name.monkey.retromusic.R import code.name.monkey.retromusic.extensions.textColorPrimary import code.name.monkey.retromusic.extensions.textColorSecondary import code.name.monkey.retromusic.fragments.base.AbsMusicServiceFragment +import code.name.monkey.retromusic.glide.SongGlideRequest import code.name.monkey.retromusic.helper.MusicPlayerRemote import code.name.monkey.retromusic.helper.MusicProgressViewUpdateHelper import code.name.monkey.retromusic.helper.PlayPauseButtonOnClickHandler import code.name.monkey.retromusic.util.PreferenceUtil import code.name.monkey.retromusic.util.RetroUtil import code.name.monkey.retromusic.util.ViewUtil +import com.bumptech.glide.Glide import kotlinx.android.synthetic.main.fragment_mini_player.* import kotlin.math.abs @@ -58,6 +60,7 @@ open class MiniPlayerFragment : AbsMusicServiceFragment(), MusicProgressViewUpda actionPrevious.visibility = View.VISIBLE actionNext?.visibility = View.VISIBLE actionPrevious?.visibility = View.VISIBLE + } else { actionNext.visibility = if (PreferenceUtil.getInstance(requireContext()).isExtraControls) View.VISIBLE else View.GONE @@ -93,6 +96,19 @@ open class MiniPlayerFragment : AbsMusicServiceFragment(), MusicProgressViewUpda miniPlayerTitle.isSelected = true miniPlayerTitle.text = builder + + if (RetroUtil.isTablet()) { + image?.let { + SongGlideRequest.Builder.from( + Glide.with(requireContext()), + MusicPlayerRemote.currentSong + ).checkIgnoreMediaStore(requireContext()) + .ignoreMediaStore(PreferenceUtil.isAllowedToDownloadMetadata(requireContext())) + .asBitmap() + .build() + .into(it) + } + } } override fun onServiceConnected() { diff --git a/app/src/main/java/code/name/monkey/retromusic/fragments/songs/SongsFragment.kt b/app/src/main/java/code/name/monkey/retromusic/fragments/songs/SongsFragment.kt index 4b2c0777..9c86abc9 100644 --- a/app/src/main/java/code/name/monkey/retromusic/fragments/songs/SongsFragment.kt +++ b/app/src/main/java/code/name/monkey/retromusic/fragments/songs/SongsFragment.kt @@ -38,7 +38,6 @@ class SongsFragment : } override fun createLayoutManager(): GridLayoutManager { - println("createLayoutManager: ${getGridSize()}") return GridLayoutManager(requireActivity(), getGridSize()).apply { spanSizeLookup = object : GridLayoutManager.SpanSizeLookup() { override fun getSpanSize(position: Int): Int { @@ -118,7 +117,6 @@ class SongsFragment : } companion object { - @JvmField var TAG: String = SongsFragment::class.java.simpleName diff --git a/app/src/main/res/layout-xlarge-land/fragment_player.xml b/app/src/main/res/layout-xlarge-land/fragment_player.xml index b0c51776..1c783414 100644 --- a/app/src/main/res/layout-xlarge-land/fragment_player.xml +++ b/app/src/main/res/layout-xlarge-land/fragment_player.xml @@ -18,7 +18,7 @@ app:layout_constraintTop_toTopOf="parent" /> - + - - + - - - - - - - + tools:src="@drawable/default_album_art" /> + + + + + - - + + + + + - \ No newline at end of file + android:progress="20" + app:layout_constraintEnd_toEndOf="parent" + app:layout_constraintStart_toStartOf="parent" + app:layout_constraintTop_toTopOf="parent" /> + \ No newline at end of file