Removed last references to FeedManager
This commit is contained in:
parent
24c50f7840
commit
edd84c6a4c
|
@ -1,6 +1,7 @@
|
||||||
package de.danoeh.antennapod.activity;
|
package de.danoeh.antennapod.activity;
|
||||||
|
|
||||||
import java.util.Date;
|
import java.util.Date;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
import android.annotation.SuppressLint;
|
import android.annotation.SuppressLint;
|
||||||
import android.content.Intent;
|
import android.content.Intent;
|
||||||
|
@ -25,11 +26,11 @@ import de.danoeh.antennapod.R;
|
||||||
import de.danoeh.antennapod.adapter.MiroGuideItemlistAdapter;
|
import de.danoeh.antennapod.adapter.MiroGuideItemlistAdapter;
|
||||||
import de.danoeh.antennapod.dialog.DownloadRequestErrorDialogCreator;
|
import de.danoeh.antennapod.dialog.DownloadRequestErrorDialogCreator;
|
||||||
import de.danoeh.antennapod.feed.Feed;
|
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.MiroGuideException;
|
||||||
import de.danoeh.antennapod.miroguide.conn.MiroGuideService;
|
import de.danoeh.antennapod.miroguide.conn.MiroGuideService;
|
||||||
import de.danoeh.antennapod.miroguide.model.MiroGuideChannel;
|
import de.danoeh.antennapod.miroguide.model.MiroGuideChannel;
|
||||||
import de.danoeh.antennapod.preferences.UserPreferences;
|
import de.danoeh.antennapod.preferences.UserPreferences;
|
||||||
|
import de.danoeh.antennapod.storage.DBReader;
|
||||||
import de.danoeh.antennapod.storage.DownloadRequestException;
|
import de.danoeh.antennapod.storage.DownloadRequestException;
|
||||||
import de.danoeh.antennapod.storage.DownloadRequester;
|
import de.danoeh.antennapod.storage.DownloadRequester;
|
||||||
|
|
||||||
|
@ -52,6 +53,7 @@ public class MiroGuideChannelViewActivity extends SherlockActivity {
|
||||||
private long channelId;
|
private long channelId;
|
||||||
private String channelUrl;
|
private String channelUrl;
|
||||||
private MiroGuideChannel channel;
|
private MiroGuideChannel channel;
|
||||||
|
private volatile List<Feed> feeds;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void onPause() {
|
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 AsyncTask<Void, Void, Void> channelLoader = new AsyncTask<Void, Void, Void>() {
|
||||||
private static final String TAG = "ChannelLoader";
|
private static final String TAG = "ChannelLoader";
|
||||||
private Exception exception;
|
private Exception exception;
|
||||||
|
@ -93,6 +97,7 @@ public class MiroGuideChannelViewActivity extends SherlockActivity {
|
||||||
protected Void doInBackground(Void... params) {
|
protected Void doInBackground(Void... params) {
|
||||||
if (AppConfig.DEBUG)
|
if (AppConfig.DEBUG)
|
||||||
Log.d(TAG, "Starting background task");
|
Log.d(TAG, "Starting background task");
|
||||||
|
feeds = DBReader.getFeedList(MiroGuideChannelViewActivity.this);
|
||||||
MiroGuideService service = new MiroGuideService();
|
MiroGuideService service = new MiroGuideService();
|
||||||
try {
|
try {
|
||||||
channel = service.getChannel(channelId);
|
channel = service.getChannel(channelId);
|
||||||
|
@ -140,7 +145,7 @@ public class MiroGuideChannelViewActivity extends SherlockActivity {
|
||||||
&& DownloadRequester.getInstance().isDownloadingFile(
|
&& DownloadRequester.getInstance().isDownloadingFile(
|
||||||
channel.getDownloadUrl());
|
channel.getDownloadUrl());
|
||||||
boolean notAdded = channelLoaded
|
boolean notAdded = channelLoaded
|
||||||
&& !((FeedManager.getInstance().feedExists(
|
&& !((feedExists(
|
||||||
channel.getDownloadUrl()) || beingDownloaded));
|
channel.getDownloadUrl()) || beingDownloaded));
|
||||||
menu.findItem(R.id.add_feed).setVisible(notAdded);
|
menu.findItem(R.id.add_feed).setVisible(notAdded);
|
||||||
menu.findItem(R.id.visit_website_item).setVisible(
|
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;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -26,11 +26,12 @@ import de.danoeh.antennapod.AppConfig;
|
||||||
import de.danoeh.antennapod.R;
|
import de.danoeh.antennapod.R;
|
||||||
import de.danoeh.antennapod.asynctask.FlattrClickWorker;
|
import de.danoeh.antennapod.asynctask.FlattrClickWorker;
|
||||||
import de.danoeh.antennapod.asynctask.OpmlExportWorker;
|
import de.danoeh.antennapod.asynctask.OpmlExportWorker;
|
||||||
import de.danoeh.antennapod.feed.FeedManager;
|
|
||||||
import de.danoeh.antennapod.preferences.UserPreferences;
|
import de.danoeh.antennapod.preferences.UserPreferences;
|
||||||
import de.danoeh.antennapod.util.flattr.FlattrUtils;
|
import de.danoeh.antennapod.util.flattr.FlattrUtils;
|
||||||
|
|
||||||
/** The main preference activity */
|
/**
|
||||||
|
* The main preference activity
|
||||||
|
*/
|
||||||
public class PreferenceActivity extends SherlockPreferenceActivity {
|
public class PreferenceActivity extends SherlockPreferenceActivity {
|
||||||
private static final String TAG = "PreferenceActivity";
|
private static final String TAG = "PreferenceActivity";
|
||||||
|
|
||||||
|
@ -93,10 +94,9 @@ public class PreferenceActivity extends SherlockPreferenceActivity {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean onPreferenceClick(Preference preference) {
|
public boolean onPreferenceClick(Preference preference) {
|
||||||
if (FeedManager.getInstance().getFeedsSize() > 0) {
|
|
||||||
new OpmlExportWorker(PreferenceActivity.this)
|
new OpmlExportWorker(PreferenceActivity.this)
|
||||||
.executeAsync();
|
.executeAsync();
|
||||||
}
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
|
@ -14,7 +14,6 @@ import android.os.AsyncTask;
|
||||||
import android.util.Log;
|
import android.util.Log;
|
||||||
import de.danoeh.antennapod.PodcastApp;
|
import de.danoeh.antennapod.PodcastApp;
|
||||||
import de.danoeh.antennapod.R;
|
import de.danoeh.antennapod.R;
|
||||||
import de.danoeh.antennapod.feed.FeedManager;
|
|
||||||
import de.danoeh.antennapod.opml.OpmlWriter;
|
import de.danoeh.antennapod.opml.OpmlWriter;
|
||||||
import de.danoeh.antennapod.preferences.UserPreferences;
|
import de.danoeh.antennapod.preferences.UserPreferences;
|
||||||
import de.danoeh.antennapod.storage.DBReader;
|
import de.danoeh.antennapod.storage.DBReader;
|
||||||
|
|
|
@ -224,8 +224,8 @@ public class FeedMedia extends FeedFile implements Playable {
|
||||||
public void loadChapterMarks() {
|
public void loadChapterMarks() {
|
||||||
if (getChapters() == null && !localFileAvailable()) {
|
if (getChapters() == null && !localFileAvailable()) {
|
||||||
ChapterUtils.loadChaptersFromStreamUrl(this);
|
ChapterUtils.loadChaptersFromStreamUrl(this);
|
||||||
if (getChapters() != null) {
|
if (getChapters() != null && item != null) {
|
||||||
FeedManager.getInstance().setFeedItem(PodcastApp.getInstance(),
|
DBWriter.setFeedItem(PodcastApp.getInstance(),
|
||||||
item);
|
item);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -26,7 +26,6 @@ import de.danoeh.antennapod.adapter.ExternalEpisodesListAdapter;
|
||||||
import de.danoeh.antennapod.dialog.DownloadRequestErrorDialogCreator;
|
import de.danoeh.antennapod.dialog.DownloadRequestErrorDialogCreator;
|
||||||
import de.danoeh.antennapod.feed.EventDistributor;
|
import de.danoeh.antennapod.feed.EventDistributor;
|
||||||
import de.danoeh.antennapod.feed.FeedItem;
|
import de.danoeh.antennapod.feed.FeedItem;
|
||||||
import de.danoeh.antennapod.feed.FeedManager;
|
|
||||||
import de.danoeh.antennapod.storage.DBReader;
|
import de.danoeh.antennapod.storage.DBReader;
|
||||||
import de.danoeh.antennapod.storage.DBTasks;
|
import de.danoeh.antennapod.storage.DBTasks;
|
||||||
import de.danoeh.antennapod.storage.DBWriter;
|
import de.danoeh.antennapod.storage.DBWriter;
|
||||||
|
|
|
@ -7,7 +7,6 @@ import android.net.ConnectivityManager;
|
||||||
import android.net.NetworkInfo;
|
import android.net.NetworkInfo;
|
||||||
import android.util.Log;
|
import android.util.Log;
|
||||||
import de.danoeh.antennapod.AppConfig;
|
import de.danoeh.antennapod.AppConfig;
|
||||||
import de.danoeh.antennapod.feed.FeedManager;
|
|
||||||
import de.danoeh.antennapod.storage.DBTasks;
|
import de.danoeh.antennapod.storage.DBTasks;
|
||||||
import de.danoeh.antennapod.storage.DownloadRequester;
|
import de.danoeh.antennapod.storage.DownloadRequester;
|
||||||
import de.danoeh.antennapod.util.NetworkUtils;
|
import de.danoeh.antennapod.util.NetworkUtils;
|
||||||
|
|
|
@ -7,7 +7,6 @@ import android.net.ConnectivityManager;
|
||||||
import android.net.NetworkInfo;
|
import android.net.NetworkInfo;
|
||||||
import android.util.Log;
|
import android.util.Log;
|
||||||
import de.danoeh.antennapod.AppConfig;
|
import de.danoeh.antennapod.AppConfig;
|
||||||
import de.danoeh.antennapod.feed.FeedManager;
|
|
||||||
import de.danoeh.antennapod.preferences.UserPreferences;
|
import de.danoeh.antennapod.preferences.UserPreferences;
|
||||||
import de.danoeh.antennapod.storage.DBTasks;
|
import de.danoeh.antennapod.storage.DBTasks;
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue