[2.13.0-merge]yakun and code style

This commit is contained in:
zhongchao
2022-11-21 18:07:52 +08:00
844 changed files with 3197 additions and 29173 deletions

View File

@@ -66,7 +66,6 @@ dependencies {
implementation project(':libraries:mogo-adas')
} else {
implementation project(':modules:mogo-module-common')
implementation project(':modules:mogo-module-service')
implementation project(':core:mogo-core-data')
implementation project(':core:mogo-core-utils')

View File

@@ -9,7 +9,7 @@ import com.mogo.eagle.core.network.MoGoRetrofitFactory;
import com.mogo.eagle.core.network.RequestOptions;
import com.mogo.eagle.core.network.SubscribeImpl;
import com.mogo.eagle.core.network.utils.GsonUtil;
import com.mogo.module.common.constants.HostConst;
import com.mogo.eagle.core.data.constants.HostConst;
import io.reactivex.android.schedulers.AndroidSchedulers;
import io.reactivex.schedulers.Schedulers;

View File

@@ -8,16 +8,13 @@ import com.mogo.eagle.core.data.bindingcar.BindingcarInfo;
import com.mogo.eagle.core.data.bindingcar.ModifyBindingcarInfo;
import com.mogo.eagle.core.function.BindHostConst;
import com.mogo.eagle.core.function.api.bindingcar.BindingcarCallBack;
import com.mogo.eagle.core.function.bindingcar.R;
import com.mogo.eagle.core.function.call.hmi.CallerHmiManager;
import com.mogo.eagle.core.function.call.map.CallerHDMapManager;
import com.mogo.eagle.core.network.MoGoRetrofitFactory;
import com.mogo.eagle.core.network.utils.GsonUtil;
import com.mogo.eagle.core.utilcode.mogo.logger.CallerLogger;
import com.mogo.eagle.core.utilcode.mogo.storage.SharedPrefsMgr;
import com.mogo.eagle.core.utilcode.mogo.toast.TipToast;
import com.mogo.eagle.core.utilcode.util.GsonUtils;
import com.mogo.module.common.constants.HostConst;
import io.reactivex.Observer;
import io.reactivex.android.schedulers.AndroidSchedulers;

View File

@@ -70,7 +70,6 @@ dependencies {
implementation rootProject.ext.dependencies.mogo_core_res
} else {
implementation project(':modules:mogo-module-common')
implementation project(':modules:mogo-module-service')
implementation project(':core:mogo-core-data')
implementation project(':core:mogo-core-utils')
implementation project(':core:mogo-core-function-api')

View File

@@ -1,11 +1,12 @@
package com.mogo.eagle.core.function.chat.facade.analytics
import com.mogo.commons.analytics.AnalyticsUtils
import com.mogo.eagle.core.function.api.chat.biz.IMoGoAnalyticsFacade
import com.mogo.eagle.core.function.chat.facade.bridge.BridgeApi
object ChatAnalyticsFacade: IMoGoAnalyticsFacade {
override fun track(eventType: String, data: Map<String, Any>?) {
BridgeApi.analytics()?.track(eventType, data)
AnalyticsUtils.track(eventType, data)
}
}

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,13 +16,4 @@ internal object BridgeApi {
internal fun context(): Context = contextHolder?.get() ?: Utils.getApp()
internal fun intentManager() = apis?.intentManagerApi
internal fun statusManager() = apis?.statusManagerApi
internal fun analytics() = apis?.analyticsApi
internal fun topViewManager() = apis?.topViewManager
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
@@ -30,8 +31,8 @@ import com.mogo.eagle.core.function.chat.facade.bridge.BridgeApi
import com.mogo.eagle.core.function.chat.facade.utils.log
import com.mogo.eagle.core.function.chat.facade.voice.VoiceControlFacade.REQUEST_CLOUD_VOICE_CALL
import com.mogo.eagle.core.utilcode.kotlin.*
import com.mogo.eagle.core.utilcode.mogo.glide.GlideRoundedCornersTransform
import com.mogo.eagle.core.utilcode.mogo.glide.GlideRoundedCornersTransform.CornerType.LEFT
import com.mogo.eagle.core.utilcode.mogo.glide.transform.GlideRoundedCornersTransform
import com.mogo.eagle.core.utilcode.mogo.glide.transform.GlideRoundedCornersTransform.CornerType.LEFT
import kotlinx.coroutines.*
import kotlinx.coroutines.channels.Channel
import kotlinx.coroutines.channels.Channel.Factory.RENDEZVOUS
@@ -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

@@ -3,13 +3,14 @@ package com.mogo.eagle.core.function.chat.facade.voice
import android.content.Context
import android.content.Intent
import com.mogo.commons.AbsMogoApplication
import com.mogo.commons.module.intent.IMogoIntentListener
import com.mogo.commons.module.intent.IntentManager
import com.mogo.commons.voice.AIAssist
import com.mogo.commons.voice.IMogoVoiceCmdCallBack
import com.mogo.eagle.core.function.api.chat.biz.IMoGoVoiceControlFacade
import com.mogo.eagle.core.function.api.chat.biz.IMoGoVoiceControlFacade.IMoGoVoiceCallback
import com.mogo.eagle.core.function.chat.facade.bridge.BridgeApi
import com.mogo.eagle.core.function.chat.facade.utils.log
import com.mogo.service.intent.IMogoIntentListener
import java.lang.ref.WeakReference
import java.util.concurrent.CopyOnWriteArrayList
import java.util.concurrent.atomic.AtomicBoolean
@@ -48,10 +49,6 @@ object VoiceControlFacade: IMoGoVoiceControlFacade, IMogoVoiceCmdCallBack, IMogo
private var onSpeechFinish: WeakReference<onSpeedFinish>? = null
private val intentManager by lazy {
BridgeApi.intentManager()
}
override fun speak(context: Context, content: String, listener: IMoGoVoiceCallback) {
listeners += WeakReference(listener)
AIAssist.getInstance(context).speakTTSVoiceWithLevel(content,AIAssist.LEVEL3 ,this)
@@ -123,10 +120,8 @@ object VoiceControlFacade: IMoGoVoiceControlFacade, IMogoVoiceCmdCallBack, IMogo
}
hasRegister.set(true)
AIAssist.getInstance(BridgeApi.context()).registerUnWakeupCommand(VOICE_REGISTER_CANCEL_CALL, customCancelCallArray, this)
intentManager?.also {
it.registerIntentListener(VOICE_INTENT_CANCEL_CALL_COMMAND, this)
it.registerIntentListener(VOICE_INTENT_REFUSE_CALL, this)
}
IntentManager.getInstance().registerIntentListener(VOICE_INTENT_CANCEL_CALL_COMMAND, this)
IntentManager.getInstance().registerIntentListener(VOICE_INTENT_REFUSE_CALL, this)
}
override fun registerInviteJoinTeam(context: Context, listener: IMoGoVoiceCallback) {
@@ -156,13 +151,13 @@ object VoiceControlFacade: IMoGoVoiceControlFacade, IMogoVoiceCmdCallBack, IMogo
override fun registerIntentInComingCall(listener: IMoGoVoiceCallback) {
listeners += WeakReference(listener)
intentManager?.registerIntentListener(VOICE_INTENT_ANSWER_CALL, this)
intentManager?.registerIntentListener(VOICE_INTENT_REFUSE_CALL, this)
IntentManager.getInstance().registerIntentListener(VOICE_INTENT_ANSWER_CALL, this)
IntentManager.getInstance().registerIntentListener(VOICE_INTENT_REFUSE_CALL, this)
}
override fun unRegisterIntentInComingCall(context: Context) {
intentManager?.unregisterIntentListener(VOICE_INTENT_ANSWER_CALL, this)
intentManager?.unregisterIntentListener(VOICE_INTENT_REFUSE_CALL, this)
IntentManager.getInstance().unregisterIntentListener(VOICE_INTENT_ANSWER_CALL, this)
IntentManager.getInstance().unregisterIntentListener(VOICE_INTENT_REFUSE_CALL, this)
}
override fun speakAndRegisterCall(onCmdAgree: (Boolean) -> Unit, onSpeakFinish: () -> Unit, listener: IMoGoVoiceCallback) {
@@ -204,10 +199,8 @@ object VoiceControlFacade: IMoGoVoiceControlFacade, IMogoVoiceCmdCallBack, IMogo
hasRegister.set(false)
listeners.clear()
AIAssist.getInstance(BridgeApi.context()).unregisterUnWakeupCommand(VOICE_REGISTER_CANCEL_CALL, this)
intentManager?.also {
it.unregisterIntentListener(VOICE_INTENT_CANCEL_CALL_COMMAND, this)
it.unregisterIntentListener(VOICE_INTENT_REFUSE_CALL, this)
}
IntentManager.getInstance().unregisterIntentListener(VOICE_INTENT_CANCEL_CALL_COMMAND, this)
IntentManager.getInstance().unregisterIntentListener(VOICE_INTENT_REFUSE_CALL, this)
}
override fun onIntentReceived(cmd: String?, intent: Intent?) {

View File

@@ -70,8 +70,6 @@ dependencies {
implementation project(':services:mogo-service-api')
implementation project(':modules:mogo-module-common')
implementation project(':modules:mogo-module-service')
//implementation project(':modules:mogo-module-carchattingprovider')
implementation project(':core:mogo-core-data')
implementation project(':core:mogo-core-utils')

View File

@@ -3,6 +3,9 @@ package com.mogo.eagle.core.function.check
import android.content.Context
import android.content.Intent
import com.alibaba.android.arouter.facade.annotation.Route
import com.mogo.commons.module.status.IMogoStatusChangedListener
import com.mogo.commons.module.status.MogoStatusManager
import com.mogo.commons.module.status.StatusDescriptor
import com.mogo.eagle.core.data.constants.MogoServicePaths
import com.mogo.eagle.core.function.api.check.ICheckProvider
import com.mogo.eagle.core.function.api.check.IMogoCheckListener
@@ -13,9 +16,6 @@ import com.mogo.eagle.core.function.check.view.CheckActivity
import com.mogo.eagle.core.function.check.view.CheckDialog
import com.mogo.eagle.core.function.report.IPCReportManager
import com.mogo.eagle.core.utilcode.util.*
import com.mogo.module.common.MogoApisHandler
import com.mogo.service.statusmanager.IMogoStatusChangedListener
import com.mogo.service.statusmanager.StatusDescriptor
import java.util.concurrent.ConcurrentHashMap
/**
@@ -38,11 +38,9 @@ class VehicleMonitoringManager : ICheckProvider, IMogoStatusChangedListener {
override fun init(context: Context) {
mContext = context
MogoApisHandler.getInstance().apis.statusManagerApi.registerStatusChangedListener(
TAG,
StatusDescriptor.MAIN_PAGE_RESUME,
this
)
MogoStatusManager.getInstance().registerStatusChangedListener(TAG,
StatusDescriptor.MAIN_PAGE_RESUME,
this)
//开启工控机监控节点上报服务
IPCReportManager.INSTANCE.initServer()
}
@@ -123,6 +121,9 @@ class VehicleMonitoringManager : ICheckProvider, IMogoStatusChangedListener {
override fun onDestroy() {
//停止工控机监控节点上报服务
MogoStatusManager.getInstance().unregisterStatusChangedListener(TAG,
StatusDescriptor.MAIN_PAGE_RESUME,
this)
IPCReportManager.INSTANCE.destroy()
}

View File

@@ -1,7 +1,7 @@
package com.mogo.eagle.core.function.check.net;
import com.mogo.eagle.core.network.MoGoRetrofitFactory;
import com.mogo.module.common.constants.HostConst;
import com.mogo.eagle.core.data.constants.HostConst;
/**
* @author liujing

View File

@@ -20,8 +20,7 @@ import com.mogo.eagle.core.function.check.api.ICheckResultCallBack;
import com.mogo.eagle.core.function.check.net.CheckNetWork;
import com.mogo.eagle.core.function.check.net.CheckResultData;
import com.mogo.eagle.core.utilcode.util.ThreadUtils;
import com.mogo.module.common.view.ImageViewClipBounds;
import com.mogo.module.common.view.SpacesItemDecoration;
import com.mogo.eagle.core.utilcode.mogo.view.SpacesItemDecoration;
import java.math.BigDecimal;

View File

@@ -1,7 +1,10 @@
package com.mogo.eagle.core.function.check.view;
import android.app.Dialog;
import android.content.Context;
import android.os.Build;
import android.view.View;
import android.view.WindowManager;
import android.widget.ImageView;
import android.widget.TextView;
@@ -9,7 +12,6 @@ import androidx.annotation.NonNull;
import com.mogo.eagle.core.function.call.check.CallerCheckManager;
import com.mogo.eagle.core.function.check.R;
import com.mogo.module.common.dialog.BaseFloatDialog;
/**
* @author liujing
@@ -17,13 +19,21 @@ import com.mogo.module.common.dialog.BaseFloatDialog;
* 第一版本为添加长时间未检测的提示框,因为逻辑冲突,二期需求与产品确认,UI公用
* @since: 7/30/21
*/
public class CheckDialog extends BaseFloatDialog {
public class CheckDialog extends Dialog {
private boolean showWarning;
private Context mContext;
public CheckDialog(@NonNull Context context, boolean hasError) {
super(context);
super(context,R.style.CheckInfoDialogStyle);
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
getWindow().setType(WindowManager.LayoutParams.TYPE_APPLICATION_OVERLAY);
} else {
getWindow().setType(WindowManager.LayoutParams.TYPE_SYSTEM_ALERT);
}
getWindow().addFlags(WindowManager.LayoutParams.FLAG_LAYOUT_IN_SCREEN
| WindowManager.LayoutParams.FLAG_TRANSLUCENT_NAVIGATION
| WindowManager.LayoutParams.FLAG_LOCAL_FOCUS_MODE);
mContext = context;
showWarning = hasError;
initView();

View File

@@ -1,6 +1,9 @@
package com.mogo.eagle.core.function.check.view;
import android.app.Dialog;
import android.content.Context;
import android.os.Build;
import android.view.WindowManager;
import android.widget.TextView;
import androidx.annotation.NonNull;
@@ -9,7 +12,6 @@ import androidx.recyclerview.widget.GridLayoutManager;
import com.mogo.eagle.core.function.check.R;
import com.mogo.eagle.core.function.check.model.CheckItemInfo;
import com.mogo.eagle.core.function.check.net.CheckResultData;
import com.mogo.module.common.dialog.BaseFloatDialog;
import java.util.ArrayList;
import java.util.List;
@@ -19,7 +21,7 @@ import java.util.List;
* @description 检测指标详情弹框
* @since: 9/22/21
*/
public class CheckInfoListDialog extends BaseFloatDialog {
public class CheckInfoListDialog extends Dialog {
private static final String TAG = "CheckInfoListDialog";
private CheckInfoRecyclerView mRecyclerView;
@@ -28,10 +30,18 @@ public class CheckInfoListDialog extends BaseFloatDialog {
private int span;
private String mStyle;
private CheckResultData mCheckResultData;
private List<CheckResultData.CheckListItem> result = new ArrayList<>();
private final List<CheckResultData.CheckListItem> result = new ArrayList<>();
public CheckInfoListDialog(@NonNull Context context, String style, CheckResultData checkResultData) {
super(context);
super(context,R.style.CheckInfoDialogStyle);
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
getWindow().setType(WindowManager.LayoutParams.TYPE_APPLICATION_OVERLAY);
} else {
getWindow().setType(WindowManager.LayoutParams.TYPE_SYSTEM_ALERT);
}
getWindow().addFlags(WindowManager.LayoutParams.FLAG_LAYOUT_IN_SCREEN
| WindowManager.LayoutParams.FLAG_TRANSLUCENT_NAVIGATION
| WindowManager.LayoutParams.FLAG_LOCAL_FOCUS_MODE);
mContext = context;
mStyle = style;
mCheckResultData = checkResultData;

View File

@@ -0,0 +1,57 @@
package com.mogo.eagle.core.function.check.view;
import android.content.Context;
import android.graphics.Canvas;
import android.graphics.Rect;
import android.util.AttributeSet;
import androidx.appcompat.widget.AppCompatImageView;
import java.util.Objects;
/**
* @author donghongyu
* @date 2019-08-22
*/
public class ImageViewClipBounds extends AppCompatImageView {
Rect mClipBounds = null;
public ImageViewClipBounds(Context context) {
this(context, null);
}
public ImageViewClipBounds(Context context, AttributeSet attrs) {
this(context, attrs, 0);
}
public ImageViewClipBounds(Context context, AttributeSet attrs, int defStyleAttr) {
super(context, attrs, defStyleAttr);
}
@Override
protected void onDraw(Canvas canvas) {
if (mClipBounds != null) {
// clip bounds ignore scroll
canvas.clipRect(mClipBounds);
}
super.onDraw(canvas);
}
public void setClip(Rect clipBounds) {
if (Objects.equals(clipBounds, mClipBounds)) {
return;
}
if (clipBounds != null) {
if (mClipBounds == null) {
mClipBounds = new Rect(clipBounds);
} else {
mClipBounds.set(clipBounds);
}
} else {
mClipBounds = null;
}
invalidate();
}
}

View File

@@ -42,7 +42,7 @@
app:layout_constraintRight_toRightOf="parent"
app:layout_constraintTop_toTopOf="parent" />
<com.mogo.module.common.view.ImageViewClipBounds
<com.mogo.eagle.core.function.check.view.ImageViewClipBounds
android:id="@+id/scan_car_top_image"
android:layout_width="@dimen/check_scan_width"
android:layout_height="@dimen/check_scan_height"
@@ -53,7 +53,7 @@
app:layout_constraintTop_toTopOf="@id/scan_car_image" />
<com.mogo.module.common.view.ImageViewClipBounds
<com.mogo.eagle.core.function.check.view.ImageViewClipBounds
android:id="@+id/scan_car_tips"
android:layout_width="@dimen/check_scan_width"
android:layout_height="@dimen/check_scan_height"
@@ -72,7 +72,7 @@
android:layout_height="wrap_content"
android:layout_marginTop="@dimen/dp_120"
android:text="自动驾驶车辆体检中,请稍候……"
android:textColor="@color/module_commons_wm_dialog_text_textColor"
android:textColor="@android:color/white"
android:textSize="@dimen/dp_42"
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintRight_toRightOf="parent"

View File

@@ -42,7 +42,7 @@
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="自动驾驶车辆存在风险"
android:textColor="@color/module_commons_wm_dialog_text_textColor"
android:textColor="@android:color/white"
android:textSize="@dimen/dp_54"
android:textStyle="bold"
app:layout_constraintStart_toStartOf="@id/error_view"
@@ -54,13 +54,14 @@
android:layout_height="@dimen/dp_56"
android:layout_marginTop="@dimen/dp_25"
android:src="@drawable/check_wrong"
app:layout_constraintTop_toBottomOf="@id/error_title" />
app:layout_constraintTop_toBottomOf="@id/error_title"
tools:ignore="MissingConstraints" />
<TextView
android:id="@+id/error_txt"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="@dimen/dp_26"
android:layout_marginStart="@dimen/dp_26"
android:layout_marginTop="@dimen/dp_23"
android:text="软件运行异常"
android:textColor="@color/check_tip_error_color"
@@ -76,9 +77,10 @@
android:background="@drawable/check_detail"
android:gravity="center"
android:text="查看详情"
android:textColor="@color/module_commons_wm_dialog_text_textColor"
android:textColor="@android:color/white"
android:textSize="@dimen/check_button_text_size"
app:layout_constraintTop_toBottomOf="@id/error_image" />
app:layout_constraintTop_toBottomOf="@id/error_image"
tools:ignore="MissingConstraints" />
</androidx.constraintlayout.widget.ConstraintLayout>
@@ -97,8 +99,9 @@
android:layout_width="@dimen/dp_520"
android:layout_height="wrap_content"
android:text="您的自动驾驶系统已经很久没有进行体检了,建议立即体检。"
android:textColor="@color/module_commons_wm_dialog_text_textColor"
android:textSize="@dimen/dp_44" />
android:textColor="@android:color/white"
android:textSize="@dimen/dp_44"
tools:ignore="MissingConstraints" />
<TextView
android:id="@+id/check_button"
@@ -108,9 +111,10 @@
android:background="@drawable/check_button"
android:gravity="center"
android:text="立即体检"
android:textColor="@color/module_commons_wm_dialog_text_textColor"
android:textColor="@android:color/white"
android:textSize="@dimen/check_button_text_size"
app:layout_constraintTop_toBottomOf="@id/check_text_view" />
app:layout_constraintTop_toBottomOf="@id/check_text_view"
tools:ignore="MissingConstraints" />
</androidx.constraintlayout.widget.ConstraintLayout>

View File

@@ -18,7 +18,7 @@
android:layout_marginTop="@dimen/dp_50"
android:gravity="left"
android:text="硬件检测:"
android:textColor="@color/module_commons_wm_dialog_text_textColor"
android:textColor="@android:color/white"
android:textSize="@dimen/dp_42"
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintTop_toTopOf="parent"
@@ -30,7 +30,7 @@
android:layout_height="wrap_content"
android:layout_marginTop="@dimen/dp_50"
android:text="(下面 1 项存在异常)"
android:textColor="@color/module_commons_wm_dialog_text_textColor"
android:textColor="@android:color/white"
android:textSize="@dimen/dp_42"
app:layout_constraintLeft_toRightOf="@+id/title"
app:layout_constraintTop_toTopOf="parent" />
@@ -45,8 +45,8 @@
android:layout_marginTop="@dimen/dp_236"
android:gravity="center"
android:text="角激光"
android:textColor="@color/module_commons_wm_dialog_text_textColor"
android:textSize="@dimen/dp_32"
android:textColor="@android:color/white"
android:textSize="@dimen/dp_42"
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintTop_toTopOf="parent" />
<!--车辆模型-->
@@ -77,8 +77,8 @@
android:layout_centerVertical="true"
android:gravity="center"
android:text="Pad"
android:textColor="@color/module_commons_wm_dialog_text_textColor"
android:textSize="@dimen/dp_32" />
android:textColor="@android:color/white"
android:textSize="@dimen/dp_42" />
<!--前摄像头3-->
<TextView
android:id="@+id/camera_front_txt"
@@ -89,8 +89,8 @@
android:layout_marginBottom="@dimen/dp_42"
android:gravity="center"
android:text="摄像头"
android:textColor="@color/module_commons_wm_dialog_text_textColor"
android:textSize="@dimen/dp_32" />
android:textColor="@android:color/white"
android:textSize="@dimen/dp_42" />
<LinearLayout
android:id="@+id/camera"
@@ -163,8 +163,8 @@
android:layout_centerVertical="true"
android:gravity="center"
android:text="主激光"
android:textColor="@color/module_commons_wm_dialog_text_textColor"
android:textSize="@dimen/dp_32" />
android:textColor="@android:color/white"
android:textSize="@dimen/dp_42" />
<!--RTK-->
<ImageView
android:id="@+id/rtk"
@@ -184,8 +184,8 @@
android:layout_centerVertical="true"
android:gravity="center"
android:text="RTK"
android:textColor="@color/module_commons_wm_dialog_text_textColor"
android:textSize="@dimen/dp_32" />
android:textColor="@android:color/white"
android:textSize="@dimen/dp_42" />
<!--摄像头-后1-->
<ImageView
android:id="@+id/camera_begind"
@@ -205,8 +205,8 @@
android:layout_marginBottom="@dimen/dp_42"
android:gravity="center"
android:text="摄像头"
android:textColor="@color/module_commons_wm_dialog_text_textColor"
android:textSize="@dimen/dp_32" />
android:textColor="@android:color/white"
android:textSize="@dimen/dp_42" />
<!--路由器-->
<ImageView
android:id="@+id/luyouqi"
@@ -226,8 +226,8 @@
android:layout_marginTop="@dimen/dp_42"
android:gravity="center"
android:text="路由器"
android:textColor="@color/module_commons_wm_dialog_text_textColor"
android:textSize="@dimen/dp_32" />
android:textColor="@android:color/white"
android:textSize="@dimen/dp_42" />
<!--OBU-->
<ImageView
@@ -251,8 +251,8 @@
android:layout_marginStart="@dimen/dp_1000"
android:gravity="center"
android:text="角激光"
android:textColor="@color/module_commons_wm_dialog_text_textColor"
android:textSize="@dimen/dp_32"
android:textColor="@android:color/white"
android:textSize="@dimen/dp_42"
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintTop_toBottomOf="@+id/check_image" />
<!--OBU文案-->
@@ -265,15 +265,15 @@
android:layout_marginTop="@dimen/dp_236"
android:gravity="center"
android:text="OBU"
android:textColor="@color/module_commons_wm_dialog_text_textColor"
android:textSize="@dimen/dp_32"
android:textColor="@android:color/white"
android:textSize="@dimen/dp_42"
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintTop_toTopOf="parent" />
<ImageView
android:id="@+id/error_tip"
android:layout_width="@dimen/dp_32"
android:layout_height="@dimen/dp_32"
android:layout_width="@dimen/dp_42"
android:layout_height="@dimen/dp_42"
android:layout_marginLeft="@dimen/dp_907"
android:layout_marginTop="@dimen/dp_177"
android:background="@drawable/check_little_btn"
@@ -287,14 +287,14 @@
android:layout_height="wrap_content"
android:layout_marginLeft="@dimen/dp_24"
android:text="设备故障"
android:textColor="@color/module_commons_wm_dialog_text_textColor"
android:textColor="@android:color/white"
app:layout_constraintLeft_toRightOf="@+id/error_tip"
app:layout_constraintTop_toTopOf="@+id/error_tip" />
<ImageView
android:id="@+id/error_tip_green"
android:layout_width="@dimen/dp_32"
android:layout_height="@dimen/dp_32"
android:layout_width="@dimen/dp_42"
android:layout_height="@dimen/dp_42"
android:layout_marginLeft="@dimen/dp_160"
android:layout_marginTop="88dp"
android:background="@drawable/check_little_btn_green"
@@ -307,7 +307,7 @@
android:layout_height="wrap_content"
android:layout_marginLeft="@dimen/dp_24"
android:text="设备正常"
android:textColor="@color/module_commons_wm_dialog_text_textColor"
android:textColor="@android:color/white"
app:layout_constraintLeft_toRightOf="@+id/error_tip_green"
app:layout_constraintTop_toTopOf="@+id/error_tip_green" />

View File

@@ -13,7 +13,7 @@
android:background="@drawable/check_top_item_no_line_shape"
android:gravity="left"
android:paddingLeft="@dimen/dp_40"
android:paddingTop="@dimen/dp_32"
android:paddingTop="@dimen/dp_42"
android:text="模块名称"
android:textColor="#FFF"
android:textSize="@dimen/dp_38"
@@ -30,7 +30,7 @@
android:layout_height="match_parent"
android:background="@drawable/check_top_item_left_shape"
android:paddingLeft="@dimen/dp_40"
android:paddingTop="@dimen/dp_32"
android:paddingTop="@dimen/dp_42"
android:text="运行状态"
android:textColor="#FFF"
android:textSize="@dimen/dp_38"
@@ -47,7 +47,7 @@
android:layout_height="match_parent"
android:background="@drawable/check_top_item_left_shape"
android:paddingLeft="@dimen/dp_40"
android:paddingTop="@dimen/dp_32"
android:paddingTop="@dimen/dp_42"
android:text="模块名称"
android:textColor="#FFF"
android:textSize="@dimen/dp_38"
@@ -64,7 +64,7 @@
android:layout_height="match_parent"
android:background="@drawable/check_top_item_left_shape"
android:paddingLeft="@dimen/dp_40"
android:paddingTop="@dimen/dp_32"
android:paddingTop="@dimen/dp_42"
android:text="运行状态"
android:textColor="#FFF"
android:textSize="@dimen/dp_38"

View File

@@ -17,7 +17,7 @@
android:layout_marginLeft="@dimen/dp_50"
android:layout_marginTop="@dimen/dp_50"
android:text="硬件检测:"
android:textColor="@color/module_commons_wm_dialog_text_textColor"
android:textColor="@android:color/white"
android:textSize="@dimen/dp_42"
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintStart_toStartOf="parent"
@@ -52,7 +52,7 @@
android:layout_marginTop="@dimen/dp_22"
android:maxLines="2"
android:text="自动驾驶"
android:textColor="@color/module_commons_wm_dialog_text_textColor"
android:textColor="@android:color/white"
android:textSize="@dimen/dp_42"
app:layout_constraintTop_toBottomOf="@id/icon_auto" />
@@ -97,7 +97,7 @@
android:layout_marginTop="@dimen/dp_22"
android:text=" 鹰眼\n版本"
android:textAlignment="center"
android:textColor="@color/module_commons_wm_dialog_text_textColor"
android:textColor="@android:color/white"
android:textSize="@dimen/dp_42"
app:layout_constraintTop_toBottomOf="@id/icon_auto" />

View File

@@ -25,7 +25,7 @@
android:layout_marginLeft="@dimen/dp_65"
android:layout_marginTop="@dimen/dp_20"
android:text="暂无数据,请关闭重试"
android:textColor="@color/module_commons_wm_dialog_text_textColor"
android:textColor="@android:color/white"
android:textSize="@dimen/dp_64"
app:layout_constraintLeft_toRightOf="@+id/check_tip_image"
app:layout_constraintTop_toTopOf="@+id/check_tip_image" />

View File

@@ -8,4 +8,19 @@
<item name="android:progressDrawable">@drawable/check_progress</item>
<item name="android:listDivider">@drawable/check_item_left_shape</item>
</style>
<style name="CheckInfoDialogStyle" parent="@android:style/Theme.Dialog">
<item name="android:windowIsFloating">true</item>
<item name="android:windowFrame">@null</item>
<item name="android:windowNoTitle">true</item>
<item name="android:windowBackground">@android:color/transparent</item>
<item name="android:backgroundDimAmount">0.6</item>
<item name="android:backgroundDimEnabled">true</item>
<item name="android:windowContentOverlay">@null</item>
<item name="android:fullBright">@android:color/transparent</item>
<item name="android:fullDark">@android:color/transparent</item>
<item name="android:topBright">@android:color/transparent</item>
<item name="android:topDark">@android:color/transparent</item>
<item name="android:borderlessButtonStyle">@android:color/transparent</item>
</style>
</resources>

View File

@@ -4,7 +4,7 @@ import com.mogo.eagle.core.data.Response
import com.mogo.eagle.core.network.MoGoRetrofitFactory
import com.mogo.eagle.core.network.apiResponseCall
import com.mogo.eagle.core.network.request
import com.mogo.module.common.constants.HostConst
import com.mogo.eagle.core.data.constants.HostConst
import com.zhjt.mogo_core_function_devatools.upgrade.network.HostConst.Companion.getBaseUrl
class UpgradeVersionNetWorkModel {

View File

@@ -66,8 +66,6 @@ public class DispatchAutoPilotManager implements IMogoOnMessageListener<Dispatch
private boolean isDispatch = false;
private boolean isArriveEnd = false;
private IMogoServiceApis mApis;
private DispatchAutoPilotManager() {
}
@@ -104,10 +102,9 @@ public class DispatchAutoPilotManager implements IMogoOnMessageListener<Dispatch
public void initSocket(Context context) {
mContext = context;
mApis = MogoApisHandler.getInstance().getApis();
MogoAiCloudSocketManager.getInstance(context).registerOnMessageListener(MSG_SOCKET_TYPE, this);
mApis.getRegisterCenterApi()
MogoApisHandler.getInstance().getApis().getRegisterCenterApi()
.registerCarLocationChangedListener(TAG, this);
// 添加自动驾驶按钮选中监听
CallerHmiListenerManager.INSTANCE.addCheckAutoPilotBtnListener(TAG, this);

View File

@@ -1,16 +1,26 @@
package com.zhjt.dispatch;
import android.app.Dialog;
import android.content.Context;
import android.os.Build;
import android.view.WindowManager;
import androidx.annotation.NonNull;
import com.mogo.eagle.core.data.dispatch.DispatchAdasAutoPilotLocReceiverBean;
import com.mogo.module.common.dialog.BaseFloatDialog;
public abstract class DispatchBaseDialog extends BaseFloatDialog {
public abstract class DispatchBaseDialog extends Dialog {
public DispatchBaseDialog(@NonNull Context context) {
super(context);
super(context,R.style.Base_AlertDialog_AppCompat);
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
getWindow().setType(WindowManager.LayoutParams.TYPE_APPLICATION_OVERLAY);
} else {
getWindow().setType(WindowManager.LayoutParams.TYPE_SYSTEM_ALERT);
}
getWindow().addFlags(WindowManager.LayoutParams.FLAG_LAYOUT_IN_SCREEN
| WindowManager.LayoutParams.FLAG_TRANSLUCENT_NAVIGATION
| WindowManager.LayoutParams.FLAG_LOCAL_FOCUS_MODE);
}
public abstract void addIDispatchRemindListener(IDispatchRemindClickListener listener);

View File

@@ -1,7 +1,7 @@
package com.zhjt.dispatch.model;
import static com.mogo.commons.context.ContextHolderUtil.getContext;
import static com.mogo.module.common.constants.HostConst.DATA_SERVICE_HOST;
import static com.mogo.eagle.core.data.constants.HostConst.DATA_SERVICE_HOST;
import com.mogo.cloud.passport.MoGoAiCloudClientConfig;
import com.mogo.eagle.core.data.BaseData;
@@ -13,7 +13,6 @@ import com.mogo.eagle.core.network.MoGoRetrofitFactory;
import com.mogo.eagle.core.network.RequestOptions;
import com.mogo.eagle.core.network.SubscribeImpl;
import com.mogo.eagle.core.network.utils.GsonUtil;
import com.mogo.module.common.MogoApisHandler;
import java.util.HashMap;
import java.util.List;

View File

@@ -0,0 +1,18 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<style name="BaseFloatDialogStyle" parent="@android:style/Theme.Dialog">
<item name="android:windowIsFloating">true</item>
<item name="android:windowFrame">@null</item>
<item name="android:windowNoTitle">true</item>
<item name="android:windowBackground">@android:color/transparent</item>
<item name="android:backgroundDimAmount">0.6</item>
<item name="android:backgroundDimEnabled">true</item>
<item name="android:windowContentOverlay">@null</item>
<item name="android:fullBright">@android:color/transparent</item>
<item name="android:fullDark">@android:color/transparent</item>
<item name="android:topBright">@android:color/transparent</item>
<item name="android:topDark">@android:color/transparent</item>
<item name="android:borderlessButtonStyle">@android:color/transparent</item>
</style>
</resources>

View File

@@ -114,7 +114,6 @@ dependencies {
api project(':services:mogo-service-api')
api project(':services:mogo-service')
api project(':modules:mogo-module-service')
api project(':libraries:mogo-map')
api project(':test:crashreport-upgrade')
// api project(':test:crashreport-bugly')

View File

@@ -0,0 +1,73 @@
package com.mogo.eagle.core.function.hmi.dialog;
import android.app.Dialog;
import android.content.Context;
import android.os.Build;
import android.view.Gravity;
import android.view.ViewGroup;
import android.view.WindowManager;
import android.widget.FrameLayout;
import androidx.annotation.NonNull;
import com.mogo.commons.debug.DebugConfig;
import com.mogo.eagle.core.function.hmi.R;
import com.mogo.eagle.core.utilcode.mogo.logger.CallerLogger;
/**
* 浮在各种wm上面的dialog基类调用了window.setType
*
* @author tongchenfei
*/
public class BaseFloatDialog extends Dialog {
private static final String TAG = "BaseFloatDialog";
public BaseFloatDialog(@NonNull Context context) {
this(context, R.style.BaseFloatDialogStyle);
}
public BaseFloatDialog(@NonNull Context context, int themeResId) {
super(context, themeResId);
if (DebugConfig.getCarMachineType() != DebugConfig.CAR_MACHINE_TYPE_BYD) {
addFlag();
}
}
private void addFlag() {
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
getWindow().setType(WindowManager.LayoutParams.TYPE_APPLICATION_OVERLAY);
} else {
getWindow().setType(WindowManager.LayoutParams.TYPE_SYSTEM_ALERT);
}
getWindow().addFlags(WindowManager.LayoutParams.FLAG_LAYOUT_IN_SCREEN
| WindowManager.LayoutParams.FLAG_TRANSLUCENT_NAVIGATION
| WindowManager.LayoutParams.FLAG_LOCAL_FOCUS_MODE);
}
@Override
public void show() {
CallerLogger.INSTANCE.d(TAG, "onShow====");
super.show();
setWindowSize();
}
@Override
public void dismiss() {
CallerLogger.INSTANCE.d( TAG, "onDismiss====");
super.dismiss();
}
private void setWindowSize(){
WindowManager.LayoutParams attributes = getWindow().getAttributes();
attributes.width = ViewGroup.LayoutParams.MATCH_PARENT;
attributes.height = ViewGroup.LayoutParams.MATCH_PARENT;
FrameLayout content = (FrameLayout)findViewById(android.R.id.content);
if(content!=null){
ViewGroup rootView = (ViewGroup) content.getChildAt(0);
FrameLayout.LayoutParams layoutParams = (FrameLayout.LayoutParams) rootView.getLayoutParams();
layoutParams.gravity = Gravity.CENTER;
rootView.setLayoutParams(layoutParams);
}
getWindow().setAttributes(attributes);
}
}

View File

@@ -0,0 +1,56 @@
package com.mogo.eagle.core.function.hmi.dialog;
import android.app.Dialog;
import android.view.View;
import android.view.ViewGroup;
/**
* 采用Dialog实现接口
*/
class DialogImpl implements IWindowManagerView {
private Dialog dialog;
private View contentView;
@Override
public void init(WindowManagerView.WMViewParams params) {
dialog = new BaseFloatDialog(params.mContext);
contentView = params.mContentView;
dialog.setContentView(contentView);
}
@Override
public boolean isShowing() {
return dialog.isShowing();
}
@Override
public void handleTouchEvent(OnViewClickListener listener) {
// do nothings.
}
@Override
public void show() {
dialog.show();
}
@Override
public void update(WindowManagerView.WMViewParams params) {
}
@Override
public void update() {
}
@Override
public void hide() {
/*
* 取得view的父组件然后移除view
*/
if (contentView != null) {
((ViewGroup) contentView.getParent()).removeView(contentView);
}
dialog.dismiss();
}
}

View File

@@ -0,0 +1,49 @@
package com.mogo.eagle.core.function.hmi.dialog;
import android.view.View;
public interface IWindowManagerView {
/**
* 初始化
*
* @param params contentView包装类
*/
void init( WindowManagerView.WMViewParams params );
/**
* 是否显示
*
* @return true - 显示中
*/
boolean isShowing();
/**
* 支持手势拖动,该操作只支持触发点击操作
*/
void handleTouchEvent(OnViewClickListener listener);
/**
* 显示
*/
void show();
/**
* 更新界面位置或大小
* @param params 具体参数
*/
void update(WindowManagerView.WMViewParams params);
/**
* 刷新
*/
void update();
/**
* 隐藏
*/
void hide();
public interface OnViewClickListener {
void onClick( View view, float xPos, float yPos );
}
}

View File

@@ -0,0 +1,140 @@
package com.mogo.eagle.core.function.hmi.dialog;
import android.app.Activity;
import android.content.Context;
import android.content.DialogInterface;
import android.widget.TextView;
import androidx.annotation.StringRes;
import com.mogo.eagle.core.function.hmi.R;
/**
* @author congtaowang
* @since 2020-04-24
* <p>
* 显示在最上层的对话框
*/
public class WMDialog implements DialogInterface {
private WMDialogParams mParams;
private WindowManagerView mWindowManagerView;
private WMDialog( WMDialogParams params ) {
this.mParams = params;
mWindowManagerView = new WindowManagerView.Builder( mParams.mContext ).contentView( R.layout.module_commons_layout_wm_dialog ).build();
initViews();
}
public void show() {
mWindowManagerView.show();
}
private void initViews() {
TextView ok = mWindowManagerView.findViewById( R.id.module_commons_wm_dialog_button_ok );
TextView cancel = mWindowManagerView.findViewById( R.id.module_commons_wm_dialog_button_cancel );
TextView content = mWindowManagerView.findViewById( R.id.module_commons_wm_dialog_content );
ok.setText( mParams.mOkButtonText );
if ( mParams.mOnOkButtonClickListener != null ) {
ok.setOnClickListener( view -> {
if ( mParams.mOnOkButtonClickListener != null ) {
mParams.mOnOkButtonClickListener.onClick( WMDialog.this, DialogInterface.BUTTON_POSITIVE );
}
} );
}
cancel.setText( mParams.mCancelButtonText );
if ( mParams.mOnCancelButtonClickListener != null ) {
cancel.setOnClickListener( view -> {
if ( mParams.mOnCancelButtonClickListener != null ) {
mParams.mOnCancelButtonClickListener.onClick( WMDialog.this, DialogInterface.BUTTON_NEGATIVE );
}
} );
}
content.setText( mParams.mContent );
}
@Override
public void cancel() {
dismiss();
}
@Override
public void dismiss() {
mWindowManagerView.dismiss();
}
public boolean isShowing() {
return mWindowManagerView.isShowing();
}
public static class Builder {
private Context mContext;
private WMDialogParams mParams;
public Builder( Activity activity ) {
this.mContext = activity;
mParams = new WMDialogParams();
mParams.mContext = activity;
}
public Builder setContent( CharSequence content ) {
mParams.mContent = content;
return this;
}
public Builder setContent( @StringRes int content ) {
mParams.mContent = mContext.getString( content );
return this;
}
public Builder setOkButton( CharSequence buttonText, OnClickListener listener ) {
mParams.mOkButtonText = buttonText;
mParams.mOnOkButtonClickListener = listener;
return this;
}
public Builder setOkButton( @StringRes int buttonText, OnClickListener listener ) {
mParams.mOkButtonText = mContext.getText( buttonText );
mParams.mOnOkButtonClickListener = listener;
return this;
}
public Builder setCancelButton( CharSequence buttonText, OnClickListener listener ) {
mParams.mCancelButtonText = buttonText;
mParams.mOnCancelButtonClickListener = listener;
return this;
}
public Builder setCancelButton( @StringRes int buttonText, OnClickListener listener ) {
mParams.mCancelButtonText = mContext.getText( buttonText );
mParams.mOnCancelButtonClickListener = listener;
return this;
}
public Builder setOnDialogDismissListener( OnDismissListener onDialogDismissListener ) {
mParams.mOnDialogDismissListener = onDialogDismissListener;
return this;
}
public WMDialog build() {
WMDialog dialog = new WMDialog( mParams );
return dialog;
}
}
public static class WMDialogParams {
// public CharSequence mTitle;
public CharSequence mOkButtonText;
public CharSequence mCancelButtonText;
public CharSequence mContent;
public OnClickListener mOnOkButtonClickListener;
public OnClickListener mOnCancelButtonClickListener;
public OnDismissListener mOnDialogDismissListener;
public Context mContext;
}
}

View File

@@ -0,0 +1,118 @@
package com.mogo.eagle.core.function.hmi.dialog;
import android.content.Context;
import android.graphics.PixelFormat;
import android.os.Build;
import android.view.MotionEvent;
import android.view.View;
import android.view.WindowManager;
/**
* 采用windowManager实现接口
*/
class WindowManagerImpl implements IWindowManagerView {
private WindowManager mWindowManager;
private WindowManager.LayoutParams mLayoutParams;
private WindowManagerView.WMViewParams mParams;
private boolean isShowing;
private View rootView;
private float mLastX, mLastY;
private int mOldOffsetX, mOldOffsetY;
@Override
public void init( WindowManagerView.WMViewParams params ) {
mParams = params;
mWindowManager = ( WindowManager ) mParams.mContext.getApplicationContext().getSystemService( Context.WINDOW_SERVICE );
generateLayoutParams();
}
private void generateLayoutParams(){
mLayoutParams = new WindowManager.LayoutParams();
if ( Build.VERSION.SDK_INT >= Build.VERSION_CODES.O ) {
mLayoutParams.type = WindowManager.LayoutParams.TYPE_APPLICATION_OVERLAY;
} else {
mLayoutParams.type = WindowManager.LayoutParams.TYPE_SYSTEM_ALERT;
}
mLayoutParams.format = PixelFormat.TRANSLUCENT;
mLayoutParams.gravity = mParams.mGravity;
mLayoutParams.flags = WindowManager.LayoutParams.FLAG_LAYOUT_IN_SCREEN | WindowManager.LayoutParams.FLAG_NOT_TOUCH_MODAL | WindowManager.LayoutParams.FLAG_WATCH_OUTSIDE_TOUCH | WindowManager.LayoutParams.FLAG_NOT_FOCUSABLE;
mLayoutParams.width = mParams.mWidth;
mLayoutParams.height = mParams.mHeight;
mOldOffsetX = mLayoutParams.x = mParams.mX;
mOldOffsetY = mLayoutParams.y = mParams.mY;
mLayoutParams.dimAmount = 0.5f;
}
@Override
public boolean isShowing() {
return isShowing;
}
@Override
public void handleTouchEvent(OnViewClickListener listener) {
mParams.mContentView.setOnTouchListener( ( v, event ) -> {
final int action = event.getAction();
float x = event.getX();
float y = event.getY();
if ( action == MotionEvent.ACTION_DOWN ) {
mLastX = x;
mLastY = y;
} else if ( action == MotionEvent.ACTION_MOVE ) {
mLayoutParams.x += ( int ) ( x - mLastX ) / 3; // 减小偏移量,防止过度抖动
mLayoutParams.y += ( int ) ( y - mLastY ) / 3; // 减小偏移量,防止过度抖动
mWindowManager.updateViewLayout( mParams.mContentView, mLayoutParams );
} else if ( action == MotionEvent.ACTION_UP ) {
int newOffsetX = mLayoutParams.x;
int newOffsetY = mLayoutParams.y;
// 只要按钮一动位置不是很大,就认为是点击事件
if ( Math.abs( mOldOffsetX - newOffsetX ) <= 20
&& Math.abs( mOldOffsetY - newOffsetY ) <= 20 ) {
if ( listener != null ) {
listener.onClick( mParams.mContentView, x, y );
}
return false;
}
mOldOffsetX = newOffsetX;
mOldOffsetY = newOffsetY;
}
return true;
} );
}
@Override
public void show() {
if ( !isShowing ) {
isShowing = true;
rootView = mParams.mContentView;
mWindowManager.addView( mParams.mContentView, mLayoutParams );
}
}
@Override
public void update(WindowManagerView.WMViewParams params) {
if (isShowing) {
mParams = params;
generateLayoutParams();
mWindowManager.updateViewLayout(rootView,mLayoutParams);
}
}
@Override
public void update() {
if ( isShowing ) {
mWindowManager.updateViewLayout(rootView,mLayoutParams);
}
}
@Override
public void hide() {
if ( isShowing && mParams != null ) {
mWindowManager.removeView( mParams.mContentView );
isShowing = false;
}
}
}

View File

@@ -0,0 +1,136 @@
package com.mogo.eagle.core.function.hmi.dialog;
import android.content.Context;
import android.view.LayoutInflater;
import android.view.View;
import androidx.annotation.IdRes;
import androidx.annotation.LayoutRes;
/**
* @author congtaowang
* @since 2020-05-21
* <p>
* 往 window manager 添加view
*/
public class WindowManagerView {
private WMViewParams mParams;
private IWindowManagerView mManagerView;
private WindowManagerView( WMViewParams params, IWindowManagerView view ) {
this.mParams = params;
mManagerView = view;
view.init( params );
}
public boolean isShowing() {
return mManagerView.isShowing();
}
public < T extends View > T findViewById( @IdRes int id ) {
return mParams.mContentView.findViewById( id );
}
public void attachTouchEvent( IWindowManagerView.OnViewClickListener listener ) {
mManagerView.handleTouchEvent(listener);
}
public void show() {
mManagerView.show();
}
public void dismiss() {
mManagerView.hide();
}
public static class Builder {
private WMViewParams mParams = null;
public Builder( Context context ) {
mParams = new WMViewParams();
mParams.mContext = context;
}
public Builder contentView( View contentView ) {
mParams.mContentView = contentView;
return this;
}
public Builder contentView( @LayoutRes int contentViewId ) {
mParams.mContentView = LayoutInflater.from( mParams.mContext ).inflate( contentViewId, null );
return this;
}
public Builder size( int width, int height ) {
mParams.mWidth = width;
mParams.mHeight = height;
return this;
}
public Builder position( int x, int y ) {
mParams.mX = x;
mParams.mY = y;
return this;
}
public Builder gravity( int gravity ) {
mParams.mGravity = gravity;
return this;
}
/**
* 默认dialog实现
*
* @return
*/
public WindowManagerView build() {
return showInDialog();
}
public WindowManagerView showInDialog() {
if ( mParams.mContentView == null ) {
throw new NullPointerException( "WMViewParams#mContentView must not be null." );
}
return new WindowManagerView( mParams, new DialogImpl() );
}
public WindowManagerView showInWindowManager() {
if ( mParams.mContentView == null ) {
throw new NullPointerException( "WMViewParams#mContentView must not be null." );
}
return new WindowManagerView( mParams, new WindowManagerImpl() );
}
}
public static class WMViewParams {
public View mContentView;
public Context mContext;
public int mWidth;
public int mHeight;
public int mX;
public int mY;
public int mGravity;
}
public void exchangeSizeAndPosition(int width, int height, int x, int y) {
if (isShowing()) {
mParams.mX = x;
mParams.mY = y;
mParams.mWidth = width;
mParams.mHeight = height;
mManagerView.update(mParams);
}
}
public void update(){
if ( mManagerView != null) {
mManagerView.update();
}
}
}

View File

@@ -7,7 +7,7 @@ import com.mogo.eagle.core.function.call.hmi.CallerHmiManager
import com.mogo.eagle.core.function.hmi.WaringConst
import com.mogo.eagle.core.utilcode.mogo.logger.CallerLogger
import com.mogo.eagle.core.utilcode.mogo.logger.scene.SceneConstant.Companion.M_HMI
import com.mogo.module.common.enums.EventTypeEnum
import com.mogo.eagle.core.data.enums.EventTypeEnum
/**
* V2X 预警广播接收。用于跨应用,跨进程,内部也可以通过这种方式弹出预警提示框

View File

@@ -23,6 +23,7 @@ import com.alibaba.android.arouter.launcher.ARouter
import com.mogo.cloud.passport.MoGoAiCloudClient
import com.mogo.commons.AbsMogoApplication
import com.mogo.commons.debug.DebugConfig
import com.mogo.eagle.core.data.enums.EventTypeEnum
import com.mogo.commons.mvp.BaseFragment
import com.mogo.commons.mvp.MvpFragment
import com.mogo.commons.voice.*
@@ -83,6 +84,7 @@ import com.mogo.eagle.core.function.hmi.ui.tools.MaskView
import com.mogo.eagle.core.function.hmi.ui.widget.DemoModeView
import com.mogo.eagle.core.function.hmi.ui.widget.StatusBarView
import com.mogo.eagle.core.function.hmi.ui.widget.V2XNotificationView
import com.mogo.eagle.core.function.main.utils.DisplayEffectsHelper
import com.mogo.eagle.core.utilcode.kotlin.*
import com.mogo.eagle.core.utilcode.mogo.AppIdentityModeUtils
import com.mogo.eagle.core.utilcode.mogo.logger.*
@@ -96,7 +98,6 @@ import com.mogo.eagle.core.utilcode.reminder.api.impl.*
import com.mogo.eagle.core.utilcode.util.*
import com.mogo.eagle.core.utilcode.util.TimeUtils.millis2String
import com.mogo.map.MogoMap
import com.mogo.module.common.enums.*
import com.zhidao.support.adas.high.common.MogoReport.Code.Error.EMAP.*
import com.zhjt.mogo_core_function_devatools.badcase.consts.BadCaseConfig
import com.zhjt.service_biz.BizConfig
@@ -133,7 +134,6 @@ class MoGoHmiFragment : MvpFragment<MoGoHmiContract.View?, HmiPresenter?>(),
private var mSOPSettingView: SOPSettingView? = null
//StatusView
private var statusBarViewFloat: WarningFloat.Builder? = null
private var statusBarView: StatusBarView? = null
private var mNoticeFloat: WarningFloat.Builder? = null
@@ -195,10 +195,10 @@ class MoGoHmiFragment : MvpFragment<MoGoHmiContract.View?, HmiPresenter?>(),
}
override fun initViews() {
//toggleStatusBarView()
initViewShowWithConfig()
val decorView = requireActivity().window.decorView as FrameLayout
statusBarView = decorView.findViewWithTag<View>("status_bar") as StatusBarView?
//设置StatusBar初始状态
if (FunctionBuildConfig.isDemoMode) {
statusBarView?.updateRightView(true, "demoMode", DemoModeView(requireContext()))
@@ -592,6 +592,10 @@ class MoGoHmiFragment : MvpFragment<MoGoHmiContract.View?, HmiPresenter?>(),
return HmiPresenter(this)
}
override fun displayEffects() {
DisplayEffectsHelper.getInstance().display()
}
override fun setSpeedChartViewVisibility(visibility: Int) {
viewSpeedChart?.visibility = visibility
}
@@ -746,52 +750,6 @@ class MoGoHmiFragment : MvpFragment<MoGoHmiContract.View?, HmiPresenter?>(),
}
}
private fun toggleStatusBarView() {
activity?.let{
if(statusBarViewFloat!= null){
WarningFloat.dismiss(statusBarViewFloat!!.config.floatTag, false)
statusBarViewFloat = null
statusBarView = null
}else{
if (statusBarView == null){
statusBarView = StatusBarView(it)
}
val side = TOP
val gravity = Gravity.TOP
statusBarViewFloat = WarningFloat.with(it)
.setTag("statusBarView")
.setLayout(statusBarView!!)
.setSidePattern(side)
.setWindowWidth(ScreenUtils.getScreenWidth())
.setWindowHeight(BarUtils.getStatusBarHeight())
.setGravity(gravity, 0)
.setImmersionStatusBar(true)
.setAnimator(object : DefaultAnimator() {
override fun enterAnim(
view: View,
params: LayoutParams,
windowManager: WindowManager,
sidePattern: SidePattern
): Animator? =
super.enterAnim(view, params, windowManager, sidePattern)
?.apply {
interpolator = LinearInterpolator()
}
override fun exitAnim(
view: View,
params: LayoutParams,
windowManager: WindowManager,
sidePattern: SidePattern
): Animator? =
super.exitAnim(view, params, windowManager, sidePattern)
?.setDuration(200)
})
.show()
}
}
}
/**
* 展示VR下V2X预警
*

View File

@@ -1,49 +1,54 @@
package com.mogo.eagle.core.function.hmi.ui.bindingcar
import android.content.Context
import android.util.Log
import android.widget.TextView
import androidx.lifecycle.LifecycleObserver
import com.mogo.commons.module.status.IMogoStatusChangedListener
import com.mogo.commons.module.status.MogoStatusManager
import com.mogo.commons.module.status.StatusDescriptor
import com.mogo.eagle.core.function.call.bindingcar.CallerBindingcarManager
import com.mogo.eagle.core.function.hmi.R
import com.mogo.eagle.core.utilcode.mogo.toast.TipToast
import com.mogo.module.common.dialog.BaseFloatDialog
import com.mogo.service.IMogoServiceApis
import com.mogo.service.statusmanager.IMogoStatusChangedListener
import com.mogo.service.statusmanager.StatusDescriptor
import com.mogo.eagle.core.function.hmi.dialog.BaseFloatDialog
/**
* @brief 修改车辆对话框
* @author lixiaopeng
*/
class ModifyBindingCarDialog(context: Context) : BaseFloatDialog(context), LifecycleObserver{
class ModifyBindingCarDialog(context: Context) : BaseFloatDialog(context), LifecycleObserver {
private val TAG = "BindingCarDialog"
private var confirmTv: TextView? = null
private var cancleTv: TextView? = null
private var cancelTv: TextView? = null
private var mServiceApis: IMogoServiceApis? = null
private val statusChangedListenerForCheckNotice = IMogoStatusChangedListener { descriptor, isTrue ->
if (descriptor == StatusDescriptor.MAIN_PAGE_IS_BACKGROUND) {
dismiss()
private val statusChangedListenerForCheckNotice =
IMogoStatusChangedListener { descriptor, isTrue ->
if (descriptor == StatusDescriptor.MAIN_PAGE_IS_BACKGROUND) {
dismiss()
}
}
}
init {
setContentView(R.layout.dialog_modify_bindingcar)
setCanceledOnTouchOutside(true)
confirmTv = findViewById(R.id.tv_bindingcar_confirm)
cancleTv = findViewById(R.id.tv_bindingcar_cancel)
cancelTv = findViewById(R.id.tv_bindingcar_cancel)
confirmTv?.setOnClickListener {
modifyBindingcar()
}
cancleTv?.setOnClickListener {
cancelTv?.setOnClickListener {
dismiss()
}
MogoStatusManager.getInstance().registerStatusChangedListener(
TAG,
StatusDescriptor.MAIN_PAGE_IS_BACKGROUND,
statusChangedListenerForCheckNotice
)
}
/**
@@ -62,6 +67,11 @@ class ModifyBindingCarDialog(context: Context) : BaseFloatDialog(context), Lifec
override fun dismiss() {
super.dismiss()
MogoStatusManager.getInstance().unregisterStatusChangedListener(
TAG,
StatusDescriptor.MAIN_PAGE_IS_BACKGROUND,
statusChangedListenerForCheckNotice
)
}
fun showModifyBindingcarDialog() {

View File

@@ -3,13 +3,13 @@ package com.mogo.eagle.core.function.hmi.ui.bindingcar
import android.content.Context
import android.widget.TextView
import androidx.lifecycle.LifecycleObserver
import com.mogo.commons.module.status.IMogoStatusChangedListener
import com.mogo.commons.module.status.MogoStatusManager
import com.mogo.commons.module.status.StatusDescriptor
import com.mogo.eagle.core.function.call.bindingcar.CallerBindingcarManager
import com.mogo.eagle.core.function.hmi.R
import com.mogo.eagle.core.utilcode.mogo.toast.TipToast
import com.mogo.module.common.dialog.BaseFloatDialog
import com.mogo.service.IMogoServiceApis
import com.mogo.service.statusmanager.IMogoStatusChangedListener
import com.mogo.service.statusmanager.StatusDescriptor
import com.mogo.eagle.core.function.hmi.dialog.BaseFloatDialog
/**
@@ -20,9 +20,8 @@ class ToBindingCarDialog(context: Context) : BaseFloatDialog(context), Lifecycle
private val TAG = "ToBindingCarDialog"
private var confirmTv: TextView? = null
private var cancleTv: TextView? = null
private var cancelTv: TextView? = null
private var mServiceApis: IMogoServiceApis? = null
private val statusChangedListenerForCheckNotice = IMogoStatusChangedListener { descriptor, isTrue ->
if (descriptor == StatusDescriptor.MAIN_PAGE_IS_BACKGROUND) {
dismiss()
@@ -34,15 +33,21 @@ class ToBindingCarDialog(context: Context) : BaseFloatDialog(context), Lifecycle
setCanceledOnTouchOutside(true)
confirmTv = findViewById(R.id.tv_to_bindingcar_confirm)
cancleTv = findViewById(R.id.tv_to_bindingcar_cancel)
cancelTv = findViewById(R.id.tv_to_bindingcar_cancel)
confirmTv?.setOnClickListener {
toBindingcar()
}
cancleTv?.setOnClickListener {
cancelTv?.setOnClickListener {
dismiss()
}
MogoStatusManager.getInstance().registerStatusChangedListener(
TAG,
StatusDescriptor.MAIN_PAGE_IS_BACKGROUND,
statusChangedListenerForCheckNotice
)
}
/**
@@ -61,6 +66,11 @@ class ToBindingCarDialog(context: Context) : BaseFloatDialog(context), Lifecycle
override fun dismiss() {
super.dismiss()
MogoStatusManager.getInstance().unregisterStatusChangedListener(
TAG,
StatusDescriptor.MAIN_PAGE_IS_BACKGROUND,
statusChangedListenerForCheckNotice
)
}
fun showToBindingcarDialog() {

View File

@@ -1,24 +1,19 @@
package com.mogo.eagle.core.function.hmi.ui.bindingcar
import android.content.Context
import android.opengl.Visibility
import android.util.Log
import android.view.View
import android.widget.TextView
import androidx.lifecycle.LifecycleObserver
import com.mogo.eagle.core.function.call.devatools.CallerDevaToolsManager
import com.mogo.eagle.core.function.hmi.R
import com.mogo.eagle.core.utilcode.util.ToastUtils
import com.mogo.module.common.dialog.BaseFloatDialog
import com.mogo.service.IMogoServiceApis
import com.mogo.service.statusmanager.IMogoStatusChangedListener
import com.mogo.service.statusmanager.StatusDescriptor
import com.mogo.eagle.core.function.hmi.dialog.BaseFloatDialog
/**
* @brief APP升级提示弹框
* @author lixiaopeng
*/
class UpgradeAppDialog(context: Context) : BaseFloatDialog(context), LifecycleObserver{
class UpgradeAppDialog(context: Context) : BaseFloatDialog(context), LifecycleObserver {
private val TAG = "UpgradeAppDialog"
private var confirmTv: TextView? = null
@@ -70,7 +65,13 @@ class UpgradeAppDialog(context: Context) : BaseFloatDialog(context), LifecycleOb
}
// 升级类型 1:提示升级 2:静默升级 3:强制升级
fun showUpgradeAppDialog(name: String, url: String, title: String, content: String, installType: String) {
fun showUpgradeAppDialog(
name: String,
url: String,
title: String,
content: String,
installType: String
) {
if (isShowing) {
return
}

View File

@@ -13,7 +13,7 @@ import com.mogo.eagle.core.utilcode.mogo.logger.CallerLogger
import com.mogo.eagle.core.utilcode.mogo.logger.scene.SceneConstant
import com.mogo.eagle.core.utilcode.util.ToastUtils
import com.mogo.eagle.core.widget.media.video.SimpleVideoPlayer
import com.mogo.module.common.dialog.BaseFloatDialog
import com.mogo.eagle.core.function.hmi.dialog.BaseFloatDialog
import com.shuyu.gsyvideoplayer.GSYVideoManager
import com.shuyu.gsyvideoplayer.builder.GSYVideoOptionBuilder
import com.shuyu.gsyvideoplayer.model.VideoOptionModel

View File

@@ -18,7 +18,7 @@ import com.mogo.eagle.core.function.hmi.R;
import com.mogo.eagle.core.function.hmi.WaringConst;
import com.mogo.eagle.core.function.hmi.notification.WarningFloat;
import com.mogo.eagle.core.utilcode.mogo.glide.GlideApp;
import com.mogo.eagle.core.utilcode.mogo.glide.GlideRoundedCornersTransform;
import com.mogo.eagle.core.utilcode.mogo.glide.transform.GlideRoundedCornersTransform;
import com.mogo.eagle.core.utilcode.util.BitmapHelper;
import com.mogo.eagle.core.utilcode.util.ThreadUtils;

View File

@@ -7,19 +7,19 @@ import android.view.View
import android.widget.ImageView
import android.widget.TextView
import androidx.lifecycle.LifecycleObserver
import com.mogo.commons.module.status.IMogoStatusChangedListener
import com.mogo.commons.module.status.MogoStatusManager
import com.mogo.commons.module.status.StatusDescriptor
import com.mogo.eagle.core.utilcode.mogo.logger.scene.SceneConstant.Companion.M_HMI
import com.mogo.eagle.core.data.notice.NoticeNormalData
import com.mogo.eagle.core.utilcode.mogo.logger.CallerLogger
import com.mogo.eagle.core.function.hmi.R
import com.mogo.eagle.core.utilcode.mogo.glide.GlideApp
import com.mogo.eagle.core.utilcode.mogo.glide.GlideRoundedCornersTransform
import com.mogo.eagle.core.utilcode.mogo.glide.transform.GlideRoundedCornersTransform
import com.mogo.eagle.core.utilcode.util.BitmapHelper
import com.mogo.eagle.core.widget.media.video.NoticeSimpleVideoPlayer
import com.mogo.module.common.MogoApisHandler
import com.mogo.module.common.dialog.BaseFloatDialog
import com.mogo.eagle.core.function.hmi.dialog.BaseFloatDialog
import com.mogo.service.IMogoServiceApis
import com.mogo.service.statusmanager.IMogoStatusChangedListener
import com.mogo.service.statusmanager.StatusDescriptor
import com.shuyu.gsyvideoplayer.GSYVideoManager
import com.shuyu.gsyvideoplayer.builder.GSYVideoOptionBuilder
import com.shuyu.gsyvideoplayer.listener.VideoAllCallBack
@@ -94,13 +94,13 @@ class NoticeCheckDialog(context: Context) : BaseFloatDialog(context), LifecycleO
playVideo(mVideoUrl)
}
mServiceApis = MogoApisHandler.getInstance().apis
mServiceApis?.statusManagerApi?.registerStatusChangedListener(TAG, StatusDescriptor.MAIN_PAGE_IS_BACKGROUND, statusChangedListenerForCheckNotice)
MogoStatusManager.getInstance().registerStatusChangedListener(TAG, StatusDescriptor.MAIN_PAGE_IS_BACKGROUND, statusChangedListenerForCheckNotice)
}
override fun dismiss() {
super.dismiss()
MogoStatusManager.getInstance().unregisterStatusChangedListener(TAG, StatusDescriptor.MAIN_PAGE_IS_BACKGROUND, statusChangedListenerForCheckNotice)
stopLive()
}
@@ -125,7 +125,9 @@ class NoticeCheckDialog(context: Context) : BaseFloatDialog(context), LifecycleO
pushImageView?.let {
GlideApp.with(context).load(noticeNormal.imageUrl).optionalTransform(
GlideRoundedCornersTransform(
20f, GlideRoundedCornersTransform.CornerType.ALL)
20f,
GlideRoundedCornersTransform.CornerType.ALL
)
).into(it)
}
@@ -191,8 +193,12 @@ class NoticeCheckDialog(context: Context) : BaseFloatDialog(context), LifecycleO
playImageView!!.visibility = View.VISIBLE
playImageView!!.setImageResource(R.drawable.notice_video_play)
thumbnailImageView!!.visibility = View.VISIBLE
GlideApp.with(context).load(firstbitmap).optionalTransform(GlideRoundedCornersTransform(
20f, GlideRoundedCornersTransform.CornerType.ALL)).into(thumbnailImageView!!)
GlideApp.with(context).load(firstbitmap).optionalTransform(
GlideRoundedCornersTransform(
20f,
GlideRoundedCornersTransform.CornerType.ALL
)
).into(thumbnailImageView!!)
}

View File

@@ -16,7 +16,7 @@ import com.mogo.eagle.core.function.hmi.R;
import com.mogo.eagle.core.function.hmi.WaringConst;
import com.mogo.eagle.core.function.hmi.notification.WarningFloat;
import com.mogo.eagle.core.utilcode.mogo.glide.GlideApp;
import com.mogo.eagle.core.utilcode.mogo.glide.GlideRoundedCornersTransform;
import com.mogo.eagle.core.utilcode.mogo.glide.transform.GlideRoundedCornersTransform;
/**

View File

@@ -15,27 +15,25 @@ import androidx.recyclerview.widget.StaggeredGridLayoutManager;
import com.mogo.cloud.commons.utils.CoordinateUtils;
import com.mogo.cloud.passport.MoGoAiCloudClientConfig;
import com.mogo.commons.module.status.IMogoStatusChangedListener;
import com.mogo.commons.module.status.MogoStatusManager;
import com.mogo.commons.module.status.StatusDescriptor;
import com.mogo.eagle.core.data.autopilot.AutopilotControlParameters;
import com.mogo.eagle.core.data.notice.NoticeTrafficStyleInfo;
import com.mogo.eagle.core.data.notice.NoticeTrafficStylePushData;
import com.mogo.eagle.core.data.notice.NoticeValue;
import com.mogo.eagle.core.function.api.notice.NoticeNetCallBack;
import com.mogo.eagle.core.function.call.autopilot.CallerAutoPilotManager;
import com.mogo.eagle.core.function.call.autopilot.CallerAutoPilotStatusListenerManager;
import com.mogo.eagle.core.utilcode.mogo.logger.CallerLogger;
import com.mogo.eagle.core.function.call.notice.CallerNoticeManager;
import com.mogo.eagle.core.function.hmi.R;
import com.mogo.eagle.core.utilcode.mogo.glide.GlideApp;
import com.mogo.eagle.core.utilcode.mogo.glide.GlideRoundedCornersTransform;
import com.mogo.eagle.core.utilcode.mogo.glide.transform.GlideRoundedCornersTransform;
import com.mogo.eagle.core.utilcode.mogo.imageloader.MogoImageView;
import com.mogo.eagle.core.utilcode.mogo.logger.CallerLogger;
import com.mogo.eagle.core.utilcode.util.BitmapHelper;
import com.mogo.eagle.core.utilcode.util.DateTimeUtils;
import com.mogo.eagle.core.widget.media.video.NoticeSimpleSmallVideoPlayer;
import com.mogo.module.common.MogoApisHandler;
import com.mogo.module.common.dialog.BaseFloatDialog;
import com.mogo.service.IMogoServiceApis;
import com.mogo.service.imageloader.MogoImageView;
import com.mogo.service.statusmanager.IMogoStatusChangedListener;
import com.mogo.service.statusmanager.StatusDescriptor;
import com.mogo.eagle.core.function.hmi.dialog.BaseFloatDialog;
import com.shuyu.gsyvideoplayer.GSYVideoManager;
import com.shuyu.gsyvideoplayer.builder.GSYVideoOptionBuilder;
import com.shuyu.gsyvideoplayer.listener.VideoAllCallBack;
@@ -64,9 +62,8 @@ public class NoticeTrafficDialog extends BaseFloatDialog implements LifecycleObs
private TextView refuse;//拒绝
private TextView connect;//连接
private NoticeTrafficAdapter adapter;
private final ArrayList dataArrayList = new ArrayList();
private final ArrayList<NoticeValue> dataArrayList = new ArrayList<>();
private NoticeTrafficStyleInfo.NoticeTrafficAccountInfo mTrafficStyleInfo;
private IMogoServiceApis mServiceApis;
public NoticeTrafficDialog(@NonNull Context context, NoticeTrafficStylePushData pushData) {
super(context);
@@ -84,8 +81,7 @@ public class NoticeTrafficDialog extends BaseFloatDialog implements LifecycleObs
setCanceledOnTouchOutside(true);
playerShow();//视频播放器及接操作按钮
recyclerVie();//详情信息列表
mServiceApis = MogoApisHandler.getInstance().getApis();
mServiceApis.getStatusManagerApi().registerStatusChangedListener(M_HMI + TAG, StatusDescriptor.MAIN_PAGE_IS_BACKGROUND, statusChangedListenerForNotice);
MogoStatusManager.getInstance().registerStatusChangedListener(M_HMI + TAG, StatusDescriptor.MAIN_PAGE_IS_BACKGROUND, statusChangedListenerForNotice);
}
/**
@@ -169,7 +165,7 @@ public class NoticeTrafficDialog extends BaseFloatDialog implements LifecycleObs
* 开启自动驾驶
*/
private void startAutoPilot() {
if (mTrafficStyleInfo != null){
if (mTrafficStyleInfo != null) {
AutopilotControlParameters parameters = new AutopilotControlParameters();
parameters.isSpeakVoice = false;
parameters.vehicleType = 10;
@@ -356,13 +352,10 @@ public class NoticeTrafficDialog extends BaseFloatDialog implements LifecycleObs
*/
private void requestTrafficInfo() {
CallerLogger.INSTANCE.d(M_HMI + TAG, "requestTrafficInfo");
CallerNoticeManager.getNoticeProvider().requestAccidentInfo(mPushData.getInfoId(), MoGoAiCloudClientConfig.getInstance().getSn(), new NoticeNetCallBack() {
@Override
public void callBackWithResult(NoticeTrafficStyleInfo trafficInfo) {
CallerLogger.INSTANCE.d(M_HMI + TAG, "交通事故详情::" + trafficInfo);
mTrafficStyleInfo = trafficInfo.getResult().getAccidentInfo();
infoRefresh(mTrafficStyleInfo);
}
CallerNoticeManager.getNoticeProvider().requestAccidentInfo(mPushData.getInfoId(), MoGoAiCloudClientConfig.getInstance().getSn(), trafficInfo -> {
CallerLogger.INSTANCE.d(M_HMI + TAG, "交通事故详情::" + trafficInfo);
mTrafficStyleInfo = trafficInfo.getResult().getAccidentInfo();
infoRefresh(mTrafficStyleInfo);
});
}
@@ -445,6 +438,7 @@ public class NoticeTrafficDialog extends BaseFloatDialog implements LifecycleObs
public void dismiss() {
super.dismiss();
CallerLogger.INSTANCE.d(M_HMI + TAG, "trafficDialog dismiss");
MogoStatusManager.getInstance().unregisterStatusChangedListener(M_HMI + TAG, StatusDescriptor.MAIN_PAGE_IS_BACKGROUND, statusChangedListenerForNotice);
releasePlayer();
}

View File

@@ -76,7 +76,7 @@ import com.mogo.map.MogoMap
import com.mogo.map.MogoMapUIController
import com.mogo.map.uicontroller.VisualAngleMode
import com.mogo.map.uicontroller.VisualAngleMode.*
import com.mogo.module.service.routeoverlay.*
import com.mogo.eagle.core.function.business.routeoverlay.*
import com.zhidao.easysocket.utils.L
import com.zhidao.support.adas.high.other.permission.BackgrounderPermission
import com.zhjt.mogo_core_function_devatools.env.*

View File

@@ -17,8 +17,7 @@ import com.mogo.eagle.core.function.hmi.R
import com.mogo.eagle.core.utilcode.kotlin.currentPadding
import com.mogo.eagle.core.utilcode.mogo.AppIdentityModeUtils
import com.mogo.eagle.core.utilcode.util.ToastUtils
import com.mogo.module.service.routeoverlay.RouteStrategy
import kotlinx.android.synthetic.main.view_debug_setting.view.*
import com.mogo.eagle.core.function.business.routeoverlay.RouteStrategy
import kotlinx.android.synthetic.main.view_sop_setting.view.*
import kotlinx.android.synthetic.main.view_sop_setting.view.tbRouteDynamicEffect

View File

@@ -4,7 +4,7 @@ import android.content.Context
import android.widget.TextView
import androidx.lifecycle.LifecycleObserver
import com.mogo.eagle.core.function.hmi.R
import com.mogo.module.common.dialog.BaseFloatDialog
import com.mogo.eagle.core.function.hmi.dialog.BaseFloatDialog
/**
* @author XuXinChao

View File

@@ -4,7 +4,7 @@ import android.content.Context
import android.widget.TextView
import androidx.lifecycle.LifecycleObserver
import com.mogo.eagle.core.function.hmi.R
import com.mogo.module.common.dialog.BaseFloatDialog
import com.mogo.eagle.core.function.hmi.dialog.BaseFloatDialog
/**
* @author XuXinChao

View File

@@ -18,7 +18,6 @@ import com.mogo.eagle.core.utilcode.mogo.logger.CallerLogger
import com.mogo.eagle.core.utilcode.mogo.logger.scene.SceneConstant.Companion.M_HMI
import com.mogo.eagle.core.utilcode.util.ToastUtils
import com.mogo.eagle.core.utilcode.util.UiThreadHandler
import com.mogo.module.common.MogoApisHandler
import kotlinx.android.synthetic.main.view_autopilot_status.view.*
/**

View File

@@ -1,15 +1,13 @@
package com.mogo.eagle.core.function.hmi.ui.widget
import android.content.*
import android.util.*
import android.view.*
import android.widget.*
import com.mogo.commons.*
import android.content.Context
import android.util.AttributeSet
import android.view.LayoutInflater
import android.view.View
import android.widget.FrameLayout
import com.mogo.eagle.core.function.hmi.R
import com.mogo.eagle.core.function.v2x.events.scenario.scene.airoad.*
import com.mogo.map.*
import com.mogo.map.uicontroller.*
import com.mogo.module.common.constants.*
import com.mogo.map.MogoMapUIController
import com.mogo.map.uicontroller.VisualAngleMode
import kotlinx.android.synthetic.main.view_perspective_switch.view.*
/**
@@ -34,17 +32,20 @@ class PerspectiveSwitchView @JvmOverloads constructor(
if (MogoMapUIController.getInstance().currentMapVisualAngle.isLongSight) {
// MogoMarkerManager.getInstance(AbsMogoApplication.getApp())
// .visibleAllMarkers()
MogoMapUIController.getInstance().changeMapVisualAngle(VisualAngleMode.MODE_MEDIUM_SIGHT, null)
MogoMapUIController.getInstance()
.changeMapVisualAngle(VisualAngleMode.MODE_MEDIUM_SIGHT, null)
textSwitch.setText(R.string.module_map_model_normal)
} else if (MogoMapUIController.getInstance().currentMapVisualAngle.isMediumSight) {
// MogoMarkerManager.getInstance(AbsMogoApplication.getApp())
// .inVisibleWithoutMarkers(DataTypes.TYPE_MARKER_ADAS)
MogoMapUIController.getInstance().changeMapVisualAngle(VisualAngleMode.MODE_LONG_SIGHT, null)
MogoMapUIController.getInstance()
.changeMapVisualAngle(VisualAngleMode.MODE_LONG_SIGHT, null)
textSwitch.setText(R.string.module_map_model_faster)
} else {
// MogoMarkerManager.getInstance(AbsMogoApplication.getApp())
// .visibleAllMarkers()
MogoMapUIController.getInstance().changeMapVisualAngle(VisualAngleMode.MODE_MEDIUM_SIGHT, null)
MogoMapUIController.getInstance()
.changeMapVisualAngle(VisualAngleMode.MODE_MEDIUM_SIGHT, null)
textSwitch.setText(R.string.module_map_model_normal)
}
}

View File

@@ -28,8 +28,10 @@ import com.kwai.koom.base.MonitorManager;
import com.kwai.koom.nativeoom.leakmonitor.LeakMonitor;
import com.kwai.koom.nativeoom.leakmonitor.LeakMonitorConfig;
import com.kwai.koom.nativeoom.leakmonitor.LeakRecord;
import com.mogo.commons.analytics.AnalyticsUtils;
import com.mogo.commons.context.ContextHolderUtil;
import com.mogo.commons.debug.DebugConfig;
import com.mogo.commons.module.status.MogoStatusManager;
import com.mogo.commons.mvp.BaseFragment;
import com.mogo.commons.mvp.MvpActivity;
import com.mogo.commons.mvp.MvpFragment;
@@ -58,10 +60,6 @@ import com.mogo.map.listener.MogoMapListenerHandler;
import com.mogo.map.location.IMogoLocationListener;
import com.mogo.map.uicontroller.EnumMapUI;
import com.mogo.map.uicontroller.IMogoMapUIController;
import com.mogo.module.common.MogoApisHandler;
import com.mogo.service.IMogoServiceApis;
import com.mogo.service.fragmentmanager.FragmentStackTransactionListener;
import com.mogo.service.statusmanager.IMogoStatusManager;
import com.rousetime.android_startup.StartupManager;
import com.rousetime.android_startup.model.LoggerLevel;
import com.rousetime.android_startup.model.StartupConfig;
@@ -85,15 +83,11 @@ import system_master.SystemStatusInfo;
*/
public class MainActivity extends MvpActivity<MainView, MainPresenter> implements MainView,
IMogoLocationListener,
FragmentStackTransactionListener,
IMoGoAutopilotStatusListener {
protected static final String TAG = "MainActivity";
private static final int REQUEST_CODE_DIALOG = 100;
protected IMogoServiceApis mServiceApis;
protected IMogoStatusManager mMogoStatusManager;
protected FrameLayout mFloatingLayout;
protected View mCoverUpLayout;
@@ -103,7 +97,7 @@ public class MainActivity extends MvpActivity<MainView, MainPresenter> implement
private RecyclerView mConnectInfoRV;
private ConnInfoAdapter mConnAdapter;
private List<AutopilotStatusInfo> dataList = new ArrayList<>();
private final List<AutopilotStatusInfo> dataList = new ArrayList<>();
private int mLastStatus = 0x00;
private boolean isFloatingLayerHidden = false;
@@ -218,16 +212,12 @@ public class MainActivity extends MvpActivity<MainView, MainPresenter> implement
properties.put("app_launch_hotStartTime", hotStartTime);
}
}
MogoApisHandler.getInstance().getApis().getAnalyticsApi().track("app_launch_time", properties);
AnalyticsUtils.track("app_launch_time", properties);
}
}
private void init() {
if (mServiceApis == null) {
mServiceApis = MogoApisHandler.getInstance().getApis();
}
mMogoStatusManager = mServiceApis.getStatusManagerApi();
mMogoStatusManager.setMainPageLaunchedStatus(TAG, true);
MogoStatusManager.getInstance().setMainPageLaunchedStatus(TAG, true);
}
private void initConnectInfoRV() {
@@ -275,7 +265,7 @@ public class MainActivity extends MvpActivity<MainView, MainPresenter> implement
loadFunctionFragment();
// TODO 这里临时兼容进入VR模式标记状态机。有些业务OCH会根据状态判断加载
MogoApisHandler.getInstance().getApis().getStatusManagerApi().setVrMode(TAG, true);
MogoStatusManager.getInstance().setVrMode(TAG, true);
// 设置地图样式
MogoMapListenerHandler.getInstance().onMapModeChanged(EnumMapUI.MAP_STYLE_DAY_VR);
});
@@ -286,21 +276,11 @@ public class MainActivity extends MvpActivity<MainView, MainPresenter> implement
loadFunctionMapView();
}
@Override
public void onTransaction(int size) {
if (size == 0) {
showLayout();
} else if (size == 1) {
hideLayout();
}
}
/**
* 加载其它模块
*/
protected void loadOthersModules() {
// 加载地图,触发地图加载完毕回调,在初始化其他卡片模块,保证卡片模块可以正确获取地图相关服务。
MogoModulesManager.getInstance().loadModules();
MogoModulesManager.getInstance().loadFunctionModules();
mPresenter.delayOperations();
MogoModulesManager.getInstance().loadFunctionModulesServer();
@@ -317,8 +297,8 @@ public class MainActivity extends MvpActivity<MainView, MainPresenter> implement
* 启动后台服务
*/
private void startBaseService() {
Intent intentMainServicee = new Intent(this, MogoMainService.class);
startService(intentMainServicee);
Intent intentMainService = new Intent(this, MogoMainService.class);
startService(intentMainService);
// USB 摄像头行车记录仪进程
// Intent intentCarcorderService = new Intent(this, CarcorderService.class);
@@ -404,23 +384,20 @@ public class MainActivity extends MvpActivity<MainView, MainPresenter> implement
@Override
protected void onResume() {
super.onResume();
mMogoStatusManager.setMainPageResumeStatus(TAG, true);
mMogoStatusManager.setMainPageIsBackgroundStatus(TAG, false);
MogoStatusManager.getInstance().setMainPageResumeStatus(TAG, true);
MogoStatusManager.getInstance().setMainPageIsBackgroundStatus(TAG, true);
}
@Override
protected void onPause() {
super.onPause();
mMogoStatusManager.setMainPageResumeStatus(TAG, false);
MogoStatusManager.getInstance().setMainPageResumeStatus(TAG, false);
}
@Override
protected void onStop() {
super.onStop();
if (mMogoStatusManager != null) {
mMogoStatusManager.setMainPageIsBackgroundStatus(TAG, true);
}
MogoStatusManager.getInstance().setMainPageIsBackgroundStatus(TAG, true);
}
@Override
@@ -431,15 +408,6 @@ public class MainActivity extends MvpActivity<MainView, MainPresenter> implement
@Override
protected void onNewIntent(Intent intent) {
super.onNewIntent(intent);
mPresenter.handleSchemeIntent(intent, true);
}
@Override
public IMogoServiceApis getApis() {
if (mServiceApis == null) {
mServiceApis = MogoApisHandler.getInstance().getApis();
}
return mServiceApis;
}
@Override
@@ -492,17 +460,16 @@ public class MainActivity extends MvpActivity<MainView, MainPresenter> implement
listenerRegister.unregisterMarkerClickListener();
listenerRegister.unregisterHostMapListener();
}
mMogoStatusManager.setMainPageLaunchedStatus(TAG, false);
mMogoStatusManager.setMainPageIsBackgroundStatus(TAG, false);
IMogoMapUIController mapUIController = CallerMapUIServiceManager.INSTANCE.getMapUIController();
if (mapUIController != null) {
mapUIController.destroy();
}
MogoStatusManager.getInstance().setMainPageLaunchedStatus(TAG, false);
MogoStatusManager.getInstance().setMainPageIsBackgroundStatus(TAG, false);
CallerLogger.INSTANCE.d(M_HMI + TAG, "destroy.");
ContextHolderUtil.releaseContext();
MogoModulesManager.getInstance().onDestroy();
SchemeIntent.getInstance().clear();
FloatingViewHandler.clear();
ProcessUtils.killAllBackgroundProcesses();
}

View File

@@ -13,7 +13,6 @@ import android.os.Bundle;
import android.os.Handler;
import android.os.Process;
import android.text.TextUtils;
import android.util.Log;
import android.view.KeyEvent;
import android.view.MotionEvent;
import android.widget.FrameLayout;
@@ -22,12 +21,13 @@ import androidx.annotation.Nullable;
import com.alibaba.android.arouter.launcher.ARouter;
import com.mogo.commons.debug.DebugConfig;
import com.mogo.commons.module.intent.IMogoIntentListener;
import com.mogo.commons.module.intent.IntentManager;
import com.mogo.eagle.core.data.config.FunctionBuildConfig;
import com.mogo.eagle.core.function.api.base.IMoGoFunctionProvider;
import com.mogo.eagle.core.function.api.setting.IMoGoSkinModeChangeListener;
import com.mogo.eagle.core.function.call.autopilot.CallerAutoPilotManager;
import com.mogo.eagle.core.function.call.autopilot.CallerAutoPilotStatusListenerManager;
import com.mogo.eagle.core.function.call.hmi.CallerHmiManager;
import com.mogo.eagle.core.function.call.setting.CallerSkinModeListenerManager;
import com.mogo.eagle.core.function.hmi.R;
import com.mogo.eagle.core.function.main.moujie.BluetoothMonitorReceiver;
@@ -36,8 +36,6 @@ import com.mogo.eagle.core.utilcode.mogo.AppIdentityModeUtils;
import com.mogo.eagle.core.utilcode.mogo.logger.CallerLogger;
import com.mogo.eagle.core.utilcode.mogo.storage.SharedPrefsMgr;
import com.mogo.eagle.core.utilcode.util.ToastUtils;
import com.mogo.eagle.core.utilcode.util.UiThreadHandler;
import com.mogo.service.intent.IMogoIntentListener;
import com.rousetime.android_startup.model.CostTimesModel;
import com.zhjt.service.chain.ChainLog;
import com.zhjt.service.chain.TracingConstants;
@@ -48,7 +46,6 @@ import org.greenrobot.eventbus.ThreadMode;
import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Method;
import java.util.ArrayList;
import java.util.List;
import java.util.Set;
import java.util.Timer;
@@ -73,7 +70,7 @@ public class MainLauncherActivity extends MainActivity implements IMogoIntentLis
private BluetoothMonitorReceiver mBluetoothReceiver = null;
private BluetoothAdapter mBluetoothAdapter;
// private List<BluetoothDevice> mAreadlyConnectedList = new ArrayList<>();//已连接设备集合
// private List<BluetoothDevice> mAreadlyConnectedList = new ArrayList<>();//已连接设备集合
private int numberA = 0;
private boolean isLongPressA = false;
private int numberB = 0;
@@ -123,7 +120,7 @@ public class MainLauncherActivity extends MainActivity implements IMogoIntentLis
@Override
protected void onStart() {
super.onStart();
getApis().getIntentManagerApi().registerIntentListener(Intent.ACTION_CLOSE_SYSTEM_DIALOGS, this);
IntentManager.getInstance().registerIntentListener(Intent.ACTION_CLOSE_SYSTEM_DIALOGS, this);
// 添加换肤监听
CallerSkinModeListenerManager.INSTANCE.addListener(TAG, this);
//ActivityLifecycleManager.getInstance().setAppActive(true);
@@ -138,7 +135,7 @@ public class MainLauncherActivity extends MainActivity implements IMogoIntentLis
@Override
protected void onStop() {
super.onStop();
getApis().getIntentManagerApi().unregisterIntentListener(Intent.ACTION_CLOSE_SYSTEM_DIALOGS, this);
IntentManager.getInstance().unregisterIntentListener(Intent.ACTION_CLOSE_SYSTEM_DIALOGS, this);
//ActivityLifecycleManager.getInstance().setAppActive(false);
}
@@ -381,7 +378,6 @@ public class MainLauncherActivity extends MainActivity implements IMogoIntentLis
/**
* 查找蓝牙连接过的蓝牙设备
*
*/
private void showBondedDevice(BluetoothAdapter bluetoothAdapter) {
// mAreadlyConnectedList.clear();

View File

@@ -10,6 +10,8 @@ import com.elegant.utils.UiThreadHandler;
import com.mogo.cloud.socket.SocketBuildConfig;
import com.mogo.commons.AbsMogoApplication;
import com.mogo.commons.debug.DebugConfig;
import com.mogo.commons.module.MogoModule;
import com.mogo.commons.module.MogoModulePaths;
import com.mogo.commons.voice.AIAssist;
import com.mogo.eagle.core.data.config.FunctionBuildConfig;
import com.mogo.eagle.core.data.constants.MoGoConfig;
@@ -17,7 +19,6 @@ import com.mogo.eagle.core.data.constants.MogoServicePaths;
import com.mogo.eagle.core.function.api.chat.biz.ChatConsts;
import com.mogo.eagle.core.function.call.bindingcar.CallerBindingcarManager;
import com.mogo.eagle.core.function.call.devatools.CallerDevaToolsManager;
import com.mogo.eagle.core.function.notice.PushUIConstants;
import com.mogo.eagle.core.function.overview.OverviewDb;
import com.mogo.eagle.core.utilcode.mogo.AppIdentityModeUtils;
import com.mogo.eagle.core.utilcode.mogo.AppLaunchTimeUtils;
@@ -25,9 +26,6 @@ import com.mogo.eagle.core.utilcode.mogo.logger.CallerLogger;
import com.mogo.eagle.core.utilcode.mogo.storage.SharedPrefsMgr;
import com.mogo.eagle.core.utilcode.util.ProcessUtils;
import com.mogo.map.MapApiPath;
import com.mogo.module.common.MogoModule;
import com.mogo.module.common.MogoModulePaths;
import com.mogo.module.service.ServiceConst;
import com.zhidao.support.obu.ami.AmiClientManager;
import com.zhjt.mogo_core_function_devatools.monitor.db.CpuInfo;
import com.zhjt.mogo_core_function_devatools.monitor.db.MemInfo;
@@ -138,7 +136,6 @@ public abstract class MainMoGoApplication extends AbsMogoApplication {
MogoModulePaths.addModuleFunction(new MogoModule("/och/api", "IMoGoFunctionProvider"));
MogoModulePaths.addBaseModule(new MogoModule(MapApiPath.PATH, "CustomMapApiBuilder"));
MogoModulePaths.addBaseModule(new MogoModule(ServiceConst.PATH_REFRESH_STRATEGY, ServiceConst.PATH_REFRESH_STRATEGY));
// MogoModulePaths.addBaseModule(new MogoModule(V2XConst.PATH_V2X_UI, V2XConst.MODULE_NAME));
// OBU 模块
@@ -155,8 +152,6 @@ public abstract class MainMoGoApplication extends AbsMogoApplication {
MogoModulePaths.addBaseModule(new MogoModule(MogoServicePaths.PATH_V2X_MODULE, "V2XProvider"));
// 自动驾驶系统检测模块
MogoModulePaths.addBaseModule(new MogoModule(MogoServicePaths.PATH_CHECK, "CheckProvider"));
// 推送模块
MogoModulePaths.addModule(new MogoModule(PushUIConstants.PATH, "PUSH_UI"));
// 绑定车辆
MogoModulePaths.addModuleFunctionServer(new MogoModule(MogoServicePaths.PATH_BINDING_CAR, "IMoGoBindingcarProvider"));

View File

@@ -2,7 +2,6 @@ package com.mogo.eagle.core.function.main;
import android.Manifest;
import android.app.Activity;
import android.content.Intent;
import android.content.pm.PackageManager;
import android.os.Handler;
import android.os.Looper;
@@ -43,7 +42,6 @@ public class MainPresenter extends Presenter<MainView> {
public MainPresenter(MainView view) {
super(view);
SchemeIntent.getInstance().init(getContext(), mView.getApis());
}
@Override
@@ -109,7 +107,4 @@ public class MainPresenter extends Presenter<MainView> {
mMsgHandler.sendMessage(msg);
}
public void handleSchemeIntent(Intent intent, boolean isOnNewIntent) {
SchemeIntent.getInstance().handle(intent, isOnNewIntent);
}
}

View File

@@ -26,11 +26,4 @@ public interface MainView extends IView {
*/
void loadModules();
/**
* 接口水龙头
*
* @return
*/
IMogoServiceApis getApis();
}

View File

@@ -1,204 +0,0 @@
package com.mogo.eagle.core.function.main;
import static com.mogo.eagle.core.utilcode.mogo.logger.scene.SceneConstant.M_HMI;
import android.content.Context;
import android.content.Intent;
import android.net.Uri;
import android.text.TextUtils;
import com.mogo.eagle.core.utilcode.mogo.logger.CallerLogger;
import com.mogo.eagle.core.utilcode.util.CommonUtils;
import com.mogo.eagle.core.utilcode.util.UiThreadHandler;
import com.mogo.service.IMogoServiceApis;
import com.mogo.service.statusmanager.IMogoStatusChangedListener;
import com.mogo.service.statusmanager.StatusDescriptor;
import java.util.HashMap;
import java.util.Map;
/**
* @author congtaowang
* @since 2020-04-20
* <p>
* scheme 意图处理
* <p>
* 导航adb shell am start -d "mogo://launcher/main/switch2?type=navi'&'lon=116.327007'&'lat=39.977639"
*/
public class SchemeIntent implements IMogoStatusChangedListener {
private static final String TAG = "SchemeIntent";
public static final String TYPE_NAVI = "navi";
public static final String TYPE_SEARCH_ROAD_CONDITION = "search-road-condition";
public static final String TYPE_LAUNCH = "launch";
public static final String TYPE_SHOW_ONLINE_CAR_PANEL = "showOnlineCarPanel";
public static final String TYPE_SHOW_SHARE_PANEL = "showSharePanel";
public static final String TYPE_SHOW_HISTORY_PANEL = "showHistoryPanel";
public static final String TYPE_SHOW_SURROUNDING_PANEL = "showSurroundingPanel";
private IMogoServiceApis mApis;
private Context mContext;
private IntentWrapper mNextIntent;
private static class IntentWrapper {
public Intent mIntent;
public long mDelay;
public IntentWrapper(Intent intent, long delay) {
this.mIntent = intent;
this.mDelay = delay;
}
}
private static volatile SchemeIntent sInstance;
private SchemeIntent() {
}
public static SchemeIntent getInstance() {
if (sInstance == null) {
synchronized (SchemeIntent.class) {
if (sInstance == null) {
sInstance = new SchemeIntent();
}
}
}
return sInstance;
}
public synchronized void release() {
sInstance = null;
}
public void init(Context context, IMogoServiceApis apis) {
mContext = context;
mApis = apis;
mApis.getStatusManagerApi().registerStatusChangedListener(TAG, StatusDescriptor.MAIN_PAGE_RESUME, this);
}
public void clear() {
mApis.getStatusManagerApi().unregisterStatusChangedListener(TAG, StatusDescriptor.MAIN_PAGE_RESUME, this);
mContext = null;
mApis = null;
}
/**
* 处理scheme
*
* @param intent 跳转的intent
* @param isOnNewIntent 根据这个参数判断是从onCreate过来还是从onNewIntent过来从而可以在{@link #isDelay(Intent, boolean)}里面确定延时逻辑如果是从onNewIntent过来是不需要延时的
*/
public void handle(Intent intent, boolean isOnNewIntent) {
if (intent == null || intent.getData() == null) {
return;
}
Uri target = intent.getData();
String path = target.getPath();
if (path == null || path.isEmpty()) {
return;
}
if (!mApis.getStatusManagerApi().isMainPageOnResume()) {
long delay = 0L;
if (isDelay(intent, isOnNewIntent)) {
delay = 5_000L;
}
mNextIntent = new IntentWrapper(intent, delay);
return;
}
switch (path) {
case "/main/switch2":
handleSwitch2Action(target);
break;
case "/main/share":
CallerLogger.INSTANCE.d(M_HMI + TAG, "收到打开分享框的scheme准备打开分享框");
// Map<String, Object> properties = new HashMap<>();
// properties.put("from", "1");
// mApis.getAnalyticsApi().track("v2x_share_click", properties);
// mApis.getShareManager().showShareDialog();
break;
default:
break;
}
mNextIntent = null;
}
private boolean isDelay(Intent intent, boolean isOnNewIntent) {
if (isOnNewIntent || intent == null || intent.getData() == null) {
return false;
}
Uri target = intent.getData();
String type = target.getQueryParameter("type");
return TextUtils.equals(TYPE_NAVI, type) || TextUtils.equals(TYPE_SHOW_SHARE_PANEL, type);
}
private void handleSwitch2Action(Uri target) {
String type = target.getQueryParameter("type");
if (TextUtils.isEmpty(type)) {
return;
}
CallerLogger.INSTANCE.d(M_HMI + TAG, "语音打开事件面板" + type);
switch (type) {
case TYPE_LAUNCH:
handleLaunchIntent(target);
break;
case TYPE_SHOW_HISTORY_PANEL:
handleShowEventPanel(0);
break;
case TYPE_SHOW_SURROUNDING_PANEL:
handleShowEventPanel(1);
break;
case TYPE_SHOW_SHARE_PANEL:
handleShowEventPanel(2);
break;
default:
break;
}
}
private void handleLaunchIntent(Uri uri) {
String type = uri.getQueryParameter("channelType");
Map<String, Object> properties = new HashMap<>();
properties.put("appname", CommonUtils.getAppName(mContext));
properties.put("appversion", CommonUtils.getVersionName(mContext));
properties.put("from", type);
mApis.getAnalyticsApi().track("appenterfront", properties);
}
/**
* 语音打开事件面板
*/
private void handleShowEventPanel(int item) {
CallerLogger.INSTANCE.d(M_HMI + TAG, "语音打开事件面板" + item);
//mApis.getEventPanelManager().showPanelWithSelectedItem(item);
}
@Override
public void onStatusChanged(StatusDescriptor descriptor, boolean isTrue) {
if (descriptor == StatusDescriptor.MAIN_PAGE_RESUME) {
if (mNextIntent == null) {
return;
}
if (isTrue) {
// 保证回到桌面后在开始该规划路线。
UiThreadHandler.postDelayed(() -> {
if (mNextIntent == null) {
return;
}
handle(mNextIntent.mIntent, false);
}, mNextIntent.mDelay);
}
}
}
}

View File

@@ -8,11 +8,6 @@ package com.mogo.eagle.core.function.main.cards;
*/
public interface MogoModulesHandler {
/**
* 加载模块
*/
void loadModules();
/**
* 架构升级v1.1加载功能模块
*/
@@ -27,7 +22,6 @@ public interface MogoModulesHandler {
* 加载基本服务模块,需要不启动页面就能运行
* <p>
* 1. v2x
* 2. mogo-module-service
*/
void loadBaseModule();

View File

@@ -5,18 +5,14 @@ import static com.mogo.eagle.core.utilcode.mogo.logger.scene.SceneConstant.M_HMI
import android.app.Application;
import android.content.Context;
import androidx.fragment.app.Fragment;
import com.alibaba.android.arouter.facade.template.IProvider;
import com.alibaba.android.arouter.launcher.ARouter;
import com.mogo.commons.module.MogoModule;
import com.mogo.commons.module.MogoModulePaths;
import com.mogo.eagle.core.function.api.base.IMoGoFunctionProvider;
import com.mogo.eagle.core.function.api.base.IMoGoFunctionServerProvider;
import com.mogo.eagle.core.utilcode.mogo.logger.CallerLogger;
import com.mogo.eagle.core.function.main.MainActivity;
import com.mogo.eagle.core.utilcode.mogo.toast.ResourcesHelper;
import com.mogo.module.common.MogoModule;
import com.mogo.module.common.MogoModulePaths;
import com.mogo.service.module.IMogoModuleProvider;
import com.mogo.eagle.core.utilcode.mogo.logger.CallerLogger;
import java.util.Collection;
import java.util.HashMap;
@@ -35,18 +31,15 @@ public class MogoModulesManager implements MogoModulesHandler {
private MainActivity mActivity;
private Application mApp;
private Map<MogoModule, IMogoModuleProvider> mModuleProviders = new HashMap<>();
// 空间换效率
private Map<String, IMogoModuleProvider> mModuleNameProviders = new HashMap<>();
private static final byte[] obj = new byte[0];
// 架构升级后的加载功能模块的方式
private Map<MogoModule, IMoGoFunctionProvider> mModuleFunctionProviders = new HashMap<>();
private Map<String, IMoGoFunctionProvider> mModuleNameFunctionProviders = new HashMap<>();
private final Map<MogoModule, IMoGoFunctionProvider> mModuleFunctionProviders = new HashMap<>();
private final Map<String, IMoGoFunctionProvider> mModuleNameFunctionProviders = new HashMap<>();
// 架构升级后的加载功能模块的方式
private Map<MogoModule, IMoGoFunctionServerProvider> mModuleFunctionServerProviders = new HashMap<>();
private Map<String, IMoGoFunctionServerProvider> mModuleNameFunctionServerProviders = new HashMap<>();
private final Map<MogoModule, IMoGoFunctionServerProvider> mModuleFunctionServerProviders = new HashMap<>();
private final Map<String, IMoGoFunctionServerProvider> mModuleNameFunctionServerProviders = new HashMap<>();
private static volatile MogoModulesManager sInstance;
@@ -55,7 +48,7 @@ public class MogoModulesManager implements MogoModulesHandler {
public static MogoModulesManager getInstance() {
if (sInstance == null) {
synchronized (MogoModulesManager.class) {
synchronized (obj) {
if (sInstance == null) {
sInstance = new MogoModulesManager();
}
@@ -84,21 +77,6 @@ public class MogoModulesManager implements MogoModulesHandler {
return mApp;
}
@Override
public void loadModules() {
final List<MogoModule> modules = MogoModulePaths.getModules();
if (modules != null && !modules.isEmpty()) {
for (MogoModule module : modules) {
CallerLogger.INSTANCE.d(M_HMI + TAG, "module.getPath():" + module.getPath() + " name: " + module.getName());
IMogoModuleProvider provider = load(module.getPath());
if (provider != null) {
mModuleProviders.put(module, provider);
mModuleNameProviders.put(module.getName(), provider);
}
}
}
}
@Override
public void loadFunctionModules() {
final List<MogoModule> modules = MogoModulePaths.getModuleFunctions();
@@ -151,15 +129,6 @@ public class MogoModulesManager implements MogoModulesHandler {
}
}
private IMogoModuleProvider load(String path) {
try {
return (IMogoModuleProvider) ARouter.getInstance().build(path).navigation(getContext());
} catch (Exception e) {
e.printStackTrace();
return null;
}
}
private IMoGoFunctionProvider loadFunction(String path) {
try {
return (IMoGoFunctionProvider) ARouter.getInstance().build(path).navigation(getContext());
@@ -178,45 +147,8 @@ public class MogoModulesManager implements MogoModulesHandler {
}
}
private void addFragment(IMogoModuleProvider provider, int containerId) {
if (provider == null) {
CallerLogger.INSTANCE.e(M_HMI + TAG, "add fragment fail cause provider == null, container is " + ResourcesHelper.getResNameById(getApplicationContext(), containerId));
return;
}
Fragment fragment = null;
fragment = mActivity.getSupportFragmentManager().findFragmentByTag(provider.getModuleName());
if (fragment == null) {
fragment = provider.createFragment(getContext(), null);
}
if (fragment == null) {
CallerLogger.INSTANCE.e(M_HMI + TAG, "add fragment fail cause fragment == null, container is " + ResourcesHelper.getResNameById(getApplicationContext(), containerId));
return;
}
mActivity.getSupportFragmentManager().beginTransaction()
.replace(containerId, fragment, provider.getModuleName())
.commitAllowingStateLoss();
}
@Override
public void onDestroy() {
if (mModuleNameProviders != null) {
Collection<IMogoModuleProvider> modules = mModuleNameProviders.values();
if (modules != null) {
for (IMogoModuleProvider module : modules) {
try {
CallerLogger.INSTANCE.d(M_HMI + TAG, "destroy module: " + module.getModuleName());
module.onDestroy();
} catch (Exception e) {
CallerLogger.INSTANCE.e(M_HMI + TAG, e + " onDestroy");
}
}
}
mModuleNameProviders.clear();
}
if (mModuleProviders != null) {
mModuleProviders.clear();
}
if (mModuleFunctionProviders != null) {
Collection<IMoGoFunctionProvider> modules = mModuleFunctionProviders.values();
if (modules != null) {

View File

@@ -21,8 +21,6 @@ import com.mogo.eagle.core.utilcode.util.UiThreadHandler;
import com.mogo.map.location.IMogoLocationClient;
import com.mogo.map.location.IMogoLocationListener;
import com.mogo.map.navi.MogoCarLocationChangedListenerRegister;
import com.mogo.module.common.MogoApisHandler;
import com.mogo.service.IMogoServiceApis;
public
/**
@@ -35,7 +33,6 @@ public
class MogoMainService extends Service implements IMogoLocationListener {
private static final String TAG = "MogoMainService";
private IMogoServiceApis mServiceApis;
/**
* 主模块管控定位,可以向各个模块发送统一定位信息
@@ -45,7 +42,6 @@ class MogoMainService extends Service implements IMogoLocationListener {
@Override
public void onCreate() {
CallerLogger.INSTANCE.d(M_HMI + TAG, "基本服务启动");
mServiceApis = MogoApisHandler.getInstance().getApis();
initAndStartLocation();
UiThreadHandler.postDelayed(() -> {
CallerLogger.INSTANCE.d(M_HMI + TAG, "5秒已过启动基础服务……");
@@ -106,6 +102,5 @@ class MogoMainService extends Service implements IMogoLocationListener {
mLocationClient.destroy();
mLocationClient = null;
}
mServiceApis = null;
}
}

View File

@@ -1,27 +0,0 @@
package com.mogo.eagle.core.function.main.utils;
import android.content.Context;
import com.alibaba.android.arouter.facade.annotation.Route;
import com.mogo.eagle.core.data.constants.MogoServicePaths;
import com.mogo.service.v2x.DisplayEffectsInterface;
/**
* created by wujifei on 2021/3/30 15:45
* describe:
*/
@Route(path = MogoServicePaths.PATH_MAIN_DISPLAY_EFFECTS_MANAGER)
public class DisplayEffectsManager implements DisplayEffectsInterface {
private Context context;
@Override
public void init(Context context) {
this.context = context;
}
@Override
public void displayEffects(String type) {
DisplayEffectsHelper.getInstance().display();
}
}

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

@@ -1,7 +1,7 @@
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="rectangle">
<corners android:radius="@dimen/module_push_clear_bg_radius" />
<solid android:color="#FF494B66 "/>
<corners android:radius="@dimen/dp_30" />
<gradient android:startColor="#3F4057" android:endColor="#2A2B38"/>
</shape>

View File

@@ -0,0 +1,11 @@
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="rectangle">
<gradient
android:angle="180"
android:endColor="#3E7FFC"
android:startColor="#5CC1FF" />
<corners android:bottomLeftRadius="@dimen/dp_30" />
</shape>

View File

@@ -0,0 +1,12 @@
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="rectangle">
<gradient
android:angle="180"
android:endColor="#50526E"
android:startColor="#333F4057" />
<corners android:bottomRightRadius="@dimen/dp_30" />
</shape>

View File

@@ -0,0 +1,55 @@
<?xml version="1.0" encoding="utf-8"?>
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@color/color_99000000"
android:layout_gravity="center">
<androidx.constraintlayout.widget.ConstraintLayout
android:layout_width="@dimen/dp_790"
android:layout_height="@dimen/dp_440"
android:layout_gravity="center"
android:background="@drawable/module_commons_shape_dlg_round_bkg">
<TextView
android:id="@+id/module_commons_wm_dialog_content"
android:layout_width="wrap_content"
android:layout_height="@dimen/dp_56"
android:layout_marginTop="@dimen/dp_134"
android:maxLines="1"
android:textColor="@android:color/white"
android:textSize="@dimen/dp_40"
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintRight_toRightOf="parent"
app:layout_constraintTop_toTopOf="parent"
tools:text="是否退出导航导航导航导航导航导航导航导航导航导航导航导航导航导航导航导航?" />
<TextView
android:id="@+id/module_commons_wm_dialog_button_ok"
android:layout_width="@dimen/dp_395"
android:layout_height="@dimen/dp_128"
android:background="@drawable/module_commons_shape_left_btn_bkg"
android:gravity="center"
android:textColor="@android:color/white"
android:textSize="@dimen/dp_40"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintLeft_toLeftOf="parent"
tools:text="确认" />
<TextView
android:id="@+id/module_commons_wm_dialog_button_cancel"
android:layout_width="@dimen/dp_395"
android:layout_height="@dimen/dp_128"
android:background="@drawable/module_commons_shape_right_btn_bkg"
android:gravity="center"
android:textColor="@android:color/white"
android:textSize="@dimen/dp_40"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintRight_toRightOf="parent"
tools:text="取消" />
</androidx.constraintlayout.widget.ConstraintLayout>
</FrameLayout>

View File

@@ -79,7 +79,7 @@
app:layout_constraintTop_toBottomOf="@+id/module_push_dialog_acc_title" />
<!--缩略图-->
<com.mogo.service.imageloader.MogoImageView
<com.mogo.eagle.core.utilcode.mogo.imageloader.MogoImageView
android:id="@+id/thumbnail_image"
android:layout_width="@dimen/module_push_dialog_check_acc_image_width"
android:layout_height="@dimen/module_push_dialog_check_acc_image__height"

View File

@@ -43,7 +43,7 @@
app:layout_constraintRight_toRightOf="parent"
app:layout_constraintTop_toBottomOf="@+id/notice_traffic_dialog_title" />
<!---->
<com.mogo.service.imageloader.MogoImageView
<com.mogo.eagle.core.utilcode.mogo.imageloader.MogoImageView
android:id="@+id/thumbnail_image"
android:layout_width="0dp"
android:layout_height="0dp"

View File

@@ -53,4 +53,19 @@
<attr name="defaultColor" format="color"/> <!--档位默认色值-->
<attr name="selectColor" format="color"/> <!--当前档位色值-->
</declare-styleable>
<style name="BaseFloatDialogStyle" parent="@android:style/Theme.Dialog">
<item name="android:windowIsFloating">true</item>
<item name="android:windowFrame">@null</item>
<item name="android:windowNoTitle">true</item>
<item name="android:windowBackground">@android:color/transparent</item>
<item name="android:backgroundDimAmount">0.6</item>
<item name="android:backgroundDimEnabled">true</item>
<item name="android:windowContentOverlay">@null</item>
<item name="android:fullBright">@android:color/transparent</item>
<item name="android:fullDark">@android:color/transparent</item>
<item name="android:topBright">@android:color/transparent</item>
<item name="android:topDark">@android:color/transparent</item>
<item name="android:borderlessButtonStyle">@android:color/transparent</item>
</style>
</resources>

View File

@@ -40,6 +40,7 @@
<color name="color_FF2966EC">#FF2966EC</color>
<color name="color_FFA7B6F0">#FFA7B6F0</color>
<color name="color_B3FFFFFF">#B3FFFFFF</color>
<color name="color_99000000">#99000000</color>
<color name="version_latest_start_color">#6D7BAF</color>

View File

@@ -94,7 +94,6 @@ dependencies {
implementation project(":libraries:mogo-map")
implementation project(":libraries:mogo-map-api")
implementation project(':libraries:mogo-adas')
implementation project(':modules:mogo-module-service')
}
}

View File

@@ -1,4 +1,4 @@
package com.mogo.eagle.core.function.map
package com.mogo.eagle.core.function.business
import com.mogo.eagle.core.data.app.AppConfigInfo
import com.mogo.eagle.core.data.config.FunctionBuildConfig

View File

@@ -1,4 +1,4 @@
package com.mogo.eagle.core.function.impl.collect
package com.mogo.eagle.core.function.business.collect
import android.content.Context
import android.text.TextUtils

View File

@@ -1,4 +1,4 @@
package com.mogo.eagle.core.function.map.identify;
package com.mogo.eagle.core.function.business.identify;
import java.util.List;
import java.util.Vector;

View File

@@ -1,4 +1,4 @@
package com.mogo.eagle.core.function.map.identify
package com.mogo.eagle.core.function.business.identify
import com.mogo.eagle.core.data.traffic.TrafficData
import mogo.telematics.pad.MessagePad

View File

@@ -1,11 +1,11 @@
package com.mogo.eagle.core.function.map.identify
package com.mogo.eagle.core.function.business.identify
import android.annotation.SuppressLint
import com.mogo.commons.AbsMogoApplication
import com.mogo.commons.module.status.MogoStatusManager
import com.mogo.eagle.core.data.traffic.TrafficData
import com.mogo.eagle.core.utilcode.mogo.logger.CallerLogger.w
import com.mogo.map.MogoMarkerManager
import com.mogo.module.common.MogoApisHandler
import mogo.telematics.pad.MessagePad
import mogo.telematics.pad.MessagePad.TrackedObject
@@ -38,7 +38,7 @@ class IdentifyBeautifyDataDrawer : Identify {
w(TAG, "感知数据为空无需渲染……")
return
}
if (!MogoApisHandler.getInstance().apis.statusManagerApi.isVrMode) {
if (!MogoStatusManager.getInstance().isVrMode) {
TrackManager.getInstance().clearAll()
w(TAG, "渲染 adas 识别的数据 当前不是VR模式")
return

View File

@@ -1,4 +1,4 @@
package com.mogo.eagle.core.function.map.identify
package com.mogo.eagle.core.function.business.identify
import android.os.Handler
import android.os.Message

View File

@@ -1,12 +1,12 @@
package com.mogo.eagle.core.function.map.identify
package com.mogo.eagle.core.function.business.identify
import android.annotation.SuppressLint
import androidx.collection.ArraySet
import com.mogo.commons.AbsMogoApplication
import com.mogo.commons.module.status.MogoStatusManager
import com.mogo.eagle.core.data.traffic.TrafficData
import com.mogo.eagle.core.utilcode.mogo.logger.CallerLogger.w
import com.mogo.map.MogoMarkerManager
import com.mogo.module.common.MogoApisHandler
import mogo.telematics.pad.MessagePad.PlanningObject
import mogo.telematics.pad.MessagePad.TrackedObject
import java.util.concurrent.ConcurrentHashMap
@@ -60,7 +60,7 @@ class IdentifyOriginDataDrawer : Identify {
w(TAG, "感知数据为空无需渲染……")
return
}
if (!MogoApisHandler.getInstance().apis.statusManagerApi.isVrMode) {
if (!MogoStatusManager.getInstance().isVrMode) {
clearOldMarker()
w(TAG, "渲染 adas 识别的数据 当前不是VR模式")
return
@@ -69,7 +69,7 @@ class IdentifyOriginDataDrawer : Identify {
//清除缓存
for (data in resultList) {
if (trafficDataUuidList.size > 0 && trafficDataUuidList.contains("" + data.uuid)) {
if (TrackerSourceHelper.filterData(data)) {
if (TrackerSourceColorHelper.filterData(data)) {
continue
}
trafficDataUuidList.remove("" + data.uuid)
@@ -105,7 +105,7 @@ class IdentifyOriginDataDrawer : Identify {
trafficDataUuidList.clear()
for (data in trafficData) {
// 过滤掉未知感知数据
if (TrackerSourceHelper.filterData(data)) {
if (TrackerSourceColorHelper.filterData(data)) {
continue
}
var temp: TrackedObject = data
@@ -113,7 +113,7 @@ class IdentifyOriginDataDrawer : Identify {
//首次过来的数据不添加,首次未添加的感知物在调用完绘制方法后再塞入cache map
val cacheData = mMarkersCaches[uuid]
if (cacheData != null) {
val color = TrackerSourceHelper.getDefaultColor(data)
val color = TrackerSourceColorHelper.getDefaultColor(data)
temp = data.toBuilder().setColor(color).build()
mFilterTrafficData[uuid] = temp
}

View File

@@ -1,4 +1,4 @@
package com.mogo.eagle.core.function.map.identify;
package com.mogo.eagle.core.function.business.identify;
public class KalmanFilter {
private final double q = 1.0E-6D;

View File

@@ -1,10 +1,9 @@
package com.mogo.eagle.core.function.map
package com.mogo.eagle.core.function.business.identify
import com.mogo.eagle.core.data.config.FunctionBuildConfig
import com.mogo.eagle.core.function.api.autopilot.IMoGoAutopilotIdentifyListener
import com.mogo.eagle.core.function.api.base.IMoGoSubscriber
import com.mogo.eagle.core.function.call.autopilot.CallerAutopilotIdentifyListenerManager
import com.mogo.eagle.core.function.map.identify.IdentifyFactory
import com.mogo.eagle.core.utilcode.util.ThreadUtils
import mogo.telematics.pad.MessagePad
import mogo.telematics.pad.MessagePad.TrackedObject

View File

@@ -1,4 +1,4 @@
package com.mogo.eagle.core.function.map.identify;
package com.mogo.eagle.core.function.business.identify;
public class ObjQueue {

View File

@@ -1,4 +1,4 @@
package com.mogo.eagle.core.function.map.identify
package com.mogo.eagle.core.function.business.identify
data class PlanningTrack(var color: String, var time: Double) {
}

View File

@@ -1,4 +1,4 @@
package com.mogo.eagle.core.function.map.identify;
package com.mogo.eagle.core.function.business.identify;
import android.annotation.SuppressLint;
import android.os.Build;
@@ -76,13 +76,13 @@ public class TrackManager {
mFilterTrafficData.clear();
//进入过滤机制的感知物体首先从缓存队列中进行查找 uuid
for (MessagePad.TrackedObject data : trafficData) {
if (TrackerSourceHelper.INSTANCE.filterData(data)) {
if (TrackerSourceColorHelper.INSTANCE.filterData(data)) {
continue;
}
String uuid = "" + data.getUuid();
TrackObj trackObj = mMarkersCaches.get(uuid);
String color = TrackerSourceHelper.INSTANCE.getDefaultColor(data);
String color = TrackerSourceColorHelper.INSTANCE.getDefaultColor(data);
data = data.toBuilder().setColor(color).build();
if (trackObj != null) {
@@ -131,7 +131,7 @@ public class TrackManager {
//过滤现有元素
for (MessagePad.TrackedObject data : resultList) {
String uuid = "" + data.getUuid();
if (TrackerSourceHelper.INSTANCE.filterData(data)) {
if (TrackerSourceColorHelper.INSTANCE.filterData(data)) {
continue;
}
if (trafficDataUuid.size() > 0) {

View File

@@ -1,9 +1,8 @@
package com.mogo.eagle.core.function.map.identify;
package com.mogo.eagle.core.function.business.identify;
import static com.mogo.eagle.core.function.map.identify.TrackManager.LIMIT_SPEED;
import static com.mogo.eagle.core.function.business.identify.TrackManager.LIMIT_SPEED;
import android.annotation.SuppressLint;
import android.util.Log;
import com.mogo.cloud.commons.utils.CoordinateUtils;
import com.mogo.eagle.core.data.enums.TrafficTypeEnum;

View File

@@ -1,11 +1,11 @@
package com.mogo.eagle.core.function.map.identify
package com.mogo.eagle.core.function.business.identify
import android.annotation.SuppressLint
import com.mogo.eagle.core.data.config.FunctionBuildConfig
import com.mogo.eagle.core.data.enums.TrafficTypeEnum
import mogo.telematics.pad.MessagePad.*
object TrackerSourceHelper {
object TrackerSourceColorHelper {
@SuppressLint("NewApi")
fun filterData(data: TrackedObject): Boolean {

View File

@@ -1,13 +1,11 @@
package com.mogo.eagle.core.function.map.identify
package com.mogo.eagle.core.function.business.identify
import android.annotation.SuppressLint
import com.mogo.eagle.core.data.config.FunctionBuildConfig
import com.mogo.eagle.core.data.deva.bizconfig.FuncBizConfig.Companion.FOUNDATION
import com.mogo.eagle.core.data.traffic.TrafficData
import com.mogo.eagle.core.data.traffic.threatLevelColor
import com.mogo.eagle.core.function.call.autopilot.CallerAutoPilotStatusListenerManager.getAutoPilotStatusInfo
import com.mogo.eagle.core.function.call.autopilot.CallerAutoPilotStatusListenerManager.getCurWgs84SatelliteTime
import com.zhjt.service_biz.BizConfig
import mogo.telematics.pad.MessagePad
import mogo.telematics.pad.MessagePad.PlanningObject
import java.util.concurrent.ConcurrentHashMap

View File

@@ -0,0 +1,127 @@
package com.mogo.eagle.core.function.business.routeoverlay;
import androidx.annotation.NonNull;
import com.mogo.eagle.core.data.autopilot.AutopilotStatusInfo;
import com.mogo.eagle.core.data.config.FunctionBuildConfig;
import com.mogo.eagle.core.data.map.MogoLocation;
import com.mogo.eagle.core.function.api.autopilot.IMoGoAutopilotPlanningListener;
import com.mogo.eagle.core.function.api.autopilot.IMoGoAutopilotStatusListener;
import com.mogo.eagle.core.function.api.map.listener.IMoGoMapLocationListener;
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.utilcode.mogo.logger.Logger;
import org.jetbrains.annotations.NotNull;
import java.util.LinkedList;
import java.util.List;
import java.util.concurrent.atomic.AtomicBoolean;
import java.util.concurrent.atomic.AtomicInteger;
import mogo.telematics.pad.MessagePad;
import mogo_msg.MogoReportMsg;
import system_master.SystemStatusInfo;
public class MogoRouteOverlayManager implements
IMoGoAutopilotPlanningListener, IMoGoAutopilotStatusListener, IMoGoMapLocationListener {
private static volatile MogoRouteOverlayManager sInstance;
private static final String TAG = "Route";
private final AtomicBoolean isArriveAtStation = new AtomicBoolean(false);
private final AtomicInteger autopilotMode = new AtomicInteger(0);
private final LinkedList<List<MessagePad.TrajectoryPoint>> queue = new LinkedList<>();
private MogoRouteOverlayManager() {}
public void init() {
CallerAutopilotPlanningListenerManager.INSTANCE.addListener(TAG, this);
CallerAutoPilotStatusListenerManager.INSTANCE.addListener(TAG, this);
CallerMapLocationListenerManager.INSTANCE.addListener(TAG, this, false);
}
public static MogoRouteOverlayManager getInstance() {
if (sInstance == null) {
synchronized (MogoRouteOverlayManager.class) {
if (sInstance == null) {
sInstance = new MogoRouteOverlayManager();
}
}
}
return sInstance;
}
@Override
public void onAutopilotTrajectory(@NonNull List<MessagePad.TrajectoryPoint> items) {
synchronized (queue) {
queue.clear();
queue.offer(items);
}
}
@Override
public void onLocationChanged(@org.jetbrains.annotations.Nullable MogoLocation location, int from, boolean isGps) {
if (from != 1 || location == null) {
return;
}
if (isArriveAtStation.get() && autopilotMode.get() != 1) {
RouteOverlayDrawer.getInstance().clearMogoRouteOverlay();
return;
}
boolean force = FunctionBuildConfig.isIgnoreConditionsDrawAutopilotTrajectoryData;
if (!force && autopilotMode.get() != 1) {
RouteOverlayDrawer.getInstance().clearMogoRouteOverlay();
return;
}
synchronized (queue) {
if (!queue.isEmpty()) {
List<MessagePad.TrajectoryPoint> items = queue.pollLast();
if (items != null && !items.isEmpty()) {
RouteOverlayDrawer.getInstance().drawTrajectoryList(items, location.getBearing());
}
}
}
}
@Override
public void onAutopilotRotting(MessagePad.GlobalPathResp globalPathResp) {}
@Override
public void onAutopilotStatusResponse(@NotNull AutopilotStatusInfo autoPilotStatusInfo) {
int mode = autoPilotStatusInfo.getPilotmode();
if (mode == 1) {
isArriveAtStation.set(false);
}
this.autopilotMode.set(mode);
}
@Override
public void onAutopilotArriveAtStation(MessagePad.ArrivalNotification arrivalNotification) {
if (arrivalNotification == null) {
return;
}
if (!isArriveAtStation.get()) {
isArriveAtStation.set(true);
}
}
@Override
public void onAutopilotSNRequest() {
}
@Override
public void onAutopilotGuardian(MogoReportMsg.MogoReportMessage guardianInfo) {
}
@Override
public void onAutopilotIpcConnectStatusChanged(int status, @androidx.annotation.Nullable String reason) {
}
@Override
public void onAutopilotStatusRespByQuery(@NonNull SystemStatusInfo.StatusInfo status) {}
}

View File

@@ -0,0 +1,239 @@
package com.mogo.eagle.core.function.business.routeoverlay;
import android.annotation.SuppressLint;
import android.graphics.Color;
import android.os.Handler;
import android.os.HandlerThread;
import android.util.Log;
import androidx.core.util.Pools;
import com.mogo.eagle.core.data.map.MogoLatLng;
import com.mogo.eagle.core.function.call.autopilot.CallerAutoPilotStatusListenerManager;
import com.mogo.map.MogoOverlayManager;
import com.mogo.map.overlay.IMogoOverlayManager;
import com.mogo.map.overlay.IMogoPolyline;
import com.mogo.map.overlay.MogoPolylineOptions;
import com.mogo.commons.utils.DrivingDirectionUtils;
import java.util.LinkedList;
import java.util.List;
import mogo.telematics.pad.MessagePad;
public class RouteOverlayDrawer {
private static final String TAG = "MogoRouteOverlayManager";
// 连接线参数
private Handler mRenderHandler;
IMogoOverlayManager mogoOverlayManager;
private static volatile RouteOverlayDrawer sInstance;
private final MogoPolylineOptions mPolylineOptions;
private volatile IMogoPolyline mMoGoPolyline;
private static final int COLOR_LIGHT = Color.parseColor("#BAEBF5");
private RouteOverlayDrawer() {
mPolylineOptions = new MogoPolylineOptions();
mPolylineOptions.zIndex(75000f);
mPolylineOptions.setGps(true);
mPolylineOptions.width(20).useGradient(true);
// 渐变色
mogoOverlayManager = MogoOverlayManager.getInstance();
// 线条粗细,渐变,渐变色值
HandlerThread renderTask = new HandlerThread("routing_render") {
@Override
protected void onLooperPrepared() {
super.onLooperPrepared();
mRenderHandler = new Handler(getLooper());
}
};
renderTask.start();
}
public static RouteOverlayDrawer getInstance() {
if (sInstance == null) {
synchronized (RouteOverlayDrawer.class) {
if (sInstance == null) {
sInstance = new RouteOverlayDrawer();
}
}
}
return sInstance;
}
public void clearMogoRouteOverlay() {
if (mRenderTask != null) {
mRenderHandler.removeCallbacks(mRenderTask);
}
if (mMoGoPolyline != null) {
mMoGoPolyline.remove();
mMoGoPolyline = null;
}
}
private class RenderTask implements Runnable {
private volatile List<MessagePad.TrajectoryPoint> routeList;
private final Pools.Pool<MogoLatLng> pools;
private final LinkedList<MogoLatLng> points;
private double bearing;
public RenderTask() {
this.pools = new Pools.SimplePool<>(500);
this.points = new LinkedList<>();
}
public void setData(List<MessagePad.TrajectoryPoint> routeList, double bearing) {
this.routeList = routeList;
this.bearing = bearing;
}
@SuppressLint("LongLogTag")
@Override
public void run() {
LinkedList<MogoLatLng> pps = this.points;
boolean isExcept = false;
int total;
try {
pps.clear();
List<MessagePad.TrajectoryPoint> routes = this.routeList;
if (routes == null || (total = routes.size()) < 2) {
isExcept = true;
return;
}
RouteStrategy.INSTANCE.start();
for (int i = 0; i < total; i++) {
MessagePad.TrajectoryPoint route = null;
try {
route = routes.get(i);
if (route == null) {
continue;
}
} catch (Throwable t) {
Log.d("Route", "render-error:" + t.getMessage());
}
if (route == null) {
//数组越界了,结束循环
break;
}
MogoLatLng acquire = pools.acquire();
double latitude = route.getLatitude();
double longitude = route.getLongitude();
if (acquire == null) {
acquire = new MogoLatLng(latitude, longitude);
} else {
acquire.lon = longitude;
acquire.lat = latitude;
}
acquire.acc = route.getAcceleration();
acquire.speed = route.getVelocity();
pps.add(acquire);
RouteStrategy.INSTANCE.check(route.getVelocity(), route.getAcceleration(), routeList.size());
}
double lon = CallerAutoPilotStatusListenerManager.INSTANCE.getCurWgs84Lon();
double lat = CallerAutoPilotStatusListenerManager.INSTANCE.getCurWgs84Lat();
if (points.size() > 0) {
MogoLatLng top = null;
while (points.size() != 0) {
MogoLatLng first = points.peek();
if (first == null) {
continue;
}
if (first == top) {
break;
}
lon = CallerAutoPilotStatusListenerManager.INSTANCE.getCurWgs84Lon();
lat = CallerAutoPilotStatusListenerManager.INSTANCE.getCurWgs84Lat();
long angle = isPointOnCarFront(lon, lat, bearing, first.lon, first.lat);
if (angle >= 90) {
RouteStrategy.INSTANCE.remove(first.acc);
pools.release(first);
points.poll();
}
top = first;
}
if (points.size() == 0) {
isExcept = true;
return;
}
MogoLatLng self = pools.acquire();
if (self == null) {
self = new MogoLatLng(lat, lon);
} else {
self.lat = lat;
self.lon = lon;
}
points.addFirst(self);
RouteStrategy.INSTANCE.end();
Strategy strategy = RouteStrategy.INSTANCE.getStrategy();
List<Integer> colors = strategy.getColors();
boolean isLightOn = strategy instanceof ColorfulStrategy && ((ColorfulStrategy) strategy).isLightOn();
if (mMoGoPolyline == null || mMoGoPolyline.isDestroyed()) {
mPolylineOptions.points(points);
mPolylineOptions.colorValues(colors);
if (isLightOn) {
mPolylineOptions.openBright(true);
mPolylineOptions.brightColor(COLOR_LIGHT);
mPolylineOptions.brightSpeed(0.5f);
} else {
mPolylineOptions.openBright(false);
}
mMoGoPolyline = mogoOverlayManager.addPolyline(mPolylineOptions);
} else {
mPolylineOptions.points(points);
mPolylineOptions.colorValues(colors);
if (isLightOn) {
mPolylineOptions.openBright(true);
mPolylineOptions.brightColor(COLOR_LIGHT);
mPolylineOptions.brightSpeed(0.5f);
} else {
mPolylineOptions.openBright(false);
}
mMoGoPolyline.setOption(mPolylineOptions);
}
if (mMoGoPolyline != null && !mMoGoPolyline.isDestroyed() && !mMoGoPolyline.isVisible()) {
mMoGoPolyline.setVisible(true);
}
} else {
isExcept = true;
}
} catch (Throwable t) {
t.printStackTrace();
} finally {
if (isExcept) {
setVisible(false);
}
if (points.size() > 0) {
for (int i = 0; i < points.size(); i++) {
MogoLatLng latLng = points.get(i);
if (latLng == null) {
continue;
}
pools.release(latLng);
}
}
}
}
private long isPointOnCarFront(double car_lon, double car_lat, double car_head, double lon, double lat) {
return DrivingDirectionUtils.getDegreeOfCar2Poi2(car_lon, car_lat, lon, lat, car_head);
}
}
private volatile RenderTask mRenderTask;
public void drawTrajectoryList(List<MessagePad.TrajectoryPoint> routeList, double bearing) {
if (mRenderTask == null) {
mRenderTask = new RenderTask();
}
mRenderTask.setData(routeList, bearing);
if (mRenderHandler != null) {
mRenderHandler.removeCallbacks(mRenderTask);
mRenderHandler.post(mRenderTask);
}
}
public void setVisible(boolean isVisible) {
if (mMoGoPolyline != null && !mMoGoPolyline.isDestroyed()) {
mMoGoPolyline.setVisible(isVisible);
}
}
}

View File

@@ -0,0 +1,166 @@
package com.mogo.eagle.core.function.business.routeoverlay
import android.animation.*
import android.graphics.*
import android.view.animation.*
import com.mogo.eagle.core.data.config.*
import com.mogo.eagle.core.utilcode.mogo.*
import com.mogo.eagle.core.function.business.routeoverlay.Colors.Companion.COLOR_BLUE
import com.mogo.eagle.core.function.business.routeoverlay.Colors.Companion.COLOR_BLUE_DARK
import com.mogo.eagle.core.function.business.routeoverlay.Colors.Companion.COLOR_RED_DARK
import com.mogo.eagle.core.function.business.routeoverlay.Colors.Companion.COLOR_TRANSPARENT
import java.util.*
import kotlin.collections.ArrayList
interface IStrategy {
fun getColors(): List<Int>
}
class Colors {
companion object {
val COLOR_BLUE = Color.parseColor("#FF2ABAD9")
val COLOR_BLUE_DARK = Color.parseColor("#FF074EFF")
val COLOR_RED_DARK = Color.parseColor("#FFFF5F00")
val COLOR_TRANSPARENT = Color.parseColor("#002ABAD9")
}
}
sealed class Strategy: IStrategy
class DefaultStrategy(private val colors: List<Int>? = null): Strategy() {
override fun getColors(): List<Int> = colors ?: listOf(COLOR_BLUE, COLOR_TRANSPARENT)
}
class ColorfulStrategy(private val colors: List<Int> = emptyList(), var isLightOn: Boolean): Strategy() {
override fun getColors(): List<Int> = colors
}
object RouteStrategy {
@Volatile
private var isEnable = !AppIdentityModeUtils.isBus(FunctionBuildConfig.appIdentityMode)
private var strategy: Strategy? = null
private val colors: ArrayList<Int> = ArrayList()
private var index = 0
private val sorted: NavigableMap<Double, Int> by lazy { TreeMap() }
private var endEvaluator: ArgbEvaluator? = null
private var startColor = Int.MAX_VALUE
private var hasLessThan0 = false
fun enable(enable: Boolean) {
isEnable = enable
if (!enable) {
strategy = null
colors.clear()
}
}
fun start() {
if (sorted.isEmpty()) {
fill()
}
strategy = null
index = 0
startColor = Int.MAX_VALUE
colors.clear()
endEvaluator = null
hasLessThan0 = false
}
fun end() {
if (isEnable) {
if (colors.isEmpty()) {
return
}
val first = colors[0]
colors.add(0, first)
strategy = ColorfulStrategy(colors, true)
}
}
fun check(speed: Double, acc: Double, total: Int) {
if (!isEnable){
return
}
if (sorted.isEmpty()) {
return
}
if (acc < 0) {
hasLessThan0 = true
}
val delta = (total * 0.35).toInt()
val last = total - delta
val entry = sorted.floorEntry(acc)
if (entry != null) {
if (index >= last - 1) {
if (startColor == Int.MAX_VALUE) {
startColor = entry.value
if (endEvaluator == null) {
endEvaluator = ArgbEvaluator()
}
colors += entry.value
} else {
if (endEvaluator != null) {
val fraction = (index - last) * 1.0f / delta
colors += endEvaluator!!.evaluate(fraction, startColor, COLOR_TRANSPARENT) as Int
}
}
} else {
colors += entry.value
}
}
index++
}
fun remove(acc: Double): List<Int> {
if (!isEnable) {
return emptyList()
}
if (sorted.isEmpty()) {
throw AssertionError("sorted map must not be null.")
}
val entry = sorted.floorEntry(acc)
if (entry != null) {
colors.remove(entry.value)
}
return ArrayList(colors)
}
private fun fill() {
var startValue = -4.0
var endValue = 0.0
val step = 0.01
var current = startValue
val evaluator = ArgbEvaluator()
val interceptor = AccelerateInterpolator()
var total = endValue - startValue
while (current <= endValue) {
val fraction = interceptor.getInterpolation(((current - startValue) / total).toFloat())
val colorValue = evaluator.evaluate(fraction, COLOR_RED_DARK, COLOR_BLUE) as Int
sorted[current] = colorValue
current += step
}
startValue = 0.01
endValue = 3.0
current = startValue
total = endValue - startValue
while (current <= endValue) {
val fraction = (current - startValue) / total
val colorValue = evaluator.evaluate(fraction.toFloat(), COLOR_BLUE, COLOR_BLUE_DARK) as Int
sorted[current] = colorValue
current += step
}
}
fun getStrategy(): Strategy = if (isEnable) { (strategy ?: DefaultStrategy()) } else DefaultStrategy()
}

View File

@@ -4,6 +4,7 @@ import android.content.Context;
import com.alibaba.android.arouter.facade.annotation.Route;
import com.mogo.eagle.core.data.constants.MogoServicePaths;
import com.mogo.eagle.core.function.api.map.IMogoMapService;
import com.mogo.eagle.core.function.api.map.marker.IMogoMarkerService;
import com.mogo.eagle.core.function.call.map.CallerVisualAngleManager;
import com.mogo.map.MogoGeoSearch;
import com.mogo.map.MogoLocationClient;
@@ -53,6 +54,11 @@ public class MogoMapService implements IMogoMapService {
return MogoMarkerManager.getInstance(context);
}
@Override
public IMogoMarkerService getMarkerService() {
return MogoMarkerServiceImpl.getInstance();
}
@Override
public IMogoMapUIController getMapUIController() {
return MogoMapUIController.getInstance();

View File

@@ -0,0 +1,79 @@
package com.mogo.eagle.core.function.impl;
import androidx.annotation.Nullable;
import com.mogo.eagle.core.data.map.MogoLatLng;
import com.mogo.eagle.core.data.map.entity.MarkerShowEntity;
import com.mogo.eagle.core.data.traffic.TrafficData;
import com.mogo.eagle.core.function.api.map.marker.IMogoMarkerService;
import com.mogo.eagle.core.function.impl.marker.drawer.MarkerDrawer;
import com.mogo.eagle.core.function.impl.marker.drawer.TrafficMarkerDrawer;
import com.mogo.eagle.core.function.impl.marker.drawer.V2XWarnDataDrawer;
import com.mogo.map.marker.IMogoMarker;
public class MogoMarkerServiceImpl implements IMogoMarkerService {
private static volatile MogoMarkerServiceImpl sInstance;
private static final byte[] obj = new byte[0];
private MogoMarkerServiceImpl() {
}
public static MogoMarkerServiceImpl getInstance() {
if (sInstance == null) {
synchronized (obj) {
if (sInstance == null) {
sInstance = new MogoMarkerServiceImpl();
}
}
}
return sInstance;
}
@Nullable
@Override
public IMogoMarker drawMarker(Object object) {
if (object instanceof MarkerShowEntity) {
return MarkerDrawer.getInstance().drawMapMarkerImpl(((MarkerShowEntity) object), MarkerDrawer.MARKER_Z_INDEX_HIGH, null);
}
return null;
}
@Override
public void renderWarningMoveMarker(double lon, double lat, int type, double collisionlat, double collisionLon, double angle, long showTime) {
V2XWarnDataDrawer.getInstance().renderWarnData(lon, lat, type, collisionlat, collisionLon, angle, showTime);
}
@Override
public void renderStopLineMarker(double lon, double lat) {
V2XWarnDataDrawer.getInstance().renderStopLineData(lon, lat);
}
@Override
public void drawerArrowsMarkerWithLocation(MogoLatLng location, String markerType, int type, int rotate) {
V2XWarnDataDrawer.getInstance().drawerArrowsMarkerWithLocation(location, markerType, type, rotate);
}
@Override
public void updateITrafficInfo(TrafficData trafficData) {
TrafficMarkerDrawer.INSTANCE.updateITrafficInfo(trafficData);
}
@Override
public void updateITrafficLocationInfo(TrafficData trafficData) {
TrafficMarkerDrawer.INSTANCE.updateITrafficLocationInfo(trafficData);
}
@Override
public void updateITrafficThreatLevelInfo(TrafficData trafficData) {
TrafficMarkerDrawer.INSTANCE.updateITrafficThreatLevelInfo(trafficData);
}
@Override
public void removeCvxRvInfoIndInfo(String uuid) {
TrafficMarkerDrawer.INSTANCE.removeCvxRvInfoIndInfo(uuid);
}
}

View File

@@ -0,0 +1,68 @@
package com.mogo.eagle.core.function.impl.marker;
public enum AdasRecognizedType {
//背景
classIdBackground("background", 0),
//人
classIdPerson("person", 1),
//自行车
classIdBicycle("bicycle", 2),
//小轿车
classIdCar("car", 3),
//摩托车
classIdMoto("moto", 4),
//红绿灯
classIdTrafficSign("traffic_sign", 5),
//bus
classIdTrafficBus("traffic_bus", 6),
//truck
classIdTrafficTruck("traffic_truck", 8),
//stopLine
classIdStopLine("warning_stop_line", 9),
//预警箭头
classIdWarningArrows("warning_arrows", 10),
//未知物体
classIdUnKnow("unKnow", 100);
AdasRecognizedType(int code) {
this.code = code;
}
private String res = "";
private int code = -1;
AdasRecognizedType(String res, int code) {
this.res = res;
this.code = code;
}
public static AdasRecognizedType[] VAL = {
classIdBackground,//0
classIdPerson,
classIdBicycle,
classIdCar,
classIdMoto,
classIdTrafficSign,
classIdTrafficBus,
null,
classIdTrafficTruck,
classIdStopLine,
classIdWarningArrows,
classIdUnKnow,
};
public String getRes() {
return res;
}
public static AdasRecognizedType valueFrom(int code) {
if (code == 100) {
return classIdUnKnow;
}
if (code >= 0 && code < VAL.length) {
return VAL[code];
}
return null;
}
}

View File

@@ -1,46 +0,0 @@
package com.mogo.eagle.core.function.impl.marker;
import android.content.Context;
import androidx.annotation.Nullable;
import com.alibaba.android.arouter.facade.annotation.Route;
import com.mogo.eagle.core.data.constants.MogoServicePaths;
import com.mogo.eagle.core.function.api.map.marker.IMogoMarkerService;
import com.mogo.map.MogoMapUIController;
import com.mogo.map.marker.IMogoMarker;
import com.mogo.map.uicontroller.IMogoMapUIController;
import com.mogo.module.common.drawer.MarkerDrawer;
import com.mogo.module.common.entity.MarkerShowEntity;
import com.mogo.module.service.marker.MapMarkerManager;
/**
* @author congtaowang
* @since 2020-05-27
* <p>
* 调用 #mogo-module-service# 模块的样式打点
*/
@Route( path = MogoServicePaths.PATH_MARKER_SERVICE )
public class MogoMarkerServiceImpl implements IMogoMarkerService {
private static final String TAG = "MogoMarkerServiceImpl";
@Nullable
@Override
public IMogoMarker drawMarker( Object object ) {
if ( object instanceof MarkerShowEntity ) {
return MapMarkerManager.getInstance().drawMapMarker( ( ( MarkerShowEntity ) object ), MarkerDrawer.MARKER_Z_INDEX_HIGH );
}
return null;
}
@Override
public void init( Context context ) {
}
@Override
public IMogoMapUIController getMapUIController() {
return MogoMapUIController.getInstance();
}
}

View File

@@ -0,0 +1,54 @@
package com.mogo.eagle.core.function.impl.marker.drawer;
import android.content.Context;
import com.mogo.commons.AbsMogoApplication;
import com.mogo.eagle.core.function.impl.marker.AdasRecognizedType;
import com.mogo.eagle.core.function.map.R;
/**
* @author congtaowang
* @since 2020/10/30
* <p>
* 描述
*/
public class BaseDrawer {
protected final Context mContext;
public BaseDrawer() {
mContext = AbsMogoApplication.getApp();
}
/**
* 获取3D锚点模型资源
*
* @param type {@link AdasRecognizedType}
* @return modelRes
*/
public int getModelRes(int type) {
AdasRecognizedType recognizedType = AdasRecognizedType.valueFrom(type);
if (recognizedType == AdasRecognizedType.classIdCar) {
return R.raw.traffic_tachexiaoche;
} else if (recognizedType == AdasRecognizedType.classIdTrafficBus) {
return R.raw.traffic_daba;
} else if (recognizedType == AdasRecognizedType.classIdMoto) {
return R.raw.traffic_motuoche;
} else if (recognizedType == AdasRecognizedType.classIdStopLine) {
return R.raw.stopline;
} else if (recognizedType == AdasRecognizedType.classIdWarningArrows) {
return R.raw.jiantou;
} else if (recognizedType == AdasRecognizedType.classIdUnKnow) {
return R.raw.special_vehicle;
} else if (recognizedType == AdasRecognizedType.classIdBicycle) {
return R.raw.traffic_zixingche;
} else if (recognizedType == AdasRecognizedType.classIdTrafficTruck) {
return R.raw.traffic_daba;
} else if (recognizedType == AdasRecognizedType.classIdPerson) {
return R.raw.traffic_people;
}
return R.raw.special_vehicle;
}
}

View File

@@ -0,0 +1,176 @@
package com.mogo.eagle.core.function.impl.marker.drawer;
import android.text.TextUtils;
import com.mogo.cloud.commons.utils.CoordinateUtils;
import com.mogo.commons.AbsMogoApplication;
import com.mogo.commons.module.status.MogoStatusManager;
import com.mogo.eagle.core.data.map.MogoLatLng;
import com.mogo.eagle.core.data.map.entity.MarkerExploreWay;
import com.mogo.eagle.core.data.map.entity.MarkerNoveltyInfo;
import com.mogo.eagle.core.data.map.entity.MarkerOnlineCar;
import com.mogo.eagle.core.data.map.entity.MarkerShareMusic;
import com.mogo.eagle.core.data.map.entity.MarkerShowEntity;
import com.mogo.eagle.core.function.impl.marker.view.EmptyMarkerView;
import com.mogo.eagle.core.function.impl.marker.view.IMarkerView;
import com.mogo.eagle.core.function.impl.marker.view.MapMarkerAdapter;
import com.mogo.eagle.core.function.impl.marker.view.OnlineCarMarkerView;
import com.mogo.map.MogoMarkerManager;
import com.mogo.map.marker.IMogoMarker;
import com.mogo.map.marker.IMogoMarkerClickListener;
import com.mogo.map.marker.MogoMarkerOptions;
import com.mogo.eagle.core.data.enums.EventTypeEnum;
/**
* @author congtaowang
* @since 2020/10/28
* <p>
* 描述
*/
public class MarkerDrawer {
public static final int MARKER_Z_INDEX_HIGH = 100;
public static final int MARKER_Z_INDEX_LOW = 2;
private static volatile MarkerDrawer sInstance;
private MarkerDrawer() {
}
public static MarkerDrawer getInstance() {
if (sInstance == null) {
synchronized (MarkerDrawer.class) {
if (sInstance == null) {
sInstance = new MarkerDrawer();
}
}
}
return sInstance;
}
public synchronized void release() {
sInstance = null;
}
private Object readResolve() {
// 阻止反序列化,必须实现 Serializable 接口
return sInstance;
}
public IMogoMarker drawMapMarkerImpl(MarkerShowEntity markerShowEntity, int zIndex, IMogoMarkerClickListener listener) {
return drawMapMarkerImpl(markerShowEntity, false, zIndex, 0, listener);
}
/**
* add marker, { 如果是需要在3D模式下显示则需要设置 {@link MogoMarkerOptions icon3DRes 资源id}}
*
* @param markerShowEntity marker展示数据结构体
* @param matchRoadSide 设置是否道路吸附,暂时没用到这个字段
* @param zIndex zOrder
* @param icon3DRes 3D Res资源
* @param listener marker回调
* @return {@link IMogoMarker}
*/
public IMogoMarker drawMapMarkerImpl(MarkerShowEntity markerShowEntity, boolean matchRoadSide, int zIndex, int icon3DRes, IMogoMarkerClickListener listener) {
if (markerShowEntity == null || markerShowEntity.getMarkerLocation() == null) {
return null;
}
MogoMarkerOptions options = new MogoMarkerOptions().icon3DRes(icon3DRes).set3DMode(MogoStatusManager.getInstance().isVrMode()).matchOnRoadSide(matchRoadSide).owner(markerShowEntity.getMarkerType()).zIndex(zIndex).data(markerShowEntity).latitude(markerShowEntity.getMarkerLocation().getLat()).longitude(markerShowEntity.getMarkerLocation().getLon());
if (MogoStatusManager.getInstance().isVrMode()) {
Object bindObj = markerShowEntity.getBindObj();
if (bindObj instanceof MarkerExploreWay && ((MarkerExploreWay) bindObj).getPoiType() != null) {
String poiType = ((MarkerExploreWay) bindObj).getPoiType();
options.icon3DRes(EventTypeEnum.getMarker3DRes(poiType));
}
}
IMarkerView markerView = MapMarkerAdapter.getMarkerView(AbsMogoApplication.getApp(), markerShowEntity, options);
if (markerView instanceof OnlineCarMarkerView) {
try {
options.icon(markerView.getBitmap(((MarkerOnlineCar) markerShowEntity.getBindObj()).getCarInfo().getVehicleType()));
} catch (Exception e) {
options.icon(markerView.getBitmap(0));
}
options.anchor(0.5f, 0.5f);
} else {
options.icon(markerView.getView());
}
if (options.getIcon3DRes() != 0) {
options.icon(new EmptyMarkerView(AbsMogoApplication.getApp()));
options.icon(markerView.getBitmap(0));
}
IMogoMarker marker = MogoMarkerManager.getInstance(AbsMogoApplication.getApp()).addMarker(markerShowEntity.getMarkerType(), options);
if (marker != null) {
marker.setOwner(markerShowEntity.getMarkerType());
markerView.setMarker(marker);
marker.setOnMarkerClickListener(listener);
}
return marker;
}
public String getPrimaryKeyFromEntity(Object entity) {
if (entity instanceof MarkerExploreWay) {
String id = ((MarkerExploreWay) entity).getInfoId();
if (!TextUtils.isEmpty(id)) {
return id;
}
}
return getCarSnFromEntity(entity);
}
private String getPrimaryKeyFromMarker(IMogoMarker marker) {
if (marker == null || marker.getObject() == null || marker.isDestroyed()) {
return null;
}
if (!(marker.getObject() instanceof MarkerShowEntity)) {
return null;
}
return getPrimaryKeyFromEntity(((MarkerShowEntity) marker.getObject()).getBindObj());
}
private String getCarSnFromEntity(Object entity) {
try {
if (entity instanceof MarkerOnlineCar) {
return ((MarkerOnlineCar) entity).getUserInfo().getSn();
} else if (entity instanceof MarkerShareMusic) {
return ((MarkerShareMusic) entity).getUserInfo().getSn();
} else if (entity instanceof MarkerNoveltyInfo) {
return ((MarkerNoveltyInfo) entity).getSn();
} else if (entity instanceof MarkerExploreWay) {
return ((MarkerExploreWay) entity).getUserInfo().getSn();
}
} catch (Exception e) {
}
return "";
}
/**
* 距离半径计算方式
*
* @param point1 点一坐标
* @param point2 点二坐标
* @return 两坐标的距离 单位M
*/
public static float calculateLineDistance(MogoLatLng point1, MogoLatLng point2) {
if (point1 != null && point2 != null) {
return calculateLineDistance(point1.lon, point1.lat, point2.lon, point2.lat);
} else {
return 0.0F;
}
}
/**
* @param lon1
* @param lat1
* @param lon2
* @param lat2
* @return 两坐标的距离 单位M
*/
public static float calculateLineDistance(double lon1, double lat1, double lon2, double lat2) {
return CoordinateUtils.calculateLineDistance(lon1, lat1, lon2, lat2);
}
}

View File

@@ -0,0 +1,235 @@
package com.mogo.eagle.core.function.impl.marker.drawer
import android.annotation.SuppressLint
import android.content.Context
import android.os.Handler
import android.os.Message
import android.text.TextUtils
import com.mogo.commons.AbsMogoApplication
import com.mogo.eagle.core.data.config.FunctionBuildConfig
import com.mogo.eagle.core.data.constants.DataTypes
import com.mogo.eagle.core.data.enums.TrafficTypeEnum
import com.mogo.eagle.core.data.traffic.TrafficData
import com.mogo.eagle.core.data.traffic.threatLevelColor
import com.mogo.eagle.core.utilcode.mogo.logger.CallerLogger
import com.mogo.eagle.core.utilcode.mogo.thread.WorkThreadHandler
import com.mogo.map.MogoMarkerManager
import com.mogo.map.marker.IMogoMarker
import com.mogo.map.marker.MogoMarkerOptions
import java.util.concurrent.ConcurrentHashMap
/**
* 此类用于obu/v2x预警绘制交通元素 2D\3D绘制
* obu:与其进行调试单独展示与debugview上感知开关相关联
* v2x:绘制云端预警marker不会做感知控制管理后续根据注解的方式来控制v2x业务
*/
@SuppressLint("StaticFieldLeak")
object TrafficMarkerDrawer {
private const val TAG = "TrafficMarkerDrawer"
private var mContext: Context? = null
// 动画持续时间
private const val stepTime = 150L
// 维护Obu识别的他车集合
private val mTrafficMap = ConcurrentHashMap<String, TrafficData>()
// 地图内部资源md5缓存便于资源复用
private val mMarkerCachesResMd5Values = ConcurrentHashMap<String, String>()
// 上一帧数据的缓存,用来做移动动画
private val mMarkersCaches = ConcurrentHashMap<String, IMogoMarker>()
// 维护一个线程定时轮询数据进行地图绘制
private val mDrawerHandler: Handler =
object : Handler(WorkThreadHandler.newInstance("other_traffic_drawer").looper) {
override fun handleMessage(msg: Message) {
super.handleMessage(msg)
if (FunctionBuildConfig.debugTrackerProvider == 1) {
drawerTrafficInfo()
}
// 延时50毫秒重复发送自己定时轮询进行车辆绘制可以及时将已经不存在车辆删除
sendEmptyMessageDelayed(0, 50L)
}
}
init {
mContext = AbsMogoApplication.getApp()
mDrawerHandler.sendEmptyMessageDelayed(1, 0L)
}
/**
* 更新识别数据,V2V预警的时候需要修改车辆颜色
*/
fun updateITrafficInfo(trafficData: TrafficData) {
if (trafficData.uuid != null) {
mTrafficMap[trafficData.uuid!!] = trafficData
}
}
/**
* 更新识别数据位置
*/
fun updateITrafficLocationInfo(trafficData: TrafficData) {
if (FunctionBuildConfig.debugTrackerProvider != 1) {
return
}
val tempTraffic = mTrafficMap[trafficData.uuid]
if (tempTraffic != null) {
tempTraffic.lat = trafficData.lat
tempTraffic.lon = trafficData.lon
tempTraffic.heading = trafficData.heading
if (trafficData.uuid != null) {
mTrafficMap[trafficData.uuid!!] = tempTraffic
}
} else {
if (trafficData.uuid != null) {
mTrafficMap[trafficData.uuid!!] = trafficData
}
}
}
/**
* 更新识别数据颜色
*/
fun updateITrafficThreatLevelInfo(trafficData: TrafficData) {
if (FunctionBuildConfig.debugTrackerProvider != 1) {
return
}
if (trafficData != null && !TextUtils.isEmpty(trafficData.uuid)) {
val tempTraffic = mTrafficMap[trafficData.uuid]
if (tempTraffic != null) {
tempTraffic.lat = trafficData.lat
tempTraffic.lon = trafficData.lon
tempTraffic.heading = trafficData.heading
tempTraffic.threatLevel = trafficData.threatLevel
if (trafficData.uuid != null) {
mTrafficMap[trafficData.uuid!!] = tempTraffic
}
} else {
if (trafficData.uuid != null) {
mTrafficMap[trafficData.uuid!!] = trafficData
}
}
}
}
/**
* 移除识别的数据
*/
fun removeCvxRvInfoIndInfo(key: String) {
if (mTrafficMap.containsKey(key)) {
mTrafficMap.remove(key)
}
}
/**
* 绘制
*/
private fun drawerTrafficInfo() {
// 数据为空的时候清除所有数据
if (mTrafficMap.isEmpty()) {
mMarkersCaches.forEach {
it.value.remove()
}
mMarkersCaches.clear()
} else {
// 循环绘制识别的数据
mTrafficMap.forEach {
// 如果数据已经存在 Marker取出做动画
if (mMarkersCaches[it.key] != null) {
mMarkersCaches[it.key]?.let { marker ->
changeDynamicMarker(marker, it.value)
}
}
// 不存在的添加Marker绘制
else {
drawObuRecognizedDataMarker(it.value)
}
}
}
}
/**
* 绘制单条
*/
private fun drawObuRecognizedDataMarker(trafficData: TrafficData) {
CallerLogger.d(
TAG,
"trafficData.type = " + trafficData.type + "---trafficData.threatLevel = " + trafficData.threatLevel
)
if (trafficData.type != null) {
val resId: Int = trafficData.type.traffic3DIconId
val resIdVal = resId.toString() + ""
val options = MogoMarkerOptions()
.owner(DataTypes.TYPE_MARKER_ADAS)
.anchor(0.5f, 0.5f)
.set3DMode(true)
.gps(true)
.controlAngle(true)
.resName(mMarkerCachesResMd5Values[resIdVal])
.icon3DRes(resId)
.rotate(trafficData.heading.toFloat())
.position(
com.mogo.eagle.core.data.map.MogoLatLng(
trafficData.lat,
trafficData.lon
)
)
if (trafficData.type != TrafficTypeEnum.TYPE_TRAFFIC_ID_SPECIAL_VEHICLE) {
// 修改颜色
mMarkersCaches[trafficData.uuid]?.setAnchorColor(trafficData.threatLevelColor())
}
val marker = MogoMarkerManager.getInstance(mContext)
.addMarker(DataTypes.TYPE_MARKER_OBU_DATA, options)
// 缓存3D资源
mMarkerCachesResMd5Values[resIdVal] = marker.markerResName
// 缓存数据
if (trafficData.uuid != null) {
mMarkersCaches[trafficData.uuid!!] = marker
}
}
}
/**
* 带动画的修改Marker
*/
private fun changeDynamicMarker(
marker: IMogoMarker,
trafficData: TrafficData
) {
CallerLogger.d(
TAG,
"trafficData.type = " + trafficData.type + "---trafficData.threatLevel = " + trafficData.threatLevel
)
if (trafficData.type != TrafficTypeEnum.TYPE_TRAFFIC_ID_SPECIAL_VEHICLE) {
mMarkersCaches[trafficData.uuid]?.setAnchorColor(trafficData.threatLevelColor())
}
try {
marker.addDynamicAnchorPosition(
com.mogo.eagle.core.data.map.MogoLatLng(
trafficData.lat,
trafficData.lon
),
trafficData.heading.toFloat(),
stepTime
)
} catch (e: Exception) {
e.printStackTrace()
try {
drawObuRecognizedDataMarker(trafficData)
} catch (e: Exception) {
e.printStackTrace()
}
}
}
}

View File

@@ -0,0 +1,139 @@
package com.mogo.eagle.core.function.impl.marker.drawer;
import static com.mogo.eagle.core.data.constants.DataTypes.TYPE_MARKER_CLOUD_STOP_LINE_DATA;
import static com.mogo.eagle.core.data.constants.DataTypes.TYPE_MARKER_CLOUD_WARN_DATA;
import com.mogo.eagle.core.data.map.MogoLatLng;
import com.mogo.eagle.core.data.map.entity.MarkerLocation;
import com.mogo.eagle.core.data.map.entity.MarkerShowEntity;
import com.mogo.eagle.core.function.impl.marker.view.IMarkerView;
import com.mogo.eagle.core.function.impl.marker.view.MapMarkerAdapter;
import com.mogo.eagle.core.utilcode.util.UiThreadHandler;
import com.mogo.map.MogoMarkerManager;
import com.mogo.map.marker.IMogoMarker;
import com.mogo.map.marker.MogoMarkerOptions;
/**
* 云端 预警数据绘制
*/
public class V2XWarnDataDrawer extends BaseDrawer {
private static volatile V2XWarnDataDrawer sInstance;
private static final byte[] obj = new byte[0];
private V2XWarnDataDrawer() {
super();
}
public static V2XWarnDataDrawer getInstance() {
if (sInstance == null) {
synchronized (obj) {
if (sInstance == null) {
sInstance = new V2XWarnDataDrawer();
}
}
}
return sInstance;
}
public synchronized void release() {
sInstance = null;
}
/**
* 识别物移动
*/
public void renderWarnData(double lon, double lat, int type, double collisionlat, double collisionLon, double angle, long showTime) {
MarkerLocation location = new MarkerLocation();
location.setLat(lat);
location.setLon(lon);
location.setAngle(angle);
MarkerShowEntity markerShowEntity = new MarkerShowEntity();
markerShowEntity.setMarkerLocation(location);
markerShowEntity.setMarkerType(TYPE_MARKER_CLOUD_WARN_DATA);
IMogoMarker marker = drawMarker(markerShowEntity, modeResType(type));
// marker.addDynamicAnchorPosition(new MogoLatLng(collisionlat, collisionLon), (float) heading, showTime * 1000);
UiThreadHandler.postDelayed(marker::remove, showTime * 1000);
}
//根据识别物类型 (行人1/自行车2/摩托车4/骑行车辆11)获取3D模型(对应查看getModelRes)
private int modeResType(int dataType) {
switch (dataType) {
case 1:
case 11:
return 1;
case 2:
return 2;
case 4:
return 4;
}
return 1;
}
public IMogoMarker drawMarker(MarkerShowEntity markerShowEntity, int modeResType) {
MogoMarkerOptions options = new MogoMarkerOptions()
.data(markerShowEntity)
.latitude(markerShowEntity.getMarkerLocation().getLat())
.longitude(markerShowEntity.getMarkerLocation().getLon())
.controlAngle(true)
.rotate((float) markerShowEntity.getMarkerLocation().getAngle())
.setGps(true);
IMarkerView iMarkerView = MapMarkerAdapter.getMarkerView(mContext, markerShowEntity, options);
options.icon3DRes(getModelRes(modeResType));
options.anchorColor("#FB3C3CFF");
IMogoMarker marker = MogoMarkerManager.getInstance(mContext).addMarker(markerShowEntity.getMarkerType(), options);
iMarkerView.setMarker(marker);
marker.setToTop();
return marker;
}
public void drawerArrowsMarkerWithLocation(MogoLatLng location, String markerType, int type, int rotate) {
MogoMarkerOptions options = new MogoMarkerOptions()
.latitude(location.getLat())
.longitude(location.getLon())
.set3DMode(true)
.setGps(true)
.controlAngle(true)
.icon3DRes(getModelRes(type))
.anchorColor("#FB3C3CFF")
.flat(true);
IMogoMarker marker = MogoMarkerManager.getInstance(mContext).addMarker(markerType, options);
marker.setRotateAngle(rotate);
}
/**
* 绘制停止线 marker
*/
public void renderStopLineData(double lon, double lat) {
MarkerLocation location = new MarkerLocation();
location.setLat(lat);
location.setLon(lon);
MarkerShowEntity markerShowEntity = new MarkerShowEntity();
markerShowEntity.setMarkerLocation(location);
markerShowEntity.setMarkerType(TYPE_MARKER_CLOUD_STOP_LINE_DATA);
IMogoMarker marker = drawStopLineMarker(markerShowEntity);
}
/**
* 停止线绘制
*/
public IMogoMarker drawStopLineMarker(MarkerShowEntity markerShowEntity) {
MogoMarkerOptions options = new MogoMarkerOptions()
.data(markerShowEntity)
.latitude(markerShowEntity.getMarkerLocation().getLat())
.longitude(markerShowEntity.getMarkerLocation().getLon())
.setGps(false);
IMarkerView iMarkerView = MapMarkerAdapter.getMarkerView(mContext, markerShowEntity, options);
options.icon3DRes(getModelRes(9));
options.anchorColor("#FB3C3CFF");
IMogoMarker marker = MogoMarkerManager.getInstance(mContext).addMarker(markerShowEntity.getMarkerType(), options);
iMarkerView.setMarker(marker);
marker.setToTop();
return marker;
}
}

View File

@@ -0,0 +1,46 @@
package com.mogo.eagle.core.function.impl.marker.view;
import android.content.Context;
import android.util.AttributeSet;
import android.view.View;
import androidx.annotation.Nullable;
import com.mogo.map.marker.IMogoMarker;
public
/**
* @author congtaowang
* @since 2020/12/16
*
* 描述
*/
class EmptyMarkerView extends View implements IMarkerView {
public EmptyMarkerView( Context context ) {
this( context, null );
}
public EmptyMarkerView( Context context, @Nullable AttributeSet attrs ) {
this( context, attrs, 0 );
}
public EmptyMarkerView( Context context, @Nullable AttributeSet attrs, int defStyleAttr ) {
super( context, attrs, defStyleAttr );
}
@Override
public View getView() {
return this;
}
@Override
public void setMarker( IMogoMarker marker ) {
}
@Override
protected void onMeasure( int widthMeasureSpec, int heightMeasureSpec ) {
setMeasuredDimension( 1, 1 );
}
}

View File

@@ -0,0 +1,23 @@
package com.mogo.eagle.core.function.impl.marker.view;
import android.graphics.Bitmap;
import android.view.View;
import com.mogo.map.marker.IMogoMarker;
/**
* @author congtaowang
* @since 2020-02-15
* <p>
* 描述
*/
public interface IMarkerView {
View getView();
default Bitmap getBitmap( int type ){
return null;
}
void setMarker( IMogoMarker marker );
}

View File

@@ -0,0 +1,54 @@
package com.mogo.eagle.core.function.impl.marker.view;
import android.content.Context;
import android.util.AttributeSet;
import android.view.LayoutInflater;
import android.widget.ImageView;
import androidx.annotation.Nullable;
import com.mogo.eagle.core.data.map.entity.MarkerShowEntity;
import com.mogo.eagle.core.function.map.R;
import com.mogo.map.marker.MogoMarkerOptions;
/**
* author : 李小鹏
* desc : 地图2dMarker 在3d下的展示
* version: 1.0
*/
public class MapCameraInfoView extends MapMarkerBaseView {
private String TAG = "MapCameraInfoView";
private ImageView mCameraImage;
public MapCameraInfoView(Context context ) {
super( context );
}
public MapCameraInfoView(Context context, @Nullable AttributeSet attrs ) {
super( context, attrs );
}
public MapCameraInfoView(Context context, @Nullable AttributeSet attrs, int defStyleAttr ) {
super( context, attrs, defStyleAttr );
}
public MapCameraInfoView(Context context, MogoMarkerOptions options ) {
super( context );
mOptions = options;
}
@Override
protected void initView( Context context ) {
LayoutInflater.from( context ).inflate( R.layout.modudle_camera_layout_info, this );
mCameraImage = findViewById( R.id.iv_camera_traffic);
}
@Override
public void updateView( MarkerShowEntity markerShowEntity ) {
}
}

Some files were not shown because too many files have changed in this diff Show More