[2.13.0-opt]remove service module and module-common
This commit is contained in:
@@ -1,19 +1,17 @@
|
||||
package com.mogo.eagle.core.function.hmi.ui.widget
|
||||
|
||||
import android.content.Context
|
||||
import android.graphics.*
|
||||
import android.location.Location
|
||||
import android.util.*
|
||||
import android.graphics.Color
|
||||
import android.util.AttributeSet
|
||||
import android.view.Gravity
|
||||
import android.widget.FrameLayout
|
||||
import com.alibaba.android.arouter.launcher.ARouter
|
||||
import com.mogo.eagle.core.data.constants.MogoServicePaths
|
||||
import com.mogo.eagle.core.data.map.MogoLocation
|
||||
import com.mogo.eagle.core.function.api.map.listener.IMoGoMapLocationListener
|
||||
import com.mogo.eagle.core.function.call.hmi.CallerHmiManager
|
||||
import com.mogo.eagle.core.function.call.map.CallerMapLocationListenerManager
|
||||
import com.mogo.eagle.core.function.hmi.R
|
||||
import com.mogo.eagle.core.utilcode.util.*
|
||||
import com.mogo.map.*
|
||||
import com.mogo.map.navi.IMogoCarLocationChangedListener2
|
||||
import com.mogo.service.IMogoServiceApis
|
||||
import com.mogo.eagle.core.utilcode.util.UiThreadHandler
|
||||
import com.mogo.map.MogoMapUIController
|
||||
import java.util.*
|
||||
|
||||
/**
|
||||
@@ -24,20 +22,16 @@ class SpeedPanelView @JvmOverloads constructor(
|
||||
context: Context,
|
||||
attrs: AttributeSet? = null,
|
||||
defStyleAttr: Int = 0
|
||||
) : FrameLayout(context, attrs, defStyleAttr),
|
||||
IMogoCarLocationChangedListener2 {
|
||||
val TAG = "SpeedPanelView"
|
||||
private var mMogoServiceApis: IMogoServiceApis =
|
||||
ARouter.getInstance().build(MogoServicePaths.PATH_SERVICE_APIS)
|
||||
.navigation(context) as IMogoServiceApis
|
||||
) : FrameLayout(context, attrs, defStyleAttr), IMoGoMapLocationListener {
|
||||
|
||||
companion object {
|
||||
const val TAG = "SpeedPanelView"
|
||||
}
|
||||
|
||||
var mContext: Context
|
||||
var mSpeedChartView: SpeedChartView
|
||||
|
||||
var mLatLng: Location? = null
|
||||
|
||||
var mSpeedLimmit = 60;
|
||||
|
||||
var mLatLng: MogoLocation? = null
|
||||
var mSpeedLimit = 60
|
||||
|
||||
private val timer by lazy {
|
||||
Timer()
|
||||
@@ -45,7 +39,6 @@ class SpeedPanelView @JvmOverloads constructor(
|
||||
|
||||
init {
|
||||
initEvent(context)
|
||||
|
||||
setBackgroundResource(R.drawable.yi_biao_pan_bg_nor)
|
||||
mContext = context
|
||||
mSpeedChartView = SpeedChartView(context)
|
||||
@@ -66,24 +59,23 @@ class SpeedPanelView @JvmOverloads constructor(
|
||||
}
|
||||
}
|
||||
|
||||
private var timerTask : TimerTask? = null
|
||||
private var timerTask: TimerTask? = null
|
||||
|
||||
override fun onAttachedToWindow() {
|
||||
super.onAttachedToWindow() // 注册位置回调
|
||||
mMogoServiceApis.registerCenterApi.registerCarLocationChangedListener(TAG, this)
|
||||
CallerMapLocationListenerManager.addListener(TAG, this, false)
|
||||
// 开启定时查询速度
|
||||
timerTask?.cancel()
|
||||
val task = object : TimerTask() {
|
||||
override fun run() {
|
||||
if (mLatLng != null) {
|
||||
|
||||
mSpeedLimmit = MogoMapUIController.getInstance()
|
||||
.getLimitSpeed(mLatLng!!.longitude, mLatLng!!.latitude, mLatLng!!.bearing)
|
||||
mLatLng?.let {
|
||||
mSpeedLimit = MogoMapUIController.getInstance()
|
||||
.getLimitSpeed(it.longitude, it.latitude, it.bearing)
|
||||
UiThreadHandler.post {
|
||||
val speed = (mLatLng!!.speed * 3.6f).toInt()
|
||||
mSpeedChartView.setArcColor(Color.parseColor(if (speed > mSpeedLimmit) "#DB3137" else "#3E77F6"))
|
||||
val speed = (it.speed * 3.6f).toInt()
|
||||
mSpeedChartView.setArcColor(Color.parseColor(if (speed > mSpeedLimit) "#DB3137" else "#3E77F6"))
|
||||
mSpeedChartView.setValues(speed)
|
||||
setBackgroundResource(if (speed > mSpeedLimmit) R.drawable.yi_biao_pan_bg_speeding else R.drawable.yi_biao_pan_bg_nor)
|
||||
setBackgroundResource(if (speed > mSpeedLimit) R.drawable.yi_biao_pan_bg_speeding else R.drawable.yi_biao_pan_bg_nor)
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -92,11 +84,16 @@ class SpeedPanelView @JvmOverloads constructor(
|
||||
timer.schedule(task, Date(), 100)
|
||||
}
|
||||
|
||||
override fun onLocationChanged(location: MogoLocation?, from: Int, isGps: Boolean) {
|
||||
location?.let {
|
||||
mLatLng = location
|
||||
}
|
||||
}
|
||||
|
||||
override fun onDetachedFromWindow() {
|
||||
super.onDetachedFromWindow()
|
||||
// 解除注册
|
||||
mMogoServiceApis.registerCenterApi
|
||||
.unregisterMogoLocationListener(TAG)
|
||||
CallerMapLocationListenerManager.removeListener(TAG, false)
|
||||
try {
|
||||
timerTask?.cancel()
|
||||
} catch (e: Exception) {
|
||||
@@ -104,9 +101,4 @@ class SpeedPanelView @JvmOverloads constructor(
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
override fun onCarLocationChanged2(latLng: Location) {
|
||||
mLatLng = latLng
|
||||
}
|
||||
|
||||
}
|
||||
@@ -232,8 +232,8 @@ public class MainActivity extends MvpActivity<MainView, MainPresenter> implement
|
||||
MogoModulesManager.getInstance().init(this);
|
||||
IMogoHosListenerRegister listenerRegister = CallerMapUIServiceManager.INSTANCE.getHostListenerRegister();
|
||||
if (listenerRegister != null) {
|
||||
listenerRegister.registerHostMapListener(EventDispatchCenter.getInstance());
|
||||
listenerRegister.registerMarkerClickListener(EventDispatchCenter.getInstance());
|
||||
listenerRegister.registerHostMapListener(TAG,EventDispatchCenter.getInstance());
|
||||
listenerRegister.registerMarkerClickListener(TAG, EventDispatchCenter.getInstance());
|
||||
}
|
||||
|
||||
EventDispatchCenter.getInstance().setMapLoadedCallback(() -> {
|
||||
@@ -246,7 +246,7 @@ public class MainActivity extends MvpActivity<MainView, MainPresenter> implement
|
||||
// TODO 这里临时兼容进入VR模式,标记状态机。有些业务(OCH)会根据状态判断加载
|
||||
MogoStatusManager.getInstance().setVrMode(TAG, true);
|
||||
// 设置地图样式
|
||||
MogoMapListenerHandler.getInstance().onMapModeChanged(EnumMapUI.MAP_STYLE_DAY_VR);
|
||||
MogoMapListenerHandler.Companion.getMogoMapListenerHandler().onMapModeChanged(EnumMapUI.MAP_STYLE_DAY_VR);
|
||||
});
|
||||
CallerLogger.INSTANCE.i(M_HMI + TAG, "App launch timer cost " + (System.currentTimeMillis() - start) + "ms");
|
||||
});
|
||||
@@ -436,8 +436,8 @@ public class MainActivity extends MvpActivity<MainView, MainPresenter> implement
|
||||
CallerAutoPilotStatusListenerManager.INSTANCE.removeListener(TAG);
|
||||
IMogoHosListenerRegister listenerRegister = CallerMapUIServiceManager.INSTANCE.getHostListenerRegister();
|
||||
if (listenerRegister != null) {
|
||||
listenerRegister.unregisterMarkerClickListener();
|
||||
listenerRegister.unregisterHostMapListener();
|
||||
listenerRegister.unregisterMarkerClickListener(TAG);
|
||||
listenerRegister.unregisterHostMapListener(TAG);
|
||||
}
|
||||
IMogoMapUIController mapUIController = CallerMapUIServiceManager.INSTANCE.getMapUIController();
|
||||
if (mapUIController != null) {
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
package com.mogo.eagle.core.function.main;
|
||||
|
||||
import com.mogo.commons.mvp.IView;
|
||||
import com.mogo.service.IMogoServiceApis;
|
||||
|
||||
/**
|
||||
* @author congtaowang
|
||||
|
||||
Reference in New Issue
Block a user