blob: afa86c9d7b530e1b0f0eafbc45ce39c23b160dcb (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
|
package de.danoeh.antennapod.adapter.actionbutton;
import android.content.Context;
import androidx.annotation.DrawableRes;
import androidx.annotation.StringRes;
import android.widget.Toast;
import de.danoeh.antennapod.R;
import de.danoeh.antennapod.model.feed.FeedItem;
import de.danoeh.antennapod.model.feed.FeedMedia;
import de.danoeh.antennapod.core.preferences.UserPreferences;
import de.danoeh.antennapod.core.storage.DBWriter;
import de.danoeh.antennapod.core.storage.DownloadRequester;
public class CancelDownloadActionButton extends ItemActionButton {
public CancelDownloadActionButton(FeedItem item) {
super(item);
}
@Override
@StringRes
public int getLabel() {
return R.string.cancel_download_label;
}
@Override
@DrawableRes
public int getDrawable() {
return R.drawable.ic_cancel;
}
@Override
public void onClick(Context context) {
FeedMedia media = item.getMedia();
DownloadRequester.getInstance().cancelDownload(context, media);
if (UserPreferences.isEnableAutodownload()) {
DBWriter.setFeedItemAutoDownload(media.getItem(), false);
Toast.makeText(context, R.string.download_canceled_autodownload_enabled_msg, Toast.LENGTH_LONG).show();
}
}
}
|