From 57174d7f25b49f3ae8a433974c7f61af5a8c4722 Mon Sep 17 00:00:00 2001 From: PavelRatushny Date: Thu, 21 Dec 2017 13:52:45 +0200 Subject: [PATCH] Fix divider in collapsable view --- .../osmand/plus/mapcontextmenu/MenuBuilder.java | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/OsmAnd/src/net/osmand/plus/mapcontextmenu/MenuBuilder.java b/OsmAnd/src/net/osmand/plus/mapcontextmenu/MenuBuilder.java index 6a628d4e5c..824a28a1d6 100644 --- a/OsmAnd/src/net/osmand/plus/mapcontextmenu/MenuBuilder.java +++ b/OsmAnd/src/net/osmand/plus/mapcontextmenu/MenuBuilder.java @@ -716,11 +716,7 @@ public class MenuBuilder { ); } - private void buildTransportRouteRow(ViewGroup parent, TransportStopRoute r, OnClickListener listener) { - if (!isFirstRow()) { - buildRowDivider(parent, false); - } - + private void buildTransportRouteRow(ViewGroup parent, TransportStopRoute r, OnClickListener listener, boolean showDivider) { View view = LayoutInflater.from(parent.getContext()).inflate(R.layout.ctx_menu_transport_route_layout, parent, false); TextView routeDesc = (TextView) view.findViewById(R.id.route_desc); routeDesc.setText(r.getDescription(getMapActivity().getMyApplication(), true)); @@ -775,13 +771,16 @@ public class MenuBuilder { parent.addView(view); - rowBuilt(); + if (showDivider) { + buildRowDivider(parent, false); + } } private CollapsableView getCollapsableTransportStopRoutesView(final Context context, boolean collapsed) { LinearLayout view = (LinearLayout) buildCollapsableContentView(context, collapsed, false); - for (final TransportStopRoute r : routes) { + for (int i = 0; i < routes.size(); i++) { + final TransportStopRoute r = routes.get(i); View.OnClickListener listener = new View.OnClickListener() { @Override public void onClick(View arg0) { @@ -795,7 +794,8 @@ public class MenuBuilder { getMapActivity().changeZoom(cz - getMapActivity().getMapView().getZoom()); } }; - buildTransportRouteRow(view, r, listener); + boolean showDivider = i < routes.size() - 1; + buildTransportRouteRow(view, r, listener, showDivider); } return new CollapsableView(view, collapsed);