Merge pull request #2295 from ByteHamster/feed-title-confirmation

Added feed title to delete confirmation
This commit is contained in:
Martin Fietz 2017-04-15 11:58:38 +02:00 committed by GitHub
commit 09fc0debf1
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,
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) {

View File

@ -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) {

View File

@ -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(

View File

@ -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) {

View File

@ -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,

View File

@ -124,7 +124,7 @@
<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_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="load_complete_feed">Refresh complete Feed</string>
<string name="hide_episodes_title">Hide Episodes</string>