Save manual state

pull/192/head
M66B 4 years ago
parent 3432b4ec74
commit 7273d840c8

@ -90,6 +90,8 @@ public class FragmentSetup extends FragmentBase {
private int colorWarning; private int colorWarning;
private Drawable check; private Drawable check;
private boolean manual = BuildConfig.DEBUG;
@Override @Override
@Nullable @Nullable
public View onCreateView(@NonNull LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) { public View onCreateView(@NonNull LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
@ -219,13 +221,9 @@ public class FragmentSetup extends FragmentBase {
ibManual.setOnClickListener(new View.OnClickListener() { ibManual.setOnClickListener(new View.OnClickListener() {
@Override @Override
public void onClick(View v) { public void onClick(View v) {
if (grpManual.getVisibility() == View.GONE) { manual = !manual;
ibManual.setImageLevel(0 /* less */); ibManual.setImageLevel(manual ? 0 /* less */ : 1 /* more */);
grpManual.setVisibility(View.VISIBLE); grpManual.setVisibility(manual ? View.VISIBLE : View.GONE);
} else {
ibManual.setImageLevel(1 /* more */);
grpManual.setVisibility(View.GONE);
}
} }
}); });
@ -238,8 +236,10 @@ public class FragmentSetup extends FragmentBase {
} }
}); });
ibManual.setImageLevel(BuildConfig.DEBUG ? 0 /* less */ : 1 /* more */); if (savedInstanceState != null)
grpManual.setVisibility(BuildConfig.DEBUG ? View.VISIBLE : View.GONE); manual = savedInstanceState.getBoolean("fair:manual");
ibManual.setImageLevel(manual ? 0 /* less */ : 1 /* more */);
grpManual.setVisibility(manual ? View.VISIBLE : View.GONE);
btnAccount.setOnClickListener(new View.OnClickListener() { btnAccount.setOnClickListener(new View.OnClickListener() {
@Override @Override
@ -366,6 +366,12 @@ public class FragmentSetup extends FragmentBase {
return view; return view;
} }
@Override
public void onSaveInstanceState(Bundle outState) {
outState.putBoolean("fair:manual", manual);
super.onSaveInstanceState(outState);
}
@Override @Override
public void onActivityCreated(@Nullable Bundle savedInstanceState) { public void onActivityCreated(@Nullable Bundle savedInstanceState) {
super.onActivityCreated(savedInstanceState); super.onActivityCreated(savedInstanceState);

Loading…
Cancel
Save