public void moveTopAndCenterToUpWithAnimation() { if (Build.VERSION.SDK_INT >= 11) { float centerMoveHeight = mActivity.getResources().getDimension(R.dimen.pg_sdk_edit_center_move_top_height); mStepLayout.setVisibility(View.INVISIBLE); ObjectAnimator centerAnimator = ObjectAnimator.ofFloat(mCenterLayoutParent, "y", 0f, -centerMoveHeight); centerAnimator.setDuration(ANIMATION_TIME); centerAnimator.start(); float topHeight = mActivity.getResources().getDimension(R.dimen.pg_sdk_edit_top_height); ObjectAnimator topAnimator = ObjectAnimator.ofFloat(mFirstTopView, "y", 0f, -topHeight); topAnimator.setDuration(ANIMATION_TIME); topAnimator.addListener( new Animator.AnimatorListener() { @Override public void onAnimationStart(Animator animator) {} @Override public void onAnimationEnd(Animator animator) { mActivity.runOnUiThread( new Runnable() { @Override public void run() { if (null != mMenuListener) { mMenuListener.onShowSecondAnimationEnd(); } } }); } @Override public void onAnimationCancel(Animator animator) {} @Override public void onAnimationRepeat(Animator animator) {} }); topAnimator.start(); } else { mStepLayout.setVisibility(View.INVISIBLE); mFirstTopView.setVisibility(View.GONE); int centerMoveHeight = Math.round( mActivity.getResources().getDimension(R.dimen.pg_sdk_edit_center_move_top_height)); mCenterLayoutParent.setPadding( mCenterLayoutParent.getPaddingLeft(), mCenterLayoutParent.getPaddingTop() - centerMoveHeight, mCenterLayoutParent.getPaddingRight(), centerMoveHeight + mCenterLayoutParent.getPaddingBottom()); if (null != mMenuListener) { mMenuListener.onShowSecondAnimationEnd(); } } }
@Override public void onClick(View v) { if (null == mListener) { return; } if (v == mSaveEffectView) { mListener.onSaveEffectClick(); return; } if (v == mBackMainView) { mListener.onBackClick(); return; } if (v == mQuitView) { mListener.onQuitClick(); return; } if (v == mSavePhotoView) { mListener.onSavePhotoClick(); return; } if (v == mLastStepView) { mListener.onLastStepClick(); return; } if (v == mNextStepView) { mListener.onNextStepClick(); return; } if (v == mBannerView) { mListener.onBannerClick(); return; } if (v == mEffectBackView) { if (null != mMenuListener) { mMenuListener.onEffectBackClick(); } } }
public void hideBottomSecondMenuWithAnimation() { if (Build.VERSION.SDK_INT >= 11) { float secondBottomHeight = mActivity.getResources().getDimension(R.dimen.pg_sdk_edit_second_bottom_height); TranslateAnimation translateAnimation = new TranslateAnimation(0f, 0f, 0f, secondBottomHeight); translateAnimation.setInterpolator(new AccelerateDecelerateInterpolator()); translateAnimation.setDuration(ANIMATION_TIME); translateAnimation.setAnimationListener( new AnimationAdapter() { @Override public void onAnimationEnd(Animation animation) { mActivity.runOnUiThread( new Runnable() { @Override public void run() { if (null != mMenuListener) { mMenuListener.onHideBottomSecondMenuWithAnimationFinish(); } } }); } }); mSecondMenusLayout.startAnimation(translateAnimation); mFirstHorizontalLayout.setVisibility(View.VISIBLE); float bottomHeight = mActivity.getResources().getDimension(R.dimen.pg_sdk_edit_bottom_height); TranslateAnimation firstTranslateAnimation = new TranslateAnimation(0f, 0f, bottomHeight, 0f); firstTranslateAnimation.setDuration(ANIMATION_TIME); firstTranslateAnimation.setInterpolator(new AccelerateDecelerateInterpolator()); AlphaAnimation firstAlphaAnimation = new AlphaAnimation(0f, 1f); firstAlphaAnimation.setDuration(ANIMATION_TIME); firstAlphaAnimation.setInterpolator(new AccelerateDecelerateInterpolator()); AnimationSet animationSet = new AnimationSet(true); animationSet.addAnimation(firstTranslateAnimation); animationSet.addAnimation(firstAlphaAnimation); mFirstHorizontalLayout.startAnimation(animationSet); } else { if (null != mMenuListener) { mMenuListener.onHideBottomSecondMenuWithAnimationFinish(); } mFirstHorizontalLayout.setVisibility(View.VISIBLE); } }