1
0
Fork 0
mirror of https://github.com/M66B/FairEmail.git synced 2025-01-03 13:44:40 +00:00

Refactoring

This commit is contained in:
M66B 2021-01-24 10:18:19 +01:00
parent dbf70257ca
commit 8ca5f55127

View file

@ -133,8 +133,6 @@ public class FragmentSetup extends FragmentBase {
grpManual = view.findViewById(R.id.grpManual); grpManual = view.findViewById(R.id.grpManual);
grpDataSaver = view.findViewById(R.id.grpDataSaver); grpDataSaver = view.findViewById(R.id.grpDataSaver);
PackageManager pm = getContext().getPackageManager();
// Wire controls // Wire controls
ibHelp.setOnClickListener(new View.OnClickListener() { ibHelp.setOnClickListener(new View.OnClickListener() {
@ -307,6 +305,8 @@ public class FragmentSetup extends FragmentBase {
startActivity(settings); startActivity(settings);
} }
}); });
PackageManager pm = getContext().getPackageManager();
btnDataSaver.setEnabled(settings.resolveActivity(pm) != null); // system whitelisted btnDataSaver.setEnabled(settings.resolveActivity(pm) != null); // system whitelisted
} }
@ -334,6 +334,22 @@ public class FragmentSetup extends FragmentBase {
setContactsPermission(hasPermission(Manifest.permission.READ_CONTACTS)); 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 // Create outbox
new SimpleTask<Void>() { new SimpleTask<Void>() {
@Override @Override
@ -362,22 +378,6 @@ public class FragmentSetup extends FragmentBase {
} }
}.execute(this, new Bundle(), "outbox:create"); }.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<List<EntityAccount>>() { db.account().liveSynchronizingAccounts().observe(getViewLifecycleOwner(), new Observer<List<EntityAccount>>() {
private boolean done = false; private boolean done = false;