FeedPreferences.getCurrentAutoDelete() now calls UserPreferences.isAutoDelete() by itself, instead of receiving it as a parameter.
This commit is contained in:
parent
153ac4e12c
commit
a22fa8660b
|
@ -97,7 +97,7 @@ public class NewEpisodesFragment extends AllEpisodesFragment {
|
|||
long itemId = token.getFeedItemId();
|
||||
FeedItem item = DBReader.getFeedItem(context, itemId);
|
||||
FeedMedia media = item.getMedia();
|
||||
if(media != null && media.hasAlmostEnded() && item.getFeed().getPreferences().getCurrentAutoDelete(UserPreferences.isAutoDelete())) {
|
||||
if(media != null && media.hasAlmostEnded() && item.getFeed().getPreferences().getCurrentAutoDelete()) {
|
||||
DBWriter.deleteFeedMediaOfItem(context, media.getId());
|
||||
}
|
||||
}
|
||||
|
|
|
@ -431,7 +431,7 @@ public class QueueFragment extends Fragment {
|
|||
long itemId = token.getFeedItemId();
|
||||
FeedItem item = DBReader.getFeedItem(context, itemId);
|
||||
FeedMedia media = item.getMedia();
|
||||
if(media != null && media.hasAlmostEnded() && item.getFeed().getPreferences().getCurrentAutoDelete(UserPreferences.isAutoDelete())) {
|
||||
if(media != null && media.hasAlmostEnded() && item.getFeed().getPreferences().getCurrentAutoDelete()) {
|
||||
DBWriter.deleteFeedMediaOfItem(context, media.getId());
|
||||
}
|
||||
}
|
||||
|
|
|
@ -62,7 +62,7 @@ public class PlayerWidgetService extends Service {
|
|||
DBWriter.markItemRead(this, item, true, false);
|
||||
DBWriter.removeQueueItem(this, item, false);
|
||||
DBWriter.addItemToPlaybackHistory(this, media);
|
||||
if (item.getFeed().getPreferences().getCurrentAutoDelete(UserPreferences.isAutoDelete())) {
|
||||
if (item.getFeed().getPreferences().getCurrentAutoDelete()) {
|
||||
Log.d(TAG, "Delete " + media.toString());
|
||||
DBWriter.deleteFeedMediaOfItem(this, media.getId());
|
||||
}
|
||||
|
|
|
@ -3,6 +3,7 @@ package de.danoeh.antennapod.core.feed;
|
|||
import android.content.Context;
|
||||
import de.danoeh.antennapod.core.storage.DBWriter;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import de.danoeh.antennapod.core.preferences.UserPreferences;
|
||||
|
||||
/**
|
||||
* Contains preferences for a single feed.
|
||||
|
@ -82,10 +83,10 @@ public class FeedPreferences {
|
|||
this.auto_delete_action = auto_delete_action;
|
||||
}
|
||||
|
||||
public boolean getCurrentAutoDelete(boolean isAutoDelete) {
|
||||
public boolean getCurrentAutoDelete() {
|
||||
switch (auto_delete_action) {
|
||||
case GLOBAL:
|
||||
return isAutoDelete;
|
||||
return UserPreferences.isAutoDelete();
|
||||
|
||||
case YES:
|
||||
return true;
|
||||
|
|
|
@ -584,7 +584,7 @@ public class PlaybackService extends Service {
|
|||
}
|
||||
|
||||
// Delete episode if enabled
|
||||
if(item.getFeed().getPreferences().getCurrentAutoDelete(UserPreferences.isAutoDelete())) {
|
||||
if(item.getFeed().getPreferences().getCurrentAutoDelete()) {
|
||||
DBWriter.deleteFeedMediaOfItem(PlaybackService.this, media.getId());
|
||||
Log.d(TAG, "Episode Deleted");
|
||||
}
|
||||
|
|
|
@ -196,7 +196,7 @@ public class PlaybackServiceMediaPlayer {
|
|||
DBWriter.markItemRead(context, item, true, false);
|
||||
DBWriter.removeQueueItem(context, item, false);
|
||||
DBWriter.addItemToPlaybackHistory(context, oldMedia);
|
||||
if (item.getFeed().getPreferences().getCurrentAutoDelete(UserPreferences.isAutoDelete())) {
|
||||
if (item.getFeed().getPreferences().getCurrentAutoDelete()) {
|
||||
Log.d(TAG, "Delete " + oldMedia.toString());
|
||||
DBWriter.deleteFeedMediaOfItem(context, oldMedia.getId());
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue