@@ -13,6 +13,7 @@ import android.view.MotionEvent;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
import android.widget.Button;
|
||||
import android.widget.CheckedTextView;
|
||||
import android.widget.EditText;
|
||||
import android.widget.FrameLayout;
|
||||
import android.widget.ImageButton;
|
||||
@@ -67,6 +68,8 @@ import com.mogo.module.extensions.utils.TopViewAnimHelper;
|
||||
import com.mogo.module.extensions.utils.TopViewNoLinkageAnimHelper;
|
||||
import com.mogo.module.share.manager.ServiceApisManager;
|
||||
import com.mogo.service.IMogoServiceApis;
|
||||
import com.mogo.service.adas.IMogoAdasOCHCallback;
|
||||
import com.mogo.service.adas.entity.AdasOCHData;
|
||||
import com.mogo.service.analytics.IMogoAnalytics;
|
||||
import com.mogo.service.cloud.socket.IMogoOnMessageListener;
|
||||
import com.mogo.service.entrance.ButtonIndex;
|
||||
@@ -205,6 +208,7 @@ public class EntranceFragment extends MvpFragment<EntranceView, EntrancePresente
|
||||
private TextView tvRed;
|
||||
private TextView tvGreen;
|
||||
|
||||
private CheckedTextView ctvAutopilotStatus;
|
||||
|
||||
/**
|
||||
* 内部变量标识是否在vrMode,用于方法执行过滤,避免重复或异常调用
|
||||
@@ -271,6 +275,7 @@ public class EntranceFragment extends MvpFragment<EntranceView, EntrancePresente
|
||||
mMove2CurrentLocation = findViewById(R.id.module_entrance_id_move2_current_location);
|
||||
mUserHeadImg = findViewById(R.id.ivUserHeadImg);
|
||||
groupFix = findViewById(R.id.groupFix);
|
||||
ctvAutopilotStatus = findViewById(R.id.module_mogo_autopilot_status);
|
||||
|
||||
ConstraintLayout rootView = findViewById(R.id.module_entrance_id_top_motion_layout);
|
||||
if (rootView != null) {
|
||||
@@ -341,6 +346,17 @@ public class EntranceFragment extends MvpFragment<EntranceView, EntrancePresente
|
||||
});
|
||||
}
|
||||
|
||||
onAutopilotStatusChanged(
|
||||
MogoApisHandler.getInstance().getApis().getAdasControllerApi().getAutopilotStatus() == IMogoAdasOCHCallback.STATUS_AUTOPILOT_RUNNING);
|
||||
|
||||
ctvAutopilotStatus.setOnClickListener(new OnPreventFastClickListener() {
|
||||
@Override
|
||||
public void onClickImpl(View v) {
|
||||
// 如果能自动驾驶,就自动驾驶,不能就提示
|
||||
autopilotStatusClick();
|
||||
}
|
||||
});
|
||||
|
||||
dealWeatherContainer();
|
||||
|
||||
listenSeekNumber();
|
||||
@@ -376,6 +392,21 @@ public class EntranceFragment extends MvpFragment<EntranceView, EntrancePresente
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 自动驾驶状态改变
|
||||
*
|
||||
* @param isInAutopilot true - 在自动驾驶中 false - 不在自动驾驶中
|
||||
*/
|
||||
public void onAutopilotStatusChanged(boolean isInAutopilot) {
|
||||
getActivity().runOnUiThread(() -> {
|
||||
ctvAutopilotStatus.setChecked(isInAutopilot);
|
||||
});
|
||||
}
|
||||
|
||||
private void autopilotStatusClick() {
|
||||
EntranceViewHolder.getInstance().entranceAutopilotStatusClick();
|
||||
}
|
||||
|
||||
private int debugPanelClickCount = 0;
|
||||
private long lastDebugPanelClickTime = 0;
|
||||
|
||||
@@ -1368,4 +1399,18 @@ public class EntranceFragment extends MvpFragment<EntranceView, EntrancePresente
|
||||
public void onCarLocationChanged(MogoLatLng latLng) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onArriveAt(AdasOCHData data) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onStateChanged(int state, String reason) {
|
||||
if(state == IMogoAdasOCHCallback.STATUS_AUTOPILOT_RUNNING){
|
||||
ctvAutopilotStatus.setChecked(true);
|
||||
}else{
|
||||
ctvAutopilotStatus.setChecked(false);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -8,6 +8,7 @@ import com.alibaba.android.arouter.facade.annotation.Route;
|
||||
import com.mogo.module.extensions.utils.EntranceViewHolder;
|
||||
import com.mogo.service.MogoServicePaths;
|
||||
import com.mogo.service.entrance.ButtonIndex;
|
||||
import com.mogo.service.entrance.IMogoEntranceAutopilotStatusClickListener;
|
||||
import com.mogo.service.entrance.IMogoEntranceButtonController;
|
||||
import com.mogo.service.windowview.IMogoEntranceViewListener;
|
||||
|
||||
@@ -70,6 +71,16 @@ public class MogoEntranceButtonControllerImpl implements IMogoEntranceButtonCont
|
||||
EntranceViewHolder.getInstance().removeEntranceViewListener(listener);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void addEntranceAutopilotStatusClickListener(IMogoEntranceAutopilotStatusClickListener listener) {
|
||||
EntranceViewHolder.getInstance().addEntranceAutopilotStatusClickListener(listener);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void removeEntranceAutopilotStatusClickListener(IMogoEntranceAutopilotStatusClickListener listener) {
|
||||
EntranceViewHolder.getInstance().removeEntranceAutopilotStatusClickListener(listener);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void init( Context context ) {
|
||||
|
||||
|
||||
@@ -15,7 +15,7 @@ import java.util.Map;
|
||||
*/
|
||||
public class MogoEntranceButtons {
|
||||
|
||||
private static Map< ButtonIndex, TextView > sButtons = new HashMap<>();
|
||||
private static final Map< ButtonIndex, TextView > sButtons = new HashMap<>();
|
||||
|
||||
public static void save( ButtonIndex index, TextView btn ) {
|
||||
sButtons.put( index, btn );
|
||||
|
||||
@@ -1,5 +1,7 @@
|
||||
package com.mogo.module.extensions.utils;
|
||||
|
||||
import static com.mogo.service.entrance.IMogoEntranceButtonController.NOTICE_TYPE_SEEK_HELP;
|
||||
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
@@ -10,6 +12,7 @@ import android.widget.TextView;
|
||||
import com.mogo.module.common.MogoApisHandler;
|
||||
import com.mogo.module.extensions.R;
|
||||
import com.mogo.module.extensions.bean.BottomLayerViewWrapper;
|
||||
import com.mogo.service.entrance.IMogoEntranceAutopilotStatusClickListener;
|
||||
import com.mogo.service.windowview.IMogoEntranceViewListener;
|
||||
import com.mogo.utils.logger.Logger;
|
||||
|
||||
@@ -17,20 +20,20 @@ import java.util.ArrayList;
|
||||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
|
||||
import static com.mogo.service.entrance.IMogoEntranceButtonController.NOTICE_TYPE_SEEK_HELP;
|
||||
|
||||
/**
|
||||
* 入口页view管理
|
||||
*
|
||||
* @author tongchenfei
|
||||
*/
|
||||
public class EntranceViewHolder {
|
||||
private static final String TAG = "EntranceViewHolder";
|
||||
private List<BottomLayerViewWrapper> preAddView = new ArrayList<>();
|
||||
private List<View> leftFeaturePreAddView = new ArrayList<>();
|
||||
private View preAddLeftNoticeView = null;
|
||||
private EntranceViewHolder(){}
|
||||
|
||||
private EntranceViewHolder() {
|
||||
}
|
||||
|
||||
private volatile static EntranceViewHolder instance = null;
|
||||
public static EntranceViewHolder getInstance(){
|
||||
|
||||
public static EntranceViewHolder getInstance() {
|
||||
if (instance == null) {
|
||||
synchronized (EntranceViewHolder.class) {
|
||||
if (instance == null) {
|
||||
@@ -40,13 +43,18 @@ public class EntranceViewHolder {
|
||||
}
|
||||
return instance;
|
||||
}
|
||||
|
||||
private final List<BottomLayerViewWrapper> preAddView = new ArrayList<>();
|
||||
private final List<View> leftFeaturePreAddView = new ArrayList<>();
|
||||
private View preAddLeftNoticeView = null;
|
||||
|
||||
private ViewGroup rootViewGroup = null;
|
||||
private ViewGroup featureViewGroup = null;
|
||||
private ViewGroup leftNoticeContainer = null;
|
||||
|
||||
public void initRootViewGroup(View rootView) {
|
||||
Logger.i(TAG, "initRootViewGroup==");
|
||||
if(rootView instanceof ViewGroup) {
|
||||
if (rootView instanceof ViewGroup) {
|
||||
Logger.d(TAG, "initRootViewGroup 赋值");
|
||||
rootViewGroup = (ViewGroup) rootView.getParent();
|
||||
leftNoticeContainer =
|
||||
@@ -82,12 +90,12 @@ public class EntranceViewHolder {
|
||||
Logger.d(TAG, "addBottomLayerView, rootViewGroup is null: " + (rootViewGroup == null) +
|
||||
"\n x: " + x + ", y: " + y);
|
||||
BottomLayerViewWrapper wrapper = new BottomLayerViewWrapper(view, x, y);
|
||||
if(rootViewGroup == null) {
|
||||
if(!preAddView.contains(wrapper)) {
|
||||
if (rootViewGroup == null) {
|
||||
if (!preAddView.contains(wrapper)) {
|
||||
preAddView.add(wrapper);
|
||||
}
|
||||
}else{
|
||||
if(!containView(view)) {
|
||||
} else {
|
||||
if (!containView(view)) {
|
||||
realAddView(wrapper);
|
||||
}
|
||||
}
|
||||
@@ -96,7 +104,7 @@ public class EntranceViewHolder {
|
||||
private boolean containView(View view) {
|
||||
int count = rootViewGroup.getChildCount();
|
||||
for (int i = 0; i < count; i++) {
|
||||
if(rootViewGroup.getChildAt(i).equals(view)){
|
||||
if (rootViewGroup.getChildAt(i).equals(view)) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
@@ -106,7 +114,7 @@ public class EntranceViewHolder {
|
||||
private boolean containFeatureView(View view) {
|
||||
int count = featureViewGroup.getChildCount();
|
||||
for (int i = 0; i < count; i++) {
|
||||
if(featureViewGroup.getChildAt(i).equals(view)){
|
||||
if (featureViewGroup.getChildAt(i).equals(view)) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
@@ -116,7 +124,7 @@ public class EntranceViewHolder {
|
||||
/**
|
||||
* 使用的时候需要预先判断rootViewGroup是否为空,本方法默认rootViewGroup不为空
|
||||
*/
|
||||
private void realAddView(BottomLayerViewWrapper wrapper){
|
||||
private void realAddView(BottomLayerViewWrapper wrapper) {
|
||||
FrameLayout.LayoutParams params =
|
||||
new FrameLayout.LayoutParams(FrameLayout.LayoutParams.WRAP_CONTENT,
|
||||
FrameLayout.LayoutParams.WRAP_CONTENT);
|
||||
@@ -145,10 +153,10 @@ public class EntranceViewHolder {
|
||||
Logger.d(TAG, "addLeftFeatureView==" + view);
|
||||
if (featureViewGroup == null) {
|
||||
// 先缓存起来,等待时机加载
|
||||
if(!leftFeaturePreAddView.contains(view)) {
|
||||
if (!leftFeaturePreAddView.contains(view)) {
|
||||
leftFeaturePreAddView.add(view);
|
||||
}
|
||||
}else{
|
||||
} else {
|
||||
// 直接加载
|
||||
if (!containFeatureView(view)) {
|
||||
featureViewGroup.addView(view);
|
||||
@@ -171,7 +179,7 @@ public class EntranceViewHolder {
|
||||
|
||||
|
||||
public void showLeftNoticeView(View view) {
|
||||
if(MogoApisHandler.getInstance().getApis().getStatusManagerApi().isVrMode()) {
|
||||
if (MogoApisHandler.getInstance().getApis().getStatusManagerApi().isVrMode()) {
|
||||
if (leftNoticeContainer != null) {
|
||||
realShowLeftNoticeView(view);
|
||||
} else {
|
||||
@@ -181,7 +189,7 @@ public class EntranceViewHolder {
|
||||
}
|
||||
|
||||
public void hideLeftNoticeView(View view) {
|
||||
if(MogoApisHandler.getInstance().getApis().getStatusManagerApi().isVrMode()) {
|
||||
if (MogoApisHandler.getInstance().getApis().getStatusManagerApi().isVrMode()) {
|
||||
if (preAddLeftNoticeView != null && preAddLeftNoticeView == view) {
|
||||
preAddLeftNoticeView = null;
|
||||
}
|
||||
@@ -191,7 +199,7 @@ public class EntranceViewHolder {
|
||||
}
|
||||
}
|
||||
|
||||
public void forceHideNoticeView(){
|
||||
public void forceHideNoticeView() {
|
||||
for (IMogoEntranceViewListener listener : listeners) {
|
||||
listener.onViewRemoved(currentShowNoticeType);
|
||||
}
|
||||
@@ -203,8 +211,9 @@ public class EntranceViewHolder {
|
||||
}
|
||||
|
||||
private int currentShowNoticeType = 0;
|
||||
public void showLeftNoticeByType(int noticeType, int iconRes, String content){
|
||||
if(MogoApisHandler.getInstance().getApis().getStatusManagerApi().isVrMode()) {
|
||||
|
||||
public void showLeftNoticeByType(int noticeType, int iconRes, String content) {
|
||||
if (MogoApisHandler.getInstance().getApis().getStatusManagerApi().isVrMode()) {
|
||||
if (currentShowNoticeType != noticeType && currentShowNoticeType != 0) {
|
||||
for (IMogoEntranceViewListener listener : listeners) {
|
||||
listener.onViewRemoved(currentShowNoticeType);
|
||||
@@ -221,21 +230,21 @@ public class EntranceViewHolder {
|
||||
}
|
||||
|
||||
public void hideLeftNoticeByType(int noticeType) {
|
||||
if(MogoApisHandler.getInstance().getApis().getStatusManagerApi().isVrMode()) {
|
||||
if (MogoApisHandler.getInstance().getApis().getStatusManagerApi().isVrMode()) {
|
||||
if (currentShowNoticeType == noticeType) {
|
||||
forceHideNoticeView();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private View generateNoticeViewByType(int noticeType,int iconRes, String content) {
|
||||
private View generateNoticeViewByType(int noticeType, int iconRes, String content) {
|
||||
View view =
|
||||
LayoutInflater.from(leftNoticeContainer.getContext()).inflate(R.layout.item_vr_left_notice, leftNoticeContainer, false);
|
||||
ImageView icon = view.findViewById(R.id.module_ext_iv_left_notice_icon);
|
||||
if (noticeType == NOTICE_TYPE_SEEK_HELP) {
|
||||
// 自车求助,是橘色的背景
|
||||
icon.setBackgroundResource(R.drawable.module_ext_left_notice_icon_orange_bg);
|
||||
}else{
|
||||
} else {
|
||||
// 其他是红色背景
|
||||
icon.setBackgroundResource(R.drawable.module_ext_left_notice_icon_red_bg);
|
||||
}
|
||||
@@ -245,7 +254,7 @@ public class EntranceViewHolder {
|
||||
return view;
|
||||
}
|
||||
|
||||
private void realShowLeftNoticeView(View view){
|
||||
private void realShowLeftNoticeView(View view) {
|
||||
leftNoticeContainer.setVisibility(View.VISIBLE);
|
||||
leftNoticeContainer.removeAllViews();
|
||||
leftNoticeContainer.addView(view);
|
||||
@@ -260,7 +269,8 @@ public class EntranceViewHolder {
|
||||
leftNoticeContainer.setVisibility(View.GONE);
|
||||
}
|
||||
|
||||
private List<IMogoEntranceViewListener> listeners = new ArrayList<>();
|
||||
private final List<IMogoEntranceViewListener> listeners = new ArrayList<>();
|
||||
private final List<IMogoEntranceAutopilotStatusClickListener> btnClickListeners = new ArrayList<>();
|
||||
|
||||
public void addEntranceViewListener(IMogoEntranceViewListener listener) {
|
||||
listeners.add(listener);
|
||||
@@ -270,7 +280,21 @@ public class EntranceViewHolder {
|
||||
listeners.remove(listener);
|
||||
}
|
||||
|
||||
public void release(){
|
||||
public void addEntranceAutopilotStatusClickListener(IMogoEntranceAutopilotStatusClickListener listener) {
|
||||
btnClickListeners.add(listener);
|
||||
}
|
||||
|
||||
public void removeEntranceAutopilotStatusClickListener(IMogoEntranceAutopilotStatusClickListener listener) {
|
||||
btnClickListeners.remove(listener);
|
||||
}
|
||||
|
||||
public void entranceAutopilotStatusClick() {
|
||||
for (IMogoEntranceAutopilotStatusClickListener listener : btnClickListeners) {
|
||||
listener.click();
|
||||
}
|
||||
}
|
||||
|
||||
public void release() {
|
||||
rootViewGroup = null;
|
||||
featureViewGroup = null;
|
||||
leftNoticeContainer = null;
|
||||
|
||||
Binary file not shown.
|
After Width: | Height: | Size: 1.7 KiB |
@@ -0,0 +1,16 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<selector xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<item android:state_checked="true">
|
||||
<shape android:shape="rectangle">
|
||||
<corners android:bottomLeftRadius="20px" android:bottomRightRadius="45px" android:topLeftRadius="45px" android:topRightRadius="20px" />
|
||||
<gradient android:angle="315" android:endColor="#2B6EFF" android:startColor="#2B6EFF" />
|
||||
</shape>
|
||||
</item>
|
||||
<item>
|
||||
<shape android:shape="rectangle">
|
||||
<corners android:bottomLeftRadius="20px" android:bottomRightRadius="45px" android:topLeftRadius="45px" android:topRightRadius="20px" />
|
||||
<gradient android:angle="315" android:endColor="#3B4577" android:startColor="#3B4577" />
|
||||
</shape>
|
||||
</item>
|
||||
</selector>
|
||||
|
||||
@@ -6,6 +6,26 @@
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent">
|
||||
|
||||
<CheckedTextView
|
||||
android:id="@+id/module_mogo_autopilot_status"
|
||||
android:layout_width="@dimen/module_mogo_autopilot_status_bg_width"
|
||||
android:layout_height="@dimen/module_mogo_autopilot_status_bg_height"
|
||||
android:layout_marginLeft="@dimen/module_mogo_autopilot_status_margin_left"
|
||||
android:layout_marginTop="@dimen/module_mogo_autopilot_status_margin_top"
|
||||
android:background="@drawable/module_mogo_autopilot_status_bg"
|
||||
android:drawableLeft="@drawable/module_ext_ic_autopilot"
|
||||
android:drawablePadding="@dimen/dp_30"
|
||||
android:elevation="@dimen/dp_10"
|
||||
android:gravity="center_vertical"
|
||||
android:paddingLeft="@dimen/module_mogo_autopilot_status_padding"
|
||||
android:text="自动驾驶"
|
||||
android:textColor="#FFFFFF"
|
||||
android:textSize="@dimen/module_mogo_autopilot_status_text_size"
|
||||
android:textStyle="bold"
|
||||
app:layout_constraintLeft_toLeftOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent"
|
||||
tools:visibility="visible" />
|
||||
|
||||
<include
|
||||
layout="@layout/module_ext_layout_extensions"
|
||||
android:layout_width="match_parent"
|
||||
|
||||
@@ -8,4 +8,11 @@
|
||||
<dimen name="module_switch_text_size">36px</dimen>
|
||||
<dimen name="module_switch_image">50px</dimen>
|
||||
<dimen name="module_switch_image_circle">60px</dimen>
|
||||
|
||||
<dimen name="module_mogo_autopilot_status_bg_width">460px</dimen>
|
||||
<dimen name="module_mogo_autopilot_status_bg_height">140px</dimen>
|
||||
<dimen name="module_mogo_autopilot_status_margin_left">40px</dimen>
|
||||
<dimen name="module_mogo_autopilot_status_margin_top">530px</dimen>
|
||||
<dimen name="module_mogo_autopilot_status_padding">92px</dimen>
|
||||
<dimen name="module_mogo_autopilot_status_text_size">44px</dimen>
|
||||
</resources>
|
||||
@@ -251,4 +251,11 @@
|
||||
<dimen name="module_switch_image">35px</dimen>
|
||||
<dimen name="module_switch_image_circle">38px</dimen>
|
||||
|
||||
<dimen name="module_mogo_autopilot_status_bg_width">460px</dimen>
|
||||
<dimen name="module_mogo_autopilot_status_bg_height">140px</dimen>
|
||||
<dimen name="module_mogo_autopilot_status_margin_left">40px</dimen>
|
||||
<dimen name="module_mogo_autopilot_status_margin_top">530px</dimen>
|
||||
<dimen name="module_mogo_autopilot_status_padding">92px</dimen>
|
||||
<dimen name="module_mogo_autopilot_status_text_size">44px</dimen>
|
||||
|
||||
</resources>
|
||||
Reference in New Issue
Block a user