refactored const
This commit is contained in:
parent
37f6b89bd7
commit
56e2912b39
5 changed files with 8 additions and 20 deletions
|
@ -798,6 +798,7 @@ public class MapContextMenu extends MenuTitleController implements StateChangedL
|
|||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
public List<TransportStopRoute> getNearbyTransportStopRoutes() {
|
||||
if (menuController != null) {
|
||||
return menuController.getNearbyTransportStopRoutes();
|
||||
|
|
|
@ -60,7 +60,7 @@ import net.osmand.plus.views.TransportStopsLayer;
|
|||
import net.osmand.plus.views.controls.HorizontalSwipeConfirm;
|
||||
import net.osmand.plus.views.controls.SingleTapConfirm;
|
||||
import net.osmand.util.Algorithms;
|
||||
import java.util.ArrayList;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import static android.util.TypedValue.COMPLEX_UNIT_DIP;
|
||||
|
@ -507,7 +507,7 @@ public class MapContextMenuFragment extends BaseOsmAndFragment implements Downlo
|
|||
}
|
||||
if (nearbyTransportStopRoutes != null && nearbyTransportStopRoutes.size() > 0) {
|
||||
String nearInDistance = getMyApplication().getString(R.string.transport_nearby_routes) + " "
|
||||
+ OsmAndFormatter.getFormattedDistance(TransportStopController.RADIUS, getMyApplication());
|
||||
+ OsmAndFormatter.getFormattedDistance(TransportStopController.SHOW_STOPS_RADIUS_IN_METERS, getMyApplication());
|
||||
nearbRoutesWithinTv.setText(nearInDistance);
|
||||
nearbyTransportStopRoutesGrid.setAdapter(createTransportStopRouteAdapter(nearbyTransportStopRoutes));
|
||||
nearbyTransportStopRoutesGrid.setVisibility(View.VISIBLE);
|
||||
|
|
|
@ -31,23 +31,17 @@ import android.widget.Toast;
|
|||
import net.osmand.AndroidUtils;
|
||||
import net.osmand.binary.BinaryMapIndexReader;
|
||||
import net.osmand.data.Amenity;
|
||||
import net.osmand.data.FavouritePoint;
|
||||
import net.osmand.data.LatLon;
|
||||
import net.osmand.data.PointDescription;
|
||||
import net.osmand.data.QuadRect;
|
||||
import net.osmand.osm.PoiCategory;
|
||||
import net.osmand.plus.FavouritesDbHelper.FavoriteGroup;
|
||||
import net.osmand.plus.GPXUtilities.GPXFile;
|
||||
import net.osmand.plus.GPXUtilities.WptPt;
|
||||
import net.osmand.plus.IconsCache;
|
||||
import net.osmand.plus.OsmAndAppCustomization;
|
||||
import net.osmand.plus.OsmAndFormatter;
|
||||
import net.osmand.plus.OsmandApplication;
|
||||
import net.osmand.plus.OsmandPlugin;
|
||||
import net.osmand.plus.OsmandSettings.OsmandPreference;
|
||||
import net.osmand.plus.R;
|
||||
import net.osmand.plus.activities.MapActivity;
|
||||
import net.osmand.plus.activities.TrackActivity;
|
||||
import net.osmand.plus.helpers.FontCache;
|
||||
import net.osmand.plus.mapcontextmenu.builders.cards.AbstractCard;
|
||||
import net.osmand.plus.mapcontextmenu.builders.cards.CardsRowBuilder;
|
||||
|
@ -56,7 +50,6 @@ import net.osmand.plus.mapcontextmenu.builders.cards.ImageCard.GetImageCardsTask
|
|||
import net.osmand.plus.mapcontextmenu.builders.cards.NoImagesCard;
|
||||
import net.osmand.plus.mapcontextmenu.controllers.TransportStopController;
|
||||
import net.osmand.plus.transport.TransportStopRoute;
|
||||
import net.osmand.plus.myplaces.FavoritesActivity;
|
||||
import net.osmand.plus.render.RenderingIcons;
|
||||
import net.osmand.plus.views.TransportStopsLayer;
|
||||
import net.osmand.plus.widgets.TextViewEx;
|
||||
|
@ -317,7 +310,7 @@ public class MenuBuilder {
|
|||
|
||||
CollapsableView collapsableView = getCollapsableTransportStopRoutesView(view.getContext(), false, true);
|
||||
if (collapsableView != null) {
|
||||
String routesWithingDistance = app.getString(R.string.transport_nearby_routes_within) + " " + OsmAndFormatter.getFormattedDistance(TransportStopController.RADIUS,app);
|
||||
String routesWithingDistance = app.getString(R.string.transport_nearby_routes_within) + " " + OsmAndFormatter.getFormattedDistance(TransportStopController.SHOW_STOPS_RADIUS_IN_METERS,app);
|
||||
buildRow(view, 0, null, routesWithingDistance, 0, true, collapsableView,
|
||||
false, 0, false, null, true);
|
||||
}
|
||||
|
|
|
@ -523,13 +523,13 @@ public abstract class MenuController extends BaseMenuController implements Colla
|
|||
return null;
|
||||
}
|
||||
|
||||
private List<TransportStopRoute> getSubTransportStopRoutes(boolean isNearby) {
|
||||
private List<TransportStopRoute> getSubTransportStopRoutes(boolean nearby) {
|
||||
List<TransportStopRoute> allRoutes = getTransportStopRoutes();
|
||||
if (allRoutes != null) {
|
||||
List<TransportStopRoute> res = new ArrayList<>();
|
||||
for (TransportStopRoute route : allRoutes) {
|
||||
boolean isCurrentRouteNearby = route.refStop != null && !route.refStop.getName().equals(route.stop.getName());
|
||||
if (isNearby) {
|
||||
if (nearby) {
|
||||
if (isCurrentRouteNearby) {
|
||||
res.add(route);
|
||||
}
|
||||
|
|
|
@ -1,9 +1,5 @@
|
|||
package net.osmand.plus.mapcontextmenu.controllers;
|
||||
|
||||
import android.view.View;
|
||||
import android.view.View.OnClickListener;
|
||||
|
||||
import net.osmand.data.LatLon;
|
||||
import net.osmand.data.PointDescription;
|
||||
import net.osmand.data.QuadRect;
|
||||
import net.osmand.data.TransportRoute;
|
||||
|
@ -11,12 +7,10 @@ import net.osmand.data.TransportStop;
|
|||
import net.osmand.plus.R;
|
||||
import net.osmand.plus.transport.TransportStopRoute;
|
||||
import net.osmand.plus.activities.MapActivity;
|
||||
import net.osmand.plus.mapcontextmenu.MapContextMenu;
|
||||
import net.osmand.plus.mapcontextmenu.MenuBuilder;
|
||||
import net.osmand.plus.mapcontextmenu.MenuController;
|
||||
import net.osmand.plus.resources.TransportIndexRepository;
|
||||
import net.osmand.plus.transport.TransportStopType;
|
||||
import net.osmand.plus.views.TransportStopsLayer;
|
||||
import net.osmand.util.Algorithms;
|
||||
import net.osmand.util.MapUtils;
|
||||
|
||||
|
@ -28,7 +22,7 @@ import java.util.List;
|
|||
|
||||
public class TransportStopController extends MenuController {
|
||||
|
||||
public static final int RADIUS =150;
|
||||
public static final int SHOW_STOPS_RADIUS_IN_METERS = 150;
|
||||
|
||||
private TransportStop transportStop;
|
||||
private List<TransportStopRoute> routes = new ArrayList<>();
|
||||
|
@ -103,7 +97,7 @@ public class TransportStopController extends MenuController {
|
|||
addRoutes(routes, useEnglishNames, t, transportStop, transportStop, 0);
|
||||
}
|
||||
ArrayList<TransportStop> ls = new ArrayList<>();
|
||||
QuadRect ll = MapUtils.calculateLatLonBbox(transportStop.getLocation().getLatitude(), transportStop.getLocation().getLongitude(), RADIUS);
|
||||
QuadRect ll = MapUtils.calculateLatLonBbox(transportStop.getLocation().getLatitude(), transportStop.getLocation().getLongitude(), SHOW_STOPS_RADIUS_IN_METERS);
|
||||
t.searchTransportStops(ll.top, ll.left, ll.bottom, ll.right, -1, ls, null);
|
||||
for(TransportStop tstop : ls) {
|
||||
if(tstop.getId().longValue() != transportStop.getId().longValue() || empty) {
|
||||
|
|
Loading…
Reference in a new issue