diff --git a/project.properties b/project.properties index 698a59143..25d1eaed3 100644 --- a/project.properties +++ b/project.properties @@ -11,3 +11,4 @@ target=android-15 android.library.reference.1=../actionbarsherlock/library/ android.library.reference.2=../Android-ViewPagerIndicator/library +android.library.reference.3=../../../Documents/workspace/gridlayout diff --git a/res/layout/feedinfo.xml b/res/layout/feedinfo.xml index bdc585e58..7ff359f2c 100644 --- a/res/layout/feedinfo.xml +++ b/res/layout/feedinfo.xml @@ -1,5 +1,6 @@ @@ -44,12 +45,62 @@ + android:layout_height="wrap_content" + android:orientation="vertical" > + + + + + + + + + + + + + + android:layout_height="wrap_content" + android:layout_margin="8dp" /> diff --git a/res/values/strings.xml b/res/values/strings.xml index c2cafeeb5..ecebfd0c6 100644 --- a/res/values/strings.xml +++ b/res/values/strings.xml @@ -71,5 +71,7 @@ Cover Server died Unknown Error + Author + Language \ No newline at end of file diff --git a/src/de/podfetcher/activity/FeedInfoActivity.java b/src/de/podfetcher/activity/FeedInfoActivity.java index 0cffc37d5..d15c7916c 100644 --- a/src/de/podfetcher/activity/FeedInfoActivity.java +++ b/src/de/podfetcher/activity/FeedInfoActivity.java @@ -22,6 +22,8 @@ public class FeedInfoActivity extends SherlockActivity { private ImageView imgvCover; private TextView txtvTitle; private TextView txtvDescription; + private TextView txtvLanguage; + private TextView txtvAuthor; @Override protected void onCreate(Bundle savedInstanceState) { @@ -32,13 +34,23 @@ public class FeedInfoActivity extends SherlockActivity { FeedManager manager = FeedManager.getInstance(); Feed feed = manager.getFeed(feedId); if (feed != null) { + Log.d(TAG, "Language is " + feed.getLanguage()); + Log.d(TAG, "Author is " + feed.getAuthor()); imgvCover = (ImageView) findViewById(R.id.imgvCover); txtvTitle = (TextView) findViewById(R.id.txtvTitle); txtvDescription = (TextView) findViewById(R.id.txtvDescription); - + txtvLanguage = (TextView) findViewById(R.id.txtvLanguage); + txtvAuthor = (TextView) findViewById(R.id.txtvAuthor); + imgvCover.setImageBitmap(feed.getImage().getImageBitmap()); txtvTitle.setText(feed.getTitle()); txtvDescription.setText(feed.getDescription()); + if (feed.getAuthor() != null) { + txtvAuthor.setText(feed.getAuthor()); + } + if (feed.getLanguage() != null) { + txtvLanguage.setText(feed.getLanguage()); + } } else { Log.e(TAG, "Activity was started with invalid arguments"); } diff --git a/src/de/podfetcher/feed/Feed.java b/src/de/podfetcher/feed/Feed.java index 59eaf7046..ff4fc4c08 100644 --- a/src/de/podfetcher/feed/Feed.java +++ b/src/de/podfetcher/feed/Feed.java @@ -14,6 +14,9 @@ public class Feed extends FeedFile { /** Link to the website. */ private String link; private String description; + private String language; + /** Name of the author */ + private String author; private FeedImage image; private FeedCategory category; private ArrayList items; @@ -107,4 +110,20 @@ public class Feed extends FeedFile { this.paymentLink = paymentLink; } + public String getLanguage() { + return language; + } + + public void setLanguage(String language) { + this.language = language; + } + + public String getAuthor() { + return author; + } + + public void setAuthor(String author) { + this.author = author; + } + } diff --git a/src/de/podfetcher/feed/FeedManager.java b/src/de/podfetcher/feed/FeedManager.java index 9e61bbd6a..e082529ff 100644 --- a/src/de/podfetcher/feed/FeedManager.java +++ b/src/de/podfetcher/feed/FeedManager.java @@ -239,8 +239,11 @@ public class FeedManager { adapter.close(); } - /** Updates an existing feed or adds it as a new one if it doesn't exist. - * @return The saved Feed with a database ID*/ + /** + * Updates an existing feed or adds it as a new one if it doesn't exist. + * + * @return The saved Feed with a database ID + */ public Feed updateFeed(Context context, final Feed newFeed) { // Look up feed in the feedslist final Feed savedFeed = searchFeedByLink(newFeed.getLink()); @@ -493,6 +496,10 @@ public class FeedManager { .getColumnIndex(PodDBAdapter.KEY_DESCRIPTION))); feed.setPaymentLink(feedlistCursor.getString(feedlistCursor .getColumnIndex(PodDBAdapter.KEY_PAYMENT_LINK))); + feed.setAuthor(feedlistCursor.getString(feedlistCursor + .getColumnIndex(PodDBAdapter.KEY_AUTHOR))); + feed.setLanguage(feedlistCursor.getString(feedlistCursor + .getColumnIndex(PodDBAdapter.KEY_LANGUAGE))); feed.setImage(adapter.getFeedImage(feedlistCursor .getLong(feedlistCursor .getColumnIndex(PodDBAdapter.KEY_IMAGE)))); diff --git a/src/de/podfetcher/storage/PodDBAdapter.java b/src/de/podfetcher/storage/PodDBAdapter.java index 6fa7ab19c..7974d1269 100644 --- a/src/de/podfetcher/storage/PodDBAdapter.java +++ b/src/de/podfetcher/storage/PodDBAdapter.java @@ -55,6 +55,8 @@ public class PodDBAdapter { public static final String KEY_CONTENT_ENCODED = "content_encoded"; public static final String KEY_PAYMENT_LINK = "payment_link"; public static final String KEY_START = "start"; + public static final String KEY_LANGUAGE = "language"; + public static final String KEY_AUTHOR = "author"; // Table names public static final String TABLE_NAME_FEEDS = "Feeds"; @@ -75,7 +77,8 @@ public class PodDBAdapter { + KEY_IMAGE + " INTEGER," + KEY_CATEGORY + " INTEGER," + KEY_FILE_URL + " TEXT," + KEY_DOWNLOAD_URL + " TEXT," + KEY_DOWNLOADED + " INTEGER," + KEY_LASTUPDATE + " TEXT," - + KEY_PAYMENT_LINK + " TEXT)"; + + KEY_PAYMENT_LINK + " TEXT," + KEY_LANGUAGE + " TEXT," + + KEY_AUTHOR + " TEXT)"; private static final String CREATE_TABLE_FEED_ITEMS = "CREATE TABLE " + TABLE_NAME_FEED_ITEMS + " (" + TABLE_PRIMARY_KEY + KEY_TITLE @@ -159,6 +162,8 @@ public class PodDBAdapter { values.put(KEY_LINK, feed.getLink()); values.put(KEY_DESCRIPTION, feed.getDescription()); values.put(KEY_PAYMENT_LINK, feed.getPaymentLink()); + values.put(KEY_AUTHOR, feed.getAuthor()); + values.put(KEY_LANGUAGE, feed.getLanguage()); if (feed.getImage() != null) { if (feed.getImage().getId() == 0) { setImage(feed.getImage()); diff --git a/src/de/podfetcher/syndication/namespace/itunes/NSITunes.java b/src/de/podfetcher/syndication/namespace/itunes/NSITunes.java index a10f2cd17..db78c73c3 100644 --- a/src/de/podfetcher/syndication/namespace/itunes/NSITunes.java +++ b/src/de/podfetcher/syndication/namespace/itunes/NSITunes.java @@ -15,6 +15,8 @@ public class NSITunes extends Namespace{ private static final String IMAGE_TITLE = "image"; private static final String IMAGE_HREF = "href"; + private static final String AUTHOR = "author"; + @Override public SyndElement handleElementStart(String localName, HandlerState state, @@ -31,7 +33,9 @@ public class NSITunes extends Namespace{ @Override public void handleElementEnd(String localName, HandlerState state) { - + if (localName.equals(AUTHOR)) { + state.getFeed().setAuthor(state.getContentBuf().toString()); + } } diff --git a/src/de/podfetcher/syndication/namespace/rss20/NSRSS20.java b/src/de/podfetcher/syndication/namespace/rss20/NSRSS20.java index 9cd2c42eb..dfae49b7d 100644 --- a/src/de/podfetcher/syndication/namespace/rss20/NSRSS20.java +++ b/src/de/podfetcher/syndication/namespace/rss20/NSRSS20.java @@ -36,6 +36,7 @@ public class NSRSS20 extends Namespace { public final static String ENCLOSURE = "enclosure"; public final static String IMAGE = "image"; public final static String URL = "url"; + public final static String LANGUAGE = "language"; public final static String ENC_URL = "url"; public final static String ENC_LEN = "length"; @@ -105,6 +106,8 @@ public class NSRSS20 extends Namespace { state.getCurrentItem().setDescription(content); } + } else if (localName.equals(LANGUAGE)) { + state.getFeed().setLanguage(content.toLowerCase()); } } }