mirror of
https://github.com/AntennaPod/AntennaPod.git
synced 2025-01-20 21:01:17 +01:00
Using MessageEvent to deliver error message
This commit is contained in:
parent
5051a0f3d9
commit
aae06389f9
@ -7,7 +7,8 @@ import android.content.SharedPreferences;
|
||||
import android.preference.PreferenceManager;
|
||||
import android.util.Log;
|
||||
|
||||
import android.widget.Toast;
|
||||
import de.danoeh.antennapod.core.R;
|
||||
import de.danoeh.antennapod.core.event.MessageEvent;
|
||||
import org.shredzone.flattr4j.model.Flattr;
|
||||
|
||||
import java.io.File;
|
||||
@ -88,12 +89,10 @@ public class DBWriter {
|
||||
if (media.isDownloaded()) {
|
||||
// delete downloaded media file
|
||||
File mediaFile = new File(media.getFile_url());
|
||||
if (mediaFile.exists()) {
|
||||
if (!mediaFile.delete()) {
|
||||
Toast.makeText(context, "Unable to delete file. Rebooting the device could help.",
|
||||
Toast.LENGTH_LONG).show();
|
||||
return;
|
||||
}
|
||||
if (mediaFile.exists() && !mediaFile.delete()) {
|
||||
MessageEvent evt = new MessageEvent(context.getString(R.string.delete_failed));
|
||||
EventBus.getDefault().post(evt);
|
||||
return;
|
||||
}
|
||||
media.setDownloaded(false);
|
||||
media.setFile_url(null);
|
||||
|
@ -155,6 +155,7 @@
|
||||
<string name="stream_label">Stream</string>
|
||||
<string name="remove_label">Remove</string>
|
||||
<string name="delete_label">Delete</string>
|
||||
<string name="delete_failed">Unable to delete file. Rebooting the device could help.</string>
|
||||
<string name="remove_episode_lable">Remove Episode</string>
|
||||
<string name="marked_as_seen_label">Marked as seen</string>
|
||||
<string name="mark_read_label">Mark as played</string>
|
||||
|
Loading…
Reference in New Issue
Block a user