From 0b361afaec5fe7f70a9ca5cb16688b9cdabc9b43 Mon Sep 17 00:00:00 2001 From: androiddevkotlin <64539346+androiddevkotlin@users.noreply.github.com> Date: Mon, 29 Mar 2021 16:44:38 +0300 Subject: [PATCH 1/3] Quick action list fix for show/hide for editable items --- .../osmand/plus/quickaction/QuickActionListFragment.java | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/OsmAnd/src/net/osmand/plus/quickaction/QuickActionListFragment.java b/OsmAnd/src/net/osmand/plus/quickaction/QuickActionListFragment.java index ec282deb4c..b750aac1a1 100644 --- a/OsmAnd/src/net/osmand/plus/quickaction/QuickActionListFragment.java +++ b/OsmAnd/src/net/osmand/plus/quickaction/QuickActionListFragment.java @@ -593,7 +593,13 @@ public class QuickActionListFragment extends BaseOsmAndFragment List actions = getQuickActions(); int actionGlobalPosition = actions.indexOf(action); int actionPosition = actionGlobalPosition % ITEMS_IN_GROUP + 1; - h.title.setText(action.getName(app)); + int test = action.getType(); + if (test == 5) { + String prefAction = getString(R.string.quick_action_show_hide_title); + h.title.setText(getString(R.string.ltr_or_rtl_combine_via_dash, prefAction, action.getName(app))); + } else { + h.title.setText(action.getName(app)); + } h.subTitle.setText(getResources().getString(R.string.quick_action_item_action, actionPosition)); h.icon.setImageDrawable(getContentIcon(action.getIconRes(app))); From 896ae118789a6b49b48a185ea13e66a52da9ecab Mon Sep 17 00:00:00 2001 From: androiddevkotlin <64539346+androiddevkotlin@users.noreply.github.com> Date: Mon, 29 Mar 2021 19:34:44 +0300 Subject: [PATCH 2/3] Add constant, rename variable --- .../osmand/plus/quickaction/QuickActionListFragment.java | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/OsmAnd/src/net/osmand/plus/quickaction/QuickActionListFragment.java b/OsmAnd/src/net/osmand/plus/quickaction/QuickActionListFragment.java index b750aac1a1..6a9cd6c310 100644 --- a/OsmAnd/src/net/osmand/plus/quickaction/QuickActionListFragment.java +++ b/OsmAnd/src/net/osmand/plus/quickaction/QuickActionListFragment.java @@ -72,6 +72,8 @@ public class QuickActionListFragment extends BaseOsmAndFragment private static final int ITEMS_IN_GROUP = 6; + public static final int GROUP_POI_ID = 5; + private RecyclerView rv; private FloatingActionButton fab; private View bottomPanel; @@ -593,8 +595,8 @@ public class QuickActionListFragment extends BaseOsmAndFragment List actions = getQuickActions(); int actionGlobalPosition = actions.indexOf(action); int actionPosition = actionGlobalPosition % ITEMS_IN_GROUP + 1; - int test = action.getType(); - if (test == 5) { + int actionType = action.getType(); + if (actionType == GROUP_POI_ID) { String prefAction = getString(R.string.quick_action_show_hide_title); h.title.setText(getString(R.string.ltr_or_rtl_combine_via_dash, prefAction, action.getName(app))); } else { From 5e1a5e8d3eaebea78e2baec9bea6fc4863152cf5 Mon Sep 17 00:00:00 2001 From: androiddevkotlin <64539346+androiddevkotlin@users.noreply.github.com> Date: Mon, 29 Mar 2021 20:43:41 +0300 Subject: [PATCH 3/3] Review --- .../plus/quickaction/QuickActionListFragment.java | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/OsmAnd/src/net/osmand/plus/quickaction/QuickActionListFragment.java b/OsmAnd/src/net/osmand/plus/quickaction/QuickActionListFragment.java index 6a9cd6c310..28981e5db6 100644 --- a/OsmAnd/src/net/osmand/plus/quickaction/QuickActionListFragment.java +++ b/OsmAnd/src/net/osmand/plus/quickaction/QuickActionListFragment.java @@ -72,8 +72,6 @@ public class QuickActionListFragment extends BaseOsmAndFragment private static final int ITEMS_IN_GROUP = 6; - public static final int GROUP_POI_ID = 5; - private RecyclerView rv; private FloatingActionButton fab; private View bottomPanel; @@ -595,12 +593,12 @@ public class QuickActionListFragment extends BaseOsmAndFragment List actions = getQuickActions(); int actionGlobalPosition = actions.indexOf(action); int actionPosition = actionGlobalPosition % ITEMS_IN_GROUP + 1; - int actionType = action.getType(); - if (actionType == GROUP_POI_ID) { - String prefAction = getString(R.string.quick_action_show_hide_title); + String name = action.getName(app); + if (action.getActionNameRes() != 0 && !name.contains(getString(action.getActionNameRes()))) { + String prefAction = getString(action.getActionNameRes()); h.title.setText(getString(R.string.ltr_or_rtl_combine_via_dash, prefAction, action.getName(app))); } else { - h.title.setText(action.getName(app)); + h.title.setText(name); } h.subTitle.setText(getResources().getString(R.string.quick_action_item_action, actionPosition)); h.icon.setImageDrawable(getContentIcon(action.getIconRes(app)));