Browse Source

Fix logged in check in SettingsPreferencesFragment

renovate/org.robolectric-robolectric-4.x
Ammar Githam 4 years ago
parent
commit
c073cfc9be
  1. 10
      app/src/main/java/awais/instagrabber/fragments/settings/SettingsPreferencesFragment.java

10
app/src/main/java/awais/instagrabber/fragments/settings/SettingsPreferencesFragment.java

@ -41,13 +41,13 @@ public class SettingsPreferencesFragment extends BasePreferencesFragment {
public void onCreate(@Nullable final Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setHasOptionsMenu(true);
final String cookie = settingsHelper.getString(Constants.COOKIE);
isLoggedIn = !Utils.isEmpty(cookie) && Utils.getUserIdFromCookie(cookie) != null;
}
@Override
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());
screen.addPreference(generalCategory);
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.setEntryValues(values);
preference.setIconSpaceReserved(false);
preference.setOnPreferenceChangeListener((preference1, newValue) -> {
shouldRecreate();
return true;
});
return preference;
}

Loading…
Cancel
Save