Small fix for action name

This commit is contained in:
Vitaliy 2021-03-09 01:50:35 +02:00
parent d8e36b17db
commit ae1868c1f6

View file

@ -197,13 +197,12 @@ public class CreateEditActionDialog extends DialogFragment
} }
private void setupHeader(View root, Bundle savedInstanceState){ private void setupHeader(View root, Bundle savedInstanceState){
ImageView image = (ImageView) root.findViewById(R.id.image); ImageView image = (ImageView) root.findViewById(R.id.image);
EditText name = (EditText) root.findViewById(R.id.name); EditText nameEditText = (EditText) root.findViewById(R.id.name);
int buttonsAndLinksTextColorResId = isLightContent ? R.color.active_buttons_and_links_text_light : R.color.active_buttons_and_links_text_dark; int buttonsAndLinksTextColorResId = isLightContent ? R.color.active_buttons_and_links_text_light : R.color.active_buttons_and_links_text_dark;
name.setTextColor(ContextCompat.getColor(getContext(), buttonsAndLinksTextColorResId)); nameEditText.setTextColor(ContextCompat.getColor(getContext(), buttonsAndLinksTextColorResId));
name.addTextChangedListener(new TextWatcher() { nameEditText.addTextChangedListener(new TextWatcher() {
@Override @Override
public void beforeTextChanged(CharSequence charSequence, int i, int i1, int i2) { public void beforeTextChanged(CharSequence charSequence, int i, int i1, int i2) {
} }
@ -218,20 +217,20 @@ public class CreateEditActionDialog extends DialogFragment
} }
}); });
name.setEnabled(action.isActionEditable()); nameEditText.setEnabled(action.isActionEditable());
action.setAutoGeneratedTitle(name); action.setAutoGeneratedTitle(nameEditText);
String actionName = getString(R.string.quick_action_show_hide_title);
String resName = action.getName(getContext());
if (savedInstanceState == null) { if (savedInstanceState == null) {
String name = action.getName(getContext());
if (action.getActionNameRes() != 0) { if (action.getActionNameRes() != 0) {
name.setText(getString(R.string.ltr_or_rtl_combine_via_dash, actionName, resName)); String actionName = getString(action.getActionNameRes());
nameEditText.setText(getString(R.string.ltr_or_rtl_combine_via_dash, actionName, name));
} else { } else {
name.setText(action.getName(getContext())); nameEditText.setText(name);
} }
} } else {
else action.setName(name.getText().toString()); action.setName(nameEditText.getText().toString());
}
image.setImageResource(action.getIconRes(getApplication())); image.setImageResource(action.getIconRes(getApplication()));
} }