Extract hardcoded strings into strings.xml and improve them

This commit is contained in:
Stypox 2020-08-16 00:01:43 +02:00
parent c79997ebe3
commit 7766fd13fd
No known key found for this signature in database
GPG Key ID: 4BDF1B40A49FDD23
4 changed files with 144 additions and 129 deletions

View File

@ -208,15 +208,15 @@ public final class NotificationUtil {
private void initializeNotificationSlots(final VideoPlayerImpl player) {
notificationSlot0 = player.sharedPreferences.getString(
player.context.getString(R.string.notification_slot_0_key), notificationSlot0);
player.context.getString(R.string.notification_action_0_key), notificationSlot0);
notificationSlot1 = player.sharedPreferences.getString(
player.context.getString(R.string.notification_slot_1_key), notificationSlot1);
player.context.getString(R.string.notification_action_1_key), notificationSlot1);
notificationSlot2 = player.sharedPreferences.getString(
player.context.getString(R.string.notification_slot_2_key), notificationSlot2);
player.context.getString(R.string.notification_action_2_key), notificationSlot2);
notificationSlot3 = player.sharedPreferences.getString(
player.context.getString(R.string.notification_slot_3_key), notificationSlot3);
player.context.getString(R.string.notification_action_3_key), notificationSlot3);
notificationSlot4 = player.sharedPreferences.getString(
player.context.getString(R.string.notification_slot_4_key), notificationSlot4);
player.context.getString(R.string.notification_action_4_key), notificationSlot4);
}
@SuppressLint("RestrictedApi")

View File

@ -118,107 +118,107 @@
<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_slot_prev_key" translatable="false">prev</string>
<string name="notification_slot_next_key" translatable="false">next</string>
<string name="notification_slot_rewind_key" translatable="false">rewind</string>
<string name="notification_slot_forward_key" translatable="false">forward</string>
<string name="notification_slot_smart_rewind_prev_key" translatable="false">smart_rewind_prev</string>
<string name="notification_slot_smart_forward_next_key" translatable="false">smart_forward_next</string>
<string name="notification_slot_play_pause_buffering_key" translatable="false">play_pause_buffering</string>
<string name="notification_slot_play_pause_key" translatable="false">play_pause</string>
<string name="notification_slot_repeat_key" translatable="false">repeat</string>
<string name="notification_slot_shuffle_key" translatable="false">shuffle</string>
<string name="notification_slot_close_key" translatable="false">close</string>
<string name="notification_slot_n_a_key" translatable="false">n/a</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_0_value" translatable="false">@string/notification_slot_smart_rewind_prev_key</string>
<string-array name="notification_slot_0_description_list" translatable="false">
<item>Rewind / Previous</item>
<item>Previous</item>
<item>Rewind</item>
<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_slot_0_values_list" translatable="false">
<item>@string/notification_slot_smart_rewind_prev_key</item>
<item>@string/notification_slot_prev_key</item>
<item>@string/notification_slot_rewind_key</item>
<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_slot_1_key" translatable="false">notification_slot_1_key</string>
<string name="notification_slot_1_value" translatable="false">@string/notification_slot_play_pause_buffering_key</string>
<string-array name="notification_slot_1_description_list" translatable="false">
<item>Play / Pause / Buffering</item>
<item>Play / Pause</item>
<item>Rewind</item>
<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_slot_1_values_list" translatable="false">
<item>@string/notification_slot_play_pause_buffering_key</item>
<item>@string/notification_slot_play_pause_key</item>
<item>@string/notification_slot_rewind_key</item>
<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_slot_2_key" translatable="false">notification_slot_2_key</string>
<string name="notification_slot_2_value" translatable="false">@string/notification_slot_smart_forward_next_key</string>
<string-array name="notification_slot_2_description_list" translatable="false">
<item>Forward / Next</item>
<item>Forward</item>
<item>Next</item>
<item>Play / Pause / Buffering</item>
<item>Play / Pause</item>
<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_slot_2_values_list" translatable="false">
<item>@string/notification_slot_smart_forward_next_key</item>
<item>@string/notification_slot_forward_key</item>
<item>@string/notification_slot_next_key</item>
<item>@string/notification_slot_play_pause_buffering_key</item>
<item>@string/notification_slot_play_pause_key</item>
<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_slot_3_key" translatable="false">notification_slot_3_key</string>
<string name="notification_slot_3_value" translatable="false">@string/notification_slot_repeat_key</string>
<string-array name="notification_slot_3_description_list" translatable="false">
<item>Repeat</item>
<item>Shuffle</item>
<item>Previous</item>
<item>Forward</item>
<item>Forward / Next</item>
<item>Rewind</item>
<item>Rewind / Previous</item>
<item>Close</item>
<item>N/A</item>
<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_slot_3_values_list" translatable="false">
<item>@string/notification_slot_repeat_key</item>
<item>@string/notification_slot_shuffle_key</item>
<item>@string/notification_slot_prev_key</item>
<item>@string/notification_slot_forward_key</item>
<item>@string/notification_slot_smart_forward_next_key</item>
<item>@string/notification_slot_rewind_key</item>
<item>@string/notification_slot_smart_rewind_prev_key</item>
<item>@string/notification_slot_close_key</item>
<item>@string/notification_slot_n_a_key</item>
<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_slot_4_key" translatable="false">notification_slot_4_key</string>
<string name="notification_slot_4_value" translatable="false">@string/notification_slot_close_key</string>
<string-array name="notification_slot_4_description_list" translatable="false">
<item>Close</item>
<item>Repeat</item>
<item>Shuffle</item>
<item>Next</item>
<item>Forward</item>
<item>Forward / Next</item>
<item>N/A</item>
<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_slot_4_values_list" translatable="false">
<item>@string/notification_slot_close_key</item>
<item>@string/notification_slot_repeat_key</item>
<item>@string/notification_slot_shuffle_key</item>
<item>@string/notification_slot_next_key</item>
<item>@string/notification_slot_forward_key</item>
<item>@string/notification_slot_smart_forward_next_key</item>
<item>@string/notification_slot_n_a_key</item>
<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="video_mp4_key" translatable="false">video_mp4</string>

View File

@ -58,15 +58,30 @@
<string name="kore_package" translatable="false">org.xbmc.kore</string>
<string name="show_play_with_kodi_title">Show \"Play with Kodi\" option</string>
<string name="show_play_with_kodi_summary">Display an option to play a video via Kodi media center</string>
<string name="scale_to_square_image_in_notifications_title">Scale image to 1:1 aspect ratio</string>
<string name="scale_to_square_image_in_notifications_summary">This will scale the notification image from 16:9 to 1:1 aspect ratio</string>
<string name="default_notification_slot_0_title">Notification slot 0</string>
<string name="default_notification_slot_1_title">Notification slot 1</string>
<string name="default_notification_slot_2_title">Notification slot 2</string>
<string name="default_notification_slot_3_title">Notification slot 3</string>
<string name="default_notification_slot_4_title">Notification slot 4</string>
<string name="settings_notifications_compact_view_title">Notification compact view</string>
<string name="settings_notifications_compact_view_summary">Notification slots to show in compact view</string>
<string name="notification_scale_to_square_image_title">Scale image to 1:1 aspect ratio</string>
<string name="notification_scale_to_square_image_summary">This will scale the notification image from 16:9 to 1:1 aspect ratio</string>
<string name="notification_action_0_title">First action button</string>
<string name="notification_action_1_title">Second action button</string>
<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="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

@ -42,60 +42,60 @@
<SwitchPreference
android:defaultValue="false"
android:key="@string/scale_to_square_image_in_notifications_key"
android:summary="@string/scale_to_square_image_in_notifications_summary"
android:title="@string/scale_to_square_image_in_notifications_title"
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_slot_0_value"
android:entries="@array/notification_slot_0_description_list"
android:entryValues="@array/notification_slot_0_values_list"
android:key="@string/notification_slot_0_key"
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/default_notification_slot_0_title"
android:title="@string/notification_action_0_title"
app:iconSpaceReserved="false" />
<ListPreference
android:defaultValue="@string/notification_slot_1_value"
android:entries="@array/notification_slot_1_description_list"
android:entryValues="@array/notification_slot_1_values_list"
android:key="@string/notification_slot_1_key"
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/default_notification_slot_1_title"
android:title="@string/notification_action_1_title"
app:iconSpaceReserved="false" />
<ListPreference
android:defaultValue="@string/notification_slot_2_value"
android:entries="@array/notification_slot_2_description_list"
android:entryValues="@array/notification_slot_2_values_list"
android:key="@string/notification_slot_2_key"
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/default_notification_slot_2_title"
android:title="@string/notification_action_2_title"
app:iconSpaceReserved="false" />
<ListPreference
android:defaultValue="@string/notification_slot_3_value"
android:entries="@array/notification_slot_3_description_list"
android:entryValues="@array/notification_slot_3_values_list"
android:key="@string/notification_slot_3_key"
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/default_notification_slot_3_title"
android:title="@string/notification_action_3_title"
app:iconSpaceReserved="false" />
<ListPreference
android:defaultValue="@string/notification_slot_4_value"
android:entries="@array/notification_slot_4_description_list"
android:entryValues="@array/notification_slot_4_values_list"
android:key="@string/notification_slot_4_key"
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/default_notification_slot_4_title"
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/settings_notifications_compact_view_summary"
android:title="@string/settings_notifications_compact_view_title"
android:summary="@string/notification_compact_view_summary"
android:title="@string/notification_compact_view_title"
app:iconSpaceReserved="false" />
</PreferenceCategory>