修复 模块加载 类型转换异常

Signed-off-by: 董宏宇 <martindhy@gmail.com>
This commit is contained in:
董宏宇
2021-10-15 18:57:07 +08:00
parent 0e119f8f55
commit da955835a2
35 changed files with 321 additions and 219 deletions

3
.idea/gradle.xml generated
View File

@@ -4,7 +4,7 @@
<component name="GradleSettings">
<option name="linkedExternalProjectsSettings">
<GradleProjectSettings>
<option name="testRunner" value="PLATFORM" />
<option name="testRunner" value="GRADLE" />
<option name="distributionType" value="DEFAULT_WRAPPED" />
<option name="externalProjectPath" value="$PROJECT_DIR$" />
<option name="modules">
@@ -81,7 +81,6 @@
</set>
</option>
<option name="resolveModulePerSourceSet" value="false" />
<option name="useQualifiedModuleNames" value="true" />
</GradleProjectSettings>
</option>
</component>

2
.idea/misc.xml generated
View File

@@ -17,12 +17,14 @@
<entry key="core/function-impl/mogo-core-function-hmi/src/main/res/layout/view_autopilot_status.xml" value="0.25833333333333336" />
<entry key="core/function-impl/mogo-core-function-hmi/src/main/res/layout/view_check_status.xml" value="1.0" />
<entry key="core/function-impl/mogo-core-function-hmi/src/main/res/layout/view_debug_setting.xml" value="0.26614583333333336" />
<entry key="core/function-impl/mogo-core-function-hmi/src/main/res/layout/view_perspective_switch.xml" value="0.24947916666666667" />
<entry key="core/function-impl/mogo-core-function-hmi/src/main/res/layout/view_traffic_light_vr.xml" value="1.0" />
<entry key="modules/mogo-module-adas/src/main/res/drawable/module_adas_left_corner_bg.xml" value="0.22125" />
<entry key="modules/mogo-module-adas/src/main/res/layout/dialog_adas_dispatch_remind.xml" value="0.22658490296325878" />
<entry key="modules/mogo-module-apps/src/main/res/layout/module_apps_fragment_apps.xml" value="0.28125" />
<entry key="modules/mogo-module-apps/src/main/res/layout/module_apps_fragment_apps_navigator.xml" value="0.27395833333333336" />
<entry key="modules/mogo-module-apps/src/main/res/layout/module_apps_item_app.xml" value="0.28125" />
<entry key="modules/mogo-module-extensions/src/main/res/layout-xhdpi-2000x1080/include_navi_info_panle.xml" value="0.3640625" />
<entry key="modules/mogo-module-extensions/src/main/res/layout/module_ext_layout_entrance.xml" value="0.375" />
<entry key="modules/mogo-module-hmi/src/main/res/layout/fragment_warning.xml" value="0.34427083333333336" />
<entry key="modules/mogo-module-hmi/src/main/res/layout/module_hmi_warning_v2x.xml" value="0.246875" />

View File

@@ -267,20 +267,19 @@ public class MogoApplication extends AbsMogoApplication {
if (DebugConfig.isLauncher()) {
MogoModulePaths.addModule(new MogoModule(MogoServicePaths.PATH_BACK, MogoServicePaths.PATH_BACK));
}
MogoModulePaths.addModule(new MogoModule(ServiceConst.PATH_TTS_CONFIG, ServiceConst.PATH_TTS_CONFIG));
MogoModulePaths.addBaseModule(new MogoModule(MogoServicePaths.PATH_WIDGETS, MogoServicePaths.PATH_WIDGETS));
if (DebugConfig.isMapBased()) {
MogoModulePaths.addModule(new MogoModule(CallChatConstant.PROVIDER, CallChatConstant.MODULE_NAME));
}
MogoModulePaths.addBaseModule(new MogoModule(ShareConstants.TAG, ShareConstants.MODEL_NAME));
MogoModulePaths.addModule(new MogoModule(MogoServicePaths.PATH_TANLU_API, "TanluApi"));
MogoModulePaths.addModule(new MogoModule(MogoServicePaths.PATH_SHARE, "ShareControl"));
MogoModulePaths.addModule(new MogoModule(MogoServicePaths.PATH_TRAFFIC_UPLOAD, "TrafficUpload"));
MogoModulePaths.addModule(new MogoModule(LeftPanelConst.PATH_NAME, LeftPanelConst.MODULE_NAME));
MogoModulePaths.addBaseModule(new MogoModule(ServiceConst.PATH_TTS_CONFIG, ServiceConst.PATH_TTS_CONFIG));
MogoModulePaths.addBaseModule(new MogoModule(ShareConstants.TAG, ShareConstants.MODEL_NAME));
MogoModulePaths.addBaseModule(new MogoModule(MogoServicePaths.PATH_TANLU_API, "TanluApi"));
MogoModulePaths.addBaseModule(new MogoModule(MogoServicePaths.PATH_TRAFFIC_UPLOAD, "TrafficUpload"));
MogoModulePaths.addBaseModule(new MogoModule(MogoServicePaths.PATH_SHARE, "ShareControl"));
MogoModulePaths.addBaseModule(new MogoModule(ServiceConst.PATH_REFRESH_STRATEGY, ServiceConst.PATH_REFRESH_STRATEGY));
MogoModulePaths.addBaseModule(new MogoModule(V2XConst.PATH_V2X_UI, V2XConst.MODULE_NAME));
MogoModulePaths.addBaseModule(new MogoModule(MogoServicePaths.PATH_STRATEGY_SHARE, "StrategyShare"));
@@ -288,24 +287,24 @@ public class MogoApplication extends AbsMogoApplication {
MogoModulePaths.addBaseModule(new MogoModule(MogoServicePaths.PATH_MOGO_MONITOR, "MogoMonitor"));
// 域控制器模块(新)
MogoModulePaths.addModuleFunction(new MogoModule(MogoServicePaths.PATH_AUTO_PILOT, "IMoGoAutoPilotProvider"));
MogoModulePaths.addModuleFunctionServer(new MogoModule(MogoServicePaths.PATH_AUTO_PILOT, "IMoGoAutoPilotProvider"));
// OBU 模块
MogoModulePaths.addModuleFunction(new MogoModule(MogoServicePaths.PATH_V2X_OBU_MOGO, "IMoGoObuProvider"));
MogoModulePaths.addModuleFunctionServer(new MogoModule(MogoServicePaths.PATH_V2X_OBU_MOGO, "IMoGoObuProvider"));
// 小地图模块
MogoModulePaths.addModuleFunction(new MogoModule(MogoServicePaths.PATH_SMALL_MAP, "IMogoSmallMapProvider"));
// widgets 模块
MogoModulePaths.addModuleFunction(new MogoModule(MogoServicePaths.PATH_V2X_WARNING, "IMoGoWaringProvider"));
// 自动驾驶系统检测模块
MogoModulePaths.addModule(new MogoModule(MogoServicePaths.PATH_CHECK, "CheckProvider"));
MogoModulePaths.addBaseModule(new MogoModule(MogoServicePaths.PATH_CHECK, "CheckProvider"));
// 推送模块
MogoModulePaths.addModule(new MogoModule(PushUIConstants.PATH, PushUIConstants.NAME));
// 碰撞报警模块
MogoModulePaths.addModule(new MogoModule(MogoServicePaths.PATH_CRASH_WARNING, "IMogoCrashWarnProvider"));
MogoModulePaths.addBaseModule(new MogoModule(MogoServicePaths.PATH_CRASH_WARNING, "IMogoCrashWarnProvider"));
// ADAS模块慢慢被 域控制器模块 替换掉)
MogoModulePaths.addModule(new MogoModule(MogoServicePaths.PATH_ADAS, "AdasProvider"));
MogoModulePaths.addBaseModule(new MogoModule(MogoServicePaths.PATH_ADAS, "AdasProvider"));
// 前方碰撞预警
MogoModulePaths.addModule(new MogoModule(MogoServicePaths.PATH_V2X_FRONT_CRASH_WARNING, "IV2XManagerProvider"));
MogoModulePaths.addBaseModule(new MogoModule(MogoServicePaths.PATH_V2X_FRONT_CRASH_WARNING, "IV2XManagerProvider"));
// 全局语音唤醒
MogoModulePaths.addBaseModule(new MogoModule(MogoServicePaths.PATH_GLOBAL_UNWAKE, "GlobalUnwake"));

View File

@@ -16,6 +16,11 @@ import com.zhidao.support.adas.high.AdasManager
*/
@Route(path = MogoServicePaths.PATH_AUTO_PILOT)
class MoGoAutoPilotProvider : IMoGoAutoPilotProvider {
private val TAG = "MoGoAutoPilotProvider"
override val functionName: String
get() = TAG
override fun init(context: Context) {
// 初始化ADAS 域控制器
@@ -66,7 +71,4 @@ class MoGoAutoPilotProvider : IMoGoAutoPilotProvider {
return AdasManager.getInstance().recordPackage()
}
companion object {
private const val TAG = "MogoAutoPilotProvider"
}
}

View File

@@ -0,0 +1,25 @@
package com.mogo.eagle.core.function.hmi.ui.widget
import android.content.Context
import android.util.AttributeSet
import android.view.LayoutInflater
import android.widget.FrameLayout
import com.mogo.eagle.core.function.hmi.R
/**
*@author xiaoyuzhou
*@date 2021/10/15 11:34 上午
* 视角切换按钮
*/
class PerspectiveSwitchView @JvmOverloads constructor(
context: Context,
attrs: AttributeSet? = null,
defStyleAttr: Int = 0
) : FrameLayout(context, attrs, defStyleAttr) {
init {
LayoutInflater.from(context).inflate(R.layout.view_perspective_switch, this, true)
}
}

View File

@@ -0,0 +1,35 @@
<?xml version="1.0" encoding="utf-8"?>
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/module_switch_model_layout"
android:layout_width="@dimen/module_switch_map"
android:layout_height="@dimen/module_switch_map_height"
android:background="@drawable/module_switch_map_bg"
android:elevation="@dimen/dp_10"
android:padding="@dimen/dp_20">
<LinearLayout
android:id="@+id/module_switch_layout"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_vertical"
android:orientation="horizontal">
<ImageView
android:id="@+id/module_switch_model_icon"
android:layout_width="@dimen/module_switch_image"
android:layout_height="@dimen/module_switch_image"
android:layout_gravity="left|center_vertical"
android:paddingLeft="@dimen/module_switch_margin_left"
android:src="@drawable/module_switch_map_angle" />
<TextView
android:id="@+id/module_switch_model_text"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:gravity="right|center"
android:paddingLeft="@dimen/module_switch_margin_left"
android:text="@string/module_map_model_normal"
android:textColor="@color/module_ext_color_voice_text"
android:textSize="@dimen/module_switch_text_size" />
</LinearLayout>
</FrameLayout>

View File

@@ -1,17 +1,18 @@
package com.mogo.eagle.core.function.notice;
package com.mogo.eagle.core.function.notice
import android.content.Context;
import com.mogo.eagle.core.function.api.notice.IMoGoNoticeProvider;
import android.content.Context
import com.mogo.eagle.core.function.api.notice.IMoGoNoticeProvider
/**
* @author xiaoyuzhou
* @date 2021/9/18 11:44 上午
* 处理云端下发通知、公告类的逻辑的接口
*/
public class MoGoNoticeProvider implements IMoGoNoticeProvider {
@Override
public void init(Context context) {
class MoGoNoticeProvider : IMoGoNoticeProvider {
private val TAG = "MoGoNoticeProvider"
}
}
override val functionName: String
get() = TAG
override fun init(context: Context) {}
}

View File

@@ -18,6 +18,10 @@ class MoGoObuProvider : IMoGoObuProvider {
private var mContext: Context? = null
override val functionName: String
get() = TAG
override fun init(context: Context) {
LogUtils.dTag(TAG, "初始化蘑菇自研OBU……")
mContext = context
@@ -34,4 +38,5 @@ class MoGoObuProvider : IMoGoObuProvider {
}
}
}

View File

@@ -1,5 +1,6 @@
package com.mogo.eagle.core.function.api.base
import android.util.Log
import com.alibaba.android.arouter.facade.template.IProvider
/**
@@ -8,5 +9,17 @@ import com.alibaba.android.arouter.facade.template.IProvider
* 处理没有页面的服务及交互逻辑的提供者
*/
interface IMoGoFunctionServerProvider : IProvider {
/**
* 功能模块唯一标识
*
* @return 功能模块名称
*/
val functionName: String
/**
* 功能销毁回调
*/
fun onDestroy() {
Log.d("IMoGoFunctionServerProvider", "onDestroy")
}
}

View File

@@ -0,0 +1,15 @@
package com.mogo.eagle.core.function.api.map.hd
/**
*@author xiaoyuzhou
*@date 2021/10/15 12:18 下午
* 地图样式改变回调监听
*/
interface IMoGoMapStyleChangeListener {
/**
* 地图样式改变回调监听
*/
fun onMapStyleModeChange(styleMode: Int)
}

View File

@@ -0,0 +1,77 @@
package com.mogo.eagle.core.function.call.map
import androidx.annotation.Nullable
import com.mogo.eagle.core.function.api.map.hd.IMoGoMapStyleChangeListener
import com.mogo.eagle.core.function.call.base.CallerBase
import com.mogo.eagle.core.utilcode.util.LogUtils
/**
* @author xiaoyuzhou
* @date 2021/9/30 5:48 下午
* 地图 监听管理
*/
object CallerMapListenerManager : CallerBase() {
private val TAG = "CallerMapListenerManager"
// 记录地图样式
private var mMapStyleMode = 0
// 存储所有注册了监听的对象invokeXXXX进行遍历回调将信息同步
private val mMapStyleChangeListeners: HashMap<String, IMoGoMapStyleChangeListener> = HashMap()
/**
* 添加 地图样式改变 监听
* @param tag 标记,用来注销监听使用
* @param listener 监听回调
*/
fun addMapStyleChangeListener(
@Nullable tag: String,
@Nullable listener: IMoGoMapStyleChangeListener
) {
mMapStyleChangeListeners[tag] = listener
listener.onMapStyleModeChange(mMapStyleMode)
}
/**
* 删除 地图样式改变 监听
* @param tag 标记,用来注销监听使用
*/
fun removeMapStyleChangeListener(@Nullable tag: String) {
mMapStyleChangeListeners.remove(tag)
}
/**
* 删除 地图样式改变 监听
* @param listener 要删除的监听对象
*/
fun removeMapStyleChangeListener(@Nullable listener: IMoGoMapStyleChangeListener) {
mMapStyleChangeListeners.forEach {
if (it.value == listener) {
mMapStyleChangeListeners.remove(it.key)
}
}
}
/**
* 触发 地图样式改变 监听
*/
fun invokeMapStyleChangeListener() {
invokeMapStyleChangeListener(mMapStyleMode)
}
/**
* 触发 地图样式改变 监听
* @param mapStyleMode 选中状态
*/
fun invokeMapStyleChangeListener(mapStyleMode: Int) {
LogUtils.dTag(TAG, "mapStyleMode:$mapStyleMode")
mMapStyleMode = mapStyleMode
mMapStyleChangeListeners.forEach {
val tag = it.key
val listener = it.value
LogUtils.dTag(TAG, "tag:$tag listener:$listener")
listener.onMapStyleModeChange(mMapStyleMode)
}
}
}

View File

@@ -22,21 +22,21 @@ object CallerObuListenerManager : CallerBase() {
private val mObuStatusListeners: HashMap<String, IMoGoObuStatusListener> = HashMap()
/**
* 查询OBU状态
* 查询 OBU状态
*/
fun getObuStatusInfo(): ObuStatusInfo {
return mObuStatusInfo
}
/**
* 查询OBU状态
* 查询 OBU状态
*/
fun getObuStatusInfoJsonString(): String {
return GsonUtils.toJson(mObuStatusInfo)
}
/**
* 添加自动驾驶按钮选中监听
* 添加 OBU状态 监听
* @param tag 标记,用来注销监听使用
* @param listener 监听回调
*/
@@ -49,7 +49,7 @@ object CallerObuListenerManager : CallerBase() {
}
/**
* 删除 监听
* 删除 OBU状态 监听
* @param tag 标记,用来注销监听使用
*/
fun removeListener(@Nullable tag: String) {
@@ -57,7 +57,7 @@ object CallerObuListenerManager : CallerBase() {
}
/**
* 删除自动驾驶按钮选中监听
* 删除 OBU状态 监听
* @param listener 要删除的监听对象
*/
fun removeListener(@Nullable listener: IMoGoObuStatusListener) {
@@ -69,19 +69,18 @@ object CallerObuListenerManager : CallerBase() {
}
/**
* 触发自动驾驶按钮选中监听
* 触发 OBU状态 监听
*/
fun invokeListener() {
LogUtils.dTag(TAG, "isChecked:$mObuStatusInfo")
invokeListener(mObuStatusInfo)
}
/**
* 触发自动驾驶按钮选中监听
* 触发 OBU状态 监听
* @param obuStatusInfo 选中状态
*/
fun invokeListener(obuStatusInfo: ObuStatusInfo) {
LogUtils.dTag(TAG, "isChecked:$obuStatusInfo")
LogUtils.dTag(TAG, "obuStatusInfo:$obuStatusInfo")
mObuStatusInfo = obuStatusInfo
mObuStatusListeners.forEach {
val tag = it.key

View File

@@ -32,4 +32,13 @@
<dimen name="module_hmi_btn_text_size">44px</dimen>
<dimen name="module_switch_map">279px</dimen>
<dimen name="module_switch_map_height">119px</dimen>
<dimen name="module_switch_margin_left">22px</dimen>
<dimen name="module_switch_text_size">36px</dimen>
<dimen name="module_switch_image">50px</dimen>
<dimen name="module_switch_image_circle">60px</dimen>
</resources>

View File

@@ -5,4 +5,6 @@
<color name="module_switch_map_bg">#323C6F</color>
<color name="module_ext_color_voice_text">#FFFFFF</color>
</resources>

View File

@@ -32,4 +32,13 @@
<dimen name="module_hmi_btn_text_size">33px</dimen>
<dimen name="module_switch_map">190px</dimen>
<dimen name="module_switch_map_height">76px</dimen>
<dimen name="module_switch_margin_left">16px</dimen>
<dimen name="module_switch_text_size">24px</dimen>
<dimen name="module_switch_image">35px</dimen>
<dimen name="module_switch_image_circle">38px</dimen>
</resources>

View File

@@ -4,4 +4,7 @@
<string name="VideoView_info_text_video_not_supported">"不支持该视频。"</string>
<string name="file_not_support">此文件不支持播放</string>
<string name="module_map_model_normal">近距视角</string>
<string name="module_map_model_faster">远距视角</string>
</resources>

View File

@@ -61,7 +61,9 @@ dependencies {
implementation project(':foudations:mogo-utils')
implementation project(':libraries:mogo-map-api')
implementation project(':foudations:mogo-commons')
implementation project(':core:mogo-core-data')
implementation project(':core:mogo-core-function-call')
}
implementation rootProject.ext.dependencies.mogocustommap
}

View File

@@ -17,7 +17,6 @@ import android.util.Log;
import android.view.MotionEvent;
import android.view.View;
import android.view.ViewGroup;
import android.view.animation.Interpolator;
import android.widget.TextView;
import com.mogo.commons.FunctionBuildConfig;
@@ -33,7 +32,6 @@ import com.mogo.map.impl.custom.utils.ObjectUtils;
import com.mogo.map.impl.custom.utils.PointInterpolatorUtil;
import com.mogo.map.impl.custom.utils.ResIdCache;
import com.mogo.map.listener.MogoMapListenerHandler;
import com.mogo.map.marker.IMogoMarker;
import com.mogo.map.uicontroller.CarCursorOption;
import com.mogo.map.uicontroller.EnumMapUI;
import com.mogo.map.uicontroller.IMogoMapUIController;
@@ -458,9 +456,7 @@ public class AMapViewWrapper implements IMogoMapView,
if (visible && NaviClient.getInstance(getContext()).isNaviing()) {
return;
}
// if (DebugConfig.isDebug()) {
// Logger.d(TAG, Log.getStackTraceString(new Throwable()));
// }
if (checkAMapView()) {
MyLocationStyle style = mMapView.getMapAutoViewHelper().getMyLocationStyle();
if (visible) {
@@ -504,9 +500,6 @@ public class AMapViewWrapper implements IMogoMapView,
@Override
public void recoverLockMode() {
if (checkAMapView()) {
// if ( DebugConfig.isDebug() ) {
// Logger.d( TAG, Log.getStackTraceString( new Throwable() ) );
// }
if (mCurrentUI == EnumMapUI.Type_VR) {
return;
}
@@ -562,7 +555,7 @@ public class AMapViewWrapper implements IMogoMapView,
try {
return ObjectUtils.fromAMap(MapTools.INSTANCE.getVisibleRegion().getLeftBottomPoint());
} catch (Exception e) {
e.printStackTrace();
}
return null;
}
@@ -572,7 +565,7 @@ public class AMapViewWrapper implements IMogoMapView,
try {
return ObjectUtils.fromAMap(mMapView.getMapAutoViewHelper().getCenter());
} catch (Exception e) {
e.printStackTrace();
}
return null;
}
@@ -594,6 +587,7 @@ public class AMapViewWrapper implements IMogoMapView,
try {
return MapTools.INSTANCE.toScreenLocation(ObjectUtils.fromMogo(latLng));
} catch (Exception e) {
e.printStackTrace();
return null;
}
}
@@ -607,38 +601,13 @@ public class AMapViewWrapper implements IMogoMapView,
return ObjectUtils.fromAMap(
MapTools.INSTANCE.fromScreenLocation(point));
} catch (Exception e) {
e.printStackTrace();
return null;
}
}
return null;
}
@Override
public void startJumpAnimation(IMogoMarker marker, float high, Interpolator interpolator,
long duration) {
if (marker == null || high <= 0.0f || interpolator == null || duration < 0) {
return;
}
try {
// final LatLng latLng = ObjectUtils.fromMogo2( marker.getPosition() );
// Point point = mMapView.getMap().getProjection().toScreenLocation( latLng );
// point.y -= WindowUtils.dip2px( getContext(), high );
// LatLng target = mMapView.getMap().getProjection().fromScreenLocation( point );
// //使用TranslateAnimation,填写一个需要移动的目标点
// Animation animation = new TranslateAnimation( target );
// animation.setInterpolator( interpolator );
// //整个移动所需要的时间
// animation.setDuration( duration );
// //设置动画
// if ( marker instanceof AMapMarkerWrapper ) {
// ( ( AMapMarkerWrapper ) marker ).getMarker().setAnimation( animation );
// ( ( AMapMarkerWrapper ) marker ).getMarker().startAnimation();
// }
} catch (Exception e) {
Logger.e(TAG, e, "error.");
}
}
@Override
public void setRenderFps(int fps) {
if (checkAMapView()) {
@@ -833,14 +802,6 @@ public class AMapViewWrapper implements IMogoMapView,
//showSelfSpeed(location.getSpeed());
}
private int mDrawlevel;
@Override
public void setAdasRecognizedResult(int drawlevel) {
mDrawlevel = drawlevel;
}
private TextView mSpeedView = null;
private int mLastYOffset = 20;
@@ -936,7 +897,7 @@ public class AMapViewWrapper implements IMogoMapView,
@Override
public void onMapStatusChanged(int type, int value) {
// Logger.i( TAG, "mapop--onMapStatusChanged-: " + type + "," + value );
//Logger.i(TAG, "mapop--onMapStatusChanged-: " + type + "," + value);
}
@Override
@@ -961,7 +922,7 @@ public class AMapViewWrapper implements IMogoMapView,
@Override
public void onCameraChange(int type, int value) {
// Logger.i( TAG, "mapop--onCameraChange-: " + type + "," + value );
//Logger.i(TAG, "mapop--onCameraChange-: " + type + "," + value);
}
@Override
@@ -977,24 +938,11 @@ public class AMapViewWrapper implements IMogoMapView,
}
}
@Override
public void setAnchorScale(float x, float y) {
mMapView.getMapAutoViewHelper().setAnchorScale(x, y);
}
@Override
public void setAnchorRate(float rate) {
mMapView.getMapAutoViewHelper().setAnchorRate(rate);
}
@Override
public void emphasizeMyLocation() {
}
//目前切换完vr之后会立即回调其他样式这里做一个判断
// private boolean mVrModeAutoChangedFlag = false;
@Override
public void onChangeMapStyle(int i) {
@@ -1012,11 +960,6 @@ public class AMapViewWrapper implements IMogoMapView,
// 进入vr模式的时候自动切换到车头朝上
change2CarUp();
}
// else if ( i == MapAutoApi.MAP_PERSPECTIVE_2D ) {
// mCurrentUI = EnumMapUI.CarUp_2D;
// } else if ( i == MapAutoApi.MAP_PERSPECTIVE_3D ) {
// mCurrentUI = EnumMapUI.CarUp_3D;
// }
if (last == mCurrentUI) {
Logger.d(TAG, "currentUI is same as last = %s", mCurrentUI);
@@ -1024,17 +967,11 @@ public class AMapViewWrapper implements IMogoMapView,
}
// vr 模式切换到普通模式下,保持之前的白天模式 wtf.
if (last == EnumMapUI.Type_VR
&& mCurrentUI != last
&& mCurrentUI != EnumMapUI.Type_Light) {
if (last == EnumMapUI.Type_VR && mCurrentUI != EnumMapUI.Type_Light) {
if (mIsLightStyle) {
changeMapMode(EnumMapUI.Type_Light);
return;
}
// if ( mVrModeAutoChangedFlag ) {
// mVrModeAutoChangedFlag = false;
// return;
// }
}
Logger.d(TAG, Log.getStackTraceString(new Throwable()));
if (mCurrentUI != null) {
@@ -1066,7 +1003,6 @@ public class AMapViewWrapper implements IMogoMapView,
if (isVrMode) {
if (mCurrentUI != EnumMapUI.Type_VR) {
Logger.d(TAG, "自动切换为vr模式");
// mVrModeAutoChangedFlag = true;
changeMapMode(EnumMapUI.Type_VR);
}
} else {

View File

@@ -4,10 +4,8 @@ import android.graphics.Point;
import android.graphics.Rect;
import android.location.Location;
import android.view.View;
import android.view.animation.Interpolator;
import com.mogo.eagle.core.data.map.MogoLatLng;
import com.mogo.map.marker.IMogoMarker;
import com.mogo.map.uicontroller.CarCursorOption;
import com.mogo.map.uicontroller.EnumMapUI;
import com.mogo.map.uicontroller.IMogoMapUIController;
@@ -221,13 +219,6 @@ public class AMapUIController implements IMogoMapUIController {
return null;
}
@Override
public void startJumpAnimation(IMogoMarker marker, float high, Interpolator interpolator,
long duration) {
if (mClient != null) {
mClient.startJumpAnimation(marker, high, interpolator, duration);
}
}
@Override
public void setRenderFps(int fps) {
@@ -308,21 +299,11 @@ public class AMapUIController implements IMogoMapUIController {
return MapAutoApi.INSTANCE.getTileID(lon, lat, 13); // 13为默认获取瓦片层级级别
}
@Override
public void setAnchorScale(float x, float y) {
}
@Override
public void emphasizeMyLocation() {
}
@Override
public void setAnchorRate(float rate) {
}
@Override
public void rtkEnable(boolean enable) {
if (mClient != null) {
@@ -374,10 +355,4 @@ public class AMapUIController implements IMogoMapUIController {
}
}
@Override
public void setAdasRecognizedResult(int drawlevel) {
if (mClient != null) {
mClient.setAdasRecognizedResult(drawlevel);
}
}
}

View File

@@ -172,20 +172,6 @@ public interface IMogoMapUIController {
*/
MogoLatLng getLocationMogoLatLngInScreen(Point point);
/**
* marker 跳跃动画
* <p>
* Deprecated, instead of by {@link IMogoMarker#startJumpAnimation(float, long, Interpolator, OnMarkerAnimationListener)}
*
* @param marker 跳跃的 marker
* @param high 跳跃的高度
* @param interpolator 插值器
* @param duration 动画时间
*/
@Deprecated
void startJumpAnimation(IMogoMarker marker, float high, Interpolator interpolator,
long duration);
/**
* 设置刷新帧率
*/
@@ -250,8 +236,6 @@ public interface IMogoMapUIController {
*/
void changeBearing(float bearing);
void setAdasRecognizedResult(int drawlevel);
/**
* 获取瓦片id
*
@@ -262,13 +246,6 @@ public interface IMogoMapUIController {
long getTileId(double lon, double lat);
default void setAnchorScale(float x, float y) {
}
default void setAnchorRate(float rate) {
}
default void testGpsData() {

View File

@@ -4,10 +4,8 @@ import android.graphics.Point;
import android.graphics.Rect;
import android.location.Location;
import android.view.View;
import android.view.animation.Interpolator;
import com.mogo.eagle.core.data.map.MogoLatLng;
import com.mogo.map.marker.IMogoMarker;
import com.mogo.map.uicontroller.CarCursorOption;
import com.mogo.map.uicontroller.EnumMapUI;
import com.mogo.map.uicontroller.IMogoMapUIController;
@@ -255,14 +253,6 @@ public class MogoMapUIController implements IMogoMapUIController {
return null;
}
@Override
public void startJumpAnimation(IMogoMarker marker, float high, Interpolator interpolator, long duration) {
initDelegate();
if (mDelegate != null) {
mDelegate.startJumpAnimation(marker, high, interpolator, duration);
}
}
@Override
public void setRenderFps(int fps) {
initDelegate();
@@ -420,12 +410,4 @@ public class MogoMapUIController implements IMogoMapUIController {
mDelegate.clearRoadCacheById(id);
}
}
@Override
public void setAdasRecognizedResult(int drawlevel) {
initDelegate();
if (mDelegate != null) {
mDelegate.setAdasRecognizedResult(drawlevel);
}
}
}

View File

@@ -22,6 +22,8 @@ public class MogoModulePaths {
private static final List<MogoModule> mModuleFunctions = new ArrayList<>();
private static final List<MogoModule> mModuleFunctionServers = new ArrayList<>();
/**
* 地图模块 fragment 路径
*/
@@ -38,17 +40,6 @@ public class MogoModulePaths {
*/
public static final String PATH_ENTRANCE = "/extension/entrance";
/**
* 添加卡片模块
*
* @param path
*/
@Deprecated
public static void addModule(String path) {
throw new IllegalArgumentException("this method can't be invoked.");
}
/**
* 添加卡片模块
*
@@ -73,6 +64,18 @@ public class MogoModulePaths {
mModuleFunctions.add(module);
}
/**
* 添加 功能服务, 不带UI Fragment的
*
* @param module 功能模块
*/
public static void addModuleFunctionServer(MogoModule module) {
if (module == null || TextUtils.isEmpty(module.getPath().replace(" ", ""))) {
throw new IllegalArgumentException("module path can't be empty or null or blank");
}
mModuleFunctionServers.add(module);
}
/**
* 添加基础模块
*
@@ -96,4 +99,8 @@ public class MogoModulePaths {
public static List<MogoModule> getModuleFunctions() {
return mModuleFunctions;
}
public static List<MogoModule> getModuleFunctionServers() {
return mModuleFunctionServers;
}
}

Binary file not shown.

Before

Width:  |  Height:  |  Size: 862 B

View File

@@ -2,12 +2,4 @@
<resources>
<dimen name="module_ext_top_view_width_in_vr_mode">1100px</dimen>
<dimen name="module_switch_map">279px</dimen>
<dimen name="module_switch_map_height">119px</dimen>
<dimen name="module_switch_margin_left">22px</dimen>
<dimen name="module_switch_text_size">36px</dimen>
<dimen name="module_switch_image">50px</dimen>
<dimen name="module_switch_image_circle">60px</dimen>
</resources>

View File

@@ -184,11 +184,4 @@
<dimen name="module_switch_map">190px</dimen>
<dimen name="module_switch_map_height">76px</dimen>
<dimen name="module_switch_margin_left">16px</dimen>
<dimen name="module_switch_text_size">24px</dimen>
<dimen name="module_switch_image">35px</dimen>
<dimen name="module_switch_image_circle">38px</dimen>
</resources>

View File

@@ -1,6 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<color name="module_ext_color_voice_text">#FFFFFF</color>
<color name="module_ext_weather_bkg_color">#BF30334C</color>
<color name="module_ext_weather_text_color">#fff</color>
<color name="module_ext_vr_mode_left_notice_content_text_color">#f1f1f1</color>

View File

@@ -244,12 +244,4 @@
<dimen name="module_video_window_width_content">400px</dimen>
<dimen name="module_video_window_height_content">300px</dimen>
<dimen name="module_switch_map">190px</dimen>
<dimen name="module_switch_map_height">76px</dimen>
<dimen name="module_switch_margin_left">16px</dimen>
<dimen name="module_switch_text_size">24px</dimen>
<dimen name="module_switch_image">35px</dimen>
<dimen name="module_switch_image_circle">38px</dimen>
</resources>

View File

@@ -69,7 +69,5 @@
<item>提前看看出行路况,试试唤醒小智说,“中关村路况怎么样”</item>
</string-array>
<string name="module_map_model_normal">近距视角</string>
<string name="module_map_model_faster">远距视角</string>
</resources>

View File

@@ -29,6 +29,11 @@ public interface MogoModulesHandler {
*/
void loadFunctionModules();
/**
* 架构升级v1.1加载功能模块
*/
void loadFunctionModulesServer();
/**
* 加载地图
*

View File

@@ -5,8 +5,10 @@ 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.eagle.core.function.api.base.IMoGoFunctionProvider;
import com.mogo.eagle.core.function.api.base.IMoGoFunctionServerProvider;
import com.mogo.module.common.MogoApisHandler;
import com.mogo.module.common.MogoModule;
import com.mogo.module.common.MogoModulePaths;
@@ -43,6 +45,10 @@ public class MogoModulesManager implements MogoModulesHandler {
private Map< MogoModule, IMoGoFunctionProvider> mModuleFunctionProviders = new HashMap<>();
private Map< String, IMoGoFunctionProvider> mModuleNameFunctionProviders = new HashMap<>();
// 架构升级后的加载功能模块的方式
private Map< MogoModule, IMoGoFunctionServerProvider> mModuleFunctionServerProviders = new HashMap<>();
private Map< String, IMoGoFunctionServerProvider> mModuleNameFunctionServerProviders = new HashMap<>();
private static volatile MogoModulesManager sInstance;
private MogoModulesManager() {
@@ -121,6 +127,21 @@ public class MogoModulesManager implements MogoModulesHandler {
}
}
@Override
public void loadFunctionModulesServer() {
final List< MogoModule > modules = MogoModulePaths.getModuleFunctionServers();
if ( modules != null && !modules.isEmpty() ) {
for ( MogoModule module : modules ) {
Logger.d( TAG, "module.getPath():" + module.getPath() + " name: " + module.getName() );
IMoGoFunctionServerProvider provider = loadFunctionServer( module.getPath() );
if ( provider != null ) {
mModuleFunctionServerProviders.put( module, provider );
mModuleNameFunctionServerProviders.put( module.getName(), provider );
}
}
}
}
@Override
public void loadMapModule( int containerId ) {
Logger.d( TAG, "loadMapModule" );
@@ -168,7 +189,7 @@ public class MogoModulesManager implements MogoModulesHandler {
continue;
}
Logger.d( TAG, "加载基本模块:%s", baseModule.getPath() );
load( baseModule.getPath() );
loadBaseProvider( baseModule.getPath() );
}
}
@@ -181,6 +202,15 @@ public class MogoModulesManager implements MogoModulesHandler {
}
private IProvider loadBaseProvider(String path ) {
try {
return ( IProvider ) ARouter.getInstance().build( path ).navigation( getContext() );
} catch ( Exception e ) {
e.printStackTrace();
return null;
}
}
private IMogoModuleProvider load( String path ) {
try {
return ( IMogoModuleProvider ) ARouter.getInstance().build( path ).navigation( getContext() );
@@ -199,6 +229,15 @@ public class MogoModulesManager implements MogoModulesHandler {
}
}
private IMoGoFunctionServerProvider loadFunctionServer(String path ) {
try {
return ( IMoGoFunctionServerProvider ) ARouter.getInstance().build( path ).navigation( getContext() );
} catch ( Exception e ) {
e.printStackTrace();
return null;
}
}
private void addFragment( IMogoModuleProvider provider, int containerId ) {
if ( provider == null ) {
Logger.e( TAG, "add fragment fail cause provider == null, container is %s", ResourcesHelper.getResNameById( getApplicationContext(), containerId ) );
@@ -272,6 +311,23 @@ public class MogoModulesManager implements MogoModulesHandler {
if ( mModuleFunctionProviders != null ) {
mModuleFunctionProviders.clear();
}
if ( mModuleFunctionServerProviders != null ) {
Collection< IMoGoFunctionServerProvider > modules = mModuleFunctionServerProviders.values();
if ( modules != null ) {
for ( IMoGoFunctionServerProvider module : modules ) {
try {
Logger.d( TAG, "destroy module: " + module.getFunctionName() );
module.onDestroy();
} catch ( Exception e ) {
Logger.e( TAG, e, "onDestroy" );
}
}
}
mModuleNameFunctionProviders.clear();
}
if ( mModuleFunctionServerProviders != null ) {
mModuleFunctionServerProviders.clear();
}
mActivity = null;
}
}

View File

@@ -460,14 +460,7 @@ public class MogoADASController implements IMogoADASController {
@Override
public EnumMapUI getCurrentSkinMode() {
if (!DebugConfig.isMapBased()) {
return EnumMapUI.Type_Night;
}
boolean white = AdasConfigApiController.getInstance().isShowUISkinWhiteModel();
if (!white) {
return EnumMapUI.Type_Night;
}
return EnumMapUI.Type_Light;
return EnumMapUI.Type_VR;
}
@Override