From 67a2a447e7363607aeeddf195c6645725e3fc8b6 Mon Sep 17 00:00:00 2001 From: androiddevkotlin <64539346+androiddevkotlin@users.noreply.github.com> Date: Thu, 25 Mar 2021 00:36:40 +0200 Subject: [PATCH 1/4] =?UTF-8?q?Revert=20change:=20Edit=20action=20screen,?= =?UTF-8?q?=20if=20the=20action=20name=20is=20available=20for=20editing,?= =?UTF-8?q?=20we=20should=20not=20show=20the=20"Show/hide=20=E2=80=93=20"?= =?UTF-8?q?=20part,=20because=20after=20deleting=20or=20changing=20this=20?= =?UTF-8?q?part=20it=20appears=20on=20the=20quick=20action=20bar=20anyway.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit https://github.com/osmandapp/OsmAnd/issues/10196 --- .../plus/quickaction/CreateEditActionDialog.java | 14 +++----------- 1 file changed, 3 insertions(+), 11 deletions(-) diff --git a/OsmAnd/src/net/osmand/plus/quickaction/CreateEditActionDialog.java b/OsmAnd/src/net/osmand/plus/quickaction/CreateEditActionDialog.java index 819c0b9b77..0a7b95f216 100644 --- a/OsmAnd/src/net/osmand/plus/quickaction/CreateEditActionDialog.java +++ b/OsmAnd/src/net/osmand/plus/quickaction/CreateEditActionDialog.java @@ -220,17 +220,9 @@ public class CreateEditActionDialog extends DialogFragment nameEditText.setEnabled(action.isActionEditable()); action.setAutoGeneratedTitle(nameEditText); - if (savedInstanceState == null) { - String name = action.getName(getContext()); - if (action.getActionNameRes() != 0) { - String actionName = getString(action.getActionNameRes()); - nameEditText.setText(getString(R.string.ltr_or_rtl_combine_via_dash, actionName, name)); - } else { - nameEditText.setText(name); - } - } else { - action.setName(nameEditText.getText().toString()); - } + if (savedInstanceState == null) nameEditText.setText(action.getName(getContext())); + else action.setName(nameEditText.getText().toString()); + image.setImageResource(action.getIconRes(getApplication())); } From 2c43cf8b936fbba4e257bc630865896c2ba99053 Mon Sep 17 00:00:00 2001 From: androiddevkotlin <64539346+androiddevkotlin@users.noreply.github.com> Date: Thu, 25 Mar 2021 00:59:57 +0200 Subject: [PATCH 2/4] =?UTF-8?q?if=20the=20action=20name=20is=20available?= =?UTF-8?q?=20for=20editing,=20we=20should=20not=20show=20the=20"Show/hide?= =?UTF-8?q?=20=E2=80=93=20"?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../quickaction/CreateEditActionDialog.java | 20 ++++++++++++++++--- 1 file changed, 17 insertions(+), 3 deletions(-) diff --git a/OsmAnd/src/net/osmand/plus/quickaction/CreateEditActionDialog.java b/OsmAnd/src/net/osmand/plus/quickaction/CreateEditActionDialog.java index 0a7b95f216..0ab34884e2 100644 --- a/OsmAnd/src/net/osmand/plus/quickaction/CreateEditActionDialog.java +++ b/OsmAnd/src/net/osmand/plus/quickaction/CreateEditActionDialog.java @@ -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())); } From 5d3e7fd0d246d76b2b71821c9f0d5d152735cbd7 Mon Sep 17 00:00:00 2001 From: androiddevkotlin <64539346+androiddevkotlin@users.noreply.github.com> Date: Thu, 25 Mar 2021 14:02:30 +0200 Subject: [PATCH 3/4] Review --- .../osmand/plus/quickaction/CreateEditActionDialog.java | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/OsmAnd/src/net/osmand/plus/quickaction/CreateEditActionDialog.java b/OsmAnd/src/net/osmand/plus/quickaction/CreateEditActionDialog.java index 0ab34884e2..f083caec60 100644 --- a/OsmAnd/src/net/osmand/plus/quickaction/CreateEditActionDialog.java +++ b/OsmAnd/src/net/osmand/plus/quickaction/CreateEditActionDialog.java @@ -223,13 +223,11 @@ public class CreateEditActionDialog extends DialogFragment 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()); + if (!name.contains(getString(R.string.quick_action_show_hide_title))) { + String 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)); + nameEditText.setText(name); } } else { nameEditText.setText(name); From 684b0cdeb511e00f5146e84999e26105a7f6e0b0 Mon Sep 17 00:00:00 2001 From: androiddevkotlin <64539346+androiddevkotlin@users.noreply.github.com> Date: Thu, 25 Mar 2021 14:38:49 +0200 Subject: [PATCH 4/4] Review2 --- .../plus/quickaction/CreateEditActionDialog.java | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) diff --git a/OsmAnd/src/net/osmand/plus/quickaction/CreateEditActionDialog.java b/OsmAnd/src/net/osmand/plus/quickaction/CreateEditActionDialog.java index f083caec60..84a3f7edbe 100644 --- a/OsmAnd/src/net/osmand/plus/quickaction/CreateEditActionDialog.java +++ b/OsmAnd/src/net/osmand/plus/quickaction/CreateEditActionDialog.java @@ -222,13 +222,10 @@ public class CreateEditActionDialog extends DialogFragment if (savedInstanceState == null) { String name = action.getName(getContext()); - if (action.getActionNameRes() != 0 && !action.isActionEditable()) { - if (!name.contains(getString(R.string.quick_action_show_hide_title))) { - String actionName = getString(action.getActionNameRes()); - nameEditText.setText(getString(R.string.ltr_or_rtl_combine_via_dash, actionName, name)); - } else { - nameEditText.setText(name); - } + if (!action.isActionEditable() && action.getActionNameRes() != 0 + && !name.contains(getString(action.getActionNameRes()))) { + String actionName = getString(action.getActionNameRes()); + nameEditText.setText(getString(R.string.ltr_or_rtl_combine_via_dash, actionName, name)); } else { nameEditText.setText(name); }