blob: 7831c64508901044887d3b43ae359aae1eaf4f05 (
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
43
|
package de.danoeh.antennapod.adapter.actionbutton;
import android.content.Context;
import android.view.View;
import androidx.annotation.AttrRes;
import androidx.annotation.StringRes;
import de.danoeh.antennapod.R;
import de.danoeh.antennapod.core.feed.FeedItem;
import de.danoeh.antennapod.core.feed.FeedMedia;
import de.danoeh.antennapod.core.storage.DBWriter;
public class DeleteActionButton extends ItemActionButton {
public DeleteActionButton(FeedItem item) {
super(item);
}
@Override
@StringRes
public int getLabel() {
return R.string.delete_label;
}
@Override
@AttrRes
public int getDrawable() {
return R.attr.content_discard;
}
@Override
public void onClick(Context context) {
final FeedMedia media = item.getMedia();
if (media == null) {
return;
}
DBWriter.deleteFeedMediaOfItem(context, media.getId());
}
@Override
public int getVisibility() {
return (item.isPlayed()) ? View.INVISIBLE : View.VISIBLE;
}
}
|