This commit is contained in:
zhongchao
2022-11-11 18:07:24 +08:00
parent 5489eed272
commit e52ba22a56
14 changed files with 104 additions and 134 deletions

View File

@@ -26,6 +26,7 @@ import com.mogo.eagle.core.function.api.autopilot.IMoGoAutopilotPlanningListener
import com.mogo.eagle.core.function.api.autopilot.IMoGoAutopilotStatusListener;
import com.mogo.eagle.core.function.call.autopilot.CallerAutoPilotStatusListenerManager;
import com.mogo.eagle.core.function.call.autopilot.CallerAutopilotPlanningListenerManager;
import com.mogo.eagle.core.function.call.map.CallerMapLocationListenerManager;
import com.mogo.eagle.core.network.utils.GsonUtil;
import com.mogo.eagle.core.utilcode.mogo.AppIdentityModeUtils;
import com.mogo.eagle.core.utilcode.mogo.logger.CallerLogger;

View File

@@ -2,17 +2,12 @@ package com.mogo.eagle.core.function.chat.facade.bridge
import android.content.Context
import com.mogo.eagle.core.utilcode.util.Utils
import com.mogo.module.common.MogoApisHandler
import java.lang.ref.WeakReference
internal object BridgeApi {
private var contextHolder: WeakReference<Context>? = null
private val apis by lazy {
MogoApisHandler.getInstance().apis
}
internal fun init(context: Context?) {
context?.let {
contextHolder = WeakReference(context)
@@ -21,5 +16,4 @@ internal object BridgeApi {
internal fun context(): Context = contextHolder?.get() ?: Utils.getApp()
internal fun floatViewManager() = apis?.windowManagerApi
}

View File

@@ -22,6 +22,7 @@ import com.mogo.eagle.core.function.api.chat.biz.ChatConsts
import com.mogo.eagle.core.function.api.chat.biz.HangUpState
import com.mogo.eagle.core.function.api.chat.biz.IMoGoVoiceControlFacade.IMoGoVoiceCallback
import com.mogo.eagle.core.function.api.chat.biz.RefuseState
import com.mogo.eagle.core.function.call.hmi.CallerHmiFloatViewManager
import com.mogo.eagle.core.function.chat.R
import com.mogo.eagle.core.function.chat.facade.MoGoChatFacade
import com.mogo.eagle.core.function.chat.facade.OnCallingInterrupt
@@ -200,7 +201,7 @@ internal class CallChatWindowManager {
log(TAG, "由于对方呼出又挂断,导致来电界面隐藏")
d2.safeCancel()
}
2 -> {
2 -> {
log(TAG, "由于自己主动拒接,导致来电界面隐藏")
d1.safeCancel()
}
@@ -252,8 +253,11 @@ internal class CallChatWindowManager {
private fun getInComingLayoutParams(context: Context): FrameLayout.LayoutParams {
return FrameLayout.LayoutParams(
context.resources.getDimension(R.dimen.module_call_chat_state_incoming_hawk_eye_width).toInt(),
context.resources.getDimension(R.dimen.module_call_chat_state_incoming_hawk_eye_height).toInt())
context.resources.getDimension(R.dimen.module_call_chat_state_incoming_hawk_eye_width)
.toInt(),
context.resources.getDimension(R.dimen.module_call_chat_state_incoming_hawk_eye_height)
.toInt()
)
.also {
it.gravity = Gravity.BOTTOM or Gravity.START
it.marginStart = 40.PX
@@ -264,7 +268,11 @@ internal class CallChatWindowManager {
/**
* 重新开始计时
*/
private fun CoroutineScope.resetInComingTimer(old: Job?, user: UserInfo, incomingView: View): Job {
private fun CoroutineScope.resetInComingTimer(
old: Job?,
user: UserInfo,
incomingView: View
): Job {
old?.safeCancel()
return inComingTimer(user, incomingView)
}
@@ -284,13 +292,13 @@ internal class CallChatWindowManager {
var callingView = LayoutInflater.from(context)
.inflate(R.layout.module_car_chatting_launcher_calling_hawk_eye_view, null)
callingView.isClickable = true
var calling= callingView.findViewById<View>(R.id.module_carchatting_rl_call_view)
var calling = callingView.findViewById<View>(R.id.module_carchatting_rl_call_view)
var head = callingView.findViewById<ImageView>(R.id.module_carchatting_call_head)
var hangUp = callingView.findViewById<View>(R.id.module_carchatting_call_hangUp)
var name = callingView.findViewById<TextView>(R.id.module_carchatting_call_nickname)
var timer = callingView.findViewById<TextView>(R.id.module_carchatting_call_time)
calling.visibility = View.VISIBLE
name.text = "云平台"
name.text = "云平台"
timer.text = context.resources.getString(R.string.module_car_chat_matching_wait)
GlideApp.with(context).load(user.icon)
.apply(
@@ -353,7 +361,7 @@ internal class CallChatWindowManager {
}
hide(callingView)
facade.audioFocus().releaseAudioFocus()
}.also { job = it }
}.also { job = it }
}
if (itx == ON_DESTROY) {
isCallingShow = false
@@ -375,9 +383,9 @@ internal class CallChatWindowManager {
private fun getCallingLayoutParams(context: Context): FrameLayout.LayoutParams {
return FrameLayout.LayoutParams(
context.resources.getDimension(R.dimen.module_call_chat_state_hawk_eye_width).toInt(),
context.resources.getDimension(R.dimen.module_call_chat_state_hawk_eye_height).toInt()
)
context.resources.getDimension(R.dimen.module_call_chat_state_hawk_eye_width).toInt(),
context.resources.getDimension(R.dimen.module_call_chat_state_hawk_eye_height).toInt()
)
.also {
it.gravity = Gravity.BOTTOM or Gravity.START
it.marginStart = 40.PX
@@ -393,17 +401,17 @@ internal class CallChatWindowManager {
}
private fun show(view: View, params: FrameLayout.LayoutParams) {
BridgeApi.floatViewManager()?.addView(view, params, true)
CallerHmiFloatViewManager.addView(view, params, true)
}
private fun hide(view: View) {
if (!ViewCompat.isAttachedToWindow(view)) {
return
}
BridgeApi.floatViewManager()?.removeView(view)
CallerHmiFloatViewManager.removeView(view)
}
private fun playAudioCall(onPlay:(() -> Unit)? = null) {
private fun playAudioCall(onPlay: (() -> Unit)? = null) {
facade.also {
it.audioFocus().requireAudioFocus {
it.media().play(context, R.raw.call, true, AudioManager.STREAM_RING)
@@ -474,7 +482,13 @@ internal class CallChatWindowManager {
* @param onExit: 当前用户退房通知(当前用户主动挂断或对方挂断)
*/
@OptIn(ExperimentalCoroutinesApi::class)
private fun answer(user: UserInfo, onEnter: () -> Unit, onNewEnter: () -> Unit, onExit: () -> Unit, onError: (code: Int, msg: String, extra: Map<String, String>? ) -> Unit) {
private fun answer(
user: UserInfo,
onEnter: () -> Unit,
onNewEnter: () -> Unit,
onExit: () -> Unit,
onError: (code: Int, msg: String, extra: Map<String, String>?) -> Unit
) {
facade.also { itx ->
if (hasAnswered) {
return
@@ -482,7 +496,7 @@ internal class CallChatWindowManager {
hasAnswered = true
itx.answer(user.sn)
.onEach {
when(it) {
when (it) {
is EnterRoomSuccess -> {
onEnter.invoke()
}
@@ -507,7 +521,12 @@ internal class CallChatWindowManager {
}
}
private fun doRefuse(user: UserInfo, notify: Boolean = true, inComingView: View, isAnswerFail: Boolean) {
private fun doRefuse(
user: UserInfo,
notify: Boolean = true,
inComingView: View,
isAnswerFail: Boolean
) {
refuse(user,
onSuccess = {
if (notify) {
@@ -529,7 +548,11 @@ internal class CallChatWindowManager {
}
@OptIn(ExperimentalCoroutinesApi::class)
private fun refuse(user: UserInfo, onSuccess: () -> Unit, onError: (code: Int, msg: String, extra: Map<String, String>?) -> Unit){
private fun refuse(
user: UserInfo,
onSuccess: () -> Unit,
onError: (code: Int, msg: String, extra: Map<String, String>?) -> Unit
) {
facade.also {
if (hasRefused) {
return
@@ -537,7 +560,7 @@ internal class CallChatWindowManager {
hasRefused = true
it.refuse(user.sn)
.onEach { itx ->
when(itx) {
when (itx) {
is RefuseState.Success -> {
onSuccess.invoke()
}
@@ -591,13 +614,17 @@ internal class CallChatWindowManager {
var counter = 1
while (true) {
delay(1000)
emit(1000L * (counter ++))
emit(1000L * (counter++))
}
}
}
@OptIn(ExperimentalCoroutinesApi::class)
private fun hangUp(user: UserInfo, onSuccess: () -> Unit, onError:(code: Int, msg: String, extra: Map<String, String>?) -> Unit) {
private fun hangUp(
user: UserInfo,
onSuccess: () -> Unit,
onError: (code: Int, msg: String, extra: Map<String, String>?) -> Unit
) {
facade.also {
if (hasHangUpped) {
return
@@ -605,13 +632,16 @@ internal class CallChatWindowManager {
hasHangUpped = true
it.handUp(user.sn)
.onEach { itx ->
when(itx) {
when (itx) {
HangUpState.Success -> {
onSuccess.invoke()
}
is HangUpState.Error -> {
hasHangUpped = false
log(TAG, "-- 挂断失败 --: code:: ${itx.code}; msg:: ${itx.msg}; extra:: ${itx.extra}")
log(
TAG,
"-- 挂断失败 --: code:: ${itx.code}; msg:: ${itx.msg}; extra:: ${itx.extra}"
)
onError.invoke(itx.code, itx.msg, itx.extra)
}
else -> {

View File

@@ -6,7 +6,7 @@ import android.widget.FrameLayout;
import com.alibaba.android.arouter.facade.annotation.Route;
import com.mogo.eagle.core.data.constants.MogoServicePaths;
import com.mogo.service.windowview.IMogoWindowManager;
import com.mogo.eagle.core.function.api.hmi.view.IViewLayoutSet;
/**
* @author congtaowang
@@ -14,8 +14,8 @@ import com.mogo.service.windowview.IMogoWindowManager;
* <p>
* 根据优先级控制显示 window view.
*/
@Route( path = MogoServicePaths.PATH_WINDOW_MANAGER )
public class MogoWindowManager implements IMogoWindowManager {
@Route( path = MogoServicePaths.PATH_FLOAT_VIEW_MANAGER )
public class FloatViewManager implements IViewLayoutSet {
@Override
public void addView( View view, int x, int y, boolean movable ) {

View File

@@ -6,12 +6,11 @@ import androidx.annotation.Nullable;
import com.mogo.cloud.socket.entity.SocketDownData;
import com.mogo.eagle.core.function.live.impl.AbsCameraScenario;
import com.mogo.service.windowview.IMogoTopViewStatusListener;
/**
* 路边摄像头直播控制 V2XPushLiveCarScenario
*/
public class CameraLiveManager extends AbsCameraScenario<SocketDownData.CloudRoadDataProto> implements IMogoTopViewStatusListener {
public class CameraLiveManager extends AbsCameraScenario<SocketDownData.CloudRoadDataProto> {
private static final String TAG = "CameraLiveManager";
private static CameraLiveManager mCameraLiveManager;
private boolean isShowWindow;
@@ -89,20 +88,4 @@ public class CameraLiveManager extends AbsCameraScenario<SocketDownData.CloudRoa
}
@Override
public void onViewAdded(View view) {
}
@Override
public void onViewRemoved(View view) {
}
@Override
public void beforeViewAddAnim(View view) {
}
@Override
public void beforeViewRemoveAnim(View view) {
}
}

View File

@@ -8,6 +8,7 @@ import androidx.core.util.Pair
import androidx.localbroadcastmanager.content.*
import com.mogo.cloud.commons.utils.*
import com.mogo.cloud.passport.*
import com.mogo.commons.AbsMogoApplication
import com.mogo.commons.module.ServiceConst.CARD_TYPE_ROAD_CONDITION
import com.mogo.commons.module.status.IMogoStatusChangedListener
import com.mogo.commons.module.status.MogoStatusManager
@@ -54,6 +55,7 @@ import com.mogo.eagle.core.utilcode.mogo.storage.*
import com.mogo.eagle.core.utilcode.util.*
import com.mogo.eagle.core.utilcode.util.TimeUtils
import com.mogo.eagle.core.utilcode.util.Utils
import com.mogo.map.MogoMarkerManager
import com.mogo.map.listener.*
import com.mogo.map.marker.*
import com.mogo.v2x.*

View File

@@ -28,7 +28,7 @@ public class MogoServicePaths {
*/
@Keep
@Deprecated
public static final String PATH_WINDOW_MANAGER = "/windowmanger/api";
public static final String PATH_FLOAT_VIEW_MANAGER = "/floatview/api";
/**
* 免唤醒语音控制

View File

@@ -1,18 +1,13 @@
package com.mogo.service.windowview;
package com.mogo.eagle.core.function.api.hmi.view
import android.view.View;
import android.widget.FrameLayout;
import com.alibaba.android.arouter.facade.template.IProvider;
import android.view.View
import android.widget.FrameLayout
import com.alibaba.android.arouter.facade.template.IProvider
/**
* @author congtaowang
* @since 2020-01-06
* <p>
* 根据优先级控制显示 window view.
*/
public interface IMogoWindowManager extends IProvider {
interface IViewLayoutSet : IProvider{
/**
* 向window中添加指定的布局不考虑优先级
@@ -22,7 +17,7 @@ public interface IMogoWindowManager extends IProvider {
* @param y 左上角y坐标
* @param movable 是否可移动(无效
*/
void addView( View view, int x, int y, boolean movable );
fun addView(view: View, x: Int, y: Int, movable: Boolean)
/**
@@ -32,7 +27,7 @@ public interface IMogoWindowManager extends IProvider {
* @param params 布局参数
* @param movable 是否可移动(无效
*/
void addView( View view, FrameLayout.LayoutParams params, boolean movable );
fun addView(view: View, params: FrameLayout.LayoutParams, movable: Boolean)
/**
* 向window中添加指定的布局优先级大的展示
@@ -43,7 +38,7 @@ public interface IMogoWindowManager extends IProvider {
* @param y 左上角y坐标
* @param movable 是否可移动(无效
*/
void addView( int priority, View view, int x, int y, boolean movable );
fun addView(priority: Int, view: View, x: Int, y: Int, movable: Boolean)
/**
* 向window中添加指定的布局优先级大的展示
@@ -53,28 +48,28 @@ public interface IMogoWindowManager extends IProvider {
* @param params 布局参数
* @param movable 是否可移动(无效
*/
void addView( int priority, View view, FrameLayout.LayoutParams params, boolean movable );
fun addView(priority: Int, view: View, params: FrameLayout.LayoutParams, movable: Boolean)
/**
* 移除对应的 view
*
* @param view
*/
void removeView( View view );
fun removeView(view: View)
/**
* 隐藏所有
*/
void hideAll();
fun hideAll()
/**
* 显示所有
*/
void showAll();
fun showAll()
/**
* 为了配合导航动画主屏上方1/2屏的view通过此方法添加
* @param view 主屏上方1/2屏的view
*/
void addTopView(View view);
}
fun addTopView(view: View)
}

View File

@@ -1,14 +1,25 @@
package com.mogo.eagle.core.function.call.hmi
import android.view.View
import android.widget.FrameLayout
import com.alibaba.android.arouter.launcher.ARouter
import com.mogo.eagle.core.data.constants.MogoServicePaths.PATH_FLOAT_VIEW_MANAGER
import com.mogo.eagle.core.function.api.hmi.view.IViewLayoutSet
/**
* @author xiaoyuzhou
* @date 2021/9/23 10:22 上午
* HMI 悬浮控件管理
* HMI 控件管理
*/
object CallerHmiFloatViewManager {
private val TAG = "CallerHmiFloatViewManager"
private val floatViewProviderApi
get() = ARouter.getInstance().build(PATH_FLOAT_VIEW_MANAGER)
.navigation() as? IViewLayoutSet
fun addView(view: View, params: FrameLayout.LayoutParams, movable: Boolean) {
floatViewProviderApi?.addView(view, params, movable)
}
fun removeView(view: View) {
floatViewProviderApi?.removeView(view)
}
}

View File

@@ -63,7 +63,7 @@ BIZCONFIG_VERSION=1.3.2
SERVICE_BIZ_VERSION=1.2.4
################ 外部依赖引用 ################
# loglib
LOGLIB_VERSION=1.3.39
LOGLIB_VERSION=1.4.5
######## MogoAiCloudSDK Version ########
# 网络请求LOGLIB_VERSION
MOGO_NETWORK_VERSION=1.4.3.26

View File

@@ -3,7 +3,6 @@ package com.mogo.map.marker;
import android.content.Context;
import com.mogo.eagle.core.data.map.MogoLatLng;
import com.mogo.eagle.core.data.traffic.TrafficData;
import java.util.ArrayList;
import java.util.HashMap;
@@ -27,7 +26,7 @@ public interface IMogoMarkerManager {
* @param options
* @return
*/
IMogoMarker addMarker( String tag, MogoMarkerOptions options );
IMogoMarker addMarker(String tag, MogoMarkerOptions options);
/**
* 添加多个marker
@@ -36,20 +35,22 @@ public interface IMogoMarkerManager {
* @param options
* @return
*/
List< IMogoMarker > addMarkers( String tag, ArrayList< MogoMarkerOptions > options, boolean moveToCenter );
List<IMogoMarker> addMarkers(String tag, ArrayList<MogoMarkerOptions> options, boolean moveToCenter);
/**
* 批量更新锚点位置
*
* @param optionsArrayList 锚点集合
*/
void updateBatchMarkerPosition(HashMap<String,MessagePad.TrackedObject> optionsArrayList);
void updateBatchMarkerPosition(HashMap<String, MessagePad.TrackedObject> optionsArrayList);
/**
* 添加感知使用到的3d模型
*
* @param type
* @param modelRes
*/
String addPreVehicleModel(int type,int modelRes);
String addPreVehicleModel(int type, int modelRes);
/**
* 要移除的感知数据uuid
@@ -63,7 +64,7 @@ public interface IMogoMarkerManager {
*
* @param tag
*/
void removeMarkers( String tag );
void removeMarkers(String tag);
/**
* 移除地图上添加的所有markers
@@ -82,9 +83,10 @@ public interface IMogoMarkerManager {
/**
* 隐藏除了某些类别的所有marker {@link MogoMarkerOptions Owner}
*
* @param owner
*/
void inVisibleWithoutMarkers(String ...owner); //todo 后续需要把Owner类别统一起来基类下沉此接口为临时方案应该设计为隐藏某一类元素
void inVisibleWithoutMarkers(String... owner); //todo 后续需要把Owner类别统一起来基类下沉此接口为临时方案应该设计为隐藏某一类元素
/**
* 获取某种类型的全部marker。
@@ -92,21 +94,21 @@ public interface IMogoMarkerManager {
* @param tag 业务类型
* @return
*/
List< IMogoMarker > getMarkers( String tag );
List<IMogoMarker> getMarkers(String tag);
/**
* 获取所有类型的marker。
*
* @return
*/
Map< String, List< IMogoMarker > > getAllMarkers( );
Map<String, List<IMogoMarker>> getAllMarkers();
/**
* 仅保留指定类型的tag
*
* @param tag 需要保留的类型
*/
void removeMarkersExcept( String tag );
void removeMarkersExcept(String tag);
/**
* 添加搜索路线
@@ -116,7 +118,7 @@ public interface IMogoMarkerManager {
* @param endPoint 终点
* @param wayPoints 途经点
*/
void addRouteWay( Context context, MogoLatLng startPoint, MogoLatLng endPoint, List< MogoLatLng > wayPoints );
void addRouteWay(Context context, MogoLatLng startPoint, MogoLatLng endPoint, List<MogoLatLng> wayPoints);
/**
* 移除添加的导航预测路线

View File

@@ -3,7 +3,6 @@ package com.mogo.service;
import com.alibaba.android.arouter.facade.template.IProvider;
import com.mogo.service.module.IMogoRegisterCenter;
import com.mogo.service.windowview.IMogoWindowManager;
/**
* @author congtaowang
@@ -21,11 +20,4 @@ public interface IMogoServiceApis extends IProvider {
*/
IMogoRegisterCenter getRegisterCenterApi();
/**
* 桌面浮窗控制接口
*
* @return
*/
IMogoWindowManager getWindowManagerApi();
}

View File

@@ -1,34 +0,0 @@
package com.mogo.service.windowview;
import android.view.View;
/**
* 顶部view状态监听用于监听顶部view添加和移除状态
*
* @author tongchenfei
*/
public interface IMogoTopViewStatusListener {
/**
* 顶部view添加完成动画执行完成
* @param view 添加成功的view
*/
void onViewAdded(View view);
/**
* 顶部view移除完成动画执行完成
* @param view 移除的view
*/
void onViewRemoved(View view);
/**
* view添加动画开始之前
* @param view 添加的view
*/
void beforeViewAddAnim(View view);
/**
* view 移除动画开始之前
* @param view 移除的view
*/
void beforeViewRemoveAnim(View view);
}

View File

@@ -9,7 +9,6 @@ import com.mogo.eagle.core.data.constants.MogoServicePaths;
import com.mogo.eagle.core.utilcode.mogo.logger.CallerLogger;
import com.mogo.service.IMogoServiceApis;
import com.mogo.service.module.IMogoRegisterCenter;
import com.mogo.service.windowview.IMogoWindowManager;
/**
* @author congtaowang
@@ -36,11 +35,6 @@ public class MogoServiceApis implements IMogoServiceApis {
return getApiInstance(IMogoRegisterCenter.class, MogoServicePaths.PATH_REGISTER_CENTER);
}
// 父布局页面 ,添加小元素:语音通话
@Override
public IMogoWindowManager getWindowManagerApi() {
return getApiInstance(IMogoWindowManager.class, MogoServicePaths.PATH_WINDOW_MANAGER);
}
private static <T extends IProvider> T getApiInstance(Class<T> clazz, String path) {
synchronized (sLock) {