diff --git a/app/src/main/java/eu/faircode/email/FragmentSetup.java b/app/src/main/java/eu/faircode/email/FragmentSetup.java index d03d5b9465..fccfa4d337 100644 --- a/app/src/main/java/eu/faircode/email/FragmentSetup.java +++ b/app/src/main/java/eu/faircode/email/FragmentSetup.java @@ -133,8 +133,6 @@ public class FragmentSetup extends FragmentBase { grpManual = view.findViewById(R.id.grpManual); grpDataSaver = view.findViewById(R.id.grpDataSaver); - PackageManager pm = getContext().getPackageManager(); - // Wire controls ibHelp.setOnClickListener(new View.OnClickListener() { @@ -307,6 +305,8 @@ public class FragmentSetup extends FragmentBase { startActivity(settings); } }); + + PackageManager pm = getContext().getPackageManager(); btnDataSaver.setEnabled(settings.resolveActivity(pm) != null); // system whitelisted } @@ -334,6 +334,22 @@ public class FragmentSetup extends FragmentBase { setContactsPermission(hasPermission(Manifest.permission.READ_CONTACTS)); + return view; + } + + @Override + public void onSaveInstanceState(Bundle outState) { + outState.putBoolean("fair:manual", manual); + super.onSaveInstanceState(outState); + } + + @Override + public void onActivityCreated(@Nullable Bundle savedInstanceState) { + super.onActivityCreated(savedInstanceState); + + final DB db = DB.getInstance(getContext()); + final SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(getContext()); + // Create outbox new SimpleTask() { @Override @@ -362,22 +378,6 @@ public class FragmentSetup extends FragmentBase { } }.execute(this, new Bundle(), "outbox:create"); - return view; - } - - @Override - public void onSaveInstanceState(Bundle outState) { - outState.putBoolean("fair:manual", manual); - super.onSaveInstanceState(outState); - } - - @Override - public void onActivityCreated(@Nullable Bundle savedInstanceState) { - super.onActivityCreated(savedInstanceState); - - final DB db = DB.getInstance(getContext()); - final SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(getContext()); - db.account().liveSynchronizingAccounts().observe(getViewLifecycleOwner(), new Observer>() { private boolean done = false;