From 73d23773c5c9517688ba0004914b6d1582ec9f0c Mon Sep 17 00:00:00 2001 From: daniel oeh Date: Sat, 9 Mar 2013 11:00:44 +0100 Subject: [PATCH] Removed auto-delete preference --- res/values/strings.xml | 4 +- res/xml/preferences.xml | 1 - .../danoeh/antennapod/feed/FeedManager.java | 39 ------------------- .../preferences/PlaybackPreferences.java | 27 ------------- 4 files changed, 1 insertion(+), 70 deletions(-) diff --git a/res/values/strings.xml b/res/values/strings.xml index 5c49a5772..ebd2dfcd8 100644 --- a/res/values/strings.xml +++ b/res/values/strings.xml @@ -171,15 +171,13 @@ Display only episodes Display only items which also have an episode. User Interface - Auto-delete - Delete an episode when playback completes or when it is removed from the queue. Select theme Change the appearance of AntennaPod. Automatic download Configure the automatic download of episodes. Enable Wi-Fi filter Allow automatic download only for selected Wi-Fi networks. - + Search for Feeds or Episodes Found in shownotes diff --git a/res/xml/preferences.xml b/res/xml/preferences.xml index c409c122e..ebc020fe5 100644 --- a/res/xml/preferences.xml +++ b/res/xml/preferences.xml @@ -17,7 +17,6 @@ android:key="prefFollowQueue" android:summary="@string/pref_followQueue_sum" android:title="@string/pref_followQueue_title" /> - diff --git a/src/de/danoeh/antennapod/feed/FeedManager.java b/src/de/danoeh/antennapod/feed/FeedManager.java index 19b4a0375..ed72f0d47 100644 --- a/src/de/danoeh/antennapod/feed/FeedManager.java +++ b/src/de/danoeh/antennapod/feed/FeedManager.java @@ -726,7 +726,6 @@ public class FeedManager { public void removeQueueItem(final Context context, FeedItem item) { boolean removed = queue.remove(item); if (removed) { - autoDeleteIfPossible(context, item.getMedia()); dbExec.execute(new Runnable() { @Override @@ -742,44 +741,6 @@ public class FeedManager { eventDist.sendQueueUpdateBroadcast(); } - /** - * Delete the episode of this FeedMedia object if auto-delete is enabled and - * it is not the last played media or it is the last played media and - * playback has been completed. - */ - public void autoDeleteIfPossible(Context context, FeedMedia media) { - if (media != null) { - SharedPreferences prefs = PreferenceManager - .getDefaultSharedPreferences(context - .getApplicationContext()); - if (UserPreferences.isAutoDelete()) { - - if (!media.isPlaying() - && ((media.getId() != PlaybackPreferences - .getAutoDeleteMediaId()) || (media.getId() == PlaybackPreferences - .getAutoDeleteMediaId() && PlaybackPreferences - .isAutoDeleteMediaPlaybackCompleted()))) { - if (AppConfig.DEBUG) - Log.d(TAG, "Performing auto-cleanup"); - deleteFeedMedia(context, media); - - SharedPreferences.Editor editor = prefs.edit(); - editor.putLong( - PlaybackPreferences.PREF_AUTODELETE_MEDIA_ID, -1); - editor.commit(); - } else { - if (AppConfig.DEBUG) - Log.d(TAG, "Didn't do auto-cleanup"); - } - } else { - if (AppConfig.DEBUG) - Log.d(TAG, "Auto-delete preference is disabled"); - } - } else { - Log.e(TAG, "Could not do auto-cleanup: media was null"); - } - } - /** * Moves the queue item at the specified index to another position. If the * indices are out of range, no operation will be performed. diff --git a/src/de/danoeh/antennapod/preferences/PlaybackPreferences.java b/src/de/danoeh/antennapod/preferences/PlaybackPreferences.java index 22462121a..c6a431541 100644 --- a/src/de/danoeh/antennapod/preferences/PlaybackPreferences.java +++ b/src/de/danoeh/antennapod/preferences/PlaybackPreferences.java @@ -42,15 +42,6 @@ public class PlaybackPreferences implements /** True if last played media was a video. */ public static final String PREF_CURRENT_EPISODE_IS_VIDEO = "de.danoeh.antennapod.preferences.lastIsVideo"; - /** True if playback of last played media has been completed. */ - public static final String PREF_AUTO_DELETE_MEDIA_PLAYBACK_COMPLETED = "de.danoeh.antennapod.preferences.lastPlaybackCompleted"; - - /** - * ID of the last played media which should be auto-deleted as soon as - * PREF_LAST_PLAYED_ID changes. - */ - public static final String PREF_AUTODELETE_MEDIA_ID = "de.danoeh.antennapod.preferences.autoDeleteMediaId"; - /** Value of PREF_CURRENTLY_PLAYING_MEDIA if no media is playing. */ public static final long NO_MEDIA_PLAYING = -1; @@ -59,8 +50,6 @@ public class PlaybackPreferences implements private long currentlyPlayingMedia; private boolean currentEpisodeIsStream; private boolean currentEpisodeIsVideo; - private boolean autoDeleteMediaPlaybackCompleted; - private long autoDeleteMediaId; private static PlaybackPreferences instance; private Context context; @@ -97,9 +86,6 @@ public class PlaybackPreferences implements NO_MEDIA_PLAYING); currentEpisodeIsStream = sp.getBoolean(PREF_CURRENT_EPISODE_IS_STREAM, true); currentEpisodeIsVideo = sp.getBoolean(PREF_CURRENT_EPISODE_IS_VIDEO, false); - autoDeleteMediaPlaybackCompleted = sp.getBoolean( - PREF_AUTO_DELETE_MEDIA_PLAYBACK_COMPLETED, false); - autoDeleteMediaId = sp.getLong(PREF_AUTODELETE_MEDIA_ID, -1); } @Override @@ -118,11 +104,6 @@ public class PlaybackPreferences implements } else if (key.equals(PREF_CURRENT_EPISODE_IS_VIDEO)) { currentEpisodeIsVideo = sp.getBoolean(PREF_CURRENT_EPISODE_IS_VIDEO, false); - } else if (key.equals(PREF_AUTO_DELETE_MEDIA_PLAYBACK_COMPLETED)) { - autoDeleteMediaPlaybackCompleted = sp.getBoolean( - PREF_AUTO_DELETE_MEDIA_PLAYBACK_COMPLETED, false); - } else if (key.equals(PREF_AUTODELETE_MEDIA_ID)) { - autoDeleteMediaId = sp.getLong(PREF_AUTODELETE_MEDIA_ID, -1); } else if (key.equals(PREF_CURRENTLY_PLAYING_FEEDMEDIA_ID)) { currentlyPlayingFeedMediaId = sp.getLong( PREF_CURRENTLY_PLAYING_FEEDMEDIA_ID, NO_MEDIA_PLAYING); @@ -136,9 +117,6 @@ public class PlaybackPreferences implements } } - public static long getAutoDeleteMediaId() { - return instance.autoDeleteMediaId; - } public static long getLastPlayedFeedId() { instanceAvailable(); @@ -164,9 +142,4 @@ public class PlaybackPreferences implements return instance.currentEpisodeIsVideo; } - public static boolean isAutoDeleteMediaPlaybackCompleted() { - instanceAvailable(); - return instance.autoDeleteMediaPlaybackCompleted; - } - }