From 4054c89735df1ee9117dc17f9bd6d24c20aa1626 Mon Sep 17 00:00:00 2001 From: Dzmitry Yarmolenka <86627724+Endem10n@users.noreply.github.com> Date: Sun, 11 Jul 2021 09:24:46 +0200 Subject: [PATCH] [android] swap "bookmarks" and "route from" buttons on place page. (#814) * [android] swap two buttons on place page. Better UX while adding new bookmarks. Signed-off-by: Dzmitry Yarmolenka * [android] change to better UX variant: bookmark button always first in the toolbar. Signed-off-by: Dzmitry Yarmolenka * [android] changed toolbar to fix order at the beginning: "Bookmarks" -> "Route from" -> "Route to". Signed-off-by: Dzmitry Yarmolenka * [android] made toolbar buttons logic consistent to iOS. Current implementation is as described in ticket initially. Signed-off-by: Dzmitry Yarmolenka * [android] Fixes according to code review to fit common code style. Signed-off-by: Dzmitry Yarmolenka --- .../maps/widget/placepage/PlacePageView.java | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/android/src/com/mapswithme/maps/widget/placepage/PlacePageView.java b/android/src/com/mapswithme/maps/widget/placepage/PlacePageView.java index efe0e9c375..11669c4f7f 100644 --- a/android/src/com/mapswithme/maps/widget/placepage/PlacePageView.java +++ b/android/src/com/mapswithme/maps/widget/placepage/PlacePageView.java @@ -4,7 +4,6 @@ import android.content.Context; import android.content.res.Resources; import android.content.res.TypedArray; import android.graphics.Color; -import android.graphics.drawable.Drawable; import android.location.Location; import android.os.Build; import android.text.Html; @@ -959,15 +958,23 @@ public class PlacePageView extends NestedScrollViewClickFixed if (showBackButton || ParsedMwmRequest.isPickPointMode()) buttons.add(PlacePageButtons.Item.BACK); - if (mapObject.hasPhoneNumber()) + final boolean hasNumber = mapObject.hasPhoneNumber(); + + if (hasNumber) buttons.add(PlacePageButtons.Item.CALL); + boolean needToShowRoutingButtons = RoutingController.get().isPlanning() || showRoutingButton; + + if (needToShowRoutingButtons && !hasNumber) + buttons.add(PlacePageButtons.Item.ROUTE_FROM); + buttons.add(PlacePageButtons.Item.BOOKMARK); - if (RoutingController.get().isPlanning() || showRoutingButton) + if (needToShowRoutingButtons) { - buttons.add(PlacePageButtons.Item.ROUTE_FROM); buttons.add(PlacePageButtons.Item.ROUTE_TO); + if (hasNumber) + buttons.add(PlacePageButtons.Item.ROUTE_FROM); if (RoutingController.get().isStopPointAllowed()) buttons.add(PlacePageButtons.Item.ROUTE_ADD); }