修复查看路口、前方车辆直播弹窗动画异常
关闭了一些不必要的bug
删除了测试面板
升级地图版本1.0.0-vr-8.5.36
This commit is contained in:
董宏宇
2021-06-01 20:28:52 +08:00
parent 765f924615
commit bb74e84427
20 changed files with 68 additions and 582 deletions

View File

@@ -133,15 +133,6 @@ public class TopViewManager implements IMogoTopViewManager {
}
}
@Override
public boolean isViewNoLinkageAdded(View view) {
try {
return TopViewNoLinkageAnimHelper.getInstance().isViewAdded(view);
} catch( Exception e ){
return false;
}
}
@Override
public void removeAllViewInVrMode() {
try {

View File

@@ -34,7 +34,6 @@ public class TopViewNoLinkageAnimHelper {
private TopView topContainerNoLinkage;
private volatile boolean isTopViewOut = true;
private final List<View> viewCaches = new ArrayList<>();
private final Map<View, IMogoTopViewStatusListener> statusListenerMap = new ArrayMap<>();
private View currentAnimatingView = null;
@@ -61,10 +60,6 @@ public class TopViewNoLinkageAnimHelper {
}
public void init(ConstraintLayout rootView) {
init(rootView, null);
}
public void init(ConstraintLayout rootView, OnTopViewAnimSimpleListener listener) {
topMotionLayout = rootView;
topContainerNoLinkage = rootView.findViewById(R.id.module_entrance_id_top_container_no_linkage);
@@ -85,96 +80,29 @@ public class TopViewNoLinkageAnimHelper {
if (params == null) {
throw new IllegalArgumentException("method addTopView params LayoutParams is null");
}
if (!viewCaches.contains(view)) {
// 判断此view是否已经增加到了顶部view如果增加过就不增加了
view.setTranslationY(0);
statusListenerMap.put(view, statusListener);
Logger.d(TAG, "开始执行");
isTopViewOut = false;
if (topContainerNoLinkage.getChildCount() > 0) {
// 顶部view已经有了内容新增内容无需整体布局变化只是新增布局加个动画
viewCaches.add(view);
// 生硬的删掉之前的view
int lastCount = topContainerNoLinkage.getChildCount();
Logger.d(TAG, "进入动画lastCount: " + lastCount);
for (int i = 0; i < lastCount; i++) {
View lastView = topContainerNoLinkage.getChildAt(i);
if (statusListenerMap.get(lastView) != null) {
statusListenerMap.get(lastView).beforeViewRemoveAnim(lastView);
}
viewCaches.remove(lastView);
if (statusListenerMap.get(lastView) != null) {
statusListenerMap.remove(lastView).onViewRemoved(lastView);
}
}
Logger.d(TAG, "生硬的删掉了之前的view: " + viewCaches.size());
topContainerNoLinkage.removeAllViews();
// 同时设置一下隐藏状态
MogoApisHandler.getInstance().getApis().getStatusManagerApi().setTopViewShow(ExtensionsModuleConst.TYPE_ENTRANCE, false);
// 判断此view是否已经增加到了顶部view如果增加过就不增加了
view.setTranslationY(0);
statusListenerMap.put(view, statusListener);
Logger.d(TAG, "开始执行");
isTopViewOut = false;
// 如果高度变化,生硬的变化一下高度
Logger.d(TAG, "container.height: " + topContainerNoLinkage.getHeight());
if (topContainerNoLinkage.getHeight() != params.height) {
LayoutParams p = topContainerNoLinkage.getLayoutParams();
p.height = params.height;
topContainerNoLinkage.setLayoutParams(p);
topContainerNoLinkage.setTranslationY(params.height);
Logger.d(TAG, "改变container的高度===");
}
view.setTranslationY(-(params.height));
topContainerNoLinkage.addView(view, params);
Logger.d(TAG, "顶部view已经有布局了增加新增view滑入动画: " + view.getTranslationY() + " height:" +
" " + view.getHeight() + " paramsHeight: " + params.height);
if (statusListenerMap.get(view) != null) {
statusListenerMap.get(view).beforeViewAddAnim(view);
}
view.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(view);
if (listener != null) {
listener.onViewAdded(view);
}
}
@Override
public void onAnimationCancel(Animator animation) {
}
@Override
public void onAnimationRepeat(Animator animation) {
}
}).start();
} else {
// 顶部view还没有内容需要整体下移
currentAnimatingView = view;
viewCaches.add(view);
topContainerNoLinkage.addView(view, params);
Logger.d(TAG, "整体进入==== view.visibility: " + view.getVisibility() + " view" +
".position: (" + view.getX() + ", " + view.getY() + ") params.width: " + params.width + " params.height: " + params.height);
if (statusListenerMap.get(view) != null) {
statusListenerMap.get(view).beforeViewAddAnim(view);
}
topContainerNoLinkage.setChildAddedListener(child -> {
topContainerNoLinkage.setChildAddedListener(null);
NoMapTopViewShaderHelper.getInstance().showShader();
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);
});
}
// 顶部view还没有内容需要整体下移
currentAnimatingView = view;
topContainerNoLinkage.addView(view, params);
Logger.d(TAG, "整体进入==== view.visibility: " + view.getVisibility() + " view" +
".position: (" + view.getX() + ", " + view.getY() + ") params.width: " + params.width + " params.height: " + params.height);
if (statusListenerMap.get(view) != null) {
statusListenerMap.get(view).beforeViewAddAnim(view);
}
topContainerNoLinkage.setChildAddedListener(child -> {
topContainerNoLinkage.setChildAddedListener(null);
NoMapTopViewShaderHelper.getInstance().showShader();
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);
});
MogoApisHandler.getInstance().getApis().getStatusManagerApi().setTopViewShow(ExtensionsModuleConst.TYPE_ENTRANCE, true);
@@ -188,6 +116,8 @@ public class TopViewNoLinkageAnimHelper {
* 退出最新的也就是最上面的view
*/
private void startLatestTopOutAnim() {
Logger.d(TAG, "startLatestTopOutAnim=====");
if (topContainerNoLinkage.getChildCount() > 0) {
startTopOutAnim(topContainerNoLinkage.getChildAt(topContainerNoLinkage.getChildCount() - 1));
}
@@ -198,7 +128,7 @@ public class TopViewNoLinkageAnimHelper {
return;
}
Logger.d(TAG, "startTopOutAnim=====");
if (!isTopViewOut && viewCaches.contains(view)) {
if (!isTopViewOut) {
// 顶部view仅剩一个view需要整体上移
if (statusListenerMap.get(view) != null) {
statusListenerMap.get(view).beforeViewRemoveAnim(view);
@@ -217,24 +147,12 @@ public class TopViewNoLinkageAnimHelper {
return (int) topMotionLayout.getContext().getResources().getDimensionPixelSize(resId);
}
interface OnTopViewAnimSimpleListener {
void onAnimStart();
void onAnimEnd();
}
public boolean isViewAdded(View view) {
return viewCaches.contains(view);
}
public void removeAllView() {
Logger.d(TAG, "remove all view");
isTopViewOut = true;
int lastCount = topContainerNoLinkage.getChildCount();
for (int i = 0; i < lastCount; i++) {
View child = topContainerNoLinkage.getChildAt(i);
viewCaches.remove(child);
IMogoTopViewStatusListener listener = statusListenerMap.remove(child);
if (listener != null) {
listener.beforeViewRemoveAnim(child);
@@ -268,13 +186,12 @@ public class TopViewNoLinkageAnimHelper {
@Override
public void onAnimationEnd(Animator animation) {
Logger.d(TAG, "onMainAnimEnd: " + currentAnimatingView);
Logger.d(TAG, "isTopViewOut: " + isTopViewOut);
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);