Refactoring

pull/192/head
M66B 4 years ago
parent dbf70257ca
commit 8ca5f55127

@ -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<Void>() {
@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<List<EntityAccount>>() {
private boolean done = false;

Loading…
Cancel
Save