do not mark article as read before opening it in offline mode which

screwed up the cursor (closes #800)
This commit is contained in:
Andrew Dolgov 2013-11-15 15:11:15 +04:00
parent f2dde1362b
commit d7c69cf591
3 changed files with 24 additions and 15 deletions

View File

@ -170,13 +170,16 @@ public class OfflineArticlePager extends Fragment {
} }
m_cursor.moveToNext(); m_cursor.moveToNext();
} }
Log.d(TAG, "(1)maId=" + m_articleId);
m_listener.onArticleSelected(m_articleId, false);
} }
} else { } else {
if (m_cursor.moveToFirst()) { if (m_cursor.moveToFirst()) {
m_articleId = m_cursor.getInt(m_cursor.getColumnIndex(BaseColumns._ID)); m_articleId = m_cursor.getInt(m_cursor.getColumnIndex(BaseColumns._ID));
m_listener.onArticleSelected(m_articleId, false); m_listener.onArticleSelected(m_articleId, false);
Log.d(TAG, "maId=" + m_articleId); Log.d(TAG, "(2)maId=" + m_articleId);
} }
} }

View File

@ -279,13 +279,16 @@ public class OfflineFeedsActivity extends OfflineActivity implements OfflineHead
@Override @Override
public void onArticleSelected(int articleId, boolean open) { public void onArticleSelected(int articleId, boolean open) {
SQLiteStatement stmt = getWritableDb().compileStatement(
"UPDATE articles SET modified = 1, unread = 0 " + "WHERE " + BaseColumns._ID
+ " = ?");
stmt.bindLong(1, articleId); if (!open) {
stmt.execute(); SQLiteStatement stmt = getWritableDb().compileStatement(
stmt.close(); "UPDATE articles SET modified = 1, unread = 0 " + "WHERE " + BaseColumns._ID
+ " = ?");
stmt.bindLong(1, articleId);
stmt.execute();
stmt.close();
}
initMenu(); initMenu();

View File

@ -107,13 +107,16 @@ public class OfflineHeadlinesActivity extends OfflineActivity implements Offline
@Override @Override
public void onArticleSelected(int articleId, boolean open) { public void onArticleSelected(int articleId, boolean open) {
SQLiteStatement stmt = getWritableDb().compileStatement(
"UPDATE articles SET modified = 1, unread = 0 " + "WHERE " + BaseColumns._ID
+ " = ?");
stmt.bindLong(1, articleId); if (!open) {
stmt.execute(); SQLiteStatement stmt = getWritableDb().compileStatement(
stmt.close(); "UPDATE articles SET modified = 1, unread = 0 " + "WHERE " + BaseColumns._ID
+ " = ?");
stmt.bindLong(1, articleId);
stmt.execute();
stmt.close();
}
if (open) { if (open) {
OfflineArticlePager af = (OfflineArticlePager) getSupportFragmentManager().findFragmentByTag(FRAG_ARTICLE); OfflineArticlePager af = (OfflineArticlePager) getSupportFragmentManager().findFragmentByTag(FRAG_ARTICLE);