增加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;
|
||||
}
|
||||
|
||||
Binary file not shown.
|
After Width: | Height: | Size: 10 KiB |
Binary file not shown.
|
After Width: | Height: | Size: 7.9 KiB |
Binary file not shown.
|
After Width: | Height: | Size: 11 KiB |
Binary file not shown.
|
After Width: | Height: | Size: 9.6 KiB |
Binary file not shown.
|
After Width: | Height: | Size: 7.4 KiB |
@@ -0,0 +1,19 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<shape xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:shape="rectangle">
|
||||
<gradient
|
||||
android:startColor="#303A51"
|
||||
android:endColor="#4B5974"
|
||||
android:angle="0"/>
|
||||
|
||||
<padding
|
||||
android:top="@dimen/module_ext_vr_mode_left_notice_content_padding_top"
|
||||
android:bottom="@dimen/module_ext_vr_mode_left_notice_content_padding_top"
|
||||
android:left="@dimen/module_ext_vr_mode_left_notice_content_padding_left"
|
||||
android:right="@dimen/module_ext_vr_mode_left_notice_content_padding_left" />
|
||||
|
||||
<corners
|
||||
android:topRightRadius="@dimen/module_ext_common_corner"
|
||||
android:bottomRightRadius="@dimen/module_ext_common_corner" />
|
||||
|
||||
</shape>
|
||||
@@ -0,0 +1,17 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<shape xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:shape="rectangle">
|
||||
<size
|
||||
android:width="@dimen/module_ext_vr_mode_left_notice_icon_width"
|
||||
android:height="@dimen/module_ext_vr_mode_left_notice_height" />
|
||||
|
||||
<gradient
|
||||
android:startColor="#ff4944"
|
||||
android:endColor="#c23632"
|
||||
android:angle="0"/>
|
||||
|
||||
<corners
|
||||
android:topLeftRadius="@dimen/module_ext_common_corner"
|
||||
android:bottomLeftRadius="@dimen/module_ext_common_corner" />
|
||||
|
||||
</shape>
|
||||
@@ -0,0 +1,22 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<LinearLayout
|
||||
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="horizontal">
|
||||
|
||||
<ImageView
|
||||
android:layout_width="@dimen/module_ext_vr_mode_left_notice_icon_width"
|
||||
android:layout_height="@dimen/module_ext_vr_mode_left_notice_height"
|
||||
android:id="@+id/module_ext_iv_left_notice_icon"
|
||||
android:background="@drawable/module_ext_left_notice_icon_red_bg"/>
|
||||
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="@dimen/module_ext_vr_mode_left_notice_height"
|
||||
android:text="应急车辆优先通行"
|
||||
android:textSize="@dimen/module_ext_vr_mode_left_notice_content_text_size"
|
||||
android:textColor="@color/module_ext_vr_mode_left_notice_content_text_color"
|
||||
android:background="@drawable/module_ext_left_notice_content_bg"/>
|
||||
|
||||
</LinearLayout>
|
||||
@@ -218,6 +218,12 @@
|
||||
android:visibility="gone"
|
||||
tools:visibility="visible" />
|
||||
</FrameLayout>
|
||||
|
||||
<FrameLayout
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:id="@+id/module_ext_vr_mode_left_notice_container"
|
||||
android:visibility="gone"/>
|
||||
</LinearLayout>
|
||||
|
||||
|
||||
|
||||
@@ -3,4 +3,6 @@
|
||||
<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>
|
||||
|
||||
</resources>
|
||||
@@ -167,4 +167,12 @@
|
||||
<dimen name="module_ext_exit_vr_mode_text_size">30px</dimen>
|
||||
<dimen name="module_ext_exit_vr_mode_width">120px</dimen>
|
||||
<dimen name="module_ext_enter_vr_mode_margin_bottom">170px</dimen>
|
||||
|
||||
<dimen name="module_ext_vr_mode_left_notice_width">460px</dimen>
|
||||
<dimen name="module_ext_vr_mode_left_notice_icon_width">120px</dimen>
|
||||
<dimen name="module_ext_vr_mode_left_notice_height">120px</dimen>
|
||||
|
||||
<dimen name="module_ext_vr_mode_left_notice_content_text_size">40px</dimen>
|
||||
<dimen name="module_ext_vr_mode_left_notice_content_padding_top">32px</dimen>
|
||||
<dimen name="module_ext_vr_mode_left_notice_content_padding_left">40px</dimen>
|
||||
</resources>
|
||||
@@ -41,4 +41,16 @@ public interface IMogoEntranceButtonController extends IProvider {
|
||||
* @param view 待移除view
|
||||
*/
|
||||
void removeBottomLayerView(View view);
|
||||
|
||||
/**
|
||||
* 设置vr模式下,左下角提示view
|
||||
* @param view 目前是adas提示和求助
|
||||
*/
|
||||
void showLeftNoticeView(View view);
|
||||
|
||||
/**
|
||||
* 隐藏vr模式下,左下角提示view
|
||||
* @param view 待隐藏view
|
||||
*/
|
||||
void hideLeftNoticeView(View view);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user