Indicate current road
This commit is contained in:
parent
a50fe69df9
commit
30e4753c5e
9 changed files with 195 additions and 198 deletions
|
@ -1,5 +1,83 @@
|
||||||
package net.osmand.plus.activities;
|
package net.osmand.plus.activities;
|
||||||
|
|
||||||
|
import java.io.File;
|
||||||
|
import java.lang.ref.WeakReference;
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.LinkedHashMap;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
|
import java.util.regex.Matcher;
|
||||||
|
import java.util.regex.Pattern;
|
||||||
|
|
||||||
|
import net.osmand.Location;
|
||||||
|
import net.osmand.PlatformUtil;
|
||||||
|
import net.osmand.StateChangedListener;
|
||||||
|
import net.osmand.ValueHolder;
|
||||||
|
import net.osmand.access.AccessibilityPlugin;
|
||||||
|
import net.osmand.access.MapAccessibilityActions;
|
||||||
|
import net.osmand.core.android.AtlasMapRendererView;
|
||||||
|
import net.osmand.data.LatLon;
|
||||||
|
import net.osmand.data.PointDescription;
|
||||||
|
import net.osmand.data.QuadPoint;
|
||||||
|
import net.osmand.data.RotatedTileBox;
|
||||||
|
import net.osmand.map.MapTileDownloader.DownloadRequest;
|
||||||
|
import net.osmand.map.MapTileDownloader.IMapDownloaderCallback;
|
||||||
|
import net.osmand.plus.AppInitializer;
|
||||||
|
import net.osmand.plus.AppInitializer.AppInitializeListener;
|
||||||
|
import net.osmand.plus.AppInitializer.InitEvents;
|
||||||
|
import net.osmand.plus.ApplicationMode;
|
||||||
|
import net.osmand.plus.MapMarkersHelper.MapMarker;
|
||||||
|
import net.osmand.plus.MapMarkersHelper.MapMarkerChangedListener;
|
||||||
|
import net.osmand.plus.OsmAndConstants;
|
||||||
|
import net.osmand.plus.OsmandApplication;
|
||||||
|
import net.osmand.plus.OsmandPlugin;
|
||||||
|
import net.osmand.plus.OsmandSettings;
|
||||||
|
import net.osmand.plus.R;
|
||||||
|
import net.osmand.plus.TargetPointsHelper;
|
||||||
|
import net.osmand.plus.TargetPointsHelper.TargetPoint;
|
||||||
|
import net.osmand.plus.activities.search.SearchActivity;
|
||||||
|
import net.osmand.plus.base.FailSafeFuntions;
|
||||||
|
import net.osmand.plus.base.MapViewTrackingUtilities;
|
||||||
|
import net.osmand.plus.dashboard.DashboardOnMap;
|
||||||
|
import net.osmand.plus.dialogs.ErrorBottomSheetDialog;
|
||||||
|
import net.osmand.plus.dialogs.RateUsBottomSheetDialog;
|
||||||
|
import net.osmand.plus.dialogs.WhatsNewDialogFragment;
|
||||||
|
import net.osmand.plus.download.DownloadActivity;
|
||||||
|
import net.osmand.plus.download.DownloadIndexesThread.DownloadEvents;
|
||||||
|
import net.osmand.plus.download.ui.DataStoragePlaceDialogFragment;
|
||||||
|
import net.osmand.plus.firstusage.FirstUsageWelcomeFragment;
|
||||||
|
import net.osmand.plus.firstusage.FirstUsageWizardFragment;
|
||||||
|
import net.osmand.plus.helpers.AndroidUiHelper;
|
||||||
|
import net.osmand.plus.helpers.DiscountHelper;
|
||||||
|
import net.osmand.plus.helpers.ExternalApiHelper;
|
||||||
|
import net.osmand.plus.helpers.GpxImportHelper;
|
||||||
|
import net.osmand.plus.helpers.WakeLockHelper;
|
||||||
|
import net.osmand.plus.mapcontextmenu.MapContextMenu;
|
||||||
|
import net.osmand.plus.mapcontextmenu.MapContextMenuFragment;
|
||||||
|
import net.osmand.plus.mapcontextmenu.other.DestinationReachedMenu;
|
||||||
|
import net.osmand.plus.mapcontextmenu.other.MapRouteInfoMenu;
|
||||||
|
import net.osmand.plus.mapcontextmenu.other.MapRouteInfoMenuFragment;
|
||||||
|
import net.osmand.plus.render.RendererRegistry;
|
||||||
|
import net.osmand.plus.resources.ResourceManager;
|
||||||
|
import net.osmand.plus.routing.RoutingHelper;
|
||||||
|
import net.osmand.plus.routing.RoutingHelper.IRouteInformationListener;
|
||||||
|
import net.osmand.plus.routing.RoutingHelper.RouteCalculationProgressCallback;
|
||||||
|
import net.osmand.plus.search.QuickSearchDialogFragment;
|
||||||
|
import net.osmand.plus.views.AnimateDraggingMapThread;
|
||||||
|
import net.osmand.plus.views.MapControlsLayer;
|
||||||
|
import net.osmand.plus.views.MapInfoLayer;
|
||||||
|
import net.osmand.plus.views.OsmAndMapLayersView;
|
||||||
|
import net.osmand.plus.views.OsmAndMapSurfaceView;
|
||||||
|
import net.osmand.plus.views.OsmandMapLayer;
|
||||||
|
import net.osmand.plus.views.OsmandMapTileView;
|
||||||
|
import net.osmand.plus.views.corenative.NativeCoreContext;
|
||||||
|
import net.osmand.plus.views.mapwidgets.MapInfoWidgetsFactory.TopToolbarController;
|
||||||
|
import net.osmand.plus.views.mapwidgets.MapInfoWidgetsFactory.TopToolbarControllerType;
|
||||||
|
import net.osmand.render.RenderingRulesStorage;
|
||||||
|
import net.osmand.util.Algorithms;
|
||||||
|
|
||||||
|
import org.apache.commons.logging.Log;
|
||||||
|
|
||||||
import android.Manifest;
|
import android.Manifest;
|
||||||
import android.app.Activity;
|
import android.app.Activity;
|
||||||
import android.app.AlarmManager;
|
import android.app.AlarmManager;
|
||||||
|
@ -37,86 +115,6 @@ import android.widget.ProgressBar;
|
||||||
import android.widget.TextView;
|
import android.widget.TextView;
|
||||||
import android.widget.Toast;
|
import android.widget.Toast;
|
||||||
|
|
||||||
import net.osmand.IndexConstants;
|
|
||||||
import net.osmand.Location;
|
|
||||||
import net.osmand.PlatformUtil;
|
|
||||||
import net.osmand.StateChangedListener;
|
|
||||||
import net.osmand.ValueHolder;
|
|
||||||
import net.osmand.access.AccessibilityPlugin;
|
|
||||||
import net.osmand.access.MapAccessibilityActions;
|
|
||||||
import net.osmand.core.android.AtlasMapRendererView;
|
|
||||||
import net.osmand.data.LatLon;
|
|
||||||
import net.osmand.data.PointDescription;
|
|
||||||
import net.osmand.data.QuadPoint;
|
|
||||||
import net.osmand.data.RotatedTileBox;
|
|
||||||
import net.osmand.map.MapTileDownloader.DownloadRequest;
|
|
||||||
import net.osmand.map.MapTileDownloader.IMapDownloaderCallback;
|
|
||||||
import net.osmand.plus.AppInitializer;
|
|
||||||
import net.osmand.plus.AppInitializer.AppInitializeListener;
|
|
||||||
import net.osmand.plus.AppInitializer.InitEvents;
|
|
||||||
import net.osmand.plus.ApplicationMode;
|
|
||||||
import net.osmand.plus.firstusage.FirstUsageWelcomeFragment;
|
|
||||||
import net.osmand.plus.MapMarkersHelper.MapMarker;
|
|
||||||
import net.osmand.plus.MapMarkersHelper.MapMarkerChangedListener;
|
|
||||||
import net.osmand.plus.OsmAndConstants;
|
|
||||||
import net.osmand.plus.OsmandApplication;
|
|
||||||
import net.osmand.plus.OsmandPlugin;
|
|
||||||
import net.osmand.plus.OsmandSettings;
|
|
||||||
import net.osmand.plus.R;
|
|
||||||
import net.osmand.plus.TargetPointsHelper;
|
|
||||||
import net.osmand.plus.TargetPointsHelper.TargetPoint;
|
|
||||||
import net.osmand.plus.activities.search.SearchActivity;
|
|
||||||
import net.osmand.plus.base.FailSafeFuntions;
|
|
||||||
import net.osmand.plus.base.MapViewTrackingUtilities;
|
|
||||||
import net.osmand.plus.dashboard.DashboardOnMap;
|
|
||||||
import net.osmand.plus.dialogs.ErrorBottomSheetDialog;
|
|
||||||
import net.osmand.plus.dialogs.RateUsBottomSheetDialog;
|
|
||||||
import net.osmand.plus.dialogs.WhatsNewDialogFragment;
|
|
||||||
import net.osmand.plus.download.DownloadActivity;
|
|
||||||
import net.osmand.plus.download.DownloadIndexesThread.DownloadEvents;
|
|
||||||
import net.osmand.plus.download.ui.DataStoragePlaceDialogFragment;
|
|
||||||
import net.osmand.plus.firstusage.FirstUsageWizardFragment;
|
|
||||||
import net.osmand.plus.helpers.AndroidUiHelper;
|
|
||||||
import net.osmand.plus.helpers.DiscountHelper;
|
|
||||||
import net.osmand.plus.helpers.ExternalApiHelper;
|
|
||||||
import net.osmand.plus.helpers.GpxImportHelper;
|
|
||||||
import net.osmand.plus.helpers.WakeLockHelper;
|
|
||||||
import net.osmand.plus.mapcontextmenu.MapContextMenu;
|
|
||||||
import net.osmand.plus.mapcontextmenu.MapContextMenuFragment;
|
|
||||||
import net.osmand.plus.mapcontextmenu.other.DestinationReachedMenu;
|
|
||||||
import net.osmand.plus.mapcontextmenu.other.MapRouteInfoMenu;
|
|
||||||
import net.osmand.plus.mapcontextmenu.other.MapRouteInfoMenuFragment;
|
|
||||||
import net.osmand.plus.render.RendererRegistry;
|
|
||||||
import net.osmand.plus.resources.ResourceManager;
|
|
||||||
import net.osmand.plus.routing.RoutingHelper;
|
|
||||||
import net.osmand.plus.routing.RoutingHelper.IRouteInformationListener;
|
|
||||||
import net.osmand.plus.routing.RoutingHelper.RouteCalculationProgressCallback;
|
|
||||||
import net.osmand.plus.search.QuickSearchDialogFragment;
|
|
||||||
import net.osmand.plus.views.AnimateDraggingMapThread;
|
|
||||||
import net.osmand.plus.views.MapControlsLayer;
|
|
||||||
import net.osmand.plus.views.MapInfoLayer;
|
|
||||||
import net.osmand.plus.views.OsmAndMapLayersView;
|
|
||||||
import net.osmand.plus.views.OsmAndMapSurfaceView;
|
|
||||||
import net.osmand.plus.views.OsmandMapLayer;
|
|
||||||
import net.osmand.plus.views.OsmandMapTileView;
|
|
||||||
import net.osmand.plus.views.corenative.NativeCoreContext;
|
|
||||||
import net.osmand.plus.views.mapwidgets.MapInfoWidgetsFactory.TopToolbarController;
|
|
||||||
import net.osmand.plus.views.mapwidgets.MapInfoWidgetsFactory.TopToolbarController.TopToolbarControllerType;
|
|
||||||
import net.osmand.render.RenderingRulesStorage;
|
|
||||||
import net.osmand.util.Algorithms;
|
|
||||||
|
|
||||||
import org.apache.commons.logging.Log;
|
|
||||||
|
|
||||||
import java.io.File;
|
|
||||||
import java.io.FileFilter;
|
|
||||||
import java.lang.ref.WeakReference;
|
|
||||||
import java.util.ArrayList;
|
|
||||||
import java.util.LinkedHashMap;
|
|
||||||
import java.util.List;
|
|
||||||
import java.util.Map;
|
|
||||||
import java.util.regex.Matcher;
|
|
||||||
import java.util.regex.Pattern;
|
|
||||||
|
|
||||||
public class MapActivity extends OsmandActionBarActivity implements DownloadEvents,
|
public class MapActivity extends OsmandActionBarActivity implements DownloadEvents,
|
||||||
ActivityCompat.OnRequestPermissionsResultCallback, IRouteInformationListener,
|
ActivityCompat.OnRequestPermissionsResultCallback, IRouteInformationListener,
|
||||||
MapMarkerChangedListener {
|
MapMarkerChangedListener {
|
||||||
|
|
|
@ -1,11 +1,7 @@
|
||||||
package net.osmand.plus.helpers;
|
package net.osmand.plus.helpers;
|
||||||
|
|
||||||
import android.annotation.SuppressLint;
|
import java.text.SimpleDateFormat;
|
||||||
import android.content.Intent;
|
import java.util.Date;
|
||||||
import android.net.Uri;
|
|
||||||
import android.os.AsyncTask;
|
|
||||||
import android.util.Log;
|
|
||||||
import android.view.View;
|
|
||||||
|
|
||||||
import net.osmand.AndroidNetworkUtils;
|
import net.osmand.AndroidNetworkUtils;
|
||||||
import net.osmand.plus.OsmandApplication;
|
import net.osmand.plus.OsmandApplication;
|
||||||
|
@ -14,12 +10,17 @@ import net.osmand.plus.R;
|
||||||
import net.osmand.plus.Version;
|
import net.osmand.plus.Version;
|
||||||
import net.osmand.plus.activities.MapActivity;
|
import net.osmand.plus.activities.MapActivity;
|
||||||
import net.osmand.plus.views.mapwidgets.MapInfoWidgetsFactory.TopToolbarController;
|
import net.osmand.plus.views.mapwidgets.MapInfoWidgetsFactory.TopToolbarController;
|
||||||
|
import net.osmand.plus.views.mapwidgets.MapInfoWidgetsFactory.TopToolbarControllerType;
|
||||||
import net.osmand.util.Algorithms;
|
import net.osmand.util.Algorithms;
|
||||||
|
|
||||||
import org.json.JSONObject;
|
import org.json.JSONObject;
|
||||||
|
|
||||||
import java.text.SimpleDateFormat;
|
import android.annotation.SuppressLint;
|
||||||
import java.util.Date;
|
import android.content.Intent;
|
||||||
|
import android.net.Uri;
|
||||||
|
import android.os.AsyncTask;
|
||||||
|
import android.util.Log;
|
||||||
|
import android.view.View;
|
||||||
|
|
||||||
public class DiscountHelper {
|
public class DiscountHelper {
|
||||||
|
|
||||||
|
|
|
@ -1,15 +1,8 @@
|
||||||
package net.osmand.plus.mapcontextmenu;
|
package net.osmand.plus.mapcontextmenu;
|
||||||
|
|
||||||
import android.app.Dialog;
|
import java.lang.ref.WeakReference;
|
||||||
import android.app.ProgressDialog;
|
import java.util.LinkedList;
|
||||||
import android.content.DialogInterface;
|
import java.util.List;
|
||||||
import android.support.annotation.NonNull;
|
|
||||||
import android.support.annotation.Nullable;
|
|
||||||
import android.support.v4.app.Fragment;
|
|
||||||
import android.support.v7.app.AlertDialog;
|
|
||||||
import android.support.v7.app.AlertDialog.Builder;
|
|
||||||
import android.view.View;
|
|
||||||
import android.widget.LinearLayout;
|
|
||||||
|
|
||||||
import net.osmand.CallbackWithObject;
|
import net.osmand.CallbackWithObject;
|
||||||
import net.osmand.StateChangedListener;
|
import net.osmand.StateChangedListener;
|
||||||
|
@ -46,14 +39,19 @@ import net.osmand.plus.mapcontextmenu.other.ShareMenu;
|
||||||
import net.osmand.plus.routing.RoutingHelper;
|
import net.osmand.plus.routing.RoutingHelper;
|
||||||
import net.osmand.plus.views.ContextMenuLayer;
|
import net.osmand.plus.views.ContextMenuLayer;
|
||||||
import net.osmand.plus.views.OsmandMapLayer;
|
import net.osmand.plus.views.OsmandMapLayer;
|
||||||
import net.osmand.plus.views.mapwidgets.MapInfoWidgetsFactory;
|
|
||||||
import net.osmand.plus.views.mapwidgets.MapInfoWidgetsFactory.TopToolbarController;
|
import net.osmand.plus.views.mapwidgets.MapInfoWidgetsFactory.TopToolbarController;
|
||||||
import net.osmand.plus.views.mapwidgets.MapInfoWidgetsFactory.TopToolbarController.TopToolbarControllerType;
|
import net.osmand.plus.views.mapwidgets.MapInfoWidgetsFactory.TopToolbarControllerType;
|
||||||
import net.osmand.util.MapUtils;
|
import net.osmand.util.MapUtils;
|
||||||
|
import android.app.Dialog;
|
||||||
import java.lang.ref.WeakReference;
|
import android.app.ProgressDialog;
|
||||||
import java.util.LinkedList;
|
import android.content.DialogInterface;
|
||||||
import java.util.List;
|
import android.support.annotation.NonNull;
|
||||||
|
import android.support.annotation.Nullable;
|
||||||
|
import android.support.v4.app.Fragment;
|
||||||
|
import android.support.v7.app.AlertDialog;
|
||||||
|
import android.support.v7.app.AlertDialog.Builder;
|
||||||
|
import android.view.View;
|
||||||
|
import android.widget.LinearLayout;
|
||||||
|
|
||||||
public class MapContextMenu extends MenuTitleController implements StateChangedListener<ApplicationMode>,
|
public class MapContextMenu extends MenuTitleController implements StateChangedListener<ApplicationMode>,
|
||||||
MapMarkerChangedListener, TargetPointChangedListener {
|
MapMarkerChangedListener, TargetPointChangedListener {
|
||||||
|
|
|
@ -1,10 +1,9 @@
|
||||||
package net.osmand.plus.mapcontextmenu;
|
package net.osmand.plus.mapcontextmenu;
|
||||||
|
|
||||||
import android.graphics.drawable.Drawable;
|
import java.io.IOException;
|
||||||
import android.support.annotation.NonNull;
|
import java.util.Iterator;
|
||||||
import android.view.View;
|
import java.util.LinkedList;
|
||||||
import android.view.View.OnClickListener;
|
import java.util.List;
|
||||||
import android.widget.LinearLayout;
|
|
||||||
|
|
||||||
import net.osmand.IndexConstants;
|
import net.osmand.IndexConstants;
|
||||||
import net.osmand.binary.BinaryMapDataObject;
|
import net.osmand.binary.BinaryMapDataObject;
|
||||||
|
@ -55,13 +54,14 @@ import net.osmand.plus.parkingpoint.ParkingPositionMenuController;
|
||||||
import net.osmand.plus.resources.ResourceManager;
|
import net.osmand.plus.resources.ResourceManager;
|
||||||
import net.osmand.plus.views.DownloadedRegionsLayer.DownloadMapObject;
|
import net.osmand.plus.views.DownloadedRegionsLayer.DownloadMapObject;
|
||||||
import net.osmand.plus.views.mapwidgets.MapInfoWidgetsFactory.TopToolbarController;
|
import net.osmand.plus.views.mapwidgets.MapInfoWidgetsFactory.TopToolbarController;
|
||||||
|
import net.osmand.plus.views.mapwidgets.MapInfoWidgetsFactory.TopToolbarControllerType;
|
||||||
import net.osmand.util.Algorithms;
|
import net.osmand.util.Algorithms;
|
||||||
import net.osmand.util.MapUtils;
|
import net.osmand.util.MapUtils;
|
||||||
|
import android.graphics.drawable.Drawable;
|
||||||
import java.io.IOException;
|
import android.support.annotation.NonNull;
|
||||||
import java.util.Iterator;
|
import android.view.View;
|
||||||
import java.util.LinkedList;
|
import android.view.View.OnClickListener;
|
||||||
import java.util.List;
|
import android.widget.LinearLayout;
|
||||||
|
|
||||||
public abstract class MenuController extends BaseMenuController {
|
public abstract class MenuController extends BaseMenuController {
|
||||||
|
|
||||||
|
|
|
@ -737,22 +737,6 @@ public class RoutingHelper {
|
||||||
}
|
}
|
||||||
return formattedStreetName;
|
return formattedStreetName;
|
||||||
|
|
||||||
// if(destination != null && destination.length() > 0){
|
|
||||||
// if(ref != null && ref.length() > 0) {
|
|
||||||
// destination = ref + " " + destination;
|
|
||||||
// }
|
|
||||||
// return destination;
|
|
||||||
// } else if(name != null && name.length() > 0){
|
|
||||||
// if(ref != null && ref.length() > 0) {
|
|
||||||
// name = ref + " " + name;
|
|
||||||
// }
|
|
||||||
// return name;
|
|
||||||
// } else {
|
|
||||||
// if(ref == null) {
|
|
||||||
// return "";
|
|
||||||
// }
|
|
||||||
// return ref;
|
|
||||||
// }
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// protected boolean isDistanceLess(float currentSpeed, double dist, double etalon, float defSpeed){
|
// protected boolean isDistanceLess(float currentSpeed, double dist, double etalon, float defSpeed){
|
||||||
|
|
|
@ -1,5 +1,48 @@
|
||||||
package net.osmand.plus.search;
|
package net.osmand.plus.search;
|
||||||
|
|
||||||
|
import java.io.File;
|
||||||
|
import java.io.IOException;
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
import net.osmand.AndroidUtils;
|
||||||
|
import net.osmand.Location;
|
||||||
|
import net.osmand.ResultMatcher;
|
||||||
|
import net.osmand.data.City;
|
||||||
|
import net.osmand.data.LatLon;
|
||||||
|
import net.osmand.data.PointDescription;
|
||||||
|
import net.osmand.osm.AbstractPoiType;
|
||||||
|
import net.osmand.plus.AppInitializer;
|
||||||
|
import net.osmand.plus.AppInitializer.AppInitializeListener;
|
||||||
|
import net.osmand.plus.GPXUtilities;
|
||||||
|
import net.osmand.plus.GPXUtilities.GPXFile;
|
||||||
|
import net.osmand.plus.GPXUtilities.WptPt;
|
||||||
|
import net.osmand.plus.LockableViewPager;
|
||||||
|
import net.osmand.plus.OsmAndFormatter;
|
||||||
|
import net.osmand.plus.OsmAndLocationProvider.OsmAndCompassListener;
|
||||||
|
import net.osmand.plus.OsmAndLocationProvider.OsmAndLocationListener;
|
||||||
|
import net.osmand.plus.OsmandApplication;
|
||||||
|
import net.osmand.plus.OsmandSettings;
|
||||||
|
import net.osmand.plus.R;
|
||||||
|
import net.osmand.plus.activities.MapActivity;
|
||||||
|
import net.osmand.plus.activities.MapActivity.ShowQuickSearchMode;
|
||||||
|
import net.osmand.plus.helpers.SearchHistoryHelper;
|
||||||
|
import net.osmand.plus.helpers.SearchHistoryHelper.HistoryEntry;
|
||||||
|
import net.osmand.plus.poi.PoiUIFilter;
|
||||||
|
import net.osmand.plus.search.QuickSearchHelper.SearchHistoryAPI;
|
||||||
|
import net.osmand.plus.views.mapwidgets.MapInfoWidgetsFactory.TopToolbarController;
|
||||||
|
import net.osmand.plus.views.mapwidgets.MapInfoWidgetsFactory.TopToolbarControllerType;
|
||||||
|
import net.osmand.search.SearchUICore;
|
||||||
|
import net.osmand.search.SearchUICore.SearchResultCollection;
|
||||||
|
import net.osmand.search.core.ObjectType;
|
||||||
|
import net.osmand.search.core.SearchCoreAPI;
|
||||||
|
import net.osmand.search.core.SearchCoreFactory.SearchAmenityTypesAPI;
|
||||||
|
import net.osmand.search.core.SearchPhrase;
|
||||||
|
import net.osmand.search.core.SearchResult;
|
||||||
|
import net.osmand.search.core.SearchSettings;
|
||||||
|
import net.osmand.search.core.SearchWord;
|
||||||
|
import net.osmand.util.Algorithms;
|
||||||
|
import net.osmand.util.MapUtils;
|
||||||
import android.annotation.SuppressLint;
|
import android.annotation.SuppressLint;
|
||||||
import android.app.Dialog;
|
import android.app.Dialog;
|
||||||
import android.content.DialogInterface;
|
import android.content.DialogInterface;
|
||||||
|
@ -34,49 +77,6 @@ import android.widget.ListView;
|
||||||
import android.widget.ProgressBar;
|
import android.widget.ProgressBar;
|
||||||
import android.widget.TextView;
|
import android.widget.TextView;
|
||||||
|
|
||||||
import net.osmand.AndroidUtils;
|
|
||||||
import net.osmand.Location;
|
|
||||||
import net.osmand.ResultMatcher;
|
|
||||||
import net.osmand.data.City;
|
|
||||||
import net.osmand.data.LatLon;
|
|
||||||
import net.osmand.data.PointDescription;
|
|
||||||
import net.osmand.osm.AbstractPoiType;
|
|
||||||
import net.osmand.plus.AppInitializer;
|
|
||||||
import net.osmand.plus.AppInitializer.AppInitializeListener;
|
|
||||||
import net.osmand.plus.GPXUtilities;
|
|
||||||
import net.osmand.plus.GPXUtilities.GPXFile;
|
|
||||||
import net.osmand.plus.GPXUtilities.WptPt;
|
|
||||||
import net.osmand.plus.LockableViewPager;
|
|
||||||
import net.osmand.plus.OsmAndFormatter;
|
|
||||||
import net.osmand.plus.OsmAndLocationProvider.OsmAndCompassListener;
|
|
||||||
import net.osmand.plus.OsmAndLocationProvider.OsmAndLocationListener;
|
|
||||||
import net.osmand.plus.OsmandApplication;
|
|
||||||
import net.osmand.plus.OsmandSettings;
|
|
||||||
import net.osmand.plus.R;
|
|
||||||
import net.osmand.plus.activities.MapActivity;
|
|
||||||
import net.osmand.plus.activities.MapActivity.ShowQuickSearchMode;
|
|
||||||
import net.osmand.plus.helpers.SearchHistoryHelper;
|
|
||||||
import net.osmand.plus.helpers.SearchHistoryHelper.HistoryEntry;
|
|
||||||
import net.osmand.plus.poi.PoiUIFilter;
|
|
||||||
import net.osmand.plus.search.QuickSearchHelper.SearchHistoryAPI;
|
|
||||||
import net.osmand.plus.views.mapwidgets.MapInfoWidgetsFactory.TopToolbarController;
|
|
||||||
import net.osmand.search.SearchUICore;
|
|
||||||
import net.osmand.search.SearchUICore.SearchResultCollection;
|
|
||||||
import net.osmand.search.core.ObjectType;
|
|
||||||
import net.osmand.search.core.SearchCoreAPI;
|
|
||||||
import net.osmand.search.core.SearchCoreFactory.SearchAmenityTypesAPI;
|
|
||||||
import net.osmand.search.core.SearchPhrase;
|
|
||||||
import net.osmand.search.core.SearchResult;
|
|
||||||
import net.osmand.search.core.SearchSettings;
|
|
||||||
import net.osmand.search.core.SearchWord;
|
|
||||||
import net.osmand.util.Algorithms;
|
|
||||||
import net.osmand.util.MapUtils;
|
|
||||||
|
|
||||||
import java.io.File;
|
|
||||||
import java.io.IOException;
|
|
||||||
import java.util.ArrayList;
|
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
public class QuickSearchDialogFragment extends DialogFragment implements OsmAndCompassListener, OsmAndLocationListener {
|
public class QuickSearchDialogFragment extends DialogFragment implements OsmAndCompassListener, OsmAndLocationListener {
|
||||||
|
|
||||||
public static final String TAG = "QuickSearchDialogFragment";
|
public static final String TAG = "QuickSearchDialogFragment";
|
||||||
|
|
|
@ -1,14 +1,7 @@
|
||||||
package net.osmand.plus.views;
|
package net.osmand.plus.views;
|
||||||
|
|
||||||
|
|
||||||
import android.content.Context;
|
import java.lang.reflect.Field;
|
||||||
import android.graphics.Canvas;
|
|
||||||
import android.graphics.Color;
|
|
||||||
import android.support.v4.content.ContextCompat;
|
|
||||||
import android.view.View;
|
|
||||||
import android.view.View.OnClickListener;
|
|
||||||
import android.widget.ImageButton;
|
|
||||||
import android.widget.LinearLayout;
|
|
||||||
|
|
||||||
import net.osmand.data.RotatedTileBox;
|
import net.osmand.data.RotatedTileBox;
|
||||||
import net.osmand.plus.OsmandApplication;
|
import net.osmand.plus.OsmandApplication;
|
||||||
|
@ -17,10 +10,10 @@ import net.osmand.plus.R;
|
||||||
import net.osmand.plus.activities.MapActivity;
|
import net.osmand.plus.activities.MapActivity;
|
||||||
import net.osmand.plus.helpers.AndroidUiHelper;
|
import net.osmand.plus.helpers.AndroidUiHelper;
|
||||||
import net.osmand.plus.views.mapwidgets.MapInfoWidgetsFactory;
|
import net.osmand.plus.views.mapwidgets.MapInfoWidgetsFactory;
|
||||||
import net.osmand.plus.views.mapwidgets.MapInfoWidgetsFactory.TopToolbarController.TopToolbarControllerType;
|
|
||||||
import net.osmand.plus.views.mapwidgets.MapInfoWidgetsFactory.TopToolbarView;
|
|
||||||
import net.osmand.plus.views.mapwidgets.MapInfoWidgetsFactory.TopTextView;
|
import net.osmand.plus.views.mapwidgets.MapInfoWidgetsFactory.TopTextView;
|
||||||
import net.osmand.plus.views.mapwidgets.MapInfoWidgetsFactory.TopToolbarController;
|
import net.osmand.plus.views.mapwidgets.MapInfoWidgetsFactory.TopToolbarController;
|
||||||
|
import net.osmand.plus.views.mapwidgets.MapInfoWidgetsFactory.TopToolbarControllerType;
|
||||||
|
import net.osmand.plus.views.mapwidgets.MapInfoWidgetsFactory.TopToolbarView;
|
||||||
import net.osmand.plus.views.mapwidgets.MapMarkersWidgetsFactory;
|
import net.osmand.plus.views.mapwidgets.MapMarkersWidgetsFactory;
|
||||||
import net.osmand.plus.views.mapwidgets.MapWidgetRegistry;
|
import net.osmand.plus.views.mapwidgets.MapWidgetRegistry;
|
||||||
import net.osmand.plus.views.mapwidgets.MapWidgetRegistry.MapWidgetRegInfo;
|
import net.osmand.plus.views.mapwidgets.MapWidgetRegistry.MapWidgetRegInfo;
|
||||||
|
@ -33,8 +26,14 @@ import net.osmand.plus.views.mapwidgets.RouteInfoWidgetsFactory.LanesControl;
|
||||||
import net.osmand.plus.views.mapwidgets.RouteInfoWidgetsFactory.RulerWidget;
|
import net.osmand.plus.views.mapwidgets.RouteInfoWidgetsFactory.RulerWidget;
|
||||||
import net.osmand.plus.views.mapwidgets.RouteInfoWidgetsFactory.TimeControlWidgetState;
|
import net.osmand.plus.views.mapwidgets.RouteInfoWidgetsFactory.TimeControlWidgetState;
|
||||||
import net.osmand.plus.views.mapwidgets.TextInfoWidget;
|
import net.osmand.plus.views.mapwidgets.TextInfoWidget;
|
||||||
|
import android.content.Context;
|
||||||
import java.lang.reflect.Field;
|
import android.graphics.Canvas;
|
||||||
|
import android.graphics.Color;
|
||||||
|
import android.support.v4.content.ContextCompat;
|
||||||
|
import android.view.View;
|
||||||
|
import android.view.View.OnClickListener;
|
||||||
|
import android.widget.ImageButton;
|
||||||
|
import android.widget.LinearLayout;
|
||||||
|
|
||||||
public class MapInfoLayer extends OsmandMapLayer {
|
public class MapInfoLayer extends OsmandMapLayer {
|
||||||
private final MapActivity map;
|
private final MapActivity map;
|
||||||
|
|
|
@ -12,7 +12,6 @@ import android.widget.ImageButton;
|
||||||
import android.widget.ImageView;
|
import android.widget.ImageView;
|
||||||
import android.widget.LinearLayout;
|
import android.widget.LinearLayout;
|
||||||
import android.widget.TextView;
|
import android.widget.TextView;
|
||||||
|
|
||||||
import net.osmand.Location;
|
import net.osmand.Location;
|
||||||
import net.osmand.ValueHolder;
|
import net.osmand.ValueHolder;
|
||||||
import net.osmand.binary.RouteDataObject;
|
import net.osmand.binary.RouteDataObject;
|
||||||
|
@ -36,7 +35,6 @@ import net.osmand.plus.monitoring.OsmandMonitoringPlugin;
|
||||||
import net.osmand.plus.routing.RouteDirectionInfo;
|
import net.osmand.plus.routing.RouteDirectionInfo;
|
||||||
import net.osmand.plus.routing.RoutingHelper;
|
import net.osmand.plus.routing.RoutingHelper;
|
||||||
import net.osmand.plus.views.OsmandMapLayer.DrawSettings;
|
import net.osmand.plus.views.OsmandMapLayer.DrawSettings;
|
||||||
import net.osmand.plus.views.mapwidgets.MapInfoWidgetsFactory.TopToolbarController.TopToolbarControllerType;
|
|
||||||
import net.osmand.plus.views.mapwidgets.NextTurnInfoWidget.TurnDrawable;
|
import net.osmand.plus.views.mapwidgets.NextTurnInfoWidget.TurnDrawable;
|
||||||
import net.osmand.router.TurnType;
|
import net.osmand.router.TurnType;
|
||||||
|
|
||||||
|
@ -44,6 +42,11 @@ import java.util.Iterator;
|
||||||
import java.util.LinkedList;
|
import java.util.LinkedList;
|
||||||
|
|
||||||
public class MapInfoWidgetsFactory {
|
public class MapInfoWidgetsFactory {
|
||||||
|
public enum TopToolbarControllerType {
|
||||||
|
QUICK_SEARCH,
|
||||||
|
CONTEXT_MENU,
|
||||||
|
DISCOUNT,
|
||||||
|
}
|
||||||
|
|
||||||
public TextInfoWidget createAltitudeControl(final MapActivity map) {
|
public TextInfoWidget createAltitudeControl(final MapActivity map) {
|
||||||
final TextInfoWidget altitudeControl = new TextInfoWidget(map) {
|
final TextInfoWidget altitudeControl = new TextInfoWidget(map) {
|
||||||
|
@ -200,11 +203,6 @@ public class MapInfoWidgetsFactory {
|
||||||
OnClickListener onTitleClickListener;
|
OnClickListener onTitleClickListener;
|
||||||
OnClickListener onCloseButtonClickListener;
|
OnClickListener onCloseButtonClickListener;
|
||||||
|
|
||||||
public enum TopToolbarControllerType {
|
|
||||||
QUICK_SEARCH,
|
|
||||||
CONTEXT_MENU,
|
|
||||||
DISCOUNT,
|
|
||||||
}
|
|
||||||
|
|
||||||
public TopToolbarController(TopToolbarControllerType type) {
|
public TopToolbarController(TopToolbarControllerType type) {
|
||||||
this.type = type;
|
this.type = type;
|
||||||
|
@ -549,6 +547,13 @@ public class MapInfoWidgetsFactory {
|
||||||
text = routingHelper.getCurrentName(type);
|
text = routingHelper.getCurrentName(type);
|
||||||
if (text == null) {
|
if (text == null) {
|
||||||
text = "";
|
text = "";
|
||||||
|
} else {
|
||||||
|
if(type[0] == null){
|
||||||
|
type[0] = TurnType.valueOf(TurnType.C, false);
|
||||||
|
turnDrawable.setColor(R.color.color_myloc_distance);
|
||||||
|
} else {
|
||||||
|
turnDrawable.setColor(R.color.nav_arrow);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
@ -558,7 +563,8 @@ public class MapInfoWidgetsFactory {
|
||||||
showNextTurn = true;
|
showNextTurn = true;
|
||||||
RouteDirectionInfo next = routingHelper.getRouteDirections().get(di);
|
RouteDirectionInfo next = routingHelper.getRouteDirections().get(di);
|
||||||
type[0] = next.getTurnType();
|
type[0] = next.getTurnType();
|
||||||
text = RoutingHelper.formatStreetName(next.getStreetName(), next.getRef(), next.getDestinationName(), ">");
|
turnDrawable.setColor(R.color.nav_arrow_distant);
|
||||||
|
text = RoutingHelper.formatStreetName(next.getStreetName(), next.getRef(), next.getDestinationName(), "»");
|
||||||
// if (next.distance > 0) {
|
// if (next.distance > 0) {
|
||||||
// text += " " + OsmAndFormatter.getFormattedDistance(next.distance, map.getMyApplication());
|
// text += " " + OsmAndFormatter.getFormattedDistance(next.distance, map.getMyApplication());
|
||||||
// }
|
// }
|
||||||
|
@ -573,12 +579,13 @@ public class MapInfoWidgetsFactory {
|
||||||
RouteDataObject rt = locationProvider.getLastKnownRouteSegment();
|
RouteDataObject rt = locationProvider.getLastKnownRouteSegment();
|
||||||
if (rt != null) {
|
if (rt != null) {
|
||||||
text = RoutingHelper.formatStreetName(rt.getName(settings.MAP_PREFERRED_LOCALE.get()),
|
text = RoutingHelper.formatStreetName(rt.getName(settings.MAP_PREFERRED_LOCALE.get()),
|
||||||
rt.getRef(), rt.getDestinationName(settings.MAP_PREFERRED_LOCALE.get()), ">");
|
rt.getRef(), rt.getDestinationName(settings.MAP_PREFERRED_LOCALE.get()), "»");
|
||||||
}
|
}
|
||||||
if (text == null) {
|
if (text == null) {
|
||||||
text = "";
|
text = "";
|
||||||
} else {
|
} else {
|
||||||
text = "+ " + text;
|
type[0] = TurnType.valueOf(TurnType.C, false);
|
||||||
|
turnDrawable.setColor(R.color.color_myloc_distance);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (map.isTopToolbarActive()) {
|
if (map.isTopToolbarActive()) {
|
||||||
|
@ -596,6 +603,7 @@ public class MapInfoWidgetsFactory {
|
||||||
updateVisibility(addressTextShadow, shadowRad > 0);
|
updateVisibility(addressTextShadow, shadowRad > 0);
|
||||||
boolean update = turnDrawable.setTurnType(type[0]);
|
boolean update = turnDrawable.setTurnType(type[0]);
|
||||||
|
|
||||||
|
|
||||||
int h = addressText.getHeight() / 4 * 3;
|
int h = addressText.getHeight() / 4 * 3;
|
||||||
if (h != turnDrawable.getBounds().bottom) {
|
if (h != turnDrawable.getBounds().bottom) {
|
||||||
turnDrawable.setBounds(0, 0, h, h);
|
turnDrawable.setBounds(0, 0, h, h);
|
||||||
|
@ -611,7 +619,7 @@ public class MapInfoWidgetsFactory {
|
||||||
addressText.setCompoundDrawables(null, null, null, null);
|
addressText.setCompoundDrawables(null, null, null, null);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (!text.equals(addressText.getText().toString()) && !text.equals("+ " + addressText.getText().toString())) {
|
if (!text.equals(addressText.getText().toString())) {
|
||||||
if (!text.equals("")) {
|
if (!text.equals("")) {
|
||||||
topBar.setContentDescription(text);
|
topBar.setContentDescription(text);
|
||||||
} else {
|
} else {
|
||||||
|
|
|
@ -21,6 +21,7 @@ import android.graphics.Path;
|
||||||
import android.graphics.PointF;
|
import android.graphics.PointF;
|
||||||
import android.graphics.Rect;
|
import android.graphics.Rect;
|
||||||
import android.graphics.drawable.Drawable;
|
import android.graphics.drawable.Drawable;
|
||||||
|
import android.support.annotation.ColorRes;
|
||||||
import android.text.TextPaint;
|
import android.text.TextPaint;
|
||||||
|
|
||||||
|
|
||||||
|
@ -127,6 +128,7 @@ public class NextTurnInfoWidget extends TextInfoWidget {
|
||||||
private boolean mini;
|
private boolean mini;
|
||||||
private PointF centerText;
|
private PointF centerText;
|
||||||
private TextPaint textPaint;
|
private TextPaint textPaint;
|
||||||
|
private int clr;
|
||||||
|
|
||||||
public TurnDrawable(Context ctx, boolean mini) {
|
public TurnDrawable(Context ctx, boolean mini) {
|
||||||
this.ctx = ctx;
|
this.ctx = ctx;
|
||||||
|
@ -141,9 +143,16 @@ public class NextTurnInfoWidget extends TextInfoWidget {
|
||||||
|
|
||||||
paintRouteDirection = new Paint();
|
paintRouteDirection = new Paint();
|
||||||
paintRouteDirection.setStyle(Style.FILL);
|
paintRouteDirection.setStyle(Style.FILL);
|
||||||
paintRouteDirection.setColor(ctx.getResources().getColor(R.color.nav_arrow));
|
|
||||||
paintRouteDirection.setAntiAlias(true);
|
paintRouteDirection.setAntiAlias(true);
|
||||||
|
setColor(R.color.nav_arrow);
|
||||||
|
}
|
||||||
|
|
||||||
|
@ColorRes
|
||||||
|
public void setColor(int clr) {
|
||||||
|
if(clr != this.clr) {
|
||||||
|
this.clr = clr;
|
||||||
|
paintRouteDirection.setColor(ctx.getResources().getColor(clr));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
Loading…
Reference in a new issue