Small behavior improvement

pull/187/head
M66B 4 years ago
parent f894c81390
commit fdcb62fb95

@ -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() {

Loading…
Cancel
Save