Download list entries should now be more informative

This commit is contained in:
daniel oeh 2012-08-15 17:01:55 +02:00
parent 22bcb2463c
commit 336beae409
6 changed files with 25 additions and 7 deletions

View File

@ -175,6 +175,7 @@
<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="feed_delete_confirmation_msg">Please confirm that you want to delete this feed and ALL episodes of this feed that you have downloaded.</string>
<string name="image_of_prefix">Image of:\u0020</string>
</resources>

View File

@ -155,7 +155,7 @@ public class MiroGuideChannelViewActivity extends SherlockActivity {
return true;
case R.id.add_feed:
DownloadRequester.getInstance().downloadFeed(this,
new Feed(channel.getDownloadUrl(), new Date()));
new Feed(channel.getDownloadUrl(), new Date(), channel.getName()));
Toast toast = Toast.makeText(this, R.string.miro_feed_added,
Toast.LENGTH_LONG);
toast.show();

View File

@ -28,8 +28,6 @@ public class DownloadlistAdapter extends ArrayAdapter<DownloadStatus> {
this.selectedItemIndex = SELECTION_NONE;
}
@Override
public View getView(int position, View convertView, ViewGroup parent) {
Holder holder;
@ -69,7 +67,14 @@ public class DownloadlistAdapter extends ArrayAdapter<DownloadStatus> {
} else if (feedFile.getClass() == Feed.class) {
titleText = ((Feed) feedFile).getTitle();
} else if (feedFile.getClass() == FeedImage.class) {
titleText = "[Image] " + ((FeedImage) feedFile).getTitle();
FeedImage image = (FeedImage) feedFile;
if (image.getFeed() != null) {
titleText = convertView.getResources().getString(
R.string.image_of_prefix)
+ image.getFeed().getTitle();
} else {
titleText = "[Image] " + ((FeedImage) feedFile).getTitle();
}
}
holder.title.setText(titleText);
holder.message.setText(status.getStatusMsg());

View File

@ -51,8 +51,7 @@ public class OpmlFeedQueuer extends AsyncTask<Void, Void, Void> {
DownloadRequester requester = DownloadRequester.getInstance();
for (int idx = 0; idx < selection.length; idx++) {
OpmlElement element = OpmlImportActivity.getReadElements().get(selection[idx]);
Feed feed = new Feed(element.getXmlUrl(), new Date());
feed.setTitle(element.getText());
Feed feed = new Feed(element.getXmlUrl(), new Date(), element.getText());
requester.downloadFeed(context.getApplicationContext(), feed);
}
return null;

View File

@ -40,11 +40,24 @@ public class Feed extends FeedFile {
this.lastUpdate = lastUpdate;
}
/**
* This constructor is used for requesting a feed download. It should NOT be
* used if the title of the feed is already known.
* */
public Feed(String url, Date lastUpdate) {
this(lastUpdate);
this.download_url = url;
}
/**
* This constructor is used for requesting a feed download. It should be
* used if the title of the feed is already known.
* */
public Feed(String url, Date lastUpdate, String title) {
this(url, lastUpdate);
this.title = title;
}
/**
* Returns the number of FeedItems where 'read' is false. If the 'display
* only episodes' - preference is set to true, this method will only count

View File

@ -329,7 +329,7 @@ public class FeedManager {
public void refreshFeed(Context context, Feed feed) {
requester.downloadFeed(context, new Feed(feed.getDownload_url(),
new Date()));
new Date(), feed.getTitle()));
}
public void addDownloadStatus(final Context context,