Merge pull request #1442 from michaellee123/dev

Fixed something about notification and lockscreen.
This commit is contained in:
Prathamesh More 2023-03-06 18:49:17 +05:30 committed by GitHub
commit d6a21ee42b
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
7 changed files with 168 additions and 53 deletions

View file

@ -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() {

View file

@ -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()
}

View file

@ -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

View file

@ -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

View file

@ -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) {

View 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>

View file

@ -1,10 +1,22 @@
<?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">
<androidx.appcompat.widget.AppCompatImageView
android:id="@+id/iv_blurred_album_art"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical">
android:scaleType="centerCrop" />
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="#80000000"
android:orientation="vertical"
android:paddingTop="24dp">
<FrameLayout
android:layout_width="match_parent"
@ -13,22 +25,6 @@
<include layout="@layout/status_bar" />
</FrameLayout>
<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>
<code.name.monkey.retromusic.views.WidthFitSquareCardView
android:id="@+id/albumCoverContainer"
android:layout_width="match_parent"
@ -50,6 +46,23 @@
</code.name.monkey.retromusic.views.WidthFitSquareCardView>
<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>
<com.google.android.material.textview.MaterialTextView
android:id="@+id/slide"
android:layout_width="match_parent"
@ -61,3 +74,4 @@
android:text="@string/swipe_to_unlock"
android:textColor="?android:attr/textColorPrimary" />
</LinearLayout>
</RelativeLayout>