Small behavior improvement

pull/162/head
M66B 5 years ago
parent a0fd45dab6
commit 5961e9ae49

@ -58,8 +58,9 @@ public class FragmentOptionsBehavior extends FragmentBase implements SharedPrefe
private SwitchCompat swDiscardDelete; private SwitchCompat swDiscardDelete;
private final static String[] RESET_OPTIONS = new String[]{ private final static String[] RESET_OPTIONS = new String[]{
"pull", "autoscroll", "doubletap", "swipenav", "reversed", "autoexpand", "expand_all", "expand_one", "autoclose", "onclose", "pull", "autoscroll", "doubletap", "swipenav", "reversed",
"collapse_single", "collapse_multiple", "autoread", "autounflag", "automove", "discard_delete" "autoexpand", "expand_all", "expand_one", "collapse_single", "collapse_multiple",
"autoclose", "onclose", "autoread", "autounflag", "automove", "discard_delete"
}; };
@Override @Override
@ -80,10 +81,10 @@ public class FragmentOptionsBehavior extends FragmentBase implements SharedPrefe
swAutoExpand = view.findViewById(R.id.swAutoExpand); swAutoExpand = view.findViewById(R.id.swAutoExpand);
swExpandAll = view.findViewById(R.id.swExpandAll); swExpandAll = view.findViewById(R.id.swExpandAll);
swExpandOne = view.findViewById(R.id.swExpandOne); swExpandOne = view.findViewById(R.id.swExpandOne);
swAutoClose = view.findViewById(R.id.swAutoClose);
spOnClose = view.findViewById(R.id.spOnClose);
swCollapseSingle = view.findViewById(R.id.swCollapseSingle); swCollapseSingle = view.findViewById(R.id.swCollapseSingle);
swCollapseMultiple = view.findViewById(R.id.swCollapseMultiple); swCollapseMultiple = view.findViewById(R.id.swCollapseMultiple);
swAutoClose = view.findViewById(R.id.swAutoClose);
spOnClose = view.findViewById(R.id.spOnClose);
swAutoRead = view.findViewById(R.id.swAutoRead); swAutoRead = view.findViewById(R.id.swAutoRead);
swAutoUnflag = view.findViewById(R.id.swAutoUnflag); swAutoUnflag = view.findViewById(R.id.swAutoUnflag);
swAutoMove = view.findViewById(R.id.swAutoMove); swAutoMove = view.findViewById(R.id.swAutoMove);
@ -142,6 +143,7 @@ public class FragmentOptionsBehavior extends FragmentBase implements SharedPrefe
public void onCheckedChanged(CompoundButton compoundButton, boolean checked) { public void onCheckedChanged(CompoundButton compoundButton, boolean checked) {
prefs.edit().putBoolean("expand_all", checked).apply(); prefs.edit().putBoolean("expand_all", checked).apply();
swExpandOne.setEnabled(!checked); swExpandOne.setEnabled(!checked);
swCollapseMultiple.setEnabled(!swExpandOne.isChecked() || swExpandAll.isChecked());
} }
}); });
@ -149,6 +151,21 @@ public class FragmentOptionsBehavior extends FragmentBase implements SharedPrefe
@Override @Override
public void onCheckedChanged(CompoundButton compoundButton, boolean checked) { public void onCheckedChanged(CompoundButton compoundButton, boolean checked) {
prefs.edit().putBoolean("expand_one", checked).apply(); prefs.edit().putBoolean("expand_one", checked).apply();
swCollapseMultiple.setEnabled(!swExpandOne.isChecked() || swExpandAll.isChecked());
}
});
swCollapseSingle.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
@Override
public void onCheckedChanged(CompoundButton compoundButton, boolean checked) {
prefs.edit().putBoolean("collapse_single", checked).apply();
}
});
swCollapseMultiple.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
@Override
public void onCheckedChanged(CompoundButton compoundButton, boolean checked) {
prefs.edit().putBoolean("collapse_multiple", checked).apply();
} }
}); });
@ -177,20 +194,6 @@ public class FragmentOptionsBehavior extends FragmentBase implements SharedPrefe
} }
}); });
swCollapseSingle.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
@Override
public void onCheckedChanged(CompoundButton compoundButton, boolean checked) {
prefs.edit().putBoolean("collapse_single", checked).apply();
}
});
swCollapseMultiple.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
@Override
public void onCheckedChanged(CompoundButton compoundButton, boolean checked) {
prefs.edit().putBoolean("collapse_multiple", checked).apply();
}
});
swAutoRead.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() { swAutoRead.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
@Override @Override
public void onCheckedChanged(CompoundButton compoundButton, boolean checked) { public void onCheckedChanged(CompoundButton compoundButton, boolean checked) {
@ -270,10 +273,15 @@ public class FragmentOptionsBehavior extends FragmentBase implements SharedPrefe
swDoubleTap.setChecked(prefs.getBoolean("doubletap", false)); swDoubleTap.setChecked(prefs.getBoolean("doubletap", false));
swSwipeNav.setChecked(prefs.getBoolean("swipenav", true)); swSwipeNav.setChecked(prefs.getBoolean("swipenav", true));
swReversed.setChecked(prefs.getBoolean("reversed", false)); swReversed.setChecked(prefs.getBoolean("reversed", false));
swAutoExpand.setChecked(prefs.getBoolean("autoexpand", true)); swAutoExpand.setChecked(prefs.getBoolean("autoexpand", true));
swExpandAll.setChecked(prefs.getBoolean("expand_all", false)); swExpandAll.setChecked(prefs.getBoolean("expand_all", false));
swExpandOne.setChecked(prefs.getBoolean("expand_one", true)); swExpandOne.setChecked(prefs.getBoolean("expand_one", true));
swExpandOne.setEnabled(!swExpandAll.isChecked()); swExpandOne.setEnabled(!swExpandAll.isChecked());
swCollapseSingle.setChecked(prefs.getBoolean("collapse_single", false));
swCollapseMultiple.setChecked(prefs.getBoolean("collapse_multiple", true));
swCollapseMultiple.setEnabled(!swExpandOne.isChecked() || swExpandAll.isChecked());
swAutoClose.setChecked(prefs.getBoolean("autoclose", true)); swAutoClose.setChecked(prefs.getBoolean("autoclose", true));
String onClose = prefs.getString("onclose", ""); String onClose = prefs.getString("onclose", "");
@ -286,8 +294,6 @@ public class FragmentOptionsBehavior extends FragmentBase implements SharedPrefe
spOnClose.setEnabled(!swAutoClose.isChecked()); spOnClose.setEnabled(!swAutoClose.isChecked());
swCollapseSingle.setChecked(prefs.getBoolean("collapse_single", false));
swCollapseMultiple.setChecked(prefs.getBoolean("collapse_multiple", true));
swAutoRead.setChecked(prefs.getBoolean("autoread", false)); swAutoRead.setChecked(prefs.getBoolean("autoread", false));
swAutoUnflag.setChecked(prefs.getBoolean("autounflag", false)); swAutoUnflag.setChecked(prefs.getBoolean("autounflag", false));
swAutoMove.setChecked(!prefs.getBoolean("automove", false)); swAutoMove.setChecked(!prefs.getBoolean("automove", false));

Loading…
Cancel
Save