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) { public void build(View view) {
firstRow = true; firstRow = true;
hidden = false; hidden = false;
if (showTransportRoutes()) { buildTopInternal(view);
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);
if (showTitleIfTruncated) { if (showTitleIfTruncated) {
buildTitleRow(view); buildTitleRow(view);
} }
@ -320,6 +309,7 @@ public class MenuBuilder {
if (needBuildPlainMenuItems()) { if (needBuildPlainMenuItems()) {
buildPlainMenuItems(view); buildPlainMenuItems(view);
} }
buildInternal(view);
if (showOnlinePhotos) { if (showOnlinePhotos) {
buildNearestPhotosRow(view); buildNearestPhotosRow(view);
} }
@ -448,6 +438,20 @@ public class MenuBuilder {
protected void buildInternal(View view) { 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) { protected void buildAfter(View view) {
buildRowDivider(view); buildRowDivider(view);
} }

View file

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

View file

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