fix last headline not opened properly in articlepager (closes #503)

This commit is contained in:
Andrew Dolgov 2012-10-05 13:14:04 +04:00
parent 40e6b10a7f
commit b706937075
2 changed files with 6 additions and 4 deletions

View File

@ -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();
}

View File

@ -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;