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