opt
3
.idea/gradle.xml
generated
@@ -4,6 +4,7 @@
|
||||
<component name="GradleSettings">
|
||||
<option name="linkedExternalProjectsSettings">
|
||||
<GradleProjectSettings>
|
||||
<option name="testRunner" value="PLATFORM" />
|
||||
<option name="distributionType" value="DEFAULT_WRAPPED" />
|
||||
<option name="externalProjectPath" value="$PROJECT_DIR$" />
|
||||
<option name="modules">
|
||||
@@ -16,6 +17,7 @@
|
||||
<option value="$PROJECT_DIR$/foudations/mogo-utils" />
|
||||
<option value="$PROJECT_DIR$/libraries" />
|
||||
<option value="$PROJECT_DIR$/libraries/map-amap" />
|
||||
<option value="$PROJECT_DIR$/libraries/map-autonavi" />
|
||||
<option value="$PROJECT_DIR$/libraries/mogo-map" />
|
||||
<option value="$PROJECT_DIR$/libraries/mogo-map-api" />
|
||||
<option value="$PROJECT_DIR$/modules" />
|
||||
@@ -39,7 +41,6 @@
|
||||
</set>
|
||||
</option>
|
||||
<option name="resolveModulePerSourceSet" value="false" />
|
||||
<option name="testRunner" value="PLATFORM" />
|
||||
</GradleProjectSettings>
|
||||
</option>
|
||||
</component>
|
||||
|
||||
2
.idea/misc.xml
generated
@@ -1,6 +1,6 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="ProjectRootManager" version="2" languageLevel="JDK_1_8" project-jdk-name="1.8" project-jdk-type="JavaSDK">
|
||||
<component name="ProjectRootManager" version="2" languageLevel="JDK_1_8" project-jdk-name="JDK" project-jdk-type="JavaSDK">
|
||||
<output url="file://$PROJECT_DIR$/build/classes" />
|
||||
</component>
|
||||
</project>
|
||||
@@ -84,6 +84,7 @@ ext {
|
||||
mogocommons : "com.mogo.commons:mogo-commons:${MOGO_COMMONS_VERSION}",
|
||||
mogoutils : "com.mogo.commons:mogo-utils:${MOGO_UTILS_VERSION}",
|
||||
mapamap : "com.mogo.map:map-amap:${MAP_AMAP_VERSION}",
|
||||
mapautomap : "com.mogo.map:map-autonavi:${MAP_AUTONAVI_VERSION}",
|
||||
mogomap : "com.mogo.map:mogo-map:${MOGO_MAP_VERSION}",
|
||||
mogomapapi : "com.mogo.map:mogo-map-api:${MOGO_MAP_API_VERSION}",
|
||||
modulecommon : "com.mogo.module:module-common:${MOGO_MODULE_COMMON_VERSION}",
|
||||
|
||||
@@ -73,4 +73,17 @@ public class DebugConfig {
|
||||
public static void setNetMode( int netMode ) {
|
||||
DebugConfig.sNetMode = netMode;
|
||||
}
|
||||
|
||||
/**
|
||||
* 是否拉起位置服务
|
||||
*/
|
||||
private static boolean sLaunchLocationService = true;
|
||||
|
||||
public static boolean isLaunchLocationService() {
|
||||
return sLaunchLocationService;
|
||||
}
|
||||
|
||||
public static void setLaunchLocationService( boolean launchLocationService ) {
|
||||
DebugConfig.sLaunchLocationService = launchLocationService;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,11 +0,0 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<resources>
|
||||
<dimen name="module_commons_toast_marginLeft">30px</dimen>
|
||||
<dimen name="module_commons_toast_marginRight">30px</dimen>
|
||||
<dimen name="module_commons_toast_marginTop">16px</dimen>
|
||||
<dimen name="module_commons_toast_marginBottom">16px</dimen>
|
||||
<dimen name="module_commons_toast_textSize">22px</dimen>
|
||||
<dimen name="module_commons_toast_minWidth">371px</dimen>
|
||||
<dimen name="module_commons_toast_maxWidth">500px</dimen>
|
||||
<dimen name="module_commons_toast_y_offset">72px</dimen>
|
||||
</resources>
|
||||
@@ -1,13 +1,11 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<resources>
|
||||
<dimen name="module_commons_toast_marginLeft">50px</dimen>
|
||||
<dimen name="module_commons_toast_marginRight">50px</dimen>
|
||||
<dimen name="module_commons_toast_marginTop">32px</dimen>
|
||||
<dimen name="module_commons_toast_marginBottom">32px</dimen>
|
||||
<dimen name="module_commons_toast_textSize">40px</dimen>
|
||||
<dimen name="module_commons_toast_minWidth">698px</dimen>
|
||||
<dimen name="module_commons_toast_maxWidth">900px</dimen>
|
||||
<dimen name="module_commons_toast_y_offset">130px</dimen>
|
||||
</resources>
|
||||
|
||||
|
||||
<dimen name="module_commons_toast_marginLeft">30px</dimen>
|
||||
<dimen name="module_commons_toast_marginRight">30px</dimen>
|
||||
<dimen name="module_commons_toast_marginTop">16px</dimen>
|
||||
<dimen name="module_commons_toast_marginBottom">16px</dimen>
|
||||
<dimen name="module_commons_toast_textSize">22px</dimen>
|
||||
<dimen name="module_commons_toast_minWidth">371px</dimen>
|
||||
<dimen name="module_commons_toast_maxWidth">500px</dimen>
|
||||
<dimen name="module_commons_toast_y_offset">72px</dimen>
|
||||
</resources>
|
||||
@@ -3,6 +3,9 @@ package com.mogo.utils;
|
||||
import android.app.ActivityManager;
|
||||
import android.content.ComponentName;
|
||||
import android.content.Context;
|
||||
import android.content.pm.PackageInfo;
|
||||
import android.content.pm.PackageManager;
|
||||
import android.text.TextUtils;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@@ -25,4 +28,22 @@ public class AppUtils {
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
public static boolean isAppInstalled( Context context, String pkg ) {
|
||||
PackageInfo packageInfo;
|
||||
if ( TextUtils.isEmpty( pkg ) ) {
|
||||
return false;
|
||||
}
|
||||
try {
|
||||
packageInfo = context.getPackageManager().getPackageInfo( pkg, 0 );
|
||||
} catch ( PackageManager.NameNotFoundException e ) {
|
||||
packageInfo = null;
|
||||
e.printStackTrace();
|
||||
}
|
||||
if ( packageInfo == null ) {
|
||||
return false;
|
||||
} else {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -30,6 +30,7 @@ RELEASE=false
|
||||
MOGO_COMMONS_VERSION=1.1.0.15
|
||||
MOGO_UTILS_VERSION=1.1.0.15
|
||||
MAP_AMAP_VERSION=1.1.0.15
|
||||
MAP_AUTONAVI_VERSION=1.1.0.15
|
||||
MOGO_MAP_VERSION=1.1.0.15
|
||||
MOGO_MAP_API_VERSION=1.1.0.15
|
||||
MOGO_SERVICE_VERSION=1.1.0.15
|
||||
|
||||
|
Before Width: | Height: | Size: 4.3 KiB After Width: | Height: | Size: 4.3 KiB |
|
Before Width: | Height: | Size: 4.5 KiB After Width: | Height: | Size: 4.5 KiB |
|
Before Width: | Height: | Size: 3.4 KiB After Width: | Height: | Size: 3.4 KiB |
|
Before Width: | Height: | Size: 3.2 KiB After Width: | Height: | Size: 3.2 KiB |
|
Before Width: | Height: | Size: 3.9 KiB After Width: | Height: | Size: 3.9 KiB |
|
Before Width: | Height: | Size: 4.9 KiB After Width: | Height: | Size: 4.9 KiB |
|
Before Width: | Height: | Size: 3.8 KiB After Width: | Height: | Size: 3.8 KiB |
|
Before Width: | Height: | Size: 4.9 KiB After Width: | Height: | Size: 4.9 KiB |
|
Before Width: | Height: | Size: 3.4 KiB After Width: | Height: | Size: 3.4 KiB |
|
Before Width: | Height: | Size: 3.1 KiB After Width: | Height: | Size: 3.1 KiB |
|
Before Width: | Height: | Size: 3.6 KiB After Width: | Height: | Size: 3.6 KiB |
|
Before Width: | Height: | Size: 2.6 KiB After Width: | Height: | Size: 2.6 KiB |
|
Before Width: | Height: | Size: 2.3 KiB After Width: | Height: | Size: 2.3 KiB |
|
Before Width: | Height: | Size: 3.8 KiB After Width: | Height: | Size: 3.8 KiB |
|
Before Width: | Height: | Size: 3.3 KiB After Width: | Height: | Size: 3.3 KiB |
|
Before Width: | Height: | Size: 3.5 KiB After Width: | Height: | Size: 3.5 KiB |
|
Before Width: | Height: | Size: 3.8 KiB After Width: | Height: | Size: 3.8 KiB |
|
Before Width: | Height: | Size: 3.2 KiB After Width: | Height: | Size: 3.2 KiB |
|
Before Width: | Height: | Size: 3.7 KiB After Width: | Height: | Size: 3.7 KiB |
|
Before Width: | Height: | Size: 3.5 KiB After Width: | Height: | Size: 3.5 KiB |
|
Before Width: | Height: | Size: 3.8 KiB After Width: | Height: | Size: 3.8 KiB |
|
Before Width: | Height: | Size: 2.6 KiB After Width: | Height: | Size: 2.6 KiB |
|
Before Width: | Height: | Size: 2.5 KiB After Width: | Height: | Size: 2.5 KiB |
|
Before Width: | Height: | Size: 4.0 KiB After Width: | Height: | Size: 4.0 KiB |
|
Before Width: | Height: | Size: 4.4 KiB After Width: | Height: | Size: 4.4 KiB |
|
Before Width: | Height: | Size: 4.5 KiB After Width: | Height: | Size: 4.5 KiB |
|
Before Width: | Height: | Size: 4.2 KiB After Width: | Height: | Size: 4.2 KiB |
|
Before Width: | Height: | Size: 4.4 KiB After Width: | Height: | Size: 4.4 KiB |
|
Before Width: | Height: | Size: 4.6 KiB After Width: | Height: | Size: 4.6 KiB |
|
Before Width: | Height: | Size: 4.1 KiB After Width: | Height: | Size: 4.1 KiB |
|
Before Width: | Height: | Size: 4.6 KiB After Width: | Height: | Size: 4.6 KiB |
|
Before Width: | Height: | Size: 4.6 KiB After Width: | Height: | Size: 4.6 KiB |
|
Before Width: | Height: | Size: 4.7 KiB After Width: | Height: | Size: 4.7 KiB |
|
Before Width: | Height: | Size: 3.3 KiB After Width: | Height: | Size: 3.3 KiB |
|
Before Width: | Height: | Size: 4.0 KiB After Width: | Height: | Size: 4.0 KiB |
|
Before Width: | Height: | Size: 4.5 KiB After Width: | Height: | Size: 4.5 KiB |
|
Before Width: | Height: | Size: 4.6 KiB After Width: | Height: | Size: 4.6 KiB |
|
Before Width: | Height: | Size: 4.3 KiB After Width: | Height: | Size: 4.3 KiB |
|
Before Width: | Height: | Size: 4.5 KiB After Width: | Height: | Size: 4.5 KiB |
|
Before Width: | Height: | Size: 4.5 KiB After Width: | Height: | Size: 4.5 KiB |
|
Before Width: | Height: | Size: 4.1 KiB After Width: | Height: | Size: 4.1 KiB |
|
Before Width: | Height: | Size: 4.6 KiB After Width: | Height: | Size: 4.6 KiB |
|
Before Width: | Height: | Size: 4.6 KiB After Width: | Height: | Size: 4.6 KiB |
|
Before Width: | Height: | Size: 4.8 KiB After Width: | Height: | Size: 4.8 KiB |
|
Before Width: | Height: | Size: 3.3 KiB After Width: | Height: | Size: 3.3 KiB |
|
Before Width: | Height: | Size: 3.6 KiB After Width: | Height: | Size: 3.6 KiB |
|
Before Width: | Height: | Size: 2.4 KiB After Width: | Height: | Size: 2.4 KiB |
|
Before Width: | Height: | Size: 516 B After Width: | Height: | Size: 516 B |
|
Before Width: | Height: | Size: 3.2 KiB After Width: | Height: | Size: 3.2 KiB |
|
Before Width: | Height: | Size: 3.2 KiB After Width: | Height: | Size: 3.2 KiB |
|
Before Width: | Height: | Size: 2.8 KiB After Width: | Height: | Size: 2.8 KiB |
|
Before Width: | Height: | Size: 2.7 KiB After Width: | Height: | Size: 2.7 KiB |
|
Before Width: | Height: | Size: 2.9 KiB After Width: | Height: | Size: 2.9 KiB |
|
Before Width: | Height: | Size: 2.8 KiB After Width: | Height: | Size: 2.8 KiB |
|
Before Width: | Height: | Size: 2.5 KiB After Width: | Height: | Size: 2.5 KiB |
|
Before Width: | Height: | Size: 2.4 KiB After Width: | Height: | Size: 2.4 KiB |
|
Before Width: | Height: | Size: 3.6 KiB After Width: | Height: | Size: 3.6 KiB |
|
Before Width: | Height: | Size: 3.6 KiB After Width: | Height: | Size: 3.6 KiB |
|
Before Width: | Height: | Size: 3.6 KiB After Width: | Height: | Size: 3.6 KiB |
|
Before Width: | Height: | Size: 3.3 KiB After Width: | Height: | Size: 3.3 KiB |
|
Before Width: | Height: | Size: 3.4 KiB After Width: | Height: | Size: 3.4 KiB |
|
Before Width: | Height: | Size: 3.7 KiB After Width: | Height: | Size: 3.7 KiB |
|
Before Width: | Height: | Size: 3.5 KiB After Width: | Height: | Size: 3.5 KiB |
|
Before Width: | Height: | Size: 3.7 KiB After Width: | Height: | Size: 3.7 KiB |
|
Before Width: | Height: | Size: 3.4 KiB After Width: | Height: | Size: 3.4 KiB |
|
Before Width: | Height: | Size: 2.9 KiB After Width: | Height: | Size: 2.9 KiB |
|
Before Width: | Height: | Size: 3.0 KiB After Width: | Height: | Size: 3.0 KiB |
|
Before Width: | Height: | Size: 2.9 KiB After Width: | Height: | Size: 2.9 KiB |
|
Before Width: | Height: | Size: 3.1 KiB After Width: | Height: | Size: 3.1 KiB |
|
Before Width: | Height: | Size: 2.9 KiB After Width: | Height: | Size: 2.9 KiB |
|
Before Width: | Height: | Size: 2.8 KiB After Width: | Height: | Size: 2.8 KiB |
|
Before Width: | Height: | Size: 3.4 KiB After Width: | Height: | Size: 3.4 KiB |
|
Before Width: | Height: | Size: 3.6 KiB After Width: | Height: | Size: 3.6 KiB |
|
Before Width: | Height: | Size: 3.6 KiB After Width: | Height: | Size: 3.6 KiB |
|
Before Width: | Height: | Size: 3.4 KiB After Width: | Height: | Size: 3.4 KiB |
|
Before Width: | Height: | Size: 3.3 KiB After Width: | Height: | Size: 3.3 KiB |
|
Before Width: | Height: | Size: 2.8 KiB After Width: | Height: | Size: 2.8 KiB |
|
Before Width: | Height: | Size: 3.4 KiB After Width: | Height: | Size: 3.4 KiB |
|
Before Width: | Height: | Size: 3.5 KiB After Width: | Height: | Size: 3.5 KiB |
|
Before Width: | Height: | Size: 3.6 KiB After Width: | Height: | Size: 3.6 KiB |
|
Before Width: | Height: | Size: 3.6 KiB After Width: | Height: | Size: 3.6 KiB |
|
Before Width: | Height: | Size: 3.6 KiB After Width: | Height: | Size: 3.6 KiB |
|
Before Width: | Height: | Size: 3.7 KiB After Width: | Height: | Size: 3.7 KiB |
1
libraries/map-autonavi/.gitignore
vendored
Normal file
@@ -0,0 +1 @@
|
||||
/build
|
||||
45
libraries/map-autonavi/build.gradle
Normal file
@@ -0,0 +1,45 @@
|
||||
apply plugin: 'com.android.library'
|
||||
|
||||
android {
|
||||
compileSdkVersion rootProject.ext.android.compileSdkVersion
|
||||
// buildToolsVersion rootProject.ext.android.buildToolsVersion
|
||||
defaultConfig {
|
||||
minSdkVersion rootProject.ext.android.minSdkVersion
|
||||
targetSdkVersion rootProject.ext.android.targetSdkVersion
|
||||
versionCode Integer.valueOf(VERSION_CODE)
|
||||
versionName getValueFromRootProperties("${project.name.replace("-", "_").toUpperCase()}_VERSION")
|
||||
|
||||
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
|
||||
consumerProguardFiles "consumer-rules.pro"
|
||||
}
|
||||
|
||||
buildTypes {
|
||||
release {
|
||||
minifyEnabled false
|
||||
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
|
||||
}
|
||||
}
|
||||
|
||||
compileOptions {
|
||||
sourceCompatibility 1.8
|
||||
targetCompatibility 1.8
|
||||
}
|
||||
}
|
||||
|
||||
dependencies {
|
||||
implementation fileTree(dir: "libs", include: ["*.jar"])
|
||||
if (Boolean.valueOf(RELEASE)) {
|
||||
implementation rootProject.ext.dependencies.mogoutils
|
||||
implementation rootProject.ext.dependencies.mogomapapi
|
||||
implementation rootProject.ext.dependencies.mogocommons
|
||||
implementation rootProject.ext.dependencies.mogomapapi
|
||||
implementation rootProject.ext.dependencies.mapamap
|
||||
} else {
|
||||
implementation project(':foudations:mogo-utils')
|
||||
implementation project(':libraries:mogo-map-api')
|
||||
implementation project(':foudations:mogo-commons')
|
||||
implementation project(':services:mogo-service-api')
|
||||
implementation project(':libraries:map-amap')
|
||||
|
||||
}
|
||||
}
|
||||
0
libraries/map-autonavi/consumer-rules.pro
Normal file
3
libraries/map-autonavi/gradle.properties
Normal file
@@ -0,0 +1,3 @@
|
||||
GROUP=com.mogo.map
|
||||
POM_ARTIFACT_ID=map-autonavi
|
||||
VERSION_CODE=1
|
||||
21
libraries/map-autonavi/proguard-rules.pro
vendored
Normal file
@@ -0,0 +1,21 @@
|
||||
# Add project specific ProGuard rules here.
|
||||
# You can control the set of applied configuration files using the
|
||||
# proguardFiles setting in build.gradle.
|
||||
#
|
||||
# For more details, see
|
||||
# http://developer.android.com/guide/developing/tools/proguard.html
|
||||
|
||||
# If your project uses WebView with JS, uncomment the following
|
||||
# and specify the fully qualified class name to the JavaScript interface
|
||||
# class:
|
||||
#-keepclassmembers class fqcn.of.javascript.interface.for.webview {
|
||||
# public *;
|
||||
#}
|
||||
|
||||
# Uncomment this to preserve the line number information for
|
||||
# debugging stack traces.
|
||||
#-keepattributes SourceFile,LineNumberTable
|
||||
|
||||
# If you keep the line number information, uncomment this to
|
||||
# hide the original source file name.
|
||||
#-renamesourcefileattribute SourceFile
|
||||
5
libraries/map-autonavi/src/main/AndroidManifest.xml
Normal file
@@ -0,0 +1,5 @@
|
||||
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
package="com.mogo.map.impl.automap">
|
||||
|
||||
/
|
||||
</manifest>
|
||||
@@ -0,0 +1,228 @@
|
||||
package com.mogo.map.impl.automap.navi;
|
||||
|
||||
import android.content.Context;
|
||||
import android.content.Intent;
|
||||
import android.graphics.Rect;
|
||||
import android.location.Location;
|
||||
|
||||
import com.mogo.map.MogoLatLng;
|
||||
import com.mogo.map.impl.amap.navi.NaviClient;
|
||||
import com.mogo.map.navi.IMogoCarLocationChangedListener2;
|
||||
import com.mogo.map.navi.IMogoNavi;
|
||||
import com.mogo.map.navi.MogoCalculatePath;
|
||||
import com.mogo.map.navi.MogoNaviConfig;
|
||||
import com.mogo.map.navi.OnCalculatePathItemClickInteraction;
|
||||
import com.mogo.utils.logger.Logger;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author congtaowang
|
||||
* @since 2020/6/2
|
||||
* <p>
|
||||
* 使用高德车机版导航
|
||||
*/
|
||||
public class AutoNaviClient implements IMogoNavi {
|
||||
|
||||
private static final String TAG = "NaviClient";
|
||||
|
||||
public static final String ACTION_AUTO_MAP = "AUTO NAVI_STANDARD_BRO ADCAST_RECV";
|
||||
|
||||
public static final String KEY_TYPE = "KEY_TYPE";
|
||||
public static final String SOURCE_APP = "SOURCE_APP";
|
||||
public static final String LAT = "LAT";
|
||||
public static final String LON = "LON";
|
||||
public static final String ENTRY_LAT = "ENTRY_LAT";
|
||||
public static final String ENTRY_LON = "ENTRY_LON";
|
||||
public static final String DEV = "DEV"; // (int)是否偏移(0:lat 和 lon 是已经加密后的,不需要国测加密; 1:需要国测加密)
|
||||
|
||||
/**
|
||||
* (必填)(int)导航方式
|
||||
* =1(避免收费)
|
||||
* =2(多策略算路)
|
||||
* =3 (不走高速)
|
||||
* =4(躲避拥堵)
|
||||
* =5(不走高速且避免收费)
|
||||
* =6(不走高速且躲避拥堵)
|
||||
* =7(躲避收费且躲避拥堵)
|
||||
* =8(不走高速躲避收费和拥堵)
|
||||
* =20 (高速优先)
|
||||
* =24(高速优先且躲避拥堵)
|
||||
* =-1(地图内部设置默认规则)
|
||||
*/
|
||||
public static final String STYLE = "STYLE";
|
||||
|
||||
private static volatile AutoNaviClient sInstance;
|
||||
private final Context mContext;
|
||||
|
||||
private AutoNaviClient( Context context ) {
|
||||
mContext = context;
|
||||
}
|
||||
|
||||
public static AutoNaviClient getInstance( Context context ) {
|
||||
if ( sInstance == null ) {
|
||||
synchronized ( AutoNaviClient.class ) {
|
||||
if ( sInstance == null ) {
|
||||
sInstance = new AutoNaviClient( context );
|
||||
}
|
||||
}
|
||||
}
|
||||
return sInstance;
|
||||
}
|
||||
|
||||
public synchronized void release() {
|
||||
sInstance = null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void naviTo( MogoLatLng endPoint ) {
|
||||
Intent intent = new Intent();
|
||||
intent.putExtra( KEY_TYPE, 10038 );
|
||||
intent.putExtra( LAT, endPoint.lat );
|
||||
intent.putExtra( LON, endPoint.lon );
|
||||
intent.putExtra( ENTRY_LAT, endPoint.lat );
|
||||
intent.putExtra( ENTRY_LON, endPoint.lon );
|
||||
intent.putExtra( DEV, 0 );
|
||||
intent.putExtra( STYLE, -1 );
|
||||
intent.putExtra( SOURCE_APP, "Third App" );
|
||||
startNaviByIntent( intent );
|
||||
}
|
||||
|
||||
@Override
|
||||
public void naviTo( MogoLatLng endPoint, MogoNaviConfig config ) {
|
||||
naviTo( endPoint );
|
||||
}
|
||||
|
||||
@Override
|
||||
public void naviTo( MogoLatLng endPoint, List< MogoLatLng > wayPoints ) {
|
||||
naviTo( endPoint );
|
||||
}
|
||||
|
||||
@Override
|
||||
public void naviTo( MogoLatLng endPoint, List< MogoLatLng > wayPoints, MogoNaviConfig config ) {
|
||||
naviTo( endPoint );
|
||||
}
|
||||
|
||||
@Override
|
||||
public void reCalculateRoute( MogoNaviConfig config ) {
|
||||
Logger.w( TAG, "高德车机导航,不支持此设置" );
|
||||
}
|
||||
|
||||
@Override
|
||||
public void stopNavi() {
|
||||
Logger.w( TAG, "高德车机导航,不支持此设置" );
|
||||
}
|
||||
|
||||
@Override
|
||||
public void startNavi( boolean isRealNavi ) {
|
||||
Logger.w( TAG, "高德车机导航,不支持此设置" );
|
||||
}
|
||||
|
||||
private void startNaviByIntent( Intent intent ) {
|
||||
intent.setAction( ACTION_AUTO_MAP );
|
||||
intent.addFlags( Intent.FLAG_INCLUDE_STOPPED_PACKAGES );
|
||||
mContext.sendBroadcast( intent );
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isNaviing() {
|
||||
Logger.w( TAG, "高德车机导航,不支持此设置" );
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List< MogoCalculatePath > getCalculatedStrategies() {
|
||||
Logger.w( TAG, "高德车机导航,不支持此设置" );
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List< MogoLatLng > getCalculatedPathPos() {
|
||||
Logger.w( TAG, "高德车机导航,不支持此设置" );
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public OnCalculatePathItemClickInteraction getItemClickInteraction() {
|
||||
Logger.w( TAG, "高德车机导航,不支持此设置" );
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setLineClickInteraction( OnCalculatePathItemClickInteraction itemClickInteraction ) {
|
||||
Logger.w( TAG, "高德车机导航,不支持此设置" );
|
||||
}
|
||||
|
||||
@Override
|
||||
public void clearCalculatePaths() {
|
||||
Logger.w( TAG, "高德车机导航,不支持此设置" );
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setCalculatePathDisplayBounds( Rect bounds ) {
|
||||
Logger.w( TAG, "高德车机导航,不支持此设置" );
|
||||
}
|
||||
|
||||
@Override
|
||||
public MogoNaviConfig getNaviConfig() {
|
||||
Logger.w( TAG, "高德车机导航,不支持此设置" );
|
||||
return NaviClient.getInstance( mContext ).getNaviConfig();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean setBroadcastMode( int mode ) {
|
||||
Logger.w( TAG, "高德车机导航,不支持此设置" );
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List< MogoLatLng > getNaviPathCoordinates() {
|
||||
Logger.w( TAG, "高德车机导航,不支持此设置" );
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public MogoLatLng getCarLocation() {
|
||||
return NaviClient.getInstance( mContext ).getCarLocation();
|
||||
}
|
||||
|
||||
@Override
|
||||
public Location getCarLocation2() {
|
||||
return NaviClient.getInstance( mContext ).getCarLocation2();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void registerCarLocationChangedListener( IMogoCarLocationChangedListener2 listener ) {
|
||||
NaviClient.getInstance( mContext ).registerCarLocationChangedListener( listener );
|
||||
}
|
||||
|
||||
@Override
|
||||
public void startAimlessMode() {
|
||||
Logger.w( TAG, "高德车机导航,不支持此设置" );
|
||||
}
|
||||
|
||||
@Override
|
||||
public void stopAimlessMode() {
|
||||
Logger.w( TAG, "高德车机导航,不支持此设置" );
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setAimlessModeStatus( boolean open ) {
|
||||
Logger.w( TAG, "高德车机导航,不支持此设置" );
|
||||
}
|
||||
|
||||
@Override
|
||||
public void displayOverview( Rect bounds ) {
|
||||
Logger.w( TAG, "高德车机导航,不支持此设置" );
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setUseExtraGPSData( boolean use ) {
|
||||
NaviClient.getInstance( mContext ).setUseExtraGPSData( use );
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setExtraGPSData( double lon, double lat, float speed, float accuracy, float bearing, long timestamp ) {
|
||||
NaviClient.getInstance( mContext ).setExtraGPSData( lon, lat, speed, accuracy, bearing, timestamp );
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,69 @@
|
||||
package com.mogo.map.impl.automap.navi;
|
||||
|
||||
import android.content.BroadcastReceiver;
|
||||
import android.content.Context;
|
||||
import android.content.Intent;
|
||||
import android.content.IntentFilter;
|
||||
import android.text.TextUtils;
|
||||
|
||||
import com.mogo.map.navi.MogoNaviInfo;
|
||||
import com.mogo.map.navi.MogoNaviListenerHandler;
|
||||
import com.mogo.utils.logger.Logger;
|
||||
|
||||
/**
|
||||
* @author congtaowang
|
||||
* @since 2020/6/2
|
||||
* <p>
|
||||
* 高德公版地图透出信息广播接收者
|
||||
*/
|
||||
public class AutoNaviReceiver extends BroadcastReceiver {
|
||||
|
||||
private static final String TAG = "AutoNaviReceiver";
|
||||
|
||||
public static final String ACTION_AUTONAVI_SEND = "AUTO NAVI_STANDARD_BROADCAST_SEND";
|
||||
private static AutoNaviReceiver autoNaviReceiver;
|
||||
private static boolean sRegisterFlag = false;
|
||||
|
||||
|
||||
public static void register( Context context ) {
|
||||
IntentFilter filter = new IntentFilter();
|
||||
filter.addAction( ACTION_AUTONAVI_SEND );
|
||||
autoNaviReceiver = new AutoNaviReceiver();
|
||||
context.registerReceiver( autoNaviReceiver, filter );
|
||||
sRegisterFlag = true;
|
||||
}
|
||||
|
||||
public static void unregister( Context context ) {
|
||||
if ( autoNaviReceiver != null && sRegisterFlag ) {
|
||||
try {
|
||||
context.unregisterReceiver( autoNaviReceiver );
|
||||
} catch ( Exception e ) {
|
||||
Logger.e( TAG, e, "error. " );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onReceive( Context context, Intent intent ) {
|
||||
String action = intent.getAction();
|
||||
if ( !TextUtils.equals( ACTION_AUTONAVI_SEND, action ) ) {
|
||||
return;
|
||||
}
|
||||
int keyType = intent.getIntExtra( "KEY_TYPE", 0 );
|
||||
switch ( keyType ) {
|
||||
case 10001:
|
||||
MogoNaviInfo naviInfo = new MogoNaviInfo();
|
||||
naviInfo.setCurrentLimitSpeed( intent.getIntExtra( GuideInfoExtraKey.CAMERA_SPEED, 0 ) );
|
||||
naviInfo.setCurrentRoadName( intent.getStringExtra( GuideInfoExtraKey.CUR_ROAD_NAME ) );
|
||||
naviInfo.setCurrentSpeed( intent.getIntExtra( GuideInfoExtraKey.CUR_SPEED, 0 ) );
|
||||
naviInfo.setCurStepRetainDistance( intent.getIntExtra( GuideInfoExtraKey.SEG_REMAIN_DIS, 0 ) );
|
||||
naviInfo.setCurStepRetainTime( intent.getIntExtra( GuideInfoExtraKey.SEG_REMAIN_TIME, 0 ) );
|
||||
naviInfo.setIconResId( intent.getIntExtra( GuideInfoExtraKey.NEW_ICON, 0 ) );
|
||||
naviInfo.setNextRoadName( intent.getStringExtra( GuideInfoExtraKey.NEXT_ROAD_NAME ) );
|
||||
naviInfo.setPathRetainDistance( intent.getIntExtra( GuideInfoExtraKey.ROUTE_REMAIN_DIS, 0 ) );
|
||||
naviInfo.setPathRetainTime( intent.getIntExtra( GuideInfoExtraKey.ROUTE_REMAIN_TIME, 0 ) );
|
||||
MogoNaviListenerHandler.getInstance().onNaviInfoUpdate( naviInfo );
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,112 @@
|
||||
package com.mogo.map.impl.automap.navi;
|
||||
|
||||
//引导信息对应的KEY值机器描述
|
||||
public class GuideInfoExtraKey {
|
||||
/**
|
||||
* 导航类型,对应的值为int类型
|
||||
* 0:GPS导航
|
||||
* 1:模拟导航
|
||||
* 2:巡航
|
||||
*/
|
||||
public static final String TYPE = "TYPE";
|
||||
|
||||
/**
|
||||
* 当前道路名称,对应的值为String类型
|
||||
*/
|
||||
public static final String CUR_ROAD_NAME = "CUR_ROAD_NAME";
|
||||
|
||||
/**
|
||||
* 下一道路名,对应的值为String类型
|
||||
*/
|
||||
public static final String NEXT_ROAD_NAME = "NEXT_ROAD_NAME";
|
||||
|
||||
/**
|
||||
* 电子眼限速度,对应的值为int类型,无限速则为0,单位:公里/小时
|
||||
*/
|
||||
public static final String CAMERA_SPEED = "CAMERA_SPEED";
|
||||
|
||||
/**
|
||||
* 导航转向图标,对应的值为int类型
|
||||
*/
|
||||
public static final String ICON = "ICON";
|
||||
|
||||
/**
|
||||
* 导航最新的转向图标,对应的值为int类型
|
||||
*/
|
||||
public static final String NEW_ICON = "NEW_ICON";
|
||||
|
||||
/**
|
||||
* 路径剩余距离,对应的值为int类型,单位:米
|
||||
*/
|
||||
public static final String ROUTE_REMAIN_DIS = "ROUTE_REMAIN_DIS";
|
||||
/**
|
||||
* 路径剩余时间,对应的值为int类型,单位:秒
|
||||
*/
|
||||
public static final String ROUTE_REMAIN_TIME = "ROUTE_REMAIN_TIME";
|
||||
|
||||
/**
|
||||
* 当前导航段剩余距离,对应的值为int类型,单位:米
|
||||
*/
|
||||
public static final String SEG_REMAIN_DIS = "SEG_REMAIN_DIS";
|
||||
|
||||
/**
|
||||
* 当前导航段剩余时间,对应的值为int类型,单位:秒
|
||||
*/
|
||||
public static final String SEG_REMAIN_TIME = "SEG_REMAIN_TIME";
|
||||
|
||||
/**
|
||||
* 路径总距离,对应的值为int类型,单位:米
|
||||
*/
|
||||
public static final String ROUTE_ALL_DIS = "ROUTE_ALL_DIS";
|
||||
|
||||
/**
|
||||
* 路径总时间,对应的值为int类型,单位:秒
|
||||
*/
|
||||
public static final String ROUTE_ALL_TIME = "ROUTE_ALL_TIME";
|
||||
|
||||
/**
|
||||
* 当前车速,对应的值为int类型,单位:公里/小时
|
||||
*/
|
||||
public static final String CUR_SPEED = "CUR_SPEED";
|
||||
|
||||
/**
|
||||
* 当前道路类型,对应的值为int类型
|
||||
* 0:高速公路
|
||||
* 1:国道
|
||||
* 2:省道
|
||||
* 3:县道
|
||||
* 4:乡公路
|
||||
* 5:县乡村内部道路
|
||||
* 6:主要大街、城市快速道 * 7:主要道路
|
||||
* 8:次要道路
|
||||
* 9:普通道路
|
||||
* 10:非导航道路
|
||||
*/
|
||||
public static final String ROAD_TYPE = "ROAD_TYPE";
|
||||
|
||||
/**
|
||||
* 路径剩余时间,对应的值为String类型,单位:天/小时/分钟 比如:1天2小时, 21小时30分
|
||||
* 钟(只用于长安)
|
||||
*/
|
||||
public static final String ROUTE_REMAIN_TIME_STRING = "ROUTE_REMAIN_TIME_S TRING";
|
||||
|
||||
/**
|
||||
* 下下个路名名称,对应的值为String类型
|
||||
*/
|
||||
public static final String NEXT_NEXT_ROAD_NAME = "NEXT_NEXT_ROAD_NAME";
|
||||
/**
|
||||
* 下下个路口转向图标,对应的值为int类型
|
||||
*/
|
||||
|
||||
public static final String NEXT_NEXT_TURN_ICON = "NEXT_NEXT_TURN_ICON";
|
||||
|
||||
/**
|
||||
* 距离下下个路口剩余距离,对应的值为int类型,单位:米
|
||||
*/
|
||||
public static final String NEXT_SEG_REMAIN_DIS = "NEXT_SEG_REMAIN_DIS";
|
||||
|
||||
/**
|
||||
* 距离下下个路口剩余时间,对应的值为int类型,单位:秒
|
||||
*/
|
||||
public static final String NEXT_SEG_REMAIN_TIME = "NEXT_SEG_REMAIN_TIME";
|
||||
}
|
||||