Fix toolbar color in Playlist and Genre details

This commit is contained in:
h4h13 2019-12-07 09:09:15 +05:30
parent 66c9f19ab9
commit 38feb21568
11 changed files with 377 additions and 405 deletions

View file

@ -128,15 +128,7 @@ class GenreDetailsActivity : AbsSlidingMusicPanelActivity(), CabHolder, GenreDet
override fun openCab(menuRes: Int, callback: MaterialCab.Callback): MaterialCab { override fun openCab(menuRes: Int, callback: MaterialCab.Callback): MaterialCab {
if (cab != null && cab!!.isActive) cab!!.finish() if (cab != null && cab!!.isActive) cab!!.finish()
cab = MaterialCab(this, R.id.cab_stub).setMenu(menuRes) 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)
.setCloseDrawableRes(R.drawable.ic_close_white_24dp).setBackgroundColor(
RetroColorUtil.shiftBackgroundColorForLightText(
ATHUtil.resolveColor(
this,
R.attr.colorPrimary
)
)
).start(callback)
return cab!! return cab!!
} }

View file

@ -2,18 +2,22 @@ package code.name.monkey.retromusic.activities
import android.app.KeyguardManager import android.app.KeyguardManager
import android.content.Context import android.content.Context
import android.os.* import android.os.Build
import android.view.* import android.os.Bundle
import android.view.View
import android.view.WindowManager
import androidx.core.view.ViewCompat import androidx.core.view.ViewCompat
import code.name.monkey.appthemehelper.util.ATHUtil
import code.name.monkey.retromusic.R import code.name.monkey.retromusic.R
import code.name.monkey.retromusic.activities.base.AbsMusicServiceActivity import code.name.monkey.retromusic.activities.base.AbsMusicServiceActivity
import code.name.monkey.retromusic.fragments.player.lockscreen.LockScreenPlayerControlsFragment 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 code.name.monkey.retromusic.helper.MusicPlayerRemote
import com.bumptech.glide.Glide import com.bumptech.glide.Glide
import com.r0adkll.slidr.Slidr 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.* import kotlinx.android.synthetic.main.activity_lock_screen.*
class LockScreenActivity : AbsMusicServiceActivity() { class LockScreenActivity : AbsMusicServiceActivity() {
@ -25,13 +29,10 @@ class LockScreenActivity : AbsMusicServiceActivity() {
setShowWhenLocked(true) setShowWhenLocked(true)
setTurnScreenOn(true) setTurnScreenOn(true)
} else { } else {
this.window.addFlags( this.window.addFlags(WindowManager.LayoutParams.FLAG_DISMISS_KEYGUARD or WindowManager.LayoutParams.FLAG_SHOW_WHEN_LOCKED or WindowManager.LayoutParams.FLAG_TURN_SCREEN_ON)
WindowManager.LayoutParams.FLAG_DISMISS_KEYGUARD or WindowManager.LayoutParams.FLAG_SHOW_WHEN_LOCKED or WindowManager.LayoutParams.FLAG_TURN_SCREEN_ON
)
} }
setDrawUnderStatusBar() setDrawUnderStatusBar()
setContentView(R.layout.activity_lock_screen) setContentView(R.layout.activity_lock_screen)
hideStatusBar() hideStatusBar()
setStatusbarColorAuto() setStatusbarColorAuto()
setNavigationbarColorAuto() setNavigationbarColorAuto()
@ -70,12 +71,6 @@ class LockScreenActivity : AbsMusicServiceActivity() {
alpha = 0f alpha = 0f
ViewCompat.animate(this).translationY(0f).alpha(1f).setDuration(1500).start() ViewCompat.animate(this).translationY(0f).alpha(1f).setDuration(1500).start()
} }
findViewById<View>(R.id.root_layout).setBackgroundColor(
ATHUtil.resolveColor(
this, R.attr.colorPrimary
)
)
} }
override fun onPlayingMetaChanged() { override fun onPlayingMetaChanged() {

View file

@ -140,15 +140,7 @@ class PlaylistDetailActivity : AbsSlidingMusicPanelActivity(), CabHolder, Playli
if (cab != null && cab!!.isActive) { if (cab != null && cab!!.isActive) {
cab!!.finish() cab!!.finish()
} }
cab = MaterialCab(this, R.id.cab_stub).setMenu(menuRes) 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)
.setCloseDrawableRes(R.drawable.ic_close_white_24dp).setBackgroundColor(
RetroColorUtil.shiftBackgroundColorForLightText(
ATHUtil.resolveColor(
this,
R.attr.colorPrimary
)
)
).start(callback)
return cab!! return cab!!
} }

View file

@ -1,14 +1,19 @@
package code.name.monkey.retromusic.adapter.song package code.name.monkey.retromusic.adapter.song
import android.graphics.* import android.graphics.Color
import android.view.* import android.graphics.PorterDuff
import android.view.MenuItem
import android.view.View
import android.widget.ImageView import android.widget.ImageView
import androidx.appcompat.app.AppCompatActivity import androidx.appcompat.app.AppCompatActivity
import code.name.monkey.retromusic.R import code.name.monkey.retromusic.R
import code.name.monkey.retromusic.helper.MusicPlayerRemote import code.name.monkey.retromusic.helper.MusicPlayerRemote
import code.name.monkey.retromusic.model.Song import code.name.monkey.retromusic.model.Song
import code.name.monkey.retromusic.util.* import code.name.monkey.retromusic.util.MusicUtil
import com.h6ah4i.android.widget.advrecyclerview.draggable.* 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 com.h6ah4i.android.widget.advrecyclerview.draggable.annotation.DraggableItemStateFlags
import java.util.* import java.util.*
@ -92,14 +97,12 @@ class PlayingQueueAdapter(
holder.text?.alpha = alpha holder.text?.alpha = alpha
holder.imageText?.alpha = alpha holder.imageText?.alpha = alpha
holder.paletteColorContainer?.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 { override fun onCheckCanStartDrag(holder: ViewHolder, position: Int, x: Int, y: Int): Boolean {
return ViewUtil.hitTest(holder.imageText!!, x, y) || ViewUtil.hitTest( return ViewUtil.hitTest(holder.imageText!!, x, y) || ViewUtil.hitTest(holder.dragView!!, x, y)
holder.dragView!!,
x,
y
)
} }
override fun onGetItemDraggableRange(holder: ViewHolder, position: Int): ItemDraggableRange? { override fun onGetItemDraggableRange(holder: ViewHolder, position: Int): ItemDraggableRange? {
@ -129,7 +132,7 @@ class PlayingQueueAdapter(
override var songMenuRes: Int override var songMenuRes: Int
get() = R.menu.menu_item_playing_queue_song get() = R.menu.menu_item_playing_queue_song
set(value: Int) { set(value) {
super.songMenuRes = value super.songMenuRes = value
} }

View file

@ -10,6 +10,8 @@ import androidx.appcompat.app.AppCompatActivity
import code.name.monkey.retromusic.R import code.name.monkey.retromusic.R
import code.name.monkey.retromusic.adapter.base.AbsMultiSelectAdapter import code.name.monkey.retromusic.adapter.base.AbsMultiSelectAdapter
import code.name.monkey.retromusic.adapter.base.MediaEntryViewHolder 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.RetroMusicColoredTarget
import code.name.monkey.retromusic.glide.SongGlideRequest import code.name.monkey.retromusic.glide.SongGlideRequest
import code.name.monkey.retromusic.helper.MusicPlayerRemote import code.name.monkey.retromusic.helper.MusicPlayerRemote
@ -79,6 +81,11 @@ open class SongAdapter(
val song = dataSet[position] val song = dataSet[position]
val isChecked = isChecked(song) val isChecked = isChecked(song)
holder.itemView.isActivated = isChecked holder.itemView.isActivated = isChecked
if (isChecked) {
holder.menu?.hide()
} else {
holder.menu?.show()
}
holder.title?.text = getSongTitle(song) holder.title?.text = getSongTitle(song)
holder.text?.text = getSongText(song) holder.text?.text = getSongText(song)
loadAlbumCover(song, holder) loadAlbumCover(song, holder)
@ -131,9 +138,7 @@ open class SongAdapter(
return song.title return song.title
} }
override fun onMultipleItemAction( override fun onMultipleItemAction(menuItem: MenuItem, selection: ArrayList<Song>) {
menuItem: MenuItem, selection: ArrayList<Song>
) {
SongsMenuHelper.handleMenuClick(activity, selection, menuItem.itemId) SongsMenuHelper.handleMenuClick(activity, selection, menuItem.itemId)
} }
@ -145,9 +150,7 @@ open class SongAdapter(
SortOrder.SongSortOrder.SONG_A_Z, SortOrder.SongSortOrder.SONG_Z_A -> dataSet[position].title SortOrder.SongSortOrder.SONG_A_Z, SortOrder.SongSortOrder.SONG_Z_A -> dataSet[position].title
SortOrder.SongSortOrder.SONG_ALBUM -> dataSet[position].albumName SortOrder.SongSortOrder.SONG_ALBUM -> dataSet[position].albumName
SortOrder.SongSortOrder.SONG_ARTIST -> dataSet[position].artistName SortOrder.SongSortOrder.SONG_ARTIST -> dataSet[position].artistName
SortOrder.SongSortOrder.SONG_YEAR -> return MusicUtil.getYearString( SortOrder.SongSortOrder.SONG_YEAR -> return MusicUtil.getYearString(dataSet[position].year)
dataSet[position].year
)
SortOrder.SongSortOrder.COMPOSER -> dataSet[position].composer SortOrder.SongSortOrder.COMPOSER -> dataSet[position].composer
else -> { else -> {
return "" return ""

View file

@ -58,14 +58,14 @@ class LockScreenPlayerControlsFragment : AbsPlayerControlsFragment() {
override fun onCreateView(inflater: LayoutInflater, container: ViewGroup?, override fun onCreateView(inflater: LayoutInflater, container: ViewGroup?,
savedInstanceState: Bundle?): View? { 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?) { override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
super.onViewCreated(view, savedInstanceState) super.onViewCreated(view, savedInstanceState)
setUpMusicControllers() setUpMusicControllers()
title.isSelected = true
} }
private fun updateSong() { private fun updateSong() {

View file

@ -18,4 +18,4 @@ import android.os.Parcelable
import kotlinx.android.parcel.Parcelize import kotlinx.android.parcel.Parcelize
@Parcelize @Parcelize
class Genre(val id: Int = -1, val name: String, val songCount: Int) : Parcelable data class Genre(val id: Int = -1, val name: String, val songCount: Int) : Parcelable

View file

@ -2,9 +2,9 @@
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto" xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools" xmlns:tools="http://schemas.android.com/tools"
android:id="@+id/root_layout"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="match_parent" android:layout_height="match_parent"
android:background="?attr/colorSurface"
android:orientation="vertical"> android:orientation="vertical">
<FrameLayout <FrameLayout
@ -30,31 +30,26 @@
tools:layout="@layout/fragment_lock_screen_playback_controls" /> tools:layout="@layout/fragment_lock_screen_playback_controls" />
</LinearLayout> </LinearLayout>
<code.name.monkey.retromusic.views.WidthFitSquareCardView
<code.name.monkey.retromusic.views.WidthFitSquareLayout android:id="@+id/albumCoverContainer"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_weight="0"> android:layout_margin="16dp"
android:transitionName="@string/transition_album_art"
<com.google.android.material.card.MaterialCardView app:cardCornerRadius="24dp"
android:layout_width="match_parent" app:cardElevation="8dp"
android:layout_height="match_parent" app:layout_constraintEnd_toEndOf="parent"
android:layout_marginStart="16dp" app:layout_constraintStart_toStartOf="parent"
android:layout_marginEnd="16dp" app:layout_constraintTop_toTopOf="parent">
android:layout_marginBottom="16dp"
app:cardCornerRadius="8dp"
app:cardElevation="8dp">
<androidx.appcompat.widget.AppCompatImageView <androidx.appcompat.widget.AppCompatImageView
android:id="@+id/image" android:id="@+id/image"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="match_parent" android:layout_height="match_parent"
android:contentDescription="TODO"
android:scaleType="centerCrop" android:scaleType="centerCrop"
tools:srcCompat="@tools:sample/backgrounds/scenic[0]" /> tools:srcCompat="@tools:sample/backgrounds/scenic[0]" />
</com.google.android.material.card.MaterialCardView> </code.name.monkey.retromusic.views.WidthFitSquareCardView>
</code.name.monkey.retromusic.views.WidthFitSquareLayout>
<com.google.android.material.textview.MaterialTextView <com.google.android.material.textview.MaterialTextView
android:id="@+id/slide" android:id="@+id/slide"
@ -63,5 +58,6 @@
android:layout_weight="0" android:layout_weight="0"
android:gravity="center" android:gravity="center"
android:padding="16dp" android:padding="16dp"
android:text="@string/swipe_to_unlock" /> android:text="@string/swipe_to_unlock"
android:textColor="?android:attr/textColorPrimary" />
</LinearLayout> </LinearLayout>

View file

@ -28,7 +28,7 @@
android:gravity="center_vertical|left|end" android:gravity="center_vertical|left|end"
android:paddingLeft="8dp" android:paddingLeft="8dp"
android:singleLine="true" android:singleLine="true"
android:textColor="?colorOnSecondary" android:textColor="?android:attr/textColorSecondary"
android:textSize="12sp" android:textSize="12sp"
tools:ignore="RtlHardcoded,RtlSymmetry" tools:ignore="RtlHardcoded,RtlSymmetry"
tools:text="00:22" /> tools:text="00:22" />
@ -42,7 +42,7 @@
android:gravity="center_vertical|right|end" android:gravity="center_vertical|right|end"
android:paddingRight="8dp" android:paddingRight="8dp"
android:singleLine="true" android:singleLine="true"
android:textColor="?colorOnSecondary" android:textColor="?android:attr/textColorSecondary"
android:textSize="12sp" android:textSize="12sp"
tools:ignore="RtlHardcoded,RtlSymmetry" tools:ignore="RtlHardcoded,RtlSymmetry"
tools:text="00:22" /> tools:text="00:22" />
@ -97,7 +97,7 @@
android:maxLines="1" android:maxLines="1"
android:paddingStart="16dp" android:paddingStart="16dp"
android:paddingEnd="16dp" android:paddingEnd="16dp"
android:textAppearance="@style/TextAppearance.MaterialComponents.Body1" android:textAppearance="@style/TextViewBody1"
android:textColor="?android:attr/textColorSecondary" android:textColor="?android:attr/textColorSecondary"
app:layout_constraintBottom_toTopOf="@+id/playerMediaControllerContainer" app:layout_constraintBottom_toTopOf="@+id/playerMediaControllerContainer"
app:layout_constraintEnd_toEndOf="parent" app:layout_constraintEnd_toEndOf="parent"

View file

@ -1,5 +1,5 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android" <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto" xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools" xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent" android:layout_width="match_parent"
@ -7,14 +7,11 @@
android:background="?rectSelector" android:background="?rectSelector"
android:clickable="true" android:clickable="true"
android:focusable="true" android:focusable="true"
android:minHeight="72dp" android:gravity="center_vertical"
android:minHeight="64dp"
android:orientation="horizontal"
tools:ignore="MissingPrefix"> tools:ignore="MissingPrefix">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="horizontal">
<androidx.appcompat.widget.AppCompatImageView <androidx.appcompat.widget.AppCompatImageView
android:id="@+id/drag_view" android:id="@+id/drag_view"
android:layout_width="wrap_content" android:layout_width="wrap_content"
@ -54,12 +51,8 @@
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_gravity="center_vertical" android:layout_gravity="center_vertical"
android:layout_marginTop="12dp"
android:layout_marginBottom="12dp"
android:layout_weight="1.0" android:layout_weight="1.0"
android:orientation="vertical" android:orientation="vertical">
android:paddingStart="16dp"
android:paddingEnd="16dp">
<com.google.android.material.textview.MaterialTextView <com.google.android.material.textview.MaterialTextView
android:id="@+id/title" android:id="@+id/title"
@ -67,7 +60,7 @@
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:ellipsize="end" android:ellipsize="end"
android:maxLines="1" android:maxLines="1"
android:textAppearance="@style/TextViewHeadline6" android:textAppearance="@style/TextViewSubtitle1"
android:textSize="16sp" android:textSize="16sp"
tools:text="Song name" /> tools:text="Song name" />
@ -87,5 +80,4 @@
android:layout_weight="0" android:layout_weight="0"
app:tint="?attr/colorControlNormal" /> app:tint="?attr/colorControlNormal" />
</LinearLayout> </LinearLayout>
</FrameLayout>

View file

@ -5,7 +5,6 @@
<item name="md_font_title">@font/circular</item> <item name="md_font_title">@font/circular</item>
<item name="md_font_body">@font/circular</item> <item name="md_font_body">@font/circular</item>
<item name="md_font_button">@font/circular</item> <item name="md_font_button">@font/circular</item>
<item name="md_background_color">@color/md_red_500</item>
<item name="android:windowActionBarOverlay">true</item> <item name="android:windowActionBarOverlay">true</item>
<item name="android:windowActivityTransitions">true</item> <item name="android:windowActivityTransitions">true</item>
<item name="android:fontFamily">@font/circular</item> <item name="android:fontFamily">@font/circular</item>