コード例 #1
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);
  }
コード例 #2
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;
  }
コード例 #3
0
  /*
   * follow editText entry as a tag
   */
  private void addAsTag(final String entry) {
    if (TextUtils.isEmpty(entry)) {
      return;
    }

    if (!ReaderTag.isValidTagName(entry)) {
      ToastUtils.showToast(this, R.string.reader_toast_err_tag_invalid);
      return;
    }

    if (ReaderTagTable.isFollowedTagName(entry)) {
      ToastUtils.showToast(this, R.string.reader_toast_err_tag_exists);
      return;
    }

    // tag is valid, follow it
    mEditAdd.setText(null);
    EditTextUtils.hideSoftInput(mEditAdd);
    performAddTag(entry);
  }
コード例 #4
0
  @Override
  public void onBackPressed() {
    if (mTagsChanged || mBlogsChanged) {
      Bundle bundle = new Bundle();
      if (mTagsChanged) {
        bundle.putBoolean(KEY_TAGS_CHANGED, true);
        if (mLastAddedTagName != null && ReaderTagTable.isFollowedTagName(mLastAddedTagName)) {
          bundle.putString(KEY_LAST_ADDED_TAG_NAME, mLastAddedTagName);
        }
      }
      if (mBlogsChanged) {
        bundle.putBoolean(KEY_BLOGS_CHANGED, true);
      }
      Intent intent = new Intent();
      intent.putExtras(bundle);
      setResult(RESULT_OK, intent);
    }

    super.onBackPressed();
  }
コード例 #5
0
 /*
  * make sure current tag still exists, reset to default if it doesn't
  */
 private void checkCurrentTag() {
   if (hasCurrentTag() && !ReaderTagTable.tagExists(getCurrentTagName()))
     mCurrentTag = ReaderTag.TAG_NAME_DEFAULT;
 }