From b7069370759e8358ce7cc1b68fd13f703267dd4e Mon Sep 17 00:00:00 2001 From: Andrew Dolgov Date: Fri, 5 Oct 2012 13:14:04 +0400 Subject: [PATCH] fix last headline not opened properly in articlepager (closes #503) --- src/org/fox/ttrss/offline/OfflineArticlePager.java | 4 ++-- src/org/fox/ttrss/offline/OfflineHeadlinesFragment.java | 6 ++++-- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/src/org/fox/ttrss/offline/OfflineArticlePager.java b/src/org/fox/ttrss/offline/OfflineArticlePager.java index 659aae00..ac98646e 100644 --- a/src/org/fox/ttrss/offline/OfflineArticlePager.java +++ b/src/org/fox/ttrss/offline/OfflineArticlePager.java @@ -118,7 +118,7 @@ public class OfflineArticlePager extends Fragment { if (m_articleId != 0) { if (m_cursor.moveToFirst()) { - while (!m_cursor.isLast()) { + while (!m_cursor.isAfterLast()) { if (m_cursor.getInt(m_cursor.getColumnIndex(BaseColumns._ID)) == m_articleId) { position = m_cursor.getPosition(); break; @@ -218,7 +218,7 @@ public class OfflineArticlePager extends Fragment { public int getArticleIdPosition(int articleId) { m_cursor.moveToFirst(); - while (!m_cursor.isLast()) { + while (!m_cursor.isAfterLast()) { if (m_cursor.getInt(m_cursor.getColumnIndex(BaseColumns._ID)) == articleId) { return m_cursor.getPosition(); } diff --git a/src/org/fox/ttrss/offline/OfflineHeadlinesFragment.java b/src/org/fox/ttrss/offline/OfflineHeadlinesFragment.java index de649a57..37e35718 100644 --- a/src/org/fox/ttrss/offline/OfflineHeadlinesFragment.java +++ b/src/org/fox/ttrss/offline/OfflineHeadlinesFragment.java @@ -332,9 +332,11 @@ public class OfflineHeadlinesFragment extends Fragment implements OnItemClickLis Log.d(TAG, "onItemClick=" + position); if (list != null) { - Cursor cursor = (Cursor)list.getItemAtPosition(position); + /* Cursor cursor = (Cursor)list.getItemAtPosition(position); - int articleId = cursor.getInt(0); + int articleId = cursor.getInt(0); */ + + int articleId = getArticleIdAtPosition(position); if (getActivity().findViewById(R.id.article_fragment) != null) { m_activeArticleId = articleId;