package razerdp.demo.popup; import android.animation.Animator; import android.animation.AnimatorSet; import android.animation.ObjectAnimator; import android.app.Activity; import android.view.View; import android.view.animation.Animation; import razerdp.basepopup.BasePopupWindow; import razerdp.basepopup.R; import razerdp.demo.interpolator.OverShootInterpolator; /** * Created by 大灯泡 on 2016/10/11. * * 全屏的popup */ public class FullScreenPopup extends BasePopupWindow { public FullScreenPopup(Activity context) { super(context); /**全屏popup*/ setPopupWindowFullScreen(true); } @Override protected Animation initShowAnimation() { return null; } @Override public Animator initShowAnimator() { AnimatorSet set; set = new AnimatorSet(); ObjectAnimator transAnimator = ObjectAnimator.ofFloat(mAnimaView, "translationY", 250, 0).setDuration(600); transAnimator.setInterpolator(new OverShootInterpolator()); ObjectAnimator alphaAnimator = ObjectAnimator.ofFloat(mAnimaView, "alpha", 0.4f, 1).setDuration(250 * 3 / 2); set.playTogether(transAnimator, alphaAnimator); return set; } @Override public Animator initExitAnimator() { AnimatorSet set; set = new AnimatorSet(); ObjectAnimator transAnimator = ObjectAnimator.ofFloat(mAnimaView, "translationY", 0, 250).setDuration(600); transAnimator.setInterpolator(new OverShootInterpolator(-6)); ObjectAnimator alphaAnimator = ObjectAnimator.ofFloat(mAnimaView, "alpha", 1f, 0).setDuration(800); set.playTogether(transAnimator, alphaAnimator); return set; } @Override public View getClickToDismissView() { return getPopupWindowView(); } @Override public View onCreatePopupView() { return createPopupById(R.layout.popup_fullscreen); } @Override public View initAnimaView() { return findViewById(R.id.popup_anima); } }