New feed last update is never, not now

This commit is contained in:
Martin Fietz 2015-03-11 13:45:12 +01:00
parent bd6c93a78b
commit ae138e2b1c
4 changed files with 29 additions and 23 deletions

View File

@ -138,7 +138,7 @@ public class DefaultOnlineFeedViewActivity extends OnlineFeedViewActivity {
@Override @Override
public void onClick(View v) { public void onClick(View v) {
try { try {
Feed f = new Feed(selectedDownloadUrl, new Date(), feed.getTitle()); Feed f = new Feed(selectedDownloadUrl, new Date(0), feed.getTitle());
f.setPreferences(feed.getPreferences()); f.setPreferences(feed.getPreferences());
DefaultOnlineFeedViewActivity.this.feed = f; DefaultOnlineFeedViewActivity.this.feed = f;

View File

@ -13,9 +13,21 @@ import android.widget.ArrayAdapter;
import android.widget.LinearLayout; import android.widget.LinearLayout;
import android.widget.ProgressBar; import android.widget.ProgressBar;
import android.widget.RelativeLayout; import android.widget.RelativeLayout;
import org.apache.commons.lang3.StringUtils;
import org.xml.sax.SAXException;
import java.io.File;
import java.io.IOException;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
import java.util.Map;
import javax.xml.parsers.ParserConfigurationException;
import de.danoeh.antennapod.BuildConfig; import de.danoeh.antennapod.BuildConfig;
import de.danoeh.antennapod.R; import de.danoeh.antennapod.R;
import de.danoeh.antennapod.dialog.AuthenticationDialog;
import de.danoeh.antennapod.core.feed.Feed; import de.danoeh.antennapod.core.feed.Feed;
import de.danoeh.antennapod.core.feed.FeedPreferences; import de.danoeh.antennapod.core.feed.FeedPreferences;
import de.danoeh.antennapod.core.preferences.UserPreferences; import de.danoeh.antennapod.core.preferences.UserPreferences;
@ -31,16 +43,7 @@ import de.danoeh.antennapod.core.util.FileNameGenerator;
import de.danoeh.antennapod.core.util.StorageUtils; import de.danoeh.antennapod.core.util.StorageUtils;
import de.danoeh.antennapod.core.util.URLChecker; import de.danoeh.antennapod.core.util.URLChecker;
import de.danoeh.antennapod.core.util.syndication.FeedDiscoverer; import de.danoeh.antennapod.core.util.syndication.FeedDiscoverer;
import org.apache.commons.lang3.StringUtils; import de.danoeh.antennapod.dialog.AuthenticationDialog;
import org.xml.sax.SAXException;
import javax.xml.parsers.ParserConfigurationException;
import java.io.File;
import java.io.IOException;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
import java.util.Map;
/** /**
* Downloads a feed from a feed URL and parses it. Subclasses can display the * Downloads a feed from a feed URL and parses it. Subclasses can display the
@ -181,7 +184,7 @@ public abstract class OnlineFeedViewActivity extends ActionBarActivity {
if (BuildConfig.DEBUG) if (BuildConfig.DEBUG)
Log.d(TAG, "Starting feed download"); Log.d(TAG, "Starting feed download");
url = URLChecker.prepareURL(url); url = URLChecker.prepareURL(url);
feed = new Feed(url, new Date()); feed = new Feed(url, new Date(0));
if (username != null && password != null) { if (username != null && password != null) {
feed.setPreferences(new FeedPreferences(0, false, username, password)); feed.setPreferences(new FeedPreferences(0, false, username, password));
} }

View File

@ -4,16 +4,17 @@ import android.annotation.SuppressLint;
import android.app.ProgressDialog; import android.app.ProgressDialog;
import android.content.Context; import android.content.Context;
import android.os.AsyncTask; import android.os.AsyncTask;
import de.danoeh.antennapod.core.R;
import java.util.Arrays;
import java.util.Date;
import de.danoeh.antennapod.activity.OpmlImportHolder; import de.danoeh.antennapod.activity.OpmlImportHolder;
import de.danoeh.antennapod.core.R;
import de.danoeh.antennapod.core.feed.Feed; import de.danoeh.antennapod.core.feed.Feed;
import de.danoeh.antennapod.core.opml.OpmlElement; import de.danoeh.antennapod.core.opml.OpmlElement;
import de.danoeh.antennapod.core.storage.DownloadRequestException; import de.danoeh.antennapod.core.storage.DownloadRequestException;
import de.danoeh.antennapod.core.storage.DownloadRequester; import de.danoeh.antennapod.core.storage.DownloadRequester;
import java.util.Arrays;
import java.util.Date;
/** Queues items for download in the background. */ /** Queues items for download in the background. */
public class OpmlFeedQueuer extends AsyncTask<Void, Void, Void> { public class OpmlFeedQueuer extends AsyncTask<Void, Void, Void> {
private Context context; private Context context;
@ -46,7 +47,7 @@ public class OpmlFeedQueuer extends AsyncTask<Void, Void, Void> {
for (int idx = 0; idx < selection.length; idx++) { for (int idx = 0; idx < selection.length; idx++) {
OpmlElement element = OpmlImportHolder.getReadElements().get( OpmlElement element = OpmlImportHolder.getReadElements().get(
selection[idx]); selection[idx]);
Feed feed = new Feed(element.getXmlUrl(), new Date(), Feed feed = new Feed(element.getXmlUrl(), new Date(0),
element.getText()); element.getText());
try { try {
requester.downloadFeed(context.getApplicationContext(), feed); requester.downloadFeed(context.getApplicationContext(), feed);

View File

@ -5,15 +5,17 @@ import android.content.Context;
import android.content.Intent; import android.content.Intent;
import android.util.Log; import android.util.Log;
import android.widget.Toast; import android.widget.Toast;
import org.apache.commons.lang3.StringUtils;
import java.util.Arrays;
import java.util.Date;
import de.danoeh.antennapod.BuildConfig; import de.danoeh.antennapod.BuildConfig;
import de.danoeh.antennapod.R; import de.danoeh.antennapod.R;
import de.danoeh.antennapod.core.feed.Feed; import de.danoeh.antennapod.core.feed.Feed;
import de.danoeh.antennapod.core.storage.DownloadRequestException; import de.danoeh.antennapod.core.storage.DownloadRequestException;
import de.danoeh.antennapod.core.storage.DownloadRequester; import de.danoeh.antennapod.core.storage.DownloadRequester;
import org.apache.commons.lang3.StringUtils;
import java.util.Arrays;
import java.util.Date;
/** /**
* Receives intents from AntennaPod Single Purpose apps * Receives intents from AntennaPod Single Purpose apps
@ -34,7 +36,7 @@ public class SPAReceiver extends BroadcastReceiver{
if (feedUrls != null) { if (feedUrls != null) {
if (BuildConfig.DEBUG) Log.d(TAG, "Received feeds list: " + Arrays.toString(feedUrls)); if (BuildConfig.DEBUG) Log.d(TAG, "Received feeds list: " + Arrays.toString(feedUrls));
for (String url : feedUrls) { for (String url : feedUrls) {
Feed f = new Feed(url, new Date()); Feed f = new Feed(url, new Date(0));
try { try {
DownloadRequester.getInstance().downloadFeed(context, f); DownloadRequester.getInstance().downloadFeed(context, f);
} catch (DownloadRequestException e) { } catch (DownloadRequestException e) {