Merge branch 'feature/v1.0.5' of gitlab.zhidaoauto.com:ecos/yycp-service/Launcher into feature/v1.0.5
This commit is contained in:
2
.idea/misc.xml
generated
2
.idea/misc.xml
generated
@@ -1,6 +1,6 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="ProjectRootManager" version="2" languageLevel="JDK_1_8" project-jdk-name="JDK" project-jdk-type="JavaSDK">
|
||||
<component name="ProjectRootManager" version="2" languageLevel="JDK_1_8" project-jdk-name="1.8" project-jdk-type="JavaSDK">
|
||||
<output url="file://$PROJECT_DIR$/build/classes" />
|
||||
</component>
|
||||
</project>
|
||||
@@ -6,6 +6,7 @@ import android.content.Intent;
|
||||
import android.content.pm.ApplicationInfo;
|
||||
import android.text.TextUtils;
|
||||
|
||||
import com.mogo.commons.AbsMogoApplication;
|
||||
import com.mogo.utils.logger.Logger;
|
||||
import com.zhidao.auto.platform.voice.VoiceClient;
|
||||
import com.zhidao.voicesdk.MogoVoiceManager;
|
||||
@@ -81,7 +82,9 @@ public class AIAssist implements VoiceClient.VoiceCmdCallBack, OnTtsListener {
|
||||
}
|
||||
|
||||
private void initFlushStatus( Context context ) {
|
||||
mHasFlush = isVoiceServiceReady( context );
|
||||
if ( !mHasFlush ) {
|
||||
mHasFlush = isVoiceServiceReady( context );
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -194,6 +197,7 @@ public class AIAssist implements VoiceClient.VoiceCmdCallBack, OnTtsListener {
|
||||
*/
|
||||
public void speakTTSVoice( String text, IMogoVoiceCmdCallBack callBack ) {
|
||||
try {
|
||||
initFlushStatus( AbsMogoApplication.getApp() );
|
||||
if ( mHasFlush ) {
|
||||
mSpeakVoiceMap.put( text, callBack );
|
||||
mVoiceClient.speakDefault( text );
|
||||
@@ -209,6 +213,7 @@ public class AIAssist implements VoiceClient.VoiceCmdCallBack, OnTtsListener {
|
||||
*/
|
||||
public void speakTTSVoice( String text ) {
|
||||
try {
|
||||
initFlushStatus( AbsMogoApplication.getApp() );
|
||||
if ( mHasFlush ) {
|
||||
mVoiceClient.speakDefault( text );
|
||||
}
|
||||
@@ -224,6 +229,7 @@ public class AIAssist implements VoiceClient.VoiceCmdCallBack, OnTtsListener {
|
||||
*/
|
||||
public void speakTTSVoice( String text, VoicePreemptType type, IMogoVoiceCmdCallBack callBack ) {
|
||||
try {
|
||||
initFlushStatus( AbsMogoApplication.getApp() );
|
||||
if ( mHasFlush ) {
|
||||
mSpeakVoiceMap.put( text, callBack );
|
||||
mVoiceClient.speakTypeText( text, type.getPreemptType() );
|
||||
@@ -238,6 +244,7 @@ public class AIAssist implements VoiceClient.VoiceCmdCallBack, OnTtsListener {
|
||||
* @param tts 播报内容
|
||||
*/
|
||||
public void speakQAndACmd( String tts, IMogoVoiceCmdCallBack callBack ) {
|
||||
initFlushStatus( AbsMogoApplication.getApp() );
|
||||
if ( mHasFlush ) {
|
||||
mQAndAMap.put( tts, callBack );
|
||||
mVoiceClient.speakTtsAndRegistCmd( tts );
|
||||
@@ -252,6 +259,7 @@ public class AIAssist implements VoiceClient.VoiceCmdCallBack, OnTtsListener {
|
||||
* @param cancelCmds 取消命令唤醒词
|
||||
*/
|
||||
public void speakQAndACmd( String tts, String[] okCmds, String[] cancelCmds, IMogoVoiceCmdCallBack callBack ) {
|
||||
initFlushStatus( AbsMogoApplication.getApp() );
|
||||
if ( mHasFlush ) {
|
||||
mQAndAMap.put( tts, callBack );
|
||||
mVoiceClient.speakTtsAndRegistCmd( tts, okCmds, cancelCmds );
|
||||
@@ -271,6 +279,7 @@ public class AIAssist implements VoiceClient.VoiceCmdCallBack, OnTtsListener {
|
||||
}
|
||||
mCmdMap.get( cmd ).add( callBack );
|
||||
|
||||
initFlushStatus( AbsMogoApplication.getApp() );
|
||||
if ( mHasFlush ) {
|
||||
mVoiceClient.registerCustomWakeupCmd( cmd, cmdWords );
|
||||
mCacheUnWakeupCommands.remove( cmd );
|
||||
@@ -286,6 +295,7 @@ public class AIAssist implements VoiceClient.VoiceCmdCallBack, OnTtsListener {
|
||||
* @param cmdWords
|
||||
*/
|
||||
public void registerUnWakeupCommand( String cmd, String[] cmdWords ) {
|
||||
initFlushStatus( AbsMogoApplication.getApp() );
|
||||
if ( mHasFlush ) {
|
||||
mVoiceClient.registerCustomWakeupCmd( cmd, cmdWords );
|
||||
mCacheUnWakeupCommands.remove( cmd );
|
||||
|
||||
@@ -54,7 +54,7 @@ MOGO_MODULE_GUIDE_VERSION=1.0.3.12
|
||||
|
||||
## 工程外部模块
|
||||
# 探路
|
||||
MOGO_MODULE_TANLU_VERSION=1.0.5.2
|
||||
MOGO_MODULE_TANLU_VERSION=1.0.5.6
|
||||
# 车聊聊
|
||||
CARCHATTING_VERSION=1.0.3.2-SNAPSHOT
|
||||
# 车聊聊接口
|
||||
@@ -66,7 +66,7 @@ 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.6-SNAPSHOT
|
||||
MOGO_MODULE_V2X_VERSION=1.0.6.11
|
||||
# 媒体卡片
|
||||
MOGO_MODULE_MEDIA_VERSION=1.0.4.3
|
||||
# 推送
|
||||
@@ -74,4 +74,4 @@ MOGO_MODULE_PUSH_VERSION=1.0.1
|
||||
# 广告资源位
|
||||
MOGO_MODULE_AD_CARD_VERSION=1.0.1
|
||||
# 新鲜事
|
||||
MOGO_MODULE_FRESH_NEWS_VERSION=1.0.3.2
|
||||
MOGO_MODULE_FRESH_NEWS_VERSION=1.0.3.4
|
||||
|
||||
@@ -86,8 +86,9 @@ public class AMapMarkerWrapper implements IMogoMarker, Observer {
|
||||
mMarker.setObject( null );
|
||||
mMarker = null;
|
||||
}
|
||||
if (mMovingPointOverlay != null){
|
||||
if ( mMovingPointOverlay != null ) {
|
||||
try {
|
||||
mMovingPointOverlay.stopMove();
|
||||
mMovingPointOverlay.destroy();
|
||||
} catch ( Exception e ) {
|
||||
e.printStackTrace();
|
||||
@@ -435,27 +436,40 @@ public class AMapMarkerWrapper implements IMogoMarker, Observer {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void startSmooth(List<MogoLatLng> points,int duration) {
|
||||
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++) {
|
||||
p.add(ObjectUtils.fromMogo2(points.get(i)));
|
||||
if ( mMarker != null && points.size() > 0 ) {
|
||||
List< LatLng > p = new ArrayList<>();
|
||||
for ( int i = 0; i < points.size(); i++ ) {
|
||||
p.add( ObjectUtils.fromMogo2( points.get( i ) ) );
|
||||
}
|
||||
mMovingPointOverlay = new MovingPointOverlay(AMapWrapper.getAMap(),mMarker);
|
||||
mMovingPointOverlay.setPoints(p);
|
||||
mMovingPointOverlay.setTotalDuration(duration);
|
||||
mMovingPointOverlay.setVisible(true);
|
||||
mMovingPointOverlay.setMoveListener(new MovingPointOverlay.MoveListener() {
|
||||
@Override
|
||||
public void move(double v) {
|
||||
|
||||
mMovingPointOverlay = new MovingPointOverlay( AMapWrapper.getAMap(), mMarker );
|
||||
mMovingPointOverlay.setPoints( p );
|
||||
mMovingPointOverlay.setTotalDuration( duration );
|
||||
mMovingPointOverlay.setMoveListener( v -> {
|
||||
try {
|
||||
LatLng position = mMovingPointOverlay.getPosition();
|
||||
Point point = AMapWrapper.getAMap().getProjection().toScreenLocation( position );
|
||||
if ( point.x < 0 || point.x > WindowUtils.getScreenWidth( AbsMogoApplication.getApp() )
|
||||
|| point.y < 0 || point.y > WindowUtils.getScreenHeight( AbsMogoApplication.getApp() ) ) {
|
||||
if ( mMarker.isVisible() ) {
|
||||
mMovingPointOverlay.setVisible( false );
|
||||
Logger.d( TAG, "hide moving marker" );
|
||||
}
|
||||
} else {
|
||||
if ( !mMarker.isVisible() ) {
|
||||
mMovingPointOverlay.setVisible( true );
|
||||
Logger.d( TAG, "show moving marker" );
|
||||
}
|
||||
}
|
||||
} catch ( Exception e ) {
|
||||
Logger.e( TAG, e, "error." );
|
||||
}
|
||||
});
|
||||
} );
|
||||
mMovingPointOverlay.startSmoothMove();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -274,7 +274,6 @@ public class EntranceFragment extends MvpFragment< EntranceView, EntrancePresent
|
||||
@Override
|
||||
public void onIntentReceived( String intentStr, Intent intent ) {
|
||||
int key_type = intent.getIntExtra( "KEY_TYPE", 0 );
|
||||
|
||||
int type = intent.getIntExtra( "EXTRA_TYPE", -1 );
|
||||
int opera_type = intent.getIntExtra( "EXTRA_OPERA", -1 );
|
||||
if ( key_type == 10027 ) {
|
||||
|
||||
@@ -65,7 +65,7 @@ public class EntrancePresenter extends Presenter< EntranceView > implements IMog
|
||||
}
|
||||
|
||||
private void registerUnWake() {
|
||||
AIAssist.getInstance( mContext ).registerUnWakeupCommand( ExtensionsModuleConst.CLOSE, ExtensionsModuleConst.CMD_CLOSE, 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 );
|
||||
@@ -82,7 +82,7 @@ public class EntrancePresenter extends Presenter< EntranceView > implements IMog
|
||||
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 ) ) { //取消分享,关闭页面
|
||||
/*|| cmd.equals( ExtensionsModuleConst.CLOSE ) */) { //取消分享,关闭页面
|
||||
if ( mIMogoAuthorizeModuleManager.needAuthorize( AUTHORIZE_TYPE_LAUNCHER_SHARE ) ) {
|
||||
mIMogoAuthorizeModuleManager.invokeAuthorization( AUTHORIZE_TYPE_LAUNCHER_SHARE );
|
||||
} else {
|
||||
|
||||
@@ -338,7 +338,9 @@ public class MainActivity extends MvpActivity< MainView, MainPresenter > impleme
|
||||
@Override
|
||||
public boolean onMarkerClicked( IMogoMarker marker ) {
|
||||
EventDispatchCenter.getInstance().onMarkerClicked( marker );
|
||||
switch2Card( marker.getOwner(), false );
|
||||
if ( !mMogoStatusManager.isADASShow() ) {
|
||||
switch2Card( marker.getOwner(), false );
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
@@ -15,8 +15,10 @@ import com.mogo.commons.mvp.Presenter;
|
||||
import com.mogo.commons.voice.AIAssist;
|
||||
import com.mogo.commons.voice.IMogoVoiceCmdCallBack;
|
||||
import com.mogo.commons.voice.VoicePreemptType;
|
||||
import com.mogo.map.MogoLatLng;
|
||||
import com.mogo.map.navi.IMogoNavi;
|
||||
import com.mogo.map.navi.IMogoNaviListener2;
|
||||
import com.mogo.map.navi.MogoNaviConfig;
|
||||
import com.mogo.map.navi.MogoNaviInfo;
|
||||
import com.mogo.map.navi.MogoTraffic;
|
||||
import com.mogo.map.uicontroller.EnumMapUI;
|
||||
@@ -80,81 +82,68 @@ public class MapPresenter extends Presenter< MapView > implements
|
||||
public void onReceive( Context context, Intent intent ) {
|
||||
String action = intent.getAction();
|
||||
Logger.d( TAG, "action = %s", action );
|
||||
if ( TextUtils.equals( action, AUTONAVI_STANDARD_BROADCAST_RECV ) ) {
|
||||
int key_type = intent.getIntExtra( "KEY_TYPE", 0 );
|
||||
int type = intent.getIntExtra( "EXTRA_TYPE", -1 );
|
||||
int opera_type = intent.getIntExtra( "EXTRA_OPERA", -1 );
|
||||
|
||||
Logger.d( "NaviManager", "key_type" + key_type );
|
||||
if ( key_type == 10027 ) {
|
||||
|
||||
if ( type == 0 ) {
|
||||
mView.getUIController().setTrafficEnabled( opera_type == 0 );
|
||||
} else if ( type == 1 ) {
|
||||
zoomMap( opera_type == 0 );
|
||||
} else if ( type == 2 ) {
|
||||
|
||||
mMogoIntentManager.invoke( AUTONAVI_STANDARD_BROADCAST_RECV, intent );
|
||||
if ( opera_type == 0 ) {
|
||||
mView.getUIController().changeMapMode( EnumMapUI.CarUp_2D );
|
||||
} else if ( opera_type == 1 ) {
|
||||
mView.getUIController().changeMapMode( EnumMapUI.NorthUP_2D );
|
||||
} else if ( opera_type == 2 ) {
|
||||
mView.getUIController().changeMapMode( EnumMapUI.CarUp_3D );
|
||||
}
|
||||
|
||||
}
|
||||
} else if ( key_type == 10048 ) {
|
||||
//* @param type 0:自动; 1:白天; 2:黑夜
|
||||
int day_night_mode = intent.getIntExtra( "EXTRA_DAY_NIGHT_MODE", -1 );
|
||||
if ( day_night_mode == 0 ) {
|
||||
mView.getUIController().changeMapMode( EnumMapUI.Type_AUTO_LIGHT_Night );
|
||||
} else if ( day_night_mode == 1 ) {
|
||||
mView.getUIController().changeMapMode( EnumMapUI.Type_Light );
|
||||
} else if ( day_night_mode == 2 ) {
|
||||
mView.getUIController().changeMapMode( EnumMapUI.Type_Night );
|
||||
}
|
||||
|
||||
//intent.setAction("AUTONAVI_STANDARD_BROADCAST_RECV");
|
||||
//intent.putExtra("KEY_TYPE", 10049);
|
||||
//intent.putExtra("EXTRA_ENDURANCE_DATA", continueNavi);
|
||||
//继续导航
|
||||
} else if ( key_type == 10049 ) {
|
||||
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 ) {
|
||||
// onDisplayOverview();
|
||||
// } else {
|
||||
// onContinueNavigation();
|
||||
// }
|
||||
} else if ( key_type == 10005 ) {
|
||||
int navi_route_prefer = intent.getIntExtra( "NAVI_ROUTE_PREFER", type );
|
||||
|
||||
|
||||
} else if ( key_type == 20009 ) {
|
||||
onOpenNavi();
|
||||
if ( !TextUtils.equals( action, AUTONAVI_STANDARD_BROADCAST_RECV ) ) {
|
||||
return;
|
||||
}
|
||||
int key_type = intent.getIntExtra( "KEY_TYPE", 0 );
|
||||
int type = intent.getIntExtra( "EXTRA_TYPE", -1 );
|
||||
int opera_type = intent.getIntExtra( "EXTRA_OPERA", -1 );
|
||||
Logger.d( TAG, "key_type" + key_type );
|
||||
if ( key_type == 10027 ) {
|
||||
if ( type == 0 ) {
|
||||
onChangeTrafficMode( opera_type );
|
||||
} else if ( type == 1 ) {
|
||||
zoomMap( opera_type == 0 );
|
||||
} else if ( type == 2 ) {
|
||||
mMogoIntentManager.invoke( AUTONAVI_STANDARD_BROADCAST_RECV, intent );
|
||||
onChangeCameraMode( opera_type );
|
||||
}
|
||||
|
||||
///**
|
||||
// * 仅在导航场景下,⽀持第三⽅进⾏路线偏好的重新选择。
|
||||
// * `避免收费` |`1` `多策略算路` |`2` `不走高速` |`3` ` 躲避拥堵` |`4` `不走高速且避免收费` |`5` `不走高速且躲避拥堵` |`6`
|
||||
// * `躲避收费和拥堵` |`7` `不走高速躲避收费和拥堵` |`8` `高速优先` |`20` `躲避拥堵且高速优先` |`24`
|
||||
// *
|
||||
// * @param context
|
||||
// * @param type
|
||||
// */
|
||||
//public static void setUserPreference(Context context, int type) {
|
||||
// Intent intent = new Intent();
|
||||
// intent.setAction("AUTONAVI_STANDARD_BROADCAST_RECV");
|
||||
// intent.putExtra("KEY_TYPE", 10005);
|
||||
// intent.putExtra("NAVI_ROUTE_PREFER", type);
|
||||
// context.sendBroadcast(intent);
|
||||
} else if ( key_type == 10048 ) {
|
||||
//0:自动; 1:白天; 2:黑夜;
|
||||
int day_night_mode = intent.getIntExtra( "EXTRA_DAY_NIGHT_MODE", -1 );
|
||||
onChangeDayNightMode( day_night_mode );
|
||||
//继续导航
|
||||
} else if ( key_type == 10049 ) {
|
||||
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 ) {
|
||||
// onDisplayOverview();
|
||||
//} else {
|
||||
// onContinueNavigation();
|
||||
//}
|
||||
//
|
||||
} else if ( key_type == 10005 ) {
|
||||
int navi_route_prefer = intent.getIntExtra( "NAVI_ROUTE_PREFER", type );
|
||||
} else if ( key_type == 20009 ) {
|
||||
onOpenNavi();
|
||||
} else if ( key_type == 10038 || key_type == 10007 ) {
|
||||
mLauncher.backToLauncher( getContext() );
|
||||
onChoosePath( intent, key_type );
|
||||
} else if ( key_type == 10021 ) {
|
||||
onStopNaviInternal();
|
||||
} else if ( key_type == 10005 ) {
|
||||
// 仅在导航场景下,⽀持第三⽅进⾏路线偏好的重新选择。
|
||||
// 避免收费 | 1
|
||||
// 多策略算路 | 2
|
||||
// 不走高速 | 3
|
||||
// 躲避拥堵 | 4
|
||||
// 不走高速且避免收费 | 5
|
||||
// 不走高速且躲避拥堵 | 6
|
||||
// 躲避收费和拥堵 | 7
|
||||
// 不走高速躲避收费和拥堵 | 8
|
||||
// 高速优先 | 20
|
||||
// 躲避拥堵且高速优先 | 24
|
||||
int prefer = intent.getIntExtra( "NAVI_ROUTE_PREFER", 0 );
|
||||
MogoNaviConfig config = new MogoNaviConfig().congestion( prefer == 4 )
|
||||
.cost( prefer == 1 || prefer == 7 )
|
||||
.highSpeed( prefer == 20 )
|
||||
.avoidSpeed( prefer == 3 );
|
||||
mMogoMapService.getNavi( getContext() ).reCalculateRoute( config );
|
||||
|
||||
}
|
||||
}
|
||||
@@ -165,6 +154,66 @@ public class MapPresenter extends Presenter< MapView > implements
|
||||
getContext().registerReceiver( broadcastReceiver, inputFilter );
|
||||
}
|
||||
|
||||
/**
|
||||
* 切换交通态势模式
|
||||
*
|
||||
* @param mode
|
||||
*/
|
||||
private void onChangeTrafficMode( int mode ) {
|
||||
mView.getUIController().setTrafficEnabled( mode == 0 );
|
||||
}
|
||||
|
||||
/**
|
||||
* 切换地图视图朝向模式
|
||||
*/
|
||||
private void onChangeCameraMode( int mode ) {
|
||||
if ( mode == 0 ) {
|
||||
mView.getUIController().changeMapMode( EnumMapUI.CarUp_2D );
|
||||
} else if ( mode == 1 ) {
|
||||
mView.getUIController().changeMapMode( EnumMapUI.NorthUP_2D );
|
||||
} else if ( mode == 2 ) {
|
||||
mView.getUIController().changeMapMode( EnumMapUI.CarUp_3D );
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 切换白天黑夜模式
|
||||
*
|
||||
* @param mode
|
||||
*/
|
||||
private void onChangeDayNightMode( int mode ) {
|
||||
if ( mode == 0 ) {
|
||||
mView.getUIController().changeMapMode( EnumMapUI.Type_AUTO_LIGHT_Night );
|
||||
} else if ( mode == 1 ) {
|
||||
mView.getUIController().changeMapMode( EnumMapUI.Type_Light );
|
||||
} else if ( mode == 2 ) {
|
||||
mView.getUIController().changeMapMode( EnumMapUI.Type_Night );
|
||||
}
|
||||
}
|
||||
|
||||
private void onStopNaviInternal() {
|
||||
mMogoMapService.getNavi( getContext() ).stopNavi();
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 唤醒指令导航去哪里
|
||||
*/
|
||||
private void onChoosePath( Intent intent, int type ) {
|
||||
double lat;
|
||||
double lon;
|
||||
|
||||
if ( type == 10007 ) {
|
||||
lat = intent.getDoubleExtra( "ENTRY_LAT", 0.0 );
|
||||
lon = intent.getDoubleExtra( "ENTRY_LON", 0.0 );
|
||||
} else {
|
||||
lat = intent.getDoubleExtra( "LAT", 0.0 );
|
||||
lon = intent.getDoubleExtra( "LON", 0.0 );
|
||||
|
||||
}
|
||||
mMogoAddressManager.calculatePath( new MogoLatLng( lat, lon ) );
|
||||
}
|
||||
|
||||
/**
|
||||
* 继续导航
|
||||
*/
|
||||
|
||||
@@ -41,4 +41,10 @@ public class AMapConstants {
|
||||
public static final String PATH_FRAGMENT_SETTING = "PATH_FRAGMENT_SETTING";
|
||||
public static final String PATH_FRAGMENT_NAVI_SETTING = "PATH_FRAGMENT_NAVI_SETTING";
|
||||
public static final String PATH_FRAGMENT_SETTING_HOME = "PATH_FRAGMENT_SETTING_HOME";
|
||||
|
||||
/**
|
||||
* 开始导航
|
||||
*/
|
||||
public static final String COMMAND_START_NAVI = "com.ileja.navi.route.confirm";
|
||||
|
||||
}
|
||||
|
||||
@@ -18,6 +18,7 @@ import com.mogo.service.MogoServicePaths
|
||||
import com.mogo.service.analytics.IMogoAnalytics
|
||||
import com.mogo.service.fragmentmanager.FragmentDescriptor
|
||||
import com.mogo.service.fragmentmanager.IMogoFragmentManager
|
||||
import com.mogo.service.intent.IMogoIntentManager
|
||||
import com.mogo.service.launcher.IMogoLauncher
|
||||
import com.mogo.service.map.IMogoMapService
|
||||
import com.mogo.service.module.IMogoRegisterCenter
|
||||
@@ -40,6 +41,7 @@ object SearchServiceHolder {
|
||||
val guideShowProvider: IGuideShowProvider = ARouter.getInstance().build(GuideShowProviderConstant.GUIDE_SHOW_PROVIDER).navigation() as IGuideShowProvider
|
||||
val mogoLauncher: IMogoLauncher = ARouter.getInstance().build(MogoServicePaths.PATH_LAUNCHER_API).navigation() as IMogoLauncher
|
||||
val gpsSimulator = ARouter.getInstance().build(GpsSimulatorConstants.API_PATH).navigation() as IMogoGpsSimulatorManager
|
||||
val intentManager = ARouter.getInstance().build(MogoServicePaths.PATH_INTENT_MANAGER).navigation() as IMogoIntentManager
|
||||
|
||||
var geoSearch: IMogoGeoSearch? = null
|
||||
fun init(context: Context) {
|
||||
|
||||
@@ -46,6 +46,5 @@ public class MogoAddressManager implements IMogoAddressManager {
|
||||
AddressManager.INSTANCE.init(context);
|
||||
SearchServiceHolder.INSTANCE.init(context);
|
||||
SettingManager.INSTANCE.init(context);
|
||||
NaviManager.INSTANCE.init(context);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,86 +0,0 @@
|
||||
package com.mogo.module.navi.manager
|
||||
|
||||
import android.content.BroadcastReceiver
|
||||
import android.content.Context
|
||||
import android.content.Intent
|
||||
import android.content.IntentFilter
|
||||
import android.text.TextUtils
|
||||
import com.mogo.map.MogoLatLng
|
||||
import com.mogo.map.navi.MogoNaviConfig
|
||||
import com.mogo.module.common.MogoModulePaths
|
||||
import com.mogo.module.navi.constants.SearchServiceHolder
|
||||
import com.mogo.module.navi.ui.search.ChoosePathFragment
|
||||
import com.mogo.module.navi.ui.search.SearchFragment
|
||||
import com.mogo.service.fragmentmanager.FragmentDescriptor
|
||||
import com.mogo.utils.logger.Logger
|
||||
|
||||
/**
|
||||
*@author zyz
|
||||
* 2020-01-18.
|
||||
*/
|
||||
object NaviManager {
|
||||
private lateinit var mReceiver: BroadcastReceiver
|
||||
private val AUTONAVI_STANDARD_BROADCAST_RECV = "AUTONAVI_STANDARD_BROADCAST_RECV"
|
||||
|
||||
fun init(context: Context) {
|
||||
mReceiver = object : BroadcastReceiver() {
|
||||
override fun onReceive(context: Context, intent: Intent) {
|
||||
val action = intent.action
|
||||
if (TextUtils.equals(action, AUTONAVI_STANDARD_BROADCAST_RECV)) {
|
||||
val key_type = intent.getIntExtra("KEY_TYPE", 0)
|
||||
Logger.d("NaviManager", "key_type" + key_type, null)
|
||||
if (key_type == 10038 || key_type == 10007) {
|
||||
SearchServiceHolder.mogoLauncher.backToLauncher(context)
|
||||
choosePath(intent, key_type)
|
||||
} else if (key_type == 10021) {
|
||||
SearchServiceHolder.getNavi().stopNavi()
|
||||
} else if (key_type == 10005) {
|
||||
|
||||
// * 仅在导航场景下,⽀持第三⽅进⾏路线偏好的重新选择。
|
||||
// * `避免收费` |`1` `多策略算路` |`2` `不走高速` |`3` ` 躲避拥堵` |`4` `不走高速且避免收费` |`5` `不走高速且躲避拥堵` |`6`
|
||||
// * `躲避收费和拥堵` |`7` `不走高速躲避收费和拥堵` |`8` `高速优先` |`20` `躲避拥堵且高速优先` |`24`
|
||||
// *
|
||||
var prefer = intent.getIntExtra("NAVI_ROUTE_PREFER", 0)
|
||||
|
||||
var avoidSpeed = MogoNaviConfig().congestion(prefer == 4)
|
||||
.cost(prefer == 1 || prefer == 7)
|
||||
.highSpeed(prefer == 20)
|
||||
.avoidSpeed(prefer == 3)
|
||||
SearchServiceHolder.getNavi().reCalculateRoute(avoidSpeed)
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 打开地图
|
||||
*/
|
||||
private fun gotoSearch() {
|
||||
AddressManager.goSearch()
|
||||
}
|
||||
|
||||
/**
|
||||
* 唤醒指令导航去哪里
|
||||
*/
|
||||
private fun choosePath(intent: Intent, type: Int) {
|
||||
val lat: Double
|
||||
val lon: Double
|
||||
|
||||
if (type == 10007) {
|
||||
lat = intent.getDoubleExtra("ENTRY_LAT", 0.0)
|
||||
lon = intent.getDoubleExtra("ENTRY_LON", 0.0)
|
||||
} else {
|
||||
lat = intent.getDoubleExtra("LAT", 0.0)
|
||||
lon = intent.getDoubleExtra("LON", 0.0)
|
||||
|
||||
}
|
||||
AddressManager.calculatePath(MogoLatLng(lat, lon))
|
||||
}
|
||||
}
|
||||
val inputFilter = IntentFilter()
|
||||
inputFilter.addAction(AUTONAVI_STANDARD_BROADCAST_RECV)
|
||||
context.registerReceiver(mReceiver, inputFilter)
|
||||
|
||||
}
|
||||
}
|
||||
@@ -87,83 +87,6 @@ public abstract class BaseSearchFragment extends BaseFragment implements SearchV
|
||||
mSearchBox = view.findViewById(R.id.et_navi_search);
|
||||
}
|
||||
|
||||
/**
|
||||
* 显示我的位置,并且可设置为家
|
||||
*/
|
||||
//private void multiSearchMyLocationUI() {
|
||||
// mUiMode = SearchConstants.UI_MODE_MULTI_MY_LOCATION;
|
||||
// mSearchBox.setEnabled( false );
|
||||
// mMyLocation.setVisibility( View.GONE );
|
||||
// mChoicePoint.setVisibility( View.GONE );
|
||||
// mCurrentLocation.setVisibility( View.GONE );
|
||||
// mSearchResult.setVisibility( View.GONE );
|
||||
// mActionButton.setVisibility( View.VISIBLE );
|
||||
// mActionButton.setText( SearchUtils.getSearchTypeActionName( mSearchType ) );
|
||||
// mSearchBox.setCompoundDrawables( null, null, null, null );
|
||||
// //removeChoicePointMarker();
|
||||
// mSearchBox.setTag( null );
|
||||
// if ( mSearchBox.getLayoutParams() instanceof RelativeLayout.LayoutParams ) {
|
||||
// final RelativeLayout.LayoutParams params = ( ( RelativeLayout.LayoutParams ) mSearchBox.getLayoutParams() );
|
||||
// params.addRule( RelativeLayout.LEFT_OF, R.id.amap_search_action_setting );
|
||||
// mSearchBox.setPadding( 0, 0, WindowUtils.dip2px( mContext, 15 ), 0 );
|
||||
// mSearchBox.setLayoutParams( params );
|
||||
// }
|
||||
//}
|
||||
|
||||
/**
|
||||
* 显示我的位置,并且可设置为家
|
||||
*/
|
||||
//private void multiSearchChoicePointUI() {
|
||||
// mUiMode = SearchConstants.UI_MODE_MULTI_CHOICE_POINT;
|
||||
// mSearchBox.setEnabled( false );
|
||||
// mMyLocation.setVisibility( View.GONE );
|
||||
// mChoicePoint.setVisibility( View.GONE );
|
||||
// mCurrentLocation.setVisibility( View.GONE );
|
||||
// mSearchResult.setVisibility( View.GONE );
|
||||
// mActionButton.setVisibility( View.VISIBLE );
|
||||
// mActionButton.setText( SearchUtils.getSearchTypeActionName( mSearchType ) );
|
||||
// mSearchBox.setCompoundDrawables( null, null, null, null );
|
||||
// mSearchBox.setTag( null );
|
||||
// if ( mSearchBox.getLayoutParams() instanceof RelativeLayout.LayoutParams ) {
|
||||
// final RelativeLayout.LayoutParams params = ( ( RelativeLayout.LayoutParams ) mSearchBox.getLayoutParams() );
|
||||
// params.addRule( RelativeLayout.LEFT_OF, R.id.amap_search_action_setting );
|
||||
// mSearchBox.setPadding( 0, 0, WindowUtils.dip2px( mContext, 15 ), 0 );
|
||||
// mSearchBox.setLayoutParams( params );
|
||||
// }
|
||||
//}
|
||||
private void saveCurrentLocationAsCommonAddress() {
|
||||
//if ( mLastAMapLocation == null ) {
|
||||
// shortToast( "定位失败,请重试" );
|
||||
// return;
|
||||
//}
|
||||
//final Disposable disposable = mSearchPresenter.cacheCommonAddressPoi( mLastAMapLocation ).subscribe( output -> {
|
||||
// Toast.makeText( mContext, "设置成功!", Toast.LENGTH_SHORT ).show();
|
||||
// mActionSuccess = true;
|
||||
//}, error -> {
|
||||
// if ( error instanceof Exception) {
|
||||
// Toast.makeText( mContext, ( (Exception) error ).getMessage(), Toast.LENGTH_SHORT ).show();
|
||||
// mActionSuccess = false;
|
||||
// }
|
||||
//} );
|
||||
//mSearchPresenter.addDisposable( disposable );
|
||||
}
|
||||
|
||||
private void saveRegeoAddressAsCommonAddress() {
|
||||
//if ( mSearchBox.getTag() instanceof RegeocodeAddress ) {
|
||||
// final Disposable disposable = mSearchPresenter.cacheCommonAddressPoi( ( ( RegeocodeAddress ) mSearchBox.getTag() ) ).subscribe( output -> {
|
||||
// Toast.makeText( mContext, "设置成功!", Toast.LENGTH_SHORT ).show();
|
||||
// mActionSuccess = true;
|
||||
// }, error -> {
|
||||
// if ( error instanceof Exception) {
|
||||
// Toast.makeText( mContext, ( (Exception) error ).getMessage(), Toast.LENGTH_SHORT ).show();
|
||||
// mActionSuccess = false;
|
||||
// }
|
||||
// } );
|
||||
// mSearchPresenter.addDisposable( disposable );
|
||||
//} else {
|
||||
// Toast.makeText( mContext, "请选择位置", Toast.LENGTH_SHORT ).show();
|
||||
//}
|
||||
}
|
||||
|
||||
// view interface
|
||||
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
package com.mogo.module.navi.ui.search
|
||||
|
||||
import android.content.Intent
|
||||
import android.os.Bundle
|
||||
import android.text.TextUtils
|
||||
import android.view.View
|
||||
@@ -21,6 +22,7 @@ import com.mogo.module.navi.constants.SearchServiceHolder
|
||||
import com.mogo.module.navi.manager.SettingManager
|
||||
import com.mogo.module.navi.ui.adapter.CalculatePathAdapter
|
||||
import com.mogo.module.navi.ui.base.BaseFragment
|
||||
import com.mogo.service.intent.IMogoIntentListener
|
||||
import com.mogo.utils.UiThreadHandler
|
||||
import kotlinx.android.synthetic.main.fragment_search_category.group_path
|
||||
import kotlinx.android.synthetic.main.fragment_search_category.pb_path
|
||||
@@ -33,7 +35,7 @@ import kotlinx.android.synthetic.main.include_search_bar.iv_navi_back
|
||||
* @author zyz
|
||||
* 2020-01-09.
|
||||
*/
|
||||
class ChoosePathFragment : BaseFragment(), IMogoNaviListener, IMogoVoiceCmdCallBack {
|
||||
class ChoosePathFragment : BaseFragment(), IMogoNaviListener, IMogoVoiceCmdCallBack, IMogoIntentListener {
|
||||
|
||||
override fun onCmdSelected(cmd: String?) {
|
||||
when (cmd) {
|
||||
@@ -202,6 +204,8 @@ class ChoosePathFragment : BaseFragment(), IMogoNaviListener, IMogoVoiceCmdCallB
|
||||
AIAssist.getInstance(context).registerUnWakeupCommand("thirdPath", arrayOf<String>(thirdPath), this)
|
||||
AIAssist.getInstance(context).registerUnWakeupCommand("startNavi", arrayOf<String>(startNavi, "开始"), this)
|
||||
|
||||
SearchServiceHolder.intentManager.registerIntentListener(AMapConstants.COMMAND_START_NAVI, this)
|
||||
|
||||
}
|
||||
|
||||
private fun registerRetryVoice() {
|
||||
@@ -254,6 +258,13 @@ class ChoosePathFragment : BaseFragment(), IMogoNaviListener, IMogoVoiceCmdCallB
|
||||
AIAssist.getInstance(context).unregisterUnWakeupCommand("thirdPath")
|
||||
AIAssist.getInstance(context).unregisterUnWakeupCommand("startNavi")
|
||||
|
||||
SearchServiceHolder.intentManager.unregisterIntentListener(AMapConstants.COMMAND_START_NAVI, this)
|
||||
}
|
||||
|
||||
override fun onIntentReceived(intentStr: String?, intent: Intent?) {
|
||||
if (TextUtils.equals(AMapConstants.COMMAND_START_NAVI, intentStr)) {
|
||||
startNavi()
|
||||
}
|
||||
}
|
||||
|
||||
companion object {
|
||||
|
||||
@@ -231,91 +231,6 @@ public class SearchFragment extends BaseSearchFragment
|
||||
.registerUnWakeupCommand(WASH_CMD, new String[] { "洗车" }, this);
|
||||
}
|
||||
|
||||
private void push(Fragment fragment, String tag) {
|
||||
FragmentDescriptor.Builder builder = new FragmentDescriptor.Builder();
|
||||
builder.fragment(fragment);
|
||||
FragmentDescriptor build =
|
||||
builder.tag(tag).build();
|
||||
SearchServiceHolder.INSTANCE.getFragmentManager().push(build);
|
||||
}
|
||||
|
||||
/**
|
||||
* 显示我的位置,并且可设置为家
|
||||
*/
|
||||
//private void multiSearchMyLocationUI() {
|
||||
// mUiMode = SearchConstants.UI_MODE_MULTI_MY_LOCATION;
|
||||
// mSearchBox.setEnabled( false );
|
||||
// mMyLocation.setVisibility( View.GONE );
|
||||
// mChoicePoint.setVisibility( View.GONE );
|
||||
// mCurrentLocation.setVisibility( View.GONE );
|
||||
// mSearchResult.setVisibility( View.GONE );
|
||||
// mActionButton.setVisibility( View.VISIBLE );
|
||||
// mActionButton.setText( SearchUtils.getSearchTypeActionName( mSearchType ) );
|
||||
// mSearchBox.setCompoundDrawables( null, null, null, null );
|
||||
// //removeChoicePointMarker();
|
||||
// mSearchBox.setTag( null );
|
||||
// if ( mSearchBox.getLayoutParams() instanceof RelativeLayout.LayoutParams ) {
|
||||
// final RelativeLayout.LayoutParams params = ( ( RelativeLayout.LayoutParams ) mSearchBox.getLayoutParams() );
|
||||
// params.addRule( RelativeLayout.LEFT_OF, R.id.amap_search_action_setting );
|
||||
// mSearchBox.setPadding( 0, 0, WindowUtils.dip2px( mContext, 15 ), 0 );
|
||||
// mSearchBox.setLayoutParams( params );
|
||||
// }
|
||||
//}
|
||||
|
||||
/**
|
||||
* 显示我的位置,并且可设置为家
|
||||
*/
|
||||
//private void multiSearchChoicePointUI() {
|
||||
// mUiMode = SearchConstants.UI_MODE_MULTI_CHOICE_POINT;
|
||||
// mSearchBox.setEnabled( false );
|
||||
// mMyLocation.setVisibility( View.GONE );
|
||||
// mChoicePoint.setVisibility( View.GONE );
|
||||
// mCurrentLocation.setVisibility( View.GONE );
|
||||
// mSearchResult.setVisibility( View.GONE );
|
||||
// mActionButton.setVisibility( View.VISIBLE );
|
||||
// mActionButton.setText( SearchUtils.getSearchTypeActionName( mSearchType ) );
|
||||
// mSearchBox.setCompoundDrawables( null, null, null, null );
|
||||
// mSearchBox.setTag( null );
|
||||
// if ( mSearchBox.getLayoutParams() instanceof RelativeLayout.LayoutParams ) {
|
||||
// final RelativeLayout.LayoutParams params = ( ( RelativeLayout.LayoutParams ) mSearchBox.getLayoutParams() );
|
||||
// params.addRule( RelativeLayout.LEFT_OF, R.id.amap_search_action_setting );
|
||||
// mSearchBox.setPadding( 0, 0, WindowUtils.dip2px( mContext, 15 ), 0 );
|
||||
// mSearchBox.setLayoutParams( params );
|
||||
// }
|
||||
//}
|
||||
private void saveCurrentLocationAsCommonAddress() {
|
||||
//if ( mLastAMapLocation == null ) {
|
||||
// shortToast( "定位失败,请重试" );
|
||||
// return;
|
||||
//}
|
||||
//final Disposable disposable = mSearchPresenter.cacheCommonAddressPoi( mLastAMapLocation ).subscribe( output -> {
|
||||
// Toast.makeText( mContext, "设置成功!", Toast.LENGTH_SHORT ).show();
|
||||
// mActionSuccess = true;
|
||||
//}, error -> {
|
||||
// if ( error instanceof Exception) {
|
||||
// Toast.makeText( mContext, ( (Exception) error ).getMessage(), Toast.LENGTH_SHORT ).show();
|
||||
// mActionSuccess = false;
|
||||
// }
|
||||
//} );
|
||||
//mSearchPresenter.addDisposable( disposable );
|
||||
}
|
||||
|
||||
private void saveRegeoAddressAsCommonAddress() {
|
||||
//if ( mSearchBox.getTag() instanceof RegeocodeAddress ) {
|
||||
// final Disposable disposable = mSearchPresenter.cacheCommonAddressPoi( ( ( RegeocodeAddress ) mSearchBox.getTag() ) ).subscribe( output -> {
|
||||
// Toast.makeText( mContext, "设置成功!", Toast.LENGTH_SHORT ).show();
|
||||
// mActionSuccess = true;
|
||||
// }, error -> {
|
||||
// if ( error instanceof Exception) {
|
||||
// Toast.makeText( mContext, ( (Exception) error ).getMessage(), Toast.LENGTH_SHORT ).show();
|
||||
// mActionSuccess = false;
|
||||
// }
|
||||
// } );
|
||||
// mSearchPresenter.addDisposable( disposable );
|
||||
//} else {
|
||||
// Toast.makeText( mContext, "请选择位置", Toast.LENGTH_SHORT ).show();
|
||||
//}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void renderSearchPoiResult(List<MogoTip> datums, boolean showDelete) {
|
||||
@@ -379,70 +294,6 @@ public class SearchFragment extends BaseSearchFragment
|
||||
|
||||
}
|
||||
|
||||
//@Override
|
||||
//public void renderChoicePointResult( RegeocodeAddress address ) {
|
||||
// if ( address == null ) {
|
||||
// mSearchBox.setTag( null );
|
||||
// mSearchBox.setText( "" );
|
||||
// return;
|
||||
// }
|
||||
// mSearchBox.setTag( address );
|
||||
// mSearchBox.setText( address.getFormatAddress() );
|
||||
//}
|
||||
//
|
||||
//@Override
|
||||
//public void renderErrorView() {
|
||||
//
|
||||
//}
|
||||
//
|
||||
//@Override
|
||||
//public void renderContentView() {
|
||||
//
|
||||
//}
|
||||
|
||||
// view interface end
|
||||
|
||||
///**
|
||||
// * 屏幕中心marker 跳动
|
||||
// */
|
||||
//@Override
|
||||
//public void startJumpAnimation() {
|
||||
//
|
||||
// final AMap aMap = mUiController.getAMapServiceVisitor().getMap();
|
||||
//
|
||||
// if ( mChoicePointMaker != null ) {
|
||||
// //根据屏幕距离计算需要移动的目标点
|
||||
// final LatLng latLng = mChoicePointMaker.getPosition();
|
||||
// Point point = aMap.getProjection().toScreenLocation( latLng );
|
||||
// point.y -= WindowUtils.dip2px( mContext, 125 );
|
||||
// LatLng target = aMap.getProjection()
|
||||
// .fromScreenLocation( point );
|
||||
// //使用TranslateAnimation,填写一个需要移动的目标点
|
||||
// Animation animation = new TranslateAnimation( target );
|
||||
// animation.setInterpolator( new Interpolator() {
|
||||
// @Override
|
||||
// public float getInterpolation( float input ) {
|
||||
// // 模拟重加速度的interpolator
|
||||
// if ( input <= 0.5 ) {
|
||||
// return ( float ) ( 0.5f - 2 * ( 0.5 - input ) * ( 0.5 - input ) );
|
||||
// } else {
|
||||
// return ( float ) ( 0.5f - Math.sqrt( ( input - 0.5f ) * ( 1.5f - input ) ) );
|
||||
// }
|
||||
// }
|
||||
// } );
|
||||
// //整个移动所需要的时间
|
||||
// animation.setDuration( 600 );
|
||||
// //设置动画
|
||||
// mChoicePointMaker.setAnimation( animation );
|
||||
// //开始动画
|
||||
// mChoicePointMaker.startAnimation();
|
||||
//
|
||||
// }
|
||||
//}
|
||||
|
||||
private void navi2Location(SearchPoi searchPoi) {
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* 退出搜索,进行清理
|
||||
|
||||
@@ -4,41 +4,33 @@ 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
|
||||
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
|
||||
import com.mogo.map.search.geo.query.MogoRegeocodeQuery
|
||||
import com.mogo.module.common.MogoModulePaths
|
||||
import com.mogo.module.common.adapter.MogoMapListenerAdapter
|
||||
import com.mogo.module.common.map.MapCenterPointStrategy
|
||||
import com.mogo.module.common.map.Scene
|
||||
import com.mogo.module.navi.R
|
||||
import com.mogo.module.navi.R.string
|
||||
import com.mogo.module.navi.bean.EntityConvertUtils
|
||||
import com.mogo.module.navi.bean.SearchPoi
|
||||
import com.mogo.module.navi.constants.AMapConstants
|
||||
import com.mogo.module.navi.manager.AddressManager
|
||||
import com.mogo.module.navi.constants.DataConstants
|
||||
import com.mogo.module.navi.constants.SearchServiceHolder
|
||||
import com.mogo.module.navi.cp.AddressHelper
|
||||
import com.mogo.module.navi.database.AppDataBase
|
||||
import com.mogo.module.navi.manager.AddressManager
|
||||
import com.mogo.module.navi.ui.base.BaseFragment
|
||||
import com.mogo.utils.TipToast
|
||||
import com.mogo.utils.UiThreadHandler
|
||||
import io.reactivex.Observable
|
||||
import io.reactivex.ObservableOnSubscribe
|
||||
import io.reactivex.schedulers.Schedulers
|
||||
import kotlinx.android.synthetic.main.fragment_setting_address.et_navi_search
|
||||
import kotlinx.android.synthetic.main.fragment_setting_address.iv_navi_back
|
||||
import kotlinx.android.synthetic.main.fragment_setting_address.tv_set_as_home
|
||||
import kotlinx.android.synthetic.main.fragment_setting_address.*
|
||||
|
||||
/**
|
||||
* @author zyz
|
||||
@@ -131,8 +123,7 @@ class SettingAddressFragment : BaseFragment(), IMogoGeoSearchListener {
|
||||
}
|
||||
tv_set_as_home.setOnClickListener {
|
||||
if (selectPoi == null) {
|
||||
Toast.makeText(context, "请选择", Toast.LENGTH_SHORT)
|
||||
.show()
|
||||
TipToast.shortTip("请选择")
|
||||
return@setOnClickListener
|
||||
}
|
||||
insert(selectPoi!!)
|
||||
|
||||
@@ -24,6 +24,7 @@ import com.mogo.map.location.IMogoLocationListener;
|
||||
import com.mogo.map.location.MogoLocation;
|
||||
import com.mogo.map.model.MogoPoi;
|
||||
import com.mogo.map.navi.IMogoAimlessModeListener;
|
||||
import com.mogo.map.navi.IMogoCarLocationChangedListener2;
|
||||
import com.mogo.map.navi.IMogoNavi;
|
||||
import com.mogo.map.navi.IMogoNaviListener;
|
||||
import com.mogo.map.navi.MogoCongestionInfo;
|
||||
@@ -86,7 +87,8 @@ public class MogoServices implements IMogoMapListener,
|
||||
IMogoIntentListener,
|
||||
IMogoAimlessModeListener,
|
||||
IMogoVoiceCmdCallBack,
|
||||
FragmentStackTransactionListener {
|
||||
FragmentStackTransactionListener,
|
||||
IMogoCarLocationChangedListener2 {
|
||||
|
||||
private boolean mInternalUnWakeupRegisterStatus = false;
|
||||
|
||||
@@ -298,6 +300,7 @@ public class MogoServices implements IMogoMapListener,
|
||||
mRegisterCenter.registerMogoNaviListener( ServiceConst.TYPE, this );
|
||||
mRegisterCenter.registerMogoMapListener( ServiceConst.TYPE, this );
|
||||
mRegisterCenter.registerMogoAimlessModeListener( ServiceConst.TYPE, this );
|
||||
mRegisterCenter.registerCarLocationChangedListener( ServiceConst.TYPE, this );
|
||||
|
||||
mActionManager = MarkerServiceHandler.getActionManager();
|
||||
|
||||
@@ -572,6 +575,10 @@ public class MogoServices implements IMogoMapListener,
|
||||
@Override
|
||||
public void onLocationChanged( MogoLocation location ) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onCarLocationChanged2( Location latLng ) {
|
||||
if ( mStatusManager.isADASShow() ) {
|
||||
return;
|
||||
}
|
||||
@@ -580,12 +587,12 @@ public class MogoServices implements IMogoMapListener,
|
||||
return;
|
||||
}
|
||||
|
||||
if ( location == null ) {
|
||||
if ( latLng == null ) {
|
||||
return;
|
||||
}
|
||||
|
||||
// 自动刷新触发
|
||||
final MogoLatLng point = new MogoLatLng( location.getLatitude(), location.getLongitude() );
|
||||
final MogoLatLng point = new MogoLatLng( latLng.getLatitude(), latLng.getLongitude() );
|
||||
if ( mLastAutoRefreshLocation == null ) {
|
||||
mLastAutoRefreshLocation = point;
|
||||
mLoopRequest = true;
|
||||
@@ -601,6 +608,12 @@ public class MogoServices implements IMogoMapListener,
|
||||
mLastAutoRefreshLocation = point;
|
||||
notifyRefreshData( mLastAutoRefreshLocation, getQueryRadius(), mAutoRefreshCallback );
|
||||
}
|
||||
MapMarkerManager.getInstance().syncLocation( latLng.getLongitude(), latLng.getLatitude() );
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onCarLocationChanged( MogoLatLng latLng ) {
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
package com.mogo.module.service.marker;
|
||||
|
||||
import android.graphics.Bitmap;
|
||||
import android.view.View;
|
||||
|
||||
import com.mogo.map.marker.IMogoMarker;
|
||||
@@ -14,5 +15,9 @@ public interface IMarkerView {
|
||||
|
||||
View getView();
|
||||
|
||||
default Bitmap getBitmap(){
|
||||
return null;
|
||||
}
|
||||
|
||||
void setMarker( IMogoMarker marker );
|
||||
}
|
||||
|
||||
@@ -1,10 +1,17 @@
|
||||
package com.mogo.module.service.marker;
|
||||
|
||||
import android.content.Context;
|
||||
import android.graphics.Bitmap;
|
||||
import android.graphics.BitmapFactory;
|
||||
import android.text.TextUtils;
|
||||
import android.view.View;
|
||||
|
||||
import com.mogo.commons.AbsMogoApplication;
|
||||
import com.mogo.map.marker.IMogoMarker;
|
||||
import com.mogo.map.marker.MogoMarkerOptions;
|
||||
import com.mogo.module.common.ModuleNames;
|
||||
import com.mogo.module.common.entity.MarkerShowEntity;
|
||||
import com.mogo.module.service.R;
|
||||
|
||||
/**
|
||||
* author : donghongyu
|
||||
@@ -23,10 +30,16 @@ public class MapMarkerAdapter {
|
||||
* @return MarkerView
|
||||
*/
|
||||
public static IMarkerView getMarkerView(Context context, MarkerShowEntity markerShowEntity, MogoMarkerOptions options) {
|
||||
if (markerShowEntity.isChecked()) {
|
||||
return new MapMarkerInfoView(context, markerShowEntity, options);
|
||||
|
||||
if ( TextUtils.equals( markerShowEntity.getMarkerType(), ModuleNames.CARD_TYPE_USER_DATA ) ) {
|
||||
return OnlineCarMarkerView.getInstance();
|
||||
} else {
|
||||
return new MapMarkerView(context, markerShowEntity, options);
|
||||
if (markerShowEntity.isChecked()) {
|
||||
return new MapMarkerInfoView(context, markerShowEntity, options);
|
||||
} else {
|
||||
return new MapMarkerView(context, markerShowEntity, options);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -284,11 +284,15 @@ public class MapMarkerManager implements IMogoMarkerClickListener,
|
||||
}
|
||||
} else {
|
||||
Object object = mogoMarker.getObject();
|
||||
if (object != null) {
|
||||
MarkerShowEntity markerShowEntity = (MarkerShowEntity) object;
|
||||
markerShowEntity.setChecked(true);
|
||||
IMarkerView markerView = MapMarkerAdapter.getMarkerView(mContext, markerShowEntity, mogoMarker.getMogoMarkerOptions());
|
||||
mogoMarker.setIcon(ViewUtils.fromView(markerView.getView()));
|
||||
if ( object != null ) {
|
||||
MarkerShowEntity markerShowEntity = ( MarkerShowEntity ) object;
|
||||
markerShowEntity.setChecked( true );
|
||||
IMarkerView markerView = MapMarkerAdapter.getMarkerView( mContext, markerShowEntity, mogoMarker.getMogoMarkerOptions() );
|
||||
if ( markerView instanceof OnlineCarMarkerView ) {
|
||||
mogoMarker.setIcon( markerView.getBitmap() );
|
||||
} else {
|
||||
mogoMarker.setIcon( ViewUtils.fromView( markerView.getView() ) );
|
||||
}
|
||||
mogoMarker.setToTop();
|
||||
}
|
||||
}
|
||||
@@ -305,11 +309,15 @@ public class MapMarkerManager implements IMogoMarkerClickListener,
|
||||
Logger.d( TAG, "关闭info window" );
|
||||
} else {
|
||||
Object object = mogoMarker.getObject();
|
||||
if (object != null) {
|
||||
MarkerShowEntity markerShowEntity = (MarkerShowEntity) object;
|
||||
markerShowEntity.setChecked(false);
|
||||
IMarkerView markerView = MapMarkerAdapter.getMarkerView(mContext, markerShowEntity, mogoMarker.getMogoMarkerOptions());
|
||||
mogoMarker.setIcon(ViewUtils.fromView(markerView.getView()));
|
||||
if ( object != null ) {
|
||||
MarkerShowEntity markerShowEntity = ( MarkerShowEntity ) object;
|
||||
markerShowEntity.setChecked( false );
|
||||
IMarkerView markerView = MapMarkerAdapter.getMarkerView( mContext, markerShowEntity, mogoMarker.getMogoMarkerOptions() );
|
||||
if ( markerView instanceof OnlineCarMarkerView ) {
|
||||
mogoMarker.setIcon( markerView.getBitmap() );
|
||||
} else {
|
||||
mogoMarker.setIcon( ViewUtils.fromView( markerView.getView() ) );
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -773,14 +781,16 @@ public class MapMarkerManager implements IMogoMarkerClickListener,
|
||||
if (markerShowEntity == null || markerShowEntity.getMarkerLocation() == null) {
|
||||
return null;
|
||||
}
|
||||
MogoMarkerOptions options =
|
||||
new MogoMarkerOptions().owner(markerShowEntity.getMarkerType()).object(markerShowEntity).latitude(markerShowEntity.getMarkerLocation().getLat()).longitude(markerShowEntity.getMarkerLocation().getLon());
|
||||
IMarkerView markerView = MapMarkerAdapter.getMarkerView(mContext, markerShowEntity,
|
||||
options);
|
||||
options.icon(markerView.getView());
|
||||
MogoMarkerOptions options = new MogoMarkerOptions().owner(markerShowEntity.getMarkerType()).object(markerShowEntity).latitude(markerShowEntity.getMarkerLocation().getLat()).longitude(markerShowEntity.getMarkerLocation().getLon());
|
||||
IMarkerView markerView = MapMarkerAdapter.getMarkerView(mContext, markerShowEntity, options);
|
||||
if ( markerView instanceof OnlineCarMarkerView ) {
|
||||
options.icon(markerView.getBitmap());
|
||||
options.anchor( 0.5f, 0.5f );
|
||||
} else {
|
||||
options.icon(markerView.getView());
|
||||
}
|
||||
|
||||
IMogoMarker marker =
|
||||
MarkerServiceHandler.getMarkerManager().addMarker(markerShowEntity.getMarkerType(), options);
|
||||
IMogoMarker marker = MarkerServiceHandler.getMarkerManager().addMarker(markerShowEntity.getMarkerType(), options);
|
||||
marker.setOwner(markerShowEntity.getMarkerType());
|
||||
markerView.setMarker(marker);
|
||||
marker.setOnMarkerClickListener(this);
|
||||
@@ -811,6 +821,10 @@ public class MapMarkerManager implements IMogoMarkerClickListener,
|
||||
});
|
||||
}
|
||||
|
||||
public void syncLocation(double lon, double lat){
|
||||
mCarLatLng = new MogoLatLng( lat, lon );
|
||||
}
|
||||
|
||||
public void getOnlineCarData(MogoLatLng latlng) {
|
||||
mCarLatLng = latlng;
|
||||
getOnlineCarList();
|
||||
@@ -828,39 +842,54 @@ public class MapMarkerManager implements IMogoMarkerClickListener,
|
||||
|
||||
private void getOnlineCarList() {
|
||||
|
||||
if (MarkerServiceHandler.getMogoStatusManager().isSearchUIShow() || MarkerServiceHandler.getMogoStatusManager().isADASShow()){
|
||||
if ( ignoreOnlineCarRequest() ) {
|
||||
removeCarMarkers();
|
||||
return;
|
||||
}
|
||||
|
||||
mRefreshModel.queryOnLineCarWithRoute(mCarLatLng, false, false, new RefreshCallback() {
|
||||
@Override
|
||||
public void onSuccess(Object o) {
|
||||
MarkerResponse data = (MarkerResponse) o;
|
||||
MarkerCardResult result = data.getResult();
|
||||
if (result == null) {
|
||||
return;
|
||||
}
|
||||
removeCarMarkers();
|
||||
List<MarkerOnlineCar> onlineCarList = result.getOnlineCar();
|
||||
if ( !MarkerServiceHandler.getMogoStatusManager().isADASShow() ) {
|
||||
dispatchDataToBis(ServiceConst.CARD_TYPE_USER_DATA, onlineCarList == null ? new ArrayList<>() : onlineCarList);
|
||||
}
|
||||
if (MarkerServiceHandler.getMogoStatusManager().isSearchUIShow() ){
|
||||
return;
|
||||
}
|
||||
drawOnlineCarMarkers(onlineCarList, ServiceConst.MAX_AMOUNT_SINGLE_CARD);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onFail() {
|
||||
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* 忽略在线车辆请求策略
|
||||
* @return
|
||||
*/
|
||||
private boolean ignoreOnlineCarRequest(){
|
||||
if ( MarkerServiceHandler.getMogoStatusManager().isSearchUIShow() ) {
|
||||
return true;
|
||||
}
|
||||
if ( MarkerServiceHandler.getMogoStatusManager().isADASShow() ) {
|
||||
return false;
|
||||
}
|
||||
if ( TextUtils.equals( ServiceConst.CARD_TYPE_USER_DATA, mCurrentModuleName )
|
||||
|| TextUtils.equals( ServiceConst.CARD_TYPE_BUSINESS_OPERATION, mCurrentModuleName )
|
||||
|| TextUtils.equals( ServiceConst.CARD_TYPE_CARS_CHATTING, mCurrentModuleName )) {
|
||||
|
||||
mRefreshModel.queryOnLineCarWithRoute(mCarLatLng, false, false, new RefreshCallback() {
|
||||
@Override
|
||||
public void onSuccess(Object o) {
|
||||
MarkerResponse data = (MarkerResponse) o;
|
||||
MarkerCardResult result = data.getResult();
|
||||
if (result == null) {
|
||||
return;
|
||||
}
|
||||
removeCarMarkers();
|
||||
List<MarkerOnlineCar> onlineCarList = result.getOnlineCar();
|
||||
dispatchDataToBis(ServiceConst.CARD_TYPE_USER_DATA, onlineCarList == null ? new ArrayList<>() : onlineCarList);
|
||||
if (MarkerServiceHandler.getMogoStatusManager().isSearchUIShow() || MarkerServiceHandler.getMogoStatusManager().isADASShow()){
|
||||
return;
|
||||
}
|
||||
drawOnlineCarMarkers(onlineCarList, ServiceConst.MAX_AMOUNT_SINGLE_CARD);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onFail() {
|
||||
|
||||
}
|
||||
});
|
||||
}else {
|
||||
removeCarMarkers();
|
||||
|| TextUtils.equals( ServiceConst.CARD_TYPE_CARS_CHATTING, mCurrentModuleName ) ) {
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
private void removeCarMarkers(){
|
||||
|
||||
@@ -0,0 +1,61 @@
|
||||
package com.mogo.module.service.marker;
|
||||
|
||||
import android.graphics.Bitmap;
|
||||
import android.graphics.BitmapFactory;
|
||||
import android.view.View;
|
||||
|
||||
import com.mogo.commons.AbsMogoApplication;
|
||||
import com.mogo.map.marker.IMogoMarker;
|
||||
import com.mogo.module.common.ModuleNames;
|
||||
import com.mogo.module.service.R;
|
||||
|
||||
import java.lang.ref.SoftReference;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* @author congtaowang
|
||||
* @since 2020-04-30
|
||||
* <p>
|
||||
* 描述
|
||||
*/
|
||||
public class OnlineCarMarkerView implements IMarkerView {
|
||||
|
||||
private static Map< String, SoftReference< Bitmap > > sRef = new HashMap<>();
|
||||
|
||||
private OnlineCarMarkerView(){
|
||||
// private constructor
|
||||
}
|
||||
|
||||
private static final class InstanceHolder{
|
||||
private static final OnlineCarMarkerView INSTANCE = new OnlineCarMarkerView();
|
||||
}
|
||||
|
||||
public static OnlineCarMarkerView getInstance(){
|
||||
return InstanceHolder.INSTANCE;
|
||||
}
|
||||
|
||||
private Object readResolve(){
|
||||
// 阻止反序列化,必须实现 Serializable 接口
|
||||
return InstanceHolder.INSTANCE;
|
||||
}
|
||||
|
||||
@Override
|
||||
public View getView() {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Bitmap getBitmap() {
|
||||
if ( sRef.get( ModuleNames.CARD_TYPE_USER_DATA ) == null || sRef.get( ModuleNames.CARD_TYPE_USER_DATA ).get() == null
|
||||
|| sRef.get( ModuleNames.CARD_TYPE_USER_DATA ).get().isRecycled() ) {
|
||||
sRef.put( ModuleNames.CARD_TYPE_USER_DATA, new SoftReference<>( BitmapFactory.decodeResource( AbsMogoApplication.getApp().getResources(), R.drawable.icon_map_marker_car_gray ) ) );
|
||||
}
|
||||
return sRef.get( ModuleNames.CARD_TYPE_USER_DATA ).get();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setMarker( IMogoMarker marker ) {
|
||||
|
||||
}
|
||||
}
|
||||
@@ -8,6 +8,8 @@ import android.view.View;
|
||||
import android.widget.ImageView;
|
||||
import android.widget.TextView;
|
||||
|
||||
import com.alibaba.android.arouter.launcher.ARouter;
|
||||
import com.mogo.commons.network.SubscribeImpl;
|
||||
import com.mogo.map.marker.IMogoInfoWindowAdapter;
|
||||
import com.mogo.map.marker.IMogoMarker;
|
||||
import com.mogo.module.common.entity.MarkerLocation;
|
||||
@@ -16,15 +18,25 @@ import com.mogo.module.common.entity.MarkerShowEntity;
|
||||
import com.mogo.module.common.entity.MarkerUserInfo;
|
||||
import com.mogo.module.service.MarkerServiceHandler;
|
||||
import com.mogo.module.service.R;
|
||||
import com.mogo.module.service.network.RefreshApiService;
|
||||
import com.mogo.module.service.network.RefreshModel;
|
||||
import com.mogo.module.service.network.bean.DemoUserInfoEntity;
|
||||
import com.mogo.service.MogoServicePaths;
|
||||
import com.mogo.service.imageloader.MogoImageView;
|
||||
import com.mogo.service.network.IMogoNetwork;
|
||||
import com.mogo.utils.UiThreadHandler;
|
||||
import com.mogo.utils.WindowUtils;
|
||||
import com.mogo.utils.logger.Logger;
|
||||
import com.mogo.utils.network.RequestOptions;
|
||||
import com.zhidao.carchattingprovider.CallChattingProviderConstant;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import io.reactivex.android.schedulers.AndroidSchedulers;
|
||||
import io.reactivex.schedulers.Schedulers;
|
||||
|
||||
/**
|
||||
* @author congtaowang
|
||||
* @since 2020-04-27
|
||||
@@ -37,6 +49,7 @@ public class UserDataMarkerInfoWindowAdapter implements IMogoInfoWindowAdapter {
|
||||
|
||||
private static volatile UserDataMarkerInfoWindowAdapter sInstance;
|
||||
private final Context mContext;
|
||||
private static RefreshApiService sRefreshApiService;
|
||||
|
||||
private View mInfoWindowView = null;
|
||||
|
||||
@@ -47,6 +60,8 @@ public class UserDataMarkerInfoWindowAdapter implements IMogoInfoWindowAdapter {
|
||||
|
||||
private UserDataMarkerInfoWindowAdapter( Context context ) {
|
||||
this.mContext = context;
|
||||
IMogoNetwork network = MarkerServiceHandler.getApis().getNetworkApi();
|
||||
sRefreshApiService = network.create( RefreshApiService.class, RefreshModel.getNetHost() );
|
||||
}
|
||||
|
||||
public static UserDataMarkerInfoWindowAdapter getInstance( Context context ) {
|
||||
@@ -95,23 +110,21 @@ public class UserDataMarkerInfoWindowAdapter implements IMogoInfoWindowAdapter {
|
||||
}
|
||||
mCall.setOnClickListener( view -> {
|
||||
if ( markerShowEntity.getBindObj() instanceof MarkerOnlineCar ) {
|
||||
Map< String, String > params = new HashMap<>();
|
||||
MarkerUserInfo userInfo = ( ( MarkerOnlineCar ) markerShowEntity.getBindObj() ).getUserInfo();
|
||||
if ( userInfo != null ) {
|
||||
params.put( CallChattingProviderConstant.CCPROVIDER_SN, userInfo.getSn() );
|
||||
params.put( CallChattingProviderConstant.CCPROVIDER_USER_IMG, userInfo.getUserHead() );
|
||||
params.put( CallChattingProviderConstant.CCPROVIDER_USER_AGE, userInfo.getAgeNumber() + "" );
|
||||
params.put( CallChattingProviderConstant.CCPROVIDER_NICK_NAME, userInfo.getUserName() );
|
||||
params.put( CallChattingProviderConstant.CCPROVIDER_USER_SEX, userInfo.getGender() + "" );
|
||||
}
|
||||
MarkerLocation location = ( ( MarkerOnlineCar ) markerShowEntity.getBindObj() ).getLocation();
|
||||
if ( location != null ) {
|
||||
params.put( CallChattingProviderConstant.CCPROVIDER_ADDRESS, location.getAddress() );
|
||||
params.put( CallChattingProviderConstant.CCPROVIDER_LAT, location.getLat() + "" );
|
||||
params.put( CallChattingProviderConstant.CCPROVIDER_LON, location.getLon() + "" );
|
||||
}
|
||||
Logger.d( TAG, "call parameters: %s", params );
|
||||
MarkerServiceHandler.getCarChatting().call( params );
|
||||
sRefreshApiService.getMockUsers().subscribeOn( Schedulers.io() )
|
||||
.observeOn( AndroidSchedulers.mainThread() )
|
||||
.subscribe( new SubscribeImpl< DemoUserInfoEntity >( RequestOptions.create( mContext ) ) {
|
||||
@Override
|
||||
public void onSuccess( DemoUserInfoEntity o ) {
|
||||
super.onSuccess( o );
|
||||
callToDemoUser( markerShowEntity, o );
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onError( String message, int code ) {
|
||||
super.onError( message, code );
|
||||
callToFactUser( markerShowEntity );
|
||||
}
|
||||
} );
|
||||
}
|
||||
} );
|
||||
} catch ( Exception e ) {
|
||||
@@ -121,6 +134,58 @@ public class UserDataMarkerInfoWindowAdapter implements IMogoInfoWindowAdapter {
|
||||
return mInfoWindowView;
|
||||
}
|
||||
|
||||
private void callToDemoUser( MarkerShowEntity factUser, DemoUserInfoEntity demoUser ) {
|
||||
if ( demoUser == null
|
||||
|| demoUser.getResult() == null
|
||||
|| demoUser.getResult().getUserList() == null
|
||||
|| demoUser.getResult().getUserList().isEmpty() ) {
|
||||
callToFactUser( factUser );
|
||||
return;
|
||||
}
|
||||
List< DemoUserInfoEntity.ResultBean.UserListBean > users = demoUser.getResult().getUserList();
|
||||
for ( DemoUserInfoEntity.ResultBean.UserListBean user : users ) {
|
||||
if ( user == null ) {
|
||||
continue;
|
||||
}
|
||||
if ( TextUtils.equals( "1", user.getSceneType() ) ) {
|
||||
try {
|
||||
( ( MarkerOnlineCar ) factUser.getBindObj() ).getUserInfo().setSn( user.getUserInfo().getSn() );
|
||||
callToFactUser( factUser );
|
||||
return;
|
||||
} catch ( Exception e ) {
|
||||
}
|
||||
}
|
||||
}
|
||||
callToFactUser( factUser );
|
||||
}
|
||||
|
||||
private void callToFactUser( MarkerShowEntity factUser ) {
|
||||
if ( factUser == null ) {
|
||||
return;
|
||||
}
|
||||
Map< String, String > params = new HashMap<>();
|
||||
MarkerUserInfo userInfo = ( ( MarkerOnlineCar ) factUser.getBindObj() ).getUserInfo();
|
||||
if ( userInfo != null ) {
|
||||
params.put( CallChattingProviderConstant.CCPROVIDER_SN, userInfo.getSn() );
|
||||
params.put( CallChattingProviderConstant.CCPROVIDER_USER_IMG, userInfo.getUserHead() );
|
||||
params.put( CallChattingProviderConstant.CCPROVIDER_USER_AGE, userInfo.getAgeNumber() + "" );
|
||||
params.put( CallChattingProviderConstant.CCPROVIDER_NICK_NAME, userInfo.getUserName() );
|
||||
params.put( CallChattingProviderConstant.CCPROVIDER_USER_SEX, userInfo.getGender() + "" );
|
||||
}
|
||||
MarkerLocation location = ( ( MarkerOnlineCar ) factUser.getBindObj() ).getLocation();
|
||||
if ( location != null ) {
|
||||
params.put( CallChattingProviderConstant.CCPROVIDER_ADDRESS, location.getAddress() );
|
||||
params.put( CallChattingProviderConstant.CCPROVIDER_LAT, location.getLat() + "" );
|
||||
params.put( CallChattingProviderConstant.CCPROVIDER_LON, location.getLon() + "" );
|
||||
}
|
||||
Logger.d( TAG, "call parameters: %s", params );
|
||||
if ( MarkerServiceHandler.getApis().getStatusManagerApi().isADASShow() ) {
|
||||
MarkerServiceHandler.getCarChatting().callShowWindow( params );
|
||||
} else {
|
||||
MarkerServiceHandler.getCarChatting().call( params );
|
||||
}
|
||||
}
|
||||
|
||||
protected void loadImageHeader( final MarkerShowEntity markerShowEntity ) {
|
||||
|
||||
if ( Looper.myLooper() != Looper.getMainLooper() ) {
|
||||
|
||||
@@ -2,6 +2,7 @@ package com.mogo.module.service.network;
|
||||
|
||||
import com.mogo.commons.data.BaseData;
|
||||
import com.mogo.module.common.entity.MarkerResponse;
|
||||
import com.mogo.module.service.network.bean.DemoUserInfoEntity;
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
@@ -29,4 +30,10 @@ public interface RefreshApiService {
|
||||
@POST( "/yycp-launcherSnapshot/user/queryOnLineCarWithRoute" )
|
||||
Observable<MarkerResponse> queryOnLineCarWithRoute(@FieldMap Map< String, Object > parameters );
|
||||
|
||||
/**
|
||||
* 查询演示车用户信息
|
||||
*/
|
||||
@GET("/yycp-launcherSnapshot/mock/getMockUserInfos")
|
||||
Observable< DemoUserInfoEntity > getMockUsers();
|
||||
|
||||
}
|
||||
|
||||
@@ -44,7 +44,7 @@ public class RefreshModel {
|
||||
this.mRefreshApiService = network.create(RefreshApiService.class, getNetHost());
|
||||
}
|
||||
|
||||
private String getNetHost() {
|
||||
public static String getNetHost() {
|
||||
switch (DebugConfig.getNetMode()) {
|
||||
case DebugConfig.NET_MODE_DEV:
|
||||
return HOST_DEV;
|
||||
|
||||
@@ -0,0 +1,267 @@
|
||||
package com.mogo.module.service.network.bean;
|
||||
|
||||
import com.mogo.commons.data.BaseData;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* author : donghongyu
|
||||
* e-mail : 1358506549@qq.com
|
||||
* date : 2020/4/24 4:20 PM
|
||||
* desc : TODO 前瞻需求演示使用的用户数据
|
||||
* version: 1.0
|
||||
*/
|
||||
public class DemoUserInfoEntity extends BaseData {
|
||||
|
||||
/**
|
||||
* code : 0
|
||||
* msg :
|
||||
* detailMsg :
|
||||
* result : {"userList":[{"sceneType":"1","location":{"lat":39.97541,"lon":116.41782761},"userInfo":{"sn":"ZD801B1920L00818","userId":1,"userName":"用户昵称","userHead":"https://www.baidu.com/img/baidu_jgylogo3.png","gender":"男","age":20,"lastActiveweekAvgscore":"96","safeLabel":"老司机","safeLabelType":1}},{"sceneType":"2","location":{"lat":39.97541,"lon":116.41782761},"userInfo":{"sn":"ZD802B1932L00779","userId":1,"userName":"用户昵称","userHead":"https://www.baidu.com/img/baidu_jgylogo3.png","gender":"男","age":20,"lastActiveweekAvgscore":"96","safeLabel":"老司机","safeLabelType":1}},{"sceneType":"3","location":{"lat":39.97541,"lon":116.41782761},"userInfo":{"sn":"ZD802B1932L00779","userId":1,"userName":"用户昵称","userHead":"https://www.baidu.com/img/baidu_jgylogo3.png","gender":"男","age":20,"lastActiveweekAvgscore":"96","safeLabel":"老司机","safeLabelType":1}}]}
|
||||
*/
|
||||
|
||||
private String detailMsg;
|
||||
private ResultBean result;
|
||||
|
||||
public int getCode() {
|
||||
return code;
|
||||
}
|
||||
|
||||
public void setCode(int code) {
|
||||
this.code = code;
|
||||
}
|
||||
|
||||
public String getMsg() {
|
||||
return msg;
|
||||
}
|
||||
|
||||
public void setMsg(String msg) {
|
||||
this.msg = msg;
|
||||
}
|
||||
|
||||
public String getDetailMsg() {
|
||||
return detailMsg;
|
||||
}
|
||||
|
||||
public void setDetailMsg(String detailMsg) {
|
||||
this.detailMsg = detailMsg;
|
||||
}
|
||||
|
||||
public ResultBean getResult() {
|
||||
return result;
|
||||
}
|
||||
|
||||
public void setResult(ResultBean result) {
|
||||
this.result = result;
|
||||
}
|
||||
|
||||
public static class ResultBean {
|
||||
private List<UserListBean> userList;
|
||||
|
||||
public List<UserListBean> getUserList() {
|
||||
return userList;
|
||||
}
|
||||
|
||||
public void setUserList(List<UserListBean> userList) {
|
||||
this.userList = userList;
|
||||
}
|
||||
|
||||
public static class UserListBean {
|
||||
/**
|
||||
* sceneType : 1
|
||||
* location : {"lat":39.97541,"lon":116.41782761}
|
||||
* userInfo : {"sn":"ZD801B1920L00818","userId":1,"userName":"用户昵称","userHead":"https://www.baidu.com/img/baidu_jgylogo3.png","gender":"男","age":20,"lastActiveweekAvgscore":"96","safeLabel":"老司机","safeLabelType":1}
|
||||
*/
|
||||
|
||||
private String sceneType;
|
||||
private LocationBean location;
|
||||
private UserInfoBean userInfo;
|
||||
|
||||
public String getSceneType() {
|
||||
return sceneType;
|
||||
}
|
||||
|
||||
public void setSceneType(String sceneType) {
|
||||
this.sceneType = sceneType;
|
||||
}
|
||||
|
||||
public LocationBean getLocation() {
|
||||
return location;
|
||||
}
|
||||
|
||||
public void setLocation(LocationBean location) {
|
||||
this.location = location;
|
||||
}
|
||||
|
||||
public UserInfoBean getUserInfo() {
|
||||
return userInfo;
|
||||
}
|
||||
|
||||
public void setUserInfo(UserInfoBean userInfo) {
|
||||
this.userInfo = userInfo;
|
||||
}
|
||||
|
||||
public static class LocationBean {
|
||||
/**
|
||||
* lat : 39.97541
|
||||
* lon : 116.41782761
|
||||
*/
|
||||
|
||||
private double lat;
|
||||
private double lon;
|
||||
|
||||
public double getLat() {
|
||||
return lat;
|
||||
}
|
||||
|
||||
public void setLat(double lat) {
|
||||
this.lat = lat;
|
||||
}
|
||||
|
||||
public double getLon() {
|
||||
return lon;
|
||||
}
|
||||
|
||||
public void setLon(double lon) {
|
||||
this.lon = lon;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "LocationBean{" +
|
||||
"lat=" + lat +
|
||||
", lon=" + lon +
|
||||
'}';
|
||||
}
|
||||
}
|
||||
|
||||
public static class UserInfoBean {
|
||||
/**
|
||||
* sn : ZD801B1920L00818
|
||||
* userId : 1
|
||||
* userName : 用户昵称
|
||||
* userHead : https://www.baidu.com/img/baidu_jgylogo3.png
|
||||
* gender : 男
|
||||
* age : 20
|
||||
* lastActiveweekAvgscore : 96
|
||||
* safeLabel : 老司机
|
||||
* safeLabelType : 1
|
||||
*/
|
||||
|
||||
private String sn;
|
||||
private int userId;
|
||||
private String userName;
|
||||
private String userHead;
|
||||
private String gender;
|
||||
private int age;
|
||||
private String lastActiveweekAvgscore;
|
||||
private String safeLabel;
|
||||
private int safeLabelType;
|
||||
|
||||
public String getSn() {
|
||||
return sn;
|
||||
}
|
||||
|
||||
public void setSn(String sn) {
|
||||
this.sn = sn;
|
||||
}
|
||||
|
||||
public int getUserId() {
|
||||
return userId;
|
||||
}
|
||||
|
||||
public void setUserId(int userId) {
|
||||
this.userId = userId;
|
||||
}
|
||||
|
||||
public String getUserName() {
|
||||
return userName;
|
||||
}
|
||||
|
||||
public void setUserName(String userName) {
|
||||
this.userName = userName;
|
||||
}
|
||||
|
||||
public String getUserHead() {
|
||||
return userHead;
|
||||
}
|
||||
|
||||
public void setUserHead(String userHead) {
|
||||
this.userHead = userHead;
|
||||
}
|
||||
|
||||
public String getGender() {
|
||||
return gender;
|
||||
}
|
||||
|
||||
public void setGender(String gender) {
|
||||
this.gender = gender;
|
||||
}
|
||||
|
||||
public int getAge() {
|
||||
return age;
|
||||
}
|
||||
|
||||
public void setAge(int age) {
|
||||
this.age = age;
|
||||
}
|
||||
|
||||
public String getLastActiveweekAvgscore() {
|
||||
return lastActiveweekAvgscore;
|
||||
}
|
||||
|
||||
public void setLastActiveweekAvgscore(String lastActiveweekAvgscore) {
|
||||
this.lastActiveweekAvgscore = lastActiveweekAvgscore;
|
||||
}
|
||||
|
||||
public String getSafeLabel() {
|
||||
return safeLabel;
|
||||
}
|
||||
|
||||
public void setSafeLabel(String safeLabel) {
|
||||
this.safeLabel = safeLabel;
|
||||
}
|
||||
|
||||
public int getSafeLabelType() {
|
||||
return safeLabelType;
|
||||
}
|
||||
|
||||
public void setSafeLabelType(int safeLabelType) {
|
||||
this.safeLabelType = safeLabelType;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "UserInfoBean{" +
|
||||
"sn='" + sn + '\'' +
|
||||
", userId=" + userId +
|
||||
", userName='" + userName + '\'' +
|
||||
", userHead='" + userHead + '\'' +
|
||||
", gender='" + gender + '\'' +
|
||||
", age=" + age +
|
||||
", lastActiveweekAvgscore='" + lastActiveweekAvgscore + '\'' +
|
||||
", safeLabel='" + safeLabel + '\'' +
|
||||
", safeLabelType=" + safeLabelType +
|
||||
'}';
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "UserListBean{" +
|
||||
"sceneType='" + sceneType + '\'' +
|
||||
", location=" + location +
|
||||
", userInfo=" + userInfo +
|
||||
'}';
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "V2XDemoUserInfoEntity{" +
|
||||
"detailMsg='" + detailMsg + '\'' +
|
||||
", result=" + result +
|
||||
'}';
|
||||
}
|
||||
}
|
||||
@@ -2,6 +2,7 @@ package com.mogo.service.impl.statusmanager;
|
||||
|
||||
|
||||
import android.content.Context;
|
||||
import android.util.Log;
|
||||
|
||||
import com.alibaba.android.arouter.facade.annotation.Route;
|
||||
import com.mogo.service.MogoServicePaths;
|
||||
|
||||
Reference in New Issue
Block a user