Back to project page holoreader.
The source code is released under:
GNU General Public License
If you think the Android project holoreader listed in this page is inappropriate, such as containing malicious code/tools or violating the copyright, please email info at java2s dot com, thanks.
package de.hdodenhof.holoreader.misc; //from w ww. j av a 2 s. co m import java.util.Date; import android.content.ContentResolver; import android.content.ContentValues; import android.content.Context; import android.net.Uri; import de.hdodenhof.holoreader.provider.RSSContentProvider; import de.hdodenhof.holoreader.provider.SQLiteHelper; import de.hdodenhof.holoreader.provider.SQLiteHelper.ArticleDAO; public class MarkReadRunnable implements Runnable { Context mContext; int mArticleID = -1; int mFeedID = -1; public MarkReadRunnable(Context context) { mContext = context; } public void setArticle(int articleID) { mArticleID = articleID; mFeedID = -1; } public void setFeed(int feedID) { mFeedID = feedID; mArticleID = -1; } public void run() { ContentResolver contentResolver = mContext.getContentResolver(); ContentValues contentValues = new ContentValues(); String selection = ArticleDAO.READ + " IS NULL"; String[] selectionArgs = null; Uri uri; if (mArticleID != -1) { uri = Uri.withAppendedPath(RSSContentProvider.URI_ARTICLES, String.valueOf(mArticleID)); } else { uri = RSSContentProvider.URI_ARTICLES; if (mFeedID != -1) { selection = selection + " AND " + ArticleDAO.FEEDID + " = ? "; selectionArgs = new String[] { String.valueOf(mFeedID) }; } } contentValues.put(ArticleDAO.READ, SQLiteHelper.fromDate(new Date())); contentResolver.update(uri, contentValues, selection, selectionArgs); } }