From ae1868c1f6440688774d88faf9c72d1ed85d22d3 Mon Sep 17 00:00:00 2001 From: Vitaliy Date: Tue, 9 Mar 2021 01:50:35 +0200 Subject: [PATCH] Small fix for action name --- .../quickaction/CreateEditActionDialog.java | 25 +++++++++---------- 1 file changed, 12 insertions(+), 13 deletions(-) diff --git a/OsmAnd/src/net/osmand/plus/quickaction/CreateEditActionDialog.java b/OsmAnd/src/net/osmand/plus/quickaction/CreateEditActionDialog.java index abb8ff3210..819c0b9b77 100644 --- a/OsmAnd/src/net/osmand/plus/quickaction/CreateEditActionDialog.java +++ b/OsmAnd/src/net/osmand/plus/quickaction/CreateEditActionDialog.java @@ -197,13 +197,12 @@ public class CreateEditActionDialog extends DialogFragment } private void setupHeader(View root, Bundle savedInstanceState){ - 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; - name.setTextColor(ContextCompat.getColor(getContext(), buttonsAndLinksTextColorResId)); + nameEditText.setTextColor(ContextCompat.getColor(getContext(), buttonsAndLinksTextColorResId)); - name.addTextChangedListener(new TextWatcher() { + nameEditText.addTextChangedListener(new TextWatcher() { @Override public void beforeTextChanged(CharSequence charSequence, int i, int i1, int i2) { } @@ -218,20 +217,20 @@ public class CreateEditActionDialog extends DialogFragment } }); - name.setEnabled(action.isActionEditable()); - action.setAutoGeneratedTitle(name); + nameEditText.setEnabled(action.isActionEditable()); + action.setAutoGeneratedTitle(nameEditText); - String actionName = getString(R.string.quick_action_show_hide_title); - String resName = action.getName(getContext()); if (savedInstanceState == null) { + String name = action.getName(getContext()); 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 { - name.setText(action.getName(getContext())); + nameEditText.setText(name); } - } - else action.setName(name.getText().toString()); - + } else { + action.setName(nameEditText.getText().toString()); + } image.setImageResource(action.getIconRes(getApplication())); }