Merge remote-tracking branch 'origin/feature/v1.0.4' into feature/v1.0.4
This commit is contained in:
@@ -49,7 +49,7 @@ ext {
|
||||
// 公司服务 - 语音
|
||||
aiassist : "com.zhidaoauto.common:service:1.0.4.10",
|
||||
// 语音替换方案 暂时只用TTS 解决焦点问题
|
||||
aiassistReplace : "com.zhidao.mogoVoicesdk:voice:1.0.4",
|
||||
aiassistReplace : "com.zhidao.mogoVoicesdk:voice:1.0.5",
|
||||
// 公司服务 - 埋点
|
||||
analytics : "com.elegant.analytics:analytics:1.1.19",
|
||||
|
||||
|
||||
@@ -65,7 +65,6 @@ public abstract class SubscribeImpl< T extends BaseData > implements Observer< T
|
||||
}
|
||||
|
||||
public void onSuccess( T o ) {
|
||||
Logger.e( TAG, GsonUtil.jsonFromObject( o ) );
|
||||
}
|
||||
|
||||
public void onError( String message, int code ) {
|
||||
|
||||
@@ -26,7 +26,7 @@ import java.util.concurrent.ConcurrentHashMap;
|
||||
* <p>
|
||||
* 语音助手通信助手
|
||||
*/
|
||||
public class AIAssist implements VoiceClient.VoiceCmdCallBack , OnTtsListener {
|
||||
public class AIAssist implements VoiceClient.VoiceCmdCallBack, OnTtsListener {
|
||||
|
||||
private static final String TAG = "AIAssist";
|
||||
private static volatile AIAssist sInstance;
|
||||
@@ -87,9 +87,9 @@ public class AIAssist implements VoiceClient.VoiceCmdCallBack , OnTtsListener {
|
||||
/**
|
||||
* 初始化
|
||||
*/
|
||||
private void initSpeech( Context context ){
|
||||
private void initSpeech( Context context ) {
|
||||
mogoVoiceManager = MogoVoiceManagerImpl.getInstance();
|
||||
mogoVoiceManager.init(context, new OnConnStatusListener() {
|
||||
mogoVoiceManager.init( context, new OnConnStatusListener() {
|
||||
@Override
|
||||
public void onSuccess() {
|
||||
mInitReady = true;
|
||||
@@ -99,11 +99,12 @@ public class AIAssist implements VoiceClient.VoiceCmdCallBack , OnTtsListener {
|
||||
public void onFailed() {
|
||||
|
||||
}
|
||||
});
|
||||
} );
|
||||
}
|
||||
|
||||
/**
|
||||
* 是否语音注册成功
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
public boolean hasFlush() {
|
||||
@@ -425,36 +426,59 @@ public class AIAssist implements VoiceClient.VoiceCmdCallBack , OnTtsListener {
|
||||
return false;
|
||||
}
|
||||
|
||||
public void speakTTSAndDuck(String text ){
|
||||
speakTTSAndDuck(text,null);
|
||||
public void speakTTSAndDuck( String text ) {
|
||||
speakTTSAndDuck( text, null );
|
||||
}
|
||||
|
||||
public void speakTTSAndDuck( String text, IMogoVoiceCmdCallBack callBack ){
|
||||
public void speakTTSAndDuck( String text, IMogoVoiceCmdCallBack callBack ) {
|
||||
try {
|
||||
if( mInitReady ){
|
||||
if ( mInitReady ) {
|
||||
mSpeakVoiceMap.put( text, callBack );
|
||||
mogoVoiceManager.toSpeak( text, -3, this);
|
||||
mogoVoiceManager.toSpeak( text, -3, this );
|
||||
}
|
||||
} catch ( Exception e ) {
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onTtsStart(String ext) {
|
||||
public void shutUp( String ttsId, String text ) {
|
||||
try {
|
||||
mSpeakVoiceMap.remove( text );
|
||||
mogoVoiceManager.shutUp( ttsId );
|
||||
} catch( Exception e ){
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onTtsFinish(String speakText) {
|
||||
IMogoVoiceCmdCallBack callBack = mSpeakVoiceMap.remove( speakText );
|
||||
if ( callBack != null ) {
|
||||
callBack.onSpeakEnd( speakText );
|
||||
public void clearTTSCallback(String text){
|
||||
try {
|
||||
mSpeakVoiceMap.remove( text );
|
||||
} catch ( Exception e ) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onTtsError(String ext) {
|
||||
public void onTtsStart( String ttsId, String text ) {
|
||||
IMogoVoiceCmdCallBack callBack = mSpeakVoiceMap.get( text );
|
||||
if ( callBack != null ) {
|
||||
callBack.onTTSStart( ttsId, text );
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onTtsFinish( String ttsId, String text ) {
|
||||
IMogoVoiceCmdCallBack callBack = mSpeakVoiceMap.remove( text );
|
||||
if ( callBack != null ) {
|
||||
callBack.onTTSEnd( ttsId, text );
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onTtsError( String ttsId, String text ) {
|
||||
IMogoVoiceCmdCallBack callBack = mSpeakVoiceMap.remove( text );
|
||||
if ( callBack != null ) {
|
||||
callBack.onTTSError( ttsId, text );
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -1,6 +1,34 @@
|
||||
package com.mogo.commons.voice;
|
||||
|
||||
public interface IMogoVoiceCmdCallBack {
|
||||
|
||||
/**
|
||||
* 新SDK接口
|
||||
*
|
||||
* @param ttsId
|
||||
* @param tts
|
||||
*/
|
||||
default void onTTSStart( String ttsId, String tts ) {
|
||||
}
|
||||
|
||||
/**
|
||||
* 新SDK接口
|
||||
*
|
||||
* @param ttsId
|
||||
* @param tts
|
||||
*/
|
||||
default void onTTSEnd( String ttsId, String tts ) {
|
||||
}
|
||||
|
||||
/**
|
||||
* 新SDK接口
|
||||
*
|
||||
* @param ttsId
|
||||
* @param tts
|
||||
*/
|
||||
default void onTTSError( String ttsId, String tts ) {
|
||||
}
|
||||
|
||||
/**
|
||||
* 免唤醒命令响应回调
|
||||
*
|
||||
|
||||
@@ -54,7 +54,7 @@ MOGO_MODULE_GUIDE_VERSION=1.0.3.8
|
||||
|
||||
## 工程外部模块
|
||||
# 探路
|
||||
MOGO_MODULE_TANLU_VERSION=1.0.4.2
|
||||
MOGO_MODULE_TANLU_VERSION=1.0.4.5
|
||||
# 车聊聊
|
||||
CARCHATTING_VERSION=1.0.3.2-SNAPSHOT
|
||||
# 车聊聊接口
|
||||
|
||||
@@ -16,6 +16,7 @@ import com.amap.api.maps.model.animation.Animation;
|
||||
import com.amap.api.maps.model.animation.ScaleAnimation;
|
||||
import com.amap.api.maps.model.animation.TranslateAnimation;
|
||||
import com.amap.api.maps.utils.overlay.MovingPointOverlay;
|
||||
import com.mogo.commons.AbsMogoApplication;
|
||||
import com.mogo.map.MogoLatLng;
|
||||
import com.mogo.map.impl.amap.AMapWrapper;
|
||||
import com.mogo.map.impl.amap.utils.ObjectUtils;
|
||||
@@ -24,6 +25,7 @@ import com.mogo.map.marker.IMogoMarker;
|
||||
import com.mogo.map.marker.IMogoMarkerClickListener;
|
||||
import com.mogo.map.marker.IMogoMarkerIconViewCreator;
|
||||
import com.mogo.map.marker.MogoMarkerOptions;
|
||||
import com.mogo.map.marker.anim.OnMarkerAnimationListener;
|
||||
import com.mogo.utils.WindowUtils;
|
||||
import com.mogo.utils.logger.Logger;
|
||||
|
||||
@@ -85,6 +87,11 @@ public class AMapMarkerWrapper implements IMogoMarker, Observer {
|
||||
mMarker = null;
|
||||
}
|
||||
if (mMovingPointOverlay != null){
|
||||
try {
|
||||
mMovingPointOverlay.destroy();
|
||||
} catch ( Exception e ) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
mMovingPointOverlay = null;
|
||||
}
|
||||
mMogoInfoWindowAdapter = null;
|
||||
@@ -340,6 +347,86 @@ public class AMapMarkerWrapper implements IMogoMarker, Observer {
|
||||
mMarker.startAnimation();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void startScaleAnimation( float fromX, float toX, float fromY, float toY, int duration, Interpolator interpolator, OnMarkerAnimationListener listener ) {
|
||||
if ( isDestroyed() ) {
|
||||
return;
|
||||
}
|
||||
|
||||
ScaleAnimation animationScale = new ScaleAnimation( fromX, toX, fromY, toY );
|
||||
animationScale.setDuration( duration );
|
||||
animationScale.setFillMode( Animation.FILL_MODE_FORWARDS );
|
||||
animationScale.setInterpolator( interpolator );
|
||||
animationScale.setAnimationListener( new Animation.AnimationListener() {
|
||||
@Override
|
||||
public void onAnimationStart() {
|
||||
if ( isDestroyed() ) {
|
||||
return;
|
||||
}
|
||||
if ( listener != null ) {
|
||||
listener.onAnimStart();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onAnimationEnd() {
|
||||
if ( isDestroyed() ) {
|
||||
return;
|
||||
}
|
||||
if ( listener != null ) {
|
||||
listener.onAnimEnd();
|
||||
}
|
||||
}
|
||||
} );
|
||||
|
||||
mMarker.setAnimation( animationScale );
|
||||
mMarker.startAnimation();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void startJumpAnimation( float high, long duration, Interpolator interpolator, OnMarkerAnimationListener listener ) {
|
||||
if ( isDestroyed() || high <= 0.0f || interpolator == null || duration < 0 ) {
|
||||
return;
|
||||
}
|
||||
try {
|
||||
final LatLng latLng = ObjectUtils.fromMogo2( getPosition() );
|
||||
Point point = AMapWrapper.getAMap().getProjection().toScreenLocation( latLng );
|
||||
point.y -= WindowUtils.dip2px( AbsMogoApplication.getApp(), high );
|
||||
LatLng target = AMapWrapper.getAMap().getProjection().fromScreenLocation( point );
|
||||
//使用TranslateAnimation,填写一个需要移动的目标点
|
||||
Animation animation = new TranslateAnimation( target );
|
||||
animation.setInterpolator( interpolator );
|
||||
animation.setAnimationListener( new Animation.AnimationListener() {
|
||||
@Override
|
||||
public void onAnimationStart() {
|
||||
if ( isDestroyed() ) {
|
||||
return;
|
||||
}
|
||||
if ( listener != null ) {
|
||||
listener.onAnimStart();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onAnimationEnd() {
|
||||
if ( isDestroyed() ) {
|
||||
return;
|
||||
}
|
||||
if ( listener != null ) {
|
||||
listener.onAnimEnd();
|
||||
}
|
||||
}
|
||||
} );
|
||||
//整个移动所需要的时间
|
||||
animation.setDuration( duration );
|
||||
//设置动画
|
||||
mMarker.setAnimation( animation );
|
||||
mMarker.startAnimation();
|
||||
} catch ( Exception e ) {
|
||||
Logger.e( TAG, e, "error." );
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setClickable( boolean clickable ) {
|
||||
if ( mMarker != null ) {
|
||||
@@ -349,6 +436,11 @@ public class AMapMarkerWrapper implements IMogoMarker, Observer {
|
||||
|
||||
@Override
|
||||
public void startSmooth(List<MogoLatLng> points,int duration) {
|
||||
|
||||
if ( isDestroyed() ) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (mMarker != null && points.size() > 0){
|
||||
List<LatLng> p = new ArrayList<>();
|
||||
for (int i = 0; i < points.size(); i++) {
|
||||
|
||||
@@ -66,7 +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);
|
||||
TTSSpeaker.getInstance().speakTTS( s );
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -236,6 +236,7 @@ public class NaviListenerAdapter extends AMapNaviListenerAdapter {
|
||||
}
|
||||
|
||||
public void stopNavi() {
|
||||
TTSSpeaker.getInstance().shutUp();
|
||||
mNaviOverlayHelper.clearCalculatedOverlay();
|
||||
setStopped( true );
|
||||
setNaviing( false );
|
||||
|
||||
@@ -0,0 +1,120 @@
|
||||
package com.mogo.map.impl.amap.navi;
|
||||
|
||||
import android.text.TextUtils;
|
||||
|
||||
import com.mogo.commons.AbsMogoApplication;
|
||||
import com.mogo.commons.voice.AIAssist;
|
||||
import com.mogo.commons.voice.IMogoVoiceCmdCallBack;
|
||||
|
||||
import java.util.LinkedList;
|
||||
|
||||
/**
|
||||
* @author congtaowang
|
||||
* @since 2020-04-21
|
||||
* <p>
|
||||
* 播报导航TTS
|
||||
* <p>
|
||||
* 策略:队列缓存预播报的 tts,然后上一句播完后
|
||||
*/
|
||||
public class TTSSpeaker implements IMogoVoiceCmdCallBack {
|
||||
|
||||
private static volatile TTSSpeaker sInstance;
|
||||
|
||||
private TTSSpeaker() {
|
||||
}
|
||||
|
||||
public static TTSSpeaker getInstance() {
|
||||
if ( sInstance == null ) {
|
||||
synchronized ( TTSSpeaker.class ) {
|
||||
if ( sInstance == null ) {
|
||||
sInstance = new TTSSpeaker();
|
||||
}
|
||||
}
|
||||
}
|
||||
return sInstance;
|
||||
}
|
||||
|
||||
public synchronized void release() {
|
||||
sInstance = null;
|
||||
}
|
||||
|
||||
private LinkedList< String > mWaiting = new LinkedList<>();
|
||||
|
||||
private String mLastTts = null;
|
||||
private String mLastTtsId = null;
|
||||
|
||||
public synchronized void speakTTS( String tts ) {
|
||||
if ( TextUtils.isEmpty( tts ) ) {
|
||||
return;
|
||||
}
|
||||
mWaiting.add( tts );
|
||||
peekAndSpeak();
|
||||
}
|
||||
|
||||
public synchronized void shutUp() {
|
||||
if ( mLastTtsId != null ) {
|
||||
AIAssist.getInstance( AbsMogoApplication.getApp() ).shutUp( mLastTtsId, mLastTts );
|
||||
mWaiting.clear();
|
||||
mLastTtsId = null;
|
||||
mLastTts = null;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onCmdSelected( String cmd ) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onCmdAction( String speakText ) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onCmdCancel( String speakText ) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onSpeakEnd( String speakText ) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onSpeakSelectTimeOut( String speakText ) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onTTSStart( String ttsId, String tts ) {
|
||||
if ( TextUtils.equals( mLastTts, tts ) ) {
|
||||
mLastTtsId = ttsId;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onTTSEnd( String ttsId, String tts ) {
|
||||
mLastTtsId = null;
|
||||
peekAndSpeak();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onTTSError( String ttsId, String tts ) {
|
||||
mLastTtsId = null;
|
||||
peekAndSpeak();
|
||||
}
|
||||
|
||||
private synchronized void peekAndSpeak() {
|
||||
if ( mWaiting.isEmpty() ) {
|
||||
mLastTts = null;
|
||||
mLastTtsId = null;
|
||||
return;
|
||||
}
|
||||
if ( mLastTtsId != null ) {
|
||||
// 上一句还没有播完
|
||||
return;
|
||||
}
|
||||
mLastTts = mWaiting.pop();
|
||||
AIAssist.getInstance( AbsMogoApplication.getApp() ).speakTTSAndDuck( mLastTts, this );
|
||||
}
|
||||
}
|
||||
@@ -20,6 +20,11 @@ android {
|
||||
}
|
||||
}
|
||||
|
||||
compileOptions {
|
||||
sourceCompatibility 1.8
|
||||
targetCompatibility 1.8
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
dependencies {
|
||||
|
||||
@@ -6,6 +6,7 @@ import android.graphics.Point;
|
||||
import android.view.animation.Interpolator;
|
||||
|
||||
import com.mogo.map.MogoLatLng;
|
||||
import com.mogo.map.marker.anim.OnMarkerAnimationListener;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
@@ -247,6 +248,38 @@ public interface IMogoMarker {
|
||||
int duration,
|
||||
Interpolator interpolator );
|
||||
|
||||
/**
|
||||
* 缩放动画
|
||||
*
|
||||
* @param fromX
|
||||
* @param toX
|
||||
* @param fromY
|
||||
* @param toY
|
||||
* @param duration
|
||||
* @param interpolator
|
||||
* @param listener
|
||||
*/
|
||||
void startScaleAnimation( float fromX,
|
||||
float toX,
|
||||
float fromY,
|
||||
float toY,
|
||||
int duration,
|
||||
Interpolator interpolator,
|
||||
OnMarkerAnimationListener listener );
|
||||
|
||||
|
||||
/**
|
||||
* 弹跳动画
|
||||
* @param high
|
||||
* @param duration
|
||||
* @param interpolator
|
||||
* @param listener
|
||||
*/
|
||||
void startJumpAnimation( float high,
|
||||
long duration,
|
||||
Interpolator interpolator,
|
||||
OnMarkerAnimationListener listener);
|
||||
|
||||
/**
|
||||
* 是否是否可点击
|
||||
*
|
||||
@@ -257,8 +290,8 @@ public interface IMogoMarker {
|
||||
/**
|
||||
* 开始平滑移动
|
||||
*
|
||||
* @param points 坐标点
|
||||
* @param duration 时长
|
||||
* @param points 坐标点
|
||||
* @param duration 时长
|
||||
*/
|
||||
void startSmooth(List<MogoLatLng> points, int duration);
|
||||
void startSmooth( List< MogoLatLng > points, int duration );
|
||||
}
|
||||
|
||||
@@ -0,0 +1,16 @@
|
||||
package com.mogo.map.marker.anim;
|
||||
|
||||
/**
|
||||
* @author congtaowang
|
||||
* @since 2020-04-22
|
||||
* <p>
|
||||
* marker 动画监听
|
||||
*/
|
||||
public interface OnMarkerAnimationListener {
|
||||
|
||||
default void onAnimStart() {
|
||||
}
|
||||
|
||||
default void onAnimEnd() {
|
||||
}
|
||||
}
|
||||
@@ -11,6 +11,7 @@ import androidx.annotation.Nullable;
|
||||
|
||||
import com.mogo.map.MogoLatLng;
|
||||
import com.mogo.map.marker.IMogoMarker;
|
||||
import com.mogo.map.marker.anim.OnMarkerAnimationListener;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@@ -141,12 +142,15 @@ public interface IMogoMapUIController {
|
||||
|
||||
/**
|
||||
* marker 跳跃动画
|
||||
* <p>
|
||||
* Deprecated, instead of by {@link IMogoMarker#startJumpAnimation(float, long, Interpolator, OnMarkerAnimationListener)}
|
||||
*
|
||||
* @param marker 跳跃的 marker
|
||||
* @param high 跳跃的高度
|
||||
* @param interpolator 插值器
|
||||
* @param duration 动画时间
|
||||
*/
|
||||
@Deprecated
|
||||
void startJumpAnimation( IMogoMarker marker, float high, Interpolator interpolator,
|
||||
long duration );
|
||||
|
||||
|
||||
@@ -27,9 +27,13 @@ import com.mogo.map.navi.MogoTraffic;
|
||||
import com.mogo.map.uicontroller.EnumMapUI;
|
||||
import com.mogo.module.common.MogoModule;
|
||||
import com.mogo.module.common.MogoModulePaths;
|
||||
import com.mogo.module.common.entity.MarkerNoveltyInfo;
|
||||
import com.mogo.module.common.entity.MarkerShareMusic;
|
||||
import com.mogo.module.common.entity.MarkerShowEntity;
|
||||
import com.mogo.module.extensions.ExtensionsModuleConst;
|
||||
import com.mogo.module.main.MainActivity;
|
||||
import com.mogo.module.main.registercenter.MogoRegisterCenterHandler;
|
||||
import com.mogo.module.service.MarkerServiceHandler;
|
||||
import com.mogo.module.service.receiver.MogoReceiver;
|
||||
import com.mogo.service.IMogoServiceApis;
|
||||
import com.mogo.service.MogoServicePaths;
|
||||
@@ -611,6 +615,7 @@ public class MogoModulesManager implements MogoModulesHandler,
|
||||
IMogoMarkerClickListener listener = MogoRegisterCenterHandler.getInstance().getMarkerListener( marker.getOwner() );
|
||||
if ( listener != null ) {
|
||||
try {
|
||||
trackMarkerClickEvent( marker );
|
||||
return listener.onMarkerClicked( marker );
|
||||
} catch ( Exception e ) {
|
||||
Logger.e( TAG, e, "error." );
|
||||
@@ -619,6 +624,28 @@ public class MogoModulesManager implements MogoModulesHandler,
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* marker 点击埋点
|
||||
*
|
||||
* @param marker
|
||||
*/
|
||||
private void trackMarkerClickEvent( IMogoMarker marker ) {
|
||||
if ( marker == null || TextUtils.isEmpty( marker.getOwner() )) {
|
||||
return;
|
||||
}
|
||||
// 数据统计代码
|
||||
final Map< String, Object > properties = new HashMap<>();
|
||||
properties.put( "poitype", marker.getOwner() );
|
||||
MarkerShowEntity showEntity = ( MarkerShowEntity ) marker.getObject();
|
||||
Object bindObj = showEntity.getBindObj();
|
||||
if ( bindObj instanceof MarkerNoveltyInfo ) {
|
||||
properties.put( "contenttype", ( ( MarkerNoveltyInfo ) bindObj ).getPoiType() );
|
||||
} else if( bindObj instanceof MarkerShareMusic ){
|
||||
properties.put( "contenttype", ( ( MarkerShareMusic ) bindObj ).getShareType()+"" );
|
||||
}
|
||||
MarkerServiceHandler.getMogoAnalytics().track( "Launcher_Icon_Click", properties );
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onUpdateTraffic2( MogoTraffic traffic ) {
|
||||
Iterator< IMogoAimlessModeListener > iterator = MogoRegisterCenterHandler.getInstance().getAimlessModeListeners();
|
||||
|
||||
@@ -135,7 +135,7 @@ public class MapPresenter extends Presenter< MapView > implements
|
||||
int navi_route_prefer = intent.getIntExtra( "NAVI_ROUTE_PREFER", type );
|
||||
|
||||
|
||||
}else if (key_type == 20009) {
|
||||
} else if ( key_type == 20009 ) {
|
||||
onOpenNavi();
|
||||
}
|
||||
|
||||
@@ -173,12 +173,14 @@ public class MapPresenter extends Presenter< MapView > implements
|
||||
if ( mStatusManager.isMainPageOnResume() ) {
|
||||
mStatusManager.setDisplayOverview( TAG, false );
|
||||
mView.getUIController().recoverLockMode();
|
||||
AIAssist.getInstance( getContext() ).speakTTSVoice( "已为您继续导航" );
|
||||
} else {
|
||||
mLauncher.backToLauncher( getContext() );
|
||||
UiThreadHandler.postDelayed( () -> {
|
||||
try {
|
||||
mStatusManager.setDisplayOverview( TAG, false );
|
||||
mView.getUIController().recoverLockMode();
|
||||
AIAssist.getInstance( getContext() ).speakTTSVoice( "已为您继续导航" );
|
||||
} catch ( Exception e ) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
@@ -195,9 +197,20 @@ public class MapPresenter extends Presenter< MapView > implements
|
||||
Logger.d( TAG, "ADAS模式忽略该请求." );
|
||||
return;
|
||||
}
|
||||
mStatusManager.setUserInteractionStatus( TAG, true, false );
|
||||
mStatusManager.setDisplayOverview( TAG, true );
|
||||
mView.getUIController().displayOverview( mDisplayOverviewBounds );
|
||||
if ( !mStatusManager.isMainPageOnResume() ) {
|
||||
mStatusManager.setUserInteractionStatus( TAG, true, false );
|
||||
mStatusManager.setDisplayOverview( TAG, true );
|
||||
mView.getUIController().displayOverview( mDisplayOverviewBounds );
|
||||
AIAssist.getInstance( getContext() ).speakTTSVoice( "展示全程路线" );
|
||||
} else {
|
||||
mLauncher.backToLauncher( getContext() );
|
||||
UiThreadHandler.postDelayed( () -> {
|
||||
mStatusManager.setUserInteractionStatus( TAG, true, false );
|
||||
mStatusManager.setDisplayOverview( TAG, true );
|
||||
mView.getUIController().displayOverview( mDisplayOverviewBounds );
|
||||
AIAssist.getInstance( getContext() ).speakTTSVoice( "展示全程路线" );
|
||||
}, 2_000L );
|
||||
}
|
||||
}
|
||||
|
||||
private void zoomMap( boolean zoomIn ) {
|
||||
@@ -225,11 +238,12 @@ public class MapPresenter extends Presenter< MapView > implements
|
||||
}
|
||||
}
|
||||
|
||||
private void onOpenNavi(){
|
||||
private void onOpenNavi() {
|
||||
mLauncher.backToLauncher( getContext() );
|
||||
if ( !mMogoMapService.getNavi( getContext() ).isNaviing() && !mStatusManager.isSearchUIShow() ) {
|
||||
mMogoAddressManager.goSearch();
|
||||
}
|
||||
AIAssist.getInstance( getContext() ).speakTTSVoice( "已打开" );
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -261,6 +275,10 @@ public class MapPresenter extends Presenter< MapView > implements
|
||||
ResourcesHelper.getDimensionPixelSize( getContext(), R.dimen.module_map_display_overview_right_margin ),
|
||||
ResourcesHelper.getDimensionPixelSize( getContext(), R.dimen.module_map_display_overview_bottom_margin )
|
||||
);
|
||||
|
||||
for ( String cmd : VoiceConstants.sUnUnRegisterCmds ) {
|
||||
mMogoIntentManager.registerIntentListener( cmd, this );
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -342,34 +360,20 @@ public class MapPresenter extends Presenter< MapView > implements
|
||||
case VoiceConstants.CMD_MAP_3D_UN_WAKEUP:
|
||||
case VoiceConstants.CMD_MAP_3D:
|
||||
mView.getUIController().changeMapMode( EnumMapUI.CarUp_3D );
|
||||
|
||||
break;
|
||||
case VoiceConstants.CMD_MAP_DAY_TIME_MODE_UN_WAKEUP:
|
||||
case VoiceConstants.CMD_MAP_DAY_TIME_MODE:
|
||||
mView.getUIController().changeMapMode( EnumMapUI.Type_Light );
|
||||
AIAssist.getInstance( getContext() ).speakTTSVoice( "已切换", null );
|
||||
break;
|
||||
|
||||
//case VoiceConstants.CMD_MAP_GO_COMPANY_UN_WAKEUP:
|
||||
//case VoiceConstants.CMD_MAP_GO_COMPANY:
|
||||
// mSearchManager.goCompany();
|
||||
// break;
|
||||
//
|
||||
//case VoiceConstants.CMD_MAP_GO_HOME_UN_WAKEUP:
|
||||
//case VoiceConstants.CMD_MAP_GO_HOME:
|
||||
// mSearchManager.goHome();
|
||||
// break;
|
||||
|
||||
case VoiceConstants.CMD_MAP_HISTORY_UN_WAKEUP:
|
||||
case VoiceConstants.CMD_MAP_HISTORY:
|
||||
onOpenNavi();
|
||||
break;
|
||||
|
||||
case VoiceConstants.CMD_MAP_STOP_NAVI_MODE_UN_WAKEUP:
|
||||
case VoiceConstants.CMD_MAP_STOP_NAVI_MODE:
|
||||
mSearchManager.showMain();
|
||||
break;
|
||||
|
||||
case VoiceConstants.CMD_MAP_NIGHT_MODE_UN_WAKEUP:
|
||||
case VoiceConstants.CMD_MAP_NIGHT_MODE:
|
||||
mView.getUIController().changeMapMode( EnumMapUI.Type_Night );
|
||||
@@ -391,25 +395,15 @@ public class MapPresenter extends Presenter< MapView > implements
|
||||
mView.getUIController().changeMapMode( EnumMapUI.CarUp_2D );
|
||||
AIAssist.getInstance( getContext() ).speakTTSVoice( "已切换", null );
|
||||
break;
|
||||
|
||||
//case VoiceConstants.CMD_MAP_GEO_NEARBY:
|
||||
// if (intent != null) {
|
||||
// String keywords = intent.getStringExtra("keyword");
|
||||
// mSearchManager.showCategory(keywords);
|
||||
// }
|
||||
|
||||
case VoiceConstants.CMD_MAP_SPEAK_DRAFT_MODE:
|
||||
case VoiceConstants.CMD_MAP_SPEAK_DRAFT_MODE_UN_WAKEUP:
|
||||
mSearchManager.speakDraft();
|
||||
AIAssist.getInstance( getContext() ).speakTTSVoice( "已切换", null );
|
||||
|
||||
break;
|
||||
|
||||
case VoiceConstants.CMD_MAP_SPEAK_DETAIL_MODE:
|
||||
case VoiceConstants.CMD_MAP_SPEAK_DETAIL_MODE_UN_WAKEUP:
|
||||
mSearchManager.speakDetail();
|
||||
AIAssist.getInstance( getContext() ).speakTTSVoice( "已切换", null );
|
||||
|
||||
break;
|
||||
case VoiceConstants.CMD_MAP_SPEAK_REMAIN:
|
||||
break;
|
||||
|
||||
@@ -121,7 +121,7 @@ public class VoiceConstants {
|
||||
*/
|
||||
public static final String CMD_MAP_GEO_NEARBY = "com.ileja.navi.geo.nearby";
|
||||
public static final String CMD_MAP_GEO_NEARBY_WAKEUP = "CMD_MAP_GEO_NEARBY_WAKEUP";
|
||||
public static final String[] CMD_MAP_GEO_NEARBY_TRIGGER_WORDS = {"查找附近的","查找附近的"};
|
||||
public static final String[] CMD_MAP_GEO_NEARBY_TRIGGER_WORDS = {"查找附近的", "查找附近的"};
|
||||
|
||||
/**
|
||||
* 车头朝上
|
||||
@@ -136,12 +136,12 @@ public class VoiceConstants {
|
||||
public static final String CMD_MAP_NORTH_UP_MODE = "com.ileja.traffic.north.up";
|
||||
public static final String CMD_MAP_NORTH_UP_MODE_UN_WAKEUP = "CMD_MAP_NORTH_UP_MODE_UN_WAKEUP";
|
||||
public static final String[] CMD_MAP_NORTH_UP_MODE_TRIGGER_WORDS = {"北朝上"};
|
||||
/**
|
||||
/**
|
||||
* 简洁模式
|
||||
*/
|
||||
public static final String CMD_MAP_SPEAK_DRAFT_MODE = "com.ileja.traffic.speak.draft";
|
||||
public static final String CMD_MAP_SPEAK_DRAFT_MODE_UN_WAKEUP = "CMD_MAP_SPEAK_DRAFT_MODE_UN_WAKEUP";
|
||||
public static final String[] CMD_MAP_SPEAK_DRAFT_MODE_TRIGGER_WORDS = {"简洁模式","简洁播报"};
|
||||
public static final String[] CMD_MAP_SPEAK_DRAFT_MODE_TRIGGER_WORDS = {"简洁模式", "简洁播报"};
|
||||
|
||||
|
||||
/**
|
||||
@@ -149,40 +149,18 @@ public class VoiceConstants {
|
||||
*/
|
||||
public static final String CMD_MAP_SPEAK_DETAIL_MODE = "com.ileja.traffic.speak.detail";
|
||||
public static final String CMD_MAP_SPEAK_DETAIL_MODE_UN_WAKEUP = "CMD_MAP_SPEAK_DETAIL_MODE_UN_WAKEUP";
|
||||
public static final String[] CMD_MAP_SPEAK_DETAIL_MODE_TRIGGER_WORDS = {"详细模式","详细播报"};
|
||||
public static final String[] CMD_MAP_SPEAK_DETAIL_MODE_TRIGGER_WORDS = {"详细模式", "详细播报"};
|
||||
|
||||
/**
|
||||
* 播报当前导航剩余里程和时间
|
||||
*/
|
||||
public static final String CMD_MAP_SPEAK_REMAIN = "com.ileja.traffic.speak.remain";
|
||||
public static final String CMD_MAP_SPEAK_REMAIN_UN_WAKEUP = "CMD_MAP_SPEAK_REMAIN_UN_WAKEUP";
|
||||
public static final String[] CMD_MAP_SPEAK_REMAIN_TRIGGER_WORDS = {"还有多久","多久到","还有多远"};
|
||||
|
||||
|
||||
//mWakeupWordsList.add(new WakeupWord().setAction(NavConstants.WakeUpCommandApi.COMMAND_MAP_NAVI_OVERVIEW_BACK_NAVI).setWord("继续导航").setPinyin("ji xu dao hang").setThreshold("0.21").addGreeting(""));
|
||||
// mWakeupWordsList.add(new WakeupWord().setAction(NavConstants.WakeUpCommandApi.COMMAND_MAP_CLOSEMAP).setWord("关闭导航").setPinyin("guan bi dao hang").setThreshold("0.19").addGreeting(""));
|
||||
// mWakeupWordsList.add(new WakeupWord().setAction(NavConstants.WakeUpCommandApi.COMMAND_MAP_CLOSEMAP).setWord("关闭地图").setPinyin("guan bi di tu").setThreshold("0.215").addGreeting(""));
|
||||
// mWakeupWordsList.add(new WakeupWord().setAction(NavConstants.WakeUpCommandApi.COMMAND_MAP_CLOSEMAP).setWord("退出导航").setPinyin("tui chu dao hang").setThreshold("0.2").addGreeting(""));
|
||||
// mWakeupWordsList.add(new WakeupWord().setAction(NavConstants.WakeUpCommandApi.COMMAND_MAP_CLOSEMAP).setWord("退出地图").setPinyin("tui chu di tu").setThreshold("0.16").addGreeting(""));
|
||||
//
|
||||
// mWakeupWordsList.add(new WakeupWord().setAction(NavConstants.WakeUpCommandApi.COMMAND_MAP_NAVI_OPEN_2D_CAR).setWord("车头朝上").setPinyin("che tou chao shang").setThreshold("0.1").addGreeting("车头朝上"));
|
||||
// mWakeupWordsList.add(new WakeupWord().setAction(NavConstants.WakeUpCommandApi.COMMAND_MAP_NAVI_OPEN_2D_NORTH).setWord("北朝上").setPinyin("bei chao shang").setThreshold("0.14").addGreeting(""));
|
||||
// mWakeupWordsList.add(new WakeupWord().setAction(NavConstants.WakeUpCommandApi.COMMAND_MAP_NAVI_OPEN_3D).setWord("三地模式").setPinyin("san di mo shi").setThreshold("0.13").addGreeting(""));
|
||||
// mWakeupWordsList.add(new WakeupWord().setAction(NavConstants.WakeUpCommandApi.COMMAND_MAP_NAVI_OPEN_2D_NORTH).setWord("二地模式").setPinyin("er di mo shi").setThreshold("0.185").addGreeting(""));
|
||||
// mWakeupWordsList.add(new WakeupWord().setAction(NavConstants.WakeUpCommandApi.COMMAND_MAP_FLEX_UP).setWord("放大地图").setPinyin("fang da di tu").setThreshold("0.17").addGreeting("已放大"));
|
||||
// mWakeupWordsList.add(new WakeupWord().setAction(NavConstants.WakeUpCommandApi.COMMAND_MAP_FLEX_DOWN).setWord("缩小地图").setPinyin("suo xiao di tu").setThreshold("0.125").addGreeting("已缩小"));
|
||||
// mWakeupWordsList.add(new WakeupWord().setAction(NavConstants.WakeUpCommandApi.COMMAND_MAP_MODE_DAY).setWord("白天模式").setPinyin("bai tian mo shi").setThreshold("0.105").addGreeting("切换到白天模式"));
|
||||
// mWakeupWordsList.add(new WakeupWord().setAction(NavConstants.WakeUpCommandApi.COMMAND_MAP_MODE_NIGHT).setWord("夜间模式").setPinyin("ye jian mo shi").setThreshold("0.11").addGreeting("切换到夜间模式"));
|
||||
// mWakeupWordsList.add(new WakeupWord().setAction(NavConstants.WakeUpCommandApi.COMMAND_MAP_MODE_AUTO).setWord("自动模式").setPinyin("zi dong mo shi").setThreshold("0.11").addGreeting("切换到自动模式"));
|
||||
// mWakeupWordsList.add(new WakeupWord().setAction(NavConstants.WakeUpCommandApi.COMMAND_MAP_NAVI_OPEN_LIVE).setWord("打开路况").setPinyin("da kai lu kuang").setThreshold("0.125").addGreeting("路况已打开"));
|
||||
// mWakeupWordsList.add(new WakeupWord().setAction(NavConstants.WakeUpCommandApi.COMMAND_MAP_NAVI_CLOSE_LIVE).setWord("关闭路况").setPinyin("guan bi lu kuang").setThreshold("0.1").addGreeting("路况已关闭"));
|
||||
|
||||
|
||||
|
||||
|
||||
public static final String[] CMD_MAP_SPEAK_REMAIN_TRIGGER_WORDS = {"还有多久", "多久到", "还有多远"};
|
||||
|
||||
public static final Map< String, String[] > sVoiceCmds = new HashMap<>();
|
||||
public static final List< String > sCmds = new ArrayList<>();
|
||||
public static final List< String > sUnUnRegisterCmds = new ArrayList<>();
|
||||
|
||||
static {
|
||||
// 免唤醒
|
||||
@@ -217,16 +195,16 @@ public class VoiceConstants {
|
||||
sCmds.add( VoiceConstants.CMD_MAP_TRAFFIC_MODE );
|
||||
sCmds.add( VoiceConstants.CMD_MAP_UN_TRAFFIC_MODE );
|
||||
sCmds.add( VoiceConstants.CMD_MAP_AUTO_LIGHT_NIGHT_MODE );
|
||||
sCmds.add( VoiceConstants.CMD_MAP_DISPLAY_OVERVIEW_MODE );
|
||||
sCmds.add( VoiceConstants.CMD_MAP_CONTINUE_NAVI_MODE );
|
||||
sCmds.add( VoiceConstants.CMD_MAP_CAR_UP_MODE );
|
||||
sCmds.add( VoiceConstants.CMD_MAP_NORTH_UP_MODE );
|
||||
//sCmds.add( VoiceConstants.CMD_MAP_GO_HOME );
|
||||
//sCmds.add( VoiceConstants.CMD_MAP_GO_COMPANY );
|
||||
sCmds.add( VoiceConstants.CMD_MAP_HISTORY );
|
||||
sCmds.add( VoiceConstants.CMD_MAP_STOP_NAVI_MODE );
|
||||
sCmds.add( VoiceConstants.CMD_MAP_SPEAK_DRAFT_MODE );
|
||||
sCmds.add( VoiceConstants.CMD_MAP_SPEAK_DETAIL_MODE );
|
||||
sCmds.add( VoiceConstants.CMD_MAP_SPEAK_REMAIN );
|
||||
|
||||
// 退到后台不注销的命令
|
||||
sUnUnRegisterCmds.add( VoiceConstants.CMD_MAP_CONTINUE_NAVI_MODE );
|
||||
sUnUnRegisterCmds.add( VoiceConstants.CMD_MAP_DISPLAY_OVERVIEW_MODE );
|
||||
sUnUnRegisterCmds.add( VoiceConstants.CMD_MAP_HISTORY );
|
||||
}
|
||||
}
|
||||
|
||||
@@ -71,7 +71,9 @@ public class CategoryPresenter extends Presenter<CategoryView> {
|
||||
|
||||
inputtipsSearch.setPoiSearchListener(new IMogoPoiSearchListener() {
|
||||
@Override public void onPoiSearched(MogoPoiResult result, int errorCode) {
|
||||
mView.renderSearchPoiResult(result.getPois());
|
||||
if ( result != null ) {
|
||||
mView.renderSearchPoiResult(result.getPois());
|
||||
}
|
||||
}
|
||||
|
||||
@Override public void onPoiItemSearched(MogoPoiItem item, int errorCode) {
|
||||
|
||||
@@ -4,6 +4,7 @@ import android.graphics.BitmapFactory
|
||||
import android.os.Bundle
|
||||
import android.text.TextUtils
|
||||
import android.view.View
|
||||
import android.view.animation.BounceInterpolator
|
||||
import android.widget.Toast
|
||||
import androidx.fragment.app.Fragment
|
||||
import com.alibaba.android.arouter.facade.annotation.Route
|
||||
@@ -11,6 +12,7 @@ import com.mogo.map.MogoLatLng
|
||||
import com.mogo.map.listener.IMogoMapListener
|
||||
import com.mogo.map.marker.IMogoMarker
|
||||
import com.mogo.map.marker.MogoMarkerOptions
|
||||
import com.mogo.map.marker.anim.OnMarkerAnimationListener
|
||||
import com.mogo.map.search.geo.IMogoGeoSearchListener
|
||||
import com.mogo.map.search.geo.MogoGeocodeResult
|
||||
import com.mogo.map.search.geo.MogoRegeocodeResult
|
||||
@@ -43,161 +45,152 @@ import kotlinx.android.synthetic.main.fragment_setting_address.tv_set_as_home
|
||||
* 2020-01-07.
|
||||
*/
|
||||
class SettingAddressFragment : BaseFragment(), IMogoGeoSearchListener {
|
||||
override fun onRegeocodeSearched(regeocodeResult: MogoRegeocodeResult?) {
|
||||
et_navi_search.setText(regeocodeResult?.regeocodeAddress?.formatAddress)
|
||||
var formatAddress = regeocodeResult?.regeocodeAddress?.formatAddress
|
||||
selectPoi?.address = formatAddress
|
||||
override fun onRegeocodeSearched(regeocodeResult: MogoRegeocodeResult?) {
|
||||
et_navi_search.setText(regeocodeResult?.regeocodeAddress?.formatAddress)
|
||||
var formatAddress = regeocodeResult?.regeocodeAddress?.formatAddress
|
||||
selectPoi?.address = formatAddress
|
||||
|
||||
var neighborhood = regeocodeResult?.regeocodeAddress?.neighborhood
|
||||
if (!TextUtils.isEmpty(neighborhood)) {
|
||||
selectPoi?.name = neighborhood
|
||||
} else {
|
||||
selectPoi?.name = formatAddress
|
||||
}
|
||||
}
|
||||
|
||||
override fun onGeocodeSearched(geocodeResult: MogoGeocodeResult?) {
|
||||
|
||||
}
|
||||
|
||||
private val TAG: String = "SettingAddressFragment"
|
||||
private var style: Int = DataConstants.TYPE_HOME_ADDRESS
|
||||
var addMarker: IMogoMarker? = null
|
||||
|
||||
private var selectPoi: SearchPoi? = null
|
||||
private var mapListener: IMogoMapListener = object : MogoMapListenerAdapter() {
|
||||
override fun onMapChanged(
|
||||
latLng: MogoLatLng?,
|
||||
zoom: Float,
|
||||
tilt: Float,
|
||||
bearing: Float
|
||||
) {
|
||||
super.onMapChanged(latLng, zoom, tilt, bearing)
|
||||
selectPoi = EntityConvertUtils.geoToPoi(latLng?.lat ?: 0.0, latLng?.lng ?: 0.0, style)
|
||||
|
||||
var mogoRegeocodeQuery = MogoRegeocodeQuery()
|
||||
mogoRegeocodeQuery.point = latLng
|
||||
SearchServiceHolder.getGeoSearcher()
|
||||
.getFromLocationAsyn(mogoRegeocodeQuery)
|
||||
addMarker?.apply {
|
||||
SearchServiceHolder.getMapUIController()
|
||||
.startJumpAnimation(
|
||||
this,
|
||||
150f, { input ->
|
||||
if (input <= 0.5) {
|
||||
(0.5f - 2.0 * (0.5 - input) * (0.5 - input)).toFloat()
|
||||
} else {
|
||||
(0.5f - Math.sqrt(((input - 0.5f) * (1.5f - input)).toDouble())).toFloat()
|
||||
}
|
||||
}, 600
|
||||
)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
override fun onCreate(savedInstanceState: Bundle?) {
|
||||
super.onCreate(savedInstanceState)
|
||||
style = arguments?.getInt(AMapConstants.KEY_SET_HOME_COMPONY) ?: DataConstants.TYPE_HOME_ADDRESS
|
||||
SearchServiceHolder.listenerCenter.registerMogoMapListener(
|
||||
AMapConstants.PATH_FRAGMENT_SETTING_HOME, mapListener
|
||||
)
|
||||
SearchServiceHolder.getMapUIController().showMyLocation(false)
|
||||
|
||||
SearchServiceHolder.getGeoSearcher().setGeoSearchListener(this)
|
||||
|
||||
SearchServiceHolder.getMarkerManger().removeMarkers()
|
||||
}
|
||||
|
||||
override fun getLayoutId(): Int {
|
||||
return R.layout.fragment_setting_address
|
||||
}
|
||||
|
||||
fun isHome(): Boolean {
|
||||
return style == DataConstants.TYPE_HOME_ADDRESS
|
||||
}
|
||||
|
||||
fun isCompony(): Boolean {
|
||||
return style == DataConstants.TYPE_COMPANY_ADDRESS
|
||||
}
|
||||
|
||||
override fun onViewCreated(
|
||||
view: View,
|
||||
savedInstanceState: Bundle?
|
||||
) {
|
||||
super.onViewCreated(view, savedInstanceState)
|
||||
|
||||
|
||||
if (isHome()) {
|
||||
tv_set_as_home.text = resources.getString(R.string.set_as_home_navi)
|
||||
} else {
|
||||
tv_set_as_home.text = resources.getString(R.string.set_as_compony_navi)
|
||||
var neighborhood = regeocodeResult?.regeocodeAddress?.neighborhood
|
||||
if (!TextUtils.isEmpty(neighborhood)) {
|
||||
selectPoi?.name = neighborhood
|
||||
} else {
|
||||
selectPoi?.name = formatAddress
|
||||
}
|
||||
}
|
||||
|
||||
iv_navi_back.setOnClickListener {
|
||||
SearchServiceHolder.fragmentManager.pop()
|
||||
}
|
||||
tv_set_as_home.setOnClickListener {
|
||||
if (selectPoi == null) {
|
||||
Toast.makeText(context, "请选择", Toast.LENGTH_SHORT)
|
||||
.show()
|
||||
return@setOnClickListener
|
||||
}
|
||||
insert(selectPoi!!)
|
||||
SearchServiceHolder.fragmentManager.pop()
|
||||
override fun onGeocodeSearched(geocodeResult: MogoGeocodeResult?) {
|
||||
|
||||
}
|
||||
|
||||
et_navi_search.isEnabled = false
|
||||
et_navi_search.setText(getString(string.drag_map_to_choose))
|
||||
var location = SearchServiceHolder.getMapUIController().windowCenterLocation
|
||||
private val TAG: String = "SettingAddressFragment"
|
||||
private var style: Int = DataConstants.TYPE_HOME_ADDRESS
|
||||
var addMarker: IMogoMarker? = null
|
||||
|
||||
UiThreadHandler.postDelayed({
|
||||
if (!isAdded) {
|
||||
return@postDelayed
|
||||
}
|
||||
var decodeResource = BitmapFactory.decodeResource(resources, R.mipmap.icon_choose_position2)
|
||||
val options = MogoMarkerOptions()
|
||||
.icon(decodeResource)
|
||||
.latitude(location?.lat ?: 0.0)
|
||||
.owner(TAG)
|
||||
.anchor(0.5f, 1f)
|
||||
.longitude(location?.lng ?: 0.0)
|
||||
addMarker = SearchServiceHolder.getMarkerManger()
|
||||
.addMarker(AMapConstants.PATH_FRAGMENT_SETTING_HOME, options)
|
||||
private var selectPoi: SearchPoi? = null
|
||||
private var mapListener: IMogoMapListener = object : MogoMapListenerAdapter() {
|
||||
override fun onMapChanged(
|
||||
latLng: MogoLatLng?,
|
||||
zoom: Float,
|
||||
tilt: Float,
|
||||
bearing: Float) {
|
||||
super.onMapChanged(latLng, zoom, tilt, bearing)
|
||||
selectPoi = EntityConvertUtils.geoToPoi(latLng?.lat ?: 0.0, latLng?.lng ?: 0.0, style)
|
||||
var mogoRegeocodeQuery = MogoRegeocodeQuery()
|
||||
mogoRegeocodeQuery.point = latLng
|
||||
SearchServiceHolder.getGeoSearcher().getFromLocationAsyn(mogoRegeocodeQuery)
|
||||
addMarker?.startJumpAnimation(
|
||||
150f,
|
||||
600,
|
||||
{ input ->
|
||||
if (input <= 0.5) {
|
||||
(0.5f - 2.0 * (0.5 - input) * (0.5 - input)).toFloat()
|
||||
} else {
|
||||
(0.5f - Math.sqrt(((input - 0.5f) * (1.5f - input)).toDouble())).toFloat()
|
||||
}
|
||||
}, null)
|
||||
|
||||
var locationPointInScreen = SearchServiceHolder.getMapUIController().getLocationPointInScreen(location)
|
||||
addMarker?.setPositionByPixels(locationPointInScreen)
|
||||
}, 500L)
|
||||
}
|
||||
|
||||
fun insert(searchPoi: SearchPoi) {
|
||||
|
||||
AddressManager.insert(searchPoi)
|
||||
Observable.create(
|
||||
ObservableOnSubscribe<String> {
|
||||
AppDataBase.getDatabase(activity)
|
||||
.poiDao()
|
||||
.insert(searchPoi)
|
||||
AddressHelper.notifyAddressChanged(searchPoi.type)
|
||||
})
|
||||
.subscribeOn(Schedulers.io())
|
||||
.subscribe()
|
||||
}
|
||||
|
||||
override fun onDestroyView() {
|
||||
super.onDestroyView()
|
||||
SearchServiceHolder.listenerCenter.unregisterMogoMapListener(
|
||||
AMapConstants.PATH_FRAGMENT_SETTING_HOME
|
||||
)
|
||||
addMarker?.destroy()
|
||||
}
|
||||
|
||||
companion object {
|
||||
fun newInstance(type: Int = DataConstants.TYPE_HOME_ADDRESS): Fragment {
|
||||
var settingAddressFragment = SettingAddressFragment()
|
||||
val bundle = Bundle()
|
||||
bundle.putInt(AMapConstants.KEY_SET_HOME_COMPONY, type)
|
||||
settingAddressFragment.setArguments(bundle)
|
||||
return settingAddressFragment
|
||||
}
|
||||
}
|
||||
|
||||
override fun onCreate(savedInstanceState: Bundle?) {
|
||||
super.onCreate(savedInstanceState)
|
||||
style = arguments?.getInt(AMapConstants.KEY_SET_HOME_COMPONY)
|
||||
?: DataConstants.TYPE_HOME_ADDRESS
|
||||
SearchServiceHolder.listenerCenter.registerMogoMapListener(AMapConstants.PATH_FRAGMENT_SETTING_HOME, mapListener)
|
||||
SearchServiceHolder.getMapUIController().showMyLocation(false)
|
||||
SearchServiceHolder.getGeoSearcher().setGeoSearchListener(this)
|
||||
SearchServiceHolder.getMarkerManger().removeMarkers()
|
||||
}
|
||||
|
||||
override fun getLayoutId(): Int {
|
||||
return R.layout.fragment_setting_address
|
||||
}
|
||||
|
||||
fun isHome(): Boolean {
|
||||
return style == DataConstants.TYPE_HOME_ADDRESS
|
||||
}
|
||||
|
||||
fun isCompony(): Boolean {
|
||||
return style == DataConstants.TYPE_COMPANY_ADDRESS
|
||||
}
|
||||
|
||||
override fun onViewCreated(
|
||||
view: View,
|
||||
savedInstanceState: Bundle?) {
|
||||
super.onViewCreated(view, savedInstanceState)
|
||||
|
||||
|
||||
if (isHome()) {
|
||||
tv_set_as_home.text = resources.getString(R.string.set_as_home_navi)
|
||||
} else {
|
||||
tv_set_as_home.text = resources.getString(R.string.set_as_compony_navi)
|
||||
}
|
||||
|
||||
iv_navi_back.setOnClickListener {
|
||||
SearchServiceHolder.fragmentManager.pop()
|
||||
}
|
||||
tv_set_as_home.setOnClickListener {
|
||||
if (selectPoi == null) {
|
||||
Toast.makeText(context, "请选择", Toast.LENGTH_SHORT)
|
||||
.show()
|
||||
return@setOnClickListener
|
||||
}
|
||||
insert(selectPoi!!)
|
||||
SearchServiceHolder.fragmentManager.pop()
|
||||
}
|
||||
|
||||
et_navi_search.isEnabled = false
|
||||
et_navi_search.setText(getString(string.drag_map_to_choose))
|
||||
var location = SearchServiceHolder.getMapUIController().windowCenterLocation
|
||||
|
||||
UiThreadHandler.postDelayed({
|
||||
if (!isAdded) {
|
||||
return@postDelayed
|
||||
}
|
||||
var decodeResource = BitmapFactory.decodeResource(resources, R.mipmap.icon_choose_position2)
|
||||
val options = MogoMarkerOptions()
|
||||
.icon(decodeResource)
|
||||
.latitude(location?.lat ?: 0.0)
|
||||
.owner(TAG)
|
||||
.anchor(0.5f, 1f)
|
||||
.longitude(location?.lng ?: 0.0)
|
||||
addMarker = SearchServiceHolder.getMarkerManger()
|
||||
.addMarker(AMapConstants.PATH_FRAGMENT_SETTING_HOME, options)
|
||||
|
||||
var locationPointInScreen = SearchServiceHolder.getMapUIController().getLocationPointInScreen(location)
|
||||
addMarker?.setPositionByPixels(locationPointInScreen)
|
||||
}, 500L)
|
||||
}
|
||||
|
||||
fun insert(searchPoi: SearchPoi) {
|
||||
|
||||
AddressManager.insert(searchPoi)
|
||||
Observable.create(
|
||||
ObservableOnSubscribe<String> {
|
||||
AppDataBase.getDatabase(activity)
|
||||
.poiDao()
|
||||
.insert(searchPoi)
|
||||
AddressHelper.notifyAddressChanged(searchPoi.type)
|
||||
})
|
||||
.subscribeOn(Schedulers.io())
|
||||
.subscribe()
|
||||
}
|
||||
|
||||
override fun onDestroyView() {
|
||||
super.onDestroyView()
|
||||
SearchServiceHolder.listenerCenter.unregisterMogoMapListener(
|
||||
AMapConstants.PATH_FRAGMENT_SETTING_HOME
|
||||
)
|
||||
addMarker?.destroy()
|
||||
}
|
||||
|
||||
companion object {
|
||||
fun newInstance(type: Int = DataConstants.TYPE_HOME_ADDRESS): Fragment {
|
||||
var settingAddressFragment = SettingAddressFragment()
|
||||
val bundle = Bundle()
|
||||
bundle.putInt(AMapConstants.KEY_SET_HOME_COMPONY, type)
|
||||
settingAddressFragment.setArguments(bundle)
|
||||
return settingAddressFragment
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -787,13 +787,9 @@ public class MogoServices implements IMogoMapListener,
|
||||
mStatusManager.setVoiceUIShow( TAG, true );
|
||||
}
|
||||
} else if ( ServiceConst.COMMAND_NEXT.equals( command ) ) {
|
||||
if ( mStatusManager.isMainPageOnResume() ) {
|
||||
mActionManager.invoke( MapMarkerManager.getInstance().getCurrentModuleName(), MogoAction.Next );
|
||||
}
|
||||
onActionDown( MogoAction.Next );
|
||||
} else if ( ServiceConst.COMMAND_PREVIOUS.equals( command ) ) {
|
||||
if ( mStatusManager.isMainPageOnResume() ) {
|
||||
mActionManager.invoke( MapMarkerManager.getInstance().getCurrentModuleName(), MogoAction.Prev );
|
||||
}
|
||||
onActionDown( MogoAction.Prev );
|
||||
} else if ( ServiceConst.COMMAND_SWITCH_CARD.equals( command ) ) {
|
||||
IntentHandlerFactory.getInstance().handle( mContext, command, intent );
|
||||
} else if ( MogoReceiver.ACTION_ADAS_STATUS.equals( command ) ) {
|
||||
@@ -884,9 +880,9 @@ public class MogoServices implements IMogoMapListener,
|
||||
@Override
|
||||
public void onCmdSelected( String cmd ) {
|
||||
if ( TextUtils.equals( ServiceConst.CMD_UN_WAKE_PREV, cmd ) ) {
|
||||
mActionManager.invoke( MapMarkerManager.getInstance().getCurrentModuleName(), MogoAction.Prev );
|
||||
onActionDown( MogoAction.Prev );
|
||||
} else if ( TextUtils.equals( ServiceConst.CMD_UN_WAKE_NEXT, cmd ) ) {
|
||||
mActionManager.invoke( MapMarkerManager.getInstance().getCurrentModuleName(), MogoAction.Next );
|
||||
onActionDown( MogoAction.Next );
|
||||
} else if ( TextUtils.equals( ServiceConst.CMD_UN_WAKEUP_MY_LOCATION, cmd ) ) {
|
||||
if ( mStatusManager.isMainPageOnResume() ) {
|
||||
mUiController.recoverLockMode();
|
||||
@@ -896,6 +892,19 @@ public class MogoServices implements IMogoMapListener,
|
||||
}
|
||||
}
|
||||
|
||||
private void onActionDown(MogoAction action){
|
||||
if ( !mStatusManager.isMainPageOnResume() ) {
|
||||
return;
|
||||
}
|
||||
if ( mStatusManager.isADASShow() ) {
|
||||
// 分发到V2X
|
||||
mActionManager.invoke( "V2X_UI", action );
|
||||
} else {
|
||||
String biz = MapMarkerManager.getInstance().getCurrentModuleName();
|
||||
mActionManager.invoke( biz, action );
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onCmdAction( String speakText ) {
|
||||
|
||||
|
||||
@@ -12,6 +12,7 @@ import com.mogo.map.marker.IMogoMarkerClickListener;
|
||||
import com.mogo.map.marker.IMogoMarkerManager;
|
||||
import com.mogo.map.marker.MogoMarkerOptions;
|
||||
import com.mogo.map.marker.MogoMarkersHandler;
|
||||
import com.mogo.module.common.ModuleNames;
|
||||
import com.mogo.module.common.entity.MarkerCarPois;
|
||||
import com.mogo.module.common.entity.MarkerCardResult;
|
||||
import com.mogo.module.common.entity.MarkerExploreWay;
|
||||
@@ -143,49 +144,6 @@ public class MapMarkerManager implements IMogoMarkerClickListener,
|
||||
if (!result) {
|
||||
return false;
|
||||
}
|
||||
|
||||
// 数据统计代码
|
||||
final Map<String, Object> properties = new HashMap<>();
|
||||
switch (mLastCheckMarker.getOwner()) {
|
||||
case ServiceConst.CARD_TYPE_CARS_CHATTING:
|
||||
properties.put("type", 3);
|
||||
break;
|
||||
case ServiceConst.CARD_TYPE_USER_DATA:
|
||||
properties.put("type", 5);
|
||||
break;
|
||||
case ServiceConst.CARD_TYPE_ROAD_CONDITION:
|
||||
properties.put("type", 2);
|
||||
break;
|
||||
case ServiceConst.CARD_TYPE_NOVELTY:
|
||||
MarkerShowEntity showEntity = (MarkerShowEntity) mLastCheckMarker.getObject();
|
||||
Object bindObj = showEntity.getBindObj();
|
||||
if (bindObj instanceof MarkerNoveltyInfo) {
|
||||
switch (((MarkerNoveltyInfo) bindObj).getPoiType()) {
|
||||
case MarkerPoiTypeEnum.GAS_STATION:
|
||||
properties.put("type", 4);
|
||||
break;
|
||||
case MarkerPoiTypeEnum.TRAFFIC_CHECK:
|
||||
properties.put("type", 8);
|
||||
break;
|
||||
case MarkerPoiTypeEnum.ROAD_CLOSED:
|
||||
properties.put("type", 7);
|
||||
break;
|
||||
case MarkerPoiTypeEnum.SHOP_DISCOUNT:
|
||||
properties.put("type", 9);
|
||||
break;
|
||||
case MarkerPoiTypeEnum.FOURS_4S:
|
||||
properties.put("type", 10);
|
||||
break;
|
||||
}
|
||||
}
|
||||
break;
|
||||
case ServiceConst.CARD_TYPE_SHARE_MUSIC:
|
||||
properties.put("type", 6);
|
||||
break;
|
||||
}
|
||||
|
||||
MarkerServiceHandler.getMogoAnalytics().track("Launcher_Icon_Click", properties);
|
||||
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
@@ -638,48 +596,69 @@ public class MapMarkerManager implements IMogoMarkerClickListener,
|
||||
List<MarkerNoveltyInfo> noveltyInfoList = markerCardResult.getNoveltyInfo();
|
||||
|
||||
int size = onlineCarList == null ? 0 : onlineCarList.size();
|
||||
fillNumberTrackEventBody(array, 3, size);
|
||||
fillPoiTypeTrackBody(array, ModuleNames.CARD_TYPE_USER_DATA, size);
|
||||
size = exploreWayList == null ? 0 : exploreWayList.size();
|
||||
fillNumberTrackEventBody(array, 1, size);
|
||||
size = shareMusicList == null ? 0 : shareMusicList.size();
|
||||
fillNumberTrackEventBody(array, 4, size);
|
||||
|
||||
int num_gas_station = 0;
|
||||
int num_traffic_check = 0;
|
||||
int num_road_closed = 0;
|
||||
int num_shop_discount = 0;
|
||||
int num_fours_shop = 0;
|
||||
fillPoiTypeTrackBody(array, ModuleNames.CARD_TYPE_ROAD_CONDITION, size);
|
||||
|
||||
size = noveltyInfoList == null ? 0 : noveltyInfoList.size();
|
||||
JSONObject novelty = fillPoiTypeTrackBody(array, ModuleNames.CARD_TYPE_NOVELTY, size);
|
||||
if (noveltyInfoList != null) {
|
||||
Map<String, Integer> counter = new HashMap<>( );
|
||||
for (MarkerNoveltyInfo markerNoveltyInfo : noveltyInfoList) {
|
||||
if (markerNoveltyInfo == null) {
|
||||
continue;
|
||||
}
|
||||
switch (markerNoveltyInfo.getPoiType()) {
|
||||
case MarkerPoiTypeEnum.GAS_STATION:
|
||||
num_gas_station++;
|
||||
break;
|
||||
case MarkerPoiTypeEnum.TRAFFIC_CHECK:
|
||||
num_traffic_check++;
|
||||
break;
|
||||
case MarkerPoiTypeEnum.ROAD_CLOSED:
|
||||
num_road_closed++;
|
||||
break;
|
||||
case MarkerPoiTypeEnum.SHOP_DISCOUNT:
|
||||
num_shop_discount++;
|
||||
break;
|
||||
case MarkerPoiTypeEnum.FOURS_4S:
|
||||
num_fours_shop++;
|
||||
break;
|
||||
String childType = markerNoveltyInfo.getPoiType();
|
||||
if ( !counter.containsKey( childType ) ) {
|
||||
counter.put( childType, 0 );
|
||||
}
|
||||
int s = counter.get( childType ).intValue();
|
||||
counter.put( childType, s+1 );
|
||||
}
|
||||
if ( !counter.isEmpty() ) {
|
||||
JSONArray onlineCarJsonArray = new JSONArray();
|
||||
for ( Map.Entry< String, Integer > entry : counter.entrySet() ) {
|
||||
fillPoiChildTypeTrackBody(onlineCarJsonArray, entry.getKey(), entry.getValue());
|
||||
}
|
||||
if ( onlineCarJsonArray.length() > 0 ) {
|
||||
try {
|
||||
novelty.put( "content", onlineCarJsonArray );
|
||||
} catch ( JSONException e ) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
fillNumberTrackEventBody(array, 2, num_gas_station);
|
||||
fillNumberTrackEventBody(array, 6, num_road_closed);
|
||||
fillNumberTrackEventBody(array, 5, num_traffic_check);
|
||||
fillNumberTrackEventBody(array, 7, num_shop_discount);
|
||||
fillNumberTrackEventBody(array, 8, num_fours_shop);
|
||||
size = shareMusicList == null ? 0 : shareMusicList.size();
|
||||
JSONObject shareMusic = fillPoiTypeTrackBody(array, ModuleNames.CARD_TYPE_SHARE_MUSIC, size);
|
||||
if (shareMusicList != null) {
|
||||
Map<String, Integer> counter = new HashMap<>( );
|
||||
for (MarkerShareMusic markerShareMusic : shareMusicList) {
|
||||
if (markerShareMusic == null) {
|
||||
continue;
|
||||
}
|
||||
String childType = markerShareMusic.getShareType()+"";
|
||||
if ( !counter.containsKey( childType ) ) {
|
||||
counter.put( childType, 0 );
|
||||
}
|
||||
int s = counter.get( childType ).intValue();
|
||||
counter.put( childType, s+1 );
|
||||
}
|
||||
if ( !counter.isEmpty() ) {
|
||||
JSONArray shareMusicJsonArray = new JSONArray();
|
||||
for ( Map.Entry< String, Integer > entry : counter.entrySet() ) {
|
||||
fillPoiChildTypeTrackBody(shareMusicJsonArray, entry.getKey(), entry.getValue());
|
||||
}
|
||||
if ( shareMusicJsonArray.length() > 0 ) {
|
||||
try {
|
||||
shareMusic.put( "content", shareMusicJsonArray );
|
||||
} catch ( JSONException e ) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
try {
|
||||
if (array.length() == 0) {
|
||||
@@ -732,13 +711,28 @@ public class MapMarkerManager implements IMogoMarkerClickListener,
|
||||
}
|
||||
|
||||
/**
|
||||
* 统计埋点
|
||||
* 大而全数据计数埋点
|
||||
*/
|
||||
private synchronized static void fillNumberTrackEventBody(JSONArray arr, int type, int size) {
|
||||
private synchronized static JSONObject fillPoiTypeTrackBody( JSONArray arr, String poiType, int poiTypeNum) {
|
||||
JSONObject object = new JSONObject();
|
||||
try {
|
||||
object.put("type", type);
|
||||
object.put("num", size);
|
||||
object.put("poitype", poiType);
|
||||
object.put("num", poiTypeNum);
|
||||
if (arr != null) {
|
||||
arr.put(object);
|
||||
}
|
||||
return object;
|
||||
} catch (JSONException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
private synchronized static void fillPoiChildTypeTrackBody(JSONArray arr, String childType, int childTypeNum){
|
||||
JSONObject object = new JSONObject();
|
||||
try {
|
||||
object.put("contenttype", childType);
|
||||
object.put("num", childTypeNum);
|
||||
if (arr != null) {
|
||||
arr.put(object);
|
||||
}
|
||||
|
||||
@@ -83,8 +83,8 @@ object SeekHelpManager {
|
||||
isSeeking = true
|
||||
if (this.context == null) {
|
||||
this.context = context
|
||||
aiAssist = AIAssist.getInstance(context)
|
||||
}
|
||||
aiAssist = AIAssist.getInstance(context)
|
||||
isSeekHelp = ShareControl.getInstance(SeekHelpManager.context).mogoServiceApis.statusManagerApi.isSeekHelping
|
||||
Logger.d(TAG, "开始故障求助上报---${isSeekHelp}")
|
||||
seekListenerList.add(seekHelpListener)
|
||||
@@ -103,7 +103,9 @@ object SeekHelpManager {
|
||||
// 没有异常情况,开始故障求助
|
||||
if (useLocalVoiceNotice) {
|
||||
// 语音说完再请求,要不然可能请求的太快
|
||||
aiAssist?.speakTTSVoice(VOICE_WILL_SEEK_HELP, voiceCallback)
|
||||
Logger.d(TAG, "使用本地播报: $aiAssist")
|
||||
aiAssist?.speakTTSVoice(VOICE_WILL_SEEK_HELP)
|
||||
realSeekHelp()
|
||||
} else {
|
||||
Logger.d(TAG, "不使用本地语音播报,直接开始发起求助")
|
||||
realSeekHelp()
|
||||
|
||||
Reference in New Issue
Block a user