This commit is contained in:
wangcongtao
2020-04-28 16:47:51 +08:00
parent d8ad6630e5
commit 912da667dd
6 changed files with 110 additions and 22 deletions

View File

@@ -54,7 +54,7 @@ MOGO_MODULE_GUIDE_VERSION=1.0.3.12
## 工程外部模块
# 探路
MOGO_MODULE_TANLU_VERSION=1.0.5.5
MOGO_MODULE_TANLU_VERSION=1.0.5.6
# 车聊聊
CARCHATTING_VERSION=1.0.3.2-SNAPSHOT
# 车聊聊接口

View File

@@ -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;
@@ -603,6 +610,11 @@ public class MogoServices implements IMogoMapListener,
}
}
@Override
public void onCarLocationChanged( MogoLatLng latLng ) {
}
/**
* 刷新数据
*/

View File

@@ -811,6 +811,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();

View File

@@ -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() ) {

View File

@@ -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();
}

View File

@@ -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;