Exemplo n.º 1
0
 public Cursor getCursor(int pagerPos) {
   EntryView view = mEntryViews.get(pagerPos);
   if (view != null) {
     return (Cursor) view.getTag();
   }
   return null;
 }
Exemplo n.º 2
0
 public void setUpdatedCursor(int pagerPos, Cursor newCursor) {
   EntryView view = mEntryViews.get(pagerPos);
   if (view != null) {
     Cursor previousUpdatedOne = (Cursor) view.getTag(R.id.updated_cursor);
     if (previousUpdatedOne != null) {
       previousUpdatedOne.close();
     }
     view.setTag(newCursor);
     view.setTag(R.id.updated_cursor, newCursor);
   }
 }
Exemplo n.º 3
0
    public void displayEntry(int pagerPos, Cursor newCursor, boolean forceUpdate) {
      EntryView view = mEntryViews.get(pagerPos);
      if (view != null) {
        if (newCursor == null) {
          newCursor = (Cursor) view.getTag(); // get the old one
        }

        if (newCursor != null && newCursor.moveToFirst()) {
          String contentText = newCursor.getString(mMobilizedHtmlPos);
          if (contentText == null || (forceUpdate && !mPreferFullText)) {
            mPreferFullText = false;
            contentText = newCursor.getString(mAbstractPos);
          } else {
            mPreferFullText = true;
          }
          if (contentText == null) {
            contentText = "";
          }

          String author = newCursor.getString(mAuthorPos);
          long timestamp = newCursor.getLong(mDatePos);
          String link = newCursor.getString(mLinkPos);
          String title = newCursor.getString(mTitlePos);
          String enclosure = newCursor.getString(mEnclosurePos);

          // Set the saved scroll position (not saved by the view itself due to the ViewPager)
          if (mScrollPercentage != 0 && pagerPos == mCurrentPagerPos) {
            view.setScrollPercentage(mScrollPercentage);
            mScrollPercentage = 0;
          }

          view.setHtml(
              mEntriesIds[pagerPos],
              title,
              link,
              contentText,
              enclosure,
              author,
              timestamp,
              mPreferFullText);
          view.setTag(newCursor);

          if (pagerPos == mCurrentPagerPos) {
            refreshUI(newCursor);
          }
        }
      }
    }