Fix divider in collapsable view

This commit is contained in:
PavelRatushny 2017-12-21 13:52:45 +02:00
parent ca46ae4760
commit 57174d7f25

View file

@ -716,11 +716,7 @@ public class MenuBuilder {
); );
} }
private void buildTransportRouteRow(ViewGroup parent, TransportStopRoute r, OnClickListener listener) { private void buildTransportRouteRow(ViewGroup parent, TransportStopRoute r, OnClickListener listener, boolean showDivider) {
if (!isFirstRow()) {
buildRowDivider(parent, false);
}
View view = LayoutInflater.from(parent.getContext()).inflate(R.layout.ctx_menu_transport_route_layout, parent, false); 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); TextView routeDesc = (TextView) view.findViewById(R.id.route_desc);
routeDesc.setText(r.getDescription(getMapActivity().getMyApplication(), true)); routeDesc.setText(r.getDescription(getMapActivity().getMyApplication(), true));
@ -775,13 +771,16 @@ public class MenuBuilder {
parent.addView(view); parent.addView(view);
rowBuilt(); if (showDivider) {
buildRowDivider(parent, false);
}
} }
private CollapsableView getCollapsableTransportStopRoutesView(final Context context, boolean collapsed) { private CollapsableView getCollapsableTransportStopRoutesView(final Context context, boolean collapsed) {
LinearLayout view = (LinearLayout) buildCollapsableContentView(context, collapsed, false); 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() { View.OnClickListener listener = new View.OnClickListener() {
@Override @Override
public void onClick(View arg0) { public void onClick(View arg0) {
@ -795,7 +794,8 @@ public class MenuBuilder {
getMapActivity().changeZoom(cz - getMapActivity().getMapView().getZoom()); 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); return new CollapsableView(view, collapsed);