封装迁移控制地图视角的按钮

Signed-off-by: 董宏宇 <martindhy@gmail.com>
This commit is contained in:
董宏宇
2021-10-28 19:46:52 +08:00
parent 32417fa4e0
commit f1be75c2f6
8 changed files with 100 additions and 95 deletions

5
.idea/misc.xml generated
View File

@@ -18,7 +18,7 @@
<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.46307692307692305" />
<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_perspective_switch.xml" value="1.0" />
<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" />
@@ -26,7 +26,10 @@
<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/camera_item_v2x_live_video.xml" value="0.4401041666666667" />
<entry key="modules/mogo-module-extensions/src/main/res/layout/camera_push_live_video.xml" value="0.4401041666666667" />
<entry key="modules/mogo-module-extensions/src/main/res/layout/module_ext_layout_entrance.xml" value="0.375" />
<entry key="modules/mogo-module-extensions/src/main/res/layout/module_ext_layout_extensions.xml" value="0.4401041666666667" />
<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" />
<entry key="modules/mogo-module-hmi/src/main/res/layout/notification_v2x_msg_vr.xml" value="0.3453125" />

View File

@@ -3,8 +3,14 @@ package com.mogo.eagle.core.function.hmi.ui.widget
import android.content.Context
import android.util.AttributeSet
import android.view.LayoutInflater
import android.view.View
import android.widget.FrameLayout
import com.mogo.commons.AbsMogoApplication
import com.mogo.eagle.core.function.hmi.R
import com.mogo.map.uicontroller.VisualAngleMode
import com.mogo.module.common.MogoApisHandler
import com.mogo.module.common.constants.DataTypes
import kotlinx.android.synthetic.main.view_perspective_switch.view.*
/**
*@author xiaoyuzhou
@@ -15,11 +21,29 @@ class PerspectiveSwitchView @JvmOverloads constructor(
context: Context,
attrs: AttributeSet? = null,
defStyleAttr: Int = 0
) : FrameLayout(context, attrs, defStyleAttr) {
) : FrameLayout(context, attrs, defStyleAttr), View.OnClickListener {
init {
LayoutInflater.from(context).inflate(R.layout.view_perspective_switch, this, true)
setBackgroundResource(R.drawable.module_switch_map_bg)
setOnClickListener(this)
}
override fun onClick(v: View?) {
//切换地图的远近视图
if (MogoApisHandler.getInstance().apis.mapServiceApi.mapUIController.currentMapVisualAngle.isLongSight) {
MogoApisHandler.getInstance().apis.mapServiceApi.getMarkerManager(AbsMogoApplication.getApp())
.visibleAllMarkers()
MogoApisHandler.getInstance().apis.mapServiceApi
.mapUIController.changeMapVisualAngle(VisualAngleMode.MODE_MEDIUM_SIGHT, null)
textSwitch.setText(R.string.module_map_model_normal)
} else if (MogoApisHandler.getInstance().apis.mapServiceApi.mapUIController.currentMapVisualAngle.isMediumSight) {
MogoApisHandler.getInstance().apis.mapServiceApi.getMarkerManager(AbsMogoApplication.getApp())
.inVisibleWithoutMarkers(DataTypes.TYPE_MARKER_ADAS)
MogoApisHandler.getInstance().apis.mapServiceApi
.mapUIController.changeMapVisualAngle(VisualAngleMode.MODE_LONG_SIGHT, null)
textSwitch.setText(R.string.module_map_model_faster)
}
}
}

View File

@@ -61,12 +61,23 @@
app:layout_goneMarginTop="40px"
tools:visibility="visible" />
<com.mogo.eagle.core.function.hmi.ui.widget.CheckStatusView
<com.mogo.eagle.core.function.hmi.ui.widget.PerspectiveSwitchView
android:id="@+id/viewPerspectiveSwitch"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="@dimen/module_hmi_check_left"
android:layout_marginBottom="@dimen/dp_38"
android:layout_marginLeft="35dp"
android:layout_marginBottom="27dp"
android:elevation="@dimen/dp_10"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintStart_toStartOf="parent" />
<com.mogo.eagle.core.function.hmi.ui.widget.CheckStatusView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="31dp"
app:layout_constraintBottom_toBottomOf="@+id/viewPerspectiveSwitch"
app:layout_constraintStart_toEndOf="@+id/viewPerspectiveSwitch"
app:layout_constraintTop_toTopOf="@+id/viewPerspectiveSwitch" />
</androidx.constraintlayout.widget.ConstraintLayout>

View File

@@ -2,20 +2,17 @@
<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">
android:layout_height="@dimen/module_switch_map_height">
<LinearLayout
android:id="@+id/module_switch_layout"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_vertical"
android:layout_gravity="center"
android:gravity="center"
android:orientation="horizontal">
<ImageView
android:id="@+id/module_switch_model_icon"
android:id="@+id/iconSwitch"
android:layout_width="@dimen/module_switch_image"
android:layout_height="@dimen/module_switch_image"
android:layout_gravity="left|center_vertical"
@@ -23,7 +20,7 @@
android:src="@drawable/module_switch_map_angle" />
<TextView
android:id="@+id/module_switch_model_text"
android:id="@+id/textSwitch"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:gravity="right|center"

View File

@@ -1,9 +1,49 @@
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android"
<layer-list xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="rectangle">
<!---->
<item>
<shape android:shape="rectangle">
<padding
android:bottom="1dp"
android:left="1dp"
android:right="1dp"
android:top="1dp" />
<solid android:color="#20151D45" />
<corners android:radius="@dimen/module_hmi_btn_size" />
</shape>
</item>
<item>
<shape android:shape="rectangle">
<padding
android:bottom="2dp"
android:left="2dp"
android:right="2dp"
android:top="2dp" />
<solid android:color="#30151D45" />
<corners android:radius="@dimen/module_hmi_btn_size" />
</shape>
</item>
<item>
<shape android:shape="rectangle">
<padding
android:bottom="2dp"
android:left="2dp"
android:right="2dp"
android:top="2dp" />
<solid android:color="#50151D45" />
<corners android:radius="@dimen/module_hmi_btn_size" />
</shape>
</item>
<!-- 中心背景 -->
<item>
<shape
android:shape="rectangle"
android:useLevel="false">
<corners android:radius="@dimen/module_hmi_btn_size" />
<!-- 实心 -->
<solid android:color="@color/module_switch_map_bg" />
</shape>
</item>
<corners android:radius="@dimen/module_hmi_btn_size" />
<solid android:color="@color/module_switch_map_bg" />
</shape>
</layer-list>

View File

@@ -33,13 +33,12 @@
<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_map">280px</dimen>
<dimen name="module_switch_map_height">120px</dimen>
<dimen name="module_switch_margin_left">20px</dimen>
<dimen name="module_switch_text_size">38px</dimen>
<dimen name="module_switch_image">50px</dimen>
<dimen name="module_switch_image_circle">60px</dimen>
</resources>

View File

@@ -29,7 +29,6 @@ import android.view.View;
import android.view.ViewGroup;
import android.widget.Button;
import android.widget.EditText;
import android.widget.FrameLayout;
import android.widget.ImageButton;
import android.widget.ImageView;
import android.widget.RadioButton;
@@ -62,7 +61,6 @@ import com.mogo.map.uicontroller.EnumMapUI;
import com.mogo.map.uicontroller.IMogoMapUIController;
import com.mogo.map.uicontroller.VisualAngleMode;
import com.mogo.module.common.MogoApisHandler;
import com.mogo.module.common.constants.DataTypes;
import com.mogo.module.common.dialog.WMDialog;
import com.mogo.module.common.glide.SkinAbleBitmapTarget;
import com.mogo.module.common.map.CustomNaviInterrupter;
@@ -179,10 +177,6 @@ public class EntranceFragment extends MvpFragment<EntranceView, EntrancePresente
private boolean isShowGuide;
//远景和中景的切换
private ImageView mSwitchMapModeImage;
private FrameLayout mSwitchMapModeLayout;
private TextView mSwitchText;
/**
* 搜索莫模块
@@ -356,10 +350,6 @@ public class EntranceFragment extends MvpFragment<EntranceView, EntrancePresente
tvRed = (TextView) findViewById(R.id.tv_red);
tvGreen = (TextView) findViewById(R.id.tv_green);
mSwitchMapModeLayout = (FrameLayout) findViewById(R.id.module_switch_model_layout);
mSwitchMapModeImage = (ImageView) findViewById(R.id.module_switch_model_icon);
mSwitchMapModeLayout.setOnClickListener(clickListener);
mSwitchText = (TextView) findViewById(R.id.module_switch_model_text);
// 检查是否在vr模式
if (mStatusManager.isVrMode()) {
@@ -393,7 +383,6 @@ public class EntranceFragment extends MvpFragment<EntranceView, EntrancePresente
.registerCarLocationChangedListener(TAG, this);
localIsVrMode = true;
mSwitchMapModeLayout.setVisibility(View.VISIBLE);
mApis.getV2XListenerManager().changeTipWindowStatusForListener(ACTION_V2X_REMOVE_TIP_WINDOW);
}
@@ -414,7 +403,6 @@ public class EntranceFragment extends MvpFragment<EntranceView, EntrancePresente
MogoApisHandler.getInstance().getApis().getRegisterCenterApi().unregisterMogoLocationListener(TAG);
localIsVrMode = false;
mSwitchMapModeLayout.setVisibility(View.GONE);
clTrafficLight.setVisibility(View.GONE);
}
@@ -1083,13 +1071,7 @@ public class EntranceFragment extends MvpFragment<EntranceView, EntrancePresente
@Override
public void onMapVisualAngleChanged(VisualAngleMode visualAngleMode) {
if (visualAngleMode.isMediumSight()) {
mSwitchMapModeLayout.setVisibility(View.VISIBLE);
} else if (visualAngleMode.isLongSight()) {
mSwitchMapModeLayout.setVisibility(View.VISIBLE);
} else if (visualAngleMode.isCloseSight()) {
mSwitchMapModeLayout.setVisibility(View.GONE);
}
}
private static final int SEEK_HELP_NOTICE_NUM_MSG_TYPE = 401015;
@@ -1333,18 +1315,6 @@ public class EntranceFragment extends MvpFragment<EntranceView, EntrancePresente
// show panel
debugPanelGroup.setVisibility(View.VISIBLE);
}
} else if (v.getId() == R.id.module_switch_model_layout) { //切换地图的远近视图
if (MogoApisHandler.getInstance().getApis().getMapServiceApi().getMapUIController().getCurrentMapVisualAngle().isLongSight()) {
MogoApisHandler.getInstance().getApis().getMapServiceApi().getMarkerManager(AbsMogoApplication.getApp()).visibleAllMarkers();
MogoApisHandler.getInstance().getApis().getMapServiceApi()
.getMapUIController().changeMapVisualAngle(VisualAngleMode.MODE_MEDIUM_SIGHT, null);
mSwitchText.setText(R.string.module_map_model_normal);
} else if (MogoApisHandler.getInstance().getApis().getMapServiceApi().getMapUIController().getCurrentMapVisualAngle().isMediumSight()) {
MogoApisHandler.getInstance().getApis().getMapServiceApi().getMarkerManager(AbsMogoApplication.getApp()).inVisibleWithoutMarkers(DataTypes.TYPE_MARKER_ADAS);
MogoApisHandler.getInstance().getApis().getMapServiceApi()
.getMapUIController().changeMapVisualAngle(VisualAngleMode.MODE_LONG_SIGHT, null);
mSwitchText.setText(R.string.module_map_model_faster);
}
}
}
};

View File

@@ -24,45 +24,6 @@
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintTop_toTopOf="parent" />
<!--切换地图远近事件 @dimen/module_switch_map -->
<FrameLayout
android:id="@+id/module_switch_model_layout"
android:layout_width="@dimen/module_switch_map"
android:layout_height="@dimen/module_switch_map_height"
android:layout_marginLeft="@dimen/dp_20"
android:layout_marginBottom="26px"
android:background="@drawable/module_switch_map_bg"
android:elevation="@dimen/dp_10"
android:padding="@dimen/dp_20"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintLeft_toLeftOf="parent">
<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>
<androidx.constraintlayout.widget.ConstraintLayout
android:id="@+id/cl_traffic_light"