目的地车友白天模式及其他

This commit is contained in:
wangcongtao
2020-09-24 15:10:41 +08:00
parent 5cb983ce8e
commit b993d77be1
35 changed files with 249 additions and 26 deletions

View File

@@ -0,0 +1,78 @@
package com.mogo.module.common.api;
import android.content.Context;
import com.alibaba.android.arouter.launcher.ARouter;
import com.mogo.module.carchattingprovider.ICarsChattingProvider;
import com.mogo.module.common.entity.MarkerOnlineCar;
import com.mogo.utils.logger.Logger;
import com.zhidao.carchattingprovider.MogoDriverInfo;
public
/**
* @author congtaowang
* @since 2020/9/24
*
* 车聊聊接口
*/
class CallChatApi {
private static final String TAG = "CallChatApi";
private static volatile CallChatApi sInstance;
private CallChatApi() {
mApiProvider = ARouter.getInstance().navigation( ICarsChattingProvider.class );
}
public static CallChatApi getInstance() {
if ( sInstance == null ) {
synchronized ( CallChatApi.class ) {
if ( sInstance == null ) {
sInstance = new CallChatApi();
}
}
}
return sInstance;
}
public synchronized void release() {
mApiProvider = null;
sInstance = null;
}
private Object readResolve() {
// 阻止反序列化,必须实现 Serializable 接口
return sInstance;
}
private ICarsChattingProvider mApiProvider;
public void showUserWindow( Context context, MarkerOnlineCar onlineCar ) throws Exception {
if ( mApiProvider == null ) {
Logger.e( TAG, "no call chat api instance." );
return;
}
MogoDriverInfo driverInfo = new MogoDriverInfo();
driverInfo.setAge( onlineCar.getUserInfo().getAgeNumber() );
driverInfo.setCarTypeName( onlineCar.getCarInfo().getCarTypeName() );
driverInfo.setGender( onlineCar.getUserInfo().getGender() );
driverInfo.setLat( onlineCar.getLocation().getLat() );
driverInfo.setLon( onlineCar.getLocation().getLon() );
driverInfo.setLocationInfo( onlineCar.getLocation().getAddress() );
driverInfo.setSn( onlineCar.getUserInfo().getSn() );
driverInfo.setUserHead( onlineCar.getUserInfo().getUserHead() );
driverInfo.setUserName( onlineCar.getUserInfo().getUserName() );
mApiProvider.showUserWindow( TAG, driverInfo, context );
}
public void hideUserWindow( Context context ) {
if ( mApiProvider != null ) {
if ( mApiProvider == null ) {
Logger.e( TAG, "no call chat api instance." );
return;
}
}
mApiProvider.hideUserWindow( TAG, context, null );
}
}