「Change」

1、增加白天夜间模式切换
进入白天模式
 CallerMoGoUiSettingManager.stepInDayMode()
退出白天模式
 CallerMoGoUiSettingManager.stepOutDayMode()
监听换肤模式切换,需要实现IMoGoSkinModeChangeListener接口
CallerSkinModeListenerManager.INSTANCE.addListener(TAG, this);
移除换肤模式切换
2、增加切换白天、黑夜模式变换状态栏文字颜色

Signed-off-by: donghongyu <donghongyu@zhidaoauto.com>
This commit is contained in:
donghongyu
2022-04-13 21:30:51 +08:00
parent 517805220e
commit bb1baa023b
22 changed files with 353 additions and 180 deletions

View File

@@ -40,6 +40,7 @@ import com.mogo.eagle.core.function.call.map.CallerMapUIServiceManager
import com.mogo.eagle.core.function.call.map.CallerSmpManager
import com.mogo.eagle.core.function.call.obu.CallerOBUManager
import com.mogo.eagle.core.function.call.obu.CallerObuListenerManager
import com.mogo.eagle.core.function.call.setting.CallerMoGoUiSettingManager
import com.mogo.eagle.core.function.call.telematic.CallerTelematicManager
import com.mogo.eagle.core.function.hmi.R
import com.mogo.eagle.core.function.hmi.ui.logcatch.ILogViewListener
@@ -460,10 +461,14 @@ class DebugSettingView @JvmOverloads constructor(
/**
* 修改地图样式按钮(白天模式、夜间模式)
* 修改皮肤样式按钮(白天模式、夜间模式)
*/
tbChangeCurrentMapStyle.setOnCheckedChangeListener { _, isChecked ->
CallerHDMapManager.stepInVrMode(isChecked)
tbChangeCurrentSkinMode.setOnCheckedChangeListener { _, isChecked ->
if (isChecked) {
CallerMoGoUiSettingManager.stepInDayMode()
} else {
CallerMoGoUiSettingManager.stepOutDayMode()
}
}
//设置鹰眼本地参数配置监听

View File

@@ -15,9 +15,12 @@ import com.alibaba.android.arouter.launcher.ARouter;
import com.mogo.commons.debug.DebugConfig;
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.setting.CallerSkinModeListenerManager;
import com.mogo.eagle.core.function.hmi.R;
import com.mogo.eagle.core.utilcode.mogo.AppIdentityModeUtils;
import com.mogo.eagle.core.utilcode.mogo.logger.CallerLogger;
import com.mogo.eagle.core.utilcode.util.BarUtils;
import com.mogo.service.intent.IMogoIntentListener;
/**
@@ -25,7 +28,7 @@ import com.mogo.service.intent.IMogoIntentListener;
*
* @author tongchenfei
*/
public class MainLauncherActivity extends MainActivity implements IMogoIntentListener {
public class MainLauncherActivity extends MainActivity implements IMogoIntentListener, IMoGoSkinModeChangeListener {
private static final String TAG = "MainLauncherActivity";
protected boolean mIsHomeKeyDown = false;
private final static Handler handlerV2XEvent = new Handler();
@@ -54,6 +57,8 @@ public class MainLauncherActivity extends MainActivity implements IMogoIntentLis
protected void onStart() {
super.onStart();
getApis().getIntentManagerApi().registerIntentListener(Intent.ACTION_CLOSE_SYSTEM_DIALOGS, this);
// 添加换肤监听
CallerSkinModeListenerManager.INSTANCE.addListener(TAG, this);
//ActivityLifecycleManager.getInstance().setAppActive(true);
}
@@ -106,6 +111,8 @@ public class MainLauncherActivity extends MainActivity implements IMogoIntentLis
} catch (Exception e) {
e.printStackTrace();
}
// 移除换肤监听
CallerSkinModeListenerManager.INSTANCE.removeListener(TAG);
}
private void stopCountDown() {
@@ -115,4 +122,12 @@ public class MainLauncherActivity extends MainActivity implements IMogoIntentLis
}
}
@Override
public void onSkinModeChange(int skinMode) {
if (skinMode == 0) {
BarUtils.setStatusBarLightMode(this, false);
} else {
BarUtils.setStatusBarLightMode(this, true);
}
}
}

View File

@@ -701,8 +701,7 @@
android:drawableEnd="@drawable/icon_right"
android:padding="@dimen/dp_20"
android:textOff="车辆状态"
android:textOn="车辆状态"
/>
android:textOn="车辆状态" />
<LinearLayout
android:id="@+id/vehicleStateLayout"
@@ -716,8 +715,7 @@
style="@style/DebugSettingText"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="方向盘转向角:"
/>
android:text="方向盘转向角:" />
<View
android:layout_width="match_parent"
@@ -729,8 +727,7 @@
style="@style/DebugSettingText"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="挂挡档位:"
/>
android:text="挂挡档位:" />
<View
android:layout_width="match_parent"
@@ -844,13 +841,12 @@
android:layout_height="wrap_content"
android:gravity="center"
android:padding="@dimen/dp_5"
android:paddingStart="@dimen/dp_20"
android:paddingEnd="@dimen/dp_20"
android:text="设置刹车加速度阈值"
android:textSize="@dimen/dp_24"
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintTop_toTopOf="parent"
android:paddingStart="@dimen/dp_20"
android:paddingEnd="@dimen/dp_20"
/>
app:layout_constraintTop_toTopOf="parent" />
<androidx.appcompat.widget.LinearLayoutCompat
android:layout_width="0dp"
@@ -893,8 +889,7 @@
android:layout_width="match_parent"
android:layout_height="1dp"
android:background="#F0F0F0"
app:layout_constraintTop_toBottomOf="@id/btnBrakeThreshold"
/>
app:layout_constraintTop_toBottomOf="@id/btnBrakeThreshold" />
<Button
android:id="@+id/btnConnectServerIp"
@@ -902,13 +897,12 @@
android:layout_height="wrap_content"
android:gravity="center"
android:padding="@dimen/dp_5"
android:text="连接司机屏IP"
android:textSize="@dimen/dp_24"
android:paddingStart="@dimen/dp_20"
android:paddingEnd="@dimen/dp_20"
app:layout_constraintTop_toBottomOf="@id/brakeThresholdDivider"
android:text="连接司机屏IP"
android:textSize="@dimen/dp_24"
app:layout_constraintLeft_toLeftOf="parent"
/>
app:layout_constraintTop_toBottomOf="@id/brakeThresholdDivider" />
<androidx.appcompat.widget.AppCompatEditText
android:id="@+id/etConnectServerIp"
@@ -924,9 +918,9 @@
android:textColor="#1A1A1A"
android:textSize="14sp"
app:layout_constraintBottom_toBottomOf="@id/btnConnectServerIp"
app:layout_constraintTop_toTopOf="@id/btnConnectServerIp"
app:layout_constraintLeft_toRightOf="@id/btnConnectServerIp"
app:layout_constraintRight_toRightOf="parent"/>
app:layout_constraintRight_toRightOf="parent"
app:layout_constraintTop_toTopOf="@id/btnConnectServerIp" />
</androidx.constraintlayout.widget.ConstraintLayout>
@@ -949,6 +943,19 @@
android:columnCount="2"
android:visibility="gone">
<ToggleButton
android:id="@+id/tbChangeCurrentSkinMode"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_columnWeight="1"
android:layout_margin="2dp"
android:gravity="center"
android:textOff="切换地图为「白天模式」"
android:textOn="切换地图为「夜间模式」"
android:textSize="@dimen/dp_24"
app:layout_constraintLeft_toRightOf="@+id/tbChangeCurrentCarIcon"
app:layout_constraintTop_toTopOf="@id/tbChangeCurrentCarIcon" />
<ToggleButton
android:id="@+id/tbSpeedView"
android:layout_width="wrap_content"
@@ -1128,18 +1135,6 @@
app:layout_constraintRight_toLeftOf="@id/btnDrawTrolley"
app:layout_constraintTop_toBottomOf="@id/reset_changesight" />
<ToggleButton
android:id="@+id/tbChangeCurrentMapStyle"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_margin="2dp"
android:gravity="center"
android:textOff="切换地图为「白天模式」"
android:textOn="切换地图为「夜间模式」"
android:textSize="@dimen/dp_24"
app:layout_constraintLeft_toRightOf="@+id/tbChangeCurrentCarIcon"
app:layout_constraintTop_toTopOf="@id/tbChangeCurrentCarIcon" />
<Button
android:id="@+id/btnDrawTrolley"
android:layout_width="0dp"
@@ -1643,90 +1638,82 @@
android:drawableEnd="@drawable/icon_right"
android:padding="@dimen/dp_20"
android:textOff="应用包管理中心"
android:textOn="应用包管理中心"
/>
android:textOn="应用包管理中心" />
<androidx.constraintlayout.widget.ConstraintLayout
android:id="@+id/apkCenterLayout"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:visibility="gone"
>
android:visibility="gone">
<ImageView
android:id="@+id/ivApkSearch"
android:layout_width="40dp"
android:layout_height="40dp"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintRight_toRightOf="parent"
android:src="@drawable/icon_search"
android:padding="10dp"
android:layout_marginEnd="10dp"
/>
android:padding="10dp"
android:src="@drawable/icon_search"
app:layout_constraintRight_toRightOf="parent"
app:layout_constraintTop_toTopOf="parent" />
<androidx.appcompat.widget.AppCompatEditText
android:id="@+id/etApkSearch"
android:layout_width="0dp"
android:layout_height="0dp"
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintRight_toLeftOf="@id/ivApkSearch"
app:layout_constraintTop_toTopOf="@id/ivApkSearch"
app:layout_constraintBottom_toBottomOf="@id/ivApkSearch"
android:layout_marginStart="@dimen/dp_30"
android:layout_marginTop="@dimen/dp_10"
android:layout_marginEnd="@dimen/dp_20"
android:layout_marginBottom="@dimen/dp_10"
android:background="@drawable/debug_setting_edit_bg"
android:gravity="center"
android:hint="请输入搜索关键字如版本号等"
android:textColor="#1A1A1A"
android:textSize="14sp"
android:hint="请输入搜索关键字如版本号等"
/>
app:layout_constraintBottom_toBottomOf="@id/ivApkSearch"
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintRight_toLeftOf="@id/ivApkSearch"
app:layout_constraintTop_toTopOf="@id/ivApkSearch" />
<CheckBox
android:id="@+id/cbApkOnline"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:checked="true"
android:padding="@dimen/dp_10"
android:text="Online"
android:textColor="#000"
android:textSize="@dimen/dp_24"
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintRight_toLeftOf="@id/cbApkQa"
app:layout_constraintTop_toBottomOf="@id/ivApkSearch"
android:checked="true"
/>
app:layout_constraintTop_toBottomOf="@id/ivApkSearch" />
<CheckBox
android:id="@+id/cbApkQa"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:checked="true"
android:padding="@dimen/dp_10"
android:text="QA"
android:textColor="#000"
android:textSize="@dimen/dp_24"
app:layout_constraintLeft_toRightOf="@id/cbApkOnline"
app:layout_constraintRight_toRightOf="parent"
app:layout_constraintTop_toBottomOf="@id/ivApkSearch"
android:checked="true"
/>
app:layout_constraintTop_toBottomOf="@id/ivApkSearch" />
<View
android:id="@+id/apkSearchDivider"
android:layout_width="match_parent"
android:layout_height="1dp"
android:background="#F0F0F0"
app:layout_constraintTop_toBottomOf="@id/cbApkQa"
android:layout_marginTop="@dimen/dp_10"
/>
android:background="#F0F0F0"
app:layout_constraintTop_toBottomOf="@id/cbApkQa" />
<androidx.recyclerview.widget.RecyclerView
android:id="@+id/rvUpgradeVersionList"
android:layout_width="match_parent"
android:layout_height="wrap_content"
app:layout_constraintTop_toBottomOf="@id/apkSearchDivider"
android:nestedScrollingEnabled="false"
/>
app:layout_constraintTop_toBottomOf="@id/apkSearchDivider" />
</androidx.constraintlayout.widget.ConstraintLayout>

View File

@@ -9,7 +9,6 @@ import com.mogo.commons.AbsMogoApplication;
import com.mogo.eagle.core.data.config.FunctionBuildConfig;
import com.mogo.eagle.core.data.enums.TrafficTypeEnum;
import com.mogo.eagle.core.utilcode.mogo.logger.CallerLogger;
import com.mogo.eagle.core.utilcode.util.UiThreadHandler;
import com.mogo.map.MogoMarkerManager;
import com.mogo.module.common.MogoApisHandler;
import com.mogo.module.common.utils.DrivingDirectionUtils;
@@ -51,7 +50,6 @@ public class IdentifyDataDrawer {
private IdentifyDataDrawer() {
mContext = AbsMogoApplication.getApp();
addPreVehicleModel();
}
public static IdentifyDataDrawer getInstance() {
@@ -178,44 +176,4 @@ public class IdentifyDataDrawer {
trafficDataUuidList.clear();
}
private void addPreVehicleModel() {
CallerLogger.INSTANCE.d(TAG, "添加感知模型到地图中……");
addPreVehicleModelWeiZhi(TrafficTypeEnum.TYPE_TRAFFIC_ID_WEI_ZHI, "添加感知模型到地图中……preVehicleStrWeiZhi=");
addPreVehicleModelWeiZhi(TrafficTypeEnum.TYPE_TRAFFIC_ID_PEOPLE, "添加感知模型到地图中……preVehicleStrPeople=");
addPreVehicleModelWeiZhi(TrafficTypeEnum.TYPE_TRAFFIC_ID_BICYCLE, "添加感知模型到地图中……preVehicleStrBicycle=");
addPreVehicleModelWeiZhi(TrafficTypeEnum.TYPE_TRAFFIC_ID_TA_CHE, "添加感知模型到地图中……preVehicleStrTaChe=");
addPreVehicleModelWeiZhi(TrafficTypeEnum.TYPE_TRAFFIC_ID_MOTO, "添加感知模型到地图中……preVehicleStrMoto=");
addPreVehicleModelWeiZhi(TrafficTypeEnum.TYPE_TRAFFIC_ID_BUS, "添加感知模型到地图中……preVehicleStrBus=");
addPreVehicleModelWeiZhi(TrafficTypeEnum.TYPE_TRAFFIC_ID_TRUCK, "添加感知模型到地图中……preVehicleStrTruck=");
}
/**
* 添加模型到地图中
*
* @param typeTrafficIdWeiZhi
* @param s
*/
private void addPreVehicleModelWeiZhi(TrafficTypeEnum typeTrafficIdWeiZhi, String s) {
String preVehicleStrWeiZhi = MogoMarkerManager.getInstance(mContext)
.addPreVehicleModel(typeTrafficIdWeiZhi.getType(),
typeTrafficIdWeiZhi.getTraffic3DIconId());
CallerLogger.INSTANCE.d(TAG, s + preVehicleStrWeiZhi);
if (preVehicleStrWeiZhi == null) {
UiThreadHandler.postDelayed(new Runnable() {
@Override
public void run() {
CallerLogger.INSTANCE.w(TAG, "添加感知模型到地图中失败,尝试重复添加……");
addPreVehicleModelWeiZhi(typeTrafficIdWeiZhi, s);
}
}, 1000L);
}
}
}

View File

@@ -11,6 +11,9 @@ import com.mogo.commons.mvp.MvpFragment;
import com.mogo.eagle.core.data.constants.MoGoFragmentPaths;
import com.mogo.eagle.core.data.map.CenterLine;
import com.mogo.eagle.core.function.api.map.hd.IMoGoMapFragmentProvider;
import com.mogo.eagle.core.function.api.setting.IMoGoSkinModeChangeListener;
import com.mogo.eagle.core.function.call.map.CallerHDMapManager;
import com.mogo.eagle.core.function.call.setting.CallerSkinModeListenerManager;
import com.mogo.map.IMogoMap;
import com.mogo.map.IMogoUiSettings;
import com.mogo.map.MogoMapView;
@@ -25,7 +28,7 @@ import com.mogo.map.uicontroller.IMogoMapUIController;
*/
@Route(path = MoGoFragmentPaths.PATH_FRAGMENT_MAP)
public class MapFragment extends MvpFragment<MapView, MapPresenter>
implements MapView, IMoGoMapFragmentProvider {
implements MapView, IMoGoMapFragmentProvider, IMoGoSkinModeChangeListener {
private static final String TAG = "MapFragment";
@@ -71,6 +74,8 @@ public class MapFragment extends MvpFragment<MapView, MapPresenter>
if (mMogoMap != null) {
mMogoMap.getUIController().showMyLocation(true);
}
// 添加换肤监听
CallerSkinModeListenerManager.INSTANCE.addListener(TAG, this);
}
@NonNull
@@ -163,6 +168,7 @@ public class MapFragment extends MvpFragment<MapView, MapPresenter>
@Override
public void onDestroyView() {
CallerSkinModeListenerManager.INSTANCE.removeListener(TAG);
if (mMogoMapView != null) {
mMogoMapView.onDestroy();
mMogoMapView = null;
@@ -226,4 +232,14 @@ public class MapFragment extends MvpFragment<MapView, MapPresenter>
public CenterLine getCenterLineInfo(double lon, double lat, float angle) {
return mMogoMapView.getMap().getUIController().getCenterLineInfo(lon, lat, angle);
}
@Override
public void onSkinModeChange(int skinMode) {
if (skinMode == 0) {
CallerHDMapManager.INSTANCE.stepInVrMode(false);
} else if (skinMode == 1) {
CallerHDMapManager.INSTANCE.stepInVrMode(true);
}
}
}

View File

@@ -12,67 +12,78 @@ enum class TrafficTypeEnum(
var type: Int,
var desc: String,
var traffic2DIconId: Int,
var traffic3DIconId: Int
var traffic3DIconId: Int,
var traffic3DNightIconId: Int
) {
TYPE_TRAFFIC_ID_WEI_ZHI(
100,
"未知数据",
R.raw.fangkuang,
R.raw.fangkuang,
R.raw.fangkuang
),
TYPE_TRAFFIC_ID_PEOPLE(
1,
"",
R.raw.traffic_people,
R.raw.traffic_people_day,
R.raw.traffic_people
),
TYPE_TRAFFIC_ID_BICYCLE(
2,
"自行车",
R.raw.traffic_zixingche,
R.raw.traffic_zixingche_day,
R.raw.traffic_zixingche
),
TYPE_TRAFFIC_ID_TA_CHE(
3,
"他车",
R.raw.traffic_tachexiaoche,
R.raw.traffic_tachexiaoche_day,
R.raw.traffic_tachexiaoche
),
TYPE_TRAFFIC_ID_MOTO(
4,
"摩托",
R.raw.traffic_motuoche,
R.raw.traffic_motuoche_day,
R.raw.traffic_motuoche
),
TYPE_TRAFFIC_ID_BUS(
6,
"大巴",
R.raw.traffic_daba,
R.raw.traffic_daba_day,
R.raw.traffic_daba
),
TYPE_TRAFFIC_ID_TRUCK(
8,
"卡车",
R.raw.traffic_daba,
R.raw.traffic_daba_day,
R.raw.traffic_daba
),
TYPE_TRAFFIC_ID_CAMERA(
9,
"摄像头",
R.raw.shexiangtou,
R.raw.shexiangtou,
R.raw.shexiangtou
),
TYPE_TRAFFIC_ID_SPECIAL_VEHICLE(
11,
"特殊车辆",
R.raw.special_vehicle,
R.raw.special_vehicle,
R.raw.special_vehicle
),
TYPE_TRAFFIC_ID_DAO_LU_SHI_GONG(
12,
"道路施工",
R.raw.v2x_shigong_warning,
R.raw.v2x_shigong_warning,
R.raw.v2x_shigong_warning
);

View File

@@ -44,13 +44,12 @@ dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation rootProject.ext.dependencies.kotlinstdlibjdk7
implementation rootProject.ext.dependencies.arouter
implementation project(path: ':libraries:mogo-adas')
kapt rootProject.ext.dependencies.aroutercompiler
implementation rootProject.ext.dependencies.coroutinescore
implementation rootProject.ext.dependencies.coroutinesandroid
if (Boolean.valueOf(USE_MAVEN_PACKAGE)) {
implementation rootProject.ext.dependencies.mogo_core_data
compileOnly rootProject.ext.dependencies.adasHigh
implementation project(path: ':libraries:mogo-adas')
compileOnly rootProject.ext.dependencies.mogomapapi
} else {
implementation project(':core:mogo-core-data')

View File

@@ -0,0 +1,17 @@
package com.mogo.eagle.core.function.api.setting
import com.mogo.map.uicontroller.EnumMapUI
/**
* MAP 模式改变监听
* @author xiaoyuzhou
* @date 2021/9/22 9:26 下午
*/
interface IMoGoMapModeChangeListener {
/**
* 当 地图 修改后的回调
* @param styleMode
* @see{EnumMapUI}
*/
fun onMapStyleModeChange(styleMode: EnumMapUI)
}

View File

@@ -0,0 +1,14 @@
package com.mogo.eagle.core.function.api.setting
/**
* UI 皮肤模式改变监听
* @author xiaoyuzhou
* @date 2021/9/22 9:26 下午
*/
interface IMoGoSkinModeChangeListener {
/**
* 当皮肤颜色修改后的回调
* @param skinMode 0--默认夜间模式1-白天模式2-节日模式(待开发,加载节日图片包)
*/
fun onSkinModeChange(skinMode: Int)
}

View File

@@ -0,0 +1,36 @@
package com.mogo.eagle.core.function.api.setting
/**
* 设置UI相关的
*
* @author mogoauto
*/
interface MoGoUiSettingProvider {
/**
* 进入 VR 模式
*/
fun stepInVrMode()
/**
* 退出 VR 模式
*/
fun stepOutVrMode()
/**
* 进入 皮肤 白天 模式
*/
fun stepInDayMode()
/**
* 退出 皮肤 白天 模式
*/
fun stepOutDayMode()
/**
* 获取 皮肤 模式
*/
fun getDayMode():Int
}

View File

@@ -0,0 +1,43 @@
package com.mogo.eagle.core.function.call.setting
import com.mogo.eagle.core.function.api.setting.MoGoUiSettingProvider
/**
* UI 设置管理
*
* @author mogoauto
*/
object CallerMoGoUiSettingManager : MoGoUiSettingProvider {
// 0--默认夜间模式1-白天模式2-节日模式(待开发,加载节日图片包)
private var skinMode = 0
// 是否是VR模式true-VR模式false-2D模式
var vrMode = true
override fun stepInVrMode() {
}
override fun stepOutVrMode() {
}
override fun stepInDayMode() {
skinMode = 1
CallerSkinModeListenerManager.invokeListener(skinMode)
}
override fun stepOutDayMode() {
skinMode = 0
CallerSkinModeListenerManager.invokeListener(skinMode)
}
/**
* 0--默认夜间模式1-白天模式2-节日模式(待开发,加载节日图片包)
*/
override fun getDayMode(): Int {
return skinMode
}
}

View File

@@ -0,0 +1,75 @@
package com.mogo.eagle.core.function.call.setting
import androidx.annotation.Nullable
import com.mogo.eagle.core.function.api.setting.IMoGoSkinModeChangeListener
import com.mogo.eagle.core.function.call.base.CallerBase
import java.util.concurrent.ConcurrentHashMap
/**
* @author xiaoyuzhou
* @date 2021/9/30 5:48 下午
* 肤色模式 设置监听监听管理
*/
object CallerSkinModeListenerManager : CallerBase() {
// 存储所有注册了监听的对象invokeXXXX进行遍历回调将信息同步
private val mSkinModeListeners: ConcurrentHashMap<String, IMoGoSkinModeChangeListener> =
ConcurrentHashMap()
/**
* 添加 肤色模式 监听
* @param tag 标记,用来注销监听使用
* @param listener 监听回调
*/
fun addListener(
@Nullable tag: String,
@Nullable listener: IMoGoSkinModeChangeListener
) {
if (mSkinModeListeners.containsKey(tag)) {
return
}
mSkinModeListeners[tag] = listener
listener.onSkinModeChange(CallerMoGoUiSettingManager.getDayMode())
}
/**
* 删除 肤色模式 监听
* @param tag 标记,用来注销监听使用
*/
fun removeListener(@Nullable tag: String) {
if (!mSkinModeListeners.containsKey(tag)) {
return
}
mSkinModeListeners.remove(tag)
}
/**
* 删除 肤色模式 监听
* @param listener 要删除的监听对象
*/
fun removeListener(@Nullable listener: IMoGoSkinModeChangeListener) {
if (!mSkinModeListeners.containsValue(listener)) {
return
}
mSkinModeListeners.forEach {
if (it.value == listener) {
mSkinModeListeners.remove(it.key)
}
}
}
/**
* 触发 肤色模式 监听
* @param skinMode 肤色模式
*/
fun invokeListener(skinMode: Int) {
mSkinModeListeners.forEach {
val tag = it.key
val listener = it.value
listener.onSkinModeChange(skinMode)
}
}
}

View File

@@ -31,21 +31,6 @@ public interface IMogoMapUIController {
*/
MapControlResult changeZoom(float zoom);
/**
* 切换2D/3D模式
*
* @param mode true - 3D模式 false - 2D模式
*/
void changeMapMode(EnumMapUI mode);
/**
* 打开鹰眼模式
*
* @param zoomGestureEnable 是否支持手势缩放改变地图样式
*/
@Deprecated
void openVrMode(boolean zoomGestureEnable);
/**
* 进入VR 模式
*

View File

@@ -21,6 +21,7 @@ import android.view.View;
import com.mogo.commons.constants.SharedPrefsConstants;
import com.mogo.commons.debug.DebugConfig;
import com.mogo.eagle.core.data.config.HdMapBuildConfig;
import com.mogo.eagle.core.data.enums.TrafficTypeEnum;
import com.mogo.eagle.core.data.map.CenterLine;
import com.mogo.eagle.core.data.map.MapRoadInfo;
import com.mogo.eagle.core.data.map.MogoLatLng;
@@ -103,7 +104,7 @@ public class AMapViewWrapper implements IMogoMapView,
.naviCursorRes(R.drawable.ic_amap_navi_cursor)
.build();
private CarCursorOption mCarCursorOption = DEFAULT_OPTION;
private EnumMapUI mCurrentUI;
private EnumMapUI mCurrentUI = EnumMapUI.MAP_STYLE_NIGHT_VR;
private VisualAngleMode mVisualAngleMode = MODE_MEDIUM_SIGHT;
private float mDefaultZoomLevel = 16.0f;
@@ -112,7 +113,6 @@ public class AMapViewWrapper implements IMogoMapView,
private boolean mIsFirstLocated = true;
private boolean mIsDelayed = false;
private volatile String mRoadId = null;
public AMapViewWrapper(MapAutoView mMapView) {
@@ -314,25 +314,6 @@ public class AMapViewWrapper implements IMogoMapView,
return MapControlResult.SUCCESS;
}
@Override
public void changeMapMode(EnumMapUI ui) {
if (ui == null) {
return;
}
CallerLogger.INSTANCE.d(TAG, "设置的样式 :" + ui);
if (checkAMapView()) {
mMapView.getMapAutoViewHelper().setScaleVRMode(true);
if (ui == EnumMapUI.MAP_STYLE_DAY_VR) {
mMapView.getMapAutoViewHelper().setMapStyle(MapAutoApi.MAP_STYLE_DAY_VR);
} else if (ui == EnumMapUI.MAP_STYLE_NIGHT_VR) {
mMapView.getMapAutoViewHelper().setMapStyle(MapAutoApi.MAP_STYLE_NIGHT_VR);
} else {
mMapView.getMapAutoViewHelper().setMapStyle(MapAutoApi.MAP_STYLE_NIGHT_VR);
CallerLogger.INSTANCE.e(TAG, "暂时不支持此模式 :" + ui);
}
}
}
@Override
public void changeMapVisualAngle(VisualAngleMode angelMode, MogoLatLng mogoLatLng) {
@@ -401,10 +382,26 @@ public class AMapViewWrapper implements IMogoMapView,
}
}
/**
* 是否是VR模式
*
* @return true-是false=不是
*/
private boolean isVrMold() {
return mCurrentUI == EnumMapUI.MAP_STYLE_NIGHT_VR || mCurrentUI == EnumMapUI.MAP_STYLE_DAY_VR;
}
/**
* 是否是白天模式
*
* @return true-是false-不是
*/
private boolean isDayMold() {
return mCurrentUI == EnumMapUI.MAP_STYLE_DAY_VR
|| mCurrentUI == EnumMapUI.MAP_STYLE_DAY
|| mCurrentUI == EnumMapUI.MAP_STYLE_DAY_NAV;
}
@Override
public void showMyLocation(View view) {
if (DebugConfig.isDebug()) {
@@ -714,6 +711,7 @@ public class AMapViewWrapper implements IMogoMapView,
Trace.endSection();
initMapView();
initMyLocation();
loadPreVehicleModel();
}
@Override
@@ -807,6 +805,8 @@ public class AMapViewWrapper implements IMogoMapView,
mCurrentUI = EnumMapUI.MAP_STYLE_DAY_VR;
}
loadPreVehicleModel();
if (mCurrentUI != null) {
UiThreadHandler.post(() -> {
try {
@@ -896,23 +896,15 @@ public class AMapViewWrapper implements IMogoMapView,
CallerMapDataCollectorManager.INSTANCE.setIsInit();
}
@Override
public void openVrMode(boolean zoomGestureEnable) {
try {
mMapView.getMapAutoViewHelper().setZoomGesturesEnabled(zoomGestureEnable);
mMapView.getMapAutoViewHelper().setMapStyle(MapAutoApi.MAP_STYLE_DAY_VR);
} catch (Exception e) {
e.printStackTrace();
}
}
@Override
public void stepInVrMode(boolean isDayMode) {
try {
int mapStyle;
if (isDayMode) {
mCurrentUI = EnumMapUI.MAP_STYLE_DAY_VR;
mapStyle = MapAutoApi.MAP_STYLE_DAY_VR;
} else {
mCurrentUI = EnumMapUI.MAP_STYLE_NIGHT_VR;
mapStyle = MapAutoApi.MAP_STYLE_NIGHT_VR;
}
mMapView.getMapAutoViewHelper().setMapStyle(mapStyle);
@@ -941,4 +933,52 @@ public class AMapViewWrapper implements IMogoMapView,
return MapAutoApi.INSTANCE.getAngle(startLon, startLat, endLon, endLat);
}
private void loadPreVehicleModel() {
CallerLogger.INSTANCE.d(TAG, "添加感知模型到地图中……");
addPreVehicleModelWeiZhi(TrafficTypeEnum.TYPE_TRAFFIC_ID_WEI_ZHI, "添加感知模型到地图中……preVehicleStrWeiZhi=");
addPreVehicleModelWeiZhi(TrafficTypeEnum.TYPE_TRAFFIC_ID_PEOPLE, "添加感知模型到地图中……preVehicleStrPeople=");
addPreVehicleModelWeiZhi(TrafficTypeEnum.TYPE_TRAFFIC_ID_BICYCLE, "添加感知模型到地图中……preVehicleStrBicycle=");
addPreVehicleModelWeiZhi(TrafficTypeEnum.TYPE_TRAFFIC_ID_TA_CHE, "添加感知模型到地图中……preVehicleStrTaChe=");
addPreVehicleModelWeiZhi(TrafficTypeEnum.TYPE_TRAFFIC_ID_MOTO, "添加感知模型到地图中……preVehicleStrMoto=");
addPreVehicleModelWeiZhi(TrafficTypeEnum.TYPE_TRAFFIC_ID_BUS, "添加感知模型到地图中……preVehicleStrBus=");
addPreVehicleModelWeiZhi(TrafficTypeEnum.TYPE_TRAFFIC_ID_TRUCK, "添加感知模型到地图中……preVehicleStrTruck=");
}
/**
* 添加模型到地图中
*
* @param typeTrafficId 障碍物类型ID
* @param logMsg 日志消息
*/
private void addPreVehicleModelWeiZhi(TrafficTypeEnum typeTrafficId, String logMsg) {
String preVehicleStrWeiZhi;
// 根据当前的地图皮肤模式动态替换
if (isDayMold()) {
preVehicleStrWeiZhi =
// 添加模型到地图中
MogoMarkerManager.getInstance(getContext())
.addPreVehicleModel(typeTrafficId.getType(), typeTrafficId.getTraffic3DIconId());
} else {
preVehicleStrWeiZhi =
// 添加模型到地图中
MogoMarkerManager.getInstance(getContext())
.addPreVehicleModel(typeTrafficId.getType(), typeTrafficId.getTraffic3DNightIconId());
}
CallerLogger.INSTANCE.d(TAG, logMsg + preVehicleStrWeiZhi);
if (preVehicleStrWeiZhi == null) {
UiThreadHandler.postDelayed(() -> {
CallerLogger.INSTANCE.w(TAG, "添加感知模型到地图中失败,尝试重复添加……");
addPreVehicleModelWeiZhi(typeTrafficId, logMsg);
}, 1000L);
}
}
}

View File

@@ -67,14 +67,6 @@ public class MogoMapUIController implements IMogoMapUIController {
return MapControlResult.ERROR;
}
@Override
public void changeMapMode(EnumMapUI mode) {
initDelegate();
if (mDelegate != null) {
CallerLogger.INSTANCE.d(TAG, "set type: " + mode.name());
mDelegate.changeMapMode(mode);
}
}
@Override
public void changeMapVisualAngle(VisualAngleMode angelMode, MogoLatLng mogoLatLng) {
@@ -352,13 +344,6 @@ public class MogoMapUIController implements IMogoMapUIController {
}
}
@Override
public void openVrMode(boolean zoomGestureEnable) {
initDelegate();
if (mDelegate != null) {
mDelegate.openVrMode(zoomGestureEnable);
}
}
@Override
public void stepInVrMode(boolean isDayMode) {

View File

@@ -60,13 +60,6 @@ public class AMapUIController implements IMogoMapUIController {
return MapControlResult.ERROR;
}
@Override
public void changeMapMode(EnumMapUI mode) {
if (mClient != null) {
mClient.changeMapMode(mode);
}
}
@Override
public void changeMapVisualAngle(VisualAngleMode angelMode, MogoLatLng mogoLatLng) {
if (mClient != null) {
@@ -293,12 +286,6 @@ public class AMapUIController implements IMogoMapUIController {
}
}
@Override
public void openVrMode(boolean zoomGestureEnable) {
if (mClient != null) {
mClient.openVrMode(zoomGestureEnable);
}
}
@Override
public void stepInVrMode(boolean isDayMode) {