opt topview
This commit is contained in:
@@ -199,6 +199,16 @@ public class TopViewAnimHelper {
|
||||
if (params == null) {
|
||||
throw new IllegalArgumentException("method addTopView params LayoutParams is null");
|
||||
}
|
||||
|
||||
if (isOuting) {
|
||||
if (motionViewCache != null) {
|
||||
motionViewCache.statusListener.beforeViewRemoveAnim(motionViewCache.view);
|
||||
motionViewCache.statusListener.onViewRemoved(motionViewCache.view);
|
||||
}
|
||||
motionViewCache = new MotionViewCache(view, params, statusListener);
|
||||
// return;
|
||||
}
|
||||
|
||||
if (!viewCaches.contains(view)) {
|
||||
// 判断此view是否已经增加到了顶部view,如果增加过就不增加了
|
||||
currentAnimatingView = view;
|
||||
@@ -278,6 +288,9 @@ public class TopViewAnimHelper {
|
||||
// 顶部view还没有内容,需要整体下移
|
||||
viewCaches.add(view);
|
||||
topContainer.addView(view, params);
|
||||
LayoutParams p = topContainer.getLayoutParams();
|
||||
p.height = params.height;
|
||||
topContainer.setLayoutParams(p);
|
||||
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) {
|
||||
@@ -333,6 +346,7 @@ public class TopViewAnimHelper {
|
||||
}
|
||||
Logger.d("TopViewAnimHelper", "startTopOutAnim=====");
|
||||
if (!isTopViewOut && viewCaches.contains(view)) {
|
||||
isOuting = true;
|
||||
// 顶部view仅剩一个view,需要整体上移
|
||||
if (statusListenerMap.get(view) != null) {
|
||||
statusListenerMap.get(view).beforeViewRemoveAnim(view);
|
||||
@@ -341,7 +355,7 @@ public class TopViewAnimHelper {
|
||||
|
||||
NoMapTopViewShaderHelper.getInstance().hideShader();
|
||||
|
||||
topContainer.animate().translationY(-topContainer.getTranslationY()).setListener(mainAnimListener).start();
|
||||
topContainer.animate().translationY(0).setListener(mainAnimListener).start();
|
||||
|
||||
checkCameraModePosition(false);
|
||||
|
||||
@@ -498,6 +512,11 @@ public class TopViewAnimHelper {
|
||||
}
|
||||
topContainer.removeAllViews();
|
||||
currentAnimatingView = null;
|
||||
isOuting = false;
|
||||
// if (motionViewCache != null) {
|
||||
// startTopInAnim(motionViewCache.view, motionViewCache.params, motionViewCache.statusListener);
|
||||
// motionViewCache = null;
|
||||
// }
|
||||
} else {
|
||||
listener = statusListenerMap.get(currentAnimatingView);
|
||||
if (listener != null) {
|
||||
@@ -518,4 +537,21 @@ public class TopViewAnimHelper {
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
private MotionViewCache motionViewCache = null;
|
||||
private boolean isOuting = false;
|
||||
|
||||
private static class MotionViewCache {
|
||||
private final View view;
|
||||
private final LayoutParams params;
|
||||
private final IMogoTopViewStatusListener statusListener;
|
||||
|
||||
public MotionViewCache(View view, LayoutParams params, IMogoTopViewStatusListener statusListener) {
|
||||
this.view = view;
|
||||
this.params = params;
|
||||
this.statusListener = statusListener;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user