增加两个动画回调接口
This commit is contained in:
@@ -184,6 +184,9 @@ public class TopViewAnimHelper {
|
||||
topContainer.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) {
|
||||
@@ -217,7 +220,9 @@ public class TopViewAnimHelper {
|
||||
// tvNextRoad.setTextSize(getDimen(R.dimen.dp_34));
|
||||
// }
|
||||
topContainer.addView(view, params);
|
||||
|
||||
if (statusListenerMap.get(view) != null) {
|
||||
statusListenerMap.get(view).beforeViewAddAnim(view);
|
||||
}
|
||||
topContainer.setChildAddedListener(child -> {
|
||||
if (naviBg.getVisibility() == View.VISIBLE) {
|
||||
remainDistanceGroup.setVisibility(View.GONE);
|
||||
@@ -300,6 +305,9 @@ public class TopViewAnimHelper {
|
||||
// 顶部view包含多个view,只推出当前view,不进行整体上移
|
||||
Logger.d(TAG,
|
||||
"小view退出: " + view.getTranslationY() + " height: " + view.getHeight());
|
||||
if (statusListenerMap.get(view) != null) {
|
||||
statusListenerMap.get(view).beforeViewRemoveAnim(view);
|
||||
}
|
||||
view.animate().translationY(-(view.getHeight())).setDuration(500).setListener(new Animator.AnimatorListener() {
|
||||
@Override
|
||||
public void onAnimationStart(Animator animation) {
|
||||
@@ -333,6 +341,9 @@ public class TopViewAnimHelper {
|
||||
} else {
|
||||
// 顶部view仅剩一个view,需要整体上移
|
||||
currentAnimatingView = view;
|
||||
if (statusListenerMap.get(view) != null) {
|
||||
statusListenerMap.get(view).beforeViewRemoveAnim(view);
|
||||
}
|
||||
isTopViewOut = true;
|
||||
// if (naviBg.getVisibility() == View.VISIBLE) {
|
||||
// tvNextRoad.setTextSize(getDimen(R.dimen
|
||||
|
||||
@@ -19,4 +19,16 @@ public interface IMogoTopViewStatusListener {
|
||||
* @param view 移除的view
|
||||
*/
|
||||
void onViewRemoved(View view);
|
||||
|
||||
/**
|
||||
* view添加动画开始之前
|
||||
* @param view 添加的view
|
||||
*/
|
||||
void beforeViewAddAnim(View view);
|
||||
|
||||
/**
|
||||
* view 移除动画开始之前
|
||||
* @param view 移除的view
|
||||
*/
|
||||
void beforeViewRemoveAnim(View view);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user