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,6 +279,8 @@ public class OfflineFeedsActivity extends OfflineActivity implements OfflineHead
@Override @Override
public void onArticleSelected(int articleId, boolean open) { public void onArticleSelected(int articleId, boolean open) {
if (!open) {
SQLiteStatement stmt = getWritableDb().compileStatement( SQLiteStatement stmt = getWritableDb().compileStatement(
"UPDATE articles SET modified = 1, unread = 0 " + "WHERE " + BaseColumns._ID "UPDATE articles SET modified = 1, unread = 0 " + "WHERE " + BaseColumns._ID
+ " = ?"); + " = ?");
@ -286,6 +288,7 @@ public class OfflineFeedsActivity extends OfflineActivity implements OfflineHead
stmt.bindLong(1, articleId); stmt.bindLong(1, articleId);
stmt.execute(); stmt.execute();
stmt.close(); stmt.close();
}
initMenu(); initMenu();

View File

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