Merge pull request #1306 from mfietz/issue/1304-feed-remover

Feed Remover: Don't let the user cancel the ProgressDialog
This commit is contained in:
Tom Hennen 2015-10-31 10:12:34 -04:00
commit 01af6d4a78

View File

@ -3,15 +3,14 @@ package de.danoeh.antennapod.core.asynctask;
import android.annotation.SuppressLint; import android.annotation.SuppressLint;
import android.app.ProgressDialog; import android.app.ProgressDialog;
import android.content.Context; import android.content.Context;
import android.content.DialogInterface;
import android.content.DialogInterface.OnCancelListener;
import android.os.AsyncTask; import android.os.AsyncTask;
import java.util.concurrent.ExecutionException;
import de.danoeh.antennapod.core.R; import de.danoeh.antennapod.core.R;
import de.danoeh.antennapod.core.feed.Feed; import de.danoeh.antennapod.core.feed.Feed;
import de.danoeh.antennapod.core.storage.DBWriter; import de.danoeh.antennapod.core.storage.DBWriter;
import java.util.concurrent.ExecutionException;
/** Removes a feed in the background. */ /** Removes a feed in the background. */
public class FeedRemover extends AsyncTask<Void, Void, Void> { public class FeedRemover extends AsyncTask<Void, Void, Void> {
Context context; Context context;
@ -36,11 +35,6 @@ public class FeedRemover extends AsyncTask<Void, Void, Void> {
return null; return null;
} }
@Override
protected void onCancelled() {
dialog.dismiss();
}
@Override @Override
protected void onPostExecute(Void result) { protected void onPostExecute(Void result) {
dialog.dismiss(); dialog.dismiss();
@ -50,15 +44,8 @@ public class FeedRemover extends AsyncTask<Void, Void, Void> {
protected void onPreExecute() { protected void onPreExecute() {
dialog = new ProgressDialog(context); dialog = new ProgressDialog(context);
dialog.setMessage(context.getString(R.string.feed_remover_msg)); dialog.setMessage(context.getString(R.string.feed_remover_msg));
dialog.setOnCancelListener(new OnCancelListener() { dialog.setIndeterminate(true);
dialog.setCancelable(false);
@Override
public void onCancel(DialogInterface dialog) {
cancel(true);
}
});
dialog.show(); dialog.show();
} }