Small behavior improvement

pull/214/head
M66B 1 year ago
parent 11dcfd2c96
commit 395997842a

@ -233,6 +233,23 @@ public class FragmentDialogSend extends FragmentDialogBase {
} }
}); });
Runnable evalMore = new RunnableEx("more") {
@Override
protected void delegate() {
boolean warning = (grpMore.getVisibility() != View.VISIBLE &&
cbPlainOnly.isChecked() && styled);
int color = Helper.resolveColor(tvMore.getContext(), warning ? R.attr.colorWarning : android.R.attr.textColorSecondary);
ibMore.setImageTintList(ColorStateList.valueOf(color));
tvMore.setTextColor(color);
tvMore.setTypeface(warning ? Typeface.DEFAULT_BOLD : Typeface.DEFAULT);
tvMore.setCompoundDrawablesRelativeWithIntrinsicBounds(
0, 0,
warning ? R.drawable.twotone_warning_24 : 0, 0);
}
};
evalMore.run();
View.OnClickListener onMore = new View.OnClickListener() { View.OnClickListener onMore = new View.OnClickListener() {
@Override @Override
public void onClick(View v) { public void onClick(View v) {
@ -247,6 +264,7 @@ public class FragmentDialogSend extends FragmentDialogBase {
tvReceiptHint.setVisibility(cbReceipt.isChecked() ? View.VISIBLE : View.GONE); tvReceiptHint.setVisibility(cbReceipt.isChecked() ? View.VISIBLE : View.GONE);
grpMore.setVisibility(View.VISIBLE); grpMore.setVisibility(View.VISIBLE);
} }
evalMore.run();
prefs.edit().putBoolean("send_more", grpMore.getVisibility() == View.VISIBLE).apply(); prefs.edit().putBoolean("send_more", grpMore.getVisibility() == View.VISIBLE).apply();
} }
}; };
@ -254,22 +272,6 @@ public class FragmentDialogSend extends FragmentDialogBase {
ibMore.setOnClickListener(onMore); ibMore.setOnClickListener(onMore);
tvMore.setOnClickListener(onMore); tvMore.setOnClickListener(onMore);
Runnable evalMore = new RunnableEx("more") {
@Override
protected void delegate() {
boolean warning = (cbPlainOnly.isChecked() && styled);
int color = Helper.resolveColor(tvMore.getContext(), warning ? R.attr.colorWarning : android.R.attr.textColorSecondary);
ibMore.setImageTintList(ColorStateList.valueOf(color));
tvMore.setTextColor(color);
tvMore.setTypeface(warning ? Typeface.DEFAULT_BOLD : Typeface.DEFAULT);
tvMore.setCompoundDrawablesRelativeWithIntrinsicBounds(
0, 0,
warning ? R.drawable.twotone_warning_24 : 0, 0);
}
};
evalMore.run();
cbPlainOnly.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() { cbPlainOnly.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
@Override @Override
public void onCheckedChanged(CompoundButton compoundButton, boolean checked) { public void onCheckedChanged(CompoundButton compoundButton, boolean checked) {

Loading…
Cancel
Save