Added feed title to delete confirmation

Closes #2291
This commit is contained in:
ByteHamster 2017-04-15 10:28:29 +02:00
parent 639ff81f8c
commit cb3501342e
6 changed files with 15 additions and 11 deletions

View File

@ -593,7 +593,7 @@ public class MainActivity extends CastEnabledActivity implements NavDrawerActivi
}; };
ConfirmationDialog conDialog = new ConfirmationDialog(this, ConfirmationDialog conDialog = new ConfirmationDialog(this,
R.string.remove_feed_label, R.string.remove_feed_label,
R.string.feed_delete_confirmation_msg) { getString(R.string.feed_delete_confirmation_msg, feed.getTitle())) {
@Override @Override
public void onConfirmButtonPressed( public void onConfirmButtonPressed(
DialogInterface dialog) { DialogInterface dialog) {

View File

@ -395,7 +395,7 @@ public abstract class MediaplayerInfoActivity extends MediaplayerActivity implem
}; };
ConfirmationDialog conDialog = new ConfirmationDialog(this, ConfirmationDialog conDialog = new ConfirmationDialog(this,
R.string.remove_feed_label, R.string.remove_feed_label,
R.string.feed_delete_confirmation_msg) { getString(R.string.feed_delete_confirmation_msg, feed.getTitle())) {
@Override @Override
public void onConfirmButtonPressed( public void onConfirmButtonPressed(
DialogInterface dialog) { DialogInterface dialog) {

View File

@ -265,7 +265,7 @@ public class ItemlistFragment extends ListFragment {
}; };
ConfirmationDialog conDialog = new ConfirmationDialog(getActivity(), ConfirmationDialog conDialog = new ConfirmationDialog(getActivity(),
R.string.remove_feed_label, R.string.remove_feed_label,
R.string.feed_delete_confirmation_msg) { getString(R.string.feed_delete_confirmation_msg, feed.getTitle())) {
@Override @Override
public void onConfirmButtonPressed( public void onConfirmButtonPressed(

View File

@ -178,7 +178,7 @@ public class SubscriptionFragment extends Fragment {
}; };
ConfirmationDialog conDialog = new ConfirmationDialog(getContext(), ConfirmationDialog conDialog = new ConfirmationDialog(getContext(),
R.string.remove_feed_label, R.string.remove_feed_label,
R.string.feed_delete_confirmation_msg) { getString(R.string.feed_delete_confirmation_msg, feed.getTitle())) {
@Override @Override
public void onConfirmButtonPressed( public void onConfirmButtonPressed(
DialogInterface dialog) { DialogInterface dialog) {

View File

@ -16,16 +16,20 @@ public abstract class ConfirmationDialog {
private static final String TAG = ConfirmationDialog.class.getSimpleName(); private static final String TAG = ConfirmationDialog.class.getSimpleName();
protected Context context; protected Context context;
int titleId; private int titleId;
int messageId; private String message;
int positiveText; private int positiveText;
int negativeText; private int negativeText;
public ConfirmationDialog(Context context, int titleId, int messageId) { 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.context = context;
this.titleId = titleId; this.titleId = titleId;
this.messageId = messageId; this.message = message;
} }
public void onCancelButtonPressed(DialogInterface dialog) { public void onCancelButtonPressed(DialogInterface dialog) {
@ -47,7 +51,7 @@ public abstract class ConfirmationDialog {
public final AlertDialog createNewDialog() { public final AlertDialog createNewDialog() {
AlertDialog.Builder builder = new AlertDialog.Builder(context); AlertDialog.Builder builder = new AlertDialog.Builder(context);
builder.setTitle(titleId); builder.setTitle(titleId);
builder.setMessage(messageId); builder.setMessage(message);
builder.setPositiveButton(positiveText != 0 ? positiveText : R.string.confirm_label, builder.setPositiveButton(positiveText != 0 ? positiveText : R.string.confirm_label,
(dialog, which) -> onConfirmButtonPressed(dialog)); (dialog, which) -> onConfirmButtonPressed(dialog));
builder.setNegativeButton(negativeText != 0 ? negativeText : R.string.cancel_label, builder.setNegativeButton(negativeText != 0 ? negativeText : R.string.cancel_label,

View File

@ -124,7 +124,7 @@
<string name="share_feed_url_label">Share Feed URL</string> <string name="share_feed_url_label">Share Feed URL</string>
<string name="share_item_url_label">Share Episode File URL</string> <string name="share_item_url_label">Share Episode File URL</string>
<string name="share_item_url_with_position_label">Share Episode File URL with Position</string> <string name="share_item_url_with_position_label">Share Episode File URL with Position</string>
<string name="feed_delete_confirmation_msg">Please confirm that you want to delete this feed and ALL episodes of this feed that you have downloaded.</string> <string name="feed_delete_confirmation_msg">Please confirm that you want to delete the feed \"%1$s\" and ALL episodes of this feed that you have downloaded.</string>
<string name="feed_remover_msg">Removing Feed</string> <string name="feed_remover_msg">Removing Feed</string>
<string name="load_complete_feed">Refresh complete Feed</string> <string name="load_complete_feed">Refresh complete Feed</string>
<string name="hide_episodes_title">Hide Episodes</string> <string name="hide_episodes_title">Hide Episodes</string>