if the action name is available for editing, we should not show the "Show/hide – "

This commit is contained in:
androiddevkotlin 2021-03-25 00:59:57 +02:00
parent 67a2a447e7
commit 2c43cf8b93

View file

@ -220,9 +220,23 @@ public class CreateEditActionDialog extends DialogFragment
nameEditText.setEnabled(action.isActionEditable());
action.setAutoGeneratedTitle(nameEditText);
if (savedInstanceState == null) nameEditText.setText(action.getName(getContext()));
else action.setName(nameEditText.getText().toString());
if (savedInstanceState == null) {
String name = action.getName(getContext());
if (action.getActionNameRes() != 0 && !action.isActionEditable()) {
String actionName;
if (getString(action.getActionNameRes()).contains("Show/hide")) {
actionName = getString(action.getActionNameRes());
nameEditText.setText(getString(R.string.ltr_or_rtl_combine_via_dash, actionName, name));
} else {
actionName = "";
nameEditText.setText(getString(R.string.ltr_or_rtl_combine_via_space, actionName, name));
}
} else {
nameEditText.setText(name);
}
} else {
action.setName(nameEditText.getText().toString());
}
image.setImageResource(action.getIconRes(getApplication()));
}