Search in sources :

Example 1 with AnimationAdapter

use of us.pinguo.edit.sdk.base.widget.AnimationAdapter in project PhotoNoter by yydcdut.

the class PGEditView method hideEffectBackWithAnimation.

public void hideEffectBackWithAnimation() {
    AlphaAnimation alphaAnimation = new AlphaAnimation(1f, 0f);
    alphaAnimation.setDuration(PGEditConstants.EFFECT_ANIMATION_TIME);
    alphaAnimation.setAnimationListener(new AnimationAdapter() {

        @Override
        public void onAnimationEnd(Animation animation) {
            mActivity.runOnUiThread(new Runnable() {

                @Override
                public void run() {
                    mEffectBackView.setVisibility(View.GONE);
                }
            });
        }
    });
    mEffectBackView.startAnimation(alphaAnimation);
    mEffectBackView.setOnClickListener(null);
}
Also used : TranslateAnimation(android.view.animation.TranslateAnimation) Animation(android.view.animation.Animation) AlphaAnimation(android.view.animation.AlphaAnimation) AlphaAnimation(android.view.animation.AlphaAnimation) AnimationAdapter(us.pinguo.edit.sdk.base.widget.AnimationAdapter)

Example 2 with AnimationAdapter

use of us.pinguo.edit.sdk.base.widget.AnimationAdapter in project PhotoNoter by yydcdut.

the class PGEditView method hideBottomSecondMenuWithAnimation.

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);
    }
}
Also used : TranslateAnimation(android.view.animation.TranslateAnimation) AccelerateDecelerateInterpolator(android.view.animation.AccelerateDecelerateInterpolator) TranslateAnimation(android.view.animation.TranslateAnimation) Animation(android.view.animation.Animation) AlphaAnimation(android.view.animation.AlphaAnimation) AnimationSet(android.view.animation.AnimationSet) AnimationAdapter(us.pinguo.edit.sdk.base.widget.AnimationAdapter) AlphaAnimation(android.view.animation.AlphaAnimation)

Example 3 with AnimationAdapter

use of us.pinguo.edit.sdk.base.widget.AnimationAdapter in project PhotoNoter by yydcdut.

the class PGEditView method changeSecondBottomLayoutWithAnimation.

public void changeSecondBottomLayoutWithAnimation() {
    AlphaAnimation backAlphaAnimation = new AlphaAnimation(1f, 0f);
    backAlphaAnimation.setDuration(PGEditConstants.EFFECT_BOTTOM_ANIMATION_TIME);
    backAlphaAnimation.setAnimationListener(new AnimationAdapter() {

        @Override
        public void onAnimationEnd(Animation animation) {
            mActivity.runOnUiThread(new Runnable() {

                @Override
                public void run() {
                    mBackMainView.setVisibility(View.GONE);
                }
            });
        }
    });
    mBackMainView.startAnimation(backAlphaAnimation);
    AlphaAnimation nameAlphaAnimation = new AlphaAnimation(1f, 0f);
    nameAlphaAnimation.setDuration(PGEditConstants.EFFECT_BOTTOM_ANIMATION_TIME);
    nameAlphaAnimation.setAnimationListener(new AnimationAdapter() {

        @Override
        public void onAnimationEnd(Animation animation) {
            mActivity.runOnUiThread(new Runnable() {

                @Override
                public void run() {
                    if (null != mMenuListener) {
                        mMenuListener.onChangeSecondBottomLayoutWithAnimationFinish();
                    }
                    AlphaAnimation alphaAnimation = new AlphaAnimation(0f, 1f);
                    alphaAnimation.setDuration(PGEditConstants.EFFECT_BOTTOM_ANIMATION_TIME);
                    mSecondBottomName.startAnimation(alphaAnimation);
                }
            });
        }
    });
    mSecondBottomName.startAnimation(nameAlphaAnimation);
    AlphaAnimation savePhotoAlphaAnimation = new AlphaAnimation(1f, 0f);
    savePhotoAlphaAnimation.setDuration(PGEditConstants.EFFECT_BOTTOM_ANIMATION_TIME);
    savePhotoAlphaAnimation.setAnimationListener(new AnimationAdapter() {

        @Override
        public void onAnimationEnd(Animation animation) {
            mActivity.runOnUiThread(new Runnable() {

                @Override
                public void run() {
                    AlphaAnimation alphaAnimation = new AlphaAnimation(0f, 1f);
                    alphaAnimation.setDuration(PGEditConstants.EFFECT_BOTTOM_ANIMATION_TIME);
                    mSaveEffectView.startAnimation(alphaAnimation);
                }
            });
        }
    });
    mSaveEffectView.startAnimation(savePhotoAlphaAnimation);
}
Also used : TranslateAnimation(android.view.animation.TranslateAnimation) Animation(android.view.animation.Animation) AlphaAnimation(android.view.animation.AlphaAnimation) AlphaAnimation(android.view.animation.AlphaAnimation) AnimationAdapter(us.pinguo.edit.sdk.base.widget.AnimationAdapter)

Example 4 with AnimationAdapter

use of us.pinguo.edit.sdk.base.widget.AnimationAdapter in project PhotoNoter by yydcdut.

the class PGEditView method showBottomSecondMenuWithAnimation.

public void showBottomSecondMenuWithAnimation() {
    mSecondMenusLayout.setVisibility(View.VISIBLE);
    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, secondBottomHeight, 0f);
        translateAnimation.setInterpolator(new AccelerateDecelerateInterpolator());
        translateAnimation.setDuration(ANIMATION_TIME);
        mSecondMenusLayout.startAnimation(translateAnimation);
        float bottomHeight = mActivity.getResources().getDimension(R.dimen.pg_sdk_edit_bottom_height);
        TranslateAnimation firstTranslateAnimation = new TranslateAnimation(0f, 0f, 0f, bottomHeight);
        firstTranslateAnimation.setDuration(ANIMATION_TIME);
        firstTranslateAnimation.setInterpolator(new AccelerateDecelerateInterpolator());
        AlphaAnimation firstAlphaAnimation = new AlphaAnimation(1f, 0f);
        firstAlphaAnimation.setDuration(ANIMATION_TIME);
        firstAlphaAnimation.setInterpolator(new AccelerateDecelerateInterpolator());
        AnimationSet animationSet = new AnimationSet(true);
        animationSet.addAnimation(firstTranslateAnimation);
        animationSet.addAnimation(firstAlphaAnimation);
        animationSet.setAnimationListener(new AnimationAdapter() {

            @Override
            public void onAnimationEnd(Animation animation) {
                mActivity.runOnUiThread(new Runnable() {

                    @Override
                    public void run() {
                        mFirstHorizontalLayout.setVisibility(View.INVISIBLE);
                    }
                });
            }
        });
        mFirstHorizontalLayout.startAnimation(animationSet);
    } else {
        mFirstHorizontalLayout.setVisibility(View.INVISIBLE);
    }
}
Also used : TranslateAnimation(android.view.animation.TranslateAnimation) AccelerateDecelerateInterpolator(android.view.animation.AccelerateDecelerateInterpolator) TranslateAnimation(android.view.animation.TranslateAnimation) Animation(android.view.animation.Animation) AlphaAnimation(android.view.animation.AlphaAnimation) AnimationSet(android.view.animation.AnimationSet) AlphaAnimation(android.view.animation.AlphaAnimation) AnimationAdapter(us.pinguo.edit.sdk.base.widget.AnimationAdapter)

Example 5 with AnimationAdapter

use of us.pinguo.edit.sdk.base.widget.AnimationAdapter in project PhotoNoter by yydcdut.

the class PGEditView method resetSecondBottomLayoutWithAnimation.

public void resetSecondBottomLayoutWithAnimation() {
    mBackMainView.setVisibility(View.VISIBLE);
    AlphaAnimation backAlphaAnimation = new AlphaAnimation(0f, 1f);
    backAlphaAnimation.setDuration(PGEditConstants.EFFECT_ANIMATION_TIME);
    mBackMainView.startAnimation(backAlphaAnimation);
    AlphaAnimation nameAlphaAnimation = new AlphaAnimation(1f, 0f);
    nameAlphaAnimation.setDuration(PGEditConstants.EFFECT_BOTTOM_ANIMATION_TIME);
    nameAlphaAnimation.setAnimationListener(new AnimationAdapter() {

        @Override
        public void onAnimationEnd(Animation animation) {
            mActivity.runOnUiThread(new Runnable() {

                @Override
                public void run() {
                    if (null != mMenuListener) {
                        mMenuListener.onResetSecondBottomLayoutWithAnimationFinish();
                    }
                    AlphaAnimation alphaAnimation = new AlphaAnimation(0f, 1f);
                    alphaAnimation.setDuration(PGEditConstants.EFFECT_BOTTOM_ANIMATION_TIME);
                    mSecondBottomName.startAnimation(alphaAnimation);
                }
            });
        }
    });
    mSecondBottomName.startAnimation(nameAlphaAnimation);
    AlphaAnimation savePhotoAlphaAnimation = new AlphaAnimation(1f, 0f);
    savePhotoAlphaAnimation.setDuration(PGEditConstants.EFFECT_BOTTOM_ANIMATION_TIME);
    savePhotoAlphaAnimation.setAnimationListener(new AnimationAdapter() {

        @Override
        public void onAnimationEnd(Animation animation) {
            mActivity.runOnUiThread(new Runnable() {

                @Override
                public void run() {
                    AlphaAnimation alphaAnimation = new AlphaAnimation(0f, 1f);
                    alphaAnimation.setDuration(PGEditConstants.EFFECT_BOTTOM_ANIMATION_TIME);
                    mSaveEffectView.startAnimation(alphaAnimation);
                }
            });
        }
    });
    mSaveEffectView.startAnimation(savePhotoAlphaAnimation);
}
Also used : TranslateAnimation(android.view.animation.TranslateAnimation) Animation(android.view.animation.Animation) AlphaAnimation(android.view.animation.AlphaAnimation) AlphaAnimation(android.view.animation.AlphaAnimation) AnimationAdapter(us.pinguo.edit.sdk.base.widget.AnimationAdapter)

Aggregations

AlphaAnimation (android.view.animation.AlphaAnimation)5 Animation (android.view.animation.Animation)5 TranslateAnimation (android.view.animation.TranslateAnimation)5 AnimationAdapter (us.pinguo.edit.sdk.base.widget.AnimationAdapter)5 AccelerateDecelerateInterpolator (android.view.animation.AccelerateDecelerateInterpolator)2 AnimationSet (android.view.animation.AnimationSet)2