Add notification costumization settings menu

This commit is contained in:
Stypox 2020-09-08 19:02:05 +02:00
parent 408e819d32
commit 71b32fe641
No known key found for this signature in database
GPG key ID: 4BDF1B40A49FDD23
25 changed files with 774 additions and 290 deletions

Binary file not shown.

After

Width:  |  Height:  |  Size: 415 B

View file

Before

Width:  |  Height:  |  Size: 302 B

After

Width:  |  Height:  |  Size: 302 B

Before After
Before After

Binary file not shown.

After

Width:  |  Height:  |  Size: 285 B

View file

Before

Width:  |  Height:  |  Size: 246 B

After

Width:  |  Height:  |  Size: 246 B

Before After
Before After

Binary file not shown.

After

Width:  |  Height:  |  Size: 602 B

View file

Before

Width:  |  Height:  |  Size: 413 B

After

Width:  |  Height:  |  Size: 413 B

Before After
Before After

Binary file not shown.

After

Width:  |  Height:  |  Size: 1 KiB

View file

Before

Width:  |  Height:  |  Size: 614 B

After

Width:  |  Height:  |  Size: 614 B

Before After
Before After

Binary file not shown.

After

Width:  |  Height:  |  Size: 2 KiB

View file

Before

Width:  |  Height:  |  Size: 777 B

After

Width:  |  Height:  |  Size: 777 B

Before After
Before After

View file

@ -0,0 +1,9 @@
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="24dp"
android:height="24dp"
android:viewportWidth="24"
android:viewportHeight="24">
<path
android:pathData="M6,2l0.01,6L10,12l-3.99,4.01L6,22h12v-6l-4,-4l4,-3.99V2H6zM16,16.5V20H8v-3.5l4,-4L16,16.5z"
android:fillColor="#ffffff"/>
</vector>

View file

@ -10,10 +10,8 @@
android:maxLines="2"
android:minHeight="?attr/listPreferredItemHeightSmall"
android:paddingEnd="?attr/listPreferredItemPaddingRight"
android:paddingLeft="?attr/listPreferredItemPaddingLeft"
android:paddingRight="?attr/listPreferredItemPaddingRight"
android:paddingStart="?attr/listPreferredItemPaddingLeft"
android:background="?attr/checked_selector"
android:textColor="?attr/textColorAlertDialogListItem"
tools:drawableLeft="?attr/ic_play"
tools:drawableLeft="?attr/ic_play_arrow"
tools:text="Lorem ipsum dolor sit amet" />

View file

@ -0,0 +1,135 @@
<?xml version="1.0" encoding="utf-8"?>
<ScrollView xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
android:layout_height="match_parent">
<androidx.constraintlayout.widget.ConstraintLayout
android:layout_height="wrap_content"
android:layout_width="match_parent">
<Switch
android:id="@+id/notificationScaleSwitch"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginEnd="16dp"
android:clickable="false"
android:focusable="false"
app:layout_constraintBottom_toBottomOf="@+id/textView2"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintTop_toTopOf="@+id/textView" />
<TextView
android:id="@+id/textView"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="16dp"
android:layout_marginTop="16dp"
android:layout_marginEnd="16dp"
android:maxLines="1"
android:text="@string/notification_scale_to_square_image_title"
android:textAppearance="?android:attr/textAppearanceLarge"
android:textSize="14sp"
app:layout_constraintEnd_toStartOf="@+id/notificationScaleSwitch"
app:layout_constraintHorizontal_bias="0.0"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" />
<TextView
android:id="@+id/textView2"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginStart="16dp"
android:layout_marginEnd="16dp"
android:text="@string/notification_scale_to_square_image_summary"
app:layout_constraintEnd_toStartOf="@+id/notificationScaleSwitch"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/textView" />
<View
android:id="@+id/notificationScaleSwitchClickableArea"
android:layout_width="match_parent"
android:layout_height="0dp"
android:clickable="true"
android:focusable="true"
app:layout_constraintBottom_toTopOf="@+id/divider"
app:layout_constraintTop_toTopOf="parent"
android:background="?android:selectableItemBackground" />
<View
android:id="@+id/divider"
android:layout_width="0dp"
android:layout_height="1dp"
android:layout_marginStart="32dp"
android:layout_marginTop="16dp"
android:layout_marginEnd="32dp"
android:background="?android:attr/listDivider"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/textView2" />
<TextView
android:id="@+id/textView4"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginStart="16dp"
android:layout_marginTop="16dp"
android:layout_marginEnd="16dp"
android:clickable="false"
android:focusable="false"
android:gravity="center"
android:lines="4"
android:text="@string/notification_actions_summary"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintHorizontal_bias="0.0"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/divider" />
<include
android:id="@+id/notificationAction0"
layout="@layout/settings_notification_action"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginTop="8dp"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/textView4" />
<include
android:id="@+id/notificationAction1"
layout="@layout/settings_notification_action"
android:layout_width="0dp"
android:layout_height="wrap_content"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/notificationAction0" />
<include
android:id="@+id/notificationAction2"
layout="@layout/settings_notification_action"
android:layout_width="0dp"
android:layout_height="wrap_content"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/notificationAction1" />
<include
android:id="@+id/notificationAction3"
layout="@layout/settings_notification_action"
android:layout_width="0dp"
android:layout_height="wrap_content"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/notificationAction2" />
<include
android:id="@+id/notificationAction4"
layout="@layout/settings_notification_action"
android:layout_width="0dp"
android:layout_height="wrap_content"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/notificationAction3" />
</androidx.constraintlayout.widget.ConstraintLayout>
</ScrollView>

View file

@ -0,0 +1,88 @@
<?xml version="1.0" encoding="utf-8"?>
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="?android:selectableItemBackground">
<androidx.appcompat.widget.AppCompatImageView
android:id="@+id/notificationActionIcon"
android:layout_width="0dp"
android:layout_height="48dp"
android:layout_marginStart="12dp"
android:layout_marginTop="8dp"
android:layout_marginBottom="8dp"
app:tint="?android:textColorPrimary"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintDimensionRatio="H,1:1"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent"
tools:ignore="ContentDescription"
tools:src="@drawable/ic_previous_white_24dp" />
<TextView
android:id="@+id/notificationActionTitle"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="8dp"
android:ellipsize="end"
android:maxLines="1"
android:textAppearance="?android:attr/textAppearanceLarge"
android:textSize="14sp"
app:layout_constraintBottom_toTopOf="@+id/notificationActionSummary"
app:layout_constraintEnd_toEndOf="@id/notificationActionClickableArea"
app:layout_constraintHorizontal_bias="0.0"
app:layout_constraintStart_toEndOf="@+id/notificationActionIcon"
app:layout_constraintTop_toTopOf="@+id/notificationActionIcon"
app:layout_constraintVertical_chainStyle="packed"
tools:text="@string/notification_action_1_title" />
<TextView
android:id="@+id/notificationActionSummary"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:ellipsize="end"
android:maxLines="1"
app:layout_constraintBottom_toBottomOf="@+id/notificationActionIcon"
app:layout_constraintEnd_toEndOf="@+id/notificationActionClickableArea"
app:layout_constraintHorizontal_bias="0.0"
app:layout_constraintStart_toStartOf="@+id/notificationActionTitle"
app:layout_constraintTop_toBottomOf="@+id/notificationActionTitle"
tools:text="@string/notification_action_play_pause_buffering_value" />
<View
android:id="@+id/notificationActionClickableArea"
android:layout_width="0dp"
android:layout_height="0dp"
android:background="?android:selectableItemBackground"
android:clickable="true"
android:focusable="true"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toStartOf="@id/notificationActionCheckBoxClickableArea"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" />
<CheckBox
android:id="@+id/notificationActionCheckBox"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:clickable="false"
android:focusable="false"
app:layout_constraintBottom_toBottomOf="@+id/notificationActionCheckBoxClickableArea"
app:layout_constraintEnd_toEndOf="@+id/notificationActionCheckBoxClickableArea"
app:layout_constraintStart_toStartOf="@+id/notificationActionCheckBoxClickableArea"
app:layout_constraintTop_toTopOf="parent" />
<View
android:id="@+id/notificationActionCheckBoxClickableArea"
android:layout_width="0dp"
android:layout_height="0dp"
android:clickable="true"
android:focusable="true"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintDimensionRatio="H,1:1"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintTop_toTopOf="parent" />
</androidx.constraintlayout.widget.ConstraintLayout>

View file

@ -118,108 +118,15 @@
<string name="settings_notifications_compact_view_default_value" translatable="false">0,1,2</string>
<string name="scale_to_square_image_in_notifications_key" translatable="false">scale_to_square_image_in_notifications</string>
<string name="notification_action_prev_key" translatable="false">prev</string>
<string name="notification_action_next_key" translatable="false">next</string>
<string name="notification_action_rewind_key" translatable="false">rewind</string>
<string name="notification_action_forward_key" translatable="false">forward</string>
<string name="notification_action_smart_rewind_prev_key" translatable="false">smart_rewind_prev</string>
<string name="notification_action_smart_forward_next_key" translatable="false">smart_forward_next</string>
<string name="notification_action_play_pause_buffering_key" translatable="false">play_pause_buffering</string>
<string name="notification_action_play_pause_key" translatable="false">play_pause</string>
<string name="notification_action_repeat_key" translatable="false">repeat</string>
<string name="notification_action_shuffle_key" translatable="false">shuffle</string>
<string name="notification_action_close_key" translatable="false">close</string>
<string name="notification_action_n_a_key" translatable="false">n/a</string>
<string name="notification_slot_0_key" translatable="false">notification_slot_0_key</string>
<string name="notification_slot_1_key" translatable="false">notification_slot_1_key</string>
<string name="notification_slot_2_key" translatable="false">notification_slot_2_key</string>
<string name="notification_slot_3_key" translatable="false">notification_slot_3_key</string>
<string name="notification_slot_4_key" translatable="false">notification_slot_4_key</string>
<string name="notification_action_0_key" translatable="false">notification_action_0_key</string>
<string name="notification_action_0_value" translatable="false">@string/notification_action_smart_rewind_prev_key</string>
<string-array name="notification_action_0_description_list" translatable="false">
<item>@string/notification_action_smart_rewind_prev_value</item>
<item>@string/notification_action_prev_value</item>
<item>@string/notification_action_rewind_value</item>
</string-array>
<string-array name="notification_action_0_values_list" translatable="false">
<item>@string/notification_action_smart_rewind_prev_key</item>
<item>@string/notification_action_prev_key</item>
<item>@string/notification_action_rewind_key</item>
</string-array>
<string name="notification_action_1_key" translatable="false">notification_action_1_key</string>
<string name="notification_action_1_value" translatable="false">@string/notification_action_play_pause_buffering_key</string>
<string-array name="notification_action_1_description_list" translatable="false">
<item>@string/notification_action_play_pause_buffering_value</item>
<item>@string/notification_action_play_pause_value</item>
<item>@string/notification_action_rewind_value</item>
</string-array>
<string-array name="notification_action_1_values_list" translatable="false">
<item>@string/notification_action_play_pause_buffering_key</item>
<item>@string/notification_action_play_pause_key</item>
<item>@string/notification_action_rewind_key</item>
</string-array>
<string name="notification_action_2_key" translatable="false">notification_action_2_key</string>
<string name="notification_action_2_value" translatable="false">@string/notification_action_smart_forward_next_key</string>
<string-array name="notification_action_2_description_list" translatable="false">
<item>@string/notification_action_smart_forward_next_value</item>
<item>@string/notification_action_forward_value</item>
<item>@string/notification_action_next_value</item>
<item>@string/notification_action_play_pause_buffering_value</item>
<item>@string/notification_action_play_pause_value</item>
</string-array>
<string-array name="notification_action_2_values_list" translatable="false">
<item>@string/notification_action_smart_forward_next_key</item>
<item>@string/notification_action_forward_key</item>
<item>@string/notification_action_next_key</item>
<item>@string/notification_action_play_pause_buffering_key</item>
<item>@string/notification_action_play_pause_key</item>
</string-array>
<string name="notification_action_3_key" translatable="false">notification_action_3_key</string>
<string name="notification_action_3_value" translatable="false">@string/notification_action_repeat_key</string>
<string-array name="notification_action_3_description_list" translatable="false">
<item>@string/notification_action_repeat_value</item>
<item>@string/notification_action_shuffle_value</item>
<item>@string/notification_action_prev_value</item>
<item>@string/notification_action_forward_value</item>
<item>@string/notification_action_smart_forward_next_value</item>
<item>@string/notification_action_rewind_value</item>
<item>@string/notification_action_smart_rewind_prev_value</item>
<item>@string/notification_action_close_value</item>
<item>@string/notification_action_n_a_value</item>
</string-array>
<string-array name="notification_action_3_values_list" translatable="false">
<item>@string/notification_action_repeat_key</item>
<item>@string/notification_action_shuffle_key</item>
<item>@string/notification_action_prev_key</item>
<item>@string/notification_action_forward_key</item>
<item>@string/notification_action_smart_forward_next_key</item>
<item>@string/notification_action_rewind_key</item>
<item>@string/notification_action_smart_rewind_prev_key</item>
<item>@string/notification_action_close_key</item>
<item>@string/notification_action_n_a_key</item>
</string-array>
<string name="notification_action_4_key" translatable="false">notification_action_4_key</string>
<string name="notification_action_4_value" translatable="false">@string/notification_action_close_key</string>
<string-array name="notification_action_4_description_list" translatable="false">
<item>@string/notification_action_close_value</item>
<item>@string/notification_action_repeat_value</item>
<item>@string/notification_action_shuffle_value</item>
<item>@string/notification_action_next_value</item>
<item>@string/notification_action_forward_value</item>
<item>@string/notification_action_smart_forward_next_value</item>
<item>@string/notification_action_n_a_value</item>
</string-array>
<string-array name="notification_action_4_values_list" translatable="false">
<item>@string/notification_action_close_key</item>
<item>@string/notification_action_repeat_key</item>
<item>@string/notification_action_shuffle_key</item>
<item>@string/notification_action_next_key</item>
<item>@string/notification_action_forward_key</item>
<item>@string/notification_action_smart_forward_next_key</item>
<item>@string/notification_action_n_a_key</item>
</string-array>
<string name="notification_slot_compact_0_key" translatable="false">notification_slot_compact_0_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="video_mp4_key" translatable="false">video_mp4</string>
<string name="video_webm_key" translatable="false">video_webm</string>

View file

@ -66,21 +66,20 @@
<string name="notification_action_2_title">Third action button</string>
<string name="notification_action_3_title">Fourth action button</string>
<string name="notification_action_4_title">Fifth action button</string>
<string name="notification_compact_view_title">Notification compact view</string>
<string name="notification_compact_view_summary">Notification slots to show in compact view</string>
<string name="notification_action_prev_value">Previous</string>
<string name="notification_action_next_value">Next</string>
<string name="notification_action_rewind_value">Rewind</string>
<string name="notification_action_forward_value">Forward</string>
<string name="notification_action_smart_rewind_prev_value">Rewind / Previous</string>
<string name="notification_action_smart_forward_next_value">Forward / Next</string>
<string name="notification_action_play_pause_buffering_value">Play / Pause / Buffering</string>
<string name="notification_action_play_pause_value">Play / Pause</string>
<string name="notification_action_repeat_value">Repeat</string>
<string name="notification_action_shuffle_value">Shuffle</string>
<string name="notification_action_close_value">Close</string>
<string name="notification_action_n_a_value">Nothing</string>
<string name="notification_actions_summary">Edit each notification action below by tapping on it.\nSelect up to three of them to be shown in the compact notification by using the checkboxes on the right.</string>
<string name="notification_actions_at_most_three">You can select at most three actions to show in the compact notification!</string>
<string name="notification_action_previous">Previous</string>
<string name="notification_action_next">Next</string>
<string name="notification_action_rewind">Rewind</string>
<string name="notification_action_forward">Forward</string>
<string name="notification_action_smart_rewind_previous">Rewind / Previous</string>
<string name="notification_action_smart_forward_next">Forward / Next</string>
<string name="notification_action_play_pause_buffering">Play / Pause / Buffering</string>
<string name="notification_action_play_pause">Play / Pause</string>
<string name="notification_action_repeat">Repeat</string>
<string name="notification_action_shuffle">Shuffle</string>
<string name="notification_action_nothing">Nothing</string>
<string name="play_audio">Audio</string>
<string name="default_audio_format_title">Default audio format</string>
@ -154,7 +153,7 @@
<string name="settings_category_other_title">Other</string>
<string name="settings_category_debug_title">Debug</string>
<string name="settings_category_updates_title">Updates</string>
<string name="settings_category_notifications_title">Notifications</string>
<string name="settings_category_notification_title">Notification</string>
<string name="background_player_playing_toast">Playing in background</string>
<string name="popup_playing_toast">Playing in popup mode</string>
<string name="background_player_append">Queued on background player</string>

View file

@ -34,70 +34,4 @@
android:title="@string/caption_setting_title"
app:iconSpaceReserved="false" />
<PreferenceCategory
android:layout="@layout/settings_category_header_layout"
android:title="@string/settings_category_notifications_title"
app:iconSpaceReserved="false">
<SwitchPreference
android:defaultValue="false"
android:key="@string/scale_to_square_image_in_notifications_key"
android:summary="@string/notification_scale_to_square_image_summary"
android:title="@string/notification_scale_to_square_image_title"
app:iconSpaceReserved="false" />
<ListPreference
android:defaultValue="@string/notification_action_0_value"
android:entries="@array/notification_action_0_description_list"
android:entryValues="@array/notification_action_0_values_list"
android:key="@string/notification_action_0_key"
android:summary="%s"
android:title="@string/notification_action_0_title"
app:iconSpaceReserved="false" />
<ListPreference
android:defaultValue="@string/notification_action_1_value"
android:entries="@array/notification_action_1_description_list"
android:entryValues="@array/notification_action_1_values_list"
android:key="@string/notification_action_1_key"
android:summary="%s"
android:title="@string/notification_action_1_title"
app:iconSpaceReserved="false" />
<ListPreference
android:defaultValue="@string/notification_action_2_value"
android:entries="@array/notification_action_2_description_list"
android:entryValues="@array/notification_action_2_values_list"
android:key="@string/notification_action_2_key"
android:summary="%s"
android:title="@string/notification_action_2_title"
app:iconSpaceReserved="false" />
<ListPreference
android:defaultValue="@string/notification_action_3_value"
android:entries="@array/notification_action_3_description_list"
android:entryValues="@array/notification_action_3_values_list"
android:key="@string/notification_action_3_key"
android:summary="%s"
android:title="@string/notification_action_3_title"
app:iconSpaceReserved="false" />
<ListPreference
android:defaultValue="@string/notification_action_4_value"
android:entries="@array/notification_action_4_description_list"
android:entryValues="@array/notification_action_4_values_list"
android:key="@string/notification_action_4_key"
android:summary="%s"
android:title="@string/notification_action_4_title"
app:iconSpaceReserved="false" />
<EditTextPreference
android:defaultValue="@string/settings_notifications_compact_view_default_value"
android:key="@string/settings_notifications_compact_view_key"
android:summary="@string/notification_compact_view_summary"
android:title="@string/notification_compact_view_title"
app:iconSpaceReserved="false" />
</PreferenceCategory>
</PreferenceScreen>

View file

@ -35,6 +35,12 @@
android:icon="?attr/ic_language"
android:title="@string/content"/>
<PreferenceScreen
app:iconSpaceReserved="false"
android:fragment="org.schabi.newpipe.settings.NotificationSettingsFragment"
android:icon="?attr/ic_play_arrow"
android:title="@string/settings_category_notification_title"/>
<PreferenceScreen
app:iconSpaceReserved="false"
android:fragment="org.schabi.newpipe.settings.UpdateSettingsFragment"