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