1
0
mirror of https://github.com/TeamNewPipe/NewPipe synced 2024-11-05 09:36:22 +00:00

Merge pull request #4643 from XiangRongLin/colorize_notification

Add option to not colorize notification
This commit is contained in:
Stypox 2020-11-01 22:24:16 +01:00 committed by GitHub
commit 4c77e5cdd2
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 24 additions and 1 deletions

View File

@ -120,7 +120,10 @@ public final class NotificationUtil {
.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));

View File

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

View File

@ -132,6 +132,8 @@
<string name="notification_slot_compact_1_key" translatable="false">notification_slot_compact_1_key</string>
<string name="notification_slot_compact_2_key" translatable="false">notification_slot_compact_2_key</string>
<string name="notification_colorize_key" translatable="false">notification_colorize_key</string>
<string name="video_mp4_key" translatable="false">video_mp4</string>
<string name="video_webm_key" translatable="false">video_webm</string>
<string name="video_3gp_key" translatable="false">video_3gp</string>

View File

@ -72,6 +72,8 @@
<string name="notification_action_shuffle">Shuffle</string>
<string name="notification_action_buffering">Buffering</string>
<string name="notification_action_nothing">Nothing</string>
<string name="notification_colorize_title">Colorize notification</string>
<string name="notification_colorize_summary">Have Android customize the notification\'s color according to the main color in the thumbnail (note that this is not available on all devices)</string>
<string name="play_audio">Audio</string>
<string name="default_audio_format_title">Default audio format</string>
<string name="default_video_format_title">Default video format</string>

View File

@ -10,6 +10,13 @@
android:title="@string/notification_scale_to_square_image_title"
app:iconSpaceReserved="false" />
<SwitchPreferenceCompat
android:defaultValue="true"
android:key="@string/notification_colorize_key"
android:summary="@string/notification_colorize_summary"
android:title="@string/notification_colorize_title"
app:iconSpaceReserved="false" />
<PreferenceCategory
android:layout="@layout/settings_category_header_layout"
app:iconSpaceReserved="false">