Merge pull request #28 from janxbar/master
Support for score and other minor enhancements
This commit is contained in:
commit
2bb0a6c44f
@ -21,6 +21,7 @@
|
|||||||
<item name="headlineSelectedTextColor">#ffffff</item>
|
<item name="headlineSelectedTextColor">#ffffff</item>
|
||||||
<item name="headlineExcerptTextColor">#909090</item>
|
<item name="headlineExcerptTextColor">#909090</item>
|
||||||
<item name="headlineSelectedExcerptTextColor">@android:color/secondary_text_light</item>
|
<item name="headlineSelectedExcerptTextColor">@android:color/secondary_text_light</item>
|
||||||
|
<item name="headlineTitleHighScoreUnreadTextColor">#008000</item>
|
||||||
<item name="linkColor">#30B0E0</item>
|
<item name="linkColor">#30B0E0</item>
|
||||||
<item name="loadingBackground">@android:color/white</item>
|
<item name="loadingBackground">@android:color/white</item>
|
||||||
</style>
|
</style>
|
||||||
@ -61,6 +62,7 @@
|
|||||||
<item name="headlineSelectedTextColor">@android:color/white</item>
|
<item name="headlineSelectedTextColor">@android:color/white</item>
|
||||||
<item name="headlineExcerptTextColor">@android:color/secondary_text_dark</item>
|
<item name="headlineExcerptTextColor">@android:color/secondary_text_dark</item>
|
||||||
<item name="headlineSelectedExcerptTextColor">@android:color/black</item>
|
<item name="headlineSelectedExcerptTextColor">@android:color/black</item>
|
||||||
|
<item name="headlineTitleHighScoreUnreadTextColor">#00FF00</item>
|
||||||
<item name="linkColor">@color/ics_cyan</item>
|
<item name="linkColor">@color/ics_cyan</item>
|
||||||
<item name="loadingBackground">@android:color/black</item>
|
<item name="loadingBackground">@android:color/black</item>
|
||||||
</style>
|
</style>
|
||||||
|
@ -20,6 +20,7 @@
|
|||||||
<item name="headlineSelectedTextColor">#ffffff</item>
|
<item name="headlineSelectedTextColor">#ffffff</item>
|
||||||
<item name="headlineExcerptTextColor">#909090</item>
|
<item name="headlineExcerptTextColor">#909090</item>
|
||||||
<item name="headlineSelectedExcerptTextColor">@android:color/secondary_text_light</item>
|
<item name="headlineSelectedExcerptTextColor">@android:color/secondary_text_light</item>
|
||||||
|
<item name="headlineTitleHighScoreUnreadTextColor">#008000</item>
|
||||||
<item name="linkColor">#30B0E0</item>
|
<item name="linkColor">#30B0E0</item>
|
||||||
<item name="loadingBackground">@android:color/white</item>
|
<item name="loadingBackground">@android:color/white</item>
|
||||||
</style>
|
</style>
|
||||||
@ -65,6 +66,7 @@
|
|||||||
<item name="headlineSelectedTextColor">@android:color/white</item>
|
<item name="headlineSelectedTextColor">@android:color/white</item>
|
||||||
<item name="headlineExcerptTextColor">@android:color/secondary_text_dark</item>
|
<item name="headlineExcerptTextColor">@android:color/secondary_text_dark</item>
|
||||||
<item name="headlineSelectedExcerptTextColor">@android:color/black</item>
|
<item name="headlineSelectedExcerptTextColor">@android:color/black</item>
|
||||||
|
<item name="headlineTitleHighScoreUnreadTextColor">#00FF00</item>
|
||||||
<item name="linkColor">@color/ics_cyan</item>
|
<item name="linkColor">@color/ics_cyan</item>
|
||||||
<item name="loadingBackground">@android:color/black</item>
|
<item name="loadingBackground">@android:color/black</item>
|
||||||
</style>
|
</style>
|
||||||
|
@ -20,6 +20,7 @@
|
|||||||
<attr name="headlineSelectedTextColor" format="reference|color" />
|
<attr name="headlineSelectedTextColor" format="reference|color" />
|
||||||
<attr name="headlineExcerptTextColor" format="reference|color" />
|
<attr name="headlineExcerptTextColor" format="reference|color" />
|
||||||
<attr name="headlineSelectedExcerptTextColor" format="reference|color" />
|
<attr name="headlineSelectedExcerptTextColor" format="reference|color" />
|
||||||
|
<attr name="headlineTitleHighScoreUnreadTextColor" format="reference|color" />
|
||||||
<attr name="linkColor" format="reference|color" />
|
<attr name="linkColor" format="reference|color" />
|
||||||
<attr name="loadingBackground" format="reference|color" />
|
<attr name="loadingBackground" format="reference|color" />
|
||||||
</resources>
|
</resources>
|
@ -21,6 +21,7 @@
|
|||||||
<item name="headlineSelectedTextColor">@android:color/primary_text_light</item>
|
<item name="headlineSelectedTextColor">@android:color/primary_text_light</item>
|
||||||
<item name="headlineExcerptTextColor">@android:color/secondary_text_light</item>
|
<item name="headlineExcerptTextColor">@android:color/secondary_text_light</item>
|
||||||
<item name="headlineSelectedExcerptTextColor">@android:color/secondary_text_light</item>
|
<item name="headlineSelectedExcerptTextColor">@android:color/secondary_text_light</item>
|
||||||
|
<item name="headlineTitleHighScoreUnreadTextColor">#008000</item>
|
||||||
<item name="linkColor">#5858F8</item>
|
<item name="linkColor">#5858F8</item>
|
||||||
<item name="loadingBackground">@android:color/white</item>
|
<item name="loadingBackground">@android:color/white</item>
|
||||||
</style>
|
</style>
|
||||||
@ -61,6 +62,7 @@
|
|||||||
<item name="headlineSelectedTextColor">@android:color/black</item>
|
<item name="headlineSelectedTextColor">@android:color/black</item>
|
||||||
<item name="headlineExcerptTextColor">@android:color/secondary_text_dark</item>
|
<item name="headlineExcerptTextColor">@android:color/secondary_text_dark</item>
|
||||||
<item name="headlineSelectedExcerptTextColor">@android:color/black</item>
|
<item name="headlineSelectedExcerptTextColor">@android:color/black</item>
|
||||||
|
<item name="headlineTitleHighScoreUnreadTextColor">#00FF00</item>
|
||||||
<item name="linkColor">#5858F8</item>
|
<item name="linkColor">#5858F8</item>
|
||||||
<item name="loadingBackground">@android:color/black</item>
|
<item name="loadingBackground">@android:color/black</item>
|
||||||
</style>
|
</style>
|
||||||
|
@ -16,6 +16,8 @@ import org.jsoup.Jsoup;
|
|||||||
import android.app.Activity;
|
import android.app.Activity;
|
||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
import android.content.SharedPreferences;
|
import android.content.SharedPreferences;
|
||||||
|
import android.content.res.Resources.Theme;
|
||||||
|
import android.graphics.Paint;
|
||||||
import android.graphics.drawable.BitmapDrawable;
|
import android.graphics.drawable.BitmapDrawable;
|
||||||
import android.graphics.drawable.Drawable;
|
import android.graphics.drawable.Drawable;
|
||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
@ -24,6 +26,7 @@ import android.support.v4.app.Fragment;
|
|||||||
import android.text.Html;
|
import android.text.Html;
|
||||||
import android.text.Html.ImageGetter;
|
import android.text.Html.ImageGetter;
|
||||||
import android.util.Log;
|
import android.util.Log;
|
||||||
|
import android.util.TypedValue;
|
||||||
import android.view.ContextMenu;
|
import android.view.ContextMenu;
|
||||||
import android.view.ContextMenu.ContextMenuInfo;
|
import android.view.ContextMenu.ContextMenuInfo;
|
||||||
import android.view.LayoutInflater;
|
import android.view.LayoutInflater;
|
||||||
@ -534,9 +537,17 @@ public class HeadlinesFragment extends Fragment implements OnItemClickListener,
|
|||||||
|
|
||||||
public static final int VIEW_COUNT = VIEW_LOADMORE+1;
|
public static final int VIEW_COUNT = VIEW_LOADMORE+1;
|
||||||
|
|
||||||
|
private final Integer[] origTitleColors = new Integer[VIEW_COUNT];
|
||||||
|
private final int titleHighScoreUnreadColor;
|
||||||
|
|
||||||
public ArticleListAdapter(Context context, int textViewResourceId, ArrayList<Article> items) {
|
public ArticleListAdapter(Context context, int textViewResourceId, ArrayList<Article> items) {
|
||||||
super(context, textViewResourceId, items);
|
super(context, textViewResourceId, items);
|
||||||
this.items = items;
|
this.items = items;
|
||||||
|
|
||||||
|
Theme theme = context.getTheme();
|
||||||
|
TypedValue tv = new TypedValue();
|
||||||
|
theme.resolveAttribute(R.attr.headlineTitleHighScoreUnreadTextColor, tv, true);
|
||||||
|
titleHighScoreUnreadColor = tv.data;
|
||||||
}
|
}
|
||||||
|
|
||||||
public int getViewTypeCount() {
|
public int getViewTypeCount() {
|
||||||
@ -596,6 +607,7 @@ public class HeadlinesFragment extends Fragment implements OnItemClickListener,
|
|||||||
|
|
||||||
if (tt != null) {
|
if (tt != null) {
|
||||||
tt.setText(Html.fromHtml(article.title));
|
tt.setText(Html.fromHtml(article.title));
|
||||||
|
adjustTitleTextView(article.score, tt, position);
|
||||||
}
|
}
|
||||||
|
|
||||||
TextView ft = (TextView)v.findViewById(R.id.feed_title);
|
TextView ft = (TextView)v.findViewById(R.id.feed_title);
|
||||||
@ -727,8 +739,24 @@ public class HeadlinesFragment extends Fragment implements OnItemClickListener,
|
|||||||
|
|
||||||
return v;
|
return v;
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
|
private void adjustTitleTextView(int score, TextView tv, int position) {
|
||||||
|
int viewType = getItemViewType(position);
|
||||||
|
if (origTitleColors[viewType] == null)
|
||||||
|
// store original color
|
||||||
|
origTitleColors[viewType] = Integer.valueOf(tv.getCurrentTextColor());
|
||||||
|
|
||||||
|
if (score < -500) {
|
||||||
|
tv.setPaintFlags(tv.getPaintFlags() | Paint.STRIKE_THRU_TEXT_FLAG);
|
||||||
|
} else if (score > 500) {
|
||||||
|
tv.setTextColor(titleHighScoreUnreadColor);
|
||||||
|
tv.setPaintFlags(tv.getPaintFlags() & ~Paint.STRIKE_THRU_TEXT_FLAG);
|
||||||
|
} else {
|
||||||
|
tv.setTextColor(origTitleColors[viewType].intValue());
|
||||||
|
tv.setPaintFlags(tv.getPaintFlags() & ~Paint.STRIKE_THRU_TEXT_FLAG);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
public void notifyUpdated() {
|
public void notifyUpdated() {
|
||||||
|
@ -284,7 +284,11 @@ 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) {
|
||||||
author.setVisibility(View.GONE);
|
int authorIndex = m_cursor.getColumnIndex("author");
|
||||||
|
if (authorIndex >= 0)
|
||||||
|
author.setText(m_cursor.getString(authorIndex));
|
||||||
|
else
|
||||||
|
author.setVisibility(View.GONE);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -367,8 +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, updated, is_updated, title, link, feed_id, tags, content) " +
|
"("+BaseColumns._ID+", unread, marked, published, score, updated, is_updated, title, link, feed_id, tags, content, author) " +
|
||||||
"VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?);");
|
"VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?);");
|
||||||
|
|
||||||
for (Article article : m_articles) {
|
for (Article article : m_articles) {
|
||||||
|
|
||||||
@ -380,17 +380,20 @@ public class OfflineDownloadService extends Service {
|
|||||||
|
|
||||||
tagsString = tagsString.replaceAll(", $", "");
|
tagsString = tagsString.replaceAll(", $", "");
|
||||||
|
|
||||||
stmtInsert.bindLong(1, article.id);
|
int index = 1;
|
||||||
stmtInsert.bindLong(2, article.unread ? 1 : 0);
|
stmtInsert.bindLong(index++, article.id);
|
||||||
stmtInsert.bindLong(3, article.marked ? 1 : 0);
|
stmtInsert.bindLong(index++, article.unread ? 1 : 0);
|
||||||
stmtInsert.bindLong(4, article.published ? 1 : 0);
|
stmtInsert.bindLong(index++, article.marked ? 1 : 0);
|
||||||
stmtInsert.bindLong(5, article.updated);
|
stmtInsert.bindLong(index++, article.published ? 1 : 0);
|
||||||
stmtInsert.bindLong(6, article.is_updated ? 1 : 0);
|
stmtInsert.bindLong(index++, article.score);
|
||||||
stmtInsert.bindString(7, article.title);
|
stmtInsert.bindLong(index++, article.updated);
|
||||||
stmtInsert.bindString(8, article.link);
|
stmtInsert.bindLong(index++, article.is_updated ? 1 : 0);
|
||||||
stmtInsert.bindLong(9, article.feed_id);
|
stmtInsert.bindString(index++, article.title);
|
||||||
stmtInsert.bindString(10, tagsString); // comma-separated tags
|
stmtInsert.bindString(index++, article.link);
|
||||||
stmtInsert.bindString(11, article.content);
|
stmtInsert.bindLong(index++, article.feed_id);
|
||||||
|
stmtInsert.bindString(index++, tagsString); // comma-separated tags
|
||||||
|
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);
|
||||||
|
@ -12,8 +12,10 @@ import org.jsoup.Jsoup;
|
|||||||
import android.app.Activity;
|
import android.app.Activity;
|
||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
import android.content.SharedPreferences;
|
import android.content.SharedPreferences;
|
||||||
|
import android.content.res.Resources.Theme;
|
||||||
import android.database.Cursor;
|
import android.database.Cursor;
|
||||||
import android.database.sqlite.SQLiteStatement;
|
import android.database.sqlite.SQLiteStatement;
|
||||||
|
import android.graphics.Paint;
|
||||||
import android.graphics.drawable.BitmapDrawable;
|
import android.graphics.drawable.BitmapDrawable;
|
||||||
import android.graphics.drawable.Drawable;
|
import android.graphics.drawable.Drawable;
|
||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
@ -24,6 +26,7 @@ import android.support.v4.widget.SimpleCursorAdapter;
|
|||||||
import android.text.Html;
|
import android.text.Html;
|
||||||
import android.text.Html.ImageGetter;
|
import android.text.Html.ImageGetter;
|
||||||
import android.util.Log;
|
import android.util.Log;
|
||||||
|
import android.util.TypedValue;
|
||||||
import android.view.ContextMenu;
|
import android.view.ContextMenu;
|
||||||
import android.view.ContextMenu.ContextMenuInfo;
|
import android.view.ContextMenu.ContextMenuInfo;
|
||||||
import android.view.LayoutInflater;
|
import android.view.LayoutInflater;
|
||||||
@ -371,12 +374,6 @@ public class OfflineHeadlinesFragment extends Fragment implements OnItemClickLis
|
|||||||
} */
|
} */
|
||||||
|
|
||||||
private class ArticleListAdapter extends SimpleCursorAdapter {
|
private class ArticleListAdapter extends SimpleCursorAdapter {
|
||||||
public ArticleListAdapter(Context context, int layout, Cursor c,
|
|
||||||
String[] from, int[] to, int flags) {
|
|
||||||
super(context, layout, c, from, to, flags);
|
|
||||||
// TODO Auto-generated constructor stub
|
|
||||||
}
|
|
||||||
|
|
||||||
public static final int VIEW_NORMAL = 0;
|
public static final int VIEW_NORMAL = 0;
|
||||||
public static final int VIEW_UNREAD = 1;
|
public static final int VIEW_UNREAD = 1;
|
||||||
public static final int VIEW_SELECTED = 2;
|
public static final int VIEW_SELECTED = 2;
|
||||||
@ -385,7 +382,19 @@ public class OfflineHeadlinesFragment extends Fragment implements OnItemClickLis
|
|||||||
|
|
||||||
public static final int VIEW_COUNT = VIEW_LOADMORE+1;
|
public static final int VIEW_COUNT = VIEW_LOADMORE+1;
|
||||||
|
|
||||||
|
private final Integer[] origTitleColors = new Integer[VIEW_COUNT];
|
||||||
|
private final int titleHighScoreUnreadColor;
|
||||||
|
|
||||||
|
public ArticleListAdapter(Context context, int layout, Cursor c,
|
||||||
|
String[] from, int[] to, int flags) {
|
||||||
|
super(context, layout, c, from, to, flags);
|
||||||
|
|
||||||
|
Theme theme = context.getTheme();
|
||||||
|
TypedValue tv = new TypedValue();
|
||||||
|
theme.resolveAttribute(R.attr.headlineTitleHighScoreUnreadTextColor, tv, true);
|
||||||
|
titleHighScoreUnreadColor = tv.data;
|
||||||
|
}
|
||||||
|
|
||||||
public int getViewTypeCount() {
|
public int getViewTypeCount() {
|
||||||
return VIEW_COUNT;
|
return VIEW_COUNT;
|
||||||
}
|
}
|
||||||
@ -444,6 +453,10 @@ public class OfflineHeadlinesFragment extends Fragment implements OnItemClickLis
|
|||||||
|
|
||||||
if (tt != null) {
|
if (tt != null) {
|
||||||
tt.setText(Html.fromHtml(article.getString(article.getColumnIndex("title"))));
|
tt.setText(Html.fromHtml(article.getString(article.getColumnIndex("title"))));
|
||||||
|
|
||||||
|
int scoreIndex = article.getColumnIndex("score");
|
||||||
|
if (scoreIndex >= 0)
|
||||||
|
adjustTitleTextView(article.getInt(scoreIndex), tt, position);
|
||||||
}
|
}
|
||||||
|
|
||||||
TextView ft = (TextView)v.findViewById(R.id.feed_title);
|
TextView ft = (TextView)v.findViewById(R.id.feed_title);
|
||||||
@ -518,6 +531,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()) {
|
||||||
@ -573,6 +594,23 @@ public class OfflineHeadlinesFragment extends Fragment implements OnItemClickLis
|
|||||||
|
|
||||||
return v;
|
return v;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void adjustTitleTextView(int score, TextView tv, int position) {
|
||||||
|
int viewType = getItemViewType(position);
|
||||||
|
if (origTitleColors[viewType] == null)
|
||||||
|
// store original color
|
||||||
|
origTitleColors[viewType] = Integer.valueOf(tv.getCurrentTextColor());
|
||||||
|
|
||||||
|
if (score < -500) {
|
||||||
|
tv.setPaintFlags(tv.getPaintFlags() | Paint.STRIKE_THRU_TEXT_FLAG);
|
||||||
|
} else if (score > 500) {
|
||||||
|
tv.setTextColor(titleHighScoreUnreadColor);
|
||||||
|
tv.setPaintFlags(tv.getPaintFlags() & ~Paint.STRIKE_THRU_TEXT_FLAG);
|
||||||
|
} else {
|
||||||
|
tv.setTextColor(origTitleColors[viewType].intValue());
|
||||||
|
tv.setPaintFlags(tv.getPaintFlags() & ~Paint.STRIKE_THRU_TEXT_FLAG);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void notifyUpdated() {
|
public void notifyUpdated() {
|
||||||
|
@ -12,6 +12,7 @@ public class Article implements Parcelable {
|
|||||||
public boolean unread;
|
public boolean unread;
|
||||||
public boolean marked;
|
public boolean marked;
|
||||||
public boolean published;
|
public boolean published;
|
||||||
|
public int score;
|
||||||
public int updated;
|
public int updated;
|
||||||
public boolean is_updated;
|
public boolean is_updated;
|
||||||
public String title;
|
public String title;
|
||||||
@ -53,6 +54,7 @@ public class Article implements Parcelable {
|
|||||||
out.writeInt(unread ? 1 : 0);
|
out.writeInt(unread ? 1 : 0);
|
||||||
out.writeInt(marked ? 1 : 0);
|
out.writeInt(marked ? 1 : 0);
|
||||||
out.writeInt(published ? 1 : 0);
|
out.writeInt(published ? 1 : 0);
|
||||||
|
out.writeInt(score);
|
||||||
out.writeInt(updated);
|
out.writeInt(updated);
|
||||||
out.writeInt(is_updated ? 1 : 0);
|
out.writeInt(is_updated ? 1 : 0);
|
||||||
out.writeString(title);
|
out.writeString(title);
|
||||||
@ -73,6 +75,7 @@ public class Article implements Parcelable {
|
|||||||
unread = in.readInt() == 1;
|
unread = in.readInt() == 1;
|
||||||
marked = in.readInt() == 1;
|
marked = in.readInt() == 1;
|
||||||
published = in.readInt() == 1;
|
published = in.readInt() == 1;
|
||||||
|
score = in.readInt();
|
||||||
updated = in.readInt();
|
updated = in.readInt();
|
||||||
is_updated = in.readInt() == 1;
|
is_updated = in.readInt() == 1;
|
||||||
title = in.readString();
|
title = in.readString();
|
||||||
|
@ -10,7 +10,7 @@ public class DatabaseHelper extends SQLiteOpenHelper {
|
|||||||
@SuppressWarnings("unused")
|
@SuppressWarnings("unused")
|
||||||
private final String TAG = this.getClass().getSimpleName();
|
private final String TAG = this.getClass().getSimpleName();
|
||||||
public static final String DATABASE_NAME = "OfflineStorage.db";
|
public static final String DATABASE_NAME = "OfflineStorage.db";
|
||||||
public static final int DATABASE_VERSION = 3;
|
public static final int DATABASE_VERSION = 4;
|
||||||
|
|
||||||
public DatabaseHelper(Context context) {
|
public DatabaseHelper(Context context) {
|
||||||
super(context, DATABASE_NAME, null, DATABASE_VERSION);
|
super(context, DATABASE_NAME, null, DATABASE_VERSION);
|
||||||
@ -18,11 +18,12 @@ public class DatabaseHelper extends SQLiteOpenHelper {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onCreate(SQLiteDatabase db) {
|
public void onCreate(SQLiteDatabase db) {
|
||||||
|
db.execSQL("DROP VIEW IF EXISTS cats_unread;");
|
||||||
|
db.execSQL("DROP VIEW IF EXISTS feeds_unread;");
|
||||||
|
db.execSQL("DROP TRIGGER IF EXISTS articles_set_modified;");
|
||||||
db.execSQL("DROP TABLE IF EXISTS categories;");
|
db.execSQL("DROP TABLE IF EXISTS categories;");
|
||||||
db.execSQL("DROP TABLE IF EXISTS feeds;");
|
db.execSQL("DROP TABLE IF EXISTS feeds;");
|
||||||
db.execSQL("DROP TABLE IF EXISTS articles;");
|
db.execSQL("DROP TABLE IF EXISTS articles;");
|
||||||
db.execSQL("DROP VIEW IF EXISTS feeds_unread;");
|
|
||||||
db.execSQL("DROP TRIGGER IF EXISTS articles_set_modified;");
|
|
||||||
|
|
||||||
db.execSQL("CREATE TABLE IF NOT EXISTS feeds (" +
|
db.execSQL("CREATE TABLE IF NOT EXISTS feeds (" +
|
||||||
BaseColumns._ID + " INTEGER PRIMARY KEY AUTOINCREMENT," +
|
BaseColumns._ID + " INTEGER PRIMARY KEY AUTOINCREMENT," +
|
||||||
@ -42,6 +43,7 @@ public class DatabaseHelper extends SQLiteOpenHelper {
|
|||||||
"unread BOOLEAN, " +
|
"unread BOOLEAN, " +
|
||||||
"marked BOOLEAN, " +
|
"marked BOOLEAN, " +
|
||||||
"published BOOLEAN, " +
|
"published BOOLEAN, " +
|
||||||
|
"score INTEGER, " +
|
||||||
"updated INTEGER, " +
|
"updated INTEGER, " +
|
||||||
"is_updated BOOLEAN, " +
|
"is_updated BOOLEAN, " +
|
||||||
"title TEXT, " +
|
"title TEXT, " +
|
||||||
@ -49,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" +
|
||||||
");");
|
");");
|
||||||
|
Loading…
Reference in New Issue
Block a user