Example usage for android.view.animation AlphaAnimation setAnimationListener

List of usage examples for android.view.animation AlphaAnimation setAnimationListener

Introduction

In this page you can find the example usage for android.view.animation AlphaAnimation setAnimationListener.

Prototype

public void setAnimationListener(AnimationListener listener) 

Source Link

Document

Binds an animation listener to this animation.

Usage

From source file:org.akvo.caddisfly.sensor.colorimetry.strip.camera.CameraSharedFragmentBase.java

private void hideProgressBar() {
    AlphaAnimation animation = new AlphaAnimation(1f, 0);
    animation.setDuration(PROGRESS_FADE_DURATION_MILLIS);
    animation.setAnimationListener(new Animation.AnimationListener() {
        @Override/*  w  w  w.j  ava  2 s.co m*/
        public void onAnimationStart(Animation animation) {

        }

        @Override
        public void onAnimationEnd(Animation animation) {
            clearProgress();
        }

        @Override
        public void onAnimationRepeat(Animation animation) {

        }
    });
    progressBar.startAnimation(animation);
}

From source file:com.mina.breathitout.AnalyzeActivity.java

private void moveUp() {
    AnalyzeActivity.this.runOnUiThread(new Runnable() {
        @Override/*from w  ww  . j a  va 2s  .c o  m*/
        public void run() {
            view.moveUP();
            breathOutView.setVisibility(View.VISIBLE);
            AlphaAnimation fadeIn_breathout = new AlphaAnimation(0.0f, 1.0f);
            fadeIn_breathout.setDuration(2000);
            fadeIn_breathout.setAnimationListener(new Animation.AnimationListener() {
                @Override
                public void onAnimationStart(Animation animation) {

                }

                @Override
                public void onAnimationEnd(Animation animation) {
                    AlphaAnimation fadeOut_breathout = new AlphaAnimation(1.0f, 0.0f);
                    breathOutView.startAnimation(fadeOut_breathout);
                    fadeOut_breathout.setDuration(2000);
                    breathOutView.setVisibility(View.INVISIBLE);
                }

                @Override
                public void onAnimationRepeat(Animation animation) {

                }
            });

            breathOutView.startAnimation(fadeIn_breathout);
            fadeIn_breathout.setFillAfter(true);
            animateProgressBar();
        }
    });
}

From source file:com.example.camera360.ui.ImageDetailActivity.java

private void showDetailView(final float p1, final float p2) {
    AlphaAnimation alphaAnimation = new AlphaAnimation(p1, p2);
    alphaAnimation.setDuration(DURATION_MILLIS);
    alphaAnimation.setAnimationListener(new AnimationListener() {
        @Override/*  ww w .j a  va  2 s .  co  m*/
        public void onAnimationStart(Animation animation) {
        }

        @Override
        public void onAnimationRepeat(Animation animation) {
        }

        @Override
        public void onAnimationEnd(Animation animation) {
            mImageDetailView.clearAnimation();
            if (p2 == 0) {
                mImageDetailView.setVisibility(View.INVISIBLE);
            }
            checkStatus();
        }
    });
    mImageDetailView.setAnimation(alphaAnimation);
    alphaAnimation.setFillAfter(true);
}

From source file:com.numix.calculator.EventListener.java

private void deleteAnimation(View view) {
    final TextView colorLayout = (TextView) view.getRootView().findViewById(R.id.deleteColor);
    final LinearLayout displayView = (LinearLayout) view.getRootView().findViewById(R.id.displayLayout);
    final CalculatorDisplay calculatorDisplay = (CalculatorDisplay) view.getRootView()
            .findViewById(R.id.display);

    int finalRadius = Math.max(displayView.getWidth(), displayView.getHeight());

    // create the animator for this view (the start radius is zero)
    Animator colorAnim;//from ww  w  .j a  v  a2 s. c o m
    colorAnim = ViewAnimationUtils.createCircularReveal(colorLayout, (int) displayView.getRight(),
            (int) displayView.getBottom(), 0, finalRadius);
    final AlphaAnimation fadeAnim = new AlphaAnimation(1.0f, 0.0f);
    final AlphaAnimation fadeDisplay = new AlphaAnimation(1.0f, 0.0f);
    fadeAnim.setDuration(250);
    fadeAnim.setInterpolator(new AccelerateInterpolator());
    fadeAnim.setAnimationListener(new Animation.AnimationListener() {
        @Override
        public void onAnimationStart(Animation animation) {
        }

        @Override
        public void onAnimationEnd(Animation animation) {
            colorLayout.setVisibility(View.GONE);
        }

        @Override
        public void onAnimationRepeat(Animation animation) {

        }
    });

    fadeDisplay.setDuration(250);
    fadeDisplay.setInterpolator(new AccelerateInterpolator());
    fadeDisplay.setAnimationListener(new Animation.AnimationListener() {
        @Override
        public void onAnimationStart(Animation animation) {
        }

        @Override
        public void onAnimationEnd(Animation animation) {
            mHandler.onClear();
            displayView.setAlpha(1.0f);
        }

        @Override
        public void onAnimationRepeat(Animation animation) {

        }
    });

    colorAnim.setInterpolator(new AccelerateInterpolator());
    colorAnim.addListener(new android.animation.Animator.AnimatorListener() {
        @Override
        public void onAnimationStart(android.animation.Animator animation) {
            calculatorDisplay.startAnimation(fadeDisplay);
        }

        @Override
        public void onAnimationRepeat(android.animation.Animator animation) {
        }

        @Override
        public void onAnimationEnd(android.animation.Animator animation) {
            colorLayout.startAnimation(fadeAnim);
        }

        @Override
        public void onAnimationCancel(android.animation.Animator animation) {
        }
    });

    colorLayout.setVisibility(View.VISIBLE);
    colorAnim.start();
}

From source file:git.egatuts.nxtremotecontroller.fragment.OnlineControllerFragment.java

public AlphaAnimation getHideAnimation(final View view0, final View view1, final long time) {
    AlphaAnimation hide = new AlphaAnimation(1.0f, 0.0f);
    hide.setDuration(time);/*w w  w.ja va  2  s  .  c  om*/
    hide.setAnimationListener(new Animation.AnimationListener() {
        @Override
        public void onAnimationStart(Animation animation) {
            view0.setVisibility(View.VISIBLE);
        }

        @Override
        public void onAnimationEnd(Animation animation) {
            view0.setVisibility(View.GONE);
            view1.startAnimation(getShowAnimation(view1, time));
        }

        @Override
        public void onAnimationRepeat(Animation animation) {
        }
    });
    return hide;
}

From source file:io.github.data4all.activity.CameraActivity.java

private AlphaAnimation createAnimation(final View v) {
    AlphaAnimation anim = new AlphaAnimation(1.0f, 0.0f);
    anim.setDuration(3000);/* w  w  w  . j  a  v a  2s  .  c  o m*/
    anim.setStartOffset(3000);
    anim.setAnimationListener(new Animation.AnimationListener() {
        @Override
        public void onAnimationStart(Animation animation) {
            v.setVisibility(View.VISIBLE);
        }

        @Override
        public void onAnimationEnd(Animation animation) {
            v.setVisibility(View.INVISIBLE);
            v.setClickable(false);
        }

        @Override
        public void onAnimationRepeat(Animation animation) {

        }
    });
    return anim;
}

From source file:de.gebatzens.sia.MainActivity.java

public void toggleShareToolbar(final boolean show) {
    final Toolbar shareToolbar = (Toolbar) findViewById(R.id.share_toolbar);

    AlphaAnimation anim = new AlphaAnimation(show ? 0.f : 1.f, show ? 1.f : 0.f);
    anim.setDuration(200);/*from w w  w.j  av  a 2  s  .  co  m*/

    anim.setAnimationListener(new Animation.AnimationListener() {
        @Override
        public void onAnimationStart(Animation animation) {
            if (show) {
                shareToolbar.setVisibility(View.VISIBLE);
            }
        }

        @Override
        public void onAnimationEnd(Animation animation) {
            if (!show) {
                shareToolbar.setVisibility(View.GONE);
            }
        }

        @Override
        public void onAnimationRepeat(Animation animation) {

        }
    });

    shareToolbar.startAnimation(anim);
}

From source file:git.egatuts.nxtremotecontroller.fragment.OnlineControllerFragment.java

public AlphaAnimation getShowAnimation(final View view0, final long time) {
    AlphaAnimation show = new AlphaAnimation(0.0f, 1.0f);
    show.setFillAfter(true);//  www .ja v a  2  s .  co  m
    show.setDuration(time);
    show.setAnimationListener(new Animation.AnimationListener() {
        @Override
        public void onAnimationStart(Animation animation) {
            view0.setVisibility(View.VISIBLE);
        }

        @Override
        public void onAnimationEnd(Animation animation) {
        }

        @Override
        public void onAnimationRepeat(Animation animation) {
        }
    });
    return show;
}

From source file:org.numixproject.hermes.activity.ConversationActivity.java

private void showConversationLayout() {
    // get the final radius for the clipping circle
    int finalRadius = Math.max(roomsLayout.getWidth(), roomsLayout.getHeight());
    final FrameLayout colorLayout = (FrameLayout) findViewById(R.id.colorLayout);

    if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {

        // create the animator for this view (the start radius is zero)
        Animator colorAnim;//from w w w.  j a va2s  .c om
        colorAnim = ViewAnimationUtils.createCircularReveal(colorLayout, (int) roomsLayout.getLeft(),
                (int) roomsLayout.getTop(), 0, finalRadius);
        final AlphaAnimation fadeAnim = new AlphaAnimation(1.0f, 0.0f);
        fadeAnim.setDuration(250);
        fadeAnim.setInterpolator(new AccelerateInterpolator());
        fadeAnim.setAnimationListener(new Animation.AnimationListener() {
            @Override
            public void onAnimationStart(Animation animation) {
                conversationLayout.setVisibility(View.VISIBLE);
            }

            @Override
            public void onAnimationEnd(Animation animation) {
                colorLayout.setVisibility(View.GONE);
                invalidateOptionsMenu();
            }

            @Override
            public void onAnimationRepeat(Animation animation) {

            }
        });

        colorAnim.setInterpolator(new AccelerateInterpolator());
        colorAnim.addListener(new android.animation.Animator.AnimatorListener() {
            @Override
            public void onAnimationStart(android.animation.Animator animation) {
            }

            @Override
            public void onAnimationRepeat(android.animation.Animator animation) {
            }

            @Override
            public void onAnimationEnd(android.animation.Animator animation) {
                colorLayout.startAnimation(fadeAnim);
            }

            @Override
            public void onAnimationCancel(android.animation.Animator animation) {
            }
        });

        colorLayout.setVisibility(View.VISIBLE);
        colorAnim.start();

    } else {
        conversationLayout.setVisibility(View.VISIBLE);
        conversationLayout.setAlpha(0.f);
        conversationLayout.setScaleX(0.f);
        conversationLayout.setScaleY(0.f);
        conversationLayout.animate().alpha(1.f).scaleX(1.f).scaleY(1.f).setDuration(300).start();
    }
}

From source file:com.popdeem.sdk.uikit.activity.PDUIClaimActivity.java

@Override
public void onBackPressed() {
    if (!claiming) {
        if (verifyView.getVisibility() == View.VISIBLE) {
            AlphaAnimation animation = new AlphaAnimation(1f, 0.0f);
            animation.setDuration(250);//from   w w  w. jav  a  2s . com
            animation.setAnimationListener(new Animation.AnimationListener() {
                @Override
                public void onAnimationStart(Animation animation) {
                    verifyView.setVisibility(View.GONE);
                    pdVerifyHeadingText.setVisibility(View.GONE);
                    pdVerifyImageCard.setVisibility(View.GONE);
                    pdProceedButton.setVisibility(View.GONE);
                    pdBackButton.setVisibility(View.GONE);
                }

                @Override
                public void onAnimationEnd(Animation animation) {
                }

                @Override
                public void onAnimationRepeat(Animation animation) {
                }
            });
            verifyView.startAnimation(animation);
        } else {
            super.onBackPressed();
        }
    }
}