Merge remote-tracking branch 'origin/dev_merge_shunyi_vr_map' into dev_merge_shunyi_vr_map
This commit is contained in:
@@ -30,6 +30,8 @@ import com.mogo.commons.voice.AIAssist;
|
||||
import com.mogo.map.MogoLatLng;
|
||||
import com.mogo.map.listener.IMogoMapListener;
|
||||
import com.mogo.map.location.IMogoLocationClient;
|
||||
import com.mogo.map.location.IMogoLocationListener;
|
||||
import com.mogo.map.location.MogoLocation;
|
||||
import com.mogo.map.marker.IMogoMarkerManager;
|
||||
import com.mogo.map.navi.IMogoAimlessModeListener;
|
||||
import com.mogo.map.navi.IMogoNavi;
|
||||
@@ -43,14 +45,11 @@ import com.mogo.module.common.dialog.WMDialog;
|
||||
import com.mogo.module.common.glide.SkinAbleBitmapTarget;
|
||||
import com.mogo.module.common.map.CustomNaviInterrupter;
|
||||
import com.mogo.module.common.map.MapCenterPointStrategy;
|
||||
import com.mogo.module.common.map.MyLocationUtil;
|
||||
import com.mogo.module.common.map.Scene;
|
||||
import com.mogo.module.common.view.OnPreventFastClickListener;
|
||||
import com.mogo.module.extensions.ExtensionsModuleConst;
|
||||
import com.mogo.module.extensions.R;
|
||||
import com.mogo.module.extensions.navi.AnimNavInfoView;
|
||||
import com.mogo.module.extensions.navi.BaseNaviInfoView;
|
||||
import com.mogo.module.extensions.navi.NaviInfoView;
|
||||
import com.mogo.module.extensions.navi.VrModeNavInfoView;
|
||||
import com.mogo.module.extensions.userinfo.UserInfo;
|
||||
import com.mogo.module.extensions.utils.AdasNoticeHelper;
|
||||
@@ -59,7 +58,6 @@ import com.mogo.module.extensions.utils.EntranceViewHolder;
|
||||
import com.mogo.module.extensions.utils.NoMapTopViewShaderHelper;
|
||||
import com.mogo.module.extensions.utils.TopViewAnimHelper;
|
||||
import com.mogo.module.extensions.utils.TopViewNoLinkageAnimHelper;
|
||||
import com.mogo.module.extensions.utils.TrafficLightPanelManager;
|
||||
import com.mogo.module.share.manager.ServiceApisManager;
|
||||
import com.mogo.service.IMogoServiceApis;
|
||||
import com.mogo.service.analytics.IMogoAnalytics;
|
||||
@@ -115,7 +113,8 @@ public class EntranceFragment extends MvpFragment<EntranceView, EntrancePresente
|
||||
IMogoMapListener,
|
||||
IMogoAimlessModeListener,
|
||||
IMogoStatusChangedListener,
|
||||
IMogoIntentListener {
|
||||
IMogoIntentListener,
|
||||
IMogoLocationListener {
|
||||
|
||||
private static final String TAG = "EntranceFragment";
|
||||
|
||||
@@ -225,7 +224,6 @@ public class EntranceFragment extends MvpFragment<EntranceView, EntrancePresente
|
||||
mApis = MogoApisHandler.getInstance().getApis();
|
||||
|
||||
adasNoticeHelper.init(getContext());
|
||||
adasNoticeHelper.initView(getView());
|
||||
mCameraLiveNoticeHelper.init(getContext());
|
||||
|
||||
mEntrancePresenter = new EntrancePresenter(getContext(), this);
|
||||
@@ -321,7 +319,7 @@ public class EntranceFragment extends MvpFragment<EntranceView, EntrancePresente
|
||||
ConstraintLayout rootView = findViewById(R.id.module_entrance_id_top_motion_layout);
|
||||
if (rootView != null) {
|
||||
TopViewAnimHelper.getInstance().init(rootView);
|
||||
// TopViewNoLinkageAnimHelper.getInstance().init(rootView);
|
||||
TopViewNoLinkageAnimHelper.getInstance().init(rootView);
|
||||
}
|
||||
|
||||
mExitNavi = findViewById(R.id.module_entrance_id_exit_navi);
|
||||
@@ -382,16 +380,7 @@ public class EntranceFragment extends MvpFragment<EntranceView, EntrancePresente
|
||||
vrModeNavInfoView = findViewById(R.id.module_ext_id_vr_nav_info);
|
||||
mNaviInfo = animNavInfoView;
|
||||
|
||||
findViewById(R.id.module_map_id_navi_bg).setOnClickListener(new OnPreventFastClickListener() {
|
||||
@Override
|
||||
public void onClickImpl(View v) {
|
||||
try {
|
||||
LaunchUtils.launchByPkg(getContext(), "com.autonavi.amapauto");
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
});
|
||||
adasNoticeHelper.initView(vrModeNavInfoView);
|
||||
|
||||
mWeatherContainer = findViewById(R.id.module_ext_id_weather_container);
|
||||
mWeatherIcon = findViewById(R.id.module_ext_id_weather_icon);
|
||||
@@ -436,16 +425,6 @@ public class EntranceFragment extends MvpFragment<EntranceView, EntrancePresente
|
||||
mUploadButtonAnimatorController = new UploadButtonAnimatorController(mUploading, mUpload,
|
||||
mStatusManager);
|
||||
|
||||
// mOnlineCarEntrance = findViewById(R.id.module_ext_id_destination_online_car);
|
||||
// mOnlineCarEntrance.setOnClickListener(new OnPreventFastClickListener() {
|
||||
// @Override
|
||||
// public void onClickImpl(View v) {
|
||||
// MogoApisHandler.getInstance().getApis().getOnlineCarPanelApi().showPanel();
|
||||
// Map<String, Object> properties = new HashMap<>();
|
||||
// properties.put("type", 1);
|
||||
// MogoApisHandler.getInstance().getApis().getAnalyticsApi().track("APP_Find_Mogoer", properties);
|
||||
// }
|
||||
// } );
|
||||
tvEnterVrMode = findViewById(R.id.module_ext_enter_vr_mode);
|
||||
tvEnterVrMode.setOnClickListener((v)->{
|
||||
// 进入vr模式
|
||||
@@ -493,7 +472,6 @@ public class EntranceFragment extends MvpFragment<EntranceView, EntrancePresente
|
||||
}
|
||||
});
|
||||
|
||||
TrafficLightPanelManager.getInstance().initPanel(mRootView);
|
||||
}
|
||||
|
||||
private EditText etTimes;
|
||||
@@ -509,12 +487,13 @@ public class EntranceFragment extends MvpFragment<EntranceView, EntrancePresente
|
||||
|
||||
tvExitVrMode.setVisibility(View.VISIBLE);
|
||||
TopViewAnimHelper.getInstance().enterVrMode();
|
||||
// TopViewNoLinkageAnimHelper.getInstance().enterVrMode();
|
||||
showVrModeNaviView();
|
||||
TopViewNoLinkageAnimHelper.getInstance().enterVrMode();
|
||||
mNaviInfo = vrModeNavInfoView;
|
||||
adasNoticeHelper.enterVrMode();
|
||||
mCameraLiveNoticeHelper.enterVrMode();
|
||||
TrafficLightPanelManager.getInstance().showNavPanel();
|
||||
|
||||
MogoApisHandler.getInstance().getApis().getRegisterCenterApi().registerMogoLocationListener(TAG,this);
|
||||
|
||||
}
|
||||
|
||||
private void exitVrMode(){
|
||||
@@ -528,12 +507,12 @@ public class EntranceFragment extends MvpFragment<EntranceView, EntrancePresente
|
||||
|
||||
tvExitVrMode.setVisibility(View.GONE);
|
||||
TopViewAnimHelper.getInstance().exitVrMode();
|
||||
// TopViewNoLinkageAnimHelper.getInstance().exitVrMode();
|
||||
hideVrModeNaviView();
|
||||
TopViewNoLinkageAnimHelper.getInstance().exitVrMode();
|
||||
mNaviInfo = animNavInfoView;
|
||||
adasNoticeHelper.exitVrMode();
|
||||
mCameraLiveNoticeHelper.exitVrMode();
|
||||
TrafficLightPanelManager.getInstance().hideNavPanel();
|
||||
|
||||
MogoApisHandler.getInstance().getApis().getRegisterCenterApi().unregisterMogoLocationListener(TAG);
|
||||
}
|
||||
|
||||
private void debugCrashWarn(){
|
||||
@@ -812,7 +791,7 @@ public class EntranceFragment extends MvpFragment<EntranceView, EntrancePresente
|
||||
mStatusManager.registerStatusChangedListener(TAG, StatusDescriptor.VR_MODE, this);
|
||||
|
||||
TopViewAnimHelper.getInstance().setIMogoMapUIController(mMApUIController);
|
||||
// TopViewNoLinkageAnimHelper.getInstance().setIMogoMapUIController(mMApUIController);
|
||||
TopViewNoLinkageAnimHelper.getInstance().setIMogoMapUIController(mMApUIController);
|
||||
|
||||
mClickShareVoiceStrings =
|
||||
getContext().getResources().getStringArray(R.array.click_share_voice_guide_array);
|
||||
@@ -828,8 +807,8 @@ public class EntranceFragment extends MvpFragment<EntranceView, EntrancePresente
|
||||
isClickShare = false;
|
||||
TopViewAnimHelper.getInstance().removeAllView();
|
||||
TopViewAnimHelper.getInstance().clear();
|
||||
// TopViewNoLinkageAnimHelper.getInstance().removeAllView();
|
||||
// TopViewNoLinkageAnimHelper.getInstance().clear();
|
||||
TopViewNoLinkageAnimHelper.getInstance().removeAllView();
|
||||
TopViewNoLinkageAnimHelper.getInstance().clear();
|
||||
NoMapTopViewShaderHelper.getInstance().release();
|
||||
EntranceViewHolder.getInstance().release();
|
||||
}
|
||||
@@ -1183,12 +1162,12 @@ public class EntranceFragment extends MvpFragment<EntranceView, EntrancePresente
|
||||
// }
|
||||
}
|
||||
|
||||
private static int SEEK_HELP_NOTICE_NUM_MSG_TYPE = 401015;
|
||||
private static final int SEEK_HELP_NOTICE_NUM_MSG_TYPE = 401015;
|
||||
|
||||
private IMogoOnMessageListener<String> seekHelpNoticeListener =
|
||||
private final IMogoOnMessageListener<String> seekHelpNoticeListener =
|
||||
new IMogoOnMessageListener<String>() {
|
||||
@Override
|
||||
public Class target() {
|
||||
public Class<String> target() {
|
||||
return String.class;
|
||||
}
|
||||
|
||||
@@ -1206,7 +1185,7 @@ public class EntranceFragment extends MvpFragment<EntranceView, EntrancePresente
|
||||
}
|
||||
};
|
||||
|
||||
private Handler handler = new Handler();
|
||||
private final Handler handler = new Handler();
|
||||
|
||||
private void listenSeekNumber() {
|
||||
mApis.getSocketManagerApi(getContext()).registerOnMessageListener(SEEK_HELP_NOTICE_NUM_MSG_TYPE, seekHelpNoticeListener);
|
||||
@@ -1235,14 +1214,10 @@ public class EntranceFragment extends MvpFragment<EntranceView, EntrancePresente
|
||||
mApis.getSocketManagerApi(getContext()).unregisterOnMessageListener(SEEK_HELP_NOTICE_NUM_MSG_TYPE, seekHelpNoticeListener);
|
||||
}
|
||||
|
||||
TrafficLightPanelManager.getInstance().release();
|
||||
}
|
||||
|
||||
private void showVrModeNaviView(){
|
||||
|
||||
}
|
||||
|
||||
private void hideVrModeNaviView(){
|
||||
|
||||
@Override
|
||||
public void onLocationChanged(MogoLocation location) {
|
||||
vrModeNavInfoView.refreshCurrentSpeed((int) (location.getSpeed() * 3.6F));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -17,6 +17,7 @@ import com.mogo.map.navi.MogoNaviInfo;
|
||||
import com.mogo.module.common.MogoApisHandler;
|
||||
import com.mogo.module.common.view.OnPreventFastClickListener;
|
||||
import com.mogo.module.extensions.R;
|
||||
import com.mogo.utils.LaunchUtils;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
@@ -86,11 +87,22 @@ public class AnimNavInfoView extends BaseNaviInfoView {
|
||||
MogoApisHandler.getInstance().getApis().getAnalyticsApi().track("APP_Find_Mogoer", properties);
|
||||
}
|
||||
});
|
||||
|
||||
naviBg.setOnClickListener(new OnPreventFastClickListener() {
|
||||
@Override
|
||||
public void onClickImpl(View v) {
|
||||
try {
|
||||
LaunchUtils.launchByPkg(getContext(), "com.autonavi.amapauto");
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isVisible() {
|
||||
return turnIcon != null && turnIcon.getVisibility() == View.VISIBLE;
|
||||
return getVisibility() == View.VISIBLE;
|
||||
}
|
||||
|
||||
|
||||
@@ -113,6 +125,9 @@ public class AnimNavInfoView extends BaseNaviInfoView {
|
||||
}
|
||||
|
||||
public void exchangeToSmall(boolean smooth) {
|
||||
if (!isVisible()) {
|
||||
return;
|
||||
}
|
||||
if (smooth) {
|
||||
TransitionManager.beginDelayedTransition(this);
|
||||
}
|
||||
@@ -167,6 +182,9 @@ public class AnimNavInfoView extends BaseNaviInfoView {
|
||||
}
|
||||
|
||||
public void exchangeToBig(boolean smooth) {
|
||||
if (!isVisible()) {
|
||||
return;
|
||||
}
|
||||
if (smooth) {
|
||||
TransitionManager.beginDelayedTransition(this);
|
||||
}
|
||||
|
||||
@@ -1,17 +1,38 @@
|
||||
package com.mogo.module.extensions.navi;
|
||||
|
||||
import android.annotation.SuppressLint;
|
||||
import android.content.Context;
|
||||
import android.os.Handler;
|
||||
import android.os.Message;
|
||||
import android.util.AttributeSet;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
import android.widget.ImageView;
|
||||
import android.widget.TextView;
|
||||
|
||||
import androidx.constraintlayout.widget.Group;
|
||||
|
||||
import com.mogo.map.navi.MogoNaviInfo;
|
||||
import com.mogo.module.extensions.R;
|
||||
import com.mogo.module.extensions.view.VerticalTrafficLightView;
|
||||
|
||||
/**
|
||||
* vr模式下导航信息封装
|
||||
*
|
||||
* @author tongchenfei
|
||||
*/
|
||||
public class VrModeNavInfoView extends BaseNaviInfoView {
|
||||
public class VrModeNavInfoView extends BaseNaviInfoView implements Handler.Callback {
|
||||
|
||||
private final Group speedGroup, navGroup;
|
||||
private final TextView tvLimitSpeed;
|
||||
private final VerticalTrafficLightView turnAroundLight, turnLeftLight, straightLight, turnRightLight;
|
||||
|
||||
private final ImageView ivTurnIcon;
|
||||
private final TextView tvDistance,tvDistanceUnit, tvNextRoad;
|
||||
|
||||
private final TextView tvCurrentSpeed;
|
||||
|
||||
private final Handler handler = new Handler(this);
|
||||
|
||||
public VrModeNavInfoView(Context context) {
|
||||
this(context,null);
|
||||
@@ -23,15 +44,94 @@ public class VrModeNavInfoView extends BaseNaviInfoView {
|
||||
|
||||
public VrModeNavInfoView(Context context, AttributeSet attrs, int defStyleAttr) {
|
||||
super(context, attrs, defStyleAttr);
|
||||
LayoutInflater.from(context).inflate(R.layout.include_navi_in_vr, this);
|
||||
speedGroup = findViewById(R.id.module_ext_id_group_navi_in_vr_speed);
|
||||
navGroup = findViewById(R.id.module_ext_id_group_navi_in_vr_nav_info);
|
||||
tvLimitSpeed = findViewById(R.id.module_ext_id_tv_limit_speed);
|
||||
turnAroundLight = findViewById(R.id.module_ext_id_traffic_light_turn_around);
|
||||
turnLeftLight = findViewById(R.id.module_ext_id_traffic_light_turn_left);
|
||||
straightLight = findViewById(R.id.module_ext_id_traffic_light_straight);
|
||||
turnRightLight = findViewById(R.id.module_ext_id_traffic_light_turn_right);
|
||||
|
||||
tvCurrentSpeed = findViewById(R.id.module_ext_id_tv_speed);
|
||||
|
||||
ivTurnIcon = findViewById(R.id.module_map_id_navi_next_info_road_turn_icon_in_vr_mode);
|
||||
tvDistance = findViewById(R.id.module_map_id_navi_next_info_distance_in_vr_mode);
|
||||
tvDistanceUnit = findViewById(R.id.module_map_id_navi_next_info_distance_unit_in_vr_mode);
|
||||
tvNextRoad = findViewById(R.id.module_map_id_navi_next_info_road_in_vr_mode);
|
||||
}
|
||||
|
||||
public void startNav() {
|
||||
navGroup.setVisibility(View.VISIBLE);
|
||||
speedGroup.setVisibility(View.GONE);
|
||||
}
|
||||
|
||||
public void stopNav() {
|
||||
speedGroup.setVisibility(View.VISIBLE);
|
||||
navGroup.setVisibility(View.GONE);
|
||||
}
|
||||
|
||||
public void refreshLimitSpeed(int limitSpeed) {
|
||||
if(getVisibility() != View.VISIBLE){
|
||||
return;
|
||||
}
|
||||
handler.removeMessages(MSG_HIDE_LIMIT_SPEED);
|
||||
tvLimitSpeed.setVisibility(View.VISIBLE);
|
||||
tvLimitSpeed.setText(String.valueOf(limitSpeed));
|
||||
handler.sendEmptyMessageDelayed(MSG_HIDE_LIMIT_SPEED, HIDE_LIMIT_SPEED_DELAY);
|
||||
}
|
||||
|
||||
@SuppressLint("SetTextI18n")
|
||||
public void refreshCurrentSpeed(int speed) {
|
||||
if (speedGroup.getVisibility() == View.VISIBLE) {
|
||||
tvCurrentSpeed.setText(Integer.toString(speed));
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 刷新红绿灯显示状态
|
||||
*
|
||||
* @param laneLight 固定数组长度为4的车道类型灯,从0-3依次代表 掉头,左转,执行,右转
|
||||
* @param surplusTime 固定数组长度为4的剩余时长数组,从0-3依次代表 掉头,左转,执行,右转
|
||||
*/
|
||||
public void refreshTrafficLightStatus(int[] laneLight, String[] surplusTime) {
|
||||
turnAroundLight.setTrafficLightStatus(laneLight[0], surplusTime[0]);
|
||||
turnLeftLight.setTrafficLightStatus(laneLight[1], surplusTime[1]);
|
||||
straightLight.setTrafficLightStatus(laneLight[2], surplusTime[2]);
|
||||
turnRightLight.setTrafficLightStatus(laneLight[3], surplusTime[3]);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void notifyChanged(MogoNaviInfo naviInfo) {
|
||||
if (naviInfo == null) {
|
||||
return;
|
||||
}
|
||||
fillNextCrossDistance(tvDistance, tvDistanceUnit, naviInfo.getCurStepRetainDistance());
|
||||
fillNextCrossIconType(ivTurnIcon, naviInfo.getIconResId());
|
||||
tvNextRoad.setText(naviInfo.getNextRoadName());
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onDetachedFromWindow() {
|
||||
super.onDetachedFromWindow();
|
||||
handler.removeMessages(MSG_HIDE_LIMIT_SPEED);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isVisible() {
|
||||
return navGroup.getVisibility() == View.VISIBLE;
|
||||
}
|
||||
private static final int MSG_HIDE_LIMIT_SPEED = 1001;
|
||||
private static final long HIDE_LIMIT_SPEED_DELAY = 5000;
|
||||
@Override
|
||||
public boolean handleMessage(Message msg) {
|
||||
if (!isAttachedToWindow()||getVisibility() != View.VISIBLE) {
|
||||
return false;
|
||||
}
|
||||
if (msg.what == MSG_HIDE_LIMIT_SPEED) {
|
||||
tvLimitSpeed.setVisibility(View.GONE);
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -13,6 +13,7 @@ import com.mogo.map.location.MogoLocation;
|
||||
import com.mogo.module.common.MogoApisHandler;
|
||||
import com.mogo.module.common.entity.CloudRoadData;
|
||||
import com.mogo.module.common.entity.MogoSnapshotSetData;
|
||||
import com.mogo.module.extensions.navi.VrModeNavInfoView;
|
||||
import com.mogo.service.adas.IMogoAdasWarnMessageCallback;
|
||||
import com.mogo.service.adas.MogoADASWarnType;
|
||||
import com.mogo.service.adas.entity.ADASWarnMessage;
|
||||
@@ -50,6 +51,8 @@ public class AdasNoticeHelper implements IMogoAdasWarnMessageCallback, IMogoLoca
|
||||
private String lightStatus = "G";
|
||||
private String surplusTime;
|
||||
|
||||
private VrModeNavInfoView vrModeNavInfoView;
|
||||
|
||||
private Handler handler = new Handler(this);
|
||||
|
||||
private boolean isObuLightData = false;
|
||||
@@ -64,9 +67,10 @@ public class AdasNoticeHelper implements IMogoAdasWarnMessageCallback, IMogoLoca
|
||||
Logger.d(TAG, "init====");
|
||||
}
|
||||
|
||||
public void initView(View root) {
|
||||
public void initView(VrModeNavInfoView vrModeNavInfoView) {
|
||||
if (lightCenter) {
|
||||
}
|
||||
this.vrModeNavInfoView = vrModeNavInfoView;
|
||||
}
|
||||
|
||||
public void enterVrMode() {
|
||||
@@ -116,6 +120,7 @@ public class AdasNoticeHelper implements IMogoAdasWarnMessageCallback, IMogoLoca
|
||||
}
|
||||
|
||||
private void drawLimitSpeed() {
|
||||
vrModeNavInfoView.refreshLimitSpeed(limitSpeed);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -2,7 +2,6 @@ package com.mogo.module.extensions.utils;
|
||||
|
||||
import android.animation.Animator;
|
||||
import android.os.Handler;
|
||||
import android.transition.Transition;
|
||||
import android.util.ArrayMap;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
@@ -19,6 +18,7 @@ import com.mogo.module.extensions.ExtensionsModuleConst;
|
||||
import com.mogo.module.extensions.R;
|
||||
import com.mogo.module.extensions.navi.AnimNavInfoView;
|
||||
import com.mogo.module.extensions.navi.TopView;
|
||||
import com.mogo.module.extensions.navi.VrModeNavInfoView;
|
||||
import com.mogo.service.windowview.IMogoTopViewStatusListener;
|
||||
import com.mogo.utils.logger.Logger;
|
||||
|
||||
@@ -39,7 +39,8 @@ public class TopViewAnimHelper {
|
||||
private TopView topContainer;
|
||||
|
||||
private TextView cameraMode;
|
||||
private AnimNavInfoView navInfoView;
|
||||
private AnimNavInfoView animNavInfoView;
|
||||
private VrModeNavInfoView vrModeNavInfoView;
|
||||
|
||||
private float topHeight = 0f;
|
||||
|
||||
@@ -74,7 +75,8 @@ public class TopViewAnimHelper {
|
||||
public void init(ConstraintLayout rootView, OnTopViewAnimSimpleListener listener) {
|
||||
topMotionLayout = rootView;
|
||||
topContainer = rootView.findViewById(R.id.module_entrance_id_top_container);
|
||||
navInfoView = rootView.findViewById(R.id.module_ext_id_anim_nav_info);
|
||||
animNavInfoView = rootView.findViewById(R.id.module_ext_id_anim_nav_info);
|
||||
vrModeNavInfoView = rootView.findViewById(R.id.module_ext_id_vr_nav_info);
|
||||
|
||||
topContainer.setSlideListener(this::startLatestTopOutAnim);
|
||||
|
||||
@@ -244,8 +246,8 @@ public class TopViewAnimHelper {
|
||||
if (statusListenerMap.get(view) != null) {
|
||||
statusListenerMap.get(view).beforeViewAddAnim(view);
|
||||
}
|
||||
if (navInfoView.isVisible()) {
|
||||
navInfoView.animate().translationY(computeNaviMarginTop(params.height)).start();
|
||||
if (animNavInfoView.isVisible()) {
|
||||
animNavInfoView.animate().translationY(computeNaviMarginTop(params.height)).start();
|
||||
}
|
||||
view.animate().translationY(0).setDuration(500).setListener(new Animator.AnimatorListener() {
|
||||
@Override
|
||||
@@ -288,10 +290,10 @@ public class TopViewAnimHelper {
|
||||
NoMapTopViewShaderHelper.getInstance().showShader();
|
||||
checkCameraModePosition(false);
|
||||
int scene = 0;
|
||||
if (navInfoView.isVisible()) {
|
||||
if (animNavInfoView.isVisible()) {
|
||||
scene = Scene.NAVI_WITH_ROAD_EVENT;
|
||||
navInfoView.animate().translationY(computeNaviMarginTop(child.getHeight())).start();
|
||||
navInfoView.exchangeToSmall(true);
|
||||
animNavInfoView.animate().translationY(computeNaviMarginTop(child.getHeight())).start();
|
||||
animNavInfoView.exchangeToSmall(true);
|
||||
} else {
|
||||
scene = Scene.AIMLESS_WITH_ROAD_EVENT;
|
||||
}
|
||||
@@ -307,6 +309,10 @@ public class TopViewAnimHelper {
|
||||
}
|
||||
|
||||
MogoApisHandler.getInstance().getApis().getStatusManagerApi().setTopViewShow(ExtensionsModuleConst.TYPE_ENTRANCE, true);
|
||||
// vr模式下与TopView互斥
|
||||
if (MogoApisHandler.getInstance().getApis().getStatusManagerApi().isVrMode()) {
|
||||
TopViewNoLinkageAnimHelper.getInstance().removeAllView();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -340,9 +346,9 @@ public class TopViewAnimHelper {
|
||||
checkCameraModePosition(false);
|
||||
|
||||
int scene = 0;
|
||||
if (navInfoView.isVisible()) {
|
||||
navInfoView.animate().translationY(0).start();
|
||||
navInfoView.exchangeToBig(true);
|
||||
if (animNavInfoView.isVisible()) {
|
||||
animNavInfoView.animate().translationY(0).start();
|
||||
animNavInfoView.exchangeToBig(true);
|
||||
scene = Scene.NAVI;
|
||||
} else {
|
||||
scene = Scene.AIMLESS;
|
||||
@@ -359,14 +365,18 @@ public class TopViewAnimHelper {
|
||||
}
|
||||
|
||||
Logger.d("TopViewAnimHelper", "showNaviView=====");
|
||||
setNaviVisibility(View.VISIBLE);
|
||||
if (MogoApisHandler.getInstance().getApis().getStatusManagerApi().isVrMode()) {
|
||||
vrModeNavInfoView.startNav();
|
||||
} else {
|
||||
animNavInfoView.setVisibility(View.VISIBLE);
|
||||
}
|
||||
int scene = 0;
|
||||
if (isTopViewOut) {
|
||||
scene = Scene.NAVI_WITH_ROAD_EVENT;
|
||||
navInfoView.exchangeToBig(false);
|
||||
animNavInfoView.exchangeToBig(false);
|
||||
} else {
|
||||
scene = Scene.NAVI;
|
||||
navInfoView.exchangeToSmall(false);
|
||||
animNavInfoView.exchangeToSmall(false);
|
||||
}
|
||||
Logger.d(TAG, "navi show setMapCenterPointByScene: " + scene);
|
||||
MapCenterPointStrategy.setMapCenterPointByScene(mogoMapUIController, scene);
|
||||
@@ -379,7 +389,8 @@ public class TopViewAnimHelper {
|
||||
}
|
||||
|
||||
Logger.d("TopViewAnimHelper", "hideNaviView=====");
|
||||
setNaviVisibility(View.GONE);
|
||||
animNavInfoView.setVisibility(View.GONE);
|
||||
vrModeNavInfoView.stopNav();
|
||||
int scene = 0;
|
||||
if (isTopViewOut) {
|
||||
scene = Scene.AIMLESS;
|
||||
@@ -399,7 +410,7 @@ public class TopViewAnimHelper {
|
||||
}
|
||||
|
||||
private int computeNaviMarginTop(int height) {
|
||||
int result = (int) (height - (getDimen(R.dimen.module_ext_top_over_navi_height))-getDimen(R.dimen.module_common_shadow_width_pos));
|
||||
int result = (int) (height - (getDimen(R.dimen.module_ext_top_over_navi_height)) - getDimen(R.dimen.module_common_shadow_width_pos));
|
||||
Logger.d(TAG, "computeNaviMarginTop: " + height + " result: " + result);
|
||||
return result;
|
||||
}
|
||||
@@ -414,12 +425,11 @@ public class TopViewAnimHelper {
|
||||
return viewCaches.contains(view);
|
||||
}
|
||||
|
||||
private void setNaviVisibility(int visibility) {
|
||||
navInfoView.setVisibility(visibility);
|
||||
}
|
||||
|
||||
public void removeAllView(){
|
||||
Logger.d(TAG, "remove all view");
|
||||
/**
|
||||
* 用于和{@link TopViewNoLinkageAnimHelper}互斥显示
|
||||
*/
|
||||
public void removeAllViewExceptVrNav() {
|
||||
Logger.d(TAG, "remove all view except vr nav");
|
||||
isTopViewOut = true;
|
||||
int lastCount = topContainer.getChildCount();
|
||||
for (int i = 0; i < lastCount; i++) {
|
||||
@@ -434,29 +444,37 @@ public class TopViewAnimHelper {
|
||||
topContainer.removeAllViews();
|
||||
hideNaviView();
|
||||
MapCenterPointStrategy.setMapCenterPointByScene(mogoMapUIController, Scene.AIMLESS);
|
||||
|
||||
}
|
||||
|
||||
public void clear(){
|
||||
public void removeAllView() {
|
||||
Logger.d(TAG, "remove all view");
|
||||
removeAllViewExceptVrNav();
|
||||
vrModeNavInfoView.setVisibility(View.GONE);
|
||||
}
|
||||
|
||||
public void clear() {
|
||||
topMotionLayout = null;
|
||||
topContainer = null;
|
||||
cameraMode = null;
|
||||
}
|
||||
|
||||
public void enterVrMode(){
|
||||
public void enterVrMode() {
|
||||
removeAllView();
|
||||
topContainer.getLayoutParams().width = (int) getDimen(R.dimen.module_ext_top_view_width_in_vr_mode);
|
||||
vrModeNavInfoView.setVisibility(View.VISIBLE);
|
||||
// topContainer.requestLayout();
|
||||
// topMotionLayout.requestLayout();
|
||||
}
|
||||
|
||||
public void exitVrMode(){
|
||||
public void exitVrMode() {
|
||||
removeAllView();
|
||||
topContainer.getLayoutParams().width = (int) getDimen(R.dimen.module_ext_top_view_width);
|
||||
// topContainer.requestLayout();
|
||||
// topMotionLayout.requestLayout();
|
||||
}
|
||||
|
||||
private Animator.AnimatorListener mainAnimListener = new Animator.AnimatorListener() {
|
||||
private final Animator.AnimatorListener mainAnimListener = new Animator.AnimatorListener() {
|
||||
@Override
|
||||
public void onAnimationStart(Animator animation) {
|
||||
|
||||
|
||||
@@ -2,20 +2,14 @@ package com.mogo.module.extensions.utils;
|
||||
|
||||
import android.animation.Animator;
|
||||
import android.os.Handler;
|
||||
import android.transition.AutoTransition;
|
||||
import android.transition.Transition;
|
||||
import android.transition.TransitionManager;
|
||||
import android.util.ArrayMap;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup.LayoutParams;
|
||||
import android.widget.ImageView;
|
||||
import android.widget.TextView;
|
||||
|
||||
import androidx.constraintlayout.widget.ConstraintLayout;
|
||||
import androidx.constraintlayout.widget.ConstraintSet;
|
||||
import androidx.constraintlayout.widget.Group;
|
||||
|
||||
import com.mogo.commons.debug.DebugConfig;
|
||||
import com.mogo.map.uicontroller.IMogoMapUIController;
|
||||
import com.mogo.module.common.MogoApisHandler;
|
||||
import com.mogo.module.common.map.MapCenterPointStrategy;
|
||||
@@ -40,20 +34,8 @@ public class TopViewNoLinkageAnimHelper {
|
||||
private static final String TAG = "TopViewNoLinkageAnimHelper";
|
||||
|
||||
private ConstraintLayout topMotionLayout;
|
||||
private Group remainTimeGroup, remainDistanceGroup, arriveTimeGroup;
|
||||
private View naviBg;
|
||||
|
||||
private ImageView ivTurnIcon;
|
||||
private TextView tvNextDistance;
|
||||
private TextView tvNextRoad;
|
||||
private TextView tvNextDistanceUnit;
|
||||
private TextView tvTurnInfo;
|
||||
private TopView topContainerNoLinkage;
|
||||
|
||||
private ConstraintSet constraintSet;
|
||||
private Transition transition;
|
||||
private TextView cameraMode;
|
||||
|
||||
private float topHeight = 0f;
|
||||
|
||||
private Handler handler = new Handler();
|
||||
@@ -85,82 +67,10 @@ public class TopViewNoLinkageAnimHelper {
|
||||
}
|
||||
|
||||
public void init(ConstraintLayout rootView, OnTopViewAnimSimpleListener listener) {
|
||||
|
||||
constraintSet = new ConstraintSet();
|
||||
transition = new AutoTransition();
|
||||
|
||||
topMotionLayout = rootView;
|
||||
naviBg = rootView.findViewById(R.id.module_map_id_navi_bg);
|
||||
remainTimeGroup = rootView.findViewById(R.id.remainTimeGroup);
|
||||
remainDistanceGroup = rootView.findViewById(R.id.remainDistanceGroup);
|
||||
arriveTimeGroup = rootView.findViewById(R.id.arriveTimeGroup);
|
||||
topContainerNoLinkage = rootView.findViewById(R.id.module_entrance_id_top_container_no_linkage);
|
||||
tvNextDistanceUnit = rootView.findViewById(R.id.module_map_id_navi_next_info_distance_unit);
|
||||
tvTurnInfo = rootView.findViewById(R.id.module_map_id_navi_next_info_turn_info);
|
||||
|
||||
topContainerNoLinkage.setSlideListener(this::startLatestTopOutAnim);
|
||||
|
||||
ivTurnIcon = rootView.findViewById(R.id.module_map_id_navi_next_info_road_turn_icon);
|
||||
tvNextDistance = rootView.findViewById(R.id.module_map_id_navi_next_info_distance);
|
||||
tvNextRoad = rootView.findViewById(R.id.module_map_id_navi_next_info_road);
|
||||
transition.setDuration(200);
|
||||
|
||||
transition.addListener(new Transition.TransitionListener() {
|
||||
@Override
|
||||
public void onTransitionStart(Transition transition) {
|
||||
if (listener != null) {
|
||||
listener.onAnimStart();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onTransitionEnd(Transition transition) {
|
||||
// if (isTopViewOut) {
|
||||
// topContainer.removeAllViews();
|
||||
// }
|
||||
if (listener != null) {
|
||||
listener.onAnimEnd();
|
||||
}
|
||||
Logger.d(TAG, "onTransitionEnd: " + currentAnimatingView);
|
||||
IMogoTopViewStatusListener listener;
|
||||
if (isTopViewOut) {
|
||||
int lastCount = topContainerNoLinkage.getChildCount();
|
||||
for (int i = 0; i < lastCount; i++) {
|
||||
View child = topContainerNoLinkage.getChildAt(i);
|
||||
viewCaches.remove(child);
|
||||
listener = statusListenerMap.remove(child);
|
||||
if (listener != null) {
|
||||
listener.onViewRemoved(child);
|
||||
}
|
||||
}
|
||||
topContainerNoLinkage.removeAllViews();
|
||||
} else {
|
||||
listener = statusListenerMap.get(currentAnimatingView);
|
||||
if (listener != null) {
|
||||
listener.onViewAdded(currentAnimatingView);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onTransitionCancel(Transition transition) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onTransitionPause(Transition transition) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onTransitionResume(Transition transition) {
|
||||
|
||||
}
|
||||
});
|
||||
|
||||
cameraMode = rootView.findViewById(R.id.module_ext_id_north);
|
||||
// 初始化默认隐藏导航
|
||||
hideNaviView();
|
||||
}
|
||||
|
||||
private volatile boolean isTopViewOut = true;
|
||||
@@ -169,100 +79,6 @@ public class TopViewNoLinkageAnimHelper {
|
||||
|
||||
private View currentAnimatingView = null;
|
||||
|
||||
public void addSubView(View subView, LayoutParams params,
|
||||
IMogoTopViewStatusListener statusListener) {
|
||||
if (isTopViewOut || topContainerNoLinkage.getChildCount() == 0) {
|
||||
throw new IllegalStateException("no base view in top view");
|
||||
}
|
||||
if (subView == null) {
|
||||
throw new IllegalArgumentException("method addTopView params view is null");
|
||||
}
|
||||
if (params == null) {
|
||||
throw new IllegalArgumentException("method addTopView params LayoutParams is null");
|
||||
}
|
||||
|
||||
// 是在已经添加过view之后,才能添加sub view,所以直接走增加小view的逻辑就行
|
||||
if (!viewCaches.contains(subView)) {
|
||||
viewCaches.add(subView);
|
||||
statusListenerMap.put(subView, statusListener);
|
||||
subView.setTranslationY(0);
|
||||
subView.setTranslationY(-(params.height));
|
||||
topContainerNoLinkage.addView(subView, params);
|
||||
Logger.d(TAG, "添加subView: " + subView.getTranslationY() + " height:" +
|
||||
" " + subView.getHeight() + " paramsHeight: " + params.height);
|
||||
if (statusListenerMap.get(subView) != null) {
|
||||
statusListenerMap.get(subView).beforeViewAddAnim(subView);
|
||||
}
|
||||
subView.animate().translationY(0).setDuration(500).setListener(new Animator.AnimatorListener() {
|
||||
@Override
|
||||
public void onAnimationStart(Animator animation) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onAnimationEnd(Animator animation) {
|
||||
IMogoTopViewStatusListener listener = statusListenerMap.get(subView);
|
||||
if (listener != null) {
|
||||
listener.onViewAdded(subView);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onAnimationCancel(Animator animation) {
|
||||
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void onAnimationRepeat(Animator animation) {
|
||||
|
||||
}
|
||||
}).start();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public void removeSubView(View subView) {
|
||||
if (topContainerNoLinkage.getChildCount() < 2) {
|
||||
throw new IllegalStateException("view count not enough");
|
||||
}
|
||||
Logger.d(TAG,
|
||||
"小view退出: " + subView.getTranslationY() + " height: " + subView.getHeight());
|
||||
if (statusListenerMap.get(subView) != null) {
|
||||
statusListenerMap.get(subView).beforeViewRemoveAnim(subView);
|
||||
}
|
||||
subView.animate().translationY(-(subView.getHeight())).setDuration(500).setListener(new Animator.AnimatorListener() {
|
||||
@Override
|
||||
public void onAnimationStart(Animator animation) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onAnimationEnd(Animator animation) {
|
||||
Logger.d(TAG, "onAnimationEnd: " + subView);
|
||||
viewCaches.remove(subView);
|
||||
topContainerNoLinkage.removeView(subView);
|
||||
IMogoTopViewStatusListener listener = statusListenerMap.remove(subView);
|
||||
if (listener != null) {
|
||||
listener.onViewRemoved(subView);
|
||||
} else {
|
||||
Logger.d(TAG, "listener is null");
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onAnimationCancel(Animator animation) {
|
||||
viewCaches.remove(subView);
|
||||
topContainerNoLinkage.removeView(subView);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onAnimationRepeat(Animator animation) {
|
||||
|
||||
}
|
||||
}).start();
|
||||
}
|
||||
|
||||
public void startTopInAnim(View view, LayoutParams params,
|
||||
IMogoTopViewStatusListener statusListener) {
|
||||
|
||||
@@ -308,14 +124,10 @@ public class TopViewNoLinkageAnimHelper {
|
||||
// 如果高度变化,生硬的变化一下高度
|
||||
Logger.d(TAG, "container.height: " + topContainerNoLinkage.getHeight());
|
||||
if (topContainerNoLinkage.getHeight() != params.height) {
|
||||
constraintSet.clone(topMotionLayout);
|
||||
LayoutParams p = topContainerNoLinkage.getLayoutParams();
|
||||
p.height = params.height;
|
||||
topContainerNoLinkage.setLayoutParams(p);
|
||||
constraintSet.connect(naviBg.getId(), ConstraintSet.TOP,
|
||||
R.id.module_entrance_id_top_motion_layout, ConstraintSet.TOP,
|
||||
computeNaviMarginTop(params.height));
|
||||
constraintSet.applyTo(topMotionLayout);
|
||||
topContainerNoLinkage.setTranslationY(params.height);
|
||||
Logger.d(TAG, "改变container的高度===");
|
||||
}
|
||||
|
||||
@@ -363,19 +175,8 @@ public class TopViewNoLinkageAnimHelper {
|
||||
}
|
||||
topContainerNoLinkage.setChildAddedListener(child -> {
|
||||
topContainerNoLinkage.setChildAddedListener(null);
|
||||
|
||||
NoMapTopViewShaderHelper.getInstance().showShader();
|
||||
|
||||
constraintSet.clone(topMotionLayout);
|
||||
|
||||
constraintSet.clear(R.id.module_entrance_id_top_container_no_linkage,
|
||||
ConstraintSet.BOTTOM);
|
||||
constraintSet.connect(R.id.module_entrance_id_top_container_no_linkage, ConstraintSet.TOP,
|
||||
R.id.module_entrance_id_top_motion_layout, ConstraintSet.TOP);
|
||||
TransitionManager.beginDelayedTransition(topMotionLayout, transition);
|
||||
checkCameraModePosition(false);
|
||||
constraintSet.applyTo(topMotionLayout);
|
||||
|
||||
topContainerNoLinkage.animate().translationY(child.getHeight()).setListener(mainAnimListener).start();
|
||||
int scene = Scene.AIMLESS_WITH_ROAD_EVENT;
|
||||
Logger.d(TAG, "show top setMapCenterPointByScene: " + scene);
|
||||
MapCenterPointStrategy.setMapCenterPointByScene(mogoMapUIController, scene);
|
||||
@@ -387,7 +188,7 @@ public class TopViewNoLinkageAnimHelper {
|
||||
|
||||
// vr模式下与TopView互斥
|
||||
if (MogoApisHandler.getInstance().getApis().getStatusManagerApi().isVrMode()) {
|
||||
TopViewAnimHelper.getInstance().removeAllView();
|
||||
TopViewAnimHelper.getInstance().removeAllViewExceptVrNav();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -395,9 +196,7 @@ public class TopViewNoLinkageAnimHelper {
|
||||
* 退出最新的(也就是最上面的)view
|
||||
*/
|
||||
private void startLatestTopOutAnim() {
|
||||
if (topContainerNoLinkage.getChildCount() > 1) {
|
||||
removeSubView(topContainerNoLinkage.getChildAt(topContainerNoLinkage.getChildCount() - 1));
|
||||
} else if (topContainerNoLinkage.getChildCount() > 0) {
|
||||
if (topContainerNoLinkage.getChildCount() > 0) {
|
||||
startTopOutAnim(topContainerNoLinkage.getChildAt(topContainerNoLinkage.getChildCount() - 1));
|
||||
}
|
||||
}
|
||||
@@ -414,16 +213,7 @@ public class TopViewNoLinkageAnimHelper {
|
||||
}
|
||||
isTopViewOut = true;
|
||||
NoMapTopViewShaderHelper.getInstance().hideShader();
|
||||
constraintSet.clone(topMotionLayout);
|
||||
|
||||
constraintSet.clear(R.id.module_entrance_id_top_container_no_linkage, ConstraintSet.TOP);
|
||||
constraintSet.connect(R.id.module_entrance_id_top_container_no_linkage, ConstraintSet.BOTTOM,
|
||||
R.id.module_entrance_id_top_motion_layout, ConstraintSet.TOP);
|
||||
TransitionManager.beginDelayedTransition(topMotionLayout, transition);
|
||||
checkCameraModePosition(false);
|
||||
|
||||
constraintSet.applyTo(topMotionLayout);
|
||||
|
||||
topContainerNoLinkage.animate().translationY(-topContainerNoLinkage.getTranslationY()).setListener(mainAnimListener).start();
|
||||
int scene = Scene.AIMLESS;
|
||||
Logger.d(TAG, "hide top setMapCenterPointByScene: " + scene);
|
||||
MapCenterPointStrategy.setMapCenterPointByScene(mogoMapUIController, scene);
|
||||
@@ -431,61 +221,10 @@ public class TopViewNoLinkageAnimHelper {
|
||||
}
|
||||
}
|
||||
|
||||
public void hideNaviView() {
|
||||
if (topMotionLayout == null) {
|
||||
return;
|
||||
}
|
||||
|
||||
Logger.d(TAG, "hideNaviView=====");
|
||||
setNaviVisibility(View.GONE);
|
||||
remainDistanceGroup.setVisibility(View.GONE);
|
||||
remainTimeGroup.setVisibility(View.GONE);
|
||||
arriveTimeGroup.setVisibility(View.GONE);
|
||||
int scene = 0;
|
||||
if (isTopViewOut) {
|
||||
scene = Scene.AIMLESS;
|
||||
} else {
|
||||
scene = Scene.AIMLESS_WITH_ROAD_EVENT;
|
||||
}
|
||||
Logger.d(TAG, "hide navi setMapCenterPointByScene: " + scene);
|
||||
MapCenterPointStrategy.setMapCenterPointByScene(mogoMapUIController, scene);
|
||||
checkCameraModePosition(true);
|
||||
}
|
||||
|
||||
private void checkCameraModePosition(boolean isNeedClone) {
|
||||
if (isNeedClone) {
|
||||
constraintSet.clone(topMotionLayout);
|
||||
}
|
||||
if (naviBg.getVisibility() == View.VISIBLE) {
|
||||
constraintSet.connect(cameraMode.getId(), ConstraintSet.TOP, naviBg.getId(),
|
||||
ConstraintSet.BOTTOM, (int) getDimen(R.dimen.dp_30));
|
||||
} else {
|
||||
if (isTopViewOut) {
|
||||
constraintSet.connect(cameraMode.getId(), ConstraintSet.TOP, naviBg.getId(),
|
||||
ConstraintSet.BOTTOM,
|
||||
(int) getDimen(R.dimen.module_ext_north_goneMarginTop));
|
||||
} else {
|
||||
constraintSet.connect(cameraMode.getId(), ConstraintSet.TOP,
|
||||
R.id.module_entrance_id_top_container_no_linkage,
|
||||
ConstraintSet.BOTTOM,
|
||||
(int) getDimen(R.dimen.dp_30));
|
||||
}
|
||||
}
|
||||
if (isNeedClone) {
|
||||
constraintSet.applyTo(topMotionLayout);
|
||||
}
|
||||
}
|
||||
|
||||
private float getDimen(int resId) {
|
||||
return (int) topMotionLayout.getContext().getResources().getDimensionPixelSize(resId);
|
||||
}
|
||||
|
||||
private int computeNaviMarginTop(int height) {
|
||||
int result = (int) (height - (getDimen(R.dimen.module_ext_top_over_navi_height)) - getDimen(R.dimen.module_common_shadow_width_pos));
|
||||
Logger.d(TAG, "computeNaviMarginTop: " + height + " result: " + result);
|
||||
return result;
|
||||
}
|
||||
|
||||
interface OnTopViewAnimSimpleListener {
|
||||
void onAnimStart();
|
||||
|
||||
@@ -496,17 +235,6 @@ public class TopViewNoLinkageAnimHelper {
|
||||
return viewCaches.contains(view);
|
||||
}
|
||||
|
||||
private void setNaviVisibility(int visibility) {
|
||||
ivTurnIcon.setVisibility(visibility);
|
||||
tvNextRoad.setVisibility(visibility);
|
||||
tvNextDistance.setVisibility(visibility);
|
||||
remainTimeGroup.setVisibility(visibility);
|
||||
remainDistanceGroup.setVisibility(visibility);
|
||||
arriveTimeGroup.setVisibility(visibility);
|
||||
naviBg.setVisibility(visibility);
|
||||
tvNextDistanceUnit.setVisibility(visibility);
|
||||
tvTurnInfo.setVisibility(visibility);
|
||||
}
|
||||
|
||||
public void removeAllView() {
|
||||
Logger.d(TAG, "remove all view");
|
||||
@@ -522,24 +250,12 @@ public class TopViewNoLinkageAnimHelper {
|
||||
}
|
||||
}
|
||||
topContainerNoLinkage.removeAllViews();
|
||||
hideNaviView();
|
||||
MapCenterPointStrategy.setMapCenterPointByScene(mogoMapUIController, Scene.AIMLESS);
|
||||
}
|
||||
|
||||
public void clear() {
|
||||
topMotionLayout = null;
|
||||
remainTimeGroup = null;
|
||||
remainDistanceGroup = null;
|
||||
arriveTimeGroup = null;
|
||||
naviBg = null;
|
||||
ivTurnIcon = null;
|
||||
tvNextDistance = null;
|
||||
tvNextRoad = null;
|
||||
tvNextDistanceUnit = null;
|
||||
tvTurnInfo = null;
|
||||
topContainerNoLinkage = null;
|
||||
cameraMode = null;
|
||||
transition = null;
|
||||
}
|
||||
|
||||
public void enterVrMode(){
|
||||
@@ -551,4 +267,46 @@ public class TopViewNoLinkageAnimHelper {
|
||||
removeAllView();
|
||||
topContainerNoLinkage.getLayoutParams().width = LayoutParams.MATCH_PARENT;
|
||||
}
|
||||
|
||||
private final Animator.AnimatorListener mainAnimListener = new Animator.AnimatorListener() {
|
||||
@Override
|
||||
public void onAnimationStart(Animator animation) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onAnimationEnd(Animator animation) {
|
||||
Logger.d(TAG, "onMainAnimEnd: " + currentAnimatingView);
|
||||
IMogoTopViewStatusListener listener;
|
||||
if (isTopViewOut) {
|
||||
int lastCount = topContainerNoLinkage.getChildCount();
|
||||
for (int i = 0; i < lastCount; i++) {
|
||||
View child = topContainerNoLinkage.getChildAt(i);
|
||||
viewCaches.remove(child);
|
||||
listener = statusListenerMap.remove(child);
|
||||
if (listener != null) {
|
||||
listener.onViewRemoved(child);
|
||||
}
|
||||
}
|
||||
topContainerNoLinkage.removeAllViews();
|
||||
currentAnimatingView = null;
|
||||
} else {
|
||||
listener = statusListenerMap.get(currentAnimatingView);
|
||||
if (listener != null) {
|
||||
listener.onViewAdded(currentAnimatingView);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onAnimationCancel(Animator animation) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onAnimationRepeat(Animator animation) {
|
||||
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
@@ -1,175 +0,0 @@
|
||||
package com.mogo.module.extensions.utils;
|
||||
|
||||
import android.os.Handler;
|
||||
import android.os.Message;
|
||||
import android.view.View;
|
||||
import android.widget.TextView;
|
||||
|
||||
import androidx.constraintlayout.widget.Group;
|
||||
|
||||
import com.mogo.module.extensions.R;
|
||||
import com.mogo.module.extensions.view.VerticalTrafficLightView;
|
||||
import com.mogo.utils.logger.Logger;
|
||||
|
||||
import java.util.Random;
|
||||
|
||||
/**
|
||||
* 红绿灯面板管理类,控制各部分显示隐藏,同时控制限速、车速、红绿灯信息展示
|
||||
* <p>
|
||||
* 导航信息内容通过{@link com.mogo.module.extensions.navi.VrModeNavInfoView} 在{@link com.mogo.module.extensions.entrance.EntranceFragment}进行控制
|
||||
* 此处仅控制导航信息的显示与隐藏
|
||||
*
|
||||
* @author tongchenfei
|
||||
*/
|
||||
public class TrafficLightPanelManager implements Handler.Callback, View.OnClickListener {
|
||||
private static final String TAG = "TrafficLightPanelManager";
|
||||
|
||||
private TrafficLightPanelManager() {
|
||||
}
|
||||
|
||||
private final static TrafficLightPanelManager INSTANCE = new TrafficLightPanelManager();
|
||||
|
||||
public static TrafficLightPanelManager getInstance() {
|
||||
return INSTANCE;
|
||||
}
|
||||
|
||||
private Group speedGroup, navGroup, extraGroup;
|
||||
private TextView tvLimitSpeed;
|
||||
private VerticalTrafficLightView turnAroundLight, turnLeftLight, straightLight, turnRightLight;
|
||||
|
||||
private Handler handler = new Handler(this);
|
||||
|
||||
private boolean isInit = false;
|
||||
|
||||
public void initPanel(View root) {
|
||||
speedGroup = root.findViewById(R.id.module_ext_id_group_navi_in_vr_speed);
|
||||
navGroup = root.findViewById(R.id.module_ext_id_group_navi_in_vr_nav_info);
|
||||
extraGroup = root.findViewById(R.id.module_ext_id_group_traffic_light_panel_extra);
|
||||
tvLimitSpeed = root.findViewById(R.id.module_ext_id_tv_limit_speed);
|
||||
turnAroundLight = root.findViewById(R.id.module_ext_id_traffic_light_turn_around);
|
||||
turnLeftLight = root.findViewById(R.id.module_ext_id_traffic_light_turn_left);
|
||||
straightLight = root.findViewById(R.id.module_ext_id_traffic_light_straight);
|
||||
turnRightLight = root.findViewById(R.id.module_ext_id_traffic_light_turn_right);
|
||||
isInit = true;
|
||||
|
||||
// debug
|
||||
// root.findViewById(R.id.module_ext_id_navi_in_vr_speed_bg).setOnClickListener(this);
|
||||
// root.findViewById(R.id.module_ext_id_navi_in_vr_traffic_bg).setOnClickListener(this);
|
||||
}
|
||||
|
||||
public void showNavPanel() {
|
||||
if (!isInit) {
|
||||
Logger.e(TAG, "nav panel 未初始化");
|
||||
return;
|
||||
}
|
||||
// extraGroup.setVisibility(View.VISIBLE);
|
||||
// if (isNav) {
|
||||
// navGroup.setVisibility(View.VISIBLE);
|
||||
// speedGroup.setVisibility(View.GONE);
|
||||
// } else {
|
||||
// speedGroup.setVisibility(View.VISIBLE);
|
||||
// navGroup.setVisibility(View.GONE);
|
||||
// }
|
||||
// tvLimitSpeed.setVisibility(View.VISIBLE);
|
||||
}
|
||||
|
||||
public void hideNavPanel() {
|
||||
if (!isInit) {
|
||||
Logger.e(TAG, "nav panel 未初始化");
|
||||
return;
|
||||
}
|
||||
// extraGroup.setVisibility(View.GONE);
|
||||
// speedGroup.setVisibility(View.GONE);
|
||||
// tvLimitSpeed.setVisibility(View.GONE);
|
||||
|
||||
}
|
||||
|
||||
private boolean isNav = false;
|
||||
|
||||
public void startNav() {
|
||||
isNav = true;
|
||||
// navGroup.setVisibility(View.VISIBLE);
|
||||
// speedGroup.setVisibility(View.GONE);
|
||||
}
|
||||
|
||||
public void stopNav() {
|
||||
isNav = false;
|
||||
// speedGroup.setVisibility(View.VISIBLE);
|
||||
// navGroup.setVisibility(View.GONE);
|
||||
}
|
||||
|
||||
public void refreshLimitSpeed(int limitSpeed) {
|
||||
handler.removeMessages(MSG_HIDE_LIMIT_SPEED);
|
||||
tvLimitSpeed.setVisibility(View.VISIBLE);
|
||||
tvLimitSpeed.setText(String.valueOf(limitSpeed));
|
||||
handler.sendEmptyMessageDelayed(MSG_HIDE_LIMIT_SPEED, HIDE_LIMIT_SPEED_DELAY);
|
||||
}
|
||||
|
||||
/**
|
||||
* 刷新红绿灯显示状态
|
||||
*
|
||||
* @param laneLight 固定数组长度为4的车道类型灯,从0-3依次代表 掉头,左转,执行,右转
|
||||
* @param surplusTime 固定数组长度为4的剩余时长数组,从0-3依次代表 掉头,左转,执行,右转
|
||||
*/
|
||||
public void refreshTrafficLightStatus(int[] laneLight, String[] surplusTime) {
|
||||
turnAroundLight.setTrafficLightStatus(laneLight[0], surplusTime[0]);
|
||||
turnLeftLight.setTrafficLightStatus(laneLight[1], surplusTime[1]);
|
||||
straightLight.setTrafficLightStatus(laneLight[2], surplusTime[2]);
|
||||
turnRightLight.setTrafficLightStatus(laneLight[3], surplusTime[3]);
|
||||
}
|
||||
|
||||
public void release() {
|
||||
isInit = false;
|
||||
speedGroup = null;
|
||||
navGroup = null;
|
||||
extraGroup = null;
|
||||
tvLimitSpeed = null;
|
||||
turnAroundLight = null;
|
||||
turnLeftLight = null;
|
||||
straightLight = null;
|
||||
turnRightLight = null;
|
||||
}
|
||||
|
||||
private static final int MSG_HIDE_LIMIT_SPEED = 1001;
|
||||
private static final long HIDE_LIMIT_SPEED_DELAY = 5000;
|
||||
|
||||
@Override
|
||||
public boolean handleMessage(Message msg) {
|
||||
if (!isInit) {
|
||||
return false;
|
||||
}
|
||||
if (msg.what == MSG_HIDE_LIMIT_SPEED) {
|
||||
tvLimitSpeed.setVisibility(View.GONE);
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
if (v.getId() == R.id.module_ext_id_navi_in_vr_speed_bg) {
|
||||
boolean s = new Random().nextBoolean();
|
||||
boolean b = new Random().nextBoolean();
|
||||
if (s) {
|
||||
if (b) {
|
||||
startNav();
|
||||
} else {
|
||||
stopNav();
|
||||
}
|
||||
} else {
|
||||
refreshLimitSpeed(90);
|
||||
}
|
||||
} else {
|
||||
int[] color = new int[4];
|
||||
String[] time = new String[4];
|
||||
for (int i = 0; i < 4; i++) {
|
||||
int s = new Random().nextInt(4);
|
||||
boolean b = new Random().nextBoolean();
|
||||
color[i] = s;
|
||||
time[i] = b ? "12" : "";
|
||||
}
|
||||
refreshTrafficLightStatus(color, time);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
@@ -107,6 +107,7 @@
|
||||
android:gravity="center"
|
||||
android:text="80"
|
||||
android:textColor="#FF9CA8D8"
|
||||
android:visibility="gone"
|
||||
android:textSize="@dimen/module_ext_navi_in_vr_limit_speed_text_size"
|
||||
app:layout_constraintBottom_toTopOf="@id/module_ext_id_navi_in_vr_traffic_bg"
|
||||
app:layout_constraintRight_toRightOf="@id/module_ext_id_navi_in_vr_bg"
|
||||
@@ -169,7 +170,7 @@
|
||||
android:id="@+id/module_ext_id_group_traffic_light_panel_extra"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:visibility="gone"
|
||||
android:visibility="visible"
|
||||
app:constraint_referenced_ids="module_ext_id_navi_in_vr_bg,module_ext_id_navi_in_vr_speed_bg,module_ext_id_navi_in_vr_traffic_bg,module_ext_id_traffic_light_turn_left,module_ext_id_traffic_light_turn_around,module_ext_id_traffic_light_straight,module_ext_id_traffic_light_turn_right"
|
||||
tools:visibility="visible" />
|
||||
|
||||
|
||||
@@ -20,6 +20,7 @@
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:id="@+id/module_ext_id_vr_nav_info"
|
||||
android:visibility="gone"
|
||||
app:layout_constraintLeft_toLeftOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent"/>
|
||||
|
||||
|
||||
@@ -76,55 +76,60 @@ public class V2XShareEventAdapter extends RecyclerView.Adapter<RecyclerView.View
|
||||
|
||||
@Override
|
||||
public void onBindViewHolder(@NonNull RecyclerView.ViewHolder holder, int position) {
|
||||
try {
|
||||
|
||||
if (holder instanceof shareDescriptionViewHolder) {
|
||||
//分享次数,车友认同次数,热心指数
|
||||
if (dataArrayList.size() > position) {
|
||||
V2XShareEventDescription.ResultBean.EnthusiasmIndexBean data = (V2XShareEventDescription.ResultBean.EnthusiasmIndexBean) dataArrayList.get(position);
|
||||
if (data != null) {
|
||||
String shareNum = String.valueOf(data.getShareNum());
|
||||
String likeNum = String.valueOf(data.getLikeNum());
|
||||
double enthusiasmIndex = data.getEnthusiasmIndex() <= 5 ? data.getEnthusiasmIndex() : 5;
|
||||
if (shareNum != null) {
|
||||
((shareDescriptionViewHolder) holder).shareNumTextView.setText(shareNum);
|
||||
}
|
||||
if (likeNum != null) {
|
||||
((shareDescriptionViewHolder) holder).approveNumTextView.setText(likeNum);
|
||||
}
|
||||
((shareDescriptionViewHolder) holder).ratingBar.setRating((float) enthusiasmIndex);
|
||||
}
|
||||
}
|
||||
} else if (holder instanceof shareItemViewHolder) {
|
||||
//分享列表
|
||||
if (dataArrayList.size() > position) {
|
||||
V2XShareEventItem.ResultBean.PageBean.ContentBean data = (V2XShareEventItem.ResultBean.PageBean.ContentBean) dataArrayList.get(position);
|
||||
if (data != null) {
|
||||
String poitype = data.getPoiType();
|
||||
String address = data.getUploadAddress();
|
||||
String time = DateTimeUtils.getTimeText(data.getUploadTimestamp(), DateTimeUtils.MM_Yue_dd_Ri_HH_mm);
|
||||
String likeNum = String.valueOf(data.getLikeNum());
|
||||
String notLikeNum = String.valueOf(data.getNotlikeNum());
|
||||
|
||||
if (poitype != null) {
|
||||
((shareItemViewHolder) holder).caseStyleTextView.setText(EventTypeUtils.getPoiTypeStr(poitype));
|
||||
((shareItemViewHolder) holder).caseStyleTextView.setBackgroundResource(EventTypeUtils.getPoiTypeBgForShareItem(poitype));
|
||||
|
||||
}
|
||||
if (address != null) {
|
||||
((shareItemViewHolder) holder).caseAddressTextView.setText(address);
|
||||
}
|
||||
if (time != null) {
|
||||
((shareItemViewHolder) holder).caseTimeTextView.setText(time);
|
||||
}
|
||||
if (likeNum != null) {
|
||||
((shareItemViewHolder) holder).caseUsefulTextView.setText(likeNum);
|
||||
}
|
||||
if (notLikeNum != null) {
|
||||
((shareItemViewHolder) holder).caseUselessTextView.setText(notLikeNum);
|
||||
if (holder instanceof shareDescriptionViewHolder) {
|
||||
//分享次数,车友认同次数,热心指数
|
||||
if (dataArrayList.size() > position) {
|
||||
V2XShareEventDescription.ResultBean.EnthusiasmIndexBean data = (V2XShareEventDescription.ResultBean.EnthusiasmIndexBean) dataArrayList.get(position);
|
||||
if (data != null) {
|
||||
String shareNum = String.valueOf(data.getShareNum());
|
||||
String likeNum = String.valueOf(data.getLikeNum());
|
||||
double enthusiasmIndex = data.getEnthusiasmIndex() <= 5 ? data.getEnthusiasmIndex() : 5;
|
||||
if (shareNum != null) {
|
||||
((shareDescriptionViewHolder) holder).shareNumTextView.setText(shareNum);
|
||||
}
|
||||
if (likeNum != null) {
|
||||
((shareDescriptionViewHolder) holder).approveNumTextView.setText(likeNum);
|
||||
}
|
||||
((shareDescriptionViewHolder) holder).ratingBar.setRating((float) enthusiasmIndex);
|
||||
}
|
||||
}
|
||||
} else if (holder instanceof shareItemViewHolder) {
|
||||
//分享列表
|
||||
if (dataArrayList.size() > position) {
|
||||
V2XShareEventItem.ResultBean.PageBean.ContentBean data = (V2XShareEventItem.ResultBean.PageBean.ContentBean) dataArrayList.get(position);
|
||||
if (data != null) {
|
||||
String poitype = data.getPoiType();
|
||||
String address = data.getUploadAddress();
|
||||
String time = DateTimeUtils.getTimeText(data.getUploadTimestamp(), DateTimeUtils.MM_Yue_dd_Ri_HH_mm);
|
||||
String likeNum = String.valueOf(data.getLikeNum());
|
||||
String notLikeNum = String.valueOf(data.getNotlikeNum());
|
||||
|
||||
if (poitype != null) {
|
||||
((shareItemViewHolder) holder).caseStyleTextView.setText(EventTypeUtils.getPoiTypeStr(poitype));
|
||||
((shareItemViewHolder) holder).caseStyleTextView.setBackgroundResource(EventTypeUtils.getPoiTypeBgForShareItem(poitype));
|
||||
|
||||
}
|
||||
if (address != null) {
|
||||
((shareItemViewHolder) holder).caseAddressTextView.setText(address);
|
||||
}
|
||||
if (time != null) {
|
||||
((shareItemViewHolder) holder).caseTimeTextView.setText(time);
|
||||
}
|
||||
if (likeNum != null) {
|
||||
((shareItemViewHolder) holder).caseUsefulTextView.setText(likeNum);
|
||||
}
|
||||
if (notLikeNum != null) {
|
||||
((shareItemViewHolder) holder).caseUselessTextView.setText(notLikeNum);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
} catch (Exception e) {
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -143,7 +148,7 @@ public class V2XShareEventAdapter extends RecyclerView.Adapter<RecyclerView.View
|
||||
} else if (item instanceof V2XShareEventLoadMoreItem) {
|
||||
return ((V2XShareEventLoadMoreItem) dataArrayList.get(position)).getViewType();
|
||||
}
|
||||
return V2XShareEventItemEnum.ITEM_TYPE_SHARE_LIST;
|
||||
return V2XShareEventItemEnum.ITEM_TYPE_OTHER;
|
||||
}
|
||||
|
||||
/*
|
||||
|
||||
@@ -7,5 +7,6 @@ public interface V2XShareEventItemEnum {
|
||||
int ITEM_TYPE_SHARE_EMPTY = 2;
|
||||
int ITEM_TYPE_LOAD_MORE_STATUS = 3;
|
||||
int ITEM_TYPE_NO_MORE = 4;
|
||||
int ITEM_TYPE_OTHER = 5;
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user