1
0
Fork 0
mirror of https://github.com/M66B/FairEmail.git synced 2024-12-24 16:53:37 +00:00

Small behavior improvement

This commit is contained in:
M66B 2020-10-27 23:10:44 +01:00
parent f894c81390
commit fdcb62fb95

View file

@ -470,20 +470,20 @@ public class FragmentCompose extends FragmentBase {
});
etBody.setSelectionListener(new EditTextCompose.ISelection() {
private boolean style = false;
private boolean styling = false;
@Override
public void onSelected(boolean selection) {
public void onSelected(final boolean selection) {
if (media) {
style = selection;
getMainHandler().postDelayed(new Runnable() {
@Override
public void run() {
if (style != styling) {
styling = style;
if (styling != selection) {
styling = selection;
media_bar.getMenu().clear();
media_bar.inflateMenu(styling ? R.menu.action_compose_style_alt : R.menu.action_compose_media);
media_bar.inflateMenu(styling
? R.menu.action_compose_style_alt
: R.menu.action_compose_media);
}
}
}, 20);
@ -1550,9 +1550,11 @@ public class FragmentCompose extends FragmentBase {
media = !media;
SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(getContext());
prefs.edit().putBoolean("compose_media", media).apply();
media_bar.setVisibility(media ? View.VISIBLE : View.GONE);
etBody.setSelection(etBody.getSelectionStart());
media_bar.getMenu().clear();
media_bar.inflateMenu(media && etBody.hasSelection() ? R.menu.action_compose_style_alt : R.menu.action_compose_media);
media_bar.inflateMenu(R.menu.action_compose_media);
media_bar.setVisibility(media ? View.VISIBLE : View.GONE);
style_bar.setVisibility(View.GONE);
}
private void onMenuCompact() {