added buildTopInternal method, which creates top row with routes or group items

This commit is contained in:
Chumva 2018-02-21 11:49:30 +02:00
parent bb4456af56
commit 7901516c4d
3 changed files with 27 additions and 14 deletions

View file

@ -301,18 +301,7 @@ public class MenuBuilder {
public void build(View view) {
firstRow = true;
hidden = false;
if (showTransportRoutes()) {
buildRow(view, 0, null, app.getString(R.string.transport_Routes), 0, true, getCollapsableTransportStopRoutesView(view.getContext(), false, false),
false, 0, false, null, true);
CollapsableView collapsableView = getCollapsableTransportStopRoutesView(view.getContext(), false, true);
if (collapsableView != null) {
String routesWithingDistance = app.getString(R.string.transport_nearby_routes_within) + " " + OsmAndFormatter.getFormattedDistance(TransportStopController.SHOW_STOPS_RADIUS_METERS,app);
buildRow(view, 0, null, routesWithingDistance, 0, true, collapsableView,
false, 0, false, null, true);
}
}
buildInternal(view);
buildTopInternal(view);
if (showTitleIfTruncated) {
buildTitleRow(view);
}
@ -320,6 +309,7 @@ public class MenuBuilder {
if (needBuildPlainMenuItems()) {
buildPlainMenuItems(view);
}
buildInternal(view);
if (showOnlinePhotos) {
buildNearestPhotosRow(view);
}
@ -448,6 +438,20 @@ public class MenuBuilder {
protected void buildInternal(View view) {
}
protected void buildTopInternal(View view) {
if (showTransportRoutes()) {
buildRow(view, 0, null, app.getString(R.string.transport_Routes), 0, true, getCollapsableTransportStopRoutesView(view.getContext(), false, false),
false, 0, false, null, true);
CollapsableView collapsableView = getCollapsableTransportStopRoutesView(view.getContext(), false, true);
if (collapsableView != null) {
String routesWithingDistance = app.getString(R.string.transport_nearby_routes_within) + " " + OsmAndFormatter.getFormattedDistance(TransportStopController.SHOW_STOPS_RADIUS_METERS, app);
buildRow(view, 0, null, routesWithingDistance, 0, true, collapsableView,
false, 0, false, null, true);
}
}
}
protected void buildAfter(View view) {
buildRowDivider(view);
}

View file

@ -63,8 +63,12 @@ public class FavouritePointMenuBuilder extends MenuBuilder {
}
@Override
public void buildInternal(View view) {
protected void buildTopInternal(View view) {
super.buildTopInternal(view);
buildGroupFavouritesView(view);
}
@Override
public void buildInternal(View view) {
if (originObject != null && originObject instanceof Amenity) {
AmenityMenuBuilder builder = new AmenityMenuBuilder(mapActivity, (Amenity) originObject);
builder.setLatLon(getLatLon());

View file

@ -46,8 +46,13 @@ public class WptPtMenuBuilder extends MenuBuilder {
}
@Override
public void buildInternal(View view) {
protected void buildTopInternal(View view) {
super.buildTopInternal(view);
buildWaypointsView(view);
}
@Override
public void buildInternal(View view) {
if (wpt.time > 0) {
DateFormat dateFormat = android.text.format.DateFormat.getMediumDateFormat(view.getContext());
DateFormat timeFormat = android.text.format.DateFormat.getTimeFormat(view.getContext());