From cb3501342e2a8d3fb32c12c40f60d3006fbb17dc Mon Sep 17 00:00:00 2001 From: ByteHamster Date: Sat, 15 Apr 2017 10:28:29 +0200 Subject: [PATCH] Added feed title to delete confirmation Closes #2291 --- .../danoeh/antennapod/activity/MainActivity.java | 2 +- .../activity/MediaplayerInfoActivity.java | 2 +- .../antennapod/fragment/ItemlistFragment.java | 2 +- .../fragment/SubscriptionFragment.java | 2 +- .../core/dialog/ConfirmationDialog.java | 16 ++++++++++------ core/src/main/res/values/strings.xml | 2 +- 6 files changed, 15 insertions(+), 11 deletions(-) diff --git a/app/src/main/java/de/danoeh/antennapod/activity/MainActivity.java b/app/src/main/java/de/danoeh/antennapod/activity/MainActivity.java index 41ed963c2..f0fcdca90 100644 --- a/app/src/main/java/de/danoeh/antennapod/activity/MainActivity.java +++ b/app/src/main/java/de/danoeh/antennapod/activity/MainActivity.java @@ -593,7 +593,7 @@ public class MainActivity extends CastEnabledActivity implements NavDrawerActivi }; ConfirmationDialog conDialog = new ConfirmationDialog(this, R.string.remove_feed_label, - R.string.feed_delete_confirmation_msg) { + getString(R.string.feed_delete_confirmation_msg, feed.getTitle())) { @Override public void onConfirmButtonPressed( DialogInterface dialog) { diff --git a/app/src/main/java/de/danoeh/antennapod/activity/MediaplayerInfoActivity.java b/app/src/main/java/de/danoeh/antennapod/activity/MediaplayerInfoActivity.java index 9d2f35e3d..b3cda69d3 100644 --- a/app/src/main/java/de/danoeh/antennapod/activity/MediaplayerInfoActivity.java +++ b/app/src/main/java/de/danoeh/antennapod/activity/MediaplayerInfoActivity.java @@ -395,7 +395,7 @@ public abstract class MediaplayerInfoActivity extends MediaplayerActivity implem }; ConfirmationDialog conDialog = new ConfirmationDialog(this, R.string.remove_feed_label, - R.string.feed_delete_confirmation_msg) { + getString(R.string.feed_delete_confirmation_msg, feed.getTitle())) { @Override public void onConfirmButtonPressed( DialogInterface dialog) { diff --git a/app/src/main/java/de/danoeh/antennapod/fragment/ItemlistFragment.java b/app/src/main/java/de/danoeh/antennapod/fragment/ItemlistFragment.java index 75f9c0d35..7f0527837 100644 --- a/app/src/main/java/de/danoeh/antennapod/fragment/ItemlistFragment.java +++ b/app/src/main/java/de/danoeh/antennapod/fragment/ItemlistFragment.java @@ -265,7 +265,7 @@ public class ItemlistFragment extends ListFragment { }; ConfirmationDialog conDialog = new ConfirmationDialog(getActivity(), R.string.remove_feed_label, - R.string.feed_delete_confirmation_msg) { + getString(R.string.feed_delete_confirmation_msg, feed.getTitle())) { @Override public void onConfirmButtonPressed( diff --git a/app/src/main/java/de/danoeh/antennapod/fragment/SubscriptionFragment.java b/app/src/main/java/de/danoeh/antennapod/fragment/SubscriptionFragment.java index 01119bcff..9626e6c2e 100644 --- a/app/src/main/java/de/danoeh/antennapod/fragment/SubscriptionFragment.java +++ b/app/src/main/java/de/danoeh/antennapod/fragment/SubscriptionFragment.java @@ -178,7 +178,7 @@ public class SubscriptionFragment extends Fragment { }; ConfirmationDialog conDialog = new ConfirmationDialog(getContext(), R.string.remove_feed_label, - R.string.feed_delete_confirmation_msg) { + getString(R.string.feed_delete_confirmation_msg, feed.getTitle())) { @Override public void onConfirmButtonPressed( DialogInterface dialog) { diff --git a/core/src/main/java/de/danoeh/antennapod/core/dialog/ConfirmationDialog.java b/core/src/main/java/de/danoeh/antennapod/core/dialog/ConfirmationDialog.java index 266526d82..b14803751 100644 --- a/core/src/main/java/de/danoeh/antennapod/core/dialog/ConfirmationDialog.java +++ b/core/src/main/java/de/danoeh/antennapod/core/dialog/ConfirmationDialog.java @@ -16,16 +16,20 @@ public abstract class ConfirmationDialog { private static final String TAG = ConfirmationDialog.class.getSimpleName(); protected Context context; - int titleId; - int messageId; + private int titleId; + private String message; - int positiveText; - int negativeText; + private int positiveText; + private int negativeText; public ConfirmationDialog(Context context, int titleId, int messageId) { + this(context, titleId, context.getString(messageId)); + } + + public ConfirmationDialog(Context context, int titleId, String message) { this.context = context; this.titleId = titleId; - this.messageId = messageId; + this.message = message; } public void onCancelButtonPressed(DialogInterface dialog) { @@ -47,7 +51,7 @@ public abstract class ConfirmationDialog { public final AlertDialog createNewDialog() { AlertDialog.Builder builder = new AlertDialog.Builder(context); builder.setTitle(titleId); - builder.setMessage(messageId); + builder.setMessage(message); builder.setPositiveButton(positiveText != 0 ? positiveText : R.string.confirm_label, (dialog, which) -> onConfirmButtonPressed(dialog)); builder.setNegativeButton(negativeText != 0 ? negativeText : R.string.cancel_label, diff --git a/core/src/main/res/values/strings.xml b/core/src/main/res/values/strings.xml index ebddeb243..d9b474de6 100644 --- a/core/src/main/res/values/strings.xml +++ b/core/src/main/res/values/strings.xml @@ -124,7 +124,7 @@ Share Feed URL Share Episode File URL Share Episode File URL with Position - Please confirm that you want to delete this feed and ALL episodes of this feed that you have downloaded. + Please confirm that you want to delete the feed \"%1$s\" and ALL episodes of this feed that you have downloaded. Removing Feed Refresh complete Feed Hide Episodes