Removed last references to FeedManager

This commit is contained in:
daniel oeh 2013-08-04 21:42:28 +02:00
parent 24c50f7840
commit edd84c6a4c
7 changed files with 427 additions and 413 deletions

View File

@ -1,6 +1,7 @@
package de.danoeh.antennapod.activity;
import java.util.Date;
import java.util.List;
import android.annotation.SuppressLint;
import android.content.Intent;
@ -25,11 +26,11 @@ import de.danoeh.antennapod.R;
import de.danoeh.antennapod.adapter.MiroGuideItemlistAdapter;
import de.danoeh.antennapod.dialog.DownloadRequestErrorDialogCreator;
import de.danoeh.antennapod.feed.Feed;
import de.danoeh.antennapod.feed.FeedManager;
import de.danoeh.antennapod.miroguide.conn.MiroGuideException;
import de.danoeh.antennapod.miroguide.conn.MiroGuideService;
import de.danoeh.antennapod.miroguide.model.MiroGuideChannel;
import de.danoeh.antennapod.preferences.UserPreferences;
import de.danoeh.antennapod.storage.DBReader;
import de.danoeh.antennapod.storage.DownloadRequestException;
import de.danoeh.antennapod.storage.DownloadRequester;
@ -52,6 +53,7 @@ public class MiroGuideChannelViewActivity extends SherlockActivity {
private long channelId;
private String channelUrl;
private MiroGuideChannel channel;
private volatile List<Feed> feeds;
@Override
protected void onPause() {
@ -84,7 +86,9 @@ public class MiroGuideChannelViewActivity extends SherlockActivity {
}
/** Is used to load channel information asynchronously. */
/**
* Is used to load channel information asynchronously.
*/
private AsyncTask<Void, Void, Void> channelLoader = new AsyncTask<Void, Void, Void>() {
private static final String TAG = "ChannelLoader";
private Exception exception;
@ -93,6 +97,7 @@ public class MiroGuideChannelViewActivity extends SherlockActivity {
protected Void doInBackground(Void... params) {
if (AppConfig.DEBUG)
Log.d(TAG, "Starting background task");
feeds = DBReader.getFeedList(MiroGuideChannelViewActivity.this);
MiroGuideService service = new MiroGuideService();
try {
channel = service.getChannel(channelId);
@ -140,7 +145,7 @@ public class MiroGuideChannelViewActivity extends SherlockActivity {
&& DownloadRequester.getInstance().isDownloadingFile(
channel.getDownloadUrl());
boolean notAdded = channelLoaded
&& !((FeedManager.getInstance().feedExists(
&& !((feedExists(
channel.getDownloadUrl()) || beingDownloaded));
menu.findItem(R.id.add_feed).setVisible(notAdded);
menu.findItem(R.id.visit_website_item).setVisible(
@ -180,4 +185,17 @@ public class MiroGuideChannelViewActivity extends SherlockActivity {
}
}
private boolean feedExists(String downloadUrl) {
if (feeds == null) {
return false;
}
for (Feed feed : feeds) {
if (feed.getDownload_url().equals(downloadUrl)) {
return true;
}
}
return false;
}
}

View File

@ -26,11 +26,12 @@ import de.danoeh.antennapod.AppConfig;
import de.danoeh.antennapod.R;
import de.danoeh.antennapod.asynctask.FlattrClickWorker;
import de.danoeh.antennapod.asynctask.OpmlExportWorker;
import de.danoeh.antennapod.feed.FeedManager;
import de.danoeh.antennapod.preferences.UserPreferences;
import de.danoeh.antennapod.util.flattr.FlattrUtils;
/** The main preference activity */
/**
* The main preference activity
*/
public class PreferenceActivity extends SherlockPreferenceActivity {
private static final String TAG = "PreferenceActivity";
@ -93,10 +94,9 @@ public class PreferenceActivity extends SherlockPreferenceActivity {
@Override
public boolean onPreferenceClick(Preference preference) {
if (FeedManager.getInstance().getFeedsSize() > 0) {
new OpmlExportWorker(PreferenceActivity.this)
.executeAsync();
}
return true;
}
});

View File

@ -14,7 +14,6 @@ import android.os.AsyncTask;
import android.util.Log;
import de.danoeh.antennapod.PodcastApp;
import de.danoeh.antennapod.R;
import de.danoeh.antennapod.feed.FeedManager;
import de.danoeh.antennapod.opml.OpmlWriter;
import de.danoeh.antennapod.preferences.UserPreferences;
import de.danoeh.antennapod.storage.DBReader;

View File

@ -224,8 +224,8 @@ public class FeedMedia extends FeedFile implements Playable {
public void loadChapterMarks() {
if (getChapters() == null && !localFileAvailable()) {
ChapterUtils.loadChaptersFromStreamUrl(this);
if (getChapters() != null) {
FeedManager.getInstance().setFeedItem(PodcastApp.getInstance(),
if (getChapters() != null && item != null) {
DBWriter.setFeedItem(PodcastApp.getInstance(),
item);
}
}

View File

@ -26,7 +26,6 @@ import de.danoeh.antennapod.adapter.ExternalEpisodesListAdapter;
import de.danoeh.antennapod.dialog.DownloadRequestErrorDialogCreator;
import de.danoeh.antennapod.feed.EventDistributor;
import de.danoeh.antennapod.feed.FeedItem;
import de.danoeh.antennapod.feed.FeedManager;
import de.danoeh.antennapod.storage.DBReader;
import de.danoeh.antennapod.storage.DBTasks;
import de.danoeh.antennapod.storage.DBWriter;

View File

@ -7,7 +7,6 @@ import android.net.ConnectivityManager;
import android.net.NetworkInfo;
import android.util.Log;
import de.danoeh.antennapod.AppConfig;
import de.danoeh.antennapod.feed.FeedManager;
import de.danoeh.antennapod.storage.DBTasks;
import de.danoeh.antennapod.storage.DownloadRequester;
import de.danoeh.antennapod.util.NetworkUtils;

View File

@ -7,7 +7,6 @@ import android.net.ConnectivityManager;
import android.net.NetworkInfo;
import android.util.Log;
import de.danoeh.antennapod.AppConfig;
import de.danoeh.antennapod.feed.FeedManager;
import de.danoeh.antennapod.preferences.UserPreferences;
import de.danoeh.antennapod.storage.DBTasks;