summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorByteHamster <ByteHamster@users.noreply.github.com>2024-02-25 15:31:59 +0100
committerGitHub <noreply@github.com>2024-02-25 15:31:59 +0100
commita7068cc24a2e943fe7885369c34020e7ba02c7e0 (patch)
tree8d0797ecdc91b3a7eebf8c00e3acbe4967c7972a
parent9cfbae183cd1b5e1bb1fed68125ab064d5be7c55 (diff)
downloadAntennaPod-a7068cc24a2e943fe7885369c34020e7ba02c7e0.zip
String tweaks reported on Transifex (#6942)
-rw-r--r--app/src/main/java/de/danoeh/antennapod/fragment/preferences/UserInterfacePreferencesFragment.java29
-rw-r--r--ui/i18n/src/main/res/values/strings.xml4
2 files changed, 9 insertions, 24 deletions
diff --git a/app/src/main/java/de/danoeh/antennapod/fragment/preferences/UserInterfacePreferencesFragment.java b/app/src/main/java/de/danoeh/antennapod/fragment/preferences/UserInterfacePreferencesFragment.java
index 2edf8cb68..af48c705d 100644
--- a/app/src/main/java/de/danoeh/antennapod/fragment/preferences/UserInterfacePreferencesFragment.java
+++ b/app/src/main/java/de/danoeh/antennapod/fragment/preferences/UserInterfacePreferencesFragment.java
@@ -97,43 +97,31 @@ public class UserInterfacePreferencesFragment extends PreferenceFragmentCompat {
}
}
-
private void showFullNotificationButtonsDialog() {
final Context context = getActivity();
final List<Integer> preferredButtons = UserPreferences.getFullNotificationButtons();
final String[] allButtonNames = context.getResources().getStringArray(
R.array.full_notification_buttons_options);
- final int[] buttonIDs = {
+ final int[] buttonIds = {
UserPreferences.NOTIFICATION_BUTTON_SKIP,
UserPreferences.NOTIFICATION_BUTTON_NEXT_CHAPTER,
UserPreferences.NOTIFICATION_BUTTON_PLAYBACK_SPEED,
UserPreferences.NOTIFICATION_BUTTON_SLEEP_TIMER,
};
- final int exactItems = 2;
final DialogInterface.OnClickListener completeListener = (dialog, which) ->
UserPreferences.setFullNotificationButtons(preferredButtons);
- final String title = context.getResources().getString(
- R.string.pref_full_notification_buttons_title);
-
- showNotificationButtonsDialog(preferredButtons, allButtonNames, buttonIDs, title,
- exactItems, completeListener
- );
- }
+ final String title = context.getResources().getString(R.string.pref_full_notification_buttons_title);
- private void showNotificationButtonsDialog(List<Integer> preferredButtons,
- String[] allButtonNames, int[] buttonIds, String title,
- int exactItems, DialogInterface.OnClickListener completeListener) {
boolean[] checked = new boolean[allButtonNames.length]; // booleans default to false in java
- final Context context = getActivity();
-
// Clear buttons that are not part of the setting anymore
for (int i = preferredButtons.size() - 1; i >= 0; i--) {
boolean isValid = false;
for (int j = 0; j < checked.length; j++) {
if (buttonIds[j] == preferredButtons.get(i)) {
isValid = true;
+ break;
}
}
@@ -142,7 +130,7 @@ public class UserInterfacePreferencesFragment extends PreferenceFragmentCompat {
}
}
- for(int i=0; i < checked.length; i++) {
+ for (int i = 0; i < checked.length; i++) {
if (preferredButtons.contains(buttonIds[i])) {
checked[i] = true;
}
@@ -152,7 +140,6 @@ public class UserInterfacePreferencesFragment extends PreferenceFragmentCompat {
builder.setTitle(title);
builder.setMultiChoiceItems(allButtonNames, checked, (dialog, which, isChecked) -> {
checked[which] = isChecked;
-
if (isChecked) {
preferredButtons.add(buttonIds[which]);
} else {
@@ -168,19 +155,17 @@ public class UserInterfacePreferencesFragment extends PreferenceFragmentCompat {
Button positiveButton = dialog.getButton(AlertDialog.BUTTON_POSITIVE);
positiveButton.setOnClickListener(v -> {
- if (preferredButtons.size() != exactItems) {
+ if (preferredButtons.size() != 2) {
ListView selectionView = dialog.getListView();
Snackbar.make(
selectionView,
- String.format(context.getResources().getString(
- R.string.pref_compact_notification_buttons_dialog_error_exact), exactItems),
+ context.getResources().getString(R.string.pref_compact_notification_buttons_dialog_error_exact),
Snackbar.LENGTH_SHORT).show();
} else {
completeListener.onClick(dialog, AlertDialog.BUTTON_POSITIVE);
dialog.cancel();
}
- }
- );
+ });
}
}
diff --git a/ui/i18n/src/main/res/values/strings.xml b/ui/i18n/src/main/res/values/strings.xml
index 6ff5154d8..2ec045a3d 100644
--- a/ui/i18n/src/main/res/values/strings.xml
+++ b/ui/i18n/src/main/res/values/strings.xml
@@ -488,9 +488,9 @@
<string name="pref_expandNotify_sum">This usually expands the notification to show playback buttons.</string>
<string name="pref_persistNotify_title">Persistent playback controls</string>
<string name="pref_persistNotify_sum">Keep notification and lockscreen controls when playback is paused</string>
- <string name="pref_compact_notification_buttons_dialog_error_exact">You must select exactly %1$d items.</string>
+ <string name="pref_compact_notification_buttons_dialog_error_exact">You must select exactly two items</string>
<string name="pref_full_notification_buttons_title">Set notification buttons</string>
- <string name="pref_full_notification_buttons_sum">Change the playback buttons on the playback notification.</string>
+ <string name="pref_full_notification_buttons_sum">Change the buttons on the playback notification</string>
<string name="pref_enqueue_location_title">Enqueue location</string>
<string name="pref_enqueue_location_sum">Add episodes to: %1$s</string>
<string name="enqueue_location_back">Back</string>