mirror of
https://github.com/TeamNewPipe/NewPipe
synced 2024-12-23 08:30:44 +00:00
Add option to not colorize notification
This commit is contained in:
parent
e97d0b9a69
commit
974f8f692c
@ -120,7 +120,10 @@ public final class NotificationUtil {
|
|||||||
.setCategory(NotificationCompat.CATEGORY_TRANSPORT)
|
.setCategory(NotificationCompat.CATEGORY_TRANSPORT)
|
||||||
.setShowWhen(false)
|
.setShowWhen(false)
|
||||||
.setSmallIcon(R.drawable.ic_newpipe_triangle_white)
|
.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,
|
.setDeleteIntent(PendingIntent.getBroadcast(player.context, NOTIFICATION_ID,
|
||||||
new Intent(ACTION_CLOSE), FLAG_UPDATE_CURRENT));
|
new Intent(ACTION_CLOSE), FLAG_UPDATE_CURRENT));
|
||||||
|
|
||||||
|
@ -1,10 +1,19 @@
|
|||||||
package org.schabi.newpipe.settings
|
package org.schabi.newpipe.settings
|
||||||
|
|
||||||
|
import android.os.Build
|
||||||
import android.os.Bundle
|
import android.os.Bundle
|
||||||
|
import androidx.preference.Preference
|
||||||
import org.schabi.newpipe.R
|
import org.schabi.newpipe.R
|
||||||
|
|
||||||
class NotificationSettingsFragment : BasePreferenceFragment() {
|
class NotificationSettingsFragment : BasePreferenceFragment() {
|
||||||
override fun onCreatePreferences(savedInstanceState: Bundle?, rootKey: String?) {
|
override fun onCreatePreferences(savedInstanceState: Bundle?, rootKey: String?) {
|
||||||
addPreferencesFromResource(R.xml.notification_settings)
|
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)
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -132,6 +132,8 @@
|
|||||||
<string name="notification_slot_compact_1_key" translatable="false">notification_slot_compact_1_key</string>
|
<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_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_mp4_key" translatable="false">video_mp4</string>
|
||||||
<string name="video_webm_key" translatable="false">video_webm</string>
|
<string name="video_webm_key" translatable="false">video_webm</string>
|
||||||
<string name="video_3gp_key" translatable="false">video_3gp</string>
|
<string name="video_3gp_key" translatable="false">video_3gp</string>
|
||||||
|
@ -72,6 +72,8 @@
|
|||||||
<string name="notification_action_shuffle">Shuffle</string>
|
<string name="notification_action_shuffle">Shuffle</string>
|
||||||
<string name="notification_action_buffering">Buffering</string>
|
<string name="notification_action_buffering">Buffering</string>
|
||||||
<string name="notification_action_nothing">Nothing</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="play_audio">Audio</string>
|
||||||
<string name="default_audio_format_title">Default audio format</string>
|
<string name="default_audio_format_title">Default audio format</string>
|
||||||
<string name="default_video_format_title">Default video format</string>
|
<string name="default_video_format_title">Default video format</string>
|
||||||
|
@ -10,6 +10,13 @@
|
|||||||
android:title="@string/notification_scale_to_square_image_title"
|
android:title="@string/notification_scale_to_square_image_title"
|
||||||
app:iconSpaceReserved="false" />
|
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
|
<PreferenceCategory
|
||||||
android:layout="@layout/settings_category_header_layout"
|
android:layout="@layout/settings_category_header_layout"
|
||||||
app:iconSpaceReserved="false">
|
app:iconSpaceReserved="false">
|
||||||
|
Loading…
Reference in New Issue
Block a user