增加entrance 左侧提示容器
This commit is contained in:
@@ -47,6 +47,7 @@ import com.mogo.module.extensions.ExtensionsModuleConst;
|
||||
import com.mogo.module.extensions.R;
|
||||
import com.mogo.module.extensions.navi.NaviInfoView;
|
||||
import com.mogo.module.extensions.userinfo.UserInfo;
|
||||
import com.mogo.module.extensions.utils.AdasNoticeHelper;
|
||||
import com.mogo.module.extensions.utils.EntranceViewHolder;
|
||||
import com.mogo.module.extensions.utils.TopViewAnimHelper;
|
||||
import com.mogo.module.share.manager.ServiceApisManager;
|
||||
@@ -189,6 +190,8 @@ public class EntranceFragment extends MvpFragment<EntranceView, EntrancePresente
|
||||
|
||||
private IFragmentProvider mMessageHistoryPanelProvider;
|
||||
|
||||
private AdasNoticeHelper adasNoticeHelper = new AdasNoticeHelper();
|
||||
|
||||
@Override
|
||||
protected int getLayoutId() {
|
||||
return R.layout.module_ext_layout_entrance;
|
||||
@@ -198,6 +201,8 @@ public class EntranceFragment extends MvpFragment<EntranceView, EntrancePresente
|
||||
protected void initViews() {
|
||||
mApis = MogoApisHandler.getInstance().getApis();
|
||||
|
||||
adasNoticeHelper.init(getContext());
|
||||
|
||||
mEntrancePresenter = new EntrancePresenter(getContext(), this);
|
||||
mMogoFragmentManager = mApis.getFragmentManagerApi();
|
||||
EntranceViewHolder.getInstance().initRootViewGroup(mRootView);
|
||||
@@ -417,6 +422,8 @@ public class EntranceFragment extends MvpFragment<EntranceView, EntrancePresente
|
||||
mMsgContainer.setVisibility(View.GONE);
|
||||
|
||||
tvExitVrMode.setVisibility(View.VISIBLE);
|
||||
|
||||
adasNoticeHelper.enterVrMode();
|
||||
}
|
||||
|
||||
private void exitVrMode(){
|
||||
@@ -428,6 +435,8 @@ public class EntranceFragment extends MvpFragment<EntranceView, EntrancePresente
|
||||
// mMsgContainer.setVisibility(View.VISIBLE);
|
||||
|
||||
tvExitVrMode.setVisibility(View.GONE);
|
||||
|
||||
adasNoticeHelper.exitVrMode();
|
||||
}
|
||||
|
||||
private void debugCrashWarn(){
|
||||
|
||||
@@ -39,6 +39,16 @@ public class MogoEntranceButtonControllerImpl implements IMogoEntranceButtonCont
|
||||
EntranceViewHolder.getInstance().removeBottomLayerView(view);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void showLeftNoticeView(View view) {
|
||||
EntranceViewHolder.getInstance().showLeftNoticeView(view);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void hideLeftNoticeView(View view) {
|
||||
EntranceViewHolder.getInstance().hideLeftNoticeView(view);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void init( Context context ) {
|
||||
|
||||
|
||||
@@ -0,0 +1,57 @@
|
||||
package com.mogo.module.extensions.utils;
|
||||
|
||||
import android.content.BroadcastReceiver;
|
||||
import android.content.Context;
|
||||
import android.content.Intent;
|
||||
import android.content.IntentFilter;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
import android.widget.ImageView;
|
||||
import android.widget.TextView;
|
||||
|
||||
import com.mogo.module.extensions.R;
|
||||
|
||||
/**
|
||||
* vr模式下,adas左侧提示框帮助类
|
||||
*
|
||||
* @author tongchenfei
|
||||
*/
|
||||
public class AdasNoticeHelper {
|
||||
private Context context;
|
||||
private AdasNoticeReceiver adasReceiver = new AdasNoticeReceiver();
|
||||
|
||||
public void init(Context context) {
|
||||
this.context = context;
|
||||
}
|
||||
|
||||
public void enterVrMode(){
|
||||
IntentFilter filter = new IntentFilter("com.mogo.launcher.adas.app.biz");
|
||||
context.registerReceiver(adasReceiver, filter);
|
||||
// todo 注册adas事件回调
|
||||
}
|
||||
|
||||
public void exitVrMode(){
|
||||
context.unregisterReceiver(adasReceiver);
|
||||
}
|
||||
|
||||
/**
|
||||
* 接收智慧驾驶发给adas的展示信息,代替adas做界面展示
|
||||
*
|
||||
* @author tongchenfei
|
||||
*/
|
||||
private class AdasNoticeReceiver extends BroadcastReceiver{
|
||||
@Override
|
||||
public void onReceive(Context context, Intent intent) {
|
||||
// todo 处理发给adas的事件, 主要处理逆向超车和obu行人碰撞
|
||||
}
|
||||
}
|
||||
|
||||
private View generateNoticeView(int iconRes, String content) {
|
||||
View view = LayoutInflater.from(context).inflate(R.layout.item_vr_left_notice, null);
|
||||
ImageView icon = view.findViewById(R.id.module_ext_iv_left_notice_icon);
|
||||
icon.setImageResource(iconRes);
|
||||
TextView tvContent = view.findViewById(R.id.module_ext_vr_mode_left_notice_container);
|
||||
tvContent.setText(content);
|
||||
return view;
|
||||
}
|
||||
}
|
||||
@@ -5,6 +5,7 @@ import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
import android.widget.FrameLayout;
|
||||
|
||||
import com.mogo.module.extensions.R;
|
||||
import com.mogo.module.extensions.bean.BottomLayerViewWrapper;
|
||||
import com.mogo.utils.logger.Logger;
|
||||
|
||||
@@ -19,6 +20,9 @@ import java.util.List;
|
||||
public class EntranceViewHolder {
|
||||
private static final String TAG = "EntranceViewHolder";
|
||||
private List<BottomLayerViewWrapper> preAddView = new ArrayList<>();
|
||||
|
||||
private View preAddLeftNoticeView = null;
|
||||
|
||||
private EntranceViewHolder(){}
|
||||
private volatile static EntranceViewHolder instance = null;
|
||||
public static EntranceViewHolder getInstance(){
|
||||
@@ -32,11 +36,15 @@ public class EntranceViewHolder {
|
||||
return instance;
|
||||
}
|
||||
private ViewGroup rootViewGroup = null;
|
||||
private ViewGroup leftNoticeContainer = null;
|
||||
|
||||
public void initRootViewGroup(View rootView) {
|
||||
Logger.i(TAG, "initRootViewGroup==");
|
||||
if(rootView instanceof ViewGroup) {
|
||||
Logger.d(TAG, "initRootViewGroup 赋值");
|
||||
rootViewGroup = (ViewGroup) rootView.getParent();
|
||||
leftNoticeContainer =
|
||||
rootView.findViewById(R.id.module_ext_vr_mode_left_notice_container);
|
||||
if (!preAddView.isEmpty()) {
|
||||
Logger.d(TAG, "initRootViewGroup 增加底层view: " + preAddView.size());
|
||||
Iterator<BottomLayerViewWrapper> iterator = preAddView.iterator();
|
||||
@@ -46,6 +54,9 @@ public class EntranceViewHolder {
|
||||
iterator.remove();
|
||||
}
|
||||
}
|
||||
if (preAddLeftNoticeView != null) {
|
||||
realShowLeftNoticeView(preAddLeftNoticeView);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -107,6 +118,33 @@ public class EntranceViewHolder {
|
||||
}
|
||||
}
|
||||
|
||||
public void showLeftNoticeView(View view) {
|
||||
if (leftNoticeContainer != null) {
|
||||
realShowLeftNoticeView(view);
|
||||
}else{
|
||||
preAddLeftNoticeView = view;
|
||||
}
|
||||
}
|
||||
|
||||
public void hideLeftNoticeView(View view) {
|
||||
if (preAddLeftNoticeView != null && preAddLeftNoticeView == view) {
|
||||
preAddLeftNoticeView = null;
|
||||
}
|
||||
if (leftNoticeContainer != null) {
|
||||
realHideLeftNoticeView(view);
|
||||
}
|
||||
}
|
||||
|
||||
private void realShowLeftNoticeView(View view){
|
||||
leftNoticeContainer.removeAllViews();
|
||||
leftNoticeContainer.addView(view);
|
||||
preAddLeftNoticeView = null;
|
||||
}
|
||||
|
||||
private void realHideLeftNoticeView(View view) {
|
||||
leftNoticeContainer.removeView(view);
|
||||
}
|
||||
|
||||
public void release(){
|
||||
rootViewGroup = null;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user