mirror of
https://github.com/AntennaPod/AntennaPod.git
synced 2024-12-25 00:14:00 +01:00
String tweaks reported on Transifex (#6942)
This commit is contained in:
parent
9cfbae183c
commit
a7068cc24a
@ -97,43 +97,31 @@ public class UserInterfacePreferencesFragment extends PreferenceFragmentCompat {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
private void showFullNotificationButtonsDialog() {
|
private void showFullNotificationButtonsDialog() {
|
||||||
final Context context = getActivity();
|
final Context context = getActivity();
|
||||||
|
|
||||||
final List<Integer> preferredButtons = UserPreferences.getFullNotificationButtons();
|
final List<Integer> preferredButtons = UserPreferences.getFullNotificationButtons();
|
||||||
final String[] allButtonNames = context.getResources().getStringArray(
|
final String[] allButtonNames = context.getResources().getStringArray(
|
||||||
R.array.full_notification_buttons_options);
|
R.array.full_notification_buttons_options);
|
||||||
final int[] buttonIDs = {
|
final int[] buttonIds = {
|
||||||
UserPreferences.NOTIFICATION_BUTTON_SKIP,
|
UserPreferences.NOTIFICATION_BUTTON_SKIP,
|
||||||
UserPreferences.NOTIFICATION_BUTTON_NEXT_CHAPTER,
|
UserPreferences.NOTIFICATION_BUTTON_NEXT_CHAPTER,
|
||||||
UserPreferences.NOTIFICATION_BUTTON_PLAYBACK_SPEED,
|
UserPreferences.NOTIFICATION_BUTTON_PLAYBACK_SPEED,
|
||||||
UserPreferences.NOTIFICATION_BUTTON_SLEEP_TIMER,
|
UserPreferences.NOTIFICATION_BUTTON_SLEEP_TIMER,
|
||||||
};
|
};
|
||||||
final int exactItems = 2;
|
|
||||||
final DialogInterface.OnClickListener completeListener = (dialog, which) ->
|
final DialogInterface.OnClickListener completeListener = (dialog, which) ->
|
||||||
UserPreferences.setFullNotificationButtons(preferredButtons);
|
UserPreferences.setFullNotificationButtons(preferredButtons);
|
||||||
final String title = context.getResources().getString(
|
final String title = context.getResources().getString(R.string.pref_full_notification_buttons_title);
|
||||||
R.string.pref_full_notification_buttons_title);
|
|
||||||
|
|
||||||
showNotificationButtonsDialog(preferredButtons, allButtonNames, buttonIDs, title,
|
|
||||||
exactItems, completeListener
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
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
|
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
|
// Clear buttons that are not part of the setting anymore
|
||||||
for (int i = preferredButtons.size() - 1; i >= 0; i--) {
|
for (int i = preferredButtons.size() - 1; i >= 0; i--) {
|
||||||
boolean isValid = false;
|
boolean isValid = false;
|
||||||
for (int j = 0; j < checked.length; j++) {
|
for (int j = 0; j < checked.length; j++) {
|
||||||
if (buttonIds[j] == preferredButtons.get(i)) {
|
if (buttonIds[j] == preferredButtons.get(i)) {
|
||||||
isValid = true;
|
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])) {
|
if (preferredButtons.contains(buttonIds[i])) {
|
||||||
checked[i] = true;
|
checked[i] = true;
|
||||||
}
|
}
|
||||||
@ -152,7 +140,6 @@ public class UserInterfacePreferencesFragment extends PreferenceFragmentCompat {
|
|||||||
builder.setTitle(title);
|
builder.setTitle(title);
|
||||||
builder.setMultiChoiceItems(allButtonNames, checked, (dialog, which, isChecked) -> {
|
builder.setMultiChoiceItems(allButtonNames, checked, (dialog, which, isChecked) -> {
|
||||||
checked[which] = isChecked;
|
checked[which] = isChecked;
|
||||||
|
|
||||||
if (isChecked) {
|
if (isChecked) {
|
||||||
preferredButtons.add(buttonIds[which]);
|
preferredButtons.add(buttonIds[which]);
|
||||||
} else {
|
} else {
|
||||||
@ -168,19 +155,17 @@ public class UserInterfacePreferencesFragment extends PreferenceFragmentCompat {
|
|||||||
Button positiveButton = dialog.getButton(AlertDialog.BUTTON_POSITIVE);
|
Button positiveButton = dialog.getButton(AlertDialog.BUTTON_POSITIVE);
|
||||||
|
|
||||||
positiveButton.setOnClickListener(v -> {
|
positiveButton.setOnClickListener(v -> {
|
||||||
if (preferredButtons.size() != exactItems) {
|
if (preferredButtons.size() != 2) {
|
||||||
ListView selectionView = dialog.getListView();
|
ListView selectionView = dialog.getListView();
|
||||||
Snackbar.make(
|
Snackbar.make(
|
||||||
selectionView,
|
selectionView,
|
||||||
String.format(context.getResources().getString(
|
context.getResources().getString(R.string.pref_compact_notification_buttons_dialog_error_exact),
|
||||||
R.string.pref_compact_notification_buttons_dialog_error_exact), exactItems),
|
|
||||||
Snackbar.LENGTH_SHORT).show();
|
Snackbar.LENGTH_SHORT).show();
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
completeListener.onClick(dialog, AlertDialog.BUTTON_POSITIVE);
|
completeListener.onClick(dialog, AlertDialog.BUTTON_POSITIVE);
|
||||||
dialog.cancel();
|
dialog.cancel();
|
||||||
}
|
}
|
||||||
}
|
});
|
||||||
);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -488,9 +488,9 @@
|
|||||||
<string name="pref_expandNotify_sum">This usually expands the notification to show playback buttons.</string>
|
<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_title">Persistent playback controls</string>
|
||||||
<string name="pref_persistNotify_sum">Keep notification and lockscreen controls when playback is paused</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_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_title">Enqueue location</string>
|
||||||
<string name="pref_enqueue_location_sum">Add episodes to: %1$s</string>
|
<string name="pref_enqueue_location_sum">Add episodes to: %1$s</string>
|
||||||
<string name="enqueue_location_back">Back</string>
|
<string name="enqueue_location_back">Back</string>
|
||||||
|
Loading…
Reference in New Issue
Block a user