Merge pull request #1442 from michaellee123/dev
Fixed something about notification and lockscreen.
This commit is contained in:
commit
d6a21ee42b
7 changed files with 168 additions and 53 deletions
|
@ -155,6 +155,11 @@ abstract class AbsPlayerControlsFragment(@LayoutRes layout: Int) : AbsMusicServi
|
|||
override fun onCreate(savedInstanceState: Bundle?) {
|
||||
super.onCreate(savedInstanceState)
|
||||
progressViewUpdateHelper = MusicProgressViewUpdateHelper(this)
|
||||
if (PreferenceUtil.circlePlayButton) {
|
||||
requireContext().theme.applyStyle(R.style.CircleFABOverlay, true)
|
||||
} else {
|
||||
requireContext().theme.applyStyle(R.style.RoundedFABOverlay, true)
|
||||
}
|
||||
}
|
||||
|
||||
fun View.showBounceAnimation() {
|
||||
|
|
|
@ -23,6 +23,7 @@ import android.content.SharedPreferences.OnSharedPreferenceChangeListener
|
|||
import android.content.pm.ServiceInfo
|
||||
import android.database.ContentObserver
|
||||
import android.graphics.Bitmap
|
||||
import android.graphics.BitmapFactory
|
||||
import android.graphics.drawable.Drawable
|
||||
import android.media.AudioManager
|
||||
import android.os.*
|
||||
|
@ -51,7 +52,6 @@ import code.name.monkey.retromusic.extensions.toMediaSessionQueue
|
|||
import code.name.monkey.retromusic.extensions.uri
|
||||
import code.name.monkey.retromusic.glide.BlurTransformation
|
||||
import code.name.monkey.retromusic.glide.GlideApp
|
||||
import code.name.monkey.retromusic.glide.RetroGlideExtension.getDefaultTransition
|
||||
import code.name.monkey.retromusic.glide.RetroGlideExtension.getSongModel
|
||||
import code.name.monkey.retromusic.helper.ShuffleHelper.makeShuffleList
|
||||
import code.name.monkey.retromusic.model.Song
|
||||
|
@ -1027,7 +1027,6 @@ class MusicService : MediaBrowserServiceCompat(),
|
|||
.asBitmap()
|
||||
.songCoverOptions(song)
|
||||
.load(getSongModel(song))
|
||||
.transition(getDefaultTransition())
|
||||
|
||||
if (isBlurredAlbumArt) {
|
||||
request.transform(BlurTransformation.Builder(this@MusicService).build())
|
||||
|
@ -1036,6 +1035,13 @@ class MusicService : MediaBrowserServiceCompat(),
|
|||
CustomTarget<Bitmap?>(Target.SIZE_ORIGINAL, Target.SIZE_ORIGINAL) {
|
||||
override fun onLoadFailed(errorDrawable: Drawable?) {
|
||||
super.onLoadFailed(errorDrawable)
|
||||
metaData.putBitmap(
|
||||
MediaMetadataCompat.METADATA_KEY_ALBUM_ART,
|
||||
BitmapFactory.decodeResource(
|
||||
resources,
|
||||
R.drawable.default_audio_art
|
||||
)
|
||||
)
|
||||
mediaSession?.setMetadata(metaData.build())
|
||||
onCompletion()
|
||||
}
|
||||
|
|
|
@ -263,7 +263,7 @@ object PreferenceUtil {
|
|||
|
||||
val isAlbumArtOnLockScreen
|
||||
get() = sharedPreferences.getBoolean(
|
||||
ALBUM_ART_ON_LOCK_SCREEN, false
|
||||
ALBUM_ART_ON_LOCK_SCREEN, true
|
||||
)
|
||||
|
||||
val isAudioDucking
|
||||
|
|
|
@ -20,7 +20,7 @@ import android.widget.FrameLayout
|
|||
class HeightFitSquareLayout @JvmOverloads constructor(
|
||||
context: Context,
|
||||
attrs: AttributeSet? = null,
|
||||
defStyleAttr: Int = -1
|
||||
defStyleAttr: Int = 0
|
||||
) : FrameLayout(context, attrs, defStyleAttr){
|
||||
private var forceSquare = true
|
||||
|
||||
|
|
|
@ -21,7 +21,7 @@ import android.view.View
|
|||
class StatusBarView @JvmOverloads constructor(
|
||||
context: Context,
|
||||
attrs: AttributeSet? = null,
|
||||
defStyleAttr: Int = -1
|
||||
defStyleAttr: Int = 0
|
||||
) : View(context, attrs, defStyleAttr) {
|
||||
|
||||
override fun onMeasure(widthMeasureSpec: Int, heightMeasureSpec: Int) {
|
||||
|
|
90
app/src/main/res/layout-land/activity_lock_screen.xml
Normal file
90
app/src/main/res/layout-land/activity_lock_screen.xml
Normal file
|
@ -0,0 +1,90 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<RelativeLayout 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">
|
||||
|
||||
<androidx.appcompat.widget.AppCompatImageView
|
||||
android:id="@+id/iv_blurred_album_art"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:scaleType="centerCrop" />
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:background="#80000000"
|
||||
android:orientation="vertical">
|
||||
|
||||
<FrameLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content">
|
||||
|
||||
<include layout="@layout/status_bar" />
|
||||
</FrameLayout>
|
||||
|
||||
<androidx.appcompat.widget.LinearLayoutCompat
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent">
|
||||
|
||||
<code.name.monkey.retromusic.views.HeightFitSquareLayout
|
||||
android:id="@+id/albumCoverContainer"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="match_parent">
|
||||
|
||||
<com.google.android.material.card.MaterialCardView
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_margin="16dp"
|
||||
app:cardCornerRadius="@dimen/m3_card_corner_radius"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintDimensionRatio="1:1"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent">
|
||||
|
||||
<androidx.appcompat.widget.AppCompatImageView
|
||||
android:id="@+id/image"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:scaleType="centerCrop"
|
||||
tools:ignore="ContentDescription,UnusedAttribute"
|
||||
tools:srcCompat="@tools:sample/backgrounds/scenic" />
|
||||
|
||||
<com.google.android.material.textview.MaterialTextView
|
||||
android:id="@+id/slide"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center_horizontal|bottom"
|
||||
android:elevation="3dp"
|
||||
android:fitsSystemWindows="true"
|
||||
android:gravity="center"
|
||||
android:padding="16dp"
|
||||
android:text="@string/swipe_to_unlock"
|
||||
android:textColor="?android:attr/textColorPrimary" />
|
||||
</com.google.android.material.card.MaterialCardView>
|
||||
</code.name.monkey.retromusic.views.HeightFitSquareLayout>
|
||||
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_weight="1"
|
||||
android:gravity="center_vertical"
|
||||
android:orientation="vertical"
|
||||
tools:ignore="UselessParent">
|
||||
|
||||
<androidx.fragment.app.FragmentContainerView
|
||||
android:id="@+id/playback_controls_fragment"
|
||||
android:name="code.name.monkey.retromusic.fragments.player.lockscreen.LockScreenControlsFragment"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
tools:layout="@layout/fragment_lock_screen_playback_controls" />
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
</androidx.appcompat.widget.LinearLayoutCompat>
|
||||
|
||||
</LinearLayout>
|
||||
</RelativeLayout>
|
|
@ -1,63 +1,77 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
<RelativeLayout 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:orientation="vertical">
|
||||
android:layout_height="match_parent">
|
||||
|
||||
<FrameLayout
|
||||
<androidx.appcompat.widget.AppCompatImageView
|
||||
android:id="@+id/iv_blurred_album_art"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content">
|
||||
|
||||
<include layout="@layout/status_bar" />
|
||||
</FrameLayout>
|
||||
android:layout_height="match_parent"
|
||||
android:scaleType="centerCrop" />
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_weight="1"
|
||||
android:gravity="center_vertical"
|
||||
android:background="#80000000"
|
||||
android:orientation="vertical"
|
||||
tools:ignore="UselessParent">
|
||||
android:paddingTop="24dp">
|
||||
|
||||
<androidx.fragment.app.FragmentContainerView
|
||||
android:id="@+id/playback_controls_fragment"
|
||||
android:name="code.name.monkey.retromusic.fragments.player.lockscreen.LockScreenControlsFragment"
|
||||
<FrameLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content">
|
||||
|
||||
<include layout="@layout/status_bar" />
|
||||
</FrameLayout>
|
||||
|
||||
<code.name.monkey.retromusic.views.WidthFitSquareCardView
|
||||
android:id="@+id/albumCoverContainer"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
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">
|
||||
|
||||
<androidx.appcompat.widget.AppCompatImageView
|
||||
android:id="@+id/image"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:scaleType="centerCrop"
|
||||
tools:srcCompat="@tools:sample/backgrounds/scenic[0]" />
|
||||
|
||||
</code.name.monkey.retromusic.views.WidthFitSquareCardView>
|
||||
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
tools:layout="@layout/fragment_lock_screen_playback_controls" />
|
||||
android:layout_weight="1"
|
||||
android:gravity="center_vertical"
|
||||
android:orientation="vertical"
|
||||
tools:ignore="UselessParent">
|
||||
|
||||
<androidx.fragment.app.FragmentContainerView
|
||||
android:id="@+id/playback_controls_fragment"
|
||||
android:name="code.name.monkey.retromusic.fragments.player.lockscreen.LockScreenControlsFragment"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
tools:layout="@layout/fragment_lock_screen_playback_controls" />
|
||||
</LinearLayout>
|
||||
|
||||
<com.google.android.material.textview.MaterialTextView
|
||||
android:id="@+id/slide"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_weight="0"
|
||||
android:fitsSystemWindows="true"
|
||||
android:gravity="center"
|
||||
android:padding="16dp"
|
||||
android:text="@string/swipe_to_unlock"
|
||||
android:textColor="?android:attr/textColorPrimary" />
|
||||
</LinearLayout>
|
||||
|
||||
<code.name.monkey.retromusic.views.WidthFitSquareCardView
|
||||
android:id="@+id/albumCoverContainer"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
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">
|
||||
|
||||
<androidx.appcompat.widget.AppCompatImageView
|
||||
android:id="@+id/image"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:scaleType="centerCrop"
|
||||
tools:srcCompat="@tools:sample/backgrounds/scenic[0]" />
|
||||
|
||||
</code.name.monkey.retromusic.views.WidthFitSquareCardView>
|
||||
|
||||
<com.google.android.material.textview.MaterialTextView
|
||||
android:id="@+id/slide"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_weight="0"
|
||||
android:fitsSystemWindows="true"
|
||||
android:gravity="center"
|
||||
android:padding="16dp"
|
||||
android:text="@string/swipe_to_unlock"
|
||||
android:textColor="?android:attr/textColorPrimary" />
|
||||
</LinearLayout>
|
||||
</RelativeLayout>
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue