Java Code Examples for android.view.animation.AlphaAnimation#setStartOffset()

The following examples show how to use android.view.animation.AlphaAnimation#setStartOffset() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: PostFeedActivity.java    From umeng_community_android with MIT License 6 votes vote down vote up
/**
 * 为话题提示VIew绑定动画</br>
 */
private void startAnimationForTopicTipView() {
    int timePiece = 500;
    int repeatCount = 4;
    int startDeny = 50;
    TranslateAnimation translateAnimation = new TranslateAnimation(0, 0, 10, 0);
    translateAnimation.setRepeatMode(Animation.REVERSE);
    // translateAnimation.setStartOffset(startDeny * repeatCount+timePiece);
    translateAnimation.setRepeatCount(Integer.MAX_VALUE);
    translateAnimation.setDuration(timePiece);

    AlphaAnimation alphaAnimationIn = new AlphaAnimation(0, 1.0f);
    alphaAnimationIn.setDuration(timePiece);
    alphaAnimationIn.setStartOffset(startDeny * repeatCount);

    AnimationSet animationSet = new AnimationSet(true);
    animationSet.addAnimation(alphaAnimationIn);
    animationSet.addAnimation(translateAnimation);
    // animationSet.addAnimation(alphaAnimationOut);
    // animationSet.setFillAfter(true);
    mTopicTipView.startAnimation(animationSet);
}
 
Example 2
Source File: ChannelDetailBSDFragment.java    From zap-android with MIT License 6 votes vote down vote up
private void switchToProgressScreen() {
    mProgressScreen.setVisibility(View.VISIBLE);
    mCloseChannelButton.setEnabled(false);

    // Animate out
    AlphaAnimation animateOut = new AlphaAnimation(1.0f, 0f);
    animateOut.setDuration(200);
    animateOut.setFillAfter(true);

    mContentLayout.startAnimation(animateOut);
    mIvBsdIcon.startAnimation(animateOut);

    // Set size of progress result icon to 0
    mProgressResultIcon.setScaleX(0);
    mProgressResultIcon.setScaleY(0);

    // Animate in
    mProgressScreen.setAlpha(1.0f);
    AlphaAnimation animateIn = new AlphaAnimation(0f, 1.0f);
    animateIn.setDuration(200);
    animateIn.setStartOffset(200);
    animateIn.setFillAfter(true);

    mProgressScreen.startAnimation(animateIn);
}
 
Example 3
Source File: ViewAnimationBox.java    From android-animations-transitions with MIT License 6 votes vote down vote up
@Override
    public void $onLayoutDone(final View rootView) {
        View view = rootView.findViewById(R.id.textView);
        AnimationSet animation = new AnimationSet(true);
        TranslateAnimation move = new TranslateAnimation(0, 0, 0, 800);
        move.setDuration(1000);

        AlphaAnimation fadeOut = new AlphaAnimation(1, 0);
        fadeOut.setDuration(1000);
        fadeOut.setStartOffset(1000);

        AlphaAnimation fadeIn = new AlphaAnimation(0, 1);
        fadeIn.setDuration(1000);
        fadeIn.setStartOffset(3000);

        animation.addAnimation(move);
        animation.addAnimation(fadeOut);
//        animation.addAnimation(fadeIn);

        view.startAnimation(animation);
    }
 
Example 4
Source File: SimpleActivity.java    From butterknife with Apache License 2.0 5 votes vote down vote up
@Override public void apply(@NonNull View view, int index) {
  AlphaAnimation alphaAnimation = new AlphaAnimation(0, 1);
  alphaAnimation.setFillBefore(true);
  alphaAnimation.setDuration(500);
  alphaAnimation.setStartOffset(index * 100);
  view.startAnimation(alphaAnimation);
}
 
Example 5
Source File: SendBSDFragment.java    From zap-android with MIT License 5 votes vote down vote up
private void switchToSendProgressScreen() {

        // make previous buttons and edit texts unclickable
        mNumpad.setEnabled(false);
        mBtnSend.setEnabled(false);
        mBtnManageChannels.setEnabled(false);
        mEtAmount.setEnabled(false);
        mNumpad.setEnabled(false);

        // Animate out

        AlphaAnimation animateOut = new AlphaAnimation(1.0f, 0f);
        animateOut.setDuration(200);
        animateOut.setFillAfter(true);

        mNumpad.startAnimation(animateOut);
        mSendAmountView.startAnimation(animateOut);
        mMemoView.startAnimation(animateOut);
        mBtnSend.startAnimation(animateOut);
        mTvTitle.startAnimation(animateOut);
        mIvBsdIcon.startAnimation(animateOut);
        mLightningFeeView.startAnimation(animateOut);
        mOnChainFeeView.startAnimation(animateOut);

        // Set size of progress finished icon to 0
        mProgressFinishedIcon.setScaleX(0);
        mProgressFinishedIcon.setScaleY(0);

        // Animate in

        mProgressScreen.setAlpha(1.0f);
        AlphaAnimation animateIn = new AlphaAnimation(0f, 1.0f);
        animateIn.setDuration(200);
        animateIn.setStartOffset(200);
        animateIn.setFillAfter(true);

        mProgressScreen.startAnimation(animateIn);


    }
 
Example 6
Source File: Splash.java    From SignatureView with Apache License 2.0 5 votes vote down vote up
@Override
protected void onCreate(final Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_splash);
    Context mContext = this;

    ImageView logoImg = findViewById(R.id.company_logo);
    TextView textView = findViewById(R.id.splash_text);

    Typeface typeface = Typeface.createFromAsset(mContext.getAssets(),
            "Exo2-Light.otf");
    textView.setTypeface(typeface);

    AlphaAnimation animation = new AlphaAnimation(0.2f, 1.0f);
    animation.setDuration(SPLASH_TIME_OUT);
    animation.setStartOffset(100);
    animation.setFillAfter(true);
    logoImg.startAnimation(animation);

    new Handler().postDelayed(new Runnable() {
        @Override
        public void run() {
            Intent i = new Intent(Splash.this, Signature.class);
            startActivity(i);
            finish();
        }
    }, SPLASH_TIME_OUT);
}
 
Example 7
Source File: LnUrlWithdrawBSDFragment.java    From zap-android with MIT License 5 votes vote down vote up
private void switchToWithdrawProgressScreen() {

        // make previous buttons and edit texts unclickable
        mNumpad.setEnabled(false);
        mBtnWithdraw.setEnabled(false);
        mEtAmount.setEnabled(false);
        mNumpad.setEnabled(false);

        // Animate out

        AlphaAnimation animateOut = new AlphaAnimation(1.0f, 0f);
        animateOut.setDuration(200);
        animateOut.setFillAfter(true);
        mNumpad.startAnimation(animateOut);
        mWithdrawAmountView.startAnimation(animateOut);
        mDescriptionView.startAnimation(animateOut);
        mBtnWithdraw.startAnimation(animateOut);
        mTvTitle.startAnimation(animateOut);
        mIvBsdIcon.startAnimation(animateOut);

        // Set size of progress finished icon to 0
        mProgressFinishedIcon.setScaleX(0);
        mProgressFinishedIcon.setScaleY(0);

        // Animate in
        mProgressScreen.setAlpha(1.0f);
        AlphaAnimation animateIn = new AlphaAnimation(0f, 1.0f);
        animateIn.setDuration(200);
        animateIn.setStartOffset(200);
        animateIn.setFillAfter(true);
        mProgressScreen.startAnimation(animateIn);
    }
 
Example 8
Source File: DSListView.java    From direct-select-android with MIT License 5 votes vote down vote up
private void hideListView() {
    if (!readyToHide || animationInProgress || scrollInProgress || !listViewIsShown || adapter == null) return;

    readyToHide = false;
    animationInProgress = true;
    listView.setEnabled(false);

    this.setVisibility(View.INVISIBLE);

    this.pickerBox.onSelect(adapter.getItem(selectedItem), selectedItem);

    AlphaAnimation hideAnimation = new AlphaAnimation(1f, 0f);
    hideAnimation.setStartOffset(subScrollDuration);
    hideAnimation.setDuration(200);
    hideAnimation.setInterpolator(new DecelerateInterpolator());
    hideAnimation.setAnimationListener(new AnimationListenerAdapter() {
        @Override
        public void onAnimationEnd(Animation animation) {
            listViewIsShown = false;
            animationInProgress = false;
        }
    });
    DSListView.this.startAnimation(hideAnimation);

    // Scale picker box text animation if animations enabled
    if (selectorAnimationsEnabled && null != this.pickerBox) {
        ScaleAnimation scaleAnimation = new ScaleAnimation(1f + scaleFactorDelta, 1f, 1f + scaleFactorDelta, 1f,
                Animation.RELATIVE_TO_SELF, selectorAnimationCenterPivot ? 0.5f : 0f, Animation.RELATIVE_TO_SELF, 0.5f);
        scaleAnimation.setInterpolator(new DecelerateInterpolator());
        scaleAnimation.setStartOffset(100 + subScrollDuration);
        scaleAnimation.setDuration(100);
        scaleAnimation.setFillAfter(true);
        this.pickerBox.getCellRoot().startAnimation(scaleAnimation);
    }
}
 
Example 9
Source File: OpenChannelBSDFragment.java    From zap-android with MIT License 5 votes vote down vote up
private void switchToSendProgressScreen() {

        // make previous buttons and edit texts unclickable
        mNumpad.setEnabled(false);
        mOpenChannelButton.setEnabled(false);
        mEtAmount.setEnabled(false);
        mNumpad.setEnabled(false);

        // Animate out
        AlphaAnimation animateOut = new AlphaAnimation(1.0f, 0f);
        animateOut.setDuration(200);
        animateOut.setFillAfter(true);

        mLocalAmountsInputView.startAnimation(animateOut);
        mNumpad.startAnimation(animateOut);
        mOpenChannelButton.startAnimation(animateOut);
        mNodeLayout.startAnimation(animateOut);
        mIvBsdIcon.startAnimation(animateOut);
        // Set size of progress finished icon to 0
        mProgressFinishedIcon.setScaleX(0);
        mProgressFinishedIcon.setScaleY(0);

        // Animate in
        mProgressScreen.setAlpha(1.0f);
        AlphaAnimation animateIn = new AlphaAnimation(0f, 1.0f);
        animateIn.setDuration(200);
        animateIn.setStartOffset(200);
        animateIn.setFillAfter(true);
        mProgressScreen.startAnimation(animateIn);

    }
 
Example 10
Source File: AnimationHelper.java    From AnimatedPullToRefresh-master with Apache License 2.0 5 votes vote down vote up
private void addTextFadeAnimations(AnimationSet set) {
    AlphaAnimation mFadeInAnim = new AlphaAnimation(1, FADE_MOUNT);
    mFadeInAnim.setDuration(CHARACTER_ANIM_DURATION);
    set.addAnimation(mFadeInAnim);
    AlphaAnimation mFadeOutAnim = new AlphaAnimation(FADE_MOUNT, 1);
    mFadeOutAnim.setDuration(CHARACTER_ANIM_DURATION);
    mFadeOutAnim.setStartOffset(CHARACTER_ANIM_DURATION + 20);
    mFadeOutAnim.setFillAfter(true);
    set.addAnimation(mFadeOutAnim);
    set.setInterpolator(interpolator);
}
 
Example 11
Source File: AnimationHelper.java    From AnimatedPullToRefresh-master with Apache License 2.0 5 votes vote down vote up
private void addLoopFadeAnimations(long duration, AnimationSet set) {
    AlphaAnimation mFadeInAnim = new AlphaAnimation(1, FADE_MOUNT);
    mFadeInAnim.setDuration(duration);
    set.addAnimation(mFadeInAnim);
    AlphaAnimation mFadeOutAnim = new AlphaAnimation(FADE_MOUNT, 1);
    mFadeOutAnim.setDuration(duration);
    mFadeOutAnim.setStartOffset(duration + 50);
    set.addAnimation(mFadeOutAnim);
    set.setInterpolator(interpolator);
}
 
Example 12
Source File: FeedBackAnimFragment.java    From letv with Apache License 2.0 5 votes vote down vote up
private void startAnim(View widget) {
    int distance = widget.getHeight();
    widget.setVisibility(0);
    this.mFloatLayout.setVisibility(0);
    AlphaAnimation alphaAnimation = new AlphaAnimation(0.0f, 1.0f);
    alphaAnimation.setDuration(200);
    alphaAnimation.setStartOffset(200);
    this.mFloatLayout.setAnimation(alphaAnimation);
    this.mAnimation = new TranslateAnimation(0.0f, 0.0f, (float) distance, 0.0f);
    this.mAnimation.setDuration(200);
    this.mAnimation.setStartOffset(200);
    widget.setAnimation(this.mAnimation);
    this.mAnimation.start();
    alphaAnimation.start();
}
 
Example 13
Source File: LnUrlWithdrawBSDFragment.java    From zap-android with MIT License 4 votes vote down vote up
private void switchToFailedScreen(String error) {

        // Animate Layout changes
        ConstraintSet csRoot = new ConstraintSet();
        csRoot.clone(mRootLayout);
        csRoot.connect(mProgressScreen.getId(), ConstraintSet.TOP, ConstraintSet.PARENT_ID, ConstraintSet.TOP);
        csRoot.setVerticalBias(mProgressScreen.getId(), 0.0f);

        Transition transition = new ChangeBounds();
        transition.setInterpolator(new DecelerateInterpolator(3));
        transition.setDuration(1000);
        //transition.setStartDelay(200);
        TransitionManager.beginDelayedTransition(mRootLayout, transition);
        csRoot.applyTo(mRootLayout);


        // Animate finished Icon switch
        mProgressFinishedIcon.setImageDrawable(getResources().getDrawable(R.drawable.ic_failed_circle_black_60dp));
        mProgressFinishedIcon.setImageTintList(ColorStateList.valueOf(ContextCompat.getColor(getActivity(), R.color.superRed)));
        ObjectAnimator scaleUpX = ObjectAnimator.ofFloat(mProgressFinishedIcon, "scaleX", 0f, 1f);
        ObjectAnimator scaleUpY = ObjectAnimator.ofFloat(mProgressFinishedIcon, "scaleY", 0f, 1f);
        scaleUpX.setDuration(500);
        scaleUpY.setDuration(500);

        AnimatorSet scaleUpIcon = new AnimatorSet();
        //scaleUpIcon.setInterpolator(new AnticipateOvershootInterpolator(1.0f));
        scaleUpIcon.play(scaleUpX).with(scaleUpY);
        scaleUpIcon.start();

        ObjectAnimator scaleDownX = ObjectAnimator.ofFloat(mProgressBar, "scaleX", 1f, 0f);
        ObjectAnimator scaleDownY = ObjectAnimator.ofFloat(mProgressBar, "scaleY", 1f, 0f);
        ObjectAnimator scaleDownX2 = ObjectAnimator.ofFloat(mIvProgressPaymentTypeIcon, "scaleX", 1f, 0f);
        ObjectAnimator scaleDownY2 = ObjectAnimator.ofFloat(mIvProgressPaymentTypeIcon, "scaleY", 1f, 0f);
        scaleDownX.setDuration(500);
        scaleDownY.setDuration(500);
        scaleDownX2.setDuration(500);
        scaleDownY2.setDuration(500);

        AnimatorSet scaleDownIcon = new AnimatorSet();
        //scaleUpIcon.setInterpolator(new AnticipateOvershootInterpolator(1.0f));
        scaleDownIcon.play(scaleDownX).with(scaleDownY).with(scaleDownX2).with(scaleDownY2);
        scaleDownIcon.start();

        // Set failed states
        mTvFinishedText.setText(R.string.lnurl_withdraw_fail);
        mTvFinishedText.setTextColor(getResources().getColor(R.color.superRed));
        mTvFinishedText2.setText(error);

        // Animate in
        mFinishedScreen.setAlpha(1.0f);
        AlphaAnimation animateIn = new AlphaAnimation(0f, 1.0f);
        animateIn.setDuration(300);
        animateIn.setStartOffset(300);
        animateIn.setFillAfter(true);
        mFinishedScreen.startAnimation(animateIn);

        // Enable Ok button
        mOkButton.setEnabled(true);
    }
 
Example 14
Source File: BasicAnimationDemoActivity.java    From AnimationApiDemos with Apache License 2.0 4 votes vote down vote up
private void initAnimations() {
	mTurnupAnimation = new RotateAnimation(0, -180,
			RotateAnimation.RELATIVE_TO_SELF, 0.5f,
			RotateAnimation.RELATIVE_TO_SELF, 0.5f);
	mTurnupAnimation.setInterpolator(new LinearInterpolator());
	mTurnupAnimation.setDuration(500);
	mTurnupAnimation.setFillAfter(true);

	mTurndownAnimation = new RotateAnimation(-180, 0,
			RotateAnimation.RELATIVE_TO_SELF, 0.5f,
			RotateAnimation.RELATIVE_TO_SELF, 0.5f);
	mTurndownAnimation.setInterpolator(new LinearInterpolator());
	mTurndownAnimation.setDuration(500);
	mTurndownAnimation.setFillAfter(true);

	mTranslateAnimationOne = new TranslateAnimation(0, 100, 0, 100);
	mTranslateAnimationOne
			.setInterpolator(new AccelerateDecelerateInterpolator());
	mTranslateAnimationOne.setDuration(1000);
	mTranslateAnimationOne.setFillAfter(true);

	mTranslateAnimationTwo = new TranslateAnimation(100, 100, 0, 100);
	mTranslateAnimationTwo
			.setInterpolator(new AccelerateDecelerateInterpolator());
	mTranslateAnimationTwo.setDuration(1000);
	mTranslateAnimationTwo.setFillAfter(true);

	mAlphaAnimationOne = new AlphaAnimation(1, 0);
	mAlphaAnimationOne.setDuration(500);
	mAlphaAnimationOne.setFillAfter(true);

	mAlphaAnimationTwo = new AlphaAnimation(0, 1);
	mAlphaAnimationTwo.setDuration(1000);
	mAlphaAnimationTwo.setStartOffset(500);
	mAlphaAnimationTwo.setFillAfter(true);

	mAlphaAnimationSet = new AnimationSet(false);
	mAlphaAnimationSet.addAnimation(mAlphaAnimationOne);
	mAlphaAnimationSet.addAnimation(mAlphaAnimationTwo);
	mAlphaAnimationSet.setDuration(5000);

	mAlphaAnimationSet.setFillAfter(true);

	mScaleAnimation = new ScaleAnimation(1, 1.5f, 1, 1.5f);
	mScaleAnimation.setDuration(1000);
	mScaleAnimation.setFillAfter(true);

}
 
Example 15
Source File: LnUrlWithdrawBSDFragment.java    From zap-android with MIT License 4 votes vote down vote up
private void switchToSuccessScreen() {

        // Animate Layout changes
        ConstraintSet csRoot = new ConstraintSet();
        csRoot.clone(mRootLayout);
        csRoot.connect(mProgressScreen.getId(), ConstraintSet.TOP, ConstraintSet.PARENT_ID, ConstraintSet.TOP);
        csRoot.setVerticalBias(mProgressScreen.getId(), 0.0f);

        Transition transition = new ChangeBounds();
        transition.setInterpolator(new DecelerateInterpolator(3));
        transition.setDuration(1000);
        //transition.setStartDelay(200);
        TransitionManager.beginDelayedTransition(mRootLayout, transition);
        csRoot.applyTo(mRootLayout);


        // Animate finished Icon switch
        ObjectAnimator scaleUpX = ObjectAnimator.ofFloat(mProgressFinishedIcon, "scaleX", 0f, 1f);
        ObjectAnimator scaleUpY = ObjectAnimator.ofFloat(mProgressFinishedIcon, "scaleY", 0f, 1f);
        scaleUpX.setDuration(500);
        scaleUpY.setDuration(500);

        AnimatorSet scaleUpIcon = new AnimatorSet();
        //scaleUpIcon.setInterpolator(new AnticipateOvershootInterpolator(1.0f));
        scaleUpIcon.play(scaleUpX).with(scaleUpY);
        scaleUpIcon.start();

        ObjectAnimator scaleDownX = ObjectAnimator.ofFloat(mProgressBar, "scaleX", 1f, 0f);
        ObjectAnimator scaleDownY = ObjectAnimator.ofFloat(mProgressBar, "scaleY", 1f, 0f);
        ObjectAnimator scaleDownX2 = ObjectAnimator.ofFloat(mIvProgressPaymentTypeIcon, "scaleX", 1f, 0f);
        ObjectAnimator scaleDownY2 = ObjectAnimator.ofFloat(mIvProgressPaymentTypeIcon, "scaleY", 1f, 0f);
        scaleDownX.setDuration(500);
        scaleDownY.setDuration(500);
        scaleDownX2.setDuration(500);
        scaleDownY2.setDuration(500);

        AnimatorSet scaleDownIcon = new AnimatorSet();
        //scaleUpIcon.setInterpolator(new AnticipateOvershootInterpolator(1.0f));
        scaleDownIcon.play(scaleDownX).with(scaleDownY).with(scaleDownX2).with(scaleDownY2);
        scaleDownIcon.start();


        // Animate in
        mFinishedScreen.setAlpha(1.0f);
        AlphaAnimation animateIn = new AlphaAnimation(0f, 1.0f);
        animateIn.setDuration(300);
        animateIn.setStartOffset(300);
        animateIn.setFillAfter(true);
        mFinishedScreen.startAnimation(animateIn);

        // Enable Ok button
        mOkButton.setEnabled(true);
    }
 
Example 16
Source File: ChannelDetailBSDFragment.java    From zap-android with MIT License 4 votes vote down vote up
private void switchToFinishScreen(boolean success, String error) {
    mFinishedScreen.setVisibility(View.VISIBLE);

    // Animate Layout changes
    ConstraintSet csRoot = new ConstraintSet();
    csRoot.clone(mRootLayout);
    csRoot.connect(mProgressScreen.getId(), ConstraintSet.TOP, ConstraintSet.PARENT_ID, ConstraintSet.TOP);
    csRoot.setVerticalBias(mProgressScreen.getId(), 0.0f);

    Transition transition = new ChangeBounds();
    transition.setInterpolator(new DecelerateInterpolator(3));
    transition.setDuration(1000);
    TransitionManager.beginDelayedTransition(mRootLayout, transition);
    csRoot.applyTo(mRootLayout);

    // Animate result icon switch
    if (!success) {
        mProgressResultIcon.setImageDrawable(getResources().getDrawable(R.drawable.ic_failed_circle_black_60dp));
        mProgressResultIcon.setImageTintList(ColorStateList.valueOf(ContextCompat.getColor(getActivity(), R.color.superRed)));
    } else {
        mProgressResultIcon.setImageDrawable(getResources().getDrawable(R.drawable.ic_check_circle_black_60dp));
        mProgressResultIcon.setImageTintList(ColorStateList.valueOf(ContextCompat.getColor(getActivity(), R.color.superGreen)));
    }

    ObjectAnimator scaleUpX = ObjectAnimator.ofFloat(mProgressResultIcon, "scaleX", 0f, 1f);
    ObjectAnimator scaleUpY = ObjectAnimator.ofFloat(mProgressResultIcon, "scaleY", 0f, 1f);
    scaleUpX.setDuration(500);
    scaleUpY.setDuration(500);

    AnimatorSet scaleUpIcon = new AnimatorSet();
    scaleUpIcon.play(scaleUpX).with(scaleUpY);
    scaleUpIcon.start();

    ObjectAnimator scaleDownX = ObjectAnimator.ofFloat(mProgressBar, "scaleX", 1f, 0f);
    ObjectAnimator scaleDownY = ObjectAnimator.ofFloat(mProgressBar, "scaleY", 1f, 0f);
    ObjectAnimator scaleDownX2 = ObjectAnimator.ofFloat(mProgressThunderIcon, "scaleX", 1f, 0f);
    ObjectAnimator scaleDownY2 = ObjectAnimator.ofFloat(mProgressThunderIcon, "scaleY", 1f, 0f);
    scaleDownX.setDuration(500);
    scaleDownY.setDuration(500);
    scaleDownX2.setDuration(500);
    scaleDownY2.setDuration(500);

    AnimatorSet scaleDownIcon = new AnimatorSet();
    scaleDownIcon.play(scaleDownX).with(scaleDownY).with(scaleDownX2).with(scaleDownY2);
    scaleDownIcon.start();

    if (success) {
        mTvFinishedText.setText(R.string.success);
        mTvFinishedText2.setText(R.string.channel_close_success);
    } else {
        mTvFinishedText.setText(R.string.channel_close_error);
        mTvFinishedText.setTextColor(getResources().getColor(R.color.superRed));
        mTvFinishedText2.setText(error);
    }

    // Animate in
    mFinishedScreen.setAlpha(1.0f);
    AlphaAnimation animateIn = new AlphaAnimation(0f, 1.0f);
    animateIn.setDuration(300);
    animateIn.setStartOffset(300);
    animateIn.setFillAfter(true);

    mFinishedScreen.startAnimation(animateIn);

    // Enable Ok button
    mOkButton.setEnabled(true);
}
 
Example 17
Source File: SendBSDFragment.java    From zap-android with MIT License 4 votes vote down vote up
private void switchToFailedScreen(String error) {

        // Animate Layout changes
        ConstraintSet csRoot = new ConstraintSet();
        csRoot.clone(mRootLayout);
        csRoot.connect(mProgressScreen.getId(), ConstraintSet.TOP, ConstraintSet.PARENT_ID, ConstraintSet.TOP);
        csRoot.setVerticalBias(mProgressScreen.getId(), 0.0f);

        Transition transition = new ChangeBounds();
        transition.setInterpolator(new DecelerateInterpolator(3));
        transition.setDuration(1000);
        //transition.setStartDelay(200);
        TransitionManager.beginDelayedTransition(mRootLayout, transition);
        csRoot.applyTo(mRootLayout);


        // Animate finished Icon switch
        mProgressFinishedIcon.setImageDrawable(getResources().getDrawable(R.drawable.ic_failed_circle_black_60dp));
        mProgressFinishedIcon.setImageTintList(ColorStateList.valueOf(ContextCompat.getColor(getActivity(), R.color.superRed)));
        ObjectAnimator scaleUpX = ObjectAnimator.ofFloat(mProgressFinishedIcon, "scaleX", 0f, 1f);
        ObjectAnimator scaleUpY = ObjectAnimator.ofFloat(mProgressFinishedIcon, "scaleY", 0f, 1f);
        scaleUpX.setDuration(500);
        scaleUpY.setDuration(500);

        AnimatorSet scaleUpIcon = new AnimatorSet();
        //scaleUpIcon.setInterpolator(new AnticipateOvershootInterpolator(1.0f));
        scaleUpIcon.play(scaleUpX).with(scaleUpY);
        scaleUpIcon.start();

        ObjectAnimator scaleDownX = ObjectAnimator.ofFloat(mProgressBar, "scaleX", 1f, 0f);
        ObjectAnimator scaleDownY = ObjectAnimator.ofFloat(mProgressBar, "scaleY", 1f, 0f);
        ObjectAnimator scaleDownX2 = ObjectAnimator.ofFloat(mIvProgressPaymentTypeIcon, "scaleX", 1f, 0f);
        ObjectAnimator scaleDownY2 = ObjectAnimator.ofFloat(mIvProgressPaymentTypeIcon, "scaleY", 1f, 0f);
        scaleDownX.setDuration(500);
        scaleDownY.setDuration(500);
        scaleDownX2.setDuration(500);
        scaleDownY2.setDuration(500);

        AnimatorSet scaleDownIcon = new AnimatorSet();
        //scaleUpIcon.setInterpolator(new AnticipateOvershootInterpolator(1.0f));
        scaleDownIcon.play(scaleDownX).with(scaleDownY).with(scaleDownX2).with(scaleDownY2);
        scaleDownIcon.start();


        // Set failed states
        mTvFinishedText.setText(R.string.send_fail);
        mTvFinishedText.setTextColor(getResources().getColor(R.color.superRed));
        mTvFinishedText2.setText(error);

        // Animate in

        mFinishedScreen.setAlpha(1.0f);
        AlphaAnimation animateIn = new AlphaAnimation(0f, 1.0f);
        animateIn.setDuration(300);
        animateIn.setStartOffset(300);
        animateIn.setFillAfter(true);


        mFinishedScreen.startAnimation(animateIn);

        // Enable Ok button
        mOkButton.setEnabled(true);
    }
 
Example 18
Source File: SendBSDFragment.java    From zap-android with MIT License 4 votes vote down vote up
private void switchToSuccessScreen() {


        // Animate Layout changes
        ConstraintSet csRoot = new ConstraintSet();
        csRoot.clone(mRootLayout);
        csRoot.connect(mProgressScreen.getId(), ConstraintSet.TOP, ConstraintSet.PARENT_ID, ConstraintSet.TOP);
        csRoot.setVerticalBias(mProgressScreen.getId(), 0.0f);

        Transition transition = new ChangeBounds();
        transition.setInterpolator(new DecelerateInterpolator(3));
        transition.setDuration(1000);
        //transition.setStartDelay(200);
        TransitionManager.beginDelayedTransition(mRootLayout, transition);
        csRoot.applyTo(mRootLayout);


        // Animate finished Icon switch
        ObjectAnimator scaleUpX = ObjectAnimator.ofFloat(mProgressFinishedIcon, "scaleX", 0f, 1f);
        ObjectAnimator scaleUpY = ObjectAnimator.ofFloat(mProgressFinishedIcon, "scaleY", 0f, 1f);
        scaleUpX.setDuration(500);
        scaleUpY.setDuration(500);

        AnimatorSet scaleUpIcon = new AnimatorSet();
        //scaleUpIcon.setInterpolator(new AnticipateOvershootInterpolator(1.0f));
        scaleUpIcon.play(scaleUpX).with(scaleUpY);
        scaleUpIcon.start();

        ObjectAnimator scaleDownX = ObjectAnimator.ofFloat(mProgressBar, "scaleX", 1f, 0f);
        ObjectAnimator scaleDownY = ObjectAnimator.ofFloat(mProgressBar, "scaleY", 1f, 0f);
        ObjectAnimator scaleDownX2 = ObjectAnimator.ofFloat(mIvProgressPaymentTypeIcon, "scaleX", 1f, 0f);
        ObjectAnimator scaleDownY2 = ObjectAnimator.ofFloat(mIvProgressPaymentTypeIcon, "scaleY", 1f, 0f);
        scaleDownX.setDuration(500);
        scaleDownY.setDuration(500);
        scaleDownX2.setDuration(500);
        scaleDownY2.setDuration(500);

        AnimatorSet scaleDownIcon = new AnimatorSet();
        //scaleUpIcon.setInterpolator(new AnticipateOvershootInterpolator(1.0f));
        scaleDownIcon.play(scaleDownX).with(scaleDownY).with(scaleDownX2).with(scaleDownY2);
        scaleDownIcon.start();


        // Animate in

        mFinishedScreen.setAlpha(1.0f);
        AlphaAnimation animateIn = new AlphaAnimation(0f, 1.0f);
        animateIn.setDuration(300);
        animateIn.setStartOffset(300);
        animateIn.setFillAfter(true);


        mFinishedScreen.startAnimation(animateIn);

        // Enable Ok button
        mOkButton.setEnabled(true);
    }
 
Example 19
Source File: OpenChannelBSDFragment.java    From zap-android with MIT License 4 votes vote down vote up
private void switchToSuccessScreen() {


        // Animate Layout changes
        ConstraintSet csRoot = new ConstraintSet();
        csRoot.clone(mRootLayout);
        csRoot.connect(mProgressScreen.getId(), ConstraintSet.TOP, ConstraintSet.PARENT_ID, ConstraintSet.TOP);
        csRoot.setVerticalBias(mProgressScreen.getId(), 0.0f);

        Transition transition = new ChangeBounds();
        transition.setInterpolator(new DecelerateInterpolator(3));
        transition.setDuration(1000);
        //transition.setStartDelay(200);
        TransitionManager.beginDelayedTransition(mRootLayout, transition);
        csRoot.applyTo(mRootLayout);


        // Animate finished Icon switch
        ObjectAnimator scaleUpX = ObjectAnimator.ofFloat(mProgressFinishedIcon, "scaleX", 0f, 1f);
        ObjectAnimator scaleUpY = ObjectAnimator.ofFloat(mProgressFinishedIcon, "scaleY", 0f, 1f);
        scaleUpX.setDuration(500);
        scaleUpY.setDuration(500);

        AnimatorSet scaleUpIcon = new AnimatorSet();
        //scaleUpIcon.setInterpolator(new AnticipateOvershootInterpolator(1.0f));
        scaleUpIcon.play(scaleUpX).with(scaleUpY);
        scaleUpIcon.start();

        ObjectAnimator scaleDownX = ObjectAnimator.ofFloat(mProgressBar, "scaleX", 1f, 0f);
        ObjectAnimator scaleDownY = ObjectAnimator.ofFloat(mProgressBar, "scaleY", 1f, 0f);
        ObjectAnimator scaleDownX2 = ObjectAnimator.ofFloat(mIvProgressPaymentTypeIcon, "scaleX", 1f, 0f);
        ObjectAnimator scaleDownY2 = ObjectAnimator.ofFloat(mIvProgressPaymentTypeIcon, "scaleY", 1f, 0f);
        scaleDownX.setDuration(500);
        scaleDownY.setDuration(500);
        scaleDownX2.setDuration(500);
        scaleDownY2.setDuration(500);

        AnimatorSet scaleDownIcon = new AnimatorSet();
        //scaleUpIcon.setInterpolator(new AnticipateOvershootInterpolator(1.0f));
        scaleDownIcon.play(scaleDownX).with(scaleDownY).with(scaleDownX2).with(scaleDownY2);
        scaleDownIcon.start();

        mTvFinishedText.setText(R.string.success);
        mTvFinishedTextDetail.setText(R.string.channel_open_success);

        // Animate in

        mFinishedScreen.setAlpha(1.0f);
        AlphaAnimation animateIn = new AlphaAnimation(0f, 1.0f);
        animateIn.setDuration(300);
        animateIn.setStartOffset(300);
        animateIn.setFillAfter(true);


        mFinishedScreen.startAnimation(animateIn);

        // Enable Ok button
        mOkButton.setEnabled(true);
    }
 
Example 20
Source File: OpenChannelBSDFragment.java    From zap-android with MIT License 4 votes vote down vote up
private void switchToFailedScreen(String error) {

        // Animate Layout changes
        ConstraintSet csRoot = new ConstraintSet();
        csRoot.clone(mRootLayout);
        csRoot.connect(mProgressScreen.getId(), ConstraintSet.TOP, ConstraintSet.PARENT_ID, ConstraintSet.TOP);
        csRoot.setVerticalBias(mProgressScreen.getId(), 0.0f);

        Transition transition = new ChangeBounds();
        transition.setInterpolator(new DecelerateInterpolator(3));
        transition.setDuration(1000);
        //transition.setStartDelay(200);
        TransitionManager.beginDelayedTransition(mRootLayout, transition);
        csRoot.applyTo(mRootLayout);

        // Animate finished Icon switch
        mProgressFinishedIcon.setImageDrawable(getResources().getDrawable(R.drawable.ic_failed_circle_black_60dp));
        mProgressFinishedIcon.setImageTintList(ColorStateList.valueOf(ContextCompat.getColor(getActivity(), R.color.superRed)));
        ObjectAnimator scaleUpX = ObjectAnimator.ofFloat(mProgressFinishedIcon, "scaleX", 0f, 1f);
        ObjectAnimator scaleUpY = ObjectAnimator.ofFloat(mProgressFinishedIcon, "scaleY", 0f, 1f);
        scaleUpX.setDuration(500);
        scaleUpY.setDuration(500);

        AnimatorSet scaleUpIcon = new AnimatorSet();
        scaleUpIcon.play(scaleUpX).with(scaleUpY);
        scaleUpIcon.start();

        ObjectAnimator scaleDownX = ObjectAnimator.ofFloat(mProgressBar, "scaleX", 1f, 0f);
        ObjectAnimator scaleDownY = ObjectAnimator.ofFloat(mProgressBar, "scaleY", 1f, 0f);
        ObjectAnimator scaleDownX2 = ObjectAnimator.ofFloat(mIvProgressPaymentTypeIcon, "scaleX", 1f, 0f);
        ObjectAnimator scaleDownY2 = ObjectAnimator.ofFloat(mIvProgressPaymentTypeIcon, "scaleY", 1f, 0f);
        scaleDownX.setDuration(500);
        scaleDownY.setDuration(500);
        scaleDownX2.setDuration(500);
        scaleDownY2.setDuration(500);

        AnimatorSet scaleDownIcon = new AnimatorSet();
        scaleDownIcon.play(scaleDownX).with(scaleDownY).with(scaleDownX2).with(scaleDownY2);
        scaleDownIcon.start();

        // Set failed states
        mTvFinishedText.setText(getString(R.string.channel_open_error));
        mTvFinishedText.setTextColor(getResources().getColor(R.color.superRed));
        mTvFinishedTextDetail.setText(error);

        // Animate in
        mFinishedScreen.setAlpha(1.0f);
        AlphaAnimation animateIn = new AlphaAnimation(0f, 1.0f);
        animateIn.setDuration(300);
        animateIn.setStartOffset(300);
        animateIn.setFillAfter(true);

        mFinishedScreen.startAnimation(animateIn);

        mOkButton.setEnabled(true);
    }