Merge remote-tracking branch 'origin/feature/v1.0.4' into feature/v1.0.4
# Conflicts: # modules/mogo-module-service/src/main/java/com/mogo/module/service/marker/MapMarkerManager.java
@@ -48,6 +48,8 @@ ext {
|
||||
fresco : 'com.facebook.fresco:fresco:1.1.0',
|
||||
// 公司服务 - 语音
|
||||
aiassist : "com.zhidaoauto.common:service:1.0.4.10",
|
||||
// 语音替换方案 暂时只用TTS 解决焦点问题
|
||||
aiassistReplace : "com.zhidao.mogoVoicesdk:voice:1.0.4",
|
||||
// 公司服务 - 埋点
|
||||
analytics : "com.elegant.analytics:analytics:1.1.19",
|
||||
|
||||
@@ -139,7 +141,7 @@ ext {
|
||||
|
||||
// gps 模拟
|
||||
gpssimulator : "com.mogo.module:module-gps-simulator:${MOGO_MODULE_GPS_SIMULATOR_VERSION}",
|
||||
gpssimulatordebug : "com.mogo.module:mogo-module-gps-simulator-debug:${MOGO_MODULE_GPS_SIMULATOR_DEBUG_VERSION}",
|
||||
gpssimulatornoop : "com.mogo.module:mogo-module-gps-simulator-noop:${MOGO_MODULE_GPS_SIMULATOR_NOOP_VERSION}",
|
||||
gpssimulatordebug : "com.mogo.module:module-gps-simulator-debug:${MOGO_MODULE_GPS_SIMULATOR_DEBUG_VERSION}",
|
||||
gpssimulatornoop : "com.mogo.module:module-gps-simulator-noop:${MOGO_MODULE_GPS_SIMULATOR_NOOP_VERSION}",
|
||||
]
|
||||
}
|
||||
@@ -37,6 +37,7 @@ android {
|
||||
dependencies {
|
||||
implementation fileTree(dir: 'libs', include: ['*.jar'])
|
||||
api rootProject.ext.dependencies.aiassist
|
||||
api rootProject.ext.dependencies.aiassistReplace
|
||||
api rootProject.ext.dependencies.androidxappcompat
|
||||
api rootProject.ext.dependencies.analytics
|
||||
implementation rootProject.ext.dependencies.arouter
|
||||
|
||||
@@ -1,6 +1,12 @@
|
||||
package com.mogo.commons;
|
||||
|
||||
import android.app.Application;
|
||||
import android.content.Context;
|
||||
import android.text.TextUtils;
|
||||
import android.view.Gravity;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
import android.widget.TextView;
|
||||
|
||||
import com.alibaba.android.arouter.launcher.ARouter;
|
||||
import com.elegant.analytics.Analytics;
|
||||
@@ -57,13 +63,40 @@ public class AbsMogoApplication extends Application {
|
||||
asyncInit();
|
||||
}
|
||||
|
||||
private void syncInit(){
|
||||
private void syncInit() {
|
||||
// 初始化 arouter
|
||||
if ( DebugConfig.isDebug() ) {
|
||||
ARouter.openDebug();
|
||||
ARouter.openLog();
|
||||
}
|
||||
ARouter.init( sApp );
|
||||
TipToast.init( this, new TipToast.ToastViewGenerator() {
|
||||
@Override
|
||||
public View make( Context context, String message ) {
|
||||
if ( TextUtils.isEmpty( message ) ) {
|
||||
return null;
|
||||
}
|
||||
View contentView = LayoutInflater.from( context ).inflate( R.layout.module_commons_layout_toast, null );
|
||||
TextView txt = contentView.findViewById( R.id.module_commons_toast_msg );
|
||||
txt.setText( message );
|
||||
return contentView;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int gravity() {
|
||||
return Gravity.TOP | Gravity.CENTER_HORIZONTAL;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int yOffset() {
|
||||
return sApp.getResources().getDimensionPixelSize( R.dimen.module_commons_toast_y_offset );
|
||||
}
|
||||
|
||||
@Override
|
||||
public int xOffset() {
|
||||
return 0;
|
||||
}
|
||||
} );
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -79,12 +112,11 @@ public class AbsMogoApplication extends Application {
|
||||
return sc;
|
||||
}
|
||||
|
||||
private void asyncInit(){
|
||||
ThreadPoolService.execute( ()->{
|
||||
private void asyncInit() {
|
||||
ThreadPoolService.execute( () -> {
|
||||
initNetConfig();
|
||||
initAccountSdk();
|
||||
// 初始化toast
|
||||
TipToast.init( sApp, null );
|
||||
// 初始化埋点
|
||||
Analytics.getInstance().start( sApp );
|
||||
Analytics.getInstance().setAppKey( "6bbe7e0e1ecd8e2f8dc336e1678a2791" );
|
||||
|
||||
@@ -8,6 +8,10 @@ import android.text.TextUtils;
|
||||
|
||||
import com.mogo.utils.logger.Logger;
|
||||
import com.zhidao.auto.platform.voice.VoiceClient;
|
||||
import com.zhidao.voicesdk.MogoVoiceManager;
|
||||
import com.zhidao.voicesdk.MogoVoiceManagerImpl;
|
||||
import com.zhidao.voicesdk.callback.OnConnStatusListener;
|
||||
import com.zhidao.voicesdk.callback.OnTtsListener;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
@@ -22,13 +26,14 @@ import java.util.concurrent.ConcurrentHashMap;
|
||||
* <p>
|
||||
* 语音助手通信助手
|
||||
*/
|
||||
public class AIAssist implements VoiceClient.VoiceCmdCallBack {
|
||||
public class AIAssist implements VoiceClient.VoiceCmdCallBack , OnTtsListener {
|
||||
|
||||
private static final String TAG = "AIAssist";
|
||||
private static volatile AIAssist sInstance;
|
||||
private String mLastQAndASpeakText;
|
||||
|
||||
private boolean mHasFlush = false;
|
||||
private boolean mInitReady = false;
|
||||
|
||||
public static AIAssist getInstance( Context context ) {
|
||||
if ( sInstance == null ) {
|
||||
@@ -56,6 +61,7 @@ public class AIAssist implements VoiceClient.VoiceCmdCallBack {
|
||||
}
|
||||
|
||||
private final VoiceClient mVoiceClient;
|
||||
private MogoVoiceManager mogoVoiceManager;
|
||||
// 免唤醒指令
|
||||
private Map< String, List< IMogoVoiceCmdCallBack > > mCmdMap = new HashMap<>();
|
||||
// 问答指令
|
||||
@@ -70,7 +76,7 @@ public class AIAssist implements VoiceClient.VoiceCmdCallBack {
|
||||
mVoiceClient = new VoiceClient( context.getApplicationContext() );
|
||||
mVoiceClient.setCallBack( this );
|
||||
initFlushStatus( context );
|
||||
|
||||
initSpeech( context );
|
||||
Logger.w( TAG, "voice is ready = %s", mHasFlush );
|
||||
}
|
||||
|
||||
@@ -78,6 +84,24 @@ public class AIAssist implements VoiceClient.VoiceCmdCallBack {
|
||||
mHasFlush = isVoiceServiceReady( context );
|
||||
}
|
||||
|
||||
/**
|
||||
* 初始化
|
||||
*/
|
||||
private void initSpeech( Context context ){
|
||||
mogoVoiceManager = MogoVoiceManagerImpl.getInstance();
|
||||
mogoVoiceManager.init(context, new OnConnStatusListener() {
|
||||
@Override
|
||||
public void onSuccess() {
|
||||
mInitReady = true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onFailed() {
|
||||
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* 是否语音注册成功
|
||||
* @return
|
||||
@@ -185,7 +209,6 @@ public class AIAssist implements VoiceClient.VoiceCmdCallBack {
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 语音播报
|
||||
*
|
||||
@@ -402,4 +425,36 @@ public class AIAssist implements VoiceClient.VoiceCmdCallBack {
|
||||
return false;
|
||||
}
|
||||
|
||||
public void speakTTSAndDuck(String text ){
|
||||
speakTTSAndDuck(text,null);
|
||||
}
|
||||
|
||||
public void speakTTSAndDuck( String text, IMogoVoiceCmdCallBack callBack ){
|
||||
try {
|
||||
if( mInitReady ){
|
||||
mSpeakVoiceMap.put( text, callBack );
|
||||
mogoVoiceManager.toSpeak( text, -3, this);
|
||||
}
|
||||
} catch ( Exception e ) {
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onTtsStart(String ext) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onTtsFinish(String speakText) {
|
||||
IMogoVoiceCmdCallBack callBack = mSpeakVoiceMap.remove( speakText );
|
||||
if ( callBack != null ) {
|
||||
callBack.onSpeakEnd( speakText );
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onTtsError(String ext) {
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -0,0 +1,8 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<shape xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<corners android:radius="90dp" />
|
||||
<gradient
|
||||
android:angle="270"
|
||||
android:endColor="#F2161616"
|
||||
android:startColor="#F2161616" />
|
||||
</shape>
|
||||
@@ -0,0 +1,27 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:background="@drawable/module_commons_toast_bkg"
|
||||
android:orientation="vertical">
|
||||
|
||||
<TextView
|
||||
android:id="@+id/module_commons_toast_msg"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center"
|
||||
android:layout_marginLeft="@dimen/module_commons_toast_marginLeft"
|
||||
android:layout_marginTop="@dimen/module_commons_toast_marginTop"
|
||||
android:layout_marginRight="@dimen/module_commons_toast_marginRight"
|
||||
android:layout_marginBottom="@dimen/module_commons_toast_marginBottom"
|
||||
android:ellipsize="end"
|
||||
android:gravity="center"
|
||||
android:maxWidth="@dimen/module_commons_toast_maxWidth"
|
||||
android:maxLength="20"
|
||||
android:maxLines="1"
|
||||
android:minWidth="@dimen/module_commons_toast_minWidth"
|
||||
android:textColor="#FFFF"
|
||||
android:textSize="@dimen/module_commons_toast_textSize"
|
||||
tools:text="测试测试测试测试测试测试测试测试测试测试测试测试测试测试测试测试测试测试测试测试测试测试测试测试测试测试测试测试" />
|
||||
</LinearLayout>
|
||||
11
foudations/mogo-commons/src/main/res/values-ldpi/dimens.xml
Normal file
@@ -0,0 +1,11 @@
|
||||
<?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>
|
||||
13
foudations/mogo-commons/src/main/res/values-xhdpi/dimens.xml
Normal file
@@ -0,0 +1,13 @@
|
||||
<?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>
|
||||
|
||||
|
||||
13
foudations/mogo-commons/src/main/res/values/dimens.xml
Normal file
@@ -0,0 +1,13 @@
|
||||
<?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>
|
||||
|
||||
|
||||
@@ -9,6 +9,7 @@ package com.mogo.utils;
|
||||
import android.content.Context;
|
||||
import android.os.Handler;
|
||||
import android.text.TextUtils;
|
||||
import android.view.Gravity;
|
||||
import android.view.View;
|
||||
import android.widget.Toast;
|
||||
|
||||
@@ -144,10 +145,6 @@ public final class TipToast {
|
||||
sToast.cancel();
|
||||
}
|
||||
|
||||
if ( sGenerator == null ) {
|
||||
sToast = Toast.makeText( context, msg, duration );
|
||||
}
|
||||
|
||||
if ( sGenerator == null ) {
|
||||
sToast = Toast.makeText( context, msg, duration );
|
||||
} else {
|
||||
@@ -155,6 +152,7 @@ public final class TipToast {
|
||||
final View view = sGenerator.make( context, msg );
|
||||
if ( view != null ) {
|
||||
sToast.setView( view );
|
||||
sToast.setGravity( sGenerator.gravity(), sGenerator.xOffset(), sGenerator.yOffset() );
|
||||
sToast.setDuration( duration );
|
||||
} else {
|
||||
sToast = Toast.makeText( context, msg, duration );
|
||||
@@ -171,6 +169,12 @@ public final class TipToast {
|
||||
|
||||
public interface ToastViewGenerator {
|
||||
View make( Context context, String message );
|
||||
|
||||
int gravity();
|
||||
|
||||
int yOffset();
|
||||
|
||||
int xOffset();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -27,38 +27,38 @@ PASSWORD=xintai2018
|
||||
RELEASE=false
|
||||
# 模块版本
|
||||
## 工程内模块
|
||||
MOGO_COMMONS_VERSION=1.0.3.1
|
||||
MOGO_UTILS_VERSION=1.0.3.1
|
||||
MAP_AMAP_VERSION=1.0.3.1
|
||||
MOGO_MAP_VERSION=1.0.3.1
|
||||
MOGO_MAP_API_VERSION=1.0.3.1
|
||||
MOGO_SERVICE_VERSION=1.0.3.1
|
||||
MOGO_SERVICE_API_VERSION=1.0.3.1
|
||||
MOGO_CONNECTION_VERSION=1.0.3.1
|
||||
MOGO_MODULE_APPS_VERSION=1.0.3.1
|
||||
MOGO_MODULE_NAVI_VERSION=1.0.3.1
|
||||
MOGO_MODULE_SHARE_VERSION=1.0.3.1
|
||||
MOGO_MODULE_COMMON_VERSION=1.0.3.2
|
||||
MOGO_MODULE_MAIN_VERSION=1.0.3.1
|
||||
MOGO_MODULE_MAP_VERSION=1.0.3.1
|
||||
MOGO_MODULE_SERVICE_VERSION=1.0.3.1
|
||||
MOGO_MODULE_EXTENSIONS_VERSION=1.0.3.1
|
||||
MOGO_MODULE_SEARCH_VERSION=1.0.3.1
|
||||
MOGO_MODULE_BACK_VERSION=1.0.3.1
|
||||
MOGO_MODULE_GPS_SIMULATOR_VERSION=1.0.3.1
|
||||
MOGO_MODULE_GPS_SIMULATOR_DEBUG_VERSION=1.0.3.1
|
||||
MOGO_MODULE_GPS_SIMULATOR_NOOP_VERSION=1.0.3.1
|
||||
MOGO_COMMONS_VERSION=1.0.3.8
|
||||
MOGO_UTILS_VERSION=1.0.3.8
|
||||
MAP_AMAP_VERSION=1.0.3.8
|
||||
MOGO_MAP_VERSION=1.0.3.8
|
||||
MOGO_MAP_API_VERSION=1.0.3.8
|
||||
MOGO_SERVICE_VERSION=1.0.3.8
|
||||
MOGO_SERVICE_API_VERSION=1.0.3.8
|
||||
MOGO_CONNECTION_VERSION=1.0.3.8
|
||||
MOGO_MODULE_APPS_VERSION=1.0.3.8
|
||||
MOGO_MODULE_NAVI_VERSION=1.0.3.8
|
||||
MOGO_MODULE_SHARE_VERSION=1.0.3.8
|
||||
MOGO_MODULE_COMMON_VERSION=1.0.3.8
|
||||
MOGO_MODULE_MAIN_VERSION=1.0.3.8
|
||||
MOGO_MODULE_MAP_VERSION=1.0.3.8
|
||||
MOGO_MODULE_SERVICE_VERSION=1.0.3.8
|
||||
MOGO_MODULE_EXTENSIONS_VERSION=1.0.3.8
|
||||
MOGO_MODULE_SEARCH_VERSION=1.0.3.8
|
||||
MOGO_MODULE_BACK_VERSION=1.0.3.8
|
||||
MOGO_MODULE_GPS_SIMULATOR_VERSION=1.0.3.8
|
||||
MOGO_MODULE_GPS_SIMULATOR_DEBUG_VERSION=1.0.3.8
|
||||
MOGO_MODULE_GPS_SIMULATOR_NOOP_VERSION=1.0.3.8
|
||||
MOGO_MODULE_AUTHORIZE_VERSION=1.0.3.8
|
||||
MOGO_MODULE_GUIDE_VERSION=1.0.3.8
|
||||
|
||||
MOGO_MODULE_AUTHORIZE_VERSION=1.0.0
|
||||
MOGO_MODULE_GUIDE_VERSION=1.0.0
|
||||
|
||||
## 工程外部模块
|
||||
# 探路
|
||||
MOGO_MODULE_TANLU_VERSION=1.0.3.2
|
||||
MOGO_MODULE_TANLU_VERSION=1.0.4.2
|
||||
# 车聊聊
|
||||
CARCHATTING_VERSION=1.0.3
|
||||
CARCHATTING_VERSION=1.0.3.2-SNAPSHOT
|
||||
# 车聊聊接口
|
||||
CARCHATTINGPROVIDER_VERSION=1.0.3
|
||||
CARCHATTINGPROVIDER_VERSION=1.0.3.2-SNAPSHOT
|
||||
# 视频引导
|
||||
MOGO_MODULE_GUIDESHOW_VERSION=1.0.2-SNAPSHOT
|
||||
# 视频引导接口
|
||||
@@ -66,13 +66,12 @@ MOGO_MODULE_GUIDESHOW_PROVIDER_VERSION=1.0.2-SNAPSHOT
|
||||
# 在线车辆F
|
||||
MOGO_MODULE_ONLINECAR_VERSION=1.0.3.1
|
||||
# v2x
|
||||
MOGO_MODULE_V2X_VERSION=1.0.3.2
|
||||
MOGO_MODULE_V2X_VERSION=1.0.3.3-SNAPSHOT
|
||||
# 媒体卡片
|
||||
MOGO_MODULE_MEDIA_VERSION=1.0.3
|
||||
MOGO_MODULE_MEDIA_VERSION=1.0.4.1
|
||||
# 推送
|
||||
MOGO_MODULE_PUSH_VERSION=1.0.1
|
||||
# 广告资源位
|
||||
MOGO_MODULE_AD_CARD_VERSION=1.0.1
|
||||
# 新鲜事
|
||||
MOGO_MODULE_FRESH_NEWS_VERSION=1.0.3.1
|
||||
|
||||
MOGO_MODULE_FRESH_NEWS_VERSION=1.0.3.2
|
||||
|
||||
@@ -39,10 +39,12 @@ dependencies {
|
||||
implementation rootProject.ext.dependencies.mogoutils
|
||||
implementation rootProject.ext.dependencies.mogomapapi
|
||||
implementation rootProject.ext.dependencies.mogocommons
|
||||
implementation rootProject.ext.dependencies.mogomapapi
|
||||
} else {
|
||||
implementation project(':foudations:mogo-utils')
|
||||
implementation project(':libraries:mogo-map-api')
|
||||
implementation project(':foudations:mogo-commons')
|
||||
implementation project(':services:mogo-service-api')
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -601,11 +601,11 @@ public class AMapNaviViewWrapper implements IMogoMapView,
|
||||
}
|
||||
|
||||
@Override
|
||||
public void displayOverview() {
|
||||
public void displayOverview( Rect bounds ) {
|
||||
if ( checkAMapView() ) {
|
||||
if ( NaviClient.getInstance( getContext() ).isNaviing() ) {
|
||||
loseLockMode();
|
||||
NaviClient.getInstance( getContext() ).displayOverview();
|
||||
NaviClient.getInstance( getContext() ).displayOverview( bounds );
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -633,6 +633,7 @@ public class AMapNaviViewWrapper implements IMogoMapView,
|
||||
if ( checkAMapView() ) {
|
||||
mMapView.setCarOverlayVisible( false );
|
||||
showMyLocation( true );
|
||||
NaviClient.getInstance( getContext() ).startAimlessMode();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -823,12 +824,16 @@ public class AMapNaviViewWrapper implements IMogoMapView,
|
||||
|
||||
@Override
|
||||
public void setCarCursorOption( CarCursorOption option ) {
|
||||
if ( mCarCursorOption != null ) {
|
||||
if ( mCarCursorOption != null && mCarCursorOption != DEFAULT_OPTION ) {
|
||||
mCarCursorOption.destroy();
|
||||
}
|
||||
try {
|
||||
mCarCursorOption = option.clone();
|
||||
} catch ( CloneNotSupportedException e ) {
|
||||
if ( option != null ) {
|
||||
try {
|
||||
mCarCursorOption = option.clone();
|
||||
} catch ( Exception e ) {
|
||||
mCarCursorOption = DEFAULT_OPTION;
|
||||
}
|
||||
} else {
|
||||
mCarCursorOption = DEFAULT_OPTION;
|
||||
}
|
||||
if ( !checkAMapView() ) {
|
||||
@@ -837,8 +842,10 @@ public class AMapNaviViewWrapper implements IMogoMapView,
|
||||
AMapNaviViewOptions options = mMapView.getViewOptions();
|
||||
if ( options != null && mCarCursorOption.getNaviCursorRes() != 0 ) {
|
||||
options.setCarBitmap( BitmapFactory.decodeResource( getContext().getResources(), mCarCursorOption.getNaviCursorRes() ) );
|
||||
mMapView.setViewOptions( options );
|
||||
} else {
|
||||
options.setCarBitmap( BitmapFactory.decodeResource( getContext().getResources(), DEFAULT_OPTION.getNaviCursorRes() ) );
|
||||
}
|
||||
mMapView.setViewOptions( options );
|
||||
|
||||
if ( mMapView.getMap() == null ) {
|
||||
return;
|
||||
@@ -849,6 +856,8 @@ public class AMapNaviViewWrapper implements IMogoMapView,
|
||||
} else {
|
||||
if ( mCarCursorOption.getCarCursorRes() != 0 ) {
|
||||
style.myLocationIcon( BitmapDescriptorFactory.fromResource( mCarCursorOption.getCarCursorRes() ) );
|
||||
} else {
|
||||
style.myLocationIcon( BitmapDescriptorFactory.fromResource( DEFAULT_OPTION.getCarCursorRes() ) );
|
||||
}
|
||||
}
|
||||
mMapView.getMap().setMyLocationStyle( style );
|
||||
|
||||
@@ -15,6 +15,8 @@ import com.amap.api.navi.model.AimLessModeCongestionInfo;
|
||||
import com.amap.api.navi.model.AimLessModeStat;
|
||||
import com.amap.api.navi.model.NaviInfo;
|
||||
import com.autonavi.tbt.TrafficFacilityInfo;
|
||||
import com.mogo.commons.AbsMogoApplication;
|
||||
import com.mogo.commons.voice.AIAssist;
|
||||
import com.mogo.map.MogoLatLng;
|
||||
import com.mogo.utils.logger.Logger;
|
||||
import java.util.List;
|
||||
@@ -64,6 +66,7 @@ public abstract class AMapNaviListenerAdapter implements AMapNaviListener {
|
||||
public void onGetNavigationText( String s ) {
|
||||
mLastSpeakWord = s;
|
||||
Logger.d( TAG, s );
|
||||
AIAssist.getInstance(AbsMogoApplication.getApp()).speakTTSAndDuck(s);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -11,17 +11,20 @@ import com.amap.api.navi.enums.AimLessMode;
|
||||
import com.amap.api.navi.enums.NaviType;
|
||||
import com.amap.api.navi.model.NaviLatLng;
|
||||
import com.mogo.commons.AbsMogoApplication;
|
||||
import com.mogo.commons.voice.AIAssist;
|
||||
import com.mogo.map.MogoLatLng;
|
||||
import com.mogo.map.impl.amap.AMapWrapper;
|
||||
import com.mogo.map.impl.amap.message.AMapMessageManager;
|
||||
import com.mogo.map.impl.amap.utils.ObjectUtils;
|
||||
import com.mogo.map.navi.IMogoCarLocationChangedListener;
|
||||
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.MogoNaviListenerHandler;
|
||||
import com.mogo.map.navi.OnCalculatePathItemClickInteraction;
|
||||
import com.mogo.utils.logger.Logger;
|
||||
import com.mogo.utils.storage.SharedPrefsMgr;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
@@ -35,7 +38,13 @@ import java.util.List;
|
||||
*/
|
||||
public class NaviClient implements IMogoNavi {
|
||||
|
||||
/**
|
||||
* 巡航状态控制
|
||||
*/
|
||||
public static final String KEY_AIMLESS_STATUS = "KEY_AIMLESS_STATUS";
|
||||
|
||||
private static final String TAG = "NaviClient";
|
||||
private final Context mContext;
|
||||
|
||||
private AMapNavi mAMapNavi;
|
||||
private final NaviListenerAdapter mAMapNaviListener;
|
||||
@@ -53,10 +62,20 @@ public class NaviClient implements IMogoNavi {
|
||||
private boolean mIsRealNavi;
|
||||
|
||||
private Location mCarLocation;
|
||||
private IMogoCarLocationChangedListener mCarLocationChangedListener;
|
||||
private IMogoCarLocationChangedListener2 mCarLocationChangedListener;
|
||||
private LocationSource.OnLocationChangedListener mOnLocationChangedListener;
|
||||
/**
|
||||
* 巡航模式配置状态
|
||||
*/
|
||||
private boolean mAimlessModeStatus;
|
||||
|
||||
/**
|
||||
* 巡航状态
|
||||
*/
|
||||
private boolean mAimlessStatus;
|
||||
|
||||
private NaviClient( Context context ) {
|
||||
mContext = context;
|
||||
mAMapNavi = AMapNavi.getInstance( context );
|
||||
mAMapNavi.setEmulatorNaviSpeed( 120 );
|
||||
mAMapNavi.setUseInnerVoice( false, true );
|
||||
@@ -65,6 +84,7 @@ public class NaviClient implements IMogoNavi {
|
||||
};
|
||||
mAMapNavi.addAMapNaviListener( mAMapNaviListener );
|
||||
mAMapNavi.addAimlessModeListener( mAimlessModeListener );
|
||||
mAimlessModeStatus = SharedPrefsMgr.getInstance( mContext ).getBoolean( KEY_AIMLESS_STATUS, false );
|
||||
}
|
||||
|
||||
public static NaviClient getInstance( Context context ) {
|
||||
@@ -151,7 +171,7 @@ public class NaviClient implements IMogoNavi {
|
||||
return;
|
||||
}
|
||||
mIsRealNavi = isRealNavi;
|
||||
|
||||
stopAimlessMode();
|
||||
boolean isNaving = isNaviing();
|
||||
boolean result = mAMapNavi.startNavi( isRealNavi ? NaviType.GPS : NaviType.EMULATOR );
|
||||
if ( isNaving && !result ) {
|
||||
@@ -241,7 +261,12 @@ public class NaviClient implements IMogoNavi {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void registerCarLocationChangedListener( IMogoCarLocationChangedListener listener ) {
|
||||
public Location getCarLocation2() {
|
||||
return mCarLocation;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void registerCarLocationChangedListener( IMogoCarLocationChangedListener2 listener ) {
|
||||
mCarLocationChangedListener = listener;
|
||||
}
|
||||
|
||||
@@ -250,7 +275,7 @@ public class NaviClient implements IMogoNavi {
|
||||
public void syncCarLocation( Location location ) {
|
||||
mCarLocation = location;
|
||||
if ( mCarLocationChangedListener != null ) {
|
||||
mCarLocationChangedListener.onCarLocationChanged( getCarLocation() );
|
||||
mCarLocationChangedListener.onCarLocationChanged2( mCarLocation );
|
||||
}
|
||||
}
|
||||
|
||||
@@ -274,18 +299,42 @@ public class NaviClient implements IMogoNavi {
|
||||
|
||||
@Override
|
||||
public void startAimlessMode() {
|
||||
mAMapNavi.startAimlessMode( AimLessMode.CAMERA_AND_SPECIALROAD_DETECTED );
|
||||
if ( mAimlessModeStatus && !isNaviing() ) {
|
||||
mAMapNavi.startAimlessMode( AimLessMode.CAMERA_AND_SPECIALROAD_DETECTED );
|
||||
mAimlessStatus = true;
|
||||
Logger.d( TAG, "开启巡航成功" );
|
||||
} else {
|
||||
mAimlessStatus = false;
|
||||
Logger.d( TAG, "开启巡航失败" );
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void stopAimlessMode() {
|
||||
mAMapNavi.stopAimlessMode();
|
||||
mAimlessStatus = false;
|
||||
Logger.d( TAG, "关闭巡航成功" );
|
||||
}
|
||||
|
||||
@Override
|
||||
public void displayOverview() {
|
||||
public void setAimlessModeStatus( boolean open ) {
|
||||
this.mAimlessModeStatus = open;
|
||||
SharedPrefsMgr.getInstance( mContext ).putBoolean( KEY_AIMLESS_STATUS, open );
|
||||
if ( open ) {
|
||||
if ( !mAimlessStatus ) {
|
||||
startAimlessMode();
|
||||
}
|
||||
} else {
|
||||
if ( mAimlessStatus ) {
|
||||
stopAimlessMode();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void displayOverview( Rect bounds ) {
|
||||
if ( mAMapNaviListener != null ) {
|
||||
mAMapNaviListener.displayOverview();
|
||||
mAMapNaviListener.displayOverview( bounds );
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -95,6 +95,7 @@ public class NaviListenerAdapter extends AMapNaviListenerAdapter {
|
||||
@Override
|
||||
public void onInitNaviSuccess() {
|
||||
MogoNaviListenerHandler.getInstance().onInitNaviSuccess();
|
||||
NaviClient.getInstance( mContext ).startAimlessMode();
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -245,9 +246,10 @@ public class NaviListenerAdapter extends AMapNaviListenerAdapter {
|
||||
|
||||
public void handleClickedPolyline( Polyline polyline ) {
|
||||
if ( mNaviOverlayHelper != null ) {
|
||||
|
||||
mNaviOverlayHelper.handleClickedPolyline( polyline, isNaviing() );
|
||||
mAMapNavi.selectRouteId( mNaviOverlayHelper.getSelectedPathId() );
|
||||
mNaviOverlayHelper.showBounds();
|
||||
mNaviOverlayHelper.showBoundsWithSettingBounds();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -291,9 +293,9 @@ public class NaviListenerAdapter extends AMapNaviListenerAdapter {
|
||||
}
|
||||
}
|
||||
|
||||
public void displayOverview(){
|
||||
public void displayOverview( Rect bounds ) {
|
||||
if ( mNaviOverlayHelper != null ) {
|
||||
mNaviOverlayHelper.displayOverview();
|
||||
mNaviOverlayHelper.displayOverview( bounds );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -99,7 +99,7 @@ public class NaviOverlayHelper implements OnCalculatePathItemClickInteraction {
|
||||
if ( after != null ) {
|
||||
after.run();
|
||||
}
|
||||
} );
|
||||
}, mBoundRect );
|
||||
}
|
||||
|
||||
private LatLngBounds getBounds() {
|
||||
@@ -169,25 +169,32 @@ public class NaviOverlayHelper implements OnCalculatePathItemClickInteraction {
|
||||
}
|
||||
}
|
||||
|
||||
public void showBounds() {
|
||||
public void showBoundsWithSettingBounds() {
|
||||
showBounds( mBoundRect );
|
||||
}
|
||||
|
||||
public void showBounds( Rect bounds ) {
|
||||
Logger.d( TAG, "showBounds" );
|
||||
showPathsBound( getBounds(), null );
|
||||
showPathsBound( getBounds(), null, bounds );
|
||||
}
|
||||
|
||||
/**
|
||||
* 将规划好的路径显示在视野内
|
||||
*/
|
||||
private void showPathsBound( LatLngBounds bounds, Runnable after ) {
|
||||
private void showPathsBound( LatLngBounds bounds, Runnable after, Rect rect ) {
|
||||
if ( bounds == null ) {
|
||||
return;
|
||||
}
|
||||
if ( rect == null ) {
|
||||
rect = new Rect();
|
||||
}
|
||||
checkAMapInstance();
|
||||
mAMap.moveCamera( CameraUpdateFactory.newLatLngBoundsRect(
|
||||
bounds,
|
||||
mBoundRect.left,
|
||||
mBoundRect.right,
|
||||
mBoundRect.top,
|
||||
mBoundRect.bottom ));
|
||||
rect.left,
|
||||
rect.right,
|
||||
rect.top,
|
||||
rect.bottom ) );
|
||||
if ( after != null ) {
|
||||
after.run();
|
||||
}
|
||||
@@ -431,7 +438,7 @@ public class NaviOverlayHelper implements OnCalculatePathItemClickInteraction {
|
||||
public void onItemClicked( String tagId ) {
|
||||
handleClickedPolyline( tagId );
|
||||
mAMapNavi.selectRouteId( getSelectedPathId() );
|
||||
showBounds();
|
||||
showBounds( mBoundRect );
|
||||
}
|
||||
|
||||
public OnCalculatePathItemClickInteraction getItemClickInteraction() {
|
||||
@@ -451,7 +458,7 @@ public class NaviOverlayHelper implements OnCalculatePathItemClickInteraction {
|
||||
/**
|
||||
* 展示全程
|
||||
*/
|
||||
public void displayOverview(){
|
||||
showBounds();
|
||||
public void displayOverview( Rect bounds ) {
|
||||
showBounds( bounds );
|
||||
}
|
||||
}
|
||||
|
||||
@@ -126,9 +126,9 @@ public class AMapUIController implements IMogoMapUIController {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void displayOverview() {
|
||||
public void displayOverview( Rect bounds ) {
|
||||
if (mClient != null) {
|
||||
mClient.displayOverview();
|
||||
mClient.displayOverview(bounds);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -0,0 +1,14 @@
|
||||
package com.mogo.map.navi;
|
||||
|
||||
import android.location.Location;
|
||||
|
||||
/**
|
||||
* @author congtaowang
|
||||
* @since 2020-03-14
|
||||
* <p>
|
||||
* 车辆位置变化
|
||||
*/
|
||||
public interface IMogoCarLocationChangedListener2 extends IMogoCarLocationChangedListener {
|
||||
|
||||
void onCarLocationChanged2( Location latLng );
|
||||
}
|
||||
@@ -144,12 +144,19 @@ public interface IMogoNavi {
|
||||
*/
|
||||
MogoLatLng getCarLocation();
|
||||
|
||||
/**
|
||||
* 获取车标经纬度
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
Location getCarLocation2();
|
||||
|
||||
/**
|
||||
* 注册车辆位置变化监听,非业务使用
|
||||
*
|
||||
* @param listener
|
||||
*/
|
||||
void registerCarLocationChangedListener( IMogoCarLocationChangedListener listener );
|
||||
void registerCarLocationChangedListener( IMogoCarLocationChangedListener2 listener );
|
||||
|
||||
/**
|
||||
* 打开巡航模式
|
||||
@@ -161,10 +168,17 @@ public interface IMogoNavi {
|
||||
*/
|
||||
void stopAimlessMode();
|
||||
|
||||
/**
|
||||
* 设置巡航模式状态
|
||||
*
|
||||
* @param open
|
||||
*/
|
||||
void setAimlessModeStatus( boolean open );
|
||||
|
||||
/**
|
||||
* 查看全程
|
||||
*/
|
||||
void displayOverview();
|
||||
void displayOverview( Rect bounds );
|
||||
|
||||
/**
|
||||
* 设置使用外部定位源
|
||||
|
||||
@@ -7,6 +7,7 @@ import android.view.View;
|
||||
import android.view.animation.Interpolator;
|
||||
|
||||
import androidx.annotation.DrawableRes;
|
||||
import androidx.annotation.Nullable;
|
||||
|
||||
import com.mogo.map.MogoLatLng;
|
||||
import com.mogo.map.marker.IMogoMarker;
|
||||
@@ -88,8 +89,10 @@ public interface IMogoMapUIController {
|
||||
|
||||
/**
|
||||
* 预览全程
|
||||
*
|
||||
* @param bounds 显示范围
|
||||
*/
|
||||
void displayOverview();
|
||||
void displayOverview( Rect bounds );
|
||||
|
||||
/**
|
||||
* 获取比例尺数据
|
||||
@@ -192,7 +195,7 @@ public interface IMogoMapUIController {
|
||||
/**
|
||||
* 配置自车图标样式
|
||||
*
|
||||
* @param option
|
||||
* @param option 为空时使用默认配置
|
||||
*/
|
||||
void setCarCursorOption( CarCursorOption option );
|
||||
void setCarCursorOption( @Nullable CarCursorOption option );
|
||||
}
|
||||
|
||||
@@ -120,9 +120,9 @@ public class MogoMapUIController implements IMogoMapUIController {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void displayOverview() {
|
||||
public void displayOverview( Rect bounds ) {
|
||||
if (mDelegate != null) {
|
||||
mDelegate.displayOverview();
|
||||
mDelegate.displayOverview(bounds);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -6,6 +6,7 @@ import android.location.Location;
|
||||
|
||||
import com.mogo.map.impl.amap.navi.NaviClient;
|
||||
import com.mogo.map.navi.IMogoCarLocationChangedListener;
|
||||
import com.mogo.map.navi.IMogoCarLocationChangedListener2;
|
||||
import com.mogo.map.navi.IMogoNavi;
|
||||
import com.mogo.map.navi.MogoCalculatePath;
|
||||
import com.mogo.map.navi.MogoNaviConfig;
|
||||
@@ -176,7 +177,15 @@ public class MogoNavi implements IMogoNavi {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void registerCarLocationChangedListener( IMogoCarLocationChangedListener listener ) {
|
||||
public Location getCarLocation2() {
|
||||
if ( mDelegate != null ) {
|
||||
return mDelegate.getCarLocation2();
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void registerCarLocationChangedListener( IMogoCarLocationChangedListener2 listener ) {
|
||||
if ( mDelegate != null ) {
|
||||
mDelegate.registerCarLocationChangedListener( listener );
|
||||
}
|
||||
@@ -197,9 +206,16 @@ public class MogoNavi implements IMogoNavi {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void displayOverview() {
|
||||
public void setAimlessModeStatus( boolean open ) {
|
||||
if ( mDelegate != null ) {
|
||||
mDelegate.displayOverview();
|
||||
mDelegate.setAimlessModeStatus( open );
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void displayOverview( Rect bounds ) {
|
||||
if ( mDelegate != null ) {
|
||||
mDelegate.displayOverview(bounds);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
#!/bin/bash
|
||||
|
||||
./gradlew :libraries:mogo-map-api:clean :libraries:mogo-map-api:uploadArchives
|
||||
./gradlew :libraries:map-amap:clean :libraries:map-amap:uploadArchives
|
||||
./gradlew :libraries:mogo-map:clean :libraries:mogo-map:uploadArchives
|
||||
./gradlew :services:mogo-service-api:clean :services:mogo-service-api:uploadArchives
|
||||
./gradlew :services:mogo-service:clean :services:mogo-service:uploadArchives
|
||||
./gradlew :modules:mogo-module-extensions:clean :modules:mogo-module-extensions:uploadArchives
|
||||
@@ -39,14 +39,14 @@ public class MapCenterPointStrategy {
|
||||
// 导航场景,定位视图右下角偏下
|
||||
Map< Integer, MapCenterPoint > navi = new HashMap<>();
|
||||
navi.put( CarSeries.CAR_SERIES_D80X, new MapCenterPoint( 0.7734375D, 0.65D ) );
|
||||
navi.put( CarSeries.CAR_SERIES_F80X, new MapCenterPoint( 0.775521D, 0.6759259D ) );
|
||||
navi.put( CarSeries.CAR_SERIES_F80X, new MapCenterPoint( 0.775521D, 0.661165D ) );
|
||||
sStrategies.put( Scene.NAVI, navi );
|
||||
|
||||
|
||||
// 巡航场景,定位视图右下角偏下
|
||||
Map< Integer, MapCenterPoint > aimless = new HashMap<>();
|
||||
aimless.put( CarSeries.CAR_SERIES_D80X, new MapCenterPoint( 0.677734375D, 0.54D ) );
|
||||
aimless.put( CarSeries.CAR_SERIES_F80X, new MapCenterPoint( 0.6963541D, 0.6833333D ) );
|
||||
aimless.put( CarSeries.CAR_SERIES_F80X, new MapCenterPoint( 0.6963541D, 0.558737D ) );
|
||||
sStrategies.put( Scene.AIMLESS, aimless );
|
||||
|
||||
|
||||
@@ -61,6 +61,13 @@ public class MapCenterPointStrategy {
|
||||
categorySearch.put( CarSeries.CAR_SERIES_D80X, new MapCenterPoint( 0.733398D, 0.610833D ) );
|
||||
categorySearch.put( CarSeries.CAR_SERIES_F80X, new MapCenterPoint( 0.733594D, 0.596759D ) );
|
||||
sStrategies.put( Scene.CATEGORY_SEARCH, categorySearch );
|
||||
|
||||
|
||||
// V2X,场景视图右边
|
||||
Map< Integer, MapCenterPoint > categoryV2XEvent = new HashMap<>();
|
||||
categoryV2XEvent.put( CarSeries.CAR_SERIES_D80X, new MapCenterPoint( 0.677734375D, 0.7D ) );
|
||||
categoryV2XEvent.put( CarSeries.CAR_SERIES_F80X, new MapCenterPoint( 0.6963541D, 0.65D ) );
|
||||
sStrategies.put( Scene.CATEGORY_V2X_EVENT, categoryV2XEvent );
|
||||
}
|
||||
|
||||
public static void addScene( int scene, Map< Integer, MapCenterPoint > config ) {
|
||||
|
||||
@@ -37,4 +37,9 @@ public interface Scene {
|
||||
* 分类搜索
|
||||
*/
|
||||
int CATEGORY_SEARCH = 5;
|
||||
|
||||
/**
|
||||
* V2X触发了预警场景
|
||||
*/
|
||||
int CATEGORY_V2X_EVENT = 6;
|
||||
}
|
||||
|
||||
@@ -24,8 +24,6 @@ import com.mogo.map.navi.IMogoNaviListener;
|
||||
import com.mogo.map.navi.MogoCongestionInfo;
|
||||
import com.mogo.map.navi.MogoNaviInfo;
|
||||
import com.mogo.map.navi.MogoTraffic;
|
||||
import com.mogo.map.overlay.IMogoPolyline;
|
||||
import com.mogo.map.uicontroller.CarCursorOption;
|
||||
import com.mogo.map.uicontroller.EnumMapUI;
|
||||
import com.mogo.map.uicontroller.IMogoMapUIController;
|
||||
import com.mogo.module.authorize.authprovider.invoke.AuthorizeConstant;
|
||||
@@ -41,12 +39,14 @@ import com.mogo.module.share.ShareControl;
|
||||
import com.mogo.service.IMogoServiceApis;
|
||||
import com.mogo.service.MogoServicePaths;
|
||||
import com.mogo.service.analytics.IMogoAnalytics;
|
||||
import com.mogo.service.entrance.ButtonIndex;
|
||||
import com.mogo.service.fragmentmanager.IMogoFragmentManager;
|
||||
import com.mogo.service.intent.IMogoIntentListener;
|
||||
import com.mogo.service.map.IMogoMapService;
|
||||
import com.mogo.service.module.IMogoAddressManager;
|
||||
import com.mogo.service.module.IMogoRegisterCenter;
|
||||
import com.mogo.service.statusmanager.IMogoStatusManager;
|
||||
import com.mogo.utils.logger.Logger;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
@@ -222,6 +222,8 @@ public class EntranceFragment extends MvpFragment< EntranceView, EntrancePresent
|
||||
}
|
||||
}
|
||||
} );
|
||||
MogoEntranceButtons.save( ButtonIndex.BUTTON1, findViewById( R.id.module_entrance_id_button1 ) );
|
||||
MogoEntranceButtons.save( ButtonIndex.BUTTON2, findViewById( R.id.module_entrance_id_button2 ) );
|
||||
|
||||
}
|
||||
|
||||
@@ -303,6 +305,7 @@ public class EntranceFragment extends MvpFragment< EntranceView, EntrancePresent
|
||||
|
||||
@Override
|
||||
public void onStartNavi() {
|
||||
mSearch.setVisibility( View.GONE );
|
||||
mCommonAddress.setVisibility( View.GONE );
|
||||
mNaviInfo.setVisibility( View.VISIBLE );
|
||||
mCameraMode.setVisibility( View.VISIBLE );
|
||||
@@ -315,6 +318,7 @@ public class EntranceFragment extends MvpFragment< EntranceView, EntrancePresent
|
||||
|
||||
@Override
|
||||
public void onStopNavi() {
|
||||
mSearch.setVisibility( View.VISIBLE );
|
||||
mCommonAddress.setVisibility( View.VISIBLE );
|
||||
mNaviInfo.setVisibility( View.GONE );
|
||||
mCameraMode.setVisibility( View.GONE );
|
||||
@@ -345,7 +349,8 @@ public class EntranceFragment extends MvpFragment< EntranceView, EntrancePresent
|
||||
mSpeedLimit.setVisibility( View.INVISIBLE );
|
||||
mSpeedLimitValue.setText( "--" );
|
||||
} else {
|
||||
mSpeedLimit.setVisibility( View.VISIBLE );
|
||||
// 暂时不显示限速,等有好的显示方案在放开
|
||||
mSpeedLimit.setVisibility( View.INVISIBLE );
|
||||
mSpeedLimitValue.setText( String.valueOf( traffic.getSpeedLimit() ) );
|
||||
}
|
||||
}
|
||||
@@ -380,6 +385,9 @@ public class EntranceFragment extends MvpFragment< EntranceView, EntrancePresent
|
||||
mIsLock = isLock;
|
||||
if ( isLock ) {
|
||||
mExitNavi.setText( R.string.module_ext_str_exit_navi );
|
||||
if ( mMogoStatusManager.isDisplayOverview() ) {
|
||||
mMogoStatusManager.setDisplayOverview( TAG, false );
|
||||
}
|
||||
} else {
|
||||
mExitNavi.setText( R.string.module_ext_str_continue_navi );
|
||||
}
|
||||
@@ -400,4 +408,32 @@ public class EntranceFragment extends MvpFragment< EntranceView, EntrancePresent
|
||||
properties.put( "from", from );
|
||||
mAnalytics.track( "Launcher_Share_Click", properties );
|
||||
}
|
||||
|
||||
@Override
|
||||
public void showNaviPanelWidgets() {
|
||||
if ( !mMogoNavi.isNaviing() ) {
|
||||
return;
|
||||
}
|
||||
mNaviInfo.setVisibility( View.VISIBLE );
|
||||
mCameraMode.setVisibility( View.VISIBLE );
|
||||
try {
|
||||
mApis.getWindowManagerApi().showAll();
|
||||
} catch ( Exception e ) {
|
||||
Logger.e( TAG, e, "error." );
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void hideNaviPanelWidgets() {
|
||||
if ( !mMogoNavi.isNaviing() ) {
|
||||
return;
|
||||
}
|
||||
mNaviInfo.setVisibility( View.GONE );
|
||||
mCameraMode.setVisibility( View.GONE );
|
||||
try {
|
||||
mApis.getWindowManagerApi().hideAll();
|
||||
} catch ( Exception e ) {
|
||||
Logger.e( TAG, e, "error." );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -6,6 +6,9 @@ import android.net.Uri;
|
||||
import android.text.TextUtils;
|
||||
import android.util.Log;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.lifecycle.LifecycleOwner;
|
||||
|
||||
import com.alibaba.android.arouter.launcher.ARouter;
|
||||
import com.mogo.commons.mvp.Presenter;
|
||||
import com.mogo.commons.voice.AIAssist;
|
||||
@@ -14,10 +17,14 @@ import com.mogo.module.authorize.authprovider.invoke.AuthorizeInvokerConstant;
|
||||
import com.mogo.module.authorize.authprovider.module.IMogoAuthorizeModuleManager;
|
||||
import com.mogo.module.extensions.ExtensionsModuleConst;
|
||||
import com.mogo.module.share.ShareControl;
|
||||
import com.mogo.service.IMogoServiceApis;
|
||||
import com.mogo.service.MogoServicePaths;
|
||||
import com.mogo.service.analytics.IMogoAnalytics;
|
||||
import com.mogo.service.intent.IMogoIntentListener;
|
||||
import com.mogo.service.intent.IMogoIntentManager;
|
||||
import com.mogo.service.statusmanager.IMogoStatusChangedListener;
|
||||
import com.mogo.service.statusmanager.IMogoStatusManager;
|
||||
import com.mogo.service.statusmanager.StatusDescriptor;
|
||||
import com.mogo.utils.logger.Logger;
|
||||
|
||||
import org.json.JSONObject;
|
||||
@@ -33,7 +40,7 @@ import static com.mogo.module.authorize.authprovider.invoke.AuthorizeInvokerCons
|
||||
* <p>
|
||||
* 描述
|
||||
*/
|
||||
public class EntrancePresenter extends Presenter<EntranceView> {
|
||||
public class EntrancePresenter extends Presenter< EntranceView > implements IMogoStatusChangedListener {
|
||||
|
||||
private Context mContext;
|
||||
private IMogoAnalytics mAnalytics;
|
||||
@@ -42,32 +49,28 @@ public class EntrancePresenter extends Presenter<EntranceView> {
|
||||
private IMogoAuthorizeModuleManager mIMogoAuthorizeModuleManager;
|
||||
private String mVoiceCmdType; //一级命令
|
||||
private String mVoiceCmdShareType; //对某些一级命令里面细分的类型做处理
|
||||
private IMogoStatusManager mStatusManager;
|
||||
|
||||
|
||||
public EntrancePresenter(Context context, EntranceView view, IMogoAuthorizeModuleManager authorizeModuleManager) {
|
||||
super(view);
|
||||
public EntrancePresenter( Context context, EntranceView view, IMogoAuthorizeModuleManager authorizeModuleManager ) {
|
||||
super( view );
|
||||
mContext = context;
|
||||
mAnalytics = (IMogoAnalytics) ARouter.getInstance().build(MogoServicePaths.PATH_UTILS_ANALYTICS).navigation(getContext());
|
||||
mogoIntentManager = (IMogoIntentManager) ARouter.getInstance().build(MogoServicePaths.PATH_INTENT_MANAGER).navigation(getContext());
|
||||
IMogoServiceApis apis = ( IMogoServiceApis ) ARouter.getInstance().build( MogoServicePaths.PATH_SERVICE_APIS ).navigation( mContext );
|
||||
mAnalytics = apis.getAnalyticsApi();
|
||||
mogoIntentManager = apis.getIntentManagerApi();
|
||||
mIMogoAuthorizeModuleManager = authorizeModuleManager;
|
||||
|
||||
mStatusManager = apis.getStatusManagerApi();
|
||||
registerUnWake();
|
||||
registerAwakeVoice();
|
||||
}
|
||||
|
||||
|
||||
private void registerUnWake() {
|
||||
AIAssist.getInstance(mContext).registerUnWakeupCommand(ExtensionsModuleConst.CLOSE,
|
||||
ExtensionsModuleConst.CMD_CLOSE, mogoVoiceListener);
|
||||
AIAssist.getInstance(mContext).registerUnWakeupCommand(ExtensionsModuleConst.CANCLE_SHARE,
|
||||
ExtensionsModuleConst.CMD_CANCLE_SHARE, mogoVoiceListener);
|
||||
AIAssist.getInstance( mContext ).registerUnWakeupCommand( ExtensionsModuleConst.CLOSE, ExtensionsModuleConst.CMD_CLOSE, mogoVoiceListener );
|
||||
AIAssist.getInstance( mContext ).registerUnWakeupCommand( ExtensionsModuleConst.CANCLE_SHARE, ExtensionsModuleConst.CMD_CANCLE_SHARE, mogoVoiceListener );
|
||||
//探路相关上报
|
||||
AIAssist.getInstance(mContext).registerUnWakeupCommand(ExtensionsModuleConst.UPLOAD_ROAD_BLOCK,
|
||||
ExtensionsModuleConst.CMD_UPLOAD_BLOCK, mogoVoiceListener);
|
||||
AIAssist.getInstance(mContext).registerUnWakeupCommand(ExtensionsModuleConst.UPLOAD_TRAFFIC_CHECK,
|
||||
ExtensionsModuleConst.CMD_TRAFFIC_CHECK, mogoVoiceListener);
|
||||
AIAssist.getInstance(mContext).registerUnWakeupCommand(ExtensionsModuleConst.UPLOAD_ROAD_CLOSURE,
|
||||
ExtensionsModuleConst.CMD_ROAD_CLOSURE, mogoVoiceListener);
|
||||
AIAssist.getInstance( mContext ).registerUnWakeupCommand( ExtensionsModuleConst.UPLOAD_ROAD_BLOCK, ExtensionsModuleConst.CMD_UPLOAD_BLOCK, mogoVoiceListener );
|
||||
AIAssist.getInstance( mContext ).registerUnWakeupCommand( ExtensionsModuleConst.UPLOAD_TRAFFIC_CHECK, ExtensionsModuleConst.CMD_TRAFFIC_CHECK, mogoVoiceListener );
|
||||
AIAssist.getInstance( mContext ).registerUnWakeupCommand( ExtensionsModuleConst.UPLOAD_ROAD_CLOSURE, ExtensionsModuleConst.CMD_ROAD_CLOSURE, mogoVoiceListener );
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -75,31 +78,31 @@ public class EntrancePresenter extends Presenter<EntranceView> {
|
||||
*/
|
||||
private IMogoVoiceCmdCallBack mogoVoiceListener = new IMogoVoiceCmdCallBack() {
|
||||
@Override
|
||||
public void onCmdSelected(String cmd) {
|
||||
Log.d(TAG, "免唤醒 mogoVoiceListener needAuthorize = " + mIMogoAuthorizeModuleManager.needAuthorize(AUTHORIZE_TYPE_LAUNCHER_SHARE) + " >>>cmd = " + cmd);
|
||||
public void onCmdSelected( String cmd ) {
|
||||
Log.d( TAG, "免唤醒 mogoVoiceListener needAuthorize = " + mIMogoAuthorizeModuleManager.needAuthorize( AUTHORIZE_TYPE_LAUNCHER_SHARE ) + " >>>cmd = " + cmd );
|
||||
mVoiceCmdType = cmd;
|
||||
if (cmd.equals(ExtensionsModuleConst.CANCLE_SHARE)
|
||||
|| cmd.equals(ExtensionsModuleConst.CLOSE)) { //取消分享,关闭页面
|
||||
if (mIMogoAuthorizeModuleManager.needAuthorize(AUTHORIZE_TYPE_LAUNCHER_SHARE)) {
|
||||
mIMogoAuthorizeModuleManager.invokeAuthorization(AUTHORIZE_TYPE_LAUNCHER_SHARE);
|
||||
if ( cmd.equals( ExtensionsModuleConst.CANCLE_SHARE )
|
||||
|| cmd.equals( ExtensionsModuleConst.CLOSE ) ) { //取消分享,关闭页面
|
||||
if ( mIMogoAuthorizeModuleManager.needAuthorize( AUTHORIZE_TYPE_LAUNCHER_SHARE ) ) {
|
||||
mIMogoAuthorizeModuleManager.invokeAuthorization( AUTHORIZE_TYPE_LAUNCHER_SHARE );
|
||||
} else {
|
||||
ShareControl.getInstance(mContext).dismissDialog();
|
||||
ShareControl.getInstance( mContext ).dismissDialog();
|
||||
}
|
||||
} else if (cmd.equals(ExtensionsModuleConst.UPLOAD_ROAD_BLOCK)) { //上报拥堵
|
||||
if (mIMogoAuthorizeModuleManager.needAuthorize(AUTHORIZE_TYPE_LAUNCHER_SHARE)) {
|
||||
mIMogoAuthorizeModuleManager.invokeAuthorization(AUTHORIZE_TYPE_LAUNCHER_SHARE);
|
||||
} else if ( cmd.equals( ExtensionsModuleConst.UPLOAD_ROAD_BLOCK ) ) { //上报拥堵
|
||||
if ( mIMogoAuthorizeModuleManager.needAuthorize( AUTHORIZE_TYPE_LAUNCHER_SHARE ) ) {
|
||||
mIMogoAuthorizeModuleManager.invokeAuthorization( AUTHORIZE_TYPE_LAUNCHER_SHARE );
|
||||
} else {
|
||||
uploadRoadCondition();
|
||||
}
|
||||
} else if (cmd.equals(ExtensionsModuleConst.UPLOAD_TRAFFIC_CHECK)) { //上报交通检查
|
||||
if (mIMogoAuthorizeModuleManager.needAuthorize(AUTHORIZE_TYPE_LAUNCHER_SHARE)) {
|
||||
mIMogoAuthorizeModuleManager.invokeAuthorization(AUTHORIZE_TYPE_LAUNCHER_SHARE);
|
||||
} else if ( cmd.equals( ExtensionsModuleConst.UPLOAD_TRAFFIC_CHECK ) ) { //上报交通检查
|
||||
if ( mIMogoAuthorizeModuleManager.needAuthorize( AUTHORIZE_TYPE_LAUNCHER_SHARE ) ) {
|
||||
mIMogoAuthorizeModuleManager.invokeAuthorization( AUTHORIZE_TYPE_LAUNCHER_SHARE );
|
||||
} else {
|
||||
uploadTrfficCheck();
|
||||
}
|
||||
} else if (cmd.equals(ExtensionsModuleConst.UPLOAD_ROAD_CLOSURE)) { //上报封路
|
||||
if (mIMogoAuthorizeModuleManager.needAuthorize(AUTHORIZE_TYPE_LAUNCHER_SHARE)) {
|
||||
mIMogoAuthorizeModuleManager.invokeAuthorization(AUTHORIZE_TYPE_LAUNCHER_SHARE);
|
||||
} else if ( cmd.equals( ExtensionsModuleConst.UPLOAD_ROAD_CLOSURE ) ) { //上报封路
|
||||
if ( mIMogoAuthorizeModuleManager.needAuthorize( AUTHORIZE_TYPE_LAUNCHER_SHARE ) ) {
|
||||
mIMogoAuthorizeModuleManager.invokeAuthorization( AUTHORIZE_TYPE_LAUNCHER_SHARE );
|
||||
} else {
|
||||
uploadRoadClosed();
|
||||
}
|
||||
@@ -107,32 +110,38 @@ public class EntrancePresenter extends Presenter<EntranceView> {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onCmdAction(String speakText) {
|
||||
public void onCmdAction( String speakText ) {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onCmdCancel(String speakText) {
|
||||
public void onCmdCancel( String speakText ) {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onSpeakEnd(String speakText) {
|
||||
public void onSpeakEnd( String speakText ) {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onSpeakSelectTimeOut(String speakText) {
|
||||
public void onSpeakSelectTimeOut( String speakText ) {
|
||||
}
|
||||
};
|
||||
|
||||
@Override
|
||||
public void onCreate( @NonNull LifecycleOwner owner ) {
|
||||
super.onCreate( owner );
|
||||
mStatusManager.registerStatusChangedListener( TAG, StatusDescriptor.DISPLAY_OVERVIEW, this );
|
||||
}
|
||||
|
||||
/**
|
||||
* 注册唤醒命令
|
||||
*/
|
||||
private void registerAwakeVoice() {
|
||||
mogoIntentManager.registerIntentListener(ExtensionsModuleConst.UPLOAD_ROAD_CONDITION, mogoIntentListener);
|
||||
mogoIntentManager.registerIntentListener( ExtensionsModuleConst.UPLOAD_ROAD_CONDITION, mogoIntentListener );
|
||||
|
||||
mogoIntentManager.registerIntentListener(ExtensionsModuleConst.GO_TO_SHARE, mogoIntentListener);
|
||||
mogoIntentManager.registerIntentListener(ExtensionsModuleConst.SHARE_DIALOG_CLOSE, mogoIntentListener);
|
||||
mogoIntentManager.registerIntentListener(ExtensionsModuleConst.UPLOAD_ROAD_CONDITION_AWAKEN, mogoIntentListener);
|
||||
mogoIntentManager.registerIntentListener(ExtensionsModuleConst.NO_REPLY_SHARE_DIALOG_CLOSE, mogoIntentListener);
|
||||
mogoIntentManager.registerIntentListener( ExtensionsModuleConst.GO_TO_SHARE, mogoIntentListener );
|
||||
mogoIntentManager.registerIntentListener( ExtensionsModuleConst.SHARE_DIALOG_CLOSE, mogoIntentListener );
|
||||
mogoIntentManager.registerIntentListener( ExtensionsModuleConst.UPLOAD_ROAD_CONDITION_AWAKEN, mogoIntentListener );
|
||||
mogoIntentManager.registerIntentListener( ExtensionsModuleConst.NO_REPLY_SHARE_DIALOG_CLOSE, mogoIntentListener );
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -140,81 +149,81 @@ public class EntrancePresenter extends Presenter<EntranceView> {
|
||||
*/
|
||||
private IMogoIntentListener mogoIntentListener = new IMogoIntentListener() {
|
||||
@Override
|
||||
public void onIntentReceived(String intentStr, Intent intent) {
|
||||
public void onIntentReceived( String intentStr, Intent intent ) {
|
||||
mVoiceCmdType = intentStr;
|
||||
EntranceFragment.isClickShare = false;
|
||||
|
||||
String data = intent.getStringExtra("data");
|
||||
Log.d(TAG, "唤醒 mogoIntentListener intentStr =" + intentStr + ">>data =" + data + " >>> needAuthorize = " + mIMogoAuthorizeModuleManager.needAuthorize(AUTHORIZE_TYPE_LAUNCHER_SHARE));
|
||||
if (intentStr.equals(ExtensionsModuleConst.GO_TO_SHARE)) { //我要分享 --ok
|
||||
String conditionData = intent.getStringExtra("data");
|
||||
Log.d(TAG, "唤醒 mogoIntentListener intentStr =" + intentStr + ">>conditionData =" + conditionData);
|
||||
String data = intent.getStringExtra( "data" );
|
||||
Log.d( TAG, "唤醒 mogoIntentListener intentStr =" + intentStr + ">>data =" + data + " >>> needAuthorize = " + mIMogoAuthorizeModuleManager.needAuthorize( AUTHORIZE_TYPE_LAUNCHER_SHARE ) );
|
||||
if ( intentStr.equals( ExtensionsModuleConst.GO_TO_SHARE ) ) { //我要分享 --ok
|
||||
String conditionData = intent.getStringExtra( "data" );
|
||||
Log.d( TAG, "唤醒 mogoIntentListener intentStr =" + intentStr + ">>conditionData =" + conditionData );
|
||||
try {
|
||||
JSONObject jsonObject = new JSONObject(data);
|
||||
String typeString = jsonObject.get("ob").toString();
|
||||
Log.d(TAG, "mogoIntentListener specified typeString = " + typeString);
|
||||
JSONObject jsonObject = new JSONObject( data );
|
||||
String typeString = jsonObject.get( "ob" ).toString();
|
||||
Log.d( TAG, "mogoIntentListener specified typeString = " + typeString );
|
||||
mVoiceCmdShareType = typeString;
|
||||
if (!TextUtils.isEmpty(typeString)) {
|
||||
if (typeString.equals("封路")) {
|
||||
if (mIMogoAuthorizeModuleManager.needAuthorize(AUTHORIZE_TYPE_LAUNCHER_SHARE)) {
|
||||
mIMogoAuthorizeModuleManager.invokeAuthorization(AUTHORIZE_TYPE_LAUNCHER_SHARE);
|
||||
if ( !TextUtils.isEmpty( typeString ) ) {
|
||||
if ( typeString.equals( "封路" ) ) {
|
||||
if ( mIMogoAuthorizeModuleManager.needAuthorize( AUTHORIZE_TYPE_LAUNCHER_SHARE ) ) {
|
||||
mIMogoAuthorizeModuleManager.invokeAuthorization( AUTHORIZE_TYPE_LAUNCHER_SHARE );
|
||||
} else {
|
||||
Log.d(TAG, "mogoIntentListener 封路 -------> ");
|
||||
Log.d( TAG, "mogoIntentListener 封路 -------> " );
|
||||
uploadRoadClosed();
|
||||
}
|
||||
} else if (typeString.equals("油价")) {
|
||||
if (mIMogoAuthorizeModuleManager.needAuthorize(AUTHORIZE_TYPE_LAUNCHER_SHARE)) {
|
||||
mIMogoAuthorizeModuleManager.invokeAuthorization(AUTHORIZE_TYPE_LAUNCHER_SHARE);
|
||||
} else if ( typeString.equals( "油价" ) ) {
|
||||
if ( mIMogoAuthorizeModuleManager.needAuthorize( AUTHORIZE_TYPE_LAUNCHER_SHARE ) ) {
|
||||
mIMogoAuthorizeModuleManager.invokeAuthorization( AUTHORIZE_TYPE_LAUNCHER_SHARE );
|
||||
} else {
|
||||
Log.d(TAG, "mogoIntentListener 油价 -------> ");
|
||||
Log.d( TAG, "mogoIntentListener 油价 -------> " );
|
||||
shareOilPrice();
|
||||
}
|
||||
} else if (typeString.equals("交通检查")) {
|
||||
if (mIMogoAuthorizeModuleManager.needAuthorize(AUTHORIZE_TYPE_LAUNCHER_SHARE)) {
|
||||
mIMogoAuthorizeModuleManager.invokeAuthorization(AUTHORIZE_TYPE_LAUNCHER_SHARE);
|
||||
} else if ( typeString.equals( "交通检查" ) ) {
|
||||
if ( mIMogoAuthorizeModuleManager.needAuthorize( AUTHORIZE_TYPE_LAUNCHER_SHARE ) ) {
|
||||
mIMogoAuthorizeModuleManager.invokeAuthorization( AUTHORIZE_TYPE_LAUNCHER_SHARE );
|
||||
} else {
|
||||
Log.d(TAG, "mogoIntentListener 交通检查 -------> ");
|
||||
Log.d( TAG, "mogoIntentListener 交通检查 -------> " );
|
||||
uploadTrfficCheck();
|
||||
}
|
||||
}
|
||||
} else {
|
||||
if (mIMogoAuthorizeModuleManager.needAuthorize(AUTHORIZE_TYPE_LAUNCHER_SHARE)) {
|
||||
mIMogoAuthorizeModuleManager.invokeAuthorization(AUTHORIZE_TYPE_LAUNCHER_SHARE);
|
||||
if ( mIMogoAuthorizeModuleManager.needAuthorize( AUTHORIZE_TYPE_LAUNCHER_SHARE ) ) {
|
||||
mIMogoAuthorizeModuleManager.invokeAuthorization( AUTHORIZE_TYPE_LAUNCHER_SHARE );
|
||||
} else {
|
||||
ShareControl.getInstance(mContext).showDialog();
|
||||
Log.d(TAG, "mogoIntentListener 我要分享 ----> ");
|
||||
traceData("2");
|
||||
ShareControl.getInstance( mContext ).showDialog();
|
||||
Log.d( TAG, "mogoIntentListener 我要分享 ----> " );
|
||||
traceData( "2" );
|
||||
}
|
||||
}
|
||||
} catch (Exception e) {
|
||||
} catch ( Exception e ) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
} else if (intentStr.equals(ExtensionsModuleConst.UPLOAD_ROAD_CONDITION_AWAKEN)) {
|
||||
} else if ( intentStr.equals( ExtensionsModuleConst.UPLOAD_ROAD_CONDITION_AWAKEN ) ) {
|
||||
//分享路况/上报路况/上报拥堵 唤醒
|
||||
if (mIMogoAuthorizeModuleManager.needAuthorize(AUTHORIZE_TYPE_LAUNCHER_SHARE)) {
|
||||
mIMogoAuthorizeModuleManager.invokeAuthorization(AUTHORIZE_TYPE_LAUNCHER_SHARE);
|
||||
if ( mIMogoAuthorizeModuleManager.needAuthorize( AUTHORIZE_TYPE_LAUNCHER_SHARE ) ) {
|
||||
mIMogoAuthorizeModuleManager.invokeAuthorization( AUTHORIZE_TYPE_LAUNCHER_SHARE );
|
||||
} else {
|
||||
uploadRoadCondition();
|
||||
Log.d(TAG, "mogoIntentListener 分享路况 唤醒 ----> ");
|
||||
Log.d( TAG, "mogoIntentListener 分享路况 唤醒 ----> " );
|
||||
}
|
||||
} else if (intentStr.equals(ExtensionsModuleConst.SHARE_DIALOG_CLOSE)) { //关闭分享框 唤醒
|
||||
if (mIMogoAuthorizeModuleManager.needAuthorize(AUTHORIZE_TYPE_LAUNCHER_SHARE)) {
|
||||
mIMogoAuthorizeModuleManager.invokeAuthorization(AUTHORIZE_TYPE_LAUNCHER_SHARE);
|
||||
} else if ( intentStr.equals( ExtensionsModuleConst.SHARE_DIALOG_CLOSE ) ) { //关闭分享框 唤醒
|
||||
if ( mIMogoAuthorizeModuleManager.needAuthorize( AUTHORIZE_TYPE_LAUNCHER_SHARE ) ) {
|
||||
mIMogoAuthorizeModuleManager.invokeAuthorization( AUTHORIZE_TYPE_LAUNCHER_SHARE );
|
||||
} else {
|
||||
ShareControl.getInstance(mContext).dismissDialog();
|
||||
Log.d(TAG, "mogoIntentListener 关闭分享框 唤醒 ----> ");
|
||||
ShareControl.getInstance( mContext ).dismissDialog();
|
||||
Log.d( TAG, "mogoIntentListener 关闭分享框 唤醒 ----> " );
|
||||
}
|
||||
} else if (intentStr.equals(ExtensionsModuleConst.NO_REPLY_SHARE_DIALOG_CLOSE)) {
|
||||
} else if ( intentStr.equals( ExtensionsModuleConst.NO_REPLY_SHARE_DIALOG_CLOSE ) ) {
|
||||
// 两次未回复关闭对话框
|
||||
if (mIMogoAuthorizeModuleManager.needAuthorize(AUTHORIZE_TYPE_LAUNCHER_SHARE)) {
|
||||
mIMogoAuthorizeModuleManager.invokeAuthorization(AUTHORIZE_TYPE_LAUNCHER_SHARE);
|
||||
if ( mIMogoAuthorizeModuleManager.needAuthorize( AUTHORIZE_TYPE_LAUNCHER_SHARE ) ) {
|
||||
mIMogoAuthorizeModuleManager.invokeAuthorization( AUTHORIZE_TYPE_LAUNCHER_SHARE );
|
||||
} else {
|
||||
ShareControl.getInstance(mContext).dismissDialog();
|
||||
Logger.d(TAG, "mogoIntentListener 两次未回复关闭对话框");
|
||||
ShareControl.getInstance( mContext ).dismissDialog();
|
||||
Logger.d( TAG, "mogoIntentListener 两次未回复关闭对话框" );
|
||||
}
|
||||
} else if (intentStr.equals(ExtensionsModuleConst.UPLOAD_ROAD_CONDITION)) { //上报路况 免唤醒 --ok
|
||||
if (mIMogoAuthorizeModuleManager.needAuthorize(AUTHORIZE_TYPE_LAUNCHER_SHARE)) {
|
||||
mIMogoAuthorizeModuleManager.invokeAuthorization(AUTHORIZE_TYPE_LAUNCHER_SHARE);
|
||||
} else if ( intentStr.equals( ExtensionsModuleConst.UPLOAD_ROAD_CONDITION ) ) { //上报路况 免唤醒 --ok
|
||||
if ( mIMogoAuthorizeModuleManager.needAuthorize( AUTHORIZE_TYPE_LAUNCHER_SHARE ) ) {
|
||||
mIMogoAuthorizeModuleManager.invokeAuthorization( AUTHORIZE_TYPE_LAUNCHER_SHARE );
|
||||
} else {
|
||||
uploadRoadCondition();
|
||||
}
|
||||
@@ -227,65 +236,65 @@ public class EntrancePresenter extends Presenter<EntranceView> {
|
||||
* 处理需要授权的命令 TODO
|
||||
*/
|
||||
public void handleNeedAuthorizeCmd() {
|
||||
Log.e(TAG, "handleNeedAuthorizeCmd mVoiceCmdType = " + mVoiceCmdType + " >>> mVoiceCmdShareType = " + mVoiceCmdShareType);
|
||||
if (!TextUtils.isEmpty(mVoiceCmdType)) {
|
||||
if (mVoiceCmdType.equals(ExtensionsModuleConst.CANCLE_SHARE) || mVoiceCmdType.equals(ExtensionsModuleConst.CLOSE)
|
||||
|| mVoiceCmdType.equals(ExtensionsModuleConst.SHARE_DIALOG_CLOSE) || mVoiceCmdType.equals(ExtensionsModuleConst.NO_REPLY_SHARE_DIALOG_CLOSE)) { //关闭分享弹框
|
||||
ShareControl.getInstance(mContext).dismissDialog();
|
||||
} else if (mVoiceCmdType.equals(ExtensionsModuleConst.GO_TO_SHARE)) { //打开分享弹框
|
||||
if (!TextUtils.isEmpty(mVoiceCmdShareType)) {
|
||||
if (mVoiceCmdShareType.equals("封路")) {
|
||||
Log.d(TAG, "handleNeedAuthorizeCmd 封路 -------> ");
|
||||
Log.e( TAG, "handleNeedAuthorizeCmd mVoiceCmdType = " + mVoiceCmdType + " >>> mVoiceCmdShareType = " + mVoiceCmdShareType );
|
||||
if ( !TextUtils.isEmpty( mVoiceCmdType ) ) {
|
||||
if ( mVoiceCmdType.equals( ExtensionsModuleConst.CANCLE_SHARE ) || mVoiceCmdType.equals( ExtensionsModuleConst.CLOSE )
|
||||
|| mVoiceCmdType.equals( ExtensionsModuleConst.SHARE_DIALOG_CLOSE ) || mVoiceCmdType.equals( ExtensionsModuleConst.NO_REPLY_SHARE_DIALOG_CLOSE ) ) { //关闭分享弹框
|
||||
ShareControl.getInstance( mContext ).dismissDialog();
|
||||
} else if ( mVoiceCmdType.equals( ExtensionsModuleConst.GO_TO_SHARE ) ) { //打开分享弹框
|
||||
if ( !TextUtils.isEmpty( mVoiceCmdShareType ) ) {
|
||||
if ( mVoiceCmdShareType.equals( "封路" ) ) {
|
||||
Log.d( TAG, "handleNeedAuthorizeCmd 封路 -------> " );
|
||||
uploadRoadClosed();
|
||||
} else if (mVoiceCmdShareType.equals("油价")) {
|
||||
Log.d(TAG, "handleNeedAuthorizeCmd 油价 -------> ");
|
||||
} else if ( mVoiceCmdShareType.equals( "油价" ) ) {
|
||||
Log.d( TAG, "handleNeedAuthorizeCmd 油价 -------> " );
|
||||
shareOilPrice();
|
||||
} else if (mVoiceCmdShareType.equals("交通检查")) {
|
||||
Log.d(TAG, "handleNeedAuthorizeCmd 交通检查 -------> ");
|
||||
} else if ( mVoiceCmdShareType.equals( "交通检查" ) ) {
|
||||
Log.d( TAG, "handleNeedAuthorizeCmd 交通检查 -------> " );
|
||||
uploadTrfficCheck();
|
||||
}
|
||||
} else {
|
||||
ShareControl.getInstance(mContext).showDialog();
|
||||
Log.d(TAG, "handleNeedAuthorizeCmd 我要分享 ----> ");
|
||||
traceData("2");
|
||||
ShareControl.getInstance( mContext ).showDialog();
|
||||
Log.d( TAG, "handleNeedAuthorizeCmd 我要分享 ----> " );
|
||||
traceData( "2" );
|
||||
}
|
||||
} else if (mVoiceCmdType.equals(ExtensionsModuleConst.UPLOAD_TRAFFIC_CHECK)) { //上报交通检查
|
||||
Log.d(TAG, "handleNeedAuthorizeCmd 上报交通检查 ----> ");
|
||||
} else if ( mVoiceCmdType.equals( ExtensionsModuleConst.UPLOAD_TRAFFIC_CHECK ) ) { //上报交通检查
|
||||
Log.d( TAG, "handleNeedAuthorizeCmd 上报交通检查 ----> " );
|
||||
uploadTrfficCheck();
|
||||
} else if (mVoiceCmdType.equals(ExtensionsModuleConst.UPLOAD_ROAD_CLOSURE)) { //上报封路
|
||||
Log.d(TAG, "handleNeedAuthorizeCmd 上报封路 ----> ");
|
||||
} else if ( mVoiceCmdType.equals( ExtensionsModuleConst.UPLOAD_ROAD_CLOSURE ) ) { //上报封路
|
||||
Log.d( TAG, "handleNeedAuthorizeCmd 上报封路 ----> " );
|
||||
uploadRoadClosed();
|
||||
} else if (mVoiceCmdType.equals(ExtensionsModuleConst.UPLOAD_ROAD_BLOCK)
|
||||
|| mVoiceCmdType.equals(ExtensionsModuleConst.UPLOAD_ROAD_CONDITION_AWAKEN)
|
||||
|| mVoiceCmdType.equals(ExtensionsModuleConst.UPLOAD_ROAD_CONDITION)) { //上报拥堵, 分享路况, 上报路况
|
||||
Log.d(TAG, "handleNeedAuthorizeCmd 上报路况 ----> ");
|
||||
} else if ( mVoiceCmdType.equals( ExtensionsModuleConst.UPLOAD_ROAD_BLOCK )
|
||||
|| mVoiceCmdType.equals( ExtensionsModuleConst.UPLOAD_ROAD_CONDITION_AWAKEN )
|
||||
|| mVoiceCmdType.equals( ExtensionsModuleConst.UPLOAD_ROAD_CONDITION ) ) { //上报拥堵, 分享路况, 上报路况
|
||||
Log.d( TAG, "handleNeedAuthorizeCmd 上报路况 ----> " );
|
||||
uploadRoadCondition();
|
||||
}
|
||||
} else {
|
||||
Log.e(TAG, "handleNeedAuthorizeCmd mVoiceCmdType == null ");
|
||||
Log.e( TAG, "handleNeedAuthorizeCmd mVoiceCmdType == null " );
|
||||
}
|
||||
}
|
||||
|
||||
private void uploadRoadCondition() {
|
||||
traceTanluData("2");
|
||||
sendShareReceiver("1");
|
||||
Logger.d("EntrancePresenter", "mogoIntentListener 上报路况 ----> ");
|
||||
traceTypeData("1");
|
||||
ShareControl.getInstance(mContext).dismissDialog();
|
||||
traceTanluData( "2" );
|
||||
sendShareReceiver( "1" );
|
||||
Logger.d( "EntrancePresenter", "mogoIntentListener 上报路况 ----> " );
|
||||
traceTypeData( "1" );
|
||||
ShareControl.getInstance( mContext ).dismissDialog();
|
||||
}
|
||||
|
||||
private void uploadTrfficCheck() {
|
||||
sendShareReceiver("2");
|
||||
Logger.d("EntrancePresenter", "mogoIntentListener 分享交通检查 ----> ");
|
||||
traceTypeData("3");
|
||||
ShareControl.getInstance(mContext).dismissDialog();
|
||||
sendShareReceiver( "2" );
|
||||
Logger.d( "EntrancePresenter", "mogoIntentListener 分享交通检查 ----> " );
|
||||
traceTypeData( "3" );
|
||||
ShareControl.getInstance( mContext ).dismissDialog();
|
||||
}
|
||||
|
||||
private void uploadRoadClosed() {
|
||||
sendShareReceiver("3");
|
||||
Logger.d("EntrancePresenter", "mogoIntentListener 分享封路 ----> ");
|
||||
traceTypeData("4");
|
||||
ShareControl.getInstance(mContext).dismissDialog();
|
||||
sendShareReceiver( "3" );
|
||||
Logger.d( "EntrancePresenter", "mogoIntentListener 分享封路 ----> " );
|
||||
traceTypeData( "4" );
|
||||
ShareControl.getInstance( mContext ).dismissDialog();
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -293,10 +302,10 @@ public class EntrancePresenter extends Presenter<EntranceView> {
|
||||
*
|
||||
* @param from
|
||||
*/
|
||||
private void traceData(String from) {
|
||||
Map<String, Object> properties = new HashMap<>();
|
||||
properties.put("from", from);
|
||||
mAnalytics.track(ExtensionsModuleConst.LAUNCHER_SHARE_CLICK, properties);
|
||||
private void traceData( String from ) {
|
||||
Map< String, Object > properties = new HashMap<>();
|
||||
properties.put( "from", from );
|
||||
mAnalytics.track( ExtensionsModuleConst.LAUNCHER_SHARE_CLICK, properties );
|
||||
}
|
||||
|
||||
private void shareOilPrice() {
|
||||
@@ -310,14 +319,14 @@ public class EntrancePresenter extends Presenter<EntranceView> {
|
||||
/**
|
||||
* 发送广播 1拥堵,2交通检查,3封路
|
||||
*/
|
||||
private void sendShareReceiver(String type) {
|
||||
Logger.d("EntrancePresenter", "TanluCardViewFragment sendShareReceiver ---->");
|
||||
private void sendShareReceiver( String type ) {
|
||||
Logger.d( "EntrancePresenter", "TanluCardViewFragment sendShareReceiver ---->" );
|
||||
Intent intent = new Intent();
|
||||
intent.setAction("com.zhidao.roadcondition.share");
|
||||
intent.addFlags(Intent.FLAG_RECEIVER_FOREGROUND);
|
||||
intent.addFlags(Intent.FLAG_INCLUDE_STOPPED_PACKAGES);
|
||||
intent.putExtra("type", type);
|
||||
getContext().sendBroadcast(intent);
|
||||
intent.setAction( "com.zhidao.roadcondition.share" );
|
||||
intent.addFlags( Intent.FLAG_RECEIVER_FOREGROUND );
|
||||
intent.addFlags( Intent.FLAG_INCLUDE_STOPPED_PACKAGES );
|
||||
intent.putExtra( "type", type );
|
||||
getContext().sendBroadcast( intent );
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -331,27 +340,35 @@ public class EntrancePresenter extends Presenter<EntranceView> {
|
||||
*
|
||||
* @param type
|
||||
*/
|
||||
private void traceTypeData(String type) {
|
||||
Map<String, Object> properties = new HashMap<>();
|
||||
properties.put("type", type);
|
||||
mAnalytics.track(ExtensionsModuleConst.LAUNCHER_SHARE_TYPE, properties);
|
||||
private void traceTypeData( String type ) {
|
||||
Map< String, Object > properties = new HashMap<>();
|
||||
properties.put( "type", type );
|
||||
mAnalytics.track( ExtensionsModuleConst.LAUNCHER_SHARE_TYPE, properties );
|
||||
}
|
||||
|
||||
private void traceTanluData(String type) {
|
||||
Map<String, Object> properties = new HashMap<>();
|
||||
properties.put("type", type);
|
||||
mAnalytics.track(ExtensionsModuleConst.CARNET_USER_UPLOAD, properties);
|
||||
private void traceTanluData( String type ) {
|
||||
Map< String, Object > properties = new HashMap<>();
|
||||
properties.put( "type", type );
|
||||
mAnalytics.track( ExtensionsModuleConst.CARNET_USER_UPLOAD, properties );
|
||||
}
|
||||
|
||||
|
||||
public void unregisterUnWake() {
|
||||
AIAssist.getInstance(mContext).unregisterUnWakeupCommand(ExtensionsModuleConst.CANCLE_SHARE);
|
||||
AIAssist.getInstance(mContext).unregisterUnWakeupCommand(ExtensionsModuleConst.CLOSE);
|
||||
|
||||
AIAssist.getInstance(mContext).unregisterUnWakeupCommand(ExtensionsModuleConst.UPLOAD_ROAD_BLOCK);
|
||||
AIAssist.getInstance(mContext).unregisterUnWakeupCommand(ExtensionsModuleConst.UPLOAD_TRAFFIC_CHECK);
|
||||
AIAssist.getInstance(mContext).unregisterUnWakeupCommand(ExtensionsModuleConst.UPLOAD_ROAD_CLOSURE);
|
||||
|
||||
AIAssist.getInstance( mContext ).unregisterUnWakeupCommand( ExtensionsModuleConst.CANCLE_SHARE );
|
||||
AIAssist.getInstance( mContext ).unregisterUnWakeupCommand( ExtensionsModuleConst.CLOSE );
|
||||
AIAssist.getInstance( mContext ).unregisterUnWakeupCommand( ExtensionsModuleConst.UPLOAD_ROAD_BLOCK );
|
||||
AIAssist.getInstance( mContext ).unregisterUnWakeupCommand( ExtensionsModuleConst.UPLOAD_TRAFFIC_CHECK );
|
||||
AIAssist.getInstance( mContext ).unregisterUnWakeupCommand( ExtensionsModuleConst.UPLOAD_ROAD_CLOSURE );
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onStatusChanged( StatusDescriptor descriptor, boolean isTrue ) {
|
||||
if ( descriptor == StatusDescriptor.DISPLAY_OVERVIEW ) {
|
||||
if ( isTrue ) {
|
||||
mView.hideNaviPanelWidgets();
|
||||
} else {
|
||||
mView.showNaviPanelWidgets();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -9,4 +9,8 @@ import com.mogo.commons.mvp.IView;
|
||||
* 描述
|
||||
*/
|
||||
public interface EntranceView extends IView {
|
||||
|
||||
void showNaviPanelWidgets();
|
||||
|
||||
void hideNaviPanelWidgets();
|
||||
}
|
||||
|
||||
@@ -0,0 +1,29 @@
|
||||
package com.mogo.module.extensions.entrance;
|
||||
|
||||
import android.content.Context;
|
||||
import android.widget.TextView;
|
||||
|
||||
import com.alibaba.android.arouter.facade.annotation.Route;
|
||||
import com.mogo.service.MogoServicePaths;
|
||||
import com.mogo.service.entrance.ButtonIndex;
|
||||
import com.mogo.service.entrance.IMogoEntranceButtonController;
|
||||
|
||||
/**
|
||||
* @author congtaowang
|
||||
* @since 2020-04-16
|
||||
* <p>
|
||||
* 描述
|
||||
*/
|
||||
@Route( path = MogoServicePaths.PATH_ENTRANCE_BUTTON_API )
|
||||
public class MogoEntranceButtonControllerImpl implements IMogoEntranceButtonController {
|
||||
|
||||
@Override
|
||||
public TextView getButton( ButtonIndex index ) {
|
||||
return MogoEntranceButtons.getButton( index );
|
||||
}
|
||||
|
||||
@Override
|
||||
public void init( Context context ) {
|
||||
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,31 @@
|
||||
package com.mogo.module.extensions.entrance;
|
||||
|
||||
import android.widget.TextView;
|
||||
|
||||
import com.mogo.service.entrance.ButtonIndex;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* @author congtaowang
|
||||
* @since 2020-04-16
|
||||
* <p>
|
||||
* 描述
|
||||
*/
|
||||
public class MogoEntranceButtons {
|
||||
|
||||
private static Map< ButtonIndex, TextView > sButtons = new HashMap<>();
|
||||
|
||||
public static void save( ButtonIndex index, TextView btn ) {
|
||||
sButtons.put( index, btn );
|
||||
}
|
||||
|
||||
public static TextView getButton( ButtonIndex index ) {
|
||||
return sButtons.get( index );
|
||||
}
|
||||
|
||||
public static void clear() {
|
||||
sButtons.clear();
|
||||
}
|
||||
}
|
||||
@@ -80,8 +80,8 @@
|
||||
android:layout_marginRight="@dimen/module_ext_speed_limit_marginRight"
|
||||
android:background="@drawable/module_ext_dw_speed_limit_bkg"
|
||||
android:gravity="center"
|
||||
android:visibility="invisible"
|
||||
android:orientation="vertical"
|
||||
android:visibility="invisible"
|
||||
app:layout_constraintRight_toRightOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent">
|
||||
|
||||
@@ -116,18 +116,18 @@
|
||||
<TextView
|
||||
android:id="@+id/module_ext_id_north"
|
||||
android:layout_width="@dimen/dp_120"
|
||||
android:text="@string/mode_north_up"
|
||||
android:paddingTop="@dimen/dp_14"
|
||||
android:visibility="gone"
|
||||
android:textColor="@color/white"
|
||||
android:textSize="@dimen/dp_28"
|
||||
android:gravity="center_horizontal"
|
||||
android:layout_height="@dimen/dp_120"
|
||||
android:layout_marginTop="@dimen/dp_33"
|
||||
android:background="@drawable/shape_react_gray_round"
|
||||
android:drawableTop="@drawable/selector_icon_north_up"
|
||||
app:layout_constraintTop_toBottomOf="@+id/module_entrance_id_navi_info_panel"
|
||||
android:gravity="center_horizontal"
|
||||
android:paddingTop="@dimen/dp_14"
|
||||
android:text="@string/mode_north_up"
|
||||
android:textColor="@color/white"
|
||||
android:textSize="@dimen/dp_28"
|
||||
android:visibility="gone"
|
||||
app:layout_constraintLeft_toLeftOf="@+id/module_entrance_id_navi_info_panel"
|
||||
android:layout_height="@dimen/dp_120"/>
|
||||
app:layout_constraintTop_toBottomOf="@+id/module_entrance_id_navi_info_panel" />
|
||||
|
||||
<LinearLayout
|
||||
android:id="@+id/module_entrance_id_operation_panel"
|
||||
@@ -194,18 +194,52 @@
|
||||
app:layout_goneMarginBottom="@dimen/module_ext_operation_panel_share_goneMarginBottom"
|
||||
app:layout_goneMarginRight="@dimen/module_ext_operation_panel_share_goneMarginRight" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/module_entrance_id_exit_navi"
|
||||
android:layout_width="@dimen/module_ext_navi_exit_width"
|
||||
android:layout_height="@dimen/module_ext_navi_exit_height"
|
||||
android:layout_marginLeft="@dimen/module_ext_navi_exit_marginLeft"
|
||||
android:layout_marginBottom="@dimen/module_ext_navi_exit_marginBottom"
|
||||
android:background="@drawable/module_ext_dw_common_corner_bkg"
|
||||
android:gravity="center"
|
||||
android:text="退出导航"
|
||||
android:textColor="#FFFFFF"
|
||||
android:textSize="@dimen/module_ext_navi_exit_textSize"
|
||||
android:visibility="gone"
|
||||
<LinearLayout
|
||||
android:id="@+id/module_entrance_id_buttons_container"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginLeft="@dimen/module_ext_button_container_marginLeft"
|
||||
android:layout_marginBottom="@dimen/module_ext_button_container_marginBottom"
|
||||
android:orientation="vertical"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintLeft_toLeftOf="parent" />
|
||||
app:layout_constraintLeft_toLeftOf="parent">
|
||||
|
||||
<TextView
|
||||
android:id="@+id/module_entrance_id_button1"
|
||||
android:layout_width="@dimen/module_ext_navi_exit_width"
|
||||
android:layout_height="@dimen/module_ext_navi_exit_height"
|
||||
android:gravity="center"
|
||||
android:textColor="#FFFFFF"
|
||||
android:textSize="@dimen/module_ext_navi_exit_textSize"
|
||||
android:visibility="gone"
|
||||
tools:background="@drawable/module_ext_dw_common_corner_bkg"
|
||||
tools:text="前方\n实况"
|
||||
tools:visibility="visible" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/module_entrance_id_button2"
|
||||
android:layout_width="@dimen/module_ext_navi_exit_width"
|
||||
android:layout_height="@dimen/module_ext_navi_exit_height"
|
||||
android:layout_marginTop="@dimen/module_entrance_id_button_marginTop"
|
||||
android:gravity="center"
|
||||
android:textColor="#FFFFFF"
|
||||
android:textSize="@dimen/module_ext_navi_exit_textSize"
|
||||
android:visibility="gone"
|
||||
tools:background="@drawable/module_ext_dw_common_corner_bkg"
|
||||
tools:text="取消\n求助"
|
||||
tools:visibility="visible" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/module_entrance_id_exit_navi"
|
||||
android:layout_width="@dimen/module_ext_navi_exit_width"
|
||||
android:layout_height="@dimen/module_ext_navi_exit_height"
|
||||
android:layout_marginTop="@dimen/module_entrance_id_button_marginTop"
|
||||
android:background="@drawable/module_ext_dw_common_corner_bkg"
|
||||
android:gravity="center"
|
||||
android:text="退出\n导航"
|
||||
android:textColor="#FFFFFF"
|
||||
android:textSize="@dimen/module_ext_navi_exit_textSize"
|
||||
android:visibility="gone"
|
||||
tools:visibility="visible" />
|
||||
</LinearLayout>
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||
@@ -46,11 +46,14 @@
|
||||
<dimen name="module_ext_operation_panel_share_goneMarginRight">20px</dimen>
|
||||
|
||||
|
||||
<dimen name="module_ext_navi_exit_width">130px</dimen>
|
||||
<dimen name="module_ext_navi_exit_height">58px</dimen>
|
||||
<dimen name="module_ext_navi_exit_width">64px</dimen>
|
||||
<dimen name="module_ext_navi_exit_height">64px</dimen>
|
||||
<dimen name="module_ext_navi_exit_marginLeft">20px</dimen>
|
||||
<dimen name="module_ext_navi_exit_marginBottom">32px</dimen>
|
||||
<dimen name="module_ext_button_container_marginLeft">20px</dimen>
|
||||
<dimen name="module_ext_button_container_marginBottom">30px</dimen>
|
||||
<dimen name="module_ext_navi_exit_textSize">22px</dimen>
|
||||
<dimen name="module_entrance_id_button_marginTop">8px</dimen>
|
||||
|
||||
<!-- module_ext_layout_extensions.xml-->
|
||||
<dimen name="module_ext_height">64px</dimen>
|
||||
|
||||
@@ -44,11 +44,14 @@
|
||||
<dimen name="module_ext_operation_panel_share_goneMarginBottom">32px</dimen>
|
||||
<dimen name="module_ext_operation_panel_share_goneMarginRight">32px</dimen>
|
||||
|
||||
<dimen name="module_ext_navi_exit_width">200px</dimen>
|
||||
<dimen name="module_ext_navi_exit_height">90px</dimen>
|
||||
<dimen name="module_ext_navi_exit_width">120px</dimen>
|
||||
<dimen name="module_ext_navi_exit_height">120px</dimen>
|
||||
<dimen name="module_ext_navi_exit_marginLeft">32px</dimen>
|
||||
<dimen name="module_ext_navi_exit_marginBottom">60px</dimen>
|
||||
<dimen name="module_ext_button_container_marginLeft">32px</dimen>
|
||||
<dimen name="module_ext_button_container_marginBottom">60px</dimen>
|
||||
<dimen name="module_ext_navi_exit_textSize">32px</dimen>
|
||||
<dimen name="module_entrance_id_button_marginTop">20px</dimen>
|
||||
|
||||
<!-- module_ext_layout_extensions.xml-->
|
||||
<dimen name="module_ext_height">120px</dimen>
|
||||
|
||||
@@ -44,11 +44,14 @@
|
||||
<dimen name="module_ext_operation_panel_share_goneMarginBottom">32px</dimen>
|
||||
<dimen name="module_ext_operation_panel_share_goneMarginRight">32px</dimen>
|
||||
|
||||
<dimen name="module_ext_navi_exit_width">200px</dimen>
|
||||
<dimen name="module_ext_navi_exit_height">90px</dimen>
|
||||
<dimen name="module_ext_navi_exit_width">120px</dimen>
|
||||
<dimen name="module_ext_navi_exit_height">120px</dimen>
|
||||
<dimen name="module_ext_navi_exit_marginLeft">32px</dimen>
|
||||
<dimen name="module_ext_navi_exit_marginBottom">60px</dimen>
|
||||
<dimen name="module_ext_button_container_marginLeft">32px</dimen>
|
||||
<dimen name="module_ext_button_container_marginBottom">60px</dimen>
|
||||
<dimen name="module_ext_navi_exit_textSize">32px</dimen>
|
||||
<dimen name="module_entrance_id_button_marginTop">20px</dimen>
|
||||
|
||||
<!-- module_ext_layout_extensions.xml-->
|
||||
<dimen name="module_ext_height">120px</dimen>
|
||||
|
||||
@@ -51,3 +51,5 @@ dependencies {
|
||||
implementation project(':services:mogo-service-api')
|
||||
}
|
||||
}
|
||||
|
||||
apply from: new File(rootProject.rootDir, "gradle/upload.gradle").toString()
|
||||
|
||||
@@ -46,3 +46,5 @@ dependencies {
|
||||
implementation project(':modules:mogo-module-gps-simulator')
|
||||
}
|
||||
}
|
||||
|
||||
apply from: new File(rootProject.rootDir, "gradle/upload.gradle").toString()
|
||||
|
||||
@@ -37,3 +37,5 @@ dependencies {
|
||||
implementation project(':modules:mogo-module-authorize')
|
||||
}
|
||||
}
|
||||
|
||||
apply from: new File(rootProject.rootDir, "gradle/upload.gradle").toString()
|
||||
|
||||
@@ -30,7 +30,7 @@ import com.mogo.module.main.cards.MogoModulesHandler;
|
||||
import com.mogo.module.main.cards.MogoModulesManager;
|
||||
import com.mogo.module.main.cards.OnPageChangeListenerAdapter;
|
||||
import com.mogo.module.main.cards.OrientedViewPager;
|
||||
import com.mogo.module.main.windowview.WindowViewHandler;
|
||||
import com.mogo.module.main.windowview.FloatingViewHandler;
|
||||
import com.mogo.module.service.ServiceConst;
|
||||
import com.mogo.service.IMogoServiceApis;
|
||||
import com.mogo.service.MogoServicePaths;
|
||||
@@ -192,7 +192,7 @@ public class MainActivity extends MvpActivity< MainView, MainPresenter > impleme
|
||||
// 避免事件穿透导致地图被滑动
|
||||
mLeftShadowFrame.setOnClickListener( view -> {
|
||||
} );
|
||||
WindowViewHandler.init( mFloatingLayout );
|
||||
FloatingViewHandler.init( mFloatingLayout );
|
||||
}
|
||||
|
||||
// 隐藏布局
|
||||
|
||||
@@ -7,6 +7,7 @@ import com.mogo.map.marker.IMogoMarker;
|
||||
import com.mogo.map.marker.IMogoMarkerClickListener;
|
||||
import com.mogo.map.navi.IMogoAimlessModeListener;
|
||||
import com.mogo.map.navi.IMogoCarLocationChangedListener;
|
||||
import com.mogo.map.navi.IMogoCarLocationChangedListener2;
|
||||
import com.mogo.map.navi.IMogoNaviListener;
|
||||
import com.mogo.service.module.IMogoModuleProvider;
|
||||
|
||||
@@ -26,7 +27,7 @@ public interface MogoModulesHandler extends IMogoMapListener,
|
||||
IMogoLocationListener,
|
||||
IMogoMarkerClickListener,
|
||||
IMogoAimlessModeListener,
|
||||
IMogoCarLocationChangedListener {
|
||||
IMogoCarLocationChangedListener2 {
|
||||
|
||||
/**
|
||||
* 地图加载完成回调
|
||||
|
||||
@@ -2,6 +2,7 @@ package com.mogo.module.main.cards;
|
||||
|
||||
import android.content.Context;
|
||||
import android.content.Intent;
|
||||
import android.location.Location;
|
||||
import android.text.TextUtils;
|
||||
import android.view.MotionEvent;
|
||||
|
||||
@@ -17,6 +18,7 @@ import com.mogo.map.marker.IMogoMarkerClickListener;
|
||||
import com.mogo.map.model.MogoPoi;
|
||||
import com.mogo.map.navi.IMogoAimlessModeListener;
|
||||
import com.mogo.map.navi.IMogoCarLocationChangedListener;
|
||||
import com.mogo.map.navi.IMogoCarLocationChangedListener2;
|
||||
import com.mogo.map.navi.IMogoNaviListener;
|
||||
import com.mogo.map.navi.IMogoNaviListener2;
|
||||
import com.mogo.map.navi.MogoCongestionInfo;
|
||||
@@ -109,7 +111,7 @@ public class MogoModulesManager implements MogoModulesHandler,
|
||||
final List< MogoModule > modules = MogoModulePaths.getModules();
|
||||
if ( modules != null && !modules.isEmpty() ) {
|
||||
for ( MogoModule module : modules ) {
|
||||
Logger.d(TAG,"module.getPath():" + module.getPath() + " name: " + module.getName());
|
||||
Logger.d( TAG, "module.getPath():" + module.getPath() + " name: " + module.getName() );
|
||||
IMogoModuleProvider provider = load( module.getPath() );
|
||||
if ( provider != null ) {
|
||||
mModuleProviders.put( module, provider );
|
||||
@@ -655,15 +657,30 @@ public class MogoModulesManager implements MogoModulesHandler,
|
||||
|
||||
@Override
|
||||
public void onCarLocationChanged( MogoLatLng latLng ) {
|
||||
// do nothing.
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onCarLocationChanged2( Location latLng ) {
|
||||
Iterator< IMogoCarLocationChangedListener > iterator = MogoRegisterCenterHandler.getInstance().getCarLocationChangedListener();
|
||||
if ( iterator == null ) {
|
||||
return;
|
||||
}
|
||||
MogoLatLng target = null;
|
||||
while ( iterator.hasNext() ) {
|
||||
IMogoCarLocationChangedListener listener = iterator.next();
|
||||
if ( listener != null ) {
|
||||
if ( listener instanceof IMogoCarLocationChangedListener2 ) {
|
||||
try {
|
||||
listener.onCarLocationChanged( latLng );
|
||||
( ( IMogoCarLocationChangedListener2 ) listener ).onCarLocationChanged2( latLng );
|
||||
} catch ( Exception e ) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
} else {
|
||||
try {
|
||||
if ( target == null ) {
|
||||
target = new MogoLatLng( latLng.getLatitude(), latLng.getLongitude() );
|
||||
}
|
||||
listener.onCarLocationChanged( target );
|
||||
} catch ( Exception e ) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
@@ -13,7 +13,7 @@ import com.mogo.utils.logger.Logger;
|
||||
* <p>
|
||||
* 描述
|
||||
*/
|
||||
public class WindowViewHandler {
|
||||
public class FloatingViewHandler {
|
||||
|
||||
private static final String TAG = "WindowViewHandler";
|
||||
|
||||
@@ -35,9 +35,9 @@ public class WindowViewHandler {
|
||||
*/
|
||||
private static boolean sMovable = false;
|
||||
|
||||
public static FrameLayout sFloatingLayout = null;
|
||||
private static FrameLayout sFloatingLayout = null;
|
||||
|
||||
public static void init(FrameLayout frameLayout) {
|
||||
public static void init( FrameLayout frameLayout ) {
|
||||
sFloatingLayout = frameLayout;
|
||||
}
|
||||
|
||||
@@ -49,20 +49,20 @@ public class WindowViewHandler {
|
||||
* @param y
|
||||
* @param movable
|
||||
*/
|
||||
public static void addView(View view, int x, int y, boolean movable) {
|
||||
if (view == null) {
|
||||
public static void addView( View view, int x, int y, boolean movable ) {
|
||||
if ( view == null ) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (sFloatingLayout == null) {
|
||||
Logger.e(TAG, "no floating frame. ");
|
||||
if ( sFloatingLayout == null ) {
|
||||
Logger.e( TAG, "no floating frame. " );
|
||||
return;
|
||||
}
|
||||
|
||||
FrameLayout.LayoutParams params = new FrameLayout.LayoutParams(ViewGroup.LayoutParams.WRAP_CONTENT, ViewGroup.LayoutParams.WRAP_CONTENT);
|
||||
FrameLayout.LayoutParams params = new FrameLayout.LayoutParams( ViewGroup.LayoutParams.WRAP_CONTENT, ViewGroup.LayoutParams.WRAP_CONTENT );
|
||||
params.leftMargin = x;
|
||||
params.topMargin = y;
|
||||
sFloatingLayout.addView(view, params);
|
||||
sFloatingLayout.addView( view, params );
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -72,16 +72,16 @@ public class WindowViewHandler {
|
||||
* @param params
|
||||
* @param movable
|
||||
*/
|
||||
public static void addView(View view, FrameLayout.LayoutParams params, boolean movable) {
|
||||
if (view == null) {
|
||||
public static void addView( View view, FrameLayout.LayoutParams params, boolean movable ) {
|
||||
if ( view == null ) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (sFloatingLayout == null) {
|
||||
Logger.e(TAG, "no floating frame. ");
|
||||
if ( sFloatingLayout == null ) {
|
||||
Logger.e( TAG, "no floating frame. " );
|
||||
return;
|
||||
}
|
||||
sFloatingLayout.addView(view, params);
|
||||
sFloatingLayout.addView( view, params );
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -93,27 +93,27 @@ public class WindowViewHandler {
|
||||
* @param y
|
||||
* @param movable
|
||||
*/
|
||||
public static void addView(View view, int priority, int x, int y, boolean movable) {
|
||||
if (view == null) {
|
||||
public static void addView( View view, int priority, int x, int y, boolean movable ) {
|
||||
if ( view == null ) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (sFloatingLayout == null) {
|
||||
Logger.e(TAG, "no floating frame. ");
|
||||
if ( sFloatingLayout == null ) {
|
||||
Logger.e( TAG, "no floating frame. " );
|
||||
return;
|
||||
}
|
||||
|
||||
if (sView == view) {
|
||||
Logger.w(TAG, "改布局已添加且没有移除,不操作");
|
||||
if ( sView == view ) {
|
||||
Logger.w( TAG, "改布局已添加且没有移除,不操作" );
|
||||
return;
|
||||
}
|
||||
|
||||
if (sView != null) {
|
||||
if (priority < sPriority) {
|
||||
Logger.w(TAG, "过滤低优先级布局");
|
||||
if ( sView != null ) {
|
||||
if ( priority < sPriority ) {
|
||||
Logger.w( TAG, "过滤低优先级布局" );
|
||||
return;
|
||||
}
|
||||
sFloatingLayout.removeView(sView);
|
||||
sFloatingLayout.removeView( sView );
|
||||
}
|
||||
sView = view;
|
||||
sMovable = movable;
|
||||
@@ -131,27 +131,27 @@ public class WindowViewHandler {
|
||||
* @param params
|
||||
* @param movable
|
||||
*/
|
||||
public static void addView(View view, int priority, FrameLayout.LayoutParams params, boolean movable) {
|
||||
if (view == null) {
|
||||
public static void addView( View view, int priority, FrameLayout.LayoutParams params, boolean movable ) {
|
||||
if ( view == null ) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (sFloatingLayout == null) {
|
||||
Logger.e(TAG, "no floating frame. ");
|
||||
if ( sFloatingLayout == null ) {
|
||||
Logger.e( TAG, "no floating frame. " );
|
||||
return;
|
||||
}
|
||||
|
||||
if (sView == view) {
|
||||
Logger.w(TAG, "改布局已添加且没有移除,不操作");
|
||||
if ( sView == view ) {
|
||||
Logger.w( TAG, "改布局已添加且没有移除,不操作" );
|
||||
return;
|
||||
}
|
||||
|
||||
if (sView != null) {
|
||||
if (priority < sPriority) {
|
||||
Logger.w(TAG, "过滤低优先级布局");
|
||||
if ( sView != null ) {
|
||||
if ( priority < sPriority ) {
|
||||
Logger.w( TAG, "过滤低优先级布局" );
|
||||
return;
|
||||
}
|
||||
sFloatingLayout.removeView(sView);
|
||||
sFloatingLayout.removeView( sView );
|
||||
}
|
||||
sView = view;
|
||||
sMovable = movable;
|
||||
@@ -160,15 +160,15 @@ public class WindowViewHandler {
|
||||
addView();
|
||||
}
|
||||
|
||||
public static void removeView(View view) {
|
||||
if (sFloatingLayout == null) {
|
||||
public static void removeView( View view ) {
|
||||
if ( sFloatingLayout == null ) {
|
||||
return;
|
||||
}
|
||||
if (view == null) {
|
||||
if ( view == null ) {
|
||||
return;
|
||||
}
|
||||
sFloatingLayout.removeView(view);
|
||||
if (sView == view) {
|
||||
sFloatingLayout.removeView( view );
|
||||
if ( sView == view ) {
|
||||
sView = null;
|
||||
sPriority = Integer.MIN_VALUE;
|
||||
sMovable = false;
|
||||
@@ -177,29 +177,35 @@ public class WindowViewHandler {
|
||||
}
|
||||
|
||||
private static void addView() {
|
||||
if (sView == null) {
|
||||
if ( sView == null ) {
|
||||
return;
|
||||
}
|
||||
|
||||
FrameLayout.LayoutParams params = sParams;
|
||||
if (params == null) {
|
||||
params = new FrameLayout.LayoutParams(ViewGroup.LayoutParams.WRAP_CONTENT, ViewGroup.LayoutParams.WRAP_CONTENT);
|
||||
if ( params == null ) {
|
||||
params = new FrameLayout.LayoutParams( ViewGroup.LayoutParams.WRAP_CONTENT, ViewGroup.LayoutParams.WRAP_CONTENT );
|
||||
params.leftMargin = sX;
|
||||
params.topMargin = sY;
|
||||
}
|
||||
sFloatingLayout.addView(sView, params);
|
||||
sFloatingLayout.addView( sView, params );
|
||||
}
|
||||
|
||||
public static void attachMovementEvent(View view, WindowManager.LayoutParams params) {
|
||||
if (view == null) {
|
||||
public static void attachMovementEvent( View view, WindowManager.LayoutParams params ) {
|
||||
if ( view == null ) {
|
||||
return;
|
||||
}
|
||||
view.setOnTouchListener((v, event) -> {
|
||||
view.setOnTouchListener( ( v, event ) -> {
|
||||
DispatchTouchEventWrapper.getInstance()
|
||||
.attach(view, params)
|
||||
.handle(event);
|
||||
.attach( view, params )
|
||||
.handle( event );
|
||||
return false;
|
||||
});
|
||||
} );
|
||||
}
|
||||
|
||||
public static void setVisible( boolean visible ) {
|
||||
if ( sFloatingLayout != null ) {
|
||||
sFloatingLayout.setVisibility( visible ? View.VISIBLE : View.INVISIBLE );
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -14,36 +14,46 @@ import com.mogo.service.windowview.IMogoWindowManager;
|
||||
* <p>
|
||||
* 根据优先级控制显示 window view.
|
||||
*/
|
||||
@Route(path = MogoServicePaths.PATH_WINDOW_MANAGER)
|
||||
@Route( path = MogoServicePaths.PATH_WINDOW_MANAGER )
|
||||
public class MogoWindowManager implements IMogoWindowManager {
|
||||
|
||||
@Override
|
||||
public void addView(View view, int x, int y, boolean movable) {
|
||||
WindowViewHandler.addView(view, x, y, movable);
|
||||
public void addView( View view, int x, int y, boolean movable ) {
|
||||
FloatingViewHandler.addView( view, x, y, movable );
|
||||
}
|
||||
|
||||
@Override
|
||||
public void addView(View view, FrameLayout.LayoutParams params, boolean movable) {
|
||||
WindowViewHandler.addView(view, params, movable);
|
||||
public void addView( View view, FrameLayout.LayoutParams params, boolean movable ) {
|
||||
FloatingViewHandler.addView( view, params, movable );
|
||||
}
|
||||
|
||||
@Override
|
||||
public void addView(int priority, View view, int x, int y, boolean movable) {
|
||||
WindowViewHandler.addView(view, priority, x, y, movable);
|
||||
public void addView( int priority, View view, int x, int y, boolean movable ) {
|
||||
FloatingViewHandler.addView( view, priority, x, y, movable );
|
||||
}
|
||||
|
||||
@Override
|
||||
public void addView(int priority, View view, FrameLayout.LayoutParams params, boolean movable) {
|
||||
WindowViewHandler.addView(view, priority, params, movable);
|
||||
public void addView( int priority, View view, FrameLayout.LayoutParams params, boolean movable ) {
|
||||
FloatingViewHandler.addView( view, priority, params, movable );
|
||||
}
|
||||
|
||||
@Override
|
||||
public void removeView(View view) {
|
||||
WindowViewHandler.removeView(view);
|
||||
public void removeView( View view ) {
|
||||
FloatingViewHandler.removeView( view );
|
||||
}
|
||||
|
||||
@Override
|
||||
public void init(Context context) {
|
||||
public void hideAll() {
|
||||
FloatingViewHandler.setVisible( false );
|
||||
}
|
||||
|
||||
@Override
|
||||
public void showAll() {
|
||||
FloatingViewHandler.setVisible( true );
|
||||
}
|
||||
|
||||
@Override
|
||||
public void init( Context context ) {
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -21,7 +21,8 @@ import com.mogo.map.navi.MogoNaviInfo;
|
||||
import com.mogo.map.navi.MogoTraffic;
|
||||
import com.mogo.map.uicontroller.EnumMapUI;
|
||||
import com.mogo.map.uicontroller.MapControlResult;
|
||||
import com.mogo.module.common.MogoModulePaths;
|
||||
import com.mogo.module.common.map.MapCenterPointStrategy;
|
||||
import com.mogo.module.common.map.Scene;
|
||||
import com.mogo.service.IMogoServiceApis;
|
||||
import com.mogo.service.MogoServicePaths;
|
||||
import com.mogo.service.intent.IMogoIntentListener;
|
||||
@@ -32,12 +33,8 @@ import com.mogo.service.module.IMogoRegisterCenter;
|
||||
import com.mogo.service.module.IMogoSearchManager;
|
||||
import com.mogo.service.statusmanager.IMogoStatusManager;
|
||||
import com.mogo.service.strategy.IMogoRefreshStrategyController;
|
||||
import com.mogo.service.voice.IMogoVoiceListener;
|
||||
import com.mogo.service.voice.IMogoVoiceManager;
|
||||
import com.mogo.utils.AppUtils;
|
||||
import com.mogo.utils.ResourcesHelper;
|
||||
import com.mogo.utils.UiThreadHandler;
|
||||
import com.mogo.utils.WindowUtils;
|
||||
import com.mogo.utils.logger.Logger;
|
||||
|
||||
import java.util.Map;
|
||||
@@ -62,6 +59,7 @@ public class MapPresenter extends Presenter< MapView > implements
|
||||
private IMogoStatusManager mStatusManager;
|
||||
private IMogoRegisterCenter mRegisterCenter;
|
||||
private IMogoLauncher mLauncher;
|
||||
private Rect mDisplayOverviewBounds;
|
||||
|
||||
public MapPresenter( MapView view ) {
|
||||
super( view );
|
||||
@@ -99,11 +97,8 @@ public class MapPresenter extends Presenter< MapView > implements
|
||||
mView.getUIController().changeMapMode( EnumMapUI.CarUp_2D );
|
||||
} else if ( opera_type == 1 ) {
|
||||
mView.getUIController().changeMapMode( EnumMapUI.NorthUP_2D );
|
||||
//AIAssist.getInstance(getContext()).speakTTSVoice("已切换", null);
|
||||
|
||||
} else if ( opera_type == 2 ) {
|
||||
mView.getUIController().changeMapMode( EnumMapUI.CarUp_3D );
|
||||
//AIAssist.getInstance(getContext()).speakTTSVoice("已切换", null);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -123,18 +118,14 @@ public class MapPresenter extends Presenter< MapView > implements
|
||||
//intent.putExtra("EXTRA_ENDURANCE_DATA", continueNavi);
|
||||
//继续导航
|
||||
} else if ( key_type == 10049 ) {
|
||||
boolean extra_endurance_data =
|
||||
intent.getBooleanExtra( "EXTRA_ENDURANCE_DATA", false );
|
||||
boolean extra_endurance_data = intent.getBooleanExtra( "EXTRA_ENDURANCE_DATA", false );
|
||||
if ( extra_endurance_data ) {
|
||||
onContinueNavigation();
|
||||
}
|
||||
} else if ( key_type == 10006 ) {
|
||||
|
||||
int extra_is_show = intent.getIntExtra( "EXTRA_IS_SHOW", 0 );
|
||||
|
||||
if ( extra_is_show == 0 ) {
|
||||
mStatusManager.setUserInteractionStatus( TAG, true, false );
|
||||
mView.getUIController().displayOverview();
|
||||
onDisplayOverview();
|
||||
} else {
|
||||
onContinueNavigation();
|
||||
}
|
||||
@@ -173,13 +164,16 @@ public class MapPresenter extends Presenter< MapView > implements
|
||||
/**
|
||||
* 继续导航
|
||||
*/
|
||||
private void onContinueNavigation(){
|
||||
private void onContinueNavigation() {
|
||||
|
||||
if ( mStatusManager.isMainPageOnResume() ) {
|
||||
mStatusManager.setDisplayOverview( TAG, false );
|
||||
mView.getUIController().recoverLockMode();
|
||||
} else {
|
||||
mLauncher.backToLauncher( getContext() );
|
||||
UiThreadHandler.postDelayed( () -> {
|
||||
try {
|
||||
mStatusManager.setDisplayOverview( TAG, false );
|
||||
mView.getUIController().recoverLockMode();
|
||||
} catch ( Exception e ) {
|
||||
e.printStackTrace();
|
||||
@@ -188,6 +182,16 @@ public class MapPresenter extends Presenter< MapView > implements
|
||||
}
|
||||
}
|
||||
|
||||
private void onDisplayOverview() {
|
||||
if ( !mMogoMapService.getNavi( getContext() ).isNaviing() ) {
|
||||
Logger.d( TAG, "未开始导航." );
|
||||
return;
|
||||
}
|
||||
mStatusManager.setUserInteractionStatus( TAG, true, false );
|
||||
mStatusManager.setDisplayOverview( TAG, true );
|
||||
mView.getUIController().displayOverview( mDisplayOverviewBounds );
|
||||
}
|
||||
|
||||
private void zoomMap( boolean zoomIn ) {
|
||||
boolean isLocked = mMogoMapService.getMapUIController().isCarLocked();
|
||||
MapControlResult result = mView.getUIController().changeZoom( zoomIn );
|
||||
@@ -229,11 +233,18 @@ public class MapPresenter extends Presenter< MapView > implements
|
||||
|
||||
IMogoNavi mogoNavi = mMogoMapService.getNavi( getContext() );
|
||||
mogoNavi.setCalculatePathDisplayBounds( new Rect(
|
||||
ResourcesHelper.getDimensionPixelSize( getContext(), R.dimen.module_map_calculate_path_display_overview_left_margin ),
|
||||
ResourcesHelper.getDimensionPixelSize( getContext(), R.dimen.module_map_calculate_path_display_overview_top_margin ),
|
||||
ResourcesHelper.getDimensionPixelSize( getContext(), R.dimen.module_map_calculate_path_display_overview_right_margin ),
|
||||
ResourcesHelper.getDimensionPixelSize( getContext(), R.dimen.module_map_calculate_path_display_overview_bottom_margin )
|
||||
) );
|
||||
|
||||
mDisplayOverviewBounds = new Rect(
|
||||
ResourcesHelper.getDimensionPixelSize( getContext(), R.dimen.module_map_display_overview_left_margin ),
|
||||
ResourcesHelper.getDimensionPixelSize( getContext(), R.dimen.module_map_display_overview_top_margin ),
|
||||
ResourcesHelper.getDimensionPixelSize( getContext(), R.dimen.module_map_display_overview_right_margin ),
|
||||
ResourcesHelper.getDimensionPixelSize( getContext(), R.dimen.module_map_display_overview_bottom_margin )
|
||||
) );
|
||||
);
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -259,8 +270,7 @@ public class MapPresenter extends Presenter< MapView > implements
|
||||
private void registerVoiceCmd() {
|
||||
|
||||
for ( Map.Entry< String, String[] > entry : VoiceConstants.sVoiceCmds.entrySet() ) {
|
||||
AIAssist.getInstance( getContext() )
|
||||
.registerUnWakeupCommand( entry.getKey(), entry.getValue(), this );
|
||||
AIAssist.getInstance( getContext() ).registerUnWakeupCommand( entry.getKey(), entry.getValue(), this );
|
||||
}
|
||||
|
||||
for ( String cmd : VoiceConstants.sCmds ) {
|
||||
@@ -293,12 +303,10 @@ public class MapPresenter extends Presenter< MapView > implements
|
||||
switch ( cmd ) {
|
||||
case VoiceConstants.CMD_MAP_TRAFFIC_MODE_UN_WAKEUP:
|
||||
case VoiceConstants.CMD_MAP_TRAFFIC_MODE:
|
||||
AIAssist.getInstance( getContext() ).speakTTSVoice( "已打开", null );
|
||||
mView.getUIController().setTrafficEnabled( true );
|
||||
break;
|
||||
case VoiceConstants.CMD_MAP_UN_TRAFFIC_MODE_UN_WAKEUP:
|
||||
case VoiceConstants.CMD_MAP_UN_TRAFFIC_MODE:
|
||||
AIAssist.getInstance( getContext() ).speakTTSVoice( "已关闭", null );
|
||||
mView.getUIController().setTrafficEnabled( false );
|
||||
break;
|
||||
case VoiceConstants.CMD_MAP_ZOOM_IN_UN_WAKEUP:
|
||||
@@ -314,12 +322,10 @@ public class MapPresenter extends Presenter< MapView > implements
|
||||
case VoiceConstants.CMD_MAP_NORTH_UP_MODE_UN_WAKEUP:
|
||||
case VoiceConstants.CMD_MAP_NORTH_UP_MODE:
|
||||
mView.getUIController().changeMapMode( EnumMapUI.NorthUP_2D );
|
||||
AIAssist.getInstance( getContext() ).speakTTSVoice( "已切换", null );
|
||||
break;
|
||||
case VoiceConstants.CMD_MAP_3D_UN_WAKEUP:
|
||||
case VoiceConstants.CMD_MAP_3D:
|
||||
mView.getUIController().changeMapMode( EnumMapUI.CarUp_3D );
|
||||
AIAssist.getInstance( getContext() ).speakTTSVoice( "已切换", null );
|
||||
|
||||
break;
|
||||
case VoiceConstants.CMD_MAP_DAY_TIME_MODE_UN_WAKEUP:
|
||||
@@ -359,7 +365,7 @@ public class MapPresenter extends Presenter< MapView > implements
|
||||
AIAssist.getInstance( getContext() ).speakTTSVoice( "已切换", null );
|
||||
break;
|
||||
case VoiceConstants.CMD_MAP_DISPLAY_OVERVIEW_MODE:
|
||||
mView.getUIController().displayOverview();
|
||||
onDisplayOverview();
|
||||
break;
|
||||
case VoiceConstants.CMD_MAP_CONTINUE_NAVI_MODE:
|
||||
onContinueNavigation();
|
||||
|
||||
@@ -1,7 +1,13 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<resources>
|
||||
<dimen name="module_map_display_overview_left_margin">558px</dimen>
|
||||
<dimen name="module_map_display_overview_top_margin">174px</dimen>
|
||||
<dimen name="module_map_display_overview_bottom_margin">32px</dimen>
|
||||
<dimen name="module_map_display_overview_right_margin">80px</dimen>
|
||||
<dimen name="module_map_calculate_path_display_overview_left_margin">558px</dimen>
|
||||
<dimen name="module_map_calculate_path_display_overview_top_margin">174px</dimen>
|
||||
<dimen name="module_map_calculate_path_display_overview_bottom_margin">32px</dimen>
|
||||
<dimen name="module_map_calculate_path_display_overview_right_margin">80px</dimen>
|
||||
|
||||
<!-- 导航查看全程显示范围-->
|
||||
<dimen name="module_map_display_overview_left_margin">534px</dimen>
|
||||
<dimen name="module_map_display_overview_top_margin">100px</dimen>
|
||||
<dimen name="module_map_display_overview_bottom_margin">68px</dimen>
|
||||
<dimen name="module_map_display_overview_right_margin">32px</dimen>
|
||||
</resources>
|
||||
@@ -1,7 +1,13 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<resources>
|
||||
<dimen name="module_map_display_overview_left_margin">977px</dimen>
|
||||
<dimen name="module_map_display_overview_top_margin">249px</dimen>
|
||||
<dimen name="module_map_display_overview_bottom_margin">61px</dimen>
|
||||
<dimen name="module_map_display_overview_right_margin">80px</dimen>
|
||||
<dimen name="module_map_calculate_path_display_overview_left_margin">977px</dimen>
|
||||
<dimen name="module_map_calculate_path_display_overview_top_margin">249px</dimen>
|
||||
<dimen name="module_map_calculate_path_display_overview_bottom_margin">61px</dimen>
|
||||
<dimen name="module_map_calculate_path_display_overview_right_margin">80px</dimen>
|
||||
|
||||
<!-- 导航查看全程显示范围-->
|
||||
<dimen name="module_map_display_overview_left_margin">952px</dimen>
|
||||
<dimen name="module_map_display_overview_top_margin">170px</dimen>
|
||||
<dimen name="module_map_display_overview_bottom_margin">122px</dimen>
|
||||
<dimen name="module_map_display_overview_right_margin">61px</dimen>
|
||||
</resources>
|
||||
@@ -1,7 +1,13 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<resources>
|
||||
<dimen name="module_map_display_overview_left_margin">977px</dimen>
|
||||
<dimen name="module_map_display_overview_top_margin">249px</dimen>
|
||||
<dimen name="module_map_display_overview_bottom_margin">61px</dimen>
|
||||
<dimen name="module_map_display_overview_right_margin">80px</dimen>
|
||||
<!-- 路线规划显示范围-->
|
||||
<dimen name="module_map_calculate_path_display_overview_left_margin">977px</dimen>
|
||||
<dimen name="module_map_calculate_path_display_overview_top_margin">249px</dimen>
|
||||
<dimen name="module_map_calculate_path_display_overview_bottom_margin">61px</dimen>
|
||||
<dimen name="module_map_calculate_path_display_overview_right_margin">80px</dimen>
|
||||
<!-- 导航查看全程显示范围-->
|
||||
<dimen name="module_map_display_overview_left_margin">952px</dimen>
|
||||
<dimen name="module_map_display_overview_top_margin">170px</dimen>
|
||||
<dimen name="module_map_display_overview_bottom_margin">122px</dimen>
|
||||
<dimen name="module_map_display_overview_right_margin">61px</dimen>
|
||||
</resources>
|
||||
@@ -36,8 +36,6 @@ object NaviManager {
|
||||
SearchServiceHolder.getNavi().stopNavi()
|
||||
} else if (key_type == 20009) {
|
||||
SearchServiceHolder.mogoLauncher.backToLauncher(context)
|
||||
gotoSearch()
|
||||
|
||||
} else if (key_type == 10005) {
|
||||
|
||||
// * 仅在导航场景下,⽀持第三⽅进⾏路线偏好的重新选择。
|
||||
|
||||
@@ -12,186 +12,195 @@ import com.mogo.service.module.IMogoSettingManager
|
||||
* 2020-01-12.
|
||||
*/
|
||||
object SettingManager : IMogoSettingManager {
|
||||
private val KEY_PAHT_PREFER = "keyPath"
|
||||
private val KEY_VOLUME = "keyVolume"
|
||||
private val KEY_VOICE_STYLE = "keyVoice"
|
||||
private val KEY_MAP_TYPE = "keyMapType"
|
||||
private lateinit var settings: SharedPreferences
|
||||
private val KEY_PAHT_PREFER = "keyPath"
|
||||
private val KEY_VOLUME = "keyVolume"
|
||||
private val KEY_VOICE_STYLE = "keyVoice"
|
||||
private val KEY_MAP_TYPE = "keyMapType"
|
||||
private val KEY_AIMLESS_MODE_TYPE = "keyAimlessModeType"
|
||||
private lateinit var settings: SharedPreferences
|
||||
|
||||
/**
|
||||
* 是否躲避拥堵
|
||||
*/
|
||||
private var congestion = false
|
||||
/**
|
||||
* 是否躲避拥堵
|
||||
*/
|
||||
private var congestion = false
|
||||
|
||||
/**
|
||||
* 不走高速
|
||||
*/
|
||||
private var avoidSpeed = false
|
||||
/**
|
||||
* 不走高速
|
||||
*/
|
||||
private var avoidSpeed = false
|
||||
|
||||
/**
|
||||
* 避免收费
|
||||
*/
|
||||
private var cost = false
|
||||
/**
|
||||
* 避免收费
|
||||
*/
|
||||
private var cost = false
|
||||
|
||||
/**
|
||||
* 高速优先
|
||||
*/
|
||||
private var highSpeed = false
|
||||
/**
|
||||
* 模拟导航
|
||||
*/
|
||||
private var isMonitor: Boolean = false
|
||||
/**
|
||||
* 高速优先
|
||||
*/
|
||||
private var highSpeed = false
|
||||
/**
|
||||
* 模拟导航
|
||||
*/
|
||||
private var isMonitor: Boolean = false
|
||||
|
||||
/**
|
||||
* GPS 模拟
|
||||
*/
|
||||
private var isGpsSimulator: Boolean = false
|
||||
/**
|
||||
* GPS 模拟
|
||||
*/
|
||||
private var isGpsSimulator: Boolean = false
|
||||
|
||||
override fun getPathPrefer(): Int {
|
||||
return settings!!.getInt(KEY_PAHT_PREFER, 0)
|
||||
}
|
||||
|
||||
override fun getVolume(): Int {
|
||||
return settings!!.getInt(KEY_VOLUME, 0)
|
||||
}
|
||||
|
||||
override fun getVoiceStyle(): Int {
|
||||
return settings!!.getInt(KEY_VOICE_STYLE, R.id.rb_navi_detail)
|
||||
}
|
||||
|
||||
override fun getMapType(): Int {
|
||||
return settings!!.getInt(KEY_MAP_TYPE, R.id.rb_navi_day)
|
||||
}
|
||||
|
||||
fun setPathPrefer(type: Int) {
|
||||
settings!!.edit()
|
||||
.putInt(KEY_PAHT_PREFER, type)
|
||||
.apply()
|
||||
}
|
||||
|
||||
fun setVolume(type: Int) {
|
||||
settings!!.edit()
|
||||
.putInt(KEY_VOLUME, type)
|
||||
.apply()
|
||||
}
|
||||
|
||||
fun setVoiceStyle(type: Int) {
|
||||
settings!!.edit()
|
||||
.putInt(KEY_VOICE_STYLE, type)
|
||||
.apply()
|
||||
}
|
||||
|
||||
fun setMapType(type: Int) {
|
||||
settings!!.edit()
|
||||
.putInt(KEY_MAP_TYPE, type)
|
||||
.apply()
|
||||
}
|
||||
|
||||
fun setMonitor(type: Boolean) {
|
||||
isMonitor = type
|
||||
}
|
||||
|
||||
fun isMonitor(): Boolean {
|
||||
return isMonitor
|
||||
}
|
||||
|
||||
fun setGpsSimulator(type:Boolean){
|
||||
isGpsSimulator = type
|
||||
}
|
||||
|
||||
fun isGpsSimulator(): Boolean {
|
||||
return isGpsSimulator
|
||||
}
|
||||
|
||||
/**
|
||||
* 是否躲避拥堵
|
||||
*/
|
||||
fun congestion(congestion: Boolean) {
|
||||
this.congestion = congestion
|
||||
save()
|
||||
}
|
||||
|
||||
/**
|
||||
* 不走高速
|
||||
*/
|
||||
fun avoidSpeed(avoidSpeed: Boolean) {
|
||||
this.avoidSpeed = avoidSpeed
|
||||
if (avoidSpeed) {
|
||||
this.highSpeed = false
|
||||
override fun getPathPrefer(): Int {
|
||||
return settings!!.getInt(KEY_PAHT_PREFER, 0)
|
||||
}
|
||||
save()
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* 避免收费
|
||||
*/
|
||||
fun cost(cost: Boolean) {
|
||||
this.cost = cost
|
||||
if (cost) {
|
||||
this.highSpeed = false
|
||||
override fun getVolume(): Int {
|
||||
return settings!!.getInt(KEY_VOLUME, 0)
|
||||
}
|
||||
save()
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* 高速优先
|
||||
*/
|
||||
fun highSpeed(highSpeed: Boolean) {
|
||||
this.highSpeed = highSpeed
|
||||
if (highSpeed) {
|
||||
this.avoidSpeed = false
|
||||
this.cost = false
|
||||
override fun getVoiceStyle(): Int {
|
||||
return settings!!.getInt(KEY_VOICE_STYLE, R.id.rb_navi_detail)
|
||||
}
|
||||
save()
|
||||
|
||||
}
|
||||
override fun getMapType(): Int {
|
||||
return settings!!.getInt(KEY_MAP_TYPE, R.id.rb_navi_day)
|
||||
}
|
||||
|
||||
fun isCongestion(): Boolean {
|
||||
return congestion
|
||||
}
|
||||
fun setPathPrefer(type: Int) {
|
||||
settings!!.edit()
|
||||
.putInt(KEY_PAHT_PREFER, type)
|
||||
.apply()
|
||||
}
|
||||
|
||||
fun isAvoidSpeed(): Boolean {
|
||||
return avoidSpeed
|
||||
}
|
||||
fun setVolume(type: Int) {
|
||||
settings!!.edit()
|
||||
.putInt(KEY_VOLUME, type)
|
||||
.apply()
|
||||
}
|
||||
|
||||
fun isCost(): Boolean {
|
||||
return cost
|
||||
}
|
||||
fun setVoiceStyle(type: Int) {
|
||||
settings!!.edit()
|
||||
.putInt(KEY_VOICE_STYLE, type)
|
||||
.apply()
|
||||
}
|
||||
|
||||
fun isHighSpeed(): Boolean {
|
||||
return highSpeed
|
||||
}
|
||||
fun setMapType(type: Int) {
|
||||
settings!!.edit()
|
||||
.putInt(KEY_MAP_TYPE, type)
|
||||
.apply()
|
||||
}
|
||||
|
||||
private fun save() {
|
||||
settings.edit()
|
||||
.putBoolean("congestion", congestion)
|
||||
.putBoolean("avoidSpeed", avoidSpeed)
|
||||
.putBoolean("cost", cost)
|
||||
.putBoolean("highSpeed", highSpeed)
|
||||
.apply()
|
||||
updateConfig()
|
||||
fun setMonitor(type: Boolean) {
|
||||
isMonitor = type
|
||||
}
|
||||
|
||||
}
|
||||
fun isMonitor(): Boolean {
|
||||
return isMonitor
|
||||
}
|
||||
|
||||
override fun init(context: Context) {
|
||||
settings = context.getSharedPreferences("settings", Context.MODE_PRIVATE)
|
||||
fun setGpsSimulator(type: Boolean) {
|
||||
isGpsSimulator = type
|
||||
}
|
||||
|
||||
congestion = settings.getBoolean("congestion", false)
|
||||
avoidSpeed = settings.getBoolean("avoidSpeed", false)
|
||||
cost = settings.getBoolean("cost", false)
|
||||
highSpeed = settings.getBoolean("highSpeed", false)
|
||||
updateConfig()
|
||||
}
|
||||
fun isGpsSimulator(): Boolean {
|
||||
return isGpsSimulator
|
||||
}
|
||||
|
||||
private fun updateConfig() {
|
||||
SearchServiceHolder.getNavi()
|
||||
.naviConfig
|
||||
.cost(cost)
|
||||
.avoidSpeed(avoidSpeed)
|
||||
.highSpeed(highSpeed)
|
||||
.congestion(congestion)
|
||||
}
|
||||
/**
|
||||
* 是否躲避拥堵
|
||||
*/
|
||||
fun congestion(congestion: Boolean) {
|
||||
this.congestion = congestion
|
||||
save()
|
||||
}
|
||||
|
||||
/**
|
||||
* 不走高速
|
||||
*/
|
||||
fun avoidSpeed(avoidSpeed: Boolean) {
|
||||
this.avoidSpeed = avoidSpeed
|
||||
if (avoidSpeed) {
|
||||
this.highSpeed = false
|
||||
}
|
||||
save()
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* 避免收费
|
||||
*/
|
||||
fun cost(cost: Boolean) {
|
||||
this.cost = cost
|
||||
if (cost) {
|
||||
this.highSpeed = false
|
||||
}
|
||||
save()
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* 高速优先
|
||||
*/
|
||||
fun highSpeed(highSpeed: Boolean) {
|
||||
this.highSpeed = highSpeed
|
||||
if (highSpeed) {
|
||||
this.avoidSpeed = false
|
||||
this.cost = false
|
||||
}
|
||||
save()
|
||||
|
||||
}
|
||||
|
||||
fun isCongestion(): Boolean {
|
||||
return congestion
|
||||
}
|
||||
|
||||
fun isAvoidSpeed(): Boolean {
|
||||
return avoidSpeed
|
||||
}
|
||||
|
||||
fun isCost(): Boolean {
|
||||
return cost
|
||||
}
|
||||
|
||||
fun isHighSpeed(): Boolean {
|
||||
return highSpeed
|
||||
}
|
||||
|
||||
private fun save() {
|
||||
settings.edit()
|
||||
.putBoolean("congestion", congestion)
|
||||
.putBoolean("avoidSpeed", avoidSpeed)
|
||||
.putBoolean("cost", cost)
|
||||
.putBoolean("highSpeed", highSpeed)
|
||||
.apply()
|
||||
updateConfig()
|
||||
|
||||
}
|
||||
|
||||
override fun init(context: Context) {
|
||||
settings = context.getSharedPreferences("settings", Context.MODE_PRIVATE)
|
||||
|
||||
congestion = settings.getBoolean("congestion", false)
|
||||
avoidSpeed = settings.getBoolean("avoidSpeed", false)
|
||||
cost = settings.getBoolean("cost", false)
|
||||
highSpeed = settings.getBoolean("highSpeed", false)
|
||||
updateConfig()
|
||||
}
|
||||
|
||||
private fun updateConfig() {
|
||||
SearchServiceHolder.getNavi()
|
||||
.naviConfig
|
||||
.cost(cost)
|
||||
.avoidSpeed(avoidSpeed)
|
||||
.highSpeed(highSpeed)
|
||||
.congestion(congestion)
|
||||
}
|
||||
|
||||
fun setAimlessMode(type: Int){
|
||||
settings.edit().putInt(KEY_AIMLESS_MODE_TYPE, type).apply()
|
||||
}
|
||||
|
||||
fun getAimlessMode():Int {
|
||||
return settings.getInt(KEY_AIMLESS_MODE_TYPE, R.id.aimlessModeClose)
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -40,255 +40,225 @@ import kotlinx.android.synthetic.main.fragment_search_category.tv_navi_navi
|
||||
* @author zyz
|
||||
* 2020-01-09.
|
||||
*/
|
||||
class CategorySearchFragment : BaseFragment(), CategoryView, IMogoVoiceCmdCallBack {
|
||||
class CategorySearchFragment : BaseFragment(), CategoryView, IMogoVoiceCmdCallBack, IMogoMarkerClickListener {
|
||||
// override fun onMarkerClicked(marker: IMogoMarker?): Boolean {
|
||||
//
|
||||
// return true
|
||||
// }
|
||||
|
||||
override fun onCmdSelected(cmd: String?) {
|
||||
if (cmd?.startsWith("position") == true) {
|
||||
var index = cmd.substring(8)
|
||||
mAdapter.setCurrent(index.toInt())
|
||||
updateMarker()
|
||||
goPath()
|
||||
override fun onCmdSelected(cmd: String?) {
|
||||
if (cmd?.startsWith("position") == true) {
|
||||
var index = cmd.substring(8)
|
||||
mAdapter.current = index.toInt()
|
||||
updateMarker(false)
|
||||
goPath()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
override fun onCmdAction(speakText: String?) {
|
||||
}
|
||||
override fun onCmdAction(speakText: String?) {
|
||||
}
|
||||
|
||||
override fun onCmdCancel(speakText: String?) {
|
||||
}
|
||||
override fun onCmdCancel(speakText: String?) {
|
||||
}
|
||||
|
||||
override fun onSpeakEnd(speakText: String?) {
|
||||
}
|
||||
override fun onSpeakEnd(speakText: String?) {
|
||||
}
|
||||
|
||||
override fun onSpeakSelectTimeOut(speakText: String?) {
|
||||
}
|
||||
override fun onSpeakSelectTimeOut(speakText: String?) {
|
||||
}
|
||||
|
||||
private val TAG: String = "CategorySearchFragment"
|
||||
private var addMarkers: ArrayList<IMogoMarker> = ArrayList()
|
||||
var arrayList = ArrayList<MogoMarkerOptions>()
|
||||
var locationList = ArrayList<MogoLatLng>()
|
||||
private val TAG: String = "CategorySearchFragment"
|
||||
private var addMarkers: ArrayList<IMogoMarker> = ArrayList()
|
||||
var arrayList = ArrayList<MogoMarkerOptions>()
|
||||
var locationList = ArrayList<MogoLatLng>()
|
||||
|
||||
private lateinit var cmds: ArrayList<String>
|
||||
override fun renderSearchPoiResult(datums: List<MogoPoiItem>?) {
|
||||
mAdapter.setDatas(datums)
|
||||
cv_search_result.visibility = View.VISIBLE
|
||||
pb_path.visibility = View.GONE
|
||||
AIAssist.getInstance(context)
|
||||
.speakTTSVoice(String.format("搜索到%d个位置,请选择", datums?.size))
|
||||
private lateinit var cmds: ArrayList<String>
|
||||
override fun renderSearchPoiResult(datums: List<MogoPoiItem>?) {
|
||||
mAdapter.setDatas(datums)
|
||||
cv_search_result.visibility = View.VISIBLE
|
||||
pb_path.visibility = View.GONE
|
||||
AIAssist.getInstance(context).speakTTSVoice(String.format("搜索到%d个位置,请选择", datums?.size))
|
||||
|
||||
arrayList.clear()
|
||||
locationList.clear()
|
||||
arrayList.clear()
|
||||
locationList.clear()
|
||||
|
||||
for (index in 0 until datums!!.size) {
|
||||
var decodeResource =
|
||||
BitmapFactory.decodeResource(
|
||||
resources,
|
||||
if (mAdapter.current == index) R.mipmap.icon_search_category_checked else R.mipmap.icon_search_category_unchecked
|
||||
)
|
||||
for (index in 0 until datums!!.size) {
|
||||
var decodeResource = BitmapFactory.decodeResource(
|
||||
resources,
|
||||
if (mAdapter.current == index) R.mipmap.icon_search_category_checked else R.mipmap.icon_search_category_unchecked
|
||||
)
|
||||
|
||||
var createWaterMask =
|
||||
BitmapUtils.createWaterMask(
|
||||
context, decodeResource, (index + 1).toString(), R.color.white, 18
|
||||
)
|
||||
val options = MogoMarkerOptions()
|
||||
.icon(createWaterMask)
|
||||
.latitude(datums[index].point?.lat ?: 0.0)
|
||||
.owner("CategorySearchFragment")
|
||||
.`object`(index)
|
||||
var createWaterMask = BitmapUtils.createWaterMask(
|
||||
context, decodeResource, (index + 1).toString(), R.color.white, 18
|
||||
)
|
||||
val options = MogoMarkerOptions()
|
||||
.icon(createWaterMask)
|
||||
.latitude(datums[index].point?.lat ?: 0.0)
|
||||
.owner("CategorySearchFragment")
|
||||
.`object`(index)
|
||||
// .anchor(0.5f, 1f)
|
||||
.longitude(datums[index].point?.lng ?: 0.0)
|
||||
arrayList.add(options)
|
||||
locationList.add(datums[index].point)
|
||||
.longitude(datums[index].point?.lng ?: 0.0)
|
||||
arrayList.add(options)
|
||||
locationList.add(datums[index].point)
|
||||
|
||||
var int2String = StringUtils.int2String(index + 1)
|
||||
AIAssist.getInstance(context)
|
||||
.registerUnWakeupCommand(
|
||||
"position" + index, arrayOf("第" + int2String + "个", "第" + int2String + "条"), this
|
||||
)
|
||||
cmds.add("position" + index)
|
||||
var int2String = StringUtils.int2String(index + 1)
|
||||
AIAssist.getInstance(context).registerUnWakeupCommand("position${index}", arrayOf("第${int2String}个", "第${int2String}条"), this)
|
||||
cmds.add("position" + index)
|
||||
|
||||
}
|
||||
addMarkers()
|
||||
}
|
||||
addMarkers()
|
||||
}
|
||||
|
||||
private fun addMarkers() {
|
||||
addMarkers.clear()
|
||||
var marginBounder = resources.getDimensionPixelSize(R.dimen.dp_60) * 2
|
||||
SearchServiceHolder.getMapUIController()
|
||||
.showBounds(
|
||||
TAG, null, locationList, Rect(
|
||||
cv_search_result.width + marginBounder, marginBounder, marginBounder, marginBounder
|
||||
), false
|
||||
private fun addMarkers() {
|
||||
addMarkers.clear()
|
||||
var marginBounder = resources.getDimensionPixelSize(R.dimen.dp_60) * 2
|
||||
SearchServiceHolder.getMapUIController().showBounds(TAG,
|
||||
null,
|
||||
locationList,
|
||||
Rect(cv_search_result.width + marginBounder, marginBounder, marginBounder, marginBounder),
|
||||
false
|
||||
)
|
||||
|
||||
for (options in arrayList) {
|
||||
var addMarker = SearchServiceHolder.getMarkerManger()
|
||||
.addMarker(TAG, options)
|
||||
addMarkers.add(addMarker)
|
||||
}
|
||||
addClick()
|
||||
}
|
||||
|
||||
private fun registerVoice() {
|
||||
|
||||
for (index in 0 until cmds.size) {
|
||||
var int2String = StringUtils.int2String(index + 1)
|
||||
AIAssist.getInstance(context)
|
||||
.registerUnWakeupCommand(
|
||||
"position" + index, arrayOf("第" + int2String + "个", "第" + int2String + "条"), this
|
||||
)
|
||||
for (options in arrayList) {
|
||||
var addMarker = SearchServiceHolder.getMarkerManger().addMarker(TAG, options)
|
||||
addMarker.onMarkerClickListener = this
|
||||
addMarkers.add(addMarker)
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
override fun onHiddenChanged(hidden: Boolean) {
|
||||
super.onHiddenChanged(hidden)
|
||||
if (!hidden) {
|
||||
registerVoice()
|
||||
addMarkers()
|
||||
} else {
|
||||
unRegisterVoice()
|
||||
private fun registerVoice() {
|
||||
for (index in 0 until cmds.size) {
|
||||
var int2String = StringUtils.int2String(index + 1)
|
||||
AIAssist.getInstance(context).registerUnWakeupCommand("position${index}", arrayOf("第${int2String}个", "第${int2String}条"), this)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private fun addClick() {
|
||||
if (addMarkers != null) {
|
||||
for (item in addMarkers!!) {
|
||||
item.setOnMarkerClickListener {
|
||||
override fun onHiddenChanged(hidden: Boolean) {
|
||||
super.onHiddenChanged(hidden)
|
||||
if (!hidden) {
|
||||
registerVoice()
|
||||
addMarkers()
|
||||
} else {
|
||||
unRegisterVoice()
|
||||
}
|
||||
}
|
||||
|
||||
var index = it.mogoMarkerOptions.`object` as Int
|
||||
mAdapter.current = index
|
||||
rv_search_result.smoothScrollToPosition(index)
|
||||
updateMarker()
|
||||
true
|
||||
override fun onMarkerClicked(marker: IMogoMarker?): Boolean {
|
||||
var index = marker?.mogoMarkerOptions?.`object` as Int
|
||||
mAdapter.current = index
|
||||
rv_search_result.smoothScrollToPosition(index)
|
||||
updateMarker()
|
||||
return true
|
||||
}
|
||||
|
||||
private lateinit var mAdapter: SearchCategoryAdapter
|
||||
|
||||
private lateinit var mSearchPresenter: CategoryPresenter
|
||||
private var category: String? = null
|
||||
|
||||
override fun onCreate(savedInstanceState: Bundle?) {
|
||||
super.onCreate(savedInstanceState)
|
||||
category = arguments?.getString("category")
|
||||
mSearchPresenter = CategoryPresenter(this)
|
||||
lifecycle.addObserver(mSearchPresenter)
|
||||
cmds = ArrayList<String>()
|
||||
}
|
||||
|
||||
override fun getLayoutId(): Int {
|
||||
return R.layout.fragment_search_category
|
||||
}
|
||||
|
||||
override fun onViewCreated(
|
||||
view: View,
|
||||
savedInstanceState: Bundle?) {
|
||||
super.onViewCreated(view, savedInstanceState)
|
||||
mAdapter = SearchCategoryAdapter(activity, ArrayList())
|
||||
|
||||
rv_search_result.layoutManager = LinearLayoutManager(activity, LinearLayoutManager.VERTICAL, false)
|
||||
rv_search_result.adapter = mAdapter
|
||||
et_navi_search.setText(category)
|
||||
|
||||
|
||||
iv_navi_back.setOnClickListener {
|
||||
SearchServiceHolder.fragmentManager.pop()
|
||||
}
|
||||
|
||||
}
|
||||
tv_navi_navi.setOnClickListener {
|
||||
goPath()
|
||||
}
|
||||
mAdapter.setOnClickListener {
|
||||
var position = it.getTag(R.id.tag_position) as Int
|
||||
mAdapter.current = position
|
||||
updateMarker()
|
||||
}
|
||||
|
||||
AIAssist.getInstance(context).registerUnWakeupCommand("back", arrayOf("关闭", "返回"), this)
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
private lateinit var mAdapter: SearchCategoryAdapter
|
||||
|
||||
private lateinit var mSearchPresenter: CategoryPresenter
|
||||
private var category: String? = null
|
||||
override fun onCreate(savedInstanceState: Bundle?) {
|
||||
super.onCreate(savedInstanceState)
|
||||
category = arguments?.getString("category")
|
||||
mSearchPresenter = CategoryPresenter(this)
|
||||
lifecycle.addObserver(mSearchPresenter)
|
||||
cmds = ArrayList<String>()
|
||||
}
|
||||
|
||||
override fun getLayoutId(): Int {
|
||||
return R.layout.fragment_search_category
|
||||
}
|
||||
|
||||
override fun onViewCreated(
|
||||
view: View,
|
||||
savedInstanceState: Bundle?
|
||||
) {
|
||||
super.onViewCreated(view, savedInstanceState)
|
||||
mAdapter = SearchCategoryAdapter(activity, ArrayList())
|
||||
|
||||
rv_search_result.layoutManager =
|
||||
LinearLayoutManager(activity, LinearLayoutManager.VERTICAL, false)
|
||||
|
||||
rv_search_result.adapter = mAdapter
|
||||
|
||||
et_navi_search.setText(category)
|
||||
|
||||
|
||||
iv_navi_back.setOnClickListener {
|
||||
SearchServiceHolder.fragmentManager.pop()
|
||||
private fun goPath() {
|
||||
mAdapter.currentItem?.let {
|
||||
AddressManager.calculatePath(mAdapter.currentItem.point)
|
||||
}
|
||||
}
|
||||
|
||||
tv_navi_navi.setOnClickListener {
|
||||
private fun updateMarker(moveToCenter:Boolean = true) {
|
||||
|
||||
goPath()
|
||||
}
|
||||
mAdapter.setOnClickListener {
|
||||
var position = it.getTag(R.id.tag_position) as Int
|
||||
mAdapter.setCurrent(position)
|
||||
updateMarker()
|
||||
addMarkers?.get(mAdapter.lastPosition)?.setIcon(getMarkerIcon(mAdapter.lastPosition))
|
||||
var current = addMarkers?.get(mAdapter.current)
|
||||
current?.setIcon(getMarkerIcon(mAdapter.current))
|
||||
current?.setToTop()
|
||||
arrayList.get(mAdapter.lastPosition).icon(getMarkerIcon(mAdapter.lastPosition))
|
||||
arrayList.get(mAdapter.current).icon(getMarkerIcon(mAdapter.current))
|
||||
if (moveToCenter) {
|
||||
SearchServiceHolder.statusManager.setUserInteractionStatus(TAG, true, false)
|
||||
SearchServiceHolder.getMapUIController().moveToCenter(current.position)
|
||||
}
|
||||
}
|
||||
|
||||
AIAssist.getInstance(context)
|
||||
.registerUnWakeupCommand("back", arrayOf("关闭", "返回"), this)
|
||||
private fun getMarkerIcon(index: Int): Bitmap {
|
||||
var decodeResource = BitmapFactory.decodeResource(
|
||||
resources,
|
||||
if (mAdapter.current == index) R.mipmap.icon_search_category_checked else R.mipmap.icon_search_category_unchecked
|
||||
)
|
||||
|
||||
}
|
||||
|
||||
private fun goPath() {
|
||||
mAdapter.currentItem?.let {
|
||||
AddressManager.calculatePath(mAdapter.currentItem.point)
|
||||
var createWaterMask = BitmapUtils.createWaterMask(
|
||||
context, decodeResource, (index + 1).toString(), R.color.white, 18
|
||||
)
|
||||
return createWaterMask
|
||||
}
|
||||
}
|
||||
|
||||
private fun updateMarker() {
|
||||
|
||||
addMarkers?.get(mAdapter.lastPosition)
|
||||
?.setIcon(getMarkerIcon(mAdapter.lastPosition))
|
||||
var current = addMarkers?.get(mAdapter.current)
|
||||
current?.setIcon(getMarkerIcon(mAdapter.current))
|
||||
current?.setToTop()
|
||||
arrayList.get(mAdapter.lastPosition)
|
||||
.icon(getMarkerIcon(mAdapter.lastPosition))
|
||||
arrayList.get(mAdapter.current)
|
||||
.icon(getMarkerIcon(mAdapter.current))
|
||||
}
|
||||
|
||||
private fun getMarkerIcon(index: Int): Bitmap {
|
||||
var decodeResource =
|
||||
BitmapFactory.decodeResource(
|
||||
resources,
|
||||
if (mAdapter.current == index) R.mipmap.icon_search_category_checked else R.mipmap.icon_search_category_unchecked
|
||||
)
|
||||
|
||||
var createWaterMask =
|
||||
BitmapUtils.createWaterMask(
|
||||
context, decodeResource, (index + 1).toString(), R.color.white, 18
|
||||
)
|
||||
return createWaterMask
|
||||
}
|
||||
|
||||
override fun onActivityCreated(savedInstanceState: Bundle?) {
|
||||
super.onActivityCreated(savedInstanceState)
|
||||
mSearchPresenter.startSearchLocalPoiByInput(category)
|
||||
}
|
||||
|
||||
override fun onDestroyView() {
|
||||
super.onDestroyView()
|
||||
mSearchPresenter.onDestroy(viewLifecycleOwner)
|
||||
lifecycle.removeObserver(mSearchPresenter)
|
||||
SearchServiceHolder.getMarkerManger()
|
||||
.removeMarkers(TAG)
|
||||
|
||||
unRegisterVoice()
|
||||
}
|
||||
|
||||
private fun unRegisterVoice() {
|
||||
cmds.forEach {
|
||||
AIAssist.getInstance(context)
|
||||
.unregisterUnWakeupCommand(it)
|
||||
override fun onActivityCreated(savedInstanceState: Bundle?) {
|
||||
super.onActivityCreated(savedInstanceState)
|
||||
mSearchPresenter.startSearchLocalPoiByInput(category)
|
||||
}
|
||||
}
|
||||
|
||||
override fun onDestroy() {
|
||||
super.onDestroy()
|
||||
}
|
||||
override fun onDestroyView() {
|
||||
super.onDestroyView()
|
||||
mSearchPresenter.onDestroy(viewLifecycleOwner)
|
||||
lifecycle.removeObserver(mSearchPresenter)
|
||||
SearchServiceHolder.getMarkerManger().removeMarkers(TAG)
|
||||
|
||||
companion object {
|
||||
fun newInstance(category: String): Fragment {
|
||||
MapCenterPointStrategy.setMapCenterPointByScene(SearchServiceHolder.getMapUIController(), Scene.CATEGORY_SEARCH)
|
||||
var bundle = Bundle()
|
||||
bundle.putString("category", category)
|
||||
var categorySerachFragment = CategorySearchFragment()
|
||||
categorySerachFragment.arguments = bundle
|
||||
return categorySerachFragment
|
||||
unRegisterVoice()
|
||||
}
|
||||
|
||||
private fun unRegisterVoice() {
|
||||
cmds.forEach {
|
||||
AIAssist.getInstance(context).unregisterUnWakeupCommand(it)
|
||||
}
|
||||
}
|
||||
|
||||
override fun onDestroy() {
|
||||
super.onDestroy()
|
||||
}
|
||||
|
||||
companion object {
|
||||
fun newInstance(category: String): Fragment {
|
||||
MapCenterPointStrategy.setMapCenterPointByScene(SearchServiceHolder.getMapUIController(), Scene.CATEGORY_SEARCH)
|
||||
var bundle = Bundle()
|
||||
bundle.putString("category", category)
|
||||
var categorySerachFragment = CategorySearchFragment()
|
||||
categorySerachFragment.arguments = bundle
|
||||
return categorySerachFragment
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -9,6 +9,7 @@ import android.widget.SeekBar
|
||||
import android.widget.SeekBar.OnSeekBarChangeListener
|
||||
import com.alibaba.android.arouter.facade.annotation.Route
|
||||
import com.mogo.commons.debug.DebugConfig
|
||||
import com.mogo.commons.voice.AIAssist
|
||||
import com.mogo.map.constants.BroadcastMode
|
||||
import com.mogo.map.uicontroller.EnumMapUI
|
||||
import com.mogo.module.common.MogoModulePaths
|
||||
@@ -79,9 +80,6 @@ class NaviSettingFragment : BaseFragment(), OnCheckedChangeListener {
|
||||
savedInstanceState: Bundle?) {
|
||||
super.onViewCreated(view, savedInstanceState)
|
||||
|
||||
iv_back.setOnClickListener {
|
||||
SearchServiceHolder.fragmentManager.pop()
|
||||
}
|
||||
initViews()
|
||||
initEvent()
|
||||
EventBus.getDefault().register(this)
|
||||
@@ -101,7 +99,8 @@ class NaviSettingFragment : BaseFragment(), OnCheckedChangeListener {
|
||||
rb_navi_auto.isChecked = SettingManager.mapType == R.id.rb_navi_auto
|
||||
rb_navi_detail.isChecked = SettingManager.voiceStyle == R.id.rb_navi_detail
|
||||
rb_navi_draft.isChecked = SettingManager.voiceStyle == R.id.rb_navi_draft
|
||||
|
||||
aimlessModeClose.isChecked = SettingManager.getAimlessMode() == aimlessModeClose.id
|
||||
aimlessModeOpen.isChecked = SettingManager.getAimlessMode() == aimlessModeOpen.id
|
||||
|
||||
updateHome()
|
||||
updateCompany()
|
||||
@@ -109,6 +108,9 @@ class NaviSettingFragment : BaseFragment(), OnCheckedChangeListener {
|
||||
}
|
||||
|
||||
private fun initEvent() {
|
||||
rl_navi_setting_title.setOnClickListener {
|
||||
SearchServiceHolder.fragmentManager.pop()
|
||||
}
|
||||
iv_sound_plus.setOnClickListener {
|
||||
VolumeManager.getInstance(context).incVolume()
|
||||
sb_navi_volume_progress.progress = sb_navi_volume_progress.progress.plus(10)
|
||||
@@ -177,6 +179,21 @@ class NaviSettingFragment : BaseFragment(), OnCheckedChangeListener {
|
||||
}
|
||||
}
|
||||
|
||||
aimlessModeGroup.setOnCheckedChangeListener { group, checkedId ->
|
||||
|
||||
SettingManager.setAimlessMode(checkedId)
|
||||
when (checkedId){
|
||||
R.id.aimlessModeClose -> {
|
||||
SearchServiceHolder.getNavi().setAimlessModeStatus(false)
|
||||
AIAssist.getInstance(mContext).speakTTSVoice("已为您关闭巡航模式")
|
||||
}
|
||||
R.id.aimlessModeOpen -> {
|
||||
SearchServiceHolder.getNavi().setAimlessModeStatus(true)
|
||||
AIAssist.getInstance(mContext).speakTTSVoice("已为您开启巡航模式")
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
tv_navi_clear_home_address.setOnClickListener {
|
||||
AddressManager.deleteHome(context!!)
|
||||
|
||||
@@ -313,6 +313,47 @@
|
||||
|
||||
|
||||
|
||||
<TextView
|
||||
android:id="@+id/aimlessMode"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="@dimen/module_search_txt_setting_width"
|
||||
android:layout_marginTop="@dimen/dp_40"
|
||||
android:text="@string/module_search_aimless_mode_anchor"
|
||||
android:textColor="@color/white_80"
|
||||
android:textSize="@dimen/txt_normal"
|
||||
app:layout_constraintTop_toBottomOf="@id/rg_navi_day_night"
|
||||
app:layout_constraintLeft_toLeftOf="parent"
|
||||
/>
|
||||
|
||||
<RadioGroup
|
||||
android:id="@+id/aimlessModeGroup"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginBottom="26dp"
|
||||
android:layout_marginTop="@dimen/dp_12"
|
||||
android:orientation="horizontal"
|
||||
app:layout_constraintLeft_toLeftOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@+id/aimlessMode"
|
||||
>
|
||||
|
||||
<RadioButton
|
||||
android:id="@+id/aimlessModeClose"
|
||||
android:layout_marginRight="20dp"
|
||||
android:checked="true"
|
||||
android:text="@string/module_search_aimless_mode_close"
|
||||
style="@style/rb_setting"
|
||||
/>
|
||||
|
||||
|
||||
<RadioButton
|
||||
android:id="@+id/aimlessModeOpen"
|
||||
android:layout_marginRight="20dp"
|
||||
android:text="@string/module_search_aimless_mode_open"
|
||||
style="@style/rb_setting"
|
||||
/>
|
||||
|
||||
</RadioGroup>
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tv_navi_address"
|
||||
android:layout_width="wrap_content"
|
||||
@@ -321,7 +362,7 @@
|
||||
android:text="@string/preference_navi_address"
|
||||
android:textColor="@color/white_80"
|
||||
android:textSize="@dimen/txt_normal"
|
||||
app:layout_constraintTop_toBottomOf="@id/rg_navi_day_night"
|
||||
app:layout_constraintTop_toBottomOf="@id/aimlessModeGroup"
|
||||
app:layout_constraintLeft_toLeftOf="parent"
|
||||
/>
|
||||
|
||||
|
||||
@@ -125,7 +125,8 @@
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_weight="1"
|
||||
android:ellipsize="end"
|
||||
|
||||
android:enabled="false"
|
||||
android:inputType="none"
|
||||
android:textSize="@dimen/module_search_et_text_size"
|
||||
android:imeOptions="actionDone"
|
||||
android:hint="@string/hint_map_search"
|
||||
|
||||
@@ -42,4 +42,7 @@
|
||||
<string name="preference_navi_day_mode">日夜模式</string>
|
||||
<string name="set_fps">设置刷新帧率</string>
|
||||
<string name="notice_clean_history">清空历史记录,确定还是取消</string>
|
||||
<string name="module_search_aimless_mode_anchor">巡航播报设置</string>
|
||||
<string name="module_search_aimless_mode_open">开启</string>
|
||||
<string name="module_search_aimless_mode_close">关闭</string>
|
||||
</resources>
|
||||
|
||||
@@ -82,6 +82,10 @@ public class MarkerServiceHandler {
|
||||
mMapMarkerManager.init( context );
|
||||
}
|
||||
|
||||
public static IMogoServiceApis getApis(){
|
||||
return mApis;
|
||||
}
|
||||
|
||||
public static IMogoMapService getMapService() {
|
||||
return mMapService;
|
||||
}
|
||||
|
||||
@@ -8,7 +8,6 @@ import android.location.LocationManager;
|
||||
import android.os.Handler;
|
||||
import android.os.Looper;
|
||||
import android.os.Message;
|
||||
import android.os.Trace;
|
||||
import android.text.TextUtils;
|
||||
import android.util.Log;
|
||||
import android.view.MotionEvent;
|
||||
@@ -37,6 +36,7 @@ import com.mogo.module.common.MogoModulePaths;
|
||||
import com.mogo.module.common.map.MapCenterPointStrategy;
|
||||
import com.mogo.module.common.map.Scene;
|
||||
import com.mogo.module.service.carinfo.CarStateInfo;
|
||||
import com.mogo.module.service.intent.IntentHandlerFactory;
|
||||
import com.mogo.module.service.marker.MapMarkerManager;
|
||||
import com.mogo.module.service.network.RefreshCallback;
|
||||
import com.mogo.module.service.network.RefreshModel;
|
||||
@@ -44,6 +44,7 @@ import com.mogo.module.service.receiver.MogoReceiver;
|
||||
import com.mogo.module.service.refresh.AutoRefreshStrategy;
|
||||
import com.mogo.module.service.refresh.CustomRefreshStrategy;
|
||||
import com.mogo.module.service.refresh.RefreshObject;
|
||||
import com.mogo.module.service.strategy.CarIconDisplayStrategy;
|
||||
import com.mogo.service.adas.IMogoADASController;
|
||||
import com.mogo.service.cardmanager.IMogoCardManager;
|
||||
import com.mogo.service.fragmentmanager.FragmentStackTransactionListener;
|
||||
@@ -58,13 +59,11 @@ import com.mogo.service.module.MogoAction;
|
||||
import com.mogo.service.statusmanager.IMogoStatusChangedListener;
|
||||
import com.mogo.service.statusmanager.IMogoStatusManager;
|
||||
import com.mogo.service.statusmanager.StatusDescriptor;
|
||||
import com.mogo.utils.AppUtils;
|
||||
import com.mogo.utils.UiThreadHandler;
|
||||
import com.mogo.utils.WorkThreadHandler;
|
||||
import com.mogo.utils.logger.Logger;
|
||||
import com.mogo.utils.network.utils.GsonUtil;
|
||||
|
||||
import org.json.JSONException;
|
||||
import org.json.JSONObject;
|
||||
|
||||
import java.util.List;
|
||||
@@ -207,8 +206,7 @@ public class MogoServices implements IMogoMapListener,
|
||||
mUiController.setLockZoom( ServiceConst.DEFAULT_LOCK_CAR_ZOOM_LEVEL );
|
||||
mStatusManager.setUserInteractionStatus( TAG, true, false );
|
||||
mUiController.recoverLockMode();
|
||||
notifyRefreshData( mLastAutoRefreshLocation,
|
||||
ServiceConst.DEFAULT_AUTO_REFRESH_DATA_RADIUS, mAutoRefreshCallback );
|
||||
notifyRefreshData( mLastAutoRefreshLocation, ServiceConst.DEFAULT_AUTO_REFRESH_DATA_RADIUS, mAutoRefreshCallback );
|
||||
}
|
||||
};
|
||||
private Context mContext;
|
||||
@@ -508,6 +506,8 @@ public class MogoServices implements IMogoMapListener,
|
||||
return;
|
||||
}
|
||||
|
||||
Logger.d( TAG, "mLastZoomLevel = %s, zoom = %s", mLastZoomLevel, zoom );
|
||||
|
||||
// 手动刷新触发
|
||||
if ( mLastZoomLevel - zoom > mCustomRefreshStrategy.getZoomOutLevel() ) {
|
||||
// 缩放级别缩小
|
||||
@@ -522,6 +522,7 @@ public class MogoServices implements IMogoMapListener,
|
||||
msg.what = ServiceConst.MSG_MAP_CHANGED;
|
||||
msg.obj = new RefreshObject( mCustomRefreshCallback, getQueryRadius(), latLng, 0 );
|
||||
mThreadHandler.sendMessage( msg );
|
||||
Logger.d( TAG, "平移触发" );
|
||||
}
|
||||
}
|
||||
|
||||
@@ -539,7 +540,6 @@ public class MogoServices implements IMogoMapListener,
|
||||
*/
|
||||
private boolean invokeRefreshWhenTranslationByUser( MogoLatLng latLng ) {
|
||||
try {
|
||||
Trace.beginSection( "timer.invokeRefreshWhenTranslationByUser" );
|
||||
float factor = 0.0f;
|
||||
if ( mIsVertical ) {
|
||||
factor = getMapCameraFactWidth();
|
||||
@@ -550,7 +550,7 @@ public class MogoServices implements IMogoMapListener,
|
||||
return false;
|
||||
}
|
||||
float distance = Utils.calculateLineDistance( latLng, mLastCustomRefreshCenterLocation );
|
||||
Trace.endSection();
|
||||
Logger.d( TAG, "move distance = %s, factor = %s", distance, factor );
|
||||
return distance > factor;
|
||||
} catch ( Exception e ) {
|
||||
Logger.e( TAG, e, "warming. " );
|
||||
@@ -669,17 +669,18 @@ public class MogoServices implements IMogoMapListener,
|
||||
}
|
||||
break;
|
||||
case SEEK_HELPING:
|
||||
CarIconDisplayStrategy.getInstance().changeCarIconStatus( mUiController, isTrue );
|
||||
notifySeekHelpingStatusChanged( isTrue );
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
private void notifySeekHelpingStatusChanged( boolean open ) {
|
||||
private void notifySeekHelpingStatusChanged( boolean seekHelpingStatus ) {
|
||||
Intent intent = new Intent( "com.mogo.launcher.adas.app" );
|
||||
try {
|
||||
JSONObject data = new JSONObject();
|
||||
data.put( "object", "辅助驾驶" );
|
||||
data.put( "action", open ? "2" : "1" );
|
||||
data.put( "action", seekHelpingStatus ? "2" : "1" );
|
||||
data.put( "des", "自身故障报警" );
|
||||
data.put( "v2x_warning_type", "20007" );// 后台返回
|
||||
intent.putExtra( "data", data.toString() );
|
||||
@@ -787,33 +788,14 @@ public class MogoServices implements IMogoMapListener,
|
||||
}
|
||||
} else if ( ServiceConst.COMMAND_NEXT.equals( command ) ) {
|
||||
if ( mStatusManager.isMainPageOnResume() ) {
|
||||
mActionManager.invoke( MapMarkerManager.getInstance().getCurrentModuleName(),
|
||||
MogoAction.Next );
|
||||
mActionManager.invoke( MapMarkerManager.getInstance().getCurrentModuleName(), MogoAction.Next );
|
||||
}
|
||||
} else if ( ServiceConst.COMMAND_PREVIOUS.equals( command ) ) {
|
||||
if ( mStatusManager.isMainPageOnResume() ) {
|
||||
mActionManager.invoke( MapMarkerManager.getInstance().getCurrentModuleName(),
|
||||
MogoAction.Prev );
|
||||
mActionManager.invoke( MapMarkerManager.getInstance().getCurrentModuleName(), MogoAction.Prev );
|
||||
}
|
||||
} else if ( ServiceConst.COMMAND_SWITCH_CARD.equals( command ) ) {
|
||||
String data = intent.getStringExtra( "data" );
|
||||
try {
|
||||
JSONObject jsonObject = new JSONObject( data );
|
||||
String card = jsonObject.getString( "card" );
|
||||
if ( TextUtils.equals( "多媒体卡片", card )
|
||||
|| TextUtils.equals( "媒体中心卡片", card )
|
||||
|| TextUtils.equals( "音乐卡片", card ) ) {
|
||||
switchCard2( ServiceConst.CARD_TYPE_SHARE_MUSIC );
|
||||
} else if ( TextUtils.equals( "探路卡片", card ) ) {
|
||||
switchCard2( ServiceConst.CARD_TYPE_ROAD_CONDITION );
|
||||
} else if ( TextUtils.equals( "在线车辆卡片", card ) ) {
|
||||
switchCard2( ServiceConst.CARD_TYPE_USER_DATA );
|
||||
} else if ( TextUtils.equals( "新鲜事卡片", card ) ) {
|
||||
switchCard2( ServiceConst.CARD_TYPE_NOVELTY );
|
||||
}
|
||||
} catch ( JSONException e ) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
IntentHandlerFactory.getInstance().handle( mContext, command, intent );
|
||||
} else if ( MogoReceiver.ACTION_ADAS_STATUS.equals( command ) ) {
|
||||
String msg = intent.getStringExtra( "adasMsg" );
|
||||
if ( TextUtils.isEmpty( msg ) ) {
|
||||
@@ -825,62 +807,14 @@ public class MogoServices implements IMogoMapListener,
|
||||
// changeMyLocation( stateInfo.getValues() );
|
||||
}
|
||||
} else if ( ServiceConst.COMMAND_OPERATION.equals( command ) ) {
|
||||
try {
|
||||
JSONObject object = new JSONObject( intent.getStringExtra( "data" ) );
|
||||
String app = object.optString( "object" );
|
||||
String operation = object.optString( "operation" );
|
||||
if ( TextUtils.equals( app, "车聊聊" ) ) {
|
||||
if ( TextUtils.equals( "打开", operation ) ) {
|
||||
switchCard2( ServiceConst.CARD_TYPE_CARS_CHATTING );
|
||||
}
|
||||
} else {
|
||||
if ( TextUtils.equals( app, "探路" ) ) {
|
||||
if ( TextUtils.equals( "打开", operation ) ) {
|
||||
switchCard2( ServiceConst.CARD_TYPE_ROAD_CONDITION );
|
||||
}
|
||||
}
|
||||
}
|
||||
} catch ( JSONException e ) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
IntentHandlerFactory.getInstance().handle( mContext, command, intent );
|
||||
} else if ( MogoReceiver.ACTION_VOICE_READY.equals( command ) ) {
|
||||
AIAssist.getInstance( mContext ).flush();
|
||||
mStatusManager.setAIAssistReady( TAG, true );
|
||||
} else if ( ServiceConst.COMMAND_MY_LOCATION.equals( command ) ) {
|
||||
if ( mStatusManager.isSearchUIShow() ) {
|
||||
return;
|
||||
}
|
||||
if ( mStatusManager.isMainPageOnResume() ) {
|
||||
mUiController.recoverLockMode();
|
||||
}
|
||||
IntentHandlerFactory.getInstance().handle( mContext, command, intent );
|
||||
} else if ( MogoReceiver.ACTION_MOCK.equals( command ) ) {
|
||||
final int oper = intent.getIntExtra( "oper", -1 );
|
||||
switch ( oper ) {
|
||||
case 1:
|
||||
mUiController.showMyLocation( true );
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 切换卡片
|
||||
*/
|
||||
private void switchCard2( String card ) {
|
||||
if ( AppUtils.isApplicationBroughtToBackground( mContext ) ) {
|
||||
mLauncher.backToLauncher( mContext );
|
||||
UiThreadHandler.postDelayed( () -> {
|
||||
if ( mStatusManager.isADASShow() ) {
|
||||
mADASController.closeADAS();
|
||||
}
|
||||
mCardManager.switch2( card, true );
|
||||
}, 2000L );
|
||||
} else {
|
||||
mFragmentManager.clearAll();
|
||||
if ( mStatusManager.isADASShow() ) {
|
||||
mADASController.closeADAS();
|
||||
}
|
||||
mCardManager.switch2( card, true );
|
||||
IntentHandlerFactory.getInstance().handle( mContext, command, intent );
|
||||
}
|
||||
}
|
||||
|
||||
@@ -894,11 +828,13 @@ public class MogoServices implements IMogoMapListener,
|
||||
if ( !mStatusManager.isMainPageOnResume() ) {
|
||||
return;
|
||||
}
|
||||
if ( mStatusManager.isSeekHelping() ) {
|
||||
return;
|
||||
}
|
||||
if ( mUiController.getCurrentUiMode() != EnumMapUI.NorthUP_2D ) {
|
||||
return;
|
||||
}
|
||||
UiThreadHandler.post( () -> {
|
||||
|
||||
mUiController.showMyLocation( inflateCursorView( degree ) );
|
||||
} );
|
||||
}
|
||||
|
||||
@@ -78,7 +78,7 @@ public class ServiceConst {
|
||||
public static final int DEFAULT_LOCK_CAR_ZOOM_LEVEL = 16;
|
||||
|
||||
/**
|
||||
* 自动酸辛默认半径
|
||||
* 自动刷新默认半径
|
||||
*/
|
||||
public static final int DEFAULT_AUTO_REFRESH_DATA_RADIUS = 2_000;
|
||||
|
||||
|
||||
@@ -0,0 +1,41 @@
|
||||
package com.mogo.module.service.intent;
|
||||
|
||||
import android.content.Context;
|
||||
import android.content.Intent;
|
||||
import android.text.TextUtils;
|
||||
|
||||
import com.mogo.module.service.ServiceConst;
|
||||
|
||||
import org.json.JSONException;
|
||||
import org.json.JSONObject;
|
||||
|
||||
/**
|
||||
* @author congtaowang
|
||||
* @since 2020-04-17
|
||||
* <p>
|
||||
* 描述
|
||||
*/
|
||||
public class AppOperationIntentHandler implements IntentHandler {
|
||||
|
||||
@Override
|
||||
public void handle( Context context, Intent intent ) {
|
||||
try {
|
||||
JSONObject object = new JSONObject( intent.getStringExtra( "data" ) );
|
||||
String app = object.optString( "object" );
|
||||
String operation = object.optString( "operation" );
|
||||
if ( TextUtils.equals( app, "车聊聊" ) ) {
|
||||
if ( TextUtils.equals( "打开", operation ) ) {
|
||||
SwitchCardIntentHandler.switchCard2( context, ServiceConst.CARD_TYPE_CARS_CHATTING );
|
||||
}
|
||||
} else {
|
||||
if ( TextUtils.equals( app, "探路" ) ) {
|
||||
if ( TextUtils.equals( "打开", operation ) ) {
|
||||
SwitchCardIntentHandler.switchCard2( context, ServiceConst.CARD_TYPE_ROAD_CONDITION );
|
||||
}
|
||||
}
|
||||
}
|
||||
} catch ( JSONException e ) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,22 @@
|
||||
package com.mogo.module.service.intent;
|
||||
|
||||
import android.content.Context;
|
||||
import android.content.Intent;
|
||||
|
||||
import com.mogo.utils.logger.Logger;
|
||||
|
||||
/**
|
||||
* @author congtaowang
|
||||
* @since 2020-04-17
|
||||
* <p>
|
||||
* 描述
|
||||
*/
|
||||
public class EmptyIntentHandler implements IntentHandler {
|
||||
|
||||
private static final String TAG = "EmptyIntentHandler";
|
||||
|
||||
@Override
|
||||
public void handle( Context context, Intent intent ) {
|
||||
Logger.w( TAG, "空实现." );
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,15 @@
|
||||
package com.mogo.module.service.intent;
|
||||
|
||||
import android.content.Context;
|
||||
import android.content.Intent;
|
||||
|
||||
/**
|
||||
* @author congtaowang
|
||||
* @since 2020-04-17
|
||||
* <p>
|
||||
* 描述
|
||||
*/
|
||||
public interface IntentHandler {
|
||||
|
||||
void handle( Context context, Intent intent );
|
||||
}
|
||||
@@ -0,0 +1,59 @@
|
||||
package com.mogo.module.service.intent;
|
||||
|
||||
import android.content.Context;
|
||||
import android.content.Intent;
|
||||
|
||||
import com.mogo.module.service.ServiceConst;
|
||||
import com.mogo.module.service.receiver.MogoReceiver;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* @author congtaowang
|
||||
* @since 2020-04-17
|
||||
* <p>
|
||||
* 描述
|
||||
*/
|
||||
public class IntentHandlerFactory {
|
||||
|
||||
private IntentHandlerFactory() {
|
||||
// private constructor
|
||||
mHandlers.put( MogoReceiver.ACTION_MOCK, new MockIntentHandler() );
|
||||
mHandlers.put( ServiceConst.COMMAND_SWITCH_CARD, new SwitchCardIntentHandler() );
|
||||
mHandlers.put( ServiceConst.COMMAND_OPERATION, new AppOperationIntentHandler() );
|
||||
mHandlers.put( ServiceConst.COMMAND_MY_LOCATION, new MyLocationHandler() );
|
||||
}
|
||||
|
||||
private static final class InstanceHolder {
|
||||
private static final IntentHandlerFactory INSTANCE = new IntentHandlerFactory();
|
||||
}
|
||||
|
||||
public static IntentHandlerFactory getInstance() {
|
||||
return InstanceHolder.INSTANCE;
|
||||
}
|
||||
|
||||
private Object readResolve() {
|
||||
// 阻止反序列化,必须实现 Serializable 接口
|
||||
return InstanceHolder.INSTANCE;
|
||||
}
|
||||
|
||||
private Map< String, IntentHandler > mHandlers = new HashMap<>();
|
||||
|
||||
private IntentHandler DEFAULT = new EmptyIntentHandler();
|
||||
|
||||
private IntentHandler getIntentHandler( String intent ) {
|
||||
if ( mHandlers.containsKey( intent ) && mHandlers.get( intent ) != null ) {
|
||||
return mHandlers.get( intent );
|
||||
}
|
||||
return DEFAULT;
|
||||
}
|
||||
|
||||
public void handle( Context context, String intent, Intent obj ) {
|
||||
IntentHandler handler = getIntentHandler( intent );
|
||||
if ( handler != null ) {
|
||||
handler.handle( context, obj );
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,65 @@
|
||||
package com.mogo.module.service.intent;
|
||||
|
||||
import android.content.Context;
|
||||
import android.content.Intent;
|
||||
import android.graphics.Color;
|
||||
import android.text.TextUtils;
|
||||
import android.view.View;
|
||||
import android.widget.TextView;
|
||||
|
||||
import com.mogo.commons.debug.DebugConfig;
|
||||
import com.mogo.module.service.MarkerServiceHandler;
|
||||
import com.mogo.service.entrance.ButtonIndex;
|
||||
import com.mogo.utils.TipToast;
|
||||
|
||||
/**
|
||||
* @author congtaowang
|
||||
* @since 2020-04-17
|
||||
* <p>
|
||||
* 描述
|
||||
*/
|
||||
public class MockIntentHandler implements IntentHandler {
|
||||
|
||||
private static final String TAG = "MockIntentHandler";
|
||||
|
||||
@Override
|
||||
public void handle( Context context, Intent intent ) {
|
||||
if ( !DebugConfig.isDebug() ) {
|
||||
return;
|
||||
}
|
||||
|
||||
final int oper = intent.getIntExtra( "oper", -1 );
|
||||
switch ( oper ) {
|
||||
case 1:
|
||||
MarkerServiceHandler.getMapUIController().showMyLocation( true );
|
||||
break;
|
||||
case 2:
|
||||
boolean status = intent.getBooleanExtra( "status", false );
|
||||
MarkerServiceHandler.getMogoStatusManager().setSeekHelping( TAG, status );
|
||||
break;
|
||||
case 3:
|
||||
String msg = intent.getStringExtra( "msg" );
|
||||
if ( !TextUtils.isEmpty( msg ) ) {
|
||||
TipToast.shortTip( msg );
|
||||
}
|
||||
break;
|
||||
case 4:
|
||||
TextView button1 = MarkerServiceHandler.getApis().getEntranceButtonController().getButton( ButtonIndex.BUTTON1 );
|
||||
if ( button1 != null ) {
|
||||
button1.setVisibility( View.VISIBLE );
|
||||
button1.setBackgroundColor( Color.RED );
|
||||
button1.setOnClickListener( view -> {
|
||||
TipToast.shortTip( "测试" );
|
||||
} );
|
||||
}
|
||||
break;
|
||||
case 5:
|
||||
TextView button2 = MarkerServiceHandler.getApis().getEntranceButtonController().getButton( ButtonIndex.BUTTON1 );
|
||||
if ( button2 != null ) {
|
||||
button2.setOnClickListener( null );
|
||||
button2.setVisibility( View.GONE );
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,31 @@
|
||||
package com.mogo.module.service.intent;
|
||||
|
||||
import android.content.Context;
|
||||
import android.content.Intent;
|
||||
|
||||
import com.mogo.module.service.MarkerServiceHandler;
|
||||
import com.mogo.utils.UiThreadHandler;
|
||||
|
||||
/**
|
||||
* @author congtaowang
|
||||
* @since 2020-04-17
|
||||
* <p>
|
||||
* 语音指令:定位我的位置等处理
|
||||
*/
|
||||
public class MyLocationHandler implements IntentHandler {
|
||||
|
||||
@Override
|
||||
public void handle( Context context, Intent intent ) {
|
||||
if ( MarkerServiceHandler.getMogoStatusManager().isSearchUIShow() ) {
|
||||
return;
|
||||
}
|
||||
if ( MarkerServiceHandler.getMogoStatusManager().isMainPageOnResume() ) {
|
||||
MarkerServiceHandler.getMapUIController().recoverLockMode();
|
||||
} else {
|
||||
MarkerServiceHandler.getLauncher().backToLauncher( context );
|
||||
UiThreadHandler.postDelayed( () -> {
|
||||
MarkerServiceHandler.getMapUIController().recoverLockMode();
|
||||
}, 2_000L );
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,65 @@
|
||||
package com.mogo.module.service.intent;
|
||||
|
||||
import android.content.Context;
|
||||
import android.content.Intent;
|
||||
import android.text.TextUtils;
|
||||
|
||||
import com.mogo.module.service.MarkerServiceHandler;
|
||||
import com.mogo.module.service.ServiceConst;
|
||||
import com.mogo.utils.AppUtils;
|
||||
import com.mogo.utils.UiThreadHandler;
|
||||
|
||||
import org.json.JSONException;
|
||||
import org.json.JSONObject;
|
||||
|
||||
/**
|
||||
* @author congtaowang
|
||||
* @since 2020-04-17
|
||||
* <p>
|
||||
* 描述
|
||||
*/
|
||||
public class SwitchCardIntentHandler implements IntentHandler {
|
||||
|
||||
@Override
|
||||
public void handle( Context context, Intent intent ) {
|
||||
String data = intent.getStringExtra( "data" );
|
||||
try {
|
||||
JSONObject jsonObject = new JSONObject( data );
|
||||
String card = jsonObject.getString( "card" );
|
||||
if ( TextUtils.equals( "多媒体卡片", card )
|
||||
|| TextUtils.equals( "媒体中心卡片", card )
|
||||
|| TextUtils.equals( "音乐卡片", card ) ) {
|
||||
switchCard2( context, ServiceConst.CARD_TYPE_SHARE_MUSIC );
|
||||
} else if ( TextUtils.equals( "探路卡片", card ) ) {
|
||||
switchCard2( context, ServiceConst.CARD_TYPE_ROAD_CONDITION );
|
||||
} else if ( TextUtils.equals( "在线车辆卡片", card ) ) {
|
||||
switchCard2( context, ServiceConst.CARD_TYPE_USER_DATA );
|
||||
} else if ( TextUtils.equals( "新鲜事卡片", card ) ) {
|
||||
switchCard2( context, ServiceConst.CARD_TYPE_NOVELTY );
|
||||
}
|
||||
} catch ( JSONException e ) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 切换卡片
|
||||
*/
|
||||
public static void switchCard2( Context context, String card ) {
|
||||
if ( AppUtils.isApplicationBroughtToBackground( context ) ) {
|
||||
MarkerServiceHandler.getLauncher().backToLauncher( context );
|
||||
UiThreadHandler.postDelayed( () -> {
|
||||
if ( MarkerServiceHandler.getMogoStatusManager().isADASShow() ) {
|
||||
MarkerServiceHandler.getADASController().closeADAS();
|
||||
}
|
||||
MarkerServiceHandler.getMogoCardManager().switch2( card, true );
|
||||
}, 2000L );
|
||||
} else {
|
||||
MarkerServiceHandler.getFragmentManager().clearAll();
|
||||
if ( MarkerServiceHandler.getMogoStatusManager().isADASShow() ) {
|
||||
MarkerServiceHandler.getADASController().closeADAS();
|
||||
}
|
||||
MarkerServiceHandler.getMogoCardManager().switch2( card, true );
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,179 @@
|
||||
package com.mogo.module.service.strategy;
|
||||
|
||||
import android.os.Handler;
|
||||
import android.os.Message;
|
||||
|
||||
import com.mogo.map.uicontroller.CarCursorOption;
|
||||
import com.mogo.map.uicontroller.IMogoMapUIController;
|
||||
import com.mogo.module.common.utils.CarSeries;
|
||||
import com.mogo.module.service.R;
|
||||
import com.mogo.utils.WorkThreadHandler;
|
||||
|
||||
|
||||
/**
|
||||
* @author congtaowang
|
||||
* @since 2020-04-16
|
||||
* <p>
|
||||
* 上报故障求助之后自车的图标显示策略
|
||||
*/
|
||||
public class CarIconDisplayStrategy {
|
||||
|
||||
public static final int MSG_SEEK_HELPING_ANIM = 2000;
|
||||
|
||||
// F 系列才有这个帧动画
|
||||
public static final int[] sFrame = {
|
||||
R.drawable.module_service_ic_seek_helping_00000,
|
||||
R.drawable.module_service_ic_seek_helping_00001,
|
||||
R.drawable.module_service_ic_seek_helping_00002,
|
||||
R.drawable.module_service_ic_seek_helping_00003,
|
||||
R.drawable.module_service_ic_seek_helping_00004,
|
||||
R.drawable.module_service_ic_seek_helping_00005,
|
||||
R.drawable.module_service_ic_seek_helping_00006,
|
||||
R.drawable.module_service_ic_seek_helping_00007,
|
||||
R.drawable.module_service_ic_seek_helping_00008,
|
||||
R.drawable.module_service_ic_seek_helping_00009,
|
||||
R.drawable.module_service_ic_seek_helping_00010,
|
||||
R.drawable.module_service_ic_seek_helping_00011,
|
||||
R.drawable.module_service_ic_seek_helping_00012,
|
||||
R.drawable.module_service_ic_seek_helping_00013,
|
||||
R.drawable.module_service_ic_seek_helping_00014,
|
||||
R.drawable.module_service_ic_seek_helping_00015,
|
||||
R.drawable.module_service_ic_seek_helping_00016,
|
||||
R.drawable.module_service_ic_seek_helping_00017,
|
||||
R.drawable.module_service_ic_seek_helping_00018,
|
||||
R.drawable.module_service_ic_seek_helping_00019,
|
||||
R.drawable.module_service_ic_seek_helping_00020,
|
||||
R.drawable.module_service_ic_seek_helping_00021,
|
||||
R.drawable.module_service_ic_seek_helping_00022,
|
||||
R.drawable.module_service_ic_seek_helping_00023,
|
||||
R.drawable.module_service_ic_seek_helping_00024,
|
||||
R.drawable.module_service_ic_seek_helping_00025,
|
||||
R.drawable.module_service_ic_seek_helping_00026,
|
||||
R.drawable.module_service_ic_seek_helping_00027,
|
||||
R.drawable.module_service_ic_seek_helping_00028,
|
||||
R.drawable.module_service_ic_seek_helping_00029,
|
||||
R.drawable.module_service_ic_seek_helping_00030,
|
||||
R.drawable.module_service_ic_seek_helping_00031,
|
||||
R.drawable.module_service_ic_seek_helping_00032,
|
||||
R.drawable.module_service_ic_seek_helping_00033,
|
||||
R.drawable.module_service_ic_seek_helping_00034,
|
||||
R.drawable.module_service_ic_seek_helping_00035,
|
||||
R.drawable.module_service_ic_seek_helping_00036,
|
||||
R.drawable.module_service_ic_seek_helping_00037,
|
||||
R.drawable.module_service_ic_seek_helping_00038,
|
||||
R.drawable.module_service_ic_seek_helping_00039,
|
||||
R.drawable.module_service_ic_seek_helping_00040,
|
||||
R.drawable.module_service_ic_seek_helping_00041,
|
||||
R.drawable.module_service_ic_seek_helping_00042,
|
||||
R.drawable.module_service_ic_seek_helping_00043,
|
||||
R.drawable.module_service_ic_seek_helping_00044,
|
||||
R.drawable.module_service_ic_seek_helping_00045,
|
||||
R.drawable.module_service_ic_seek_helping_00046,
|
||||
R.drawable.module_service_ic_seek_helping_00047,
|
||||
R.drawable.module_service_ic_seek_helping_00048,
|
||||
R.drawable.module_service_ic_seek_helping_00049,
|
||||
R.drawable.module_service_ic_seek_helping_00050,
|
||||
R.drawable.module_service_ic_seek_helping_00051,
|
||||
R.drawable.module_service_ic_seek_helping_00052,
|
||||
R.drawable.module_service_ic_seek_helping_00053,
|
||||
R.drawable.module_service_ic_seek_helping_00054,
|
||||
R.drawable.module_service_ic_seek_helping_00055,
|
||||
R.drawable.module_service_ic_seek_helping_00056,
|
||||
R.drawable.module_service_ic_seek_helping_00057,
|
||||
R.drawable.module_service_ic_seek_helping_00058,
|
||||
R.drawable.module_service_ic_seek_helping_00059,
|
||||
R.drawable.module_service_ic_seek_helping_00060,
|
||||
R.drawable.module_service_ic_seek_helping_00061,
|
||||
R.drawable.module_service_ic_seek_helping_00062,
|
||||
R.drawable.module_service_ic_seek_helping_00063,
|
||||
R.drawable.module_service_ic_seek_helping_00064
|
||||
};
|
||||
|
||||
private static volatile CarIconDisplayStrategy sInstance;
|
||||
private IMogoMapUIController mController;
|
||||
|
||||
private CarIconDisplayStrategy() {
|
||||
mOption = new CarCursorOption.Builder().carCursorRes( R.drawable.module_service_ic_seek_helping ).build();
|
||||
}
|
||||
|
||||
public static CarIconDisplayStrategy getInstance() {
|
||||
if ( sInstance == null ) {
|
||||
synchronized ( CarIconDisplayStrategy.class ) {
|
||||
if ( sInstance == null ) {
|
||||
sInstance = new CarIconDisplayStrategy();
|
||||
}
|
||||
}
|
||||
}
|
||||
return sInstance;
|
||||
}
|
||||
|
||||
public synchronized void release() {
|
||||
sInstance = null;
|
||||
}
|
||||
|
||||
private Handler mSeekHelpingHandler;
|
||||
private int mCounter = 0;
|
||||
private boolean mStopStatus = true;
|
||||
private CarCursorOption mOption;
|
||||
|
||||
public void changeCarIconStatus( IMogoMapUIController controller, boolean seekHelpingStatus ) {
|
||||
mController = controller;
|
||||
if ( CarSeries.getSeries() == CarSeries.CAR_SERIES_F80X ) {
|
||||
if ( seekHelpingStatus ) {
|
||||
playSeekHelpingAnim();
|
||||
} else {
|
||||
stopSeekHelpingAnim();
|
||||
}
|
||||
} else {
|
||||
if ( seekHelpingStatus ) {
|
||||
controller.setCarCursorOption( mOption );
|
||||
} else {
|
||||
controller.setCarCursorOption( null );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void playSeekHelpingAnim() {
|
||||
initHandler();
|
||||
mStopStatus = false;
|
||||
Message msg = Message.obtain();
|
||||
msg.what = MSG_SEEK_HELPING_ANIM;
|
||||
msg.arg1 = mCounter++;
|
||||
mSeekHelpingHandler.sendMessageDelayed( msg, 100 );
|
||||
}
|
||||
|
||||
private void initHandler() {
|
||||
if ( mSeekHelpingHandler != null ) {
|
||||
return;
|
||||
}
|
||||
mSeekHelpingHandler = new Handler( WorkThreadHandler.getInstance().getLooper() ) {
|
||||
@Override
|
||||
public void handleMessage( Message msg ) {
|
||||
super.handleMessage( msg );
|
||||
if ( mStopStatus ) {
|
||||
mSeekHelpingHandler.removeMessages( MSG_SEEK_HELPING_ANIM );
|
||||
mCounter = 0;
|
||||
mController.setCarCursorOption( null );
|
||||
return;
|
||||
}
|
||||
switch ( msg.what ) {
|
||||
case MSG_SEEK_HELPING_ANIM:
|
||||
mOption.setCarCursorRes( sFrame[msg.arg1 % sFrame.length] );
|
||||
mController.setCarCursorOption( mOption );
|
||||
playSeekHelpingAnim();
|
||||
break;
|
||||
}
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
private void stopSeekHelpingAnim() {
|
||||
mStopStatus = true;
|
||||
if ( mSeekHelpingHandler == null ) {
|
||||
return;
|
||||
}
|
||||
mCounter = 0;
|
||||
mSeekHelpingHandler.removeMessages( MSG_SEEK_HELPING_ANIM );
|
||||
mController.setCarCursorOption( null );
|
||||
}
|
||||
}
|
||||
|
After Width: | Height: | Size: 24 KiB |
|
After Width: | Height: | Size: 62 KiB |
|
After Width: | Height: | Size: 19 KiB |
|
After Width: | Height: | Size: 19 KiB |
|
After Width: | Height: | Size: 20 KiB |
|
After Width: | Height: | Size: 20 KiB |
|
After Width: | Height: | Size: 21 KiB |
|
After Width: | Height: | Size: 20 KiB |
|
After Width: | Height: | Size: 20 KiB |
|
After Width: | Height: | Size: 20 KiB |
|
After Width: | Height: | Size: 20 KiB |
|
After Width: | Height: | Size: 19 KiB |
|
After Width: | Height: | Size: 19 KiB |
|
After Width: | Height: | Size: 18 KiB |
|
After Width: | Height: | Size: 19 KiB |
|
After Width: | Height: | Size: 19 KiB |
|
After Width: | Height: | Size: 19 KiB |
|
After Width: | Height: | Size: 20 KiB |
|
After Width: | Height: | Size: 20 KiB |
|
After Width: | Height: | Size: 20 KiB |
|
After Width: | Height: | Size: 21 KiB |
|
After Width: | Height: | Size: 21 KiB |
|
After Width: | Height: | Size: 22 KiB |
|
After Width: | Height: | Size: 23 KiB |
|
After Width: | Height: | Size: 23 KiB |
|
After Width: | Height: | Size: 24 KiB |
|
After Width: | Height: | Size: 24 KiB |
|
After Width: | Height: | Size: 24 KiB |
|
After Width: | Height: | Size: 24 KiB |
|
After Width: | Height: | Size: 24 KiB |
|
After Width: | Height: | Size: 24 KiB |
|
After Width: | Height: | Size: 22 KiB |
|
After Width: | Height: | Size: 19 KiB |
|
After Width: | Height: | Size: 19 KiB |