优化视频播放弹窗
This commit is contained in:
@@ -57,6 +57,7 @@ import com.mogo.module.extensions.utils.CameraLiveNoticeHelper;
|
||||
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.share.manager.ServiceApisManager;
|
||||
import com.mogo.service.IMogoServiceApis;
|
||||
import com.mogo.service.analytics.IMogoAnalytics;
|
||||
@@ -223,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);
|
||||
@@ -319,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);
|
||||
@@ -380,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);
|
||||
@@ -434,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模式
|
||||
@@ -506,7 +487,7 @@ public class EntranceFragment extends MvpFragment<EntranceView, EntrancePresente
|
||||
|
||||
tvExitVrMode.setVisibility(View.VISIBLE);
|
||||
TopViewAnimHelper.getInstance().enterVrMode();
|
||||
// TopViewNoLinkageAnimHelper.getInstance().enterVrMode();
|
||||
TopViewNoLinkageAnimHelper.getInstance().enterVrMode();
|
||||
mNaviInfo = vrModeNavInfoView;
|
||||
adasNoticeHelper.enterVrMode();
|
||||
mCameraLiveNoticeHelper.enterVrMode();
|
||||
@@ -526,7 +507,7 @@ public class EntranceFragment extends MvpFragment<EntranceView, EntrancePresente
|
||||
|
||||
tvExitVrMode.setVisibility(View.GONE);
|
||||
TopViewAnimHelper.getInstance().exitVrMode();
|
||||
// TopViewNoLinkageAnimHelper.getInstance().exitVrMode();
|
||||
TopViewNoLinkageAnimHelper.getInstance().exitVrMode();
|
||||
mNaviInfo = animNavInfoView;
|
||||
adasNoticeHelper.exitVrMode();
|
||||
mCameraLiveNoticeHelper.exitVrMode();
|
||||
@@ -810,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);
|
||||
@@ -826,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();
|
||||
}
|
||||
|
||||
@@ -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,6 +87,17 @@ 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
|
||||
|
||||
@@ -72,6 +72,9 @@ public class VrModeNavInfoView extends BaseNaviInfoView implements Handler.Callb
|
||||
}
|
||||
|
||||
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));
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -17,7 +17,6 @@ import com.mogo.module.common.map.Scene;
|
||||
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.TopView;
|
||||
import com.mogo.module.extensions.navi.VrModeNavInfoView;
|
||||
import com.mogo.service.windowview.IMogoTopViewStatusListener;
|
||||
@@ -310,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();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -362,9 +365,9 @@ public class TopViewAnimHelper {
|
||||
}
|
||||
|
||||
Logger.d("TopViewAnimHelper", "showNaviView=====");
|
||||
if(MogoApisHandler.getInstance().getApis().getStatusManagerApi().isVrMode()){
|
||||
if (MogoApisHandler.getInstance().getApis().getStatusManagerApi().isVrMode()) {
|
||||
vrModeNavInfoView.startNav();
|
||||
}else {
|
||||
} else {
|
||||
animNavInfoView.setVisibility(View.VISIBLE);
|
||||
}
|
||||
int scene = 0;
|
||||
@@ -407,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;
|
||||
}
|
||||
@@ -422,8 +425,11 @@ public class TopViewAnimHelper {
|
||||
return viewCaches.contains(view);
|
||||
}
|
||||
|
||||
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++) {
|
||||
@@ -437,17 +443,23 @@ public class TopViewAnimHelper {
|
||||
}
|
||||
topContainer.removeAllViews();
|
||||
hideNaviView();
|
||||
vrModeNavInfoView.setVisibility(View.GONE);
|
||||
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);
|
||||
@@ -455,14 +467,14 @@ public class TopViewAnimHelper {
|
||||
// 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) {
|
||||
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user