diff --git a/app/src/main/java/org/schabi/newpipe/player/NotificationUtil.java b/app/src/main/java/org/schabi/newpipe/player/NotificationUtil.java index 10fff52989f..62f1d5dc2ae 100644 --- a/app/src/main/java/org/schabi/newpipe/player/NotificationUtil.java +++ b/app/src/main/java/org/schabi/newpipe/player/NotificationUtil.java @@ -120,7 +120,10 @@ private synchronized NotificationCompat.Builder createNotification( .setCategory(NotificationCompat.CATEGORY_TRANSPORT) .setShowWhen(false) .setSmallIcon(R.drawable.ic_newpipe_triangle_white) - .setColor(ContextCompat.getColor(player.context, R.color.gray)) + .setColor(ContextCompat.getColor(player.context, R.color.dark_background_color)) + .setColorized(player.sharedPreferences.getBoolean( + player.context.getString(R.string.notification_colorize_key), + true)) .setDeleteIntent(PendingIntent.getBroadcast(player.context, NOTIFICATION_ID, new Intent(ACTION_CLOSE), FLAG_UPDATE_CURRENT)); diff --git a/app/src/main/java/org/schabi/newpipe/settings/NotificationSettingsFragment.kt b/app/src/main/java/org/schabi/newpipe/settings/NotificationSettingsFragment.kt index 860968626f9..c68b699d35b 100644 --- a/app/src/main/java/org/schabi/newpipe/settings/NotificationSettingsFragment.kt +++ b/app/src/main/java/org/schabi/newpipe/settings/NotificationSettingsFragment.kt @@ -1,10 +1,19 @@ package org.schabi.newpipe.settings +import android.os.Build import android.os.Bundle +import androidx.preference.Preference import org.schabi.newpipe.R class NotificationSettingsFragment : BasePreferenceFragment() { override fun onCreatePreferences(savedInstanceState: Bundle?, rootKey: String?) { addPreferencesFromResource(R.xml.notification_settings) + + if (Build.VERSION.SDK_INT < Build.VERSION_CODES.LOLLIPOP) { + val colorizePref: Preference? = findPreference(getString(R.string.notification_colorize_key)) + colorizePref?.let { + preferenceScreen.removePreference(it) + } + } } } \ No newline at end of file diff --git a/app/src/main/res/values/settings_keys.xml b/app/src/main/res/values/settings_keys.xml index ba40ab931ee..c73d7d9dedc 100644 --- a/app/src/main/res/values/settings_keys.xml +++ b/app/src/main/res/values/settings_keys.xml @@ -132,6 +132,8 @@ notification_slot_compact_1_key notification_slot_compact_2_key + notification_colorize_key + video_mp4 video_webm video_3gp diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml index a2ab0d78edf..e0aefc935e8 100644 --- a/app/src/main/res/values/strings.xml +++ b/app/src/main/res/values/strings.xml @@ -72,6 +72,8 @@ Shuffle Buffering Nothing + Colorize notification + Have Android customize the notification\'s color according to the main color in the thumbnail (note that this is not available on all devices) Audio Default audio format Default video format diff --git a/app/src/main/res/xml/notification_settings.xml b/app/src/main/res/xml/notification_settings.xml index d9e45a41bfc..65d4af48a30 100644 --- a/app/src/main/res/xml/notification_settings.xml +++ b/app/src/main/res/xml/notification_settings.xml @@ -10,6 +10,13 @@ android:title="@string/notification_scale_to_square_image_title" app:iconSpaceReserved="false" /> + +