コード例 #1
0
    @Override
    protected Boolean doInBackground(Void... params) {
      switch (getBlogType()) {
        case RECOMMENDED:
          // get recommended blogs using this offset, then start over with no offset
          // if there aren't any with this offset,
          int limit = ReaderConstants.READER_MAX_RECOMMENDED_TO_DISPLAY;
          int offset = UserPrefs.getReaderRecommendedBlogOffset();
          tmpRecommendedBlogs = ReaderBlogTable.getRecommendedBlogs(limit, offset);
          if (tmpRecommendedBlogs.size() == 0 && offset > 0) {
            UserPrefs.setReaderRecommendedBlogOffset(0);
            tmpRecommendedBlogs = ReaderBlogTable.getRecommendedBlogs(limit, 0);
          }
          return !mRecommendedBlogs.isSameList(tmpRecommendedBlogs);

        case FOLLOWED:
          tmpFollowedBlogs = ReaderBlogTable.getFollowedBlogs();
          return !mFollowedBlogs.isSameList(tmpFollowedBlogs);

        default:
          return false;
      }
    }
コード例 #2
0
  protected void setCurrentTag(String tagName) {
    if (TextUtils.isEmpty(tagName)) return;

    mCurrentTag = tagName;
    UserPrefs.setReaderTag(tagName);

    hideLoadingProgress();
    getPostAdapter().setTag(tagName);
    hideNewPostsBar();

    // update posts in this tag if it's time to do so
    if (ReaderTagTable.shouldAutoUpdateTag(tagName))
      updatePostsWithTag(
          tagName, ReaderActions.RequestDataAction.LOAD_NEWER, RefreshType.AUTOMATIC);
  }
コード例 #3
0
  protected static ReaderPostListFragment newInstance(Context context) {
    AppLog.d(T.READER, "post list newInstance");

    // restore the previously-chosen tag, revert to default if not set or doesn't exist
    String tagName = UserPrefs.getReaderTag();
    if (TextUtils.isEmpty(tagName) || !ReaderTagTable.tagExists(tagName))
      tagName = ReaderTag.TAG_NAME_DEFAULT;

    Bundle args = new Bundle();
    args.putString(KEY_TAG_NAME, tagName);

    ReaderPostListFragment fragment = new ReaderPostListFragment();
    fragment.setArguments(args);

    return fragment;
  }