Move mAccessToken and mAccountName initialization upper (#841)

This commit is contained in:
Anatolii Afanasev 2022-08-05 01:53:20 +01:00 committed by GitHub
parent 2bc9034c89
commit 926e50090e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -153,8 +153,11 @@ public class FilteredPostsActivity extends BaseActivity implements SortTypeSelec
getSupportActionBar().setDisplayHomeAsUpEnabled(true);
setToolbarGoToTop(toolbar);
mAccessToken = mCurrentAccountSharedPreferences.getString(SharedPreferencesUtils.ACCESS_TOKEN, null);
mAccountName = mCurrentAccountSharedPreferences.getString(SharedPreferencesUtils.ACCOUNT_NAME, null);
name = getIntent().getStringExtra(EXTRA_NAME);
postType = getIntent().getIntExtra(EXTRA_POST_TYPE, PostPagingSource.TYPE_FRONT_PAGE);
int filter = getIntent().getIntExtra(EXTRA_FILTER, -1000);
PostFilter postFilter = new PostFilter();
postFilter.allowNSFW = !mSharedPreferences.getBoolean(SharedPreferencesUtils.DISABLE_NSFW_FOREVER, false) && mNsfwAndSpoilerSharedPreferences.getBoolean((mAccountName == null || mAccountName.equals("-") ? "" : mAccountName) + SharedPreferencesUtils.NSFW_BASE, false);
@ -224,9 +227,6 @@ public class FilteredPostsActivity extends BaseActivity implements SortTypeSelec
}
}
mAccessToken = mCurrentAccountSharedPreferences.getString(SharedPreferencesUtils.ACCESS_TOKEN, null);
mAccountName = mCurrentAccountSharedPreferences.getString(SharedPreferencesUtils.ACCOUNT_NAME, null);
if (savedInstanceState != null) {
mFragment = (PostFragment) getSupportFragmentManager().getFragment(savedInstanceState, FRAGMENT_OUT_STATE);
getSupportFragmentManager().beginTransaction().replace(R.id.frame_layout_filtered_posts_activity, mFragment).commit();