Save manual state

This commit is contained in:
M66B 2021-01-24 10:15:16 +01:00
parent 3432b4ec74
commit 7273d840c8
1 changed files with 15 additions and 9 deletions

View File

@ -90,6 +90,8 @@ public class FragmentSetup extends FragmentBase {
private int colorWarning;
private Drawable check;
private boolean manual = BuildConfig.DEBUG;
@Override
@Nullable
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() {
@Override
public void onClick(View v) {
if (grpManual.getVisibility() == View.GONE) {
ibManual.setImageLevel(0 /* less */);
grpManual.setVisibility(View.VISIBLE);
} else {
ibManual.setImageLevel(1 /* more */);
grpManual.setVisibility(View.GONE);
}
manual = !manual;
ibManual.setImageLevel(manual ? 0 /* less */ : 1 /* more */);
grpManual.setVisibility(manual ? View.VISIBLE : View.GONE);
}
});
@ -238,8 +236,10 @@ public class FragmentSetup extends FragmentBase {
}
});
ibManual.setImageLevel(BuildConfig.DEBUG ? 0 /* less */ : 1 /* more */);
grpManual.setVisibility(BuildConfig.DEBUG ? View.VISIBLE : View.GONE);
if (savedInstanceState != null)
manual = savedInstanceState.getBoolean("fair:manual");
ibManual.setImageLevel(manual ? 0 /* less */ : 1 /* more */);
grpManual.setVisibility(manual ? View.VISIBLE : View.GONE);
btnAccount.setOnClickListener(new View.OnClickListener() {
@Override
@ -366,6 +366,12 @@ public class FragmentSetup extends FragmentBase {
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);