Added 'author' and 'language' attributes to Feed
This commit is contained in:
parent
68e5d90b9c
commit
764ef2b1d6
|
@ -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
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:app="http://schemas.android.com/apk/res/de.podfetcher"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:orientation="vertical" >
|
||||
|
@ -44,12 +45,62 @@
|
|||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content" >
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="vertical" >
|
||||
|
||||
<android.support.v7.widget.GridLayout
|
||||
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:grid="http://schemas.android.com/apk/res-auto"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_margin="8dp"
|
||||
app:columnCount="2"
|
||||
app:orientation="horizontal"
|
||||
grid:useDefaultMargins="true" >
|
||||
|
||||
<TextView
|
||||
android:id="@+id/lblAuthor"
|
||||
android:textStyle="bold"
|
||||
app:layout_row="0"
|
||||
android:text="@string/author_label" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/lblLanguage"
|
||||
android:textStyle="bold"
|
||||
app:layout_column="0"
|
||||
app:layout_row="2"
|
||||
android:text="@string/language_label" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/txtvLanguage"
|
||||
android:layout_width="wrap_content"
|
||||
app:layout_column="1"
|
||||
app:layout_gravity="fill_vertical"
|
||||
app:layout_row="2"
|
||||
android:text="deutsch" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/txtvAuthor"
|
||||
android:layout_width="210dp"
|
||||
app:layout_column="1"
|
||||
app:layout_gravity="fill_vertical"
|
||||
app:layout_row="0"
|
||||
app:layout_rowSpan="2"
|
||||
android:text="metaebene personal media - Tim pritlove" />
|
||||
|
||||
<android.support.v7.widget.Space
|
||||
android:id="@+id/space1"
|
||||
android:layout_height="16dp"
|
||||
android:layout_width="50dp"
|
||||
app:layout_column="0"
|
||||
app:layout_row="1" />
|
||||
</android.support.v7.widget.GridLayout>
|
||||
|
||||
<TextView
|
||||
android:id="@+id/txtvDescription"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content" />
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_margin="8dp" />
|
||||
</LinearLayout>
|
||||
</ScrollView>
|
||||
|
||||
|
|
|
@ -71,5 +71,7 @@
|
|||
<string name="cover_label">Cover</string>
|
||||
<string name="playback_error_server_died">Server died</string>
|
||||
<string name="playback_error_unknown">Unknown Error</string>
|
||||
<string name="author_label">Author</string>
|
||||
<string name="language_label">Language</string>
|
||||
|
||||
</resources>
|
|
@ -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");
|
||||
}
|
||||
|
|
|
@ -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<FeedItem> 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;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -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))));
|
||||
|
|
|
@ -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());
|
||||
|
|
|
@ -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());
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
|
|
@ -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());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue