Show author in offline mode

This commit is contained in:
jan_bar 2013-04-24 16:07:51 +02:00
parent 3bdb6e86af
commit 0822058712
4 changed files with 17 additions and 5 deletions

View File

@ -284,6 +284,10 @@ public class OfflineArticleFragment extends Fragment implements GestureDetector.
TextView author = (TextView)view.findViewById(R.id.author); TextView author = (TextView)view.findViewById(R.id.author);
if (author != null) { if (author != null) {
int authorIndex = m_cursor.getColumnIndex("author");
if(authorIndex >= 0)
author.setText(m_cursor.getString(authorIndex));
else
author.setVisibility(View.GONE); author.setVisibility(View.GONE);
} }
} }

View File

@ -367,10 +367,8 @@ public class OfflineDownloadService extends Service {
m_articles = new Gson().fromJson(content, listType); m_articles = new Gson().fromJson(content, listType);
SQLiteStatement stmtInsert = getWritableDb().compileStatement("INSERT INTO articles " + SQLiteStatement stmtInsert = getWritableDb().compileStatement("INSERT INTO articles " +
"(" + "("+BaseColumns._ID+", unread, marked, published, score, updated, is_updated, title, link, feed_id, tags, content, author) " +
BaseColumns._ID + "VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?);");
", unread, marked, published, score, updated, is_updated, title, link, feed_id, tags, content) " +
"VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?);");
for (Article article : m_articles) { for (Article article : m_articles) {
@ -395,6 +393,7 @@ public class OfflineDownloadService extends Service {
stmtInsert.bindLong(index++, article.feed_id); stmtInsert.bindLong(index++, article.feed_id);
stmtInsert.bindString(index++, tagsString); // comma-separated tags stmtInsert.bindString(index++, tagsString); // comma-separated tags
stmtInsert.bindString(index++, article.content); stmtInsert.bindString(index++, article.content);
stmtInsert.bindString(index++, article.author);
if (m_downloadImages) { if (m_downloadImages) {
Document doc = Jsoup.parse(article.content); Document doc = Jsoup.parse(article.content);

View File

@ -532,6 +532,14 @@ public class OfflineHeadlinesFragment extends Fragment implements OnItemClickLis
te.setText(excerpt); te.setText(excerpt);
} }
TextView ta = (TextView)v.findViewById(R.id.author);
if (ta != null) {
int authorIndex = article.getColumnIndex("author");
if(authorIndex >= 0)
ta.setText(article.getString(authorIndex));
}
/* ImageView separator = (ImageView)v.findViewById(R.id.headlines_separator); /* ImageView separator = (ImageView)v.findViewById(R.id.headlines_separator);
if (separator != null && m_offlineServices.isSmallScreen()) { if (separator != null && m_offlineServices.isSmallScreen()) {

View File

@ -51,6 +51,7 @@ public class DatabaseHelper extends SQLiteOpenHelper {
"feed_id INTEGER, " + "feed_id INTEGER, " +
"tags TEXT, " + "tags TEXT, " +
"content TEXT, " + "content TEXT, " +
"author TEXT, " +
"selected BOOLEAN, " + "selected BOOLEAN, " +
"modified BOOLEAN" + "modified BOOLEAN" +
");"); ");");