1
0
mirror of https://github.com/KokaKiwi/BarInsta synced 2024-11-22 14:47:29 +00:00

Fix logged in check in SettingsPreferencesFragment

This commit is contained in:
Ammar Githam 2020-09-08 21:25:19 +09:00
parent e1a13c7eee
commit c073cfc9be

View File

@ -41,13 +41,13 @@ public class SettingsPreferencesFragment extends BasePreferencesFragment {
public void onCreate(@Nullable final Bundle savedInstanceState) { public void onCreate(@Nullable final Bundle savedInstanceState) {
super.onCreate(savedInstanceState); super.onCreate(savedInstanceState);
setHasOptionsMenu(true); setHasOptionsMenu(true);
final String cookie = settingsHelper.getString(Constants.COOKIE);
isLoggedIn = !Utils.isEmpty(cookie) && Utils.getUserIdFromCookie(cookie) != null;
} }
@Override @Override
void setupPreferenceScreen(final PreferenceScreen screen) { void setupPreferenceScreen(final PreferenceScreen screen) {
final String cookie = settingsHelper.getString(Constants.COOKIE);
isLoggedIn = !Utils.isEmpty(cookie) && Utils.getUserIdFromCookie(cookie) != null;
final PreferenceCategory generalCategory = new PreferenceCategory(requireContext()); final PreferenceCategory generalCategory = new PreferenceCategory(requireContext());
screen.addPreference(generalCategory); screen.addPreference(generalCategory);
generalCategory.setTitle(getString(R.string.pref_category_general)); generalCategory.setTitle(getString(R.string.pref_category_general));
@ -141,10 +141,6 @@ public class SettingsPreferencesFragment extends BasePreferencesFragment {
preference.setEntries(R.array.main_nav_ids_values); preference.setEntries(R.array.main_nav_ids_values);
preference.setEntryValues(values); preference.setEntryValues(values);
preference.setIconSpaceReserved(false); preference.setIconSpaceReserved(false);
preference.setOnPreferenceChangeListener((preference1, newValue) -> {
shouldRecreate();
return true;
});
return preference; return preference;
} }