Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -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));

Expand Down
Original file line number Diff line number Diff line change
@@ -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)
}
}
}
}
2 changes: 2 additions & 0 deletions app/src/main/res/values/settings_keys.xml
Original file line number Diff line number Diff line change
Expand Up @@ -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>
Expand Down
2 changes: 2 additions & 0 deletions app/src/main/res/values/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -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>
Expand Down
7 changes: 7 additions & 0 deletions app/src/main/res/xml/notification_settings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -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">
Expand Down