From cf519ca0aa1637c716a780b9a2f855a83fb1d6af Mon Sep 17 00:00:00 2001 From: Martin Fietz Date: Sat, 1 Aug 2015 12:17:50 +0200 Subject: Dialog when podcast's auto download preference is changed When the user changes a podcast's auto download setting, ask if this new setting should be applied to the podcast's episodes --- .../antennapod/activity/FeedInfoActivity.java | 31 +++++++++++++++++++--- 1 file changed, 27 insertions(+), 4 deletions(-) (limited to 'app') diff --git a/app/src/main/java/de/danoeh/antennapod/activity/FeedInfoActivity.java b/app/src/main/java/de/danoeh/antennapod/activity/FeedInfoActivity.java index fae8baf65..c6ea2c2e3 100644 --- a/app/src/main/java/de/danoeh/antennapod/activity/FeedInfoActivity.java +++ b/app/src/main/java/de/danoeh/antennapod/activity/FeedInfoActivity.java @@ -2,6 +2,7 @@ package de.danoeh.antennapod.activity; import android.content.ClipData; import android.content.Context; +import android.content.DialogInterface; import android.content.Intent; import android.net.Uri; import android.os.AsyncTask; @@ -14,21 +15,21 @@ import android.view.Menu; import android.view.MenuInflater; import android.view.MenuItem; import android.view.View; -import android.widget.AbsSpinner; +import android.widget.AdapterView; +import android.widget.AdapterView.OnItemSelectedListener; import android.widget.CheckBox; import android.widget.CompoundButton; import android.widget.EditText; import android.widget.ImageView; -import android.widget.TextView; import android.widget.Spinner; -import android.widget.AdapterView; -import android.widget.AdapterView.OnItemSelectedListener; +import android.widget.TextView; import android.widget.Toast; import com.joanzapata.android.iconify.Iconify; import com.squareup.picasso.Picasso; import de.danoeh.antennapod.R; +import de.danoeh.antennapod.core.dialog.ConfirmationDialog; import de.danoeh.antennapod.core.dialog.DownloadRequestErrorDialogCreator; import de.danoeh.antennapod.core.feed.Feed; import de.danoeh.antennapod.core.feed.FeedPreferences; @@ -150,6 +151,9 @@ public class FeedInfoActivity extends ActionBarActivity { public void onCheckedChanged(CompoundButton compoundButton, boolean checked) { feed.getPreferences().setAutoDownload(checked); feed.savePreferences(FeedInfoActivity.this); + ApplyToEpisodesDialog dialog = new ApplyToEpisodesDialog(FeedInfoActivity.this, + feed, checked); + dialog.createNewDialog().show(); } }); spnAutoDelete.setOnItemSelectedListener(new OnItemSelectedListener() { @@ -272,4 +276,23 @@ public class FeedInfoActivity extends ActionBarActivity { return super.onOptionsItemSelected(item); } } + + private class ApplyToEpisodesDialog extends ConfirmationDialog { + + private final Feed feed; + private final boolean autoDownload; + + public ApplyToEpisodesDialog(Context context, Feed feed, boolean autoDownload) { + super(context, R.string.auto_download_apply_to_items_title, + R.string.auto_download_apply_to_items_message); + this.feed = feed; + this.autoDownload = autoDownload; + } + + @Override + public void onConfirmButtonPressed(DialogInterface dialog) { + DBWriter.setFeedsItemsAutoDownload(context, feed, autoDownload); + } + } + } -- cgit v1.2.3