From 38feb215682e2a5a0721ebd1423d078df551235c Mon Sep 17 00:00:00 2001 From: h4h13 Date: Sat, 7 Dec 2019 09:09:15 +0530 Subject: [PATCH] Fix toolbar color in Playlist and Genre details --- .../activities/GenreDetailsActivity.kt | 10 +- .../activities/LockScreenActivity.kt | 25 +- .../activities/PlaylistDetailActivity.kt | 10 +- .../adapter/song/PlayingQueueAdapter.kt | 255 +++++++-------- .../retromusic/adapter/song/SongAdapter.kt | 299 +++++++++--------- .../LockScreenPlayerControlsFragment.kt | 4 +- .../name/monkey/retromusic/model/Genre.kt | 2 +- .../main/res/layout/activity_lock_screen.xml | 38 +-- ...fragment_lock_screen_playback_controls.xml | 6 +- app/src/main/res/layout/item_queue.xml | 132 ++++---- app/src/main/res/values/styles_parents.xml | 1 - 11 files changed, 377 insertions(+), 405 deletions(-) diff --git a/app/src/main/java/code/name/monkey/retromusic/activities/GenreDetailsActivity.kt b/app/src/main/java/code/name/monkey/retromusic/activities/GenreDetailsActivity.kt index 8ed66be5..6d3ca809 100644 --- a/app/src/main/java/code/name/monkey/retromusic/activities/GenreDetailsActivity.kt +++ b/app/src/main/java/code/name/monkey/retromusic/activities/GenreDetailsActivity.kt @@ -128,15 +128,7 @@ class GenreDetailsActivity : AbsSlidingMusicPanelActivity(), CabHolder, GenreDet override fun openCab(menuRes: Int, callback: MaterialCab.Callback): MaterialCab { if (cab != null && cab!!.isActive) cab!!.finish() - cab = MaterialCab(this, R.id.cab_stub).setMenu(menuRes) - .setCloseDrawableRes(R.drawable.ic_close_white_24dp).setBackgroundColor( - RetroColorUtil.shiftBackgroundColorForLightText( - ATHUtil.resolveColor( - this, - R.attr.colorPrimary - ) - ) - ).start(callback) + cab = MaterialCab(this, R.id.cab_stub).setMenu(menuRes).setCloseDrawableRes(R.drawable.ic_close_white_24dp).setBackgroundColor(RetroColorUtil.shiftBackgroundColorForLightText(ATHUtil.resolveColor(this, R.attr.colorSurface))).start(callback) return cab!! } diff --git a/app/src/main/java/code/name/monkey/retromusic/activities/LockScreenActivity.kt b/app/src/main/java/code/name/monkey/retromusic/activities/LockScreenActivity.kt index e477eaf1..3f0dffbd 100644 --- a/app/src/main/java/code/name/monkey/retromusic/activities/LockScreenActivity.kt +++ b/app/src/main/java/code/name/monkey/retromusic/activities/LockScreenActivity.kt @@ -2,18 +2,22 @@ package code.name.monkey.retromusic.activities import android.app.KeyguardManager import android.content.Context -import android.os.* -import android.view.* +import android.os.Build +import android.os.Bundle +import android.view.View +import android.view.WindowManager import androidx.core.view.ViewCompat -import code.name.monkey.appthemehelper.util.ATHUtil import code.name.monkey.retromusic.R import code.name.monkey.retromusic.activities.base.AbsMusicServiceActivity import code.name.monkey.retromusic.fragments.player.lockscreen.LockScreenPlayerControlsFragment -import code.name.monkey.retromusic.glide.* +import code.name.monkey.retromusic.glide.RetroMusicColoredTarget +import code.name.monkey.retromusic.glide.SongGlideRequest import code.name.monkey.retromusic.helper.MusicPlayerRemote import com.bumptech.glide.Glide import com.r0adkll.slidr.Slidr -import com.r0adkll.slidr.model.* +import com.r0adkll.slidr.model.SlidrConfig +import com.r0adkll.slidr.model.SlidrListener +import com.r0adkll.slidr.model.SlidrPosition import kotlinx.android.synthetic.main.activity_lock_screen.* class LockScreenActivity : AbsMusicServiceActivity() { @@ -25,13 +29,10 @@ class LockScreenActivity : AbsMusicServiceActivity() { setShowWhenLocked(true) setTurnScreenOn(true) } else { - this.window.addFlags( - WindowManager.LayoutParams.FLAG_DISMISS_KEYGUARD or WindowManager.LayoutParams.FLAG_SHOW_WHEN_LOCKED or WindowManager.LayoutParams.FLAG_TURN_SCREEN_ON - ) + this.window.addFlags(WindowManager.LayoutParams.FLAG_DISMISS_KEYGUARD or WindowManager.LayoutParams.FLAG_SHOW_WHEN_LOCKED or WindowManager.LayoutParams.FLAG_TURN_SCREEN_ON) } setDrawUnderStatusBar() setContentView(R.layout.activity_lock_screen) - hideStatusBar() setStatusbarColorAuto() setNavigationbarColorAuto() @@ -70,12 +71,6 @@ class LockScreenActivity : AbsMusicServiceActivity() { alpha = 0f ViewCompat.animate(this).translationY(0f).alpha(1f).setDuration(1500).start() } - - findViewById(R.id.root_layout).setBackgroundColor( - ATHUtil.resolveColor( - this, R.attr.colorPrimary - ) - ) } override fun onPlayingMetaChanged() { diff --git a/app/src/main/java/code/name/monkey/retromusic/activities/PlaylistDetailActivity.kt b/app/src/main/java/code/name/monkey/retromusic/activities/PlaylistDetailActivity.kt index b41acf11..5d1361ce 100644 --- a/app/src/main/java/code/name/monkey/retromusic/activities/PlaylistDetailActivity.kt +++ b/app/src/main/java/code/name/monkey/retromusic/activities/PlaylistDetailActivity.kt @@ -140,15 +140,7 @@ class PlaylistDetailActivity : AbsSlidingMusicPanelActivity(), CabHolder, Playli if (cab != null && cab!!.isActive) { cab!!.finish() } - cab = MaterialCab(this, R.id.cab_stub).setMenu(menuRes) - .setCloseDrawableRes(R.drawable.ic_close_white_24dp).setBackgroundColor( - RetroColorUtil.shiftBackgroundColorForLightText( - ATHUtil.resolveColor( - this, - R.attr.colorPrimary - ) - ) - ).start(callback) + cab = MaterialCab(this, R.id.cab_stub).setMenu(menuRes).setCloseDrawableRes(R.drawable.ic_close_white_24dp).setBackgroundColor(RetroColorUtil.shiftBackgroundColorForLightText(ATHUtil.resolveColor(this, R.attr.colorSurface))).start(callback) return cab!! } diff --git a/app/src/main/java/code/name/monkey/retromusic/adapter/song/PlayingQueueAdapter.kt b/app/src/main/java/code/name/monkey/retromusic/adapter/song/PlayingQueueAdapter.kt index 66f927d6..9f2e17cd 100644 --- a/app/src/main/java/code/name/monkey/retromusic/adapter/song/PlayingQueueAdapter.kt +++ b/app/src/main/java/code/name/monkey/retromusic/adapter/song/PlayingQueueAdapter.kt @@ -1,167 +1,170 @@ package code.name.monkey.retromusic.adapter.song -import android.graphics.* -import android.view.* +import android.graphics.Color +import android.graphics.PorterDuff +import android.view.MenuItem +import android.view.View import android.widget.ImageView import androidx.appcompat.app.AppCompatActivity import code.name.monkey.retromusic.R import code.name.monkey.retromusic.helper.MusicPlayerRemote import code.name.monkey.retromusic.model.Song -import code.name.monkey.retromusic.util.* -import com.h6ah4i.android.widget.advrecyclerview.draggable.* +import code.name.monkey.retromusic.util.MusicUtil +import code.name.monkey.retromusic.util.ViewUtil +import com.h6ah4i.android.widget.advrecyclerview.draggable.DraggableItemAdapter +import com.h6ah4i.android.widget.advrecyclerview.draggable.DraggableItemViewHolder +import com.h6ah4i.android.widget.advrecyclerview.draggable.ItemDraggableRange import com.h6ah4i.android.widget.advrecyclerview.draggable.annotation.DraggableItemStateFlags import java.util.* class PlayingQueueAdapter( - activity: AppCompatActivity, - dataSet: ArrayList, - private var current: Int, - itemLayoutRes: Int + activity: AppCompatActivity, + dataSet: ArrayList, + private var current: Int, + itemLayoutRes: Int ) : SongAdapter( - activity, dataSet, itemLayoutRes, false, null + activity, dataSet, itemLayoutRes, false, null ), DraggableItemAdapter { - private var color = -1 + private var color = -1 - override fun createViewHolder(view: View): SongAdapter.ViewHolder { - return ViewHolder(view) - } + override fun createViewHolder(view: View): SongAdapter.ViewHolder { + return ViewHolder(view) + } - override fun onBindViewHolder(holder: SongAdapter.ViewHolder, position: Int) { - super.onBindViewHolder(holder, position) - holder.imageText?.text = (position - current).toString() - holder.time?.text = MusicUtil.getReadableDurationString(dataSet[position].duration) - if (holder.itemViewType == HISTORY || holder.itemViewType == CURRENT) { - setAlpha(holder, 0.5f) - } - if (usePalette) { - setColor(holder, Color.WHITE) - } - } + override fun onBindViewHolder(holder: SongAdapter.ViewHolder, position: Int) { + super.onBindViewHolder(holder, position) + holder.imageText?.text = (position - current).toString() + holder.time?.text = MusicUtil.getReadableDurationString(dataSet[position].duration) + if (holder.itemViewType == HISTORY || holder.itemViewType == CURRENT) { + setAlpha(holder, 0.5f) + } + if (usePalette) { + setColor(holder, Color.WHITE) + } + } - private fun setColor(holder: SongAdapter.ViewHolder, white: Int) { + private fun setColor(holder: SongAdapter.ViewHolder, white: Int) { - if (holder.title != null) { - holder.title!!.setTextColor(white) - if (color != -1) { - holder.title!!.setTextColor(color) - } - } + if (holder.title != null) { + holder.title!!.setTextColor(white) + if (color != -1) { + holder.title!!.setTextColor(color) + } + } - holder.text?.setTextColor(white) - holder.time?.setTextColor(white) - holder.imageText?.setTextColor(white) - if (holder.menu != null) { - (holder.menu as ImageView).setColorFilter(white, PorterDuff.Mode.SRC_IN) - } - } + holder.text?.setTextColor(white) + holder.time?.setTextColor(white) + holder.imageText?.setTextColor(white) + if (holder.menu != null) { + (holder.menu as ImageView).setColorFilter(white, PorterDuff.Mode.SRC_IN) + } + } - override fun usePalette(usePalette: Boolean) { - super.usePalette(usePalette) - this.usePalette = usePalette - notifyDataSetChanged() - } + override fun usePalette(usePalette: Boolean) { + super.usePalette(usePalette) + this.usePalette = usePalette + notifyDataSetChanged() + } - override fun getItemViewType(position: Int): Int { - if (position < current) { - return HISTORY - } else if (position > current) { - return UP_NEXT - } - return CURRENT - } + override fun getItemViewType(position: Int): Int { + if (position < current) { + return HISTORY + } else if (position > current) { + return UP_NEXT + } + return CURRENT + } - override fun loadAlbumCover(song: Song, holder: SongAdapter.ViewHolder) { - // We don't want to load it in this adapter - } + override fun loadAlbumCover(song: Song, holder: SongAdapter.ViewHolder) { + // We don't want to load it in this adapter + } - fun swapDataSet(dataSet: ArrayList, position: Int) { - this.dataSet = dataSet - current = position - notifyDataSetChanged() - } + fun swapDataSet(dataSet: ArrayList, position: Int) { + this.dataSet = dataSet + current = position + notifyDataSetChanged() + } - fun setCurrent(current: Int) { - this.current = current - notifyDataSetChanged() - } + fun setCurrent(current: Int) { + this.current = current + notifyDataSetChanged() + } - private fun setAlpha(holder: SongAdapter.ViewHolder, alpha: Float) { - holder.image?.alpha = alpha - holder.title?.alpha = alpha - holder.text?.alpha = alpha - holder.imageText?.alpha = alpha - holder.paletteColorContainer?.alpha = alpha - } + private fun setAlpha(holder: SongAdapter.ViewHolder, alpha: Float) { + holder.image?.alpha = alpha + holder.title?.alpha = alpha + holder.text?.alpha = alpha + holder.imageText?.alpha = alpha + holder.paletteColorContainer?.alpha = alpha + holder.dragView?.alpha = alpha + holder.menu?.alpha = alpha + } - override fun onCheckCanStartDrag(holder: ViewHolder, position: Int, x: Int, y: Int): Boolean { - return ViewUtil.hitTest(holder.imageText!!, x, y) || ViewUtil.hitTest( - holder.dragView!!, - x, - y - ) - } + override fun onCheckCanStartDrag(holder: ViewHolder, position: Int, x: Int, y: Int): Boolean { + return ViewUtil.hitTest(holder.imageText!!, x, y) || ViewUtil.hitTest(holder.dragView!!, x, y) + } - override fun onGetItemDraggableRange(holder: ViewHolder, position: Int): ItemDraggableRange? { - return null - } + override fun onGetItemDraggableRange(holder: ViewHolder, position: Int): ItemDraggableRange? { + return null + } - override fun onMoveItem(fromPosition: Int, toPosition: Int) { - MusicPlayerRemote.moveSong(fromPosition, toPosition) - } + override fun onMoveItem(fromPosition: Int, toPosition: Int) { + MusicPlayerRemote.moveSong(fromPosition, toPosition) + } - override fun onCheckCanDrop(draggingPosition: Int, dropPosition: Int): Boolean { - return true - } + override fun onCheckCanDrop(draggingPosition: Int, dropPosition: Int): Boolean { + return true + } - override fun onItemDragStarted(position: Int) { - notifyDataSetChanged() - } + override fun onItemDragStarted(position: Int) { + notifyDataSetChanged() + } - override fun onItemDragFinished(fromPosition: Int, toPosition: Int, result: Boolean) { - notifyDataSetChanged() - } + override fun onItemDragFinished(fromPosition: Int, toPosition: Int, result: Boolean) { + notifyDataSetChanged() + } - inner class ViewHolder(itemView: View) : SongAdapter.ViewHolder(itemView), DraggableItemViewHolder { + inner class ViewHolder(itemView: View) : SongAdapter.ViewHolder(itemView), DraggableItemViewHolder { - @DraggableItemStateFlags - private var mDragStateFlags: Int = 0 + @DraggableItemStateFlags + private var mDragStateFlags: Int = 0 - override var songMenuRes: Int - get() = R.menu.menu_item_playing_queue_song - set(value: Int) { - super.songMenuRes = value - } + override var songMenuRes: Int + get() = R.menu.menu_item_playing_queue_song + set(value) { + super.songMenuRes = value + } - init { - imageText?.visibility = View.VISIBLE - dragView?.visibility = View.VISIBLE - } + init { + imageText?.visibility = View.VISIBLE + dragView?.visibility = View.VISIBLE + } - override fun onSongMenuItemClick(item: MenuItem): Boolean { - when (item.itemId) { - R.id.action_remove_from_playing_queue -> { - MusicPlayerRemote.removeFromQueue(adapterPosition) - return true - } - } - return super.onSongMenuItemClick(item) - } + override fun onSongMenuItemClick(item: MenuItem): Boolean { + when (item.itemId) { + R.id.action_remove_from_playing_queue -> { + MusicPlayerRemote.removeFromQueue(adapterPosition) + return true + } + } + return super.onSongMenuItemClick(item) + } - @DraggableItemStateFlags - override fun getDragStateFlags(): Int { - return mDragStateFlags - } + @DraggableItemStateFlags + override fun getDragStateFlags(): Int { + return mDragStateFlags + } - override fun setDragStateFlags(@DraggableItemStateFlags flags: Int) { - mDragStateFlags = flags - } - } + override fun setDragStateFlags(@DraggableItemStateFlags flags: Int) { + mDragStateFlags = flags + } + } - companion object { + companion object { - private const val HISTORY = 0 - private const val CURRENT = 1 - private const val UP_NEXT = 2 - } + private const val HISTORY = 0 + private const val CURRENT = 1 + private const val UP_NEXT = 2 + } } diff --git a/app/src/main/java/code/name/monkey/retromusic/adapter/song/SongAdapter.kt b/app/src/main/java/code/name/monkey/retromusic/adapter/song/SongAdapter.kt index 325cbb3b..14912aa2 100644 --- a/app/src/main/java/code/name/monkey/retromusic/adapter/song/SongAdapter.kt +++ b/app/src/main/java/code/name/monkey/retromusic/adapter/song/SongAdapter.kt @@ -10,6 +10,8 @@ import androidx.appcompat.app.AppCompatActivity 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.extensions.show import code.name.monkey.retromusic.glide.RetroMusicColoredTarget import code.name.monkey.retromusic.glide.SongGlideRequest import code.name.monkey.retromusic.helper.MusicPlayerRemote @@ -31,181 +33,182 @@ import java.util.* */ open class SongAdapter( - protected val activity: AppCompatActivity, - dataSet: ArrayList, - protected var itemLayoutRes: Int, - usePalette: Boolean, - cabHolder: CabHolder?, - showSectionName: Boolean = true + protected val activity: AppCompatActivity, + dataSet: ArrayList, + protected var itemLayoutRes: Int, + usePalette: Boolean, + cabHolder: CabHolder?, + showSectionName: Boolean = true ) : AbsMultiSelectAdapter( - activity, cabHolder, R.menu.menu_media_selection + activity, cabHolder, R.menu.menu_media_selection ), MaterialCab.Callback, FastScrollRecyclerView.SectionedAdapter { - var dataSet: ArrayList + var dataSet: ArrayList - protected var usePalette = false - private var showSectionName = true + protected var usePalette = false + private var showSectionName = true - init { - this.dataSet = dataSet - this.usePalette = usePalette - this.showSectionName = showSectionName - this.setHasStableIds(true) - } + init { + this.dataSet = dataSet + this.usePalette = usePalette + this.showSectionName = showSectionName + this.setHasStableIds(true) + } - open fun swapDataSet(dataSet: ArrayList) { - this.dataSet = dataSet - notifyDataSetChanged() - } + open fun swapDataSet(dataSet: ArrayList) { + this.dataSet = dataSet + notifyDataSetChanged() + } - open fun usePalette(usePalette: Boolean) { - this.usePalette = usePalette - notifyDataSetChanged() - } + open fun usePalette(usePalette: Boolean) { + this.usePalette = usePalette + notifyDataSetChanged() + } - override fun getItemId(position: Int): Long { - return dataSet[position].id.toLong() - } + override fun getItemId(position: Int): Long { + return dataSet[position].id.toLong() + } - override fun onCreateViewHolder(parent: ViewGroup, viewType: Int): ViewHolder { - val view = LayoutInflater.from(activity).inflate(itemLayoutRes, parent, false) - return createViewHolder(view) - } + override fun onCreateViewHolder(parent: ViewGroup, viewType: Int): ViewHolder { + val view = LayoutInflater.from(activity).inflate(itemLayoutRes, parent, false) + return createViewHolder(view) + } - protected open fun createViewHolder(view: View): ViewHolder { - return ViewHolder(view) - } + protected open fun createViewHolder(view: View): ViewHolder { + return ViewHolder(view) + } - override fun onBindViewHolder(holder: ViewHolder, position: Int) { - val song = dataSet[position] - val isChecked = isChecked(song) - holder.itemView.isActivated = isChecked - holder.title?.text = getSongTitle(song) - holder.text?.text = getSongText(song) - loadAlbumCover(song, holder) - } + override fun onBindViewHolder(holder: ViewHolder, position: Int) { + val song = dataSet[position] + val isChecked = isChecked(song) + holder.itemView.isActivated = isChecked + if (isChecked) { + holder.menu?.hide() + } else { + holder.menu?.show() + } + holder.title?.text = getSongTitle(song) + holder.text?.text = getSongText(song) + loadAlbumCover(song, holder) + } - private fun setColors(color: Int, holder: ViewHolder) { - if (holder.paletteColorContainer != null) { - holder.paletteColorContainer?.setBackgroundColor(color) - //holder.title?.setTextColor(MaterialValueHelper.getPrimaryTextColor(activity, ColorUtil.isColorLight(color))) - //holder.text?.setTextColor(MaterialValueHelper.getSecondaryTextColor(activity, ColorUtil.isColorLight(color))) - } - } + private fun setColors(color: Int, holder: ViewHolder) { + if (holder.paletteColorContainer != null) { + holder.paletteColorContainer?.setBackgroundColor(color) + //holder.title?.setTextColor(MaterialValueHelper.getPrimaryTextColor(activity, ColorUtil.isColorLight(color))) + //holder.text?.setTextColor(MaterialValueHelper.getSecondaryTextColor(activity, ColorUtil.isColorLight(color))) + } + } - protected open fun loadAlbumCover(song: Song, holder: ViewHolder) { - if (holder.image == null) { - return - } - SongGlideRequest.Builder.from(Glide.with(activity), song).checkIgnoreMediaStore(activity) - .generatePalette(activity).build() - .into(object : RetroMusicColoredTarget(holder.image!!) { - override fun onLoadCleared(placeholder: Drawable?) { - super.onLoadCleared(placeholder) - setColors(defaultFooterColor, holder) - } + protected open fun loadAlbumCover(song: Song, holder: ViewHolder) { + if (holder.image == null) { + return + } + SongGlideRequest.Builder.from(Glide.with(activity), song).checkIgnoreMediaStore(activity) + .generatePalette(activity).build() + .into(object : RetroMusicColoredTarget(holder.image!!) { + override fun onLoadCleared(placeholder: Drawable?) { + super.onLoadCleared(placeholder) + setColors(defaultFooterColor, holder) + } - override fun onColorReady(color: Int) { - if (usePalette) setColors(color, holder) - else setColors(defaultFooterColor, holder) - } - }) - } + override fun onColorReady(color: Int) { + if (usePalette) setColors(color, holder) + else setColors(defaultFooterColor, holder) + } + }) + } - private fun getSongTitle(song: Song): String? { - return song.title - } + private fun getSongTitle(song: Song): String? { + return song.title + } - private fun getSongText(song: Song): String? { - return song.artistName - } + private fun getSongText(song: Song): String? { + return song.artistName + } - override fun getItemCount(): Int { - return dataSet.size - } + override fun getItemCount(): Int { + return dataSet.size + } - override fun getIdentifier(position: Int): Song? { - return dataSet[position] - } + override fun getIdentifier(position: Int): Song? { + return dataSet[position] + } - override fun getName(song: Song): String { - return song.title - } + override fun getName(song: Song): String { + return song.title + } - override fun onMultipleItemAction( - menuItem: MenuItem, selection: ArrayList - ) { - SongsMenuHelper.handleMenuClick(activity, selection, menuItem.itemId) - } + override fun onMultipleItemAction(menuItem: MenuItem, selection: ArrayList) { + SongsMenuHelper.handleMenuClick(activity, selection, menuItem.itemId) + } - override fun getSectionName(position: Int): String { - if (!showSectionName) { - return "" - } - val sectionName: String? = when (PreferenceUtil.getInstance(activity).songSortOrder) { - SortOrder.SongSortOrder.SONG_A_Z, SortOrder.SongSortOrder.SONG_Z_A -> dataSet[position].title - SortOrder.SongSortOrder.SONG_ALBUM -> dataSet[position].albumName - SortOrder.SongSortOrder.SONG_ARTIST -> dataSet[position].artistName - SortOrder.SongSortOrder.SONG_YEAR -> return MusicUtil.getYearString( - dataSet[position].year - ) - SortOrder.SongSortOrder.COMPOSER -> dataSet[position].composer - else -> { - return "" - } - } - return MusicUtil.getSectionName(sectionName) - } + override fun getSectionName(position: Int): String { + if (!showSectionName) { + return "" + } + val sectionName: String? = when (PreferenceUtil.getInstance(activity).songSortOrder) { + SortOrder.SongSortOrder.SONG_A_Z, SortOrder.SongSortOrder.SONG_Z_A -> dataSet[position].title + SortOrder.SongSortOrder.SONG_ALBUM -> dataSet[position].albumName + SortOrder.SongSortOrder.SONG_ARTIST -> dataSet[position].artistName + SortOrder.SongSortOrder.SONG_YEAR -> return MusicUtil.getYearString(dataSet[position].year) + SortOrder.SongSortOrder.COMPOSER -> dataSet[position].composer + else -> { + return "" + } + } + return MusicUtil.getSectionName(sectionName) + } - open inner class ViewHolder(itemView: View) : MediaEntryViewHolder(itemView) { - protected open var songMenuRes = SongMenuHelper.MENU_RES - protected open val song: Song - get() = dataSet[adapterPosition] + open inner class ViewHolder(itemView: View) : MediaEntryViewHolder(itemView) { + protected open var songMenuRes = SongMenuHelper.MENU_RES + protected open val song: Song + get() = dataSet[adapterPosition] - init { - setImageTransitionName(activity.getString(R.string.transition_album_art)) - menu?.setOnClickListener(object : SongMenuHelper.OnClickSongMenu(activity) { - override val song: Song - get() = this@ViewHolder.song + init { + setImageTransitionName(activity.getString(R.string.transition_album_art)) + menu?.setOnClickListener(object : SongMenuHelper.OnClickSongMenu(activity) { + override val song: Song + get() = this@ViewHolder.song - override val menuRes: Int - get() = songMenuRes + override val menuRes: Int + get() = songMenuRes - override fun onMenuItemClick(item: MenuItem): Boolean { - return onSongMenuItemClick(item) || super.onMenuItemClick(item) - } - }) - } + override fun onMenuItemClick(item: MenuItem): Boolean { + return onSongMenuItemClick(item) || super.onMenuItemClick(item) + } + }) + } - protected open fun onSongMenuItemClick(item: MenuItem): Boolean { - if (image != null && image!!.visibility == View.VISIBLE) { - when (item.itemId) { - R.id.action_go_to_album -> { - val options: ActivityOptions = ActivityOptions.makeSceneTransitionAnimation( - activity, image, activity.getString(R.string.transition_album_art) - ) - NavigationUtil.goToAlbumOptions(activity, song.albumId, options) - return true - } - } - } - return false - } + protected open fun onSongMenuItemClick(item: MenuItem): Boolean { + if (image != null && image!!.visibility == View.VISIBLE) { + when (item.itemId) { + R.id.action_go_to_album -> { + val options: ActivityOptions = ActivityOptions.makeSceneTransitionAnimation( + activity, image, activity.getString(R.string.transition_album_art) + ) + NavigationUtil.goToAlbumOptions(activity, song.albumId, options) + return true + } + } + } + return false + } - override fun onClick(v: View?) { - if (isInQuickSelectMode) { - toggleChecked(adapterPosition) - } else { - MusicPlayerRemote.openQueue(dataSet, adapterPosition, true) - } - } + override fun onClick(v: View?) { + if (isInQuickSelectMode) { + toggleChecked(adapterPosition) + } else { + MusicPlayerRemote.openQueue(dataSet, adapterPosition, true) + } + } - override fun onLongClick(v: View?): Boolean { - return toggleChecked(adapterPosition) - } - } + override fun onLongClick(v: View?): Boolean { + return toggleChecked(adapterPosition) + } + } - companion object { + companion object { - val TAG: String = SongAdapter::class.java.simpleName - } + val TAG: String = SongAdapter::class.java.simpleName + } } diff --git a/app/src/main/java/code/name/monkey/retromusic/fragments/player/lockscreen/LockScreenPlayerControlsFragment.kt b/app/src/main/java/code/name/monkey/retromusic/fragments/player/lockscreen/LockScreenPlayerControlsFragment.kt index 19a2cd97..a34e1614 100644 --- a/app/src/main/java/code/name/monkey/retromusic/fragments/player/lockscreen/LockScreenPlayerControlsFragment.kt +++ b/app/src/main/java/code/name/monkey/retromusic/fragments/player/lockscreen/LockScreenPlayerControlsFragment.kt @@ -58,14 +58,14 @@ class LockScreenPlayerControlsFragment : AbsPlayerControlsFragment() { override fun onCreateView(inflater: LayoutInflater, container: ViewGroup?, savedInstanceState: Bundle?): View? { - val view = inflater.inflate(R.layout.fragment_lock_screen_playback_controls, container, false) - return view + return inflater.inflate(R.layout.fragment_lock_screen_playback_controls, container, false) } override fun onViewCreated(view: View, savedInstanceState: Bundle?) { super.onViewCreated(view, savedInstanceState) setUpMusicControllers() + title.isSelected = true } private fun updateSong() { diff --git a/app/src/main/java/code/name/monkey/retromusic/model/Genre.kt b/app/src/main/java/code/name/monkey/retromusic/model/Genre.kt index 65144026..c2a7e274 100644 --- a/app/src/main/java/code/name/monkey/retromusic/model/Genre.kt +++ b/app/src/main/java/code/name/monkey/retromusic/model/Genre.kt @@ -18,4 +18,4 @@ import android.os.Parcelable import kotlinx.android.parcel.Parcelize @Parcelize -class Genre(val id: Int = -1, val name: String, val songCount: Int) : Parcelable \ No newline at end of file +data class Genre(val id: Int = -1, val name: String, val songCount: Int) : Parcelable \ No newline at end of file diff --git a/app/src/main/res/layout/activity_lock_screen.xml b/app/src/main/res/layout/activity_lock_screen.xml index 142b5a72..f4f0872a 100644 --- a/app/src/main/res/layout/activity_lock_screen.xml +++ b/app/src/main/res/layout/activity_lock_screen.xml @@ -2,9 +2,9 @@ - - + android:layout_margin="16dp" + android:transitionName="@string/transition_album_art" + app:cardCornerRadius="24dp" + app:cardElevation="8dp" + app:layout_constraintEnd_toEndOf="parent" + app:layout_constraintStart_toStartOf="parent" + app:layout_constraintTop_toTopOf="parent"> - + android:scaleType="centerCrop" + tools:srcCompat="@tools:sample/backgrounds/scenic[0]" /> - - - - + + android:text="@string/swipe_to_unlock" + android:textColor="?android:attr/textColorPrimary" /> \ No newline at end of file diff --git a/app/src/main/res/layout/fragment_lock_screen_playback_controls.xml b/app/src/main/res/layout/fragment_lock_screen_playback_controls.xml index 8f49e234..75aed24e 100644 --- a/app/src/main/res/layout/fragment_lock_screen_playback_controls.xml +++ b/app/src/main/res/layout/fragment_lock_screen_playback_controls.xml @@ -28,7 +28,7 @@ android:gravity="center_vertical|left|end" android:paddingLeft="8dp" android:singleLine="true" - android:textColor="?colorOnSecondary" + android:textColor="?android:attr/textColorSecondary" android:textSize="12sp" tools:ignore="RtlHardcoded,RtlSymmetry" tools:text="00:22" /> @@ -42,7 +42,7 @@ android:gravity="center_vertical|right|end" android:paddingRight="8dp" android:singleLine="true" - android:textColor="?colorOnSecondary" + android:textColor="?android:attr/textColorSecondary" android:textSize="12sp" tools:ignore="RtlHardcoded,RtlSymmetry" tools:text="00:22" /> @@ -97,7 +97,7 @@ android:maxLines="1" android:paddingStart="16dp" android:paddingEnd="16dp" - android:textAppearance="@style/TextAppearance.MaterialComponents.Body1" + android:textAppearance="@style/TextViewBody1" android:textColor="?android:attr/textColorSecondary" app:layout_constraintBottom_toTopOf="@+id/playerMediaControllerContainer" app:layout_constraintEnd_toEndOf="parent" diff --git a/app/src/main/res/layout/item_queue.xml b/app/src/main/res/layout/item_queue.xml index d7fc8188..2a82c9dc 100644 --- a/app/src/main/res/layout/item_queue.xml +++ b/app/src/main/res/layout/item_queue.xml @@ -1,5 +1,5 @@ - - + android:layout_gravity="center_vertical|start" + android:padding="8dp" + android:visibility="gone" + app:srcCompat="@drawable/ic_drag_vertical_white_24dp" + app:tint="?colorOnBackground" + tools:ignore="ContentDescription" + tools:visibility="visible" /> - + + - + + + + - - - - - - - - - - - - - + android:ellipsize="end" + android:maxLines="1" + android:textAppearance="@style/TextViewSubtitle1" + android:textSize="16sp" + tools:text="Song name" /> + - \ No newline at end of file + + + + \ No newline at end of file diff --git a/app/src/main/res/values/styles_parents.xml b/app/src/main/res/values/styles_parents.xml index ba4afaa2..bebeecf9 100644 --- a/app/src/main/res/values/styles_parents.xml +++ b/app/src/main/res/values/styles_parents.xml @@ -5,7 +5,6 @@ @font/circular @font/circular @font/circular - @color/md_red_500 true true @font/circular