Added colored notification on A12 and fixed unreadable colors on light mode on A12

This commit is contained in:
Prathamesh More 2022-01-19 16:34:05 +05:30
parent 404bc0ff12
commit d1f2cac5c0
4 changed files with 12 additions and 7 deletions

View file

@ -32,7 +32,8 @@ import code.name.monkey.appthemehelper.util.MaterialValueHelper
import code.name.monkey.appthemehelper.util.VersionUtils import code.name.monkey.appthemehelper.util.VersionUtils
import code.name.monkey.retromusic.R import code.name.monkey.retromusic.R
import code.name.monkey.retromusic.activities.MainActivity import code.name.monkey.retromusic.activities.MainActivity
import code.name.monkey.retromusic.extensions.surfaceColor import code.name.monkey.retromusic.extensions.isColorLight
import code.name.monkey.retromusic.extensions.isSystemDarkModeEnabled
import code.name.monkey.retromusic.glide.GlideApp import code.name.monkey.retromusic.glide.GlideApp
import code.name.monkey.retromusic.glide.RetroGlideExtension import code.name.monkey.retromusic.glide.RetroGlideExtension
import code.name.monkey.retromusic.glide.palette.BitmapPaletteWrapper import code.name.monkey.retromusic.glide.palette.BitmapPaletteWrapper
@ -80,6 +81,7 @@ class PlayingNotificationClassic(
setContentIntent(clickIntent) setContentIntent(clickIntent)
setDeleteIntent(deleteIntent) setDeleteIntent(deleteIntent)
setCategory(NotificationCompat.CATEGORY_SERVICE) setCategory(NotificationCompat.CATEGORY_SERVICE)
setColorized(true)
priority = NotificationCompat.PRIORITY_MAX priority = NotificationCompat.PRIORITY_MAX
setVisibility(NotificationCompat.VISIBILITY_PUBLIC) setVisibility(NotificationCompat.VISIBILITY_PUBLIC)
setCustomContentView(notificationLayout) setCustomContentView(notificationLayout)
@ -152,8 +154,13 @@ class PlayingNotificationClassic(
} }
setBackgroundColor(bgColorFinal) setBackgroundColor(bgColorFinal)
setNotificationContent(ColorUtil.isColorLight(bgColorFinal)) setNotificationContent(ColorUtil.isColorLight(bgColorFinal))
}else { } else {
setNotificationContent(!ColorUtil.isColorLight(context.surfaceColor())) if (PreferenceUtil.isColoredNotification) {
color = bgColor
setNotificationContent(color.isColorLight)
} else {
setNotificationContent(!context.isSystemDarkModeEnabled())
}
} }
onUpdate() onUpdate()
} }
@ -256,7 +263,8 @@ class PlayingNotificationClassic(
R.drawable.ic_pause_white_48dp R.drawable.ic_pause_white_48dp
else else
R.drawable.ic_play_arrow_white_48dp, primaryColor R.drawable.ic_play_arrow_white_48dp, primaryColor
), NOTIFICATION_CONTROLS_SIZE_MULTIPLIER) ), NOTIFICATION_CONTROLS_SIZE_MULTIPLIER
)
} }
override fun setPlaying(isPlaying: Boolean, onUpdate: () -> Unit) { override fun setPlaying(isPlaying: Boolean, onUpdate: () -> Unit) {

View file

@ -3,7 +3,6 @@
<bool name="md3_available">true</bool> <bool name="md3_available">true</bool>
<bool name="md3_enabled">true</bool> <bool name="md3_enabled">true</bool>
<bool name="colored_notification_available">false</bool>
<integer name="overScrollMode">0</integer> <integer name="overScrollMode">0</integer>
<bool name="wallpaper_accent_enabled">false</bool> <bool name="wallpaper_accent_enabled">false</bool>
<bool name="wallpaper_accent_visible">false</bool> <bool name="wallpaper_accent_visible">false</bool>

View file

@ -27,7 +27,6 @@
<bool name="md3_available">false</bool> <bool name="md3_available">false</bool>
<bool name="md3_enabled">false</bool> <bool name="md3_enabled">false</bool>
<bool name="colored_notification_available">true</bool>
<integer name="overScrollMode">2</integer> <integer name="overScrollMode">2</integer>
<bool name="allowBackup">true</bool> <bool name="allowBackup">true</bool>

View file

@ -13,7 +13,6 @@
android:defaultValue="true" android:defaultValue="true"
android:key="colored_notification" android:key="colored_notification"
android:layout="@layout/list_item_view_switch" android:layout="@layout/list_item_view_switch"
app:isPreferenceVisible="@bool/colored_notification_available"
android:summary="@string/pref_summary_colored_notification" android:summary="@string/pref_summary_colored_notification"
android:title="@string/pref_title_colored_notification" /> android:title="@string/pref_title_colored_notification" />