Removed auto-delete preference

This commit is contained in:
daniel oeh 2013-03-09 11:00:44 +01:00
parent 3fde2349f9
commit 73d23773c5
4 changed files with 1 additions and 70 deletions

View File

@ -171,8 +171,6 @@
<string name="pref_display_only_episodes_title">Display only episodes</string>
<string name="pref_display_only_episodes_sum">Display only items which also have an episode.</string>
<string name="user_interface_label">User Interface</string>
<string name="pref_auto_delete_title">Auto-delete</string>
<string name="pref_auto_delete_sum">Delete an episode when playback completes or when it is removed from the queue.</string>
<string name="pref_set_theme_title">Select theme</string>
<string name="pref_set_theme_sum">Change the appearance of AntennaPod.</string>
<string name="pref_automatic_download_title">Automatic download</string>

View File

@ -17,7 +17,6 @@
android:key="prefFollowQueue"
android:summary="@string/pref_followQueue_sum"
android:title="@string/pref_followQueue_title" />
<CheckBoxPreference android:key="prefAutoDelete" android:summary="@string/pref_auto_delete_sum" android:title="@string/pref_auto_delete_title"/>
</PreferenceCategory>
<PreferenceCategory android:title="@string/network_pref" >

View File

@ -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.

View File

@ -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;
}
}