Java Examples for android.animation.AnimatorListenerAdapter

The following java examples will help you to understand the usage of android.animation.AnimatorListenerAdapter. These source code samples are taken from different open source projects.

Example 1
Project: Android-UndoBar-master  File: ViewCompatImpl.java View source code
@Override
void animateOut(long duration, final AnimatorListener animatorListener) {
    mViewPropertyAnimator.cancel();
    //
    mViewPropertyAnimator.alpha(0).setDuration(//
    duration).setListener(new AnimatorListenerAdapter() {

        @Override
        public void onAnimationEnd(Animator animation) {
            animatorListener.onAnimationEnd();
        }
    });
}
Example 2
Project: BlurKit-Android-master  File: MainActivity.java View source code
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_main);
    blurLayout = (BlurLayout) findViewById(R.id.blurLayout);
    blurLayout.animate().translationY(movement).setDuration(1500).setListener(new AnimatorListenerAdapter() {

        @Override
        public void onAnimationEnd(Animator animation) {
            super.onAnimationEnd(animation);
            movement = movement > 0 ? -150 : 150;
            blurLayout.animate().translationY(movement).setDuration(1500).setListener(this).start();
        }
    }).start();
}
Example 3
Project: FrescoImageViewer-master  File: AnimationUtils.java View source code
static void animateVisibility(final View view) {
    final boolean isVisible = view.getVisibility() == View.VISIBLE;
    float from = isVisible ? 1.0f : 0.0f, to = isVisible ? 0.0f : 1.0f;
    ObjectAnimator animation = ObjectAnimator.ofFloat(view, "alpha", from, to);
    animation.setDuration(ViewConfiguration.getDoubleTapTimeout());
    if (isVisible) {
        animation.addListener(new AnimatorListenerAdapter() {

            @Override
            public void onAnimationEnd(Animator animation) {
                view.setVisibility(View.GONE);
            }
        });
    } else
        view.setVisibility(View.VISIBLE);
    animation.start();
}
Example 4
Project: GaussianBlur-master  File: Animate.java View source code
private AnimatorListenerAdapter getAnimatorListenerAdapter() {
    if (isVisible()) {
        return new AnimatorListenerAdapter() {

            @Override
            public void onAnimationEnd(Animator animator) {
                view.setVisibility(View.INVISIBLE);
            }
        };
    } else {
        return new AnimatorListenerAdapter() {

            @Override
            public void onAnimationStart(Animator animator) {
                view.setVisibility(View.VISIBLE);
            }
        };
    }
}
Example 5
Project: magellan-master  File: CircularRevealTransition.java View source code
@Override
public void animate(View from, View to, NavigationType navType, Direction direction, final Callback callback) {
    int[] clickedViewCenter = getCenterClickedView((ViewGroup) from);
    int circularRevealCenterX = clickedViewCenter[0];
    int circularRevealCenterY = clickedViewCenter[1];
    float finalRadius = (float) Math.hypot(to.getWidth(), to.getHeight());
    if (android.os.Build.VERSION.SDK_INT >= android.os.Build.VERSION_CODES.LOLLIPOP) {
        Animator anim = ViewAnimationUtils.createCircularReveal(to, circularRevealCenterX, circularRevealCenterY, 0, finalRadius);
        anim.addListener(new AnimatorListenerAdapter() {

            @Override
            public void onAnimationEnd(Animator animation) {
                callback.onAnimationEnd();
            }
        });
        anim.start();
    } else {
        callback.onAnimationEnd();
    }
}
Example 6
Project: scoop-master  File: FadeTransition.java View source code
@Override
public void performTranslate(final ViewGroup root, final View from, View to, final TransitionListener transitionListener) {
    Animator animator = createAnimator(from, to);
    animator.addListener(new AnimatorListenerAdapter() {

        @Override
        public void onAnimationEnd(Animator animation) {
            root.removeView(from);
            transitionListener.onTransitionCompleted();
        }
    });
    animator.start();
}
Example 7
Project: Android-Studio-Project-master  File: PActivity.java View source code
@Override
public void onBackPressed() {
    ObjectAnimator animator = ObjectAnimator.ofFloat(mTestImage, "scaleY", 2.0f, 1.0f);
    ObjectAnimator animator1 = ObjectAnimator.ofFloat(mTestImage, "x", x);
    animator.setDuration(500);
    AnimatorSet set = new AnimatorSet();
    set.playSequentially(animator1, animator);
    set.start();
    set.addListener(new AnimatorListenerAdapter() {

        @Override
        public void onAnimationEnd(Animator animation) {
            super.onAnimationEnd(animation);
            finish();
        }
    });
}
Example 8
Project: AndroidSkinAnimator-master  File: SkinRotateHintAnimator.java View source code
@Override
public SkinAnimator apply(@NonNull View view, @Nullable final Action action) {
    this.targetView = view;
    int middle = 30;
    int range = 15;
    targetView.setPivotX(targetView.getLeft());
    targetView.setPivotY(targetView.getTop());
    preAnimator = ObjectAnimator.ofPropertyValuesHolder(targetView, PropertyValuesHolder.ofFloat("rotation", 0, middle - range, middle + range, middle - range, middle + range, middle - range, middle + range)).setDuration(PRE_DURATION * 8);
    preAnimator.setInterpolator(new LinearInterpolator());
    preAnimator.addListener(new AnimatorListenerAdapter() {

        @Override
        public void onAnimationEnd(Animator animation) {
            super.onAnimationEnd(animation);
            middleAnimator.start();
        }
    });
    middleAnimator = ObjectAnimator.ofPropertyValuesHolder(targetView, PropertyValuesHolder.ofFloat("TranslationY", targetView.getTop(), targetView.getBottom()), PropertyValuesHolder.ofFloat("alpha", 1, 0)).setDuration(PRE_DURATION * 2);
    middleAnimator.setInterpolator(new AccelerateInterpolator());
    middleAnimator.addListener(new AnimatorListenerAdapter() {

        @Override
        public void onAnimationEnd(Animator animation) {
            super.onAnimationEnd(animation);
            if (action != null) {
                action.action();
            }
            afterAnimator.start();
        }
    });
    afterAnimator = ObjectAnimator.ofPropertyValuesHolder(targetView, PropertyValuesHolder.ofFloat("rotation", 0, 0), PropertyValuesHolder.ofFloat("alpha", 1, 1), //                        targetView.getLeft() - targetView.getWidth(), targetView.getLeft()),
    PropertyValuesHolder.ofFloat("translationY", targetView.getTop() - targetView.getHeight(), targetView.getTop())).setDuration(AFTER_DURATION * 2);
    afterAnimator.setInterpolator(new LinearInterpolator());
    afterAnimator.addListener(new AnimatorListenerAdapter() {

        @Override
        public void onAnimationEnd(Animator animation) {
            super.onAnimationEnd(animation);
            targetView.setPivotX(targetView.getWidth() / 2);
            targetView.setPivotY(targetView.getHeight() / 2);
        }
    });
    return this;
}
Example 9
Project: BetaSeries-master  File: EpisodedetailFragment.java View source code
@Override
public void onViewCreated(View view, @Nullable Bundle savedInstanceState) {
    super.onViewCreated(view, savedInstanceState);
    ButterKnife.bind(this, view);
    if (episode.getYoutubeId() == null)
        play.setVisibility(View.GONE);
    carpaccio.mapObject("show", show);
    carpaccio.mapObject("episode", episode);
    carpaccio.mapObject("user", userManager.getUser());
    ratingUserStar.setOnRatingBarChangeListener(( ratingBar,  rating,  fromUser) -> {
        if (fromUser) {
            betaSeriesAPI.episodeMarquerVu(episode.getId()).subscribeOn(Schedulers.io()).observeOn(Schedulers.io()).onErrorReturn(null).subscribe( vu -> {
                betaSeriesAPI.episodeNoter(episode.getId(), episode.getNoteUser()).subscribeOn(Schedulers.io()).observeOn(AndroidSchedulers.mainThread()).onErrorReturn(null).subscribe( o2 -> ratingUserStar.animate().alpha(0).setDuration(600).setListener(new AnimatorListenerAdapter() {

                    @Override
                    public void onAnimationEnd(Animator animation) {
                        ratingUserStar.setVisibility(View.GONE);
                    }
                }).start());
            });
        }
    });
}
Example 10
Project: Carbon-master  File: SeekBarPopup.java View source code
@Override
public void dismiss() {
    bubble.animateVisibility(View.INVISIBLE);
    Animator animator = bubble.getAnimator();
    if (animator != null) {
        animator.addListener(new AnimatorListenerAdapter() {

            @Override
            public void onAnimationEnd(Animator animation) {
                SeekBarPopup.super.dismiss();
            }
        });
    }
}
Example 11
Project: codereview.chromium-master  File: ViewUtils.java View source code
public static void onAnimationEnd(ViewPropertyAnimator viewPropertyAnimator, final Runnable onEnd) {
    if (Build.VERSION.SDK_INT < Build.VERSION_CODES.JELLY_BEAN) {
        viewPropertyAnimator.setListener(new AnimatorListenerAdapter() {

            @Override
            public void onAnimationEnd(Animator animation) {
                onEnd.run();
            }
        });
    } else {
        viewPropertyAnimator.withEndAction(onEnd);
    }
}
Example 12
Project: ExpectAnim-master  File: ExpectAnimAlphaManager.java View source code
@Override
public List<Animator> getAnimators() {
    final List<Animator> animations = new ArrayList<>();
    calculate();
    if (alpha != null) {
        final ObjectAnimator objectAnimator = ObjectAnimator.ofFloat(viewToMove, View.ALPHA, alpha);
        if (alpha == 0) {
            objectAnimator.addListener(new AnimatorListenerAdapter() {

                @Override
                public void onAnimationEnd(Animator animation) {
                    viewToMove.setVisibility(View.INVISIBLE);
                }
            });
        } else {
            objectAnimator.addListener(new AnimatorListenerAdapter() {

                @Override
                public void onAnimationStart(Animator animation) {
                    viewToMove.setVisibility(View.VISIBLE);
                }
            });
        }
        animations.add(objectAnimator);
    }
    return animations;
}
Example 13
Project: GanHuoIO-master  File: SplashActivity.java View source code
@Override
protected void setUpView() {
    ObjectAnimator rotate = ObjectAnimator.ofFloat($(R.id.iv_logo), "rotationY", 180, 360);
    AnimatorSet animatorSet = new AnimatorSet();
    animatorSet.playSequentially(rotate);
    animatorSet.setDuration(2000);
    animatorSet.start();
    animatorSet.addListener(new AnimatorListenerAdapter() {

        @Override
        public void onAnimationEnd(Animator animation) {
            startActivity(new Intent(SplashActivity.this, MainActivity.class));
            finish();
        }
    });
}
Example 14
Project: GitClub-master  File: FabAnimationHelper.java View source code
public static void hide(View view, AnimatorListenerAdapter listener) {
    if (view != null) {
        int screenHeight = Utils.getScreenHeight();
        int top = view.getTop();
        int distanceToHide = screenHeight - top;
        view.animate().translationY(distanceToHide).setInterpolator(new AccelerateInterpolator(2)).setListener(listener).start();
    }
}
Example 15
Project: GlassTunes-master  File: ConfirmationActivity.java View source code
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_confirm);
    ((TextView) findViewById(R.id.text)).setText(getIntent().getStringExtra(EXTRA_TEXT));
    ObjectAnimator animator = ObjectAnimator.ofInt(((ProgressBar) findViewById(R.id.progress)), "progress", 100).setDuration(1000);
    animator.addListener(new AnimatorListenerAdapter() {

        @Override
        public void onAnimationEnd(Animator animation) {
            try {
                if (getIntent().hasExtra(EXTRA_FOLLOW_ON_INTENT)) {
                    ((PendingIntent) getIntent().getParcelableExtra(EXTRA_FOLLOW_ON_INTENT)).send();
                }
            } catch (CanceledException e) {
                e.printStackTrace();
            }
            finish();
        }
    });
    animator.start();
}
Example 16
Project: huabanDemo-master  File: AnimatorOnSubscribe.java View source code
@Override
public void call(final Subscriber<? super Void> subscriber) {
    checkUiThread();
    AnimatorListenerAdapter adapter = new AnimatorListenerAdapter() {

        @Override
        public void onAnimationStart(Animator animation) {
            super.onAnimationStart(animation);
            subscriber.onNext(null);
            Logger.d("onAnimationStart");
        }

        @Override
        public void onAnimationEnd(Animator animation) {
            super.onAnimationEnd(animation);
            subscriber.onCompleted();
            Logger.d("onAnimationEnd");
        }
    };
    animator.addListener(adapter);
    //先绑定监�器�开始
    animator.start();
//        subscriber.add(new MainThreadSubscription() {
//            @Override protected void onUnsubscribe() {
//               animator.removeAllListeners();
//            }
//        });
}
Example 17
Project: LiquidButton-master  File: BaseController.java View source code
Animator getBaseAnimator(long duration, TimeInterpolator interpolator) {
    ObjectAnimator animator = ObjectAnimator.ofFloat(this, "render", 0.0f, 1.0f);
    animator.setDuration(duration);
    animator.setInterpolator(interpolator);
    animator.addListener(new AnimatorListenerAdapter() {

        @Override
        public void onAnimationStart(Animator animation) {
            super.onAnimationStart(animation);
            reset();
        }
    });
    return animator;
}
Example 18
Project: Mortar-architect-master  File: SubnavView.java View source code
@Override
public void onViewTransition(AnimatorSet set) {
    if (set != null) {
        set.addListener(new AnimatorListenerAdapter() {

            @Override
            public void onAnimationEnd(Animator animation) {
                toolbarOwner.setTitle("Subnav presenter!");
            }
        });
    } else {
        toolbarOwner.setTitle("Subnav presenter!");
    }
}
Example 19
Project: RxAnimations-master  File: RxValueAnimator.java View source code
@Override
public void call(final CompletableSubscriber completableSubscriber) {
    completableSubscriber.onSubscribe(new ClearSubscription(valueAnimator::end));
    valueAnimator.addUpdateListener(valueUpdateAction::call);
    valueAnimator.start();
    valueAnimator.addListener(new AnimatorListenerAdapter() {

        @Override
        public void onAnimationCancel(final Animator animation) {
            animationCancelAction.call(valueAnimator);
        }

        @Override
        public void onAnimationEnd(final Animator animation) {
            valueAnimator.removeAllListeners();
            completableSubscriber.onCompleted();
        }
    });
}
Example 20
Project: shuttle-master  File: ViewUtils.java View source code
public static void fadeOut(View view, @Nullable Action0 completion) {
    ObjectAnimator objectAnimator = ObjectAnimator.ofFloat(view, View.ALPHA, 1f, 0f).setDuration(250);
    objectAnimator.addListener(new AnimatorListenerAdapter() {

        @Override
        public void onAnimationEnd(Animator animation) {
            view.setVisibility(View.GONE);
            objectAnimator.removeAllListeners();
            if (completion != null) {
                completion.call();
            }
        }
    });
    objectAnimator.start();
}
Example 21
Project: superlightstack-master  File: AnimationHandler.java View source code
private static void doCrossFade(final View from, final View to, final ViewGroup container, int duration) {
    if (from != null) {
        from.animate().alpha(0f).setDuration(duration);
        to.setAlpha(0f);
        to.setVisibility(View.VISIBLE);
        container.addView(to);
    }
    if (to != null) {
        to.animate().alpha(1f).setDuration(duration).setListener(new AnimatorListenerAdapter() {

            @Override
            public void onAnimationEnd(Animator animation) {
                super.onAnimationEnd(animation);
                container.removeView(from);
            }
        });
    }
}
Example 22
Project: TryPro-master  File: WelActivity.java View source code
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.wel_act);
    ButterKnife.inject(this);
    ObjectAnimator animator = new ObjectAnimator().ofFloat(welImg, "scaleY", 1f, 2f);
    ObjectAnimator animator1 = new ObjectAnimator().ofFloat(welImg, "scaleX", 1f, 2f);
    ObjectAnimator animator2 = new ObjectAnimator().ofFloat(welImg, "alpha", 1f, 0f);
    AnimatorSet set = new AnimatorSet();
    set.playTogether(animator, animator1, animator2);
    set.setDuration(5000);
    set.start();
    set.addListener(new AnimatorListenerAdapter() {

        @Override
        public void onAnimationEnd(Animator animation) {
            super.onAnimationEnd(animation);
            finish();
        }
    });
}
Example 23
Project: XDroidAnimation-master  File: CombinationAnimation.java View source code
@Override
public AnimatorSet createAnimatorSet() {
    ArrayList<Animator> animatorList = new ArrayList<Animator>();
    for (int i = 0; i < combinableList.size(); i++) {
        if (duration > 0) {
            combinableList.get(i).setDuration(duration);
        }
        animatorList.add(combinableList.get(i).createAnimatorSet());
    }
    AnimatorSet parallelSet = new AnimatorSet();
    parallelSet.playTogether(animatorList);
    if (interpolator != null) {
        parallelSet.setInterpolator(interpolator);
    }
    parallelSet.addListener(new AnimatorListenerAdapter() {

        @Override
        public void onAnimationEnd(Animator animation) {
            if (listener != null) {
                listener.onAnimationEnd(animation);
            }
        }
    });
    return parallelSet;
}
Example 24
Project: Zen-master  File: ClearView.java View source code
public void startClearWith(final Animator.AnimatorListener animatorListener) {
    clearDrawable.startRadiusAnimation(new Animator.AnimatorListener() {

        @Override
        public void onAnimationStart(Animator animation) {
            show();
            animatorListener.onAnimationStart(animation);
        }

        @Override
        public void onAnimationEnd(Animator animation) {
            animatorListener.onAnimationEnd(animation);
            clearDrawable.startAlphaAnimation(new AnimatorListenerAdapter() {

                @Override
                public void onAnimationEnd(Animator animation) {
                    hide();
                }
            });
        }

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

        @Override
        public void onAnimationRepeat(Animator animation) {
            animatorListener.onAnimationRepeat(animation);
        }
    });
}
Example 25
Project: 51daifan-android-master  File: Utils.java View source code
/**
     * Shows the progress UI and hides the login form.
     */
@SuppressWarnings("ConstantConditions")
@TargetApi(Build.VERSION_CODES.HONEYCOMB_MR2)
public static void swithLoadingView(final boolean on, final View loadingView, final View normalView, int animTime) {
    // the progress spinner.
    if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.HONEYCOMB_MR2) {
        loadingView.setVisibility(View.VISIBLE);
        loadingView.animate().setDuration(animTime).alpha(on ? 1 : 0).setListener(new AnimatorListenerAdapter() {

            @Override
            public void onAnimationEnd(Animator animation) {
                loadingView.setVisibility(on ? View.VISIBLE : View.GONE);
            }
        });
        normalView.setVisibility(View.VISIBLE);
        normalView.animate().setDuration(animTime).alpha(on ? 0 : 1).setListener(new AnimatorListenerAdapter() {

            @Override
            public void onAnimationEnd(Animator animation) {
                normalView.setVisibility(on ? View.GONE : View.VISIBLE);
            }
        });
    } else {
        // The ViewPropertyAnimator APIs are not available, so simply show
        // and hide the relevant UI components.
        loadingView.setVisibility(on ? View.VISIBLE : View.GONE);
        normalView.setVisibility(on ? View.GONE : View.VISIBLE);
    }
}
Example 26
Project: AisenWeiBo-master  File: OverlayAnimation.java View source code
/**
	 * Shows the overlay.
	 * 
	 * @param duration Duration of the animation in milliseconds. Use 0 for no animation.
	 * @param listener Listener for animation events.
	 */
public void show(long duration, final AnimationListener listener) {
    overlay.animate().alpha(1).setDuration(duration).setInterpolator(interpolator).setListener(new AnimatorListenerAdapter() {

        @Override
        public void onAnimationStart(Animator animation) {
            overlay.setVisibility(View.VISIBLE);
            if (listener != null) {
                listener.onStart();
            }
        }

        @Override
        public void onAnimationEnd(Animator animation) {
            if (listener != null) {
                listener.onEnd();
            }
        }
    }).start();
}
Example 27
Project: Android-Demo-Projects-master  File: CircularRevealActivity.java View source code
private void hideImageCircular() {
    int x = getX();
    int y = getY();
    int radius = getRadius();
    ValueAnimator anim = ViewAnimationUtils.createCircularReveal(mImageView, x, y, radius, 0);
    anim.addListener(new AnimatorListenerAdapter() {

        @Override
        public void onAnimationEnd(Animator animation) {
            super.onAnimationEnd(animation);
            mImageView.setVisibility(View.INVISIBLE);
        }
    });
    anim.start();
}
Example 28
Project: android-demos-master  File: VisibilityController.java View source code
boolean setVisible(final boolean visible, boolean animated) {
    if (isVisible() == visible) {
        return false;
    }
    mVisible = visible;
    if (animated) {
        float toAlpha = visible ? 1.0f : 0.0f;
        ObjectAnimator mAnimator = ObjectAnimator.ofFloat(mView, "Alpha", 1 - toAlpha, toAlpha);
        mAnimator.setDuration(mAnimationDuration).addListener(new AnimatorListenerAdapter() {

            @Override
            public void onAnimationStart(Animator animator) {
                if (visible) {
                    setViewVisible(true);
                }
            }

            @Override
            public void onAnimationEnd(Animator animator) {
                if (!visible) {
                    setViewVisible(false);
                }
            }
        });
        mAnimator.start();
    } else {
        setViewVisible(visible);
    }
    return true;
}
Example 29
Project: android-sdk-sources-for-api-level-23-master  File: ValueAnimatorCompatImplHoneycombMr1.java View source code
@Override
public void setListener(final AnimatorListenerProxy listener) {
    mValueAnimator.addListener(new AnimatorListenerAdapter() {

        @Override
        public void onAnimationStart(Animator animator) {
            listener.onAnimationStart();
        }

        @Override
        public void onAnimationEnd(Animator animator) {
            listener.onAnimationEnd();
        }

        @Override
        public void onAnimationCancel(Animator animator) {
            listener.onAnimationCancel();
        }
    });
}
Example 30
Project: android-support-v4-master  File: ViewPropertyAnimatorCompatJB.java View source code
public static void setListener(final View view, final ViewPropertyAnimatorListener listener) {
    if (listener != null) {
        view.animate().setListener(new AnimatorListenerAdapter() {

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

            @Override
            public void onAnimationEnd(Animator animation) {
                listener.onAnimationEnd(view);
            }

            @Override
            public void onAnimationStart(Animator animation) {
                listener.onAnimationStart(view);
            }
        });
    } else {
        view.animate().setListener(null);
    }
}
Example 31
Project: AndroidDemoProjects-master  File: CircularRevealActivity.java View source code
private void hideImageCircular() {
    int x = getX();
    int y = getY();
    int radius = getRadius();
    ValueAnimator anim = ViewAnimationUtils.createCircularReveal(mImageView, x, y, radius, 0);
    anim.addListener(new AnimatorListenerAdapter() {

        @Override
        public void onAnimationEnd(Animator animation) {
            super.onAnimationEnd(animation);
            mImageView.setVisibility(View.INVISIBLE);
        }
    });
    anim.start();
}
Example 32
Project: AndroidHeroes-master  File: RecyclerTest.java View source code
@Override
public void onItemClick(final View view, int position) {
    // 设置点击动画
    view.animate().translationZ(15F).setDuration(300).setListener(new AnimatorListenerAdapter() {

        @Override
        public void onAnimationEnd(Animator animation) {
            super.onAnimationEnd(animation);
            view.animate().translationZ(1f).setDuration(500).start();
        }
    }).start();
}
Example 33
Project: AndroidPullToPong-master  File: PongHeaderTransformer.java View source code
@Override
public boolean hideHeaderView() {
    final boolean changeVis = mHeaderView.getVisibility() == View.VISIBLE;
    if (changeVis) {
        Animator animator = ObjectAnimator.ofFloat(mHeaderView, "alpha", 1f, 0f);
        animator.addListener(new AnimatorListenerAdapter() {

            @Override
            public void onAnimationEnd(Animator animation) {
                mHeaderView.setVisibility(View.GONE);
                mPongPlayer.stopPlaying();
            }
        });
        animator.setDuration(FADE_IN_OUT_DURATION).start();
    }
    return changeVis;
}
Example 34
Project: android_packages_apps_Trebuchet-master  File: UiThreadCircularReveal.java View source code
public static ValueAnimator createCircularReveal(View v, int x, int y, float r0, float r1, final ViewOutlineProvider originalProvider) {
    ValueAnimator va = ValueAnimator.ofFloat(0f, 1f);
    final View revealView = v;
    final RevealOutlineProvider outlineProvider = new RevealOutlineProvider(x, y, r0, r1);
    final float elevation = v.getElevation();
    va.addListener(new AnimatorListenerAdapter() {

        public void onAnimationStart(Animator animation) {
            revealView.setOutlineProvider(outlineProvider);
            revealView.setClipToOutline(true);
            revealView.setTranslationZ(-elevation);
        }

        public void onAnimationEnd(Animator animation) {
            revealView.setOutlineProvider(originalProvider);
            revealView.setClipToOutline(false);
            revealView.setTranslationZ(0);
        }
    });
    va.addUpdateListener(new AnimatorUpdateListener() {

        @Override
        public void onAnimationUpdate(ValueAnimator arg0) {
            float progress = arg0.getAnimatedFraction();
            outlineProvider.setProgress(progress);
            revealView.invalidateOutline();
            if (!Utilities.ATLEAST_LOLLIPOP_MR1) {
                revealView.invalidate();
            }
        }
    });
    return va;
}
Example 35
Project: CameraKit-Android-master  File: FocusMarkerLayout.java View source code
public void focus(float mx, float my) {
    int x = (int) (mx - mFocusMarkerContainer.getWidth() / 2);
    int y = (int) (my - mFocusMarkerContainer.getWidth() / 2);
    mFocusMarkerContainer.setTranslationX(x);
    mFocusMarkerContainer.setTranslationY(y);
    mFocusMarkerContainer.animate().setListener(null).cancel();
    mFill.animate().setListener(null).cancel();
    mFill.setScaleX(0);
    mFill.setScaleY(0);
    mFill.setAlpha(1f);
    mFocusMarkerContainer.setScaleX(1.36f);
    mFocusMarkerContainer.setScaleY(1.36f);
    mFocusMarkerContainer.setAlpha(1f);
    mFocusMarkerContainer.animate().scaleX(1).scaleY(1).setStartDelay(0).setDuration(330).setListener(new AnimatorListenerAdapter() {

        @Override
        public void onAnimationEnd(Animator animation) {
            super.onAnimationEnd(animation);
            mFocusMarkerContainer.animate().alpha(0).setStartDelay(750).setDuration(800).setListener(null).start();
        }
    }).start();
    mFill.animate().scaleX(1).scaleY(1).setDuration(330).setListener(new AnimatorListenerAdapter() {

        @Override
        public void onAnimationEnd(Animator animation) {
            super.onAnimationEnd(animation);
            mFill.animate().alpha(0).setDuration(800).setListener(null).start();
        }
    }).start();
}
Example 36
Project: cardslib-eclipse-master  File: SwipeDismissAnimation.java View source code
@Override
public void animate(final Card card, final CardView cardView) {
    cardView.animate().translationX(mDismissRight ? mListWidth : -mListWidth).alpha(0).setDuration(mAnimationTime).setListener(new AnimatorListenerAdapter() {

        @Override
        public void onAnimationEnd(Animator animation) {
            invokeCallbak(cardView);
        }
    });
}
Example 37
Project: cardslib-master  File: SwipeDismissAnimation.java View source code
@Override
public void animate(final Card card, final CardViewWrapper cardView) {
    ((View) cardView).animate().translationX(mDismissRight ? mListWidth : -mListWidth).alpha(0).setDuration(mAnimationTime).setListener(new AnimatorListenerAdapter() {

        @Override
        public void onAnimationEnd(Animator animation) {
            invokeCallbak((View) cardView);
        }
    });
}
Example 38
Project: cogitolearning-examples-master  File: PropertyAnimation09.java View source code
@Override
@SuppressLint("NewApi")
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.property_animations09);
    if (android.os.Build.VERSION.SDK_INT >= 19) {
        ImageView someImage = (ImageView) findViewById(R.id.some_image);
        ObjectAnimator rotateAnim = ObjectAnimator.ofFloat(someImage, "rotation", 0, 360);
        rotateAnim.setDuration(1000);
        rotateAnim.setRepeatCount(5);
        rotateAnim.setRepeatMode(ObjectAnimator.RESTART);
        fpsText = (TextView) findViewById(R.id.fps_text);
        FpsTimeListener listener = new FpsTimeListener(fpsText);
        final TimeAnimator timeAnim = new TimeAnimator();
        timeAnim.setTimeListener(listener);
        anim = new AnimatorSet();
        anim.play(rotateAnim).with(timeAnim);
        rotateAnim.addListener(new AnimatorListenerAdapter() {

            @Override
            public void onAnimationEnd(Animator animation) {
                timeAnim.end();
            }
        });
    }
}
Example 39
Project: CookMan-master  File: RippleView.java View source code
public void startReveal() {
    setVisibility(VISIBLE);
    if (va == null) {
        int bigRadius = (int) (Math.sqrt(Math.pow(getHeight(), 2) + Math.pow(getWidth(), 2)));
        va = ValueAnimator.ofInt(0, bigRadius / 2);
        va.setDuration(bigRadius);
        va.addUpdateListener(new ValueAnimator.AnimatorUpdateListener() {

            @Override
            public void onAnimationUpdate(ValueAnimator animation) {
                r = (int) animation.getAnimatedValue() * 2;
                invalidate();
            }
        });
        va.addListener(new AnimatorListenerAdapter() {

            @Override
            public void onAnimationEnd(Animator animation) {
                if (listener != null) {
                    listener.onRippleEnd();
                }
            }
        });
    }
    va.start();
}
Example 40
Project: CoolAndroidAnim-master  File: ILetter.java View source code
@Override
public void startAnim() {
    ValueAnimator animator = ValueAnimator.ofInt(0, mDuration1 + mDuration2);
    animator.setDuration(mDuration1 + mDuration2);
    animator.addUpdateListener(new ValueAnimator.AnimatorUpdateListener() {

        @Override
        public void onAnimationUpdate(ValueAnimator animation) {
            if (!isStart) {
                return;
            }
            mCurValue = (int) animation.getAnimatedValue();
            if (mCurValue <= mDuration1) {
                mLength1 = LENGTH * mCurValue / mDuration1;
            } else {
                mCurValue -= mDuration1;
                mRadius = 12 * mCurValue / 500;
                mLength2 = 30 * mCurValue / 500;
            }
        }
    });
    animator.addListener(new AnimatorListenerAdapter() {

        @Override
        public void onAnimationStart(Animator animation) {
            isStart = true;
            mRadius = 0;
        }
    });
    animator.start();
}
Example 41
Project: CUT-IN-material-master  File: AnimatorCutin.java View source code
@SuppressLint("NewApi")
@Override
protected void start(Intent arg0, int arg1, int arg2) {
    // in
    ValueAnimator rotateIn = ObjectAnimator.ofFloat(mView, ImageView.ROTATION, 360f);
    rotateIn.setDuration(1000);
    DecelerateInterpolator di = new DecelerateInterpolator();
    ValueAnimator scaleAnimX = ObjectAnimator.ofFloat(mView, ImageView.SCALE_X, 1.5f);
    scaleAnimX.setDuration(1000);
    scaleAnimX.setInterpolator(di);
    ValueAnimator scaleAnimY = ObjectAnimator.ofFloat(mView, ImageView.SCALE_Y, 1.5f);
    scaleAnimY.setDuration(1000);
    scaleAnimY.setInterpolator(di);
    // out
    ValueAnimator rotateOut = ObjectAnimator.ofFloat(mView, ImageView.ROTATION, 0f);
    rotateOut.setDuration(1000);
    ValueAnimator fadeOut = ObjectAnimator.ofFloat(mView, ImageView.ALPHA, 0.0f);
    fadeOut.setDuration(1000);
    AnimatorSet tornado = new AnimatorSet();
    tornado.play(rotateIn).with(scaleAnimX);
    tornado.play(scaleAnimX).with(scaleAnimY);
    tornado.play(rotateOut).after(scaleAnimX);
    tornado.play(rotateOut).with(fadeOut);
    tornado.addListener(new AnimatorListenerAdapter() {

        @Override
        public void onAnimationEnd(Animator animation) {
            finishCutin();
        }
    });
    tornado.start();
}
Example 42
Project: DesignSupportLibraryDemo-master  File: RecyclerViewAdapter.java View source code
@Override
public void onClick(View v) {
    ObjectAnimator animator = ObjectAnimator.ofFloat(view, "translationZ", 20, 0);
    animator.addListener(new AnimatorListenerAdapter() {

        @Override
        public void onAnimationEnd(Animator animation) {
            mContext.startActivity(new Intent(mContext, DetailActivity.class));
        }
    });
    animator.start();
}
Example 43
Project: EverExample-master  File: TextFragment.java View source code
@Override
public Animator onCreateAnimator(int transit, boolean enter, int nextAnim) {
    int id = enter ? R.animator.slide_fragment_in : R.animator.slide_fragment_out;
    final Animator anim = AnimatorInflater.loadAnimator(getActivity(), id);
    if (enter) {
        anim.addListener(new AnimatorListenerAdapter() {

            @Override
            public void onAnimationEnd(Animator animation) {
                mListener.onAnimationEnd();
            }
        });
    }
    return anim;
}
Example 44
Project: farmers-market-finder-master  File: ViewUtils.java View source code
public static void crossfadeTwoViews(final View inView, final View outView, int duration) {
    inView.setAlpha(0f);
    inView.setVisibility(View.VISIBLE);
    inView.animate().alpha(1f).setDuration(duration).setListener(null);
    outView.animate().alpha(0f).setDuration(duration).setListener(new AnimatorListenerAdapter() {

        @Override
        public void onAnimationEnd(Animator animation) {
            outView.setVisibility(View.GONE);
        }
    });
}
Example 45
Project: FlickLauncher-master  File: RevealOutlineAnimation.java View source code
public ValueAnimator createRevealAnimator(final View revealView, boolean isReversed) {
    ValueAnimator va = isReversed ? ValueAnimator.ofFloat(1f, 0f) : ValueAnimator.ofFloat(0f, 1f);
    final float elevation = revealView.getElevation();
    va.addListener(new AnimatorListenerAdapter() {

        private boolean mWasCanceled = false;

        public void onAnimationStart(Animator animation) {
            revealView.setOutlineProvider(RevealOutlineAnimation.this);
            revealView.setClipToOutline(true);
            if (shouldRemoveElevationDuringAnimation()) {
                revealView.setTranslationZ(-elevation);
            }
        }

        @Override
        public void onAnimationCancel(Animator animation) {
            mWasCanceled = true;
        }

        public void onAnimationEnd(Animator animation) {
            if (!mWasCanceled) {
                revealView.setOutlineProvider(ViewOutlineProvider.BACKGROUND);
                revealView.setClipToOutline(false);
                if (shouldRemoveElevationDuringAnimation()) {
                    revealView.setTranslationZ(0);
                }
            }
        }
    });
    va.addUpdateListener(new ValueAnimator.AnimatorUpdateListener() {

        @Override
        public void onAnimationUpdate(ValueAnimator arg0) {
            float progress = (Float) arg0.getAnimatedValue();
            setProgress(progress);
            revealView.invalidateOutline();
            if (!Utilities.ATLEAST_LOLLIPOP_MR1) {
                revealView.invalidate();
            }
        }
    });
    return va;
}
Example 46
Project: FloatingText-master  File: TranslateFloatingAnimator.java View source code
@Override
public void applyFloatingAnimation(final FloatingTextView view) {
    view.setTranslationY(0);
    view.setAlpha(1f);
    view.setScaleX(0f);
    view.setScaleY(0f);
    Spring scaleAnim = createSpringByBouncinessAndSpeed(10, 15).addListener(new SimpleSpringListener() {

        @Override
        public void onSpringUpdate(Spring spring) {
            float transition = transition((float) spring.getCurrentValue(), 0.0f, 1.0f);
            view.setScaleX(transition);
            view.setScaleY(transition);
        }
    });
    ValueAnimator translateAnimator = ObjectAnimator.ofFloat(0, translateY);
    translateAnimator.setDuration(duration);
    translateAnimator.setStartDelay(50);
    translateAnimator.addUpdateListener(new ValueAnimator.AnimatorUpdateListener() {

        @Override
        public void onAnimationUpdate(ValueAnimator valueAnimator) {
            view.setTranslationY((Float) valueAnimator.getAnimatedValue());
        }
    });
    translateAnimator.addListener(new AnimatorListenerAdapter() {

        @Override
        public void onAnimationEnd(Animator animation) {
            super.onAnimationEnd(animation);
            view.setTranslationY(0);
            view.setAlpha(0f);
        }
    });
    ValueAnimator alphaAnimator = ObjectAnimator.ofFloat(1.0f, 0.0f);
    alphaAnimator.setDuration(duration);
    alphaAnimator.addUpdateListener(new ValueAnimator.AnimatorUpdateListener() {

        @Override
        public void onAnimationUpdate(ValueAnimator valueAnimator) {
            view.setAlpha((Float) valueAnimator.getAnimatedValue());
        }
    });
    scaleAnim.setEndValue(1f);
    alphaAnimator.start();
    translateAnimator.start();
}
Example 47
Project: GitHubExplorer-master  File: RecyclerViewAdapter.java View source code
@Override
public void onClick(View v) {
    ObjectAnimator animator = ObjectAnimator.ofFloat(view, "translationZ", 20, 0);
    animator.addListener(new AnimatorListenerAdapter() {

        @Override
        public void onAnimationEnd(Animator animation) {
            mContext.startActivity(new Intent(mContext, DetailActivity.class));
        }
    });
    animator.start();
}
Example 48
Project: googletv-android-samples-master  File: VisibilityController.java View source code
boolean setVisible(final boolean visible, boolean animated) {
    if (isVisible() == visible) {
        return false;
    }
    mVisible = visible;
    if (animated) {
        float toAlpha = visible ? 1.0f : 0.0f;
        ObjectAnimator mAnimator = ObjectAnimator.ofFloat(mView, "Alpha", 1 - toAlpha, toAlpha);
        mAnimator.setDuration(mAnimationDuration).addListener(new AnimatorListenerAdapter() {

            @Override
            public void onAnimationStart(Animator animator) {
                if (visible) {
                    setViewVisible(true);
                }
            }

            @Override
            public void onAnimationEnd(Animator animator) {
                if (!visible) {
                    setViewVisible(false);
                }
            }
        });
        mAnimator.start();
    } else {
        setViewVisible(visible);
    }
    return true;
}
Example 49
Project: homescreen-master  File: RevealOutlineAnimation.java View source code
public ValueAnimator createRevealAnimator(final View revealView, boolean isReversed) {
    ValueAnimator va = isReversed ? ValueAnimator.ofFloat(1f, 0f) : ValueAnimator.ofFloat(0f, 1f);
    final float elevation = revealView.getElevation();
    va.addListener(new AnimatorListenerAdapter() {

        private boolean mWasCanceled = false;

        public void onAnimationStart(Animator animation) {
            revealView.setOutlineProvider(RevealOutlineAnimation.this);
            revealView.setClipToOutline(true);
            if (shouldRemoveElevationDuringAnimation()) {
                revealView.setTranslationZ(-elevation);
            }
        }

        @Override
        public void onAnimationCancel(Animator animation) {
            mWasCanceled = true;
        }

        public void onAnimationEnd(Animator animation) {
            if (!mWasCanceled) {
                revealView.setOutlineProvider(ViewOutlineProvider.BACKGROUND);
                revealView.setClipToOutline(false);
                if (shouldRemoveElevationDuringAnimation()) {
                    revealView.setTranslationZ(0);
                }
            }
        }
    });
    va.addUpdateListener(new ValueAnimator.AnimatorUpdateListener() {

        @Override
        public void onAnimationUpdate(ValueAnimator arg0) {
            float progress = (Float) arg0.getAnimatedValue();
            setProgress(progress);
            revealView.invalidateOutline();
            if (!Utilities.ATLEAST_LOLLIPOP_MR1) {
                revealView.invalidate();
            }
        }
    });
    return va;
}
Example 50
Project: InstaMaterial-master  File: LoadingFeedItemView.java View source code
@Override
public void onLoadingFinished() {
    vSendingProgress.animate().scaleY(0).scaleX(0).setDuration(200).setStartDelay(100);
    vProgressBg.animate().alpha(0.f).setDuration(200).setStartDelay(100).setListener(new AnimatorListenerAdapter() {

        @Override
        public void onAnimationEnd(Animator animation) {
            vSendingProgress.setScaleX(1);
            vSendingProgress.setScaleY(1);
            vProgressBg.setAlpha(1);
            if (onLoadingFinishedListener != null) {
                onLoadingFinishedListener.onLoadingFinished();
                onLoadingFinishedListener = null;
            }
        }
    }).start();
}
Example 51
Project: IntranetEpitechV2-master  File: ViewPropertyAnimatorCompatJB.java View source code
public static void setListener(final View view, final ViewPropertyAnimatorListener listener) {
    if (listener != null) {
        view.animate().setListener(new AnimatorListenerAdapter() {

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

            @Override
            public void onAnimationEnd(Animator animation) {
                listener.onAnimationEnd(view);
            }

            @Override
            public void onAnimationStart(Animator animation) {
                listener.onAnimationStart(view);
            }
        });
    } else {
        view.animate().setListener(null);
    }
}
Example 52
Project: JianShuApp-master  File: SwipeDismissAnimation.java View source code
@Override
public void animate(final Card card, final CardView cardView) {
    cardView.animate().translationX(mDismissRight ? mListWidth : -mListWidth).alpha(0).setDuration(mAnimationTime).setListener(new AnimatorListenerAdapter() {

        @Override
        public void onAnimationEnd(Animator animation) {
            invokeCallbak(cardView);
        }
    });
}
Example 53
Project: Launcher3-master  File: UiThreadCircularReveal.java View source code
public static ValueAnimator createCircularReveal(View v, int x, int y, float r0, float r1, final ViewOutlineProvider originalProvider) {
    ValueAnimator va = ValueAnimator.ofFloat(0f, 1f);
    final View revealView = v;
    final RevealOutlineProvider outlineProvider = new RevealOutlineProvider(x, y, r0, r1);
    final float elevation = v.getElevation();
    va.addListener(new AnimatorListenerAdapter() {

        public void onAnimationStart(Animator animation) {
            revealView.setOutlineProvider(outlineProvider);
            revealView.setClipToOutline(true);
            revealView.setTranslationZ(-elevation);
        }

        public void onAnimationEnd(Animator animation) {
            revealView.setOutlineProvider(originalProvider);
            revealView.setClipToOutline(false);
            revealView.setTranslationZ(0);
        }
    });
    va.addUpdateListener(new AnimatorUpdateListener() {

        @Override
        public void onAnimationUpdate(ValueAnimator arg0) {
            float progress = arg0.getAnimatedFraction();
            outlineProvider.setProgress(progress);
            revealView.invalidateOutline();
            if (!Utilities.ATLEAST_LOLLIPOP_MR1) {
                revealView.invalidate();
            }
        }
    });
    return va;
}
Example 54
Project: ListBuddies-master  File: BaseActivity.java View source code
@TargetApi(Build.VERSION_CODES.HONEYCOMB)
private void animate(float from, float to) {
    mCurrentAnimator = ValueAnimator.ofFloat(from, to);
    mCurrentAnimator.addUpdateListener(new ValueAnimator.AnimatorUpdateListener() {

        @Override
        public void onAnimationUpdate(ValueAnimator animation) {
            float value = (Float) animation.getAnimatedValue();
            mMatrix.reset();
            mMatrix.postScale(mScaleFactor, mScaleFactor);
            mMatrix.postTranslate(value, 0);
            mBackground.setImageMatrix(mMatrix);
        }
    });
    mCurrentAnimator.setDuration(DURATION);
    mCurrentAnimator.addListener(new AnimatorListenerAdapter() {

        @Override
        public void onAnimationEnd(Animator animation) {
            if (mDirection == RightToLeft)
                mDirection = LeftToRight;
            else
                mDirection = RightToLeft;
            animate();
        }
    });
    mCurrentAnimator.start();
}
Example 55
Project: LollipopDemo-master  File: RevealActivity.java View source code
private void playRevealAnimationForView(final View revealView) {
    // get the center for the clipping circle
    Animator anim = getRevealAnimation(revealView);
    anim.addListener(new AnimatorListenerAdapter() {

        @Override
        public void onAnimationStart(Animator animation) {
            super.onAnimationStart(animation);
            revealView.setVisibility(View.VISIBLE);
        }
    });
    anim.start();
}
Example 56
Project: LRecyclerView-master  File: SplashActivity.java View source code
@Override
public void run() {
    final View parentView = (View) fab.getParent();
    float scale = (float) (Math.sqrt(parentView.getHeight() * parentView.getHeight() + parentView.getWidth() * parentView.getWidth()) / fab.getHeight());
    PropertyValuesHolder scaleX = PropertyValuesHolder.ofFloat("scaleX", scale);
    PropertyValuesHolder scaleY = PropertyValuesHolder.ofFloat("scaleY", scale);
    ObjectAnimator objectAnimator = ObjectAnimator.ofPropertyValuesHolder(fab, scaleX, scaleY).setDuration(1800);
    objectAnimator.setInterpolator(new AccelerateDecelerateInterpolator());
    objectAnimator.addListener(new AnimatorListenerAdapter() {

        @Override
        public void onAnimationEnd(Animator animation) {
            super.onAnimationEnd(animation);
            parentView.setBackgroundColor(ContextCompat.getColor(SplashActivity.this, R.color.colorPrimary));
            fab.setVisibility(View.GONE);
            nameTextView.setVisibility(View.VISIBLE);
        }
    });
    PropertyValuesHolder holderA = PropertyValuesHolder.ofFloat("alpha", 0, 1);
    PropertyValuesHolder holderYm = PropertyValuesHolder.ofFloat("translationY", 0, 300);
    ObjectAnimator textAnimator = ObjectAnimator.ofPropertyValuesHolder(textView, holderA, holderYm).setDuration(1000);
    textAnimator.setInterpolator(new AccelerateDecelerateInterpolator());
    textAnimator.setStartDelay(800);
    textAnimator.addListener(new AnimatorListenerAdapter() {

        @Override
        public void onAnimationEnd(Animator animation) {
            super.onAnimationEnd(animation);
            startActivity(new Intent(SplashActivity.this, MainActivity.class));
            finish();
        }
    });
    objectAnimator.start();
    textAnimator.start();
}
Example 57
Project: maepaysoh-android-master  File: ViewUtils.java View source code
/**
   * Helper to show/hide the view with an alpha animation for API 13 and above
   *
   * @param firstView first view to show/hide
   * @param secondView second view to show/hide
   * @param show flag to determine show/hide
   */
@TargetApi(Build.VERSION_CODES.HONEYCOMB_MR2)
public void showProgress(final View firstView, final View secondView, final boolean show) {
    if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.HONEYCOMB_MR2) {
        int shortAnimTime = mContext.getResources().getInteger(android.R.integer.config_shortAnimTime);
        firstView.setVisibility(show ? View.GONE : View.VISIBLE);
        firstView.animate().setDuration(shortAnimTime).alpha(show ? 0 : 1).setListener(new AnimatorListenerAdapter() {

            @Override
            public void onAnimationEnd(Animator animation) {
                firstView.setVisibility(show ? View.GONE : View.VISIBLE);
            }
        });
        secondView.setVisibility(show ? View.VISIBLE : View.GONE);
        secondView.animate().setDuration(shortAnimTime).alpha(show ? 1 : 0).setListener(new AnimatorListenerAdapter() {

            @Override
            public void onAnimationEnd(Animator animation) {
                secondView.setVisibility(show ? View.VISIBLE : View.GONE);
            }
        });
    } else {
        // The ViewPropertyAnimator APIs are not available, so simply show
        // and hide the relevant UI components.
        secondView.setVisibility(show ? View.VISIBLE : View.GONE);
        firstView.setVisibility(show ? View.GONE : View.VISIBLE);
    }
}
Example 58
Project: material-sheet-fab-master  File: OverlayAnimation.java View source code
/**
	 * Shows the overlay.
	 * 
	 * @param duration Duration of the animation in milliseconds. Use 0 for no animation.
	 * @param listener Listener for animation events.
	 */
public void show(long duration, final AnimationListener listener) {
    overlay.animate().alpha(1).setDuration(duration).setInterpolator(interpolator).setListener(new AnimatorListenerAdapter() {

        @Override
        public void onAnimationStart(Animator animation) {
            overlay.setVisibility(View.VISIBLE);
            if (listener != null) {
                listener.onStart();
            }
        }

        @Override
        public void onAnimationEnd(Animator animation) {
            if (listener != null) {
                listener.onEnd();
            }
        }
    }).start();
}
Example 59
Project: MHacksAndroid-Public-master  File: PongHeaderTransformer.java View source code
@Override
public boolean hideHeaderView() {
    final boolean changeVis = mHeaderView.getVisibility() == View.VISIBLE;
    if (changeVis) {
        Animator animator = ObjectAnimator.ofFloat(mHeaderView, "alpha", 1f, 0f);
        animator.addListener(new AnimatorListenerAdapter() {

            @Override
            public void onAnimationEnd(Animator animation) {
                mHeaderView.setVisibility(View.GONE);
                mPongPlayer.stopPlaying();
            }
        });
        animator.setDuration(FADE_IN_OUT_DURATION).start();
    }
    Log.d("PongHeaderTransformer", "hideHeaderView: " + changeVis);
    return changeVis;
}
Example 60
Project: MindRDR-master  File: UploadingFragment.java View source code
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
    // Inflate the layout for this fragment
    View view = inflater.inflate(R.layout.fragment_uploading, container, false);
    mProgressSpinner = (ProgressBar) view.findViewById(R.id.progress_spinner);
    mBlueCover = (FrameLayout) view.findViewById(R.id.blue_cover);
    mSuccessView = (LinearLayout) view.findViewById(R.id.success);
    mBlueCover.setTranslationY(360);
    AnimatorSet set = new AnimatorSet();
    ObjectAnimator animation = ObjectAnimator.ofFloat(mBlueCover, "translationY", 0);
    animation.setDuration(1000);
    animation.addListener(new AnimatorListenerAdapter() {

        @Override
        public void onAnimationEnd(Animator animation) {
        }
    });
    set.play(animation);
    set.start();
    return view;
}
Example 61
Project: mobile-cardio-master  File: VisibilityController.java View source code
boolean setVisible(final boolean visible, boolean animated) {
    if (isVisible() == visible) {
        return false;
    }
    mVisible = visible;
    if (animated) {
        float toAlpha = visible ? 1.0f : 0.0f;
        ObjectAnimator mAnimator = ObjectAnimator.ofFloat(mView, "Alpha", 1 - toAlpha, toAlpha);
        mAnimator.setDuration(mAnimationDuration).addListener(new AnimatorListenerAdapter() {

            @Override
            public void onAnimationStart(Animator animator) {
                if (visible) {
                    setViewVisible(true);
                }
            }

            @Override
            public void onAnimationEnd(Animator animator) {
                if (!visible) {
                    setViewVisible(false);
                }
            }
        });
        mAnimator.start();
    } else {
        setViewVisible(visible);
    }
    return true;
}
Example 62
Project: MoeQuest-master  File: AppSplashActivity.java View source code
private void startAnim() {
    ObjectAnimator animatorX = ObjectAnimator.ofFloat(mSplashImage, "scaleX", 1f, SCALE_END);
    ObjectAnimator animatorY = ObjectAnimator.ofFloat(mSplashImage, "scaleY", 1f, SCALE_END);
    AnimatorSet set = new AnimatorSet();
    set.setDuration(ANIMATION_TIME).play(animatorX).with(animatorY);
    set.start();
    set.addListener(new AnimatorListenerAdapter() {

        @Override
        public void onAnimationEnd(Animator animation) {
            startActivity(new Intent(AppSplashActivity.this, MainActivity.class));
            AppSplashActivity.this.finish();
            overridePendingTransition(android.R.anim.fade_in, android.R.anim.fade_out);
        }
    });
}
Example 63
Project: mosby-master  File: ExplodeFadeEnterTransition.java View source code
@Override
public Animator createAnimator(final ViewGroup sceneRoot, TransitionValues startValues, TransitionValues endValues) {
    Animator animator = super.createAnimator(sceneRoot, startValues, endValues);
    animator.addListener(new AnimatorListenerAdapter() {

        @Override
        public void onAnimationStart(Animator animation) {
            senderNameView.setVisibility(View.VISIBLE);
            senderMailView.setVisibility(View.VISIBLE);
            separatorLine.setVisibility(View.VISIBLE);
            senderNameView.setAlpha(0);
            senderMailView.setAlpha(0);
            separatorLine.setAlpha(0);
        }

        @Override
        public void onAnimationEnd(Animator animation) {
            AnimatorSet set = new AnimatorSet();
            set.playTogether(ObjectAnimator.ofFloat(senderNameView, "alpha", 0f, 1f), ObjectAnimator.ofFloat(senderMailView, "alpha", 0f, 1f), ObjectAnimator.ofFloat(separatorLine, "alpha", 0f, 1f));
            set.setDuration(200).start();
        }
    });
    return animator;
}
Example 64
Project: noticias-tvi-master  File: VisibilityController.java View source code
boolean setVisible(final boolean visible, boolean animated) {
    if (isVisible() == visible) {
        return false;
    }
    mVisible = visible;
    if (animated) {
        float toAlpha = visible ? 1.0f : 0.0f;
        ObjectAnimator mAnimator = ObjectAnimator.ofFloat(mView, "Alpha", 1 - toAlpha, toAlpha);
        mAnimator.setDuration(mAnimationDuration).addListener(new AnimatorListenerAdapter() {

            @Override
            public void onAnimationStart(Animator animator) {
                if (visible) {
                    setViewVisible(true);
                }
            }

            @Override
            public void onAnimationEnd(Animator animator) {
                if (!visible) {
                    setViewVisible(false);
                }
            }
        });
        mAnimator.start();
    } else {
        setViewVisible(visible);
    }
    return true;
}
Example 65
Project: platform_frameworks_support-master  File: ViewPropertyAnimatorCompatJB.java View source code
public static void setListener(final View view, final ViewPropertyAnimatorListener listener) {
    if (listener != null) {
        view.animate().setListener(new AnimatorListenerAdapter() {

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

            @Override
            public void onAnimationEnd(Animator animation) {
                listener.onAnimationEnd(view);
            }

            @Override
            public void onAnimationStart(Animator animation) {
                listener.onAnimationStart(view);
            }
        });
    } else {
        view.animate().setListener(null);
    }
}
Example 66
Project: PracticeDemo-master  File: WaveView.java View source code
public void startWave(int duration) {
    setVisibility(VISIBLE);
    ObjectAnimator waveAnimator = ObjectAnimator.ofInt(this, "currentHeight", 0, height).setDuration(duration);
    waveAnimator.addListener(new AnimatorListenerAdapter() {

        @Override
        public void onAnimationEnd(Animator animation) {
            super.onAnimationEnd(animation);
        }
    });
    waveAnimator.start();
}
Example 67
Project: PreLollipopTransition-master  File: SubActivity.java View source code
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_sub);
    exitTransition = ActivityTransition.with(getIntent()).enterListener(new AnimatorListenerAdapter() {

        @Override
        public void onAnimationEnd(Animator animation) {
            Log.d("TAG", "onEnterAnimationEnd!!");
        }

        @Override
        public void onAnimationStart(Animator animation) {
            Log.d("TAG", "onOEnterAnimationStart!!");
        }
    }).to(findViewById(R.id.sub_imageView)).start(savedInstanceState);
    exitTransition.exitListener(new AnimatorListenerAdapter() {

        @Override
        public void onAnimationStart(Animator animation) {
            Log.d("TAG", "onOutAnimationStart!!");
        }

        @Override
        public void onAnimationEnd(Animator animation) {
            Log.d("TAG", "onOutAnimationEnd!!");
        }
    });
}
Example 68
Project: pulse-master  File: BpmView.java View source code
private void init() {
    setNoBpm();
    setTextSize(TypedValue.COMPLEX_UNIT_FRACTION_PARENT, 60f);
    setTypeface(Typeface.createFromAsset(getContext().getAssets(), "fonts/ds_digital/DS-DIGIB.TTF"));
    setGravity(Gravity.CENTER);
    circlePaint = initCirclePaint();
    circlePaintAnimator = ObjectAnimator.ofInt(circlePaint, "Alpha", 0, 256);
    circlePaintAnimator.setInterpolator(new AccelerateInterpolator());
    circlePaintAnimator.setDuration(1000);
    circlePaintAnimator.setRepeatCount(ValueAnimator.INFINITE);
    circlePaintAnimator.setRepeatMode(ValueAnimator.REVERSE);
    circlePaintAnimator.addListener(new AnimatorListenerAdapter() {

        @Override
        public void onAnimationRepeat(Animator animation) {
            if (getText() == "-" && circlePaint.getAlpha() == 0) {
                animation.cancel();
            }
        }
    });
    circlePaintAnimator.addUpdateListener(new ValueAnimator.AnimatorUpdateListener() {

        @Override
        public void onAnimationUpdate(ValueAnimator animation) {
            invalidate();
        }
    });
}
Example 69
Project: QuickSand-master  File: ViewAnimateActivity.java View source code
@Override
public void onClick(View v) {
    if (clickedShow()) {
        animateButton.animate().alpha(0F).setDuration(500L).translationY(sandImage.getHeight()).setListener(new AnimatorListenerAdapter() {

            @Override
            public void onAnimationEnd(Animator animation) {
                animateButton.setText(R.string.view_property_hide_button);
                animateButton.animate().alpha(1F).setDuration(500L);
            }
        });
        sandImage.animate().alpha(1F).setDuration(500L).setListener(new AnimatorListenerAdapter() {

            @Override
            public void onAnimationStart(Animator animation) {
                sandImage.setVisibility(View.VISIBLE);
            }
        });
        Quicksand.trap(KEY_ANIM_SHOW_HIDE, animateButton, sandImage);
    } else {
        animateButton.animate().alpha(0F).translationYBy(-sandImage.getHeight()).setDuration(500L).setListener(new AnimatorListenerAdapter() {

            @Override
            public void onAnimationEnd(Animator animation) {
                animateButton.setText(R.string.view_property_show_button);
                animateButton.animate().alpha(1F).setDuration(500L);
            }
        });
        sandImage.animate().alpha(0F).setDuration(500L).setListener(new AnimatorListenerAdapter() {

            @Override
            public void onAnimationEnd(Animator animation) {
                sandImage.setVisibility(View.INVISIBLE);
            }
        });
        Quicksand.trap(KEY_ANIM_SHOW_HIDE, animateButton, sandImage);
    }
}
Example 70
Project: RAVA-Voting-master  File: SwipeDismissAnimation.java View source code
@Override
public void animate(final Card card, final CardView cardView) {
    cardView.animate().translationX(mDismissRight ? mListWidth : -mListWidth).alpha(0).setDuration(mAnimationTime).setListener(new AnimatorListenerAdapter() {

        @Override
        public void onAnimationEnd(Animator animation) {
            invokeCallbak(cardView);
        }
    });
}
Example 71
Project: react-native-navigation-master  File: SharedElementsAnimator.java View source code
private AnimatorSet createShowAnimators() {
    final AnimatorSet animatorSet = new AnimatorSet();
    animatorSet.playTogether(createTransitionAnimators());
    animatorSet.addListener(new AnimatorListenerAdapter() {

        @Override
        public void onAnimationStart(Animator animation) {
            onAnimationStart.run();
        }

        @Override
        public void onAnimationEnd(Animator animation) {
            sharedElements.onShowAnimationEnd();
            onAnimationEnd.run();
        }

        @Override
        public void onAnimationCancel(Animator animation) {
            sharedElements.onShowAnimationEnd();
        }
    });
    return animatorSet;
}
Example 72
Project: santa-tracker-android-master  File: BounceInAnimator.java View source code
public static void animate(final View view) {
    // Scale up
    view.setScaleX(SCALE_BIG);
    view.setScaleY(SCALE_BIG);
    // Animate back down with a bounce-in effect
    final ValueAnimator animator = ValueAnimator.ofFloat(SCALE_BIG, SCALE_NORMAL);
    animator.setDuration(1000);
    animator.setInterpolator(new BounceInterpolator());
    animator.addUpdateListener(new ValueAnimator.AnimatorUpdateListener() {

        @Override
        public void onAnimationUpdate(ValueAnimator animation) {
            float value = (float) animation.getAnimatedValue();
            view.setScaleX(value);
            view.setScaleY(value);
        }
    });
    // On end, return scale to normal
    animator.addListener(new AnimatorListenerAdapter() {

        @Override
        public void onAnimationEnd(Animator animation) {
            view.setScaleX(SCALE_NORMAL);
            view.setScaleY(SCALE_NORMAL);
        }
    });
    animator.start();
}
Example 73
Project: sdk-support-master  File: ViewPropertyAnimatorCompatJB.java View source code
public static void setListener(final View view, final ViewPropertyAnimatorListener listener) {
    if (listener != null) {
        view.animate().setListener(new AnimatorListenerAdapter() {

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

            @Override
            public void onAnimationEnd(Animator animation) {
                listener.onAnimationEnd(view);
            }

            @Override
            public void onAnimationStart(Animator animation) {
                listener.onAnimationStart(view);
            }
        });
    } else {
        view.animate().setListener(null);
    }
}
Example 74
Project: simple-stack-master  File: AnimatorViewChangeHandler.java View source code
@Override
public void performViewChange(@NonNull final ViewGroup container, @NonNull final View previousView, @NonNull final View newView, final int direction, @NonNull final CompletionCallback completionCallback) {
    container.addView(newView);
    ViewUtils.waitForMeasure(newView, new ViewUtils.OnMeasuredCallback() {

        @Override
        public void onMeasured(View view, int width, int height) {
            runAnimation(previousView, newView, direction, new AnimatorListenerAdapter() {

                @Override
                public void onAnimationEnd(Animator animation) {
                    container.removeView(previousView);
                    completionCallback.onCompleted();
                }
            });
        }
    });
}
Example 75
Project: Spark_Pixels-master  File: BaseFragment.java View source code
/**
	 * Shows & hides the progress spinner and hides the login form.
	 */
protected void showProgress(int viewId, final boolean show) {
    // Fade-in the progress spinner.
    int shortAnimTime = getResources().getInteger(android.R.integer.config_shortAnimTime);
    final View progressView = Ui.findView(this, viewId);
    progressView.setVisibility(View.VISIBLE);
    progressView.animate().setDuration(shortAnimTime).alpha(show ? 1 : 0).setListener(new AnimatorListenerAdapter() {

        @Override
        public void onAnimationEnd(Animator animation) {
            progressView.setVisibility(show ? View.VISIBLE : View.GONE);
        }
    });
}
Example 76
Project: tooltips-master  File: AnimationUtils.java View source code
static ObjectAnimator popout(final View view, final long duration, final AnimatorListenerAdapter animatorListenerAdapter) {
    ObjectAnimator popout = ObjectAnimator.ofPropertyValuesHolder(view, PropertyValuesHolder.ofFloat("alpha", 1f, 0f), PropertyValuesHolder.ofFloat("scaleX", 1f, 0f), PropertyValuesHolder.ofFloat("scaleY", 1f, 0f));
    popout.setDuration(duration);
    popout.addListener(new AnimatorListenerAdapter() {

        @Override
        public void onAnimationEnd(Animator animation) {
            super.onAnimationEnd(animation);
            view.setVisibility(View.GONE);
            if (animatorListenerAdapter != null) {
                animatorListenerAdapter.onAnimationEnd(animation);
            }
        }
    });
    popout.setInterpolator(new AnticipateOvershootInterpolator());
    return popout;
}
Example 77
Project: TVRecyclerView-master  File: ValueAnimatorCompatImplHoneycombMr1.java View source code
@Override
public void setListener(final AnimatorListenerProxy listener) {
    mValueAnimator.addListener(new AnimatorListenerAdapter() {

        @Override
        public void onAnimationStart(Animator animator) {
            listener.onAnimationStart();
        }

        @Override
        public void onAnimationEnd(Animator animator) {
            listener.onAnimationEnd();
        }

        @Override
        public void onAnimationCancel(Animator animator) {
            listener.onAnimationCancel();
        }
    });
}
Example 78
Project: TwinklingRefreshLayout-master  File: RippleView.java View source code
public void startReveal() {
    setVisibility(VISIBLE);
    if (va == null) {
        int bigRadius = (int) (Math.sqrt(Math.pow(getHeight(), 2) + Math.pow(getWidth(), 2)));
        va = ValueAnimator.ofInt(0, bigRadius / 2);
        va.setDuration(bigRadius);
        va.addUpdateListener(new ValueAnimator.AnimatorUpdateListener() {

            @Override
            public void onAnimationUpdate(ValueAnimator animation) {
                r = (int) animation.getAnimatedValue() * 2;
                invalidate();
            }
        });
        va.addListener(new AnimatorListenerAdapter() {

            @Override
            public void onAnimationEnd(Animator animation) {
                if (listener != null) {
                    listener.onRippleEnd();
                }
            }
        });
    }
    va.start();
}
Example 79
Project: ulti-master  File: FadeInAnimation.java View source code
@Override
public AnimatorSet getAnimatorSet() {
    view.setAlpha(0f);
    view.setVisibility(View.VISIBLE);
    AnimatorSet fadeSet = new AnimatorSet();
    fadeSet.play(ObjectAnimator.ofFloat(view, View.ALPHA, 1f));
    fadeSet.setInterpolator(interpolator);
    fadeSet.setDuration(duration);
    fadeSet.addListener(new AnimatorListenerAdapter() {

        @Override
        public void onAnimationEnd(Animator animation) {
            if (getListener() != null) {
                getListener().onAnimationEnd(FadeInAnimation.this);
            }
        }
    });
    return fadeSet;
}
Example 80
Project: UltimateAndroid-master  File: FadeInAnimation.java View source code
@Override
public AnimatorSet getAnimatorSet() {
    view.setAlpha(0f);
    view.setVisibility(View.VISIBLE);
    AnimatorSet fadeSet = new AnimatorSet();
    fadeSet.play(ObjectAnimator.ofFloat(view, View.ALPHA, 1f));
    fadeSet.setInterpolator(interpolator);
    fadeSet.setDuration(duration);
    fadeSet.addListener(new AnimatorListenerAdapter() {

        @Override
        public void onAnimationEnd(Animator animation) {
            if (getListener() != null) {
                getListener().onAnimationEnd(FadeInAnimation.this);
            }
        }
    });
    return fadeSet;
}
Example 81
Project: XieDaDeng-master  File: IconPulser.java View source code
public void start(final View target) {
    // n/a, or already running
    if (target == null || target.getScaleX() != 1)
        return;
    target.animate().cancel();
    target.animate().scaleX(PULSE_SCALE).scaleY(PULSE_SCALE).setInterpolator(mFastOutSlowInInterpolator).setListener(new AnimatorListenerAdapter() {

        @Override
        public void onAnimationEnd(Animator animation) {
            target.animate().scaleX(1).scaleY(1).setListener(null);
        }
    });
}
Example 82
Project: Yhb-2.0-master  File: FadeInAnimation.java View source code
@Override
public AnimatorSet getAnimatorSet() {
    view.setAlpha(0f);
    view.setVisibility(View.VISIBLE);
    AnimatorSet fadeSet = new AnimatorSet();
    fadeSet.play(ObjectAnimator.ofFloat(view, View.ALPHA, 1f));
    fadeSet.setInterpolator(interpolator);
    fadeSet.setDuration(duration);
    fadeSet.addListener(new AnimatorListenerAdapter() {

        @Override
        public void onAnimationEnd(Animator animation) {
            if (getListener() != null) {
                getListener().onAnimationEnd(FadeInAnimation.this);
            }
        }
    });
    return fadeSet;
}
Example 83
Project: ActSwitchAnimTool-master  File: ShareItemView.java View source code
private void initAnimation() {
    animator = ValueAnimator.ofFloat(0, 1).setDuration(300);
    animator.addUpdateListener(new ValueAnimator.AnimatorUpdateListener() {

        @Override
        public void onAnimationUpdate(ValueAnimator animation) {
            float factor = (float) animation.getAnimatedValue();
            setTranslationY((1 - factor) * 100);
            setAlpha(factor);
        }
    });
    animator.addListener(new AnimatorListenerAdapter() {

        @Override
        public void onAnimationEnd(Animator animation) {
            if (mAnimMode == ANIM_START) {
            } else if (mAnimMode == ANIM_REVERSE) {
                setVisibility(GONE);
            }
        }
    });
}
Example 84
Project: Android-Material-Examples-master  File: GUIUtils.java View source code
public static void hideRevealEffect(final View v, int centerX, int centerY, int initialRadius) {
    v.setVisibility(View.VISIBLE);
    // create the animation (the final radius is zero)
    Animator anim = ViewAnimationUtils.createCircularReveal(v, centerX, centerY, initialRadius, 0);
    anim.setDuration(350);
    // make the view invisible when the animation is done
    anim.addListener(new AnimatorListenerAdapter() {

        @Override
        public void onAnimationEnd(Animator animation) {
            super.onAnimationEnd(animation);
            v.setVisibility(View.INVISIBLE);
        }
    });
    anim.start();
}
Example 85
Project: android-proguards-master  File: StartAnimatable.java View source code
@Override
public Animator createAnimator(ViewGroup sceneRoot, TransitionValues startValues, TransitionValues endValues) {
    if (animatable == null || endValues == null || !(endValues.view instanceof ImageView))
        return null;
    ImageView iv = (ImageView) endValues.view;
    iv.setImageDrawable((Drawable) animatable);
    // need to return a non-null Animator even though we just want to listen for the start
    ValueAnimator transition = ValueAnimator.ofInt(0, 1);
    transition.addListener(new AnimatorListenerAdapter() {

        @Override
        public void onAnimationStart(Animator animation) {
            animatable.start();
        }
    });
    return transition;
}
Example 86
Project: android-xkcd-master  File: AnimationUtils.java View source code
/** Fade out the given view. */
public static void fadeOut(final View view, float opacity, int duration) {
    // Animate the loading view to the given opacity.
    AnimatorListenerAdapter animatorListenerAdapter = null;
    if (opacity == 0f) {
        // After the animation ends, set its visibility to GONE as an optimization step
        // (it won't participate in layout passes, etc.)
        animatorListenerAdapter = new AnimatorListenerAdapter() {

            @Override
            public void onAnimationEnd(Animator animation) {
                view.setVisibility(View.GONE);
            }
        };
    }
    view.animate().withLayer().alpha(opacity).setDuration(duration).setListener(animatorListenerAdapter);
}
Example 87
Project: AndroidAppFrameWork-master  File: RegisterActivity.java View source code
public void animateRevealShow() {
    Animator mAnimator = ViewAnimationUtils.createCircularReveal(cvAdd, cvAdd.getWidth() / 2, 0, fab.getWidth() / 2, cvAdd.getHeight());
    mAnimator.setDuration(300);
    mAnimator.setInterpolator(new AccelerateInterpolator());
    mAnimator.addListener(new AnimatorListenerAdapter() {

        @Override
        public void onAnimationEnd(Animator animation) {
            super.onAnimationEnd(animation);
        }

        @Override
        public void onAnimationStart(Animator animation) {
            cvAdd.setVisibility(View.VISIBLE);
            super.onAnimationStart(animation);
        }
    });
    mAnimator.start();
}
Example 88
Project: AndroidBlog-master  File: Util.java View source code
@TargetApi(Build.VERSION_CODES.HONEYCOMB_MR1)
public static void animateAlpha(final View view, float fromAlpha, float toAlpha, int duration, final Runnable endAction) {
    if (isPostHoneycomb()) {
        ViewPropertyAnimator animator = view.animate().alpha(toAlpha).setDuration(duration);
        if (endAction != null) {
            animator.setListener(new AnimatorListenerAdapter() {

                public void onAnimationEnd(Animator animation) {
                    endAction.run();
                }
            });
        }
    } else {
        AlphaAnimation alphaAnimation = new AlphaAnimation(fromAlpha, toAlpha);
        alphaAnimation.setDuration(duration);
        alphaAnimation.setFillAfter(true);
        if (endAction != null) {
            alphaAnimation.setAnimationListener(new Animation.AnimationListener() {

                @Override
                public void onAnimationEnd(Animation animation) {
                    // fixes the crash bug while removing views
                    Handler handler = new Handler();
                    handler.post(endAction);
                }

                @Override
                public void onAnimationStart(Animation animation) {
                }

                @Override
                public void onAnimationRepeat(Animation animation) {
                }
            });
        }
        view.startAnimation(alphaAnimation);
    }
}
Example 89
Project: AndroidStartupDemo-master  File: SplashActivity.java View source code
private void startAnim(View splashImage) {
    ObjectAnimator animatorX = ObjectAnimator.ofFloat(splashImage, "scaleX", 1f, SCALE_END);
    ObjectAnimator animatorY = ObjectAnimator.ofFloat(splashImage, "scaleY", 1f, SCALE_END);
    AnimatorSet set = new AnimatorSet();
    set.setDuration(ANIMATION_TIME).play(animatorX).with(animatorY);
    set.start();
    set.addListener(new AnimatorListenerAdapter() {

        @Override
        public void onAnimationEnd(Animator animation) {
            startActivity(new Intent(SplashActivity.this, MainActivity.class));
            //activity切�的淡入淡出效果
            overridePendingTransition(android.R.anim.fade_in, android.R.anim.fade_out);
            SplashActivity.this.finish();
        }
    });
}
Example 90
Project: androidui-master  File: MainActivity.java View source code
public void visable(View v) {
    if (valueAnimator == null) {
        valueAnimator = valueAnimator.ofFloat(0f, 1f);
        valueAnimator.setDuration(600);
        valueAnimator.setInterpolator(new DecelerateInterpolator());
        valueAnimator.addUpdateListener(new ValueAnimator.AnimatorUpdateListener() {

            @Override
            public void onAnimationUpdate(ValueAnimator animation) {
                float n = (float) animation.getAnimatedValue();
                //圈圈的旋转角度
                mProgress.setProgressRotation(n * 0.5f);
                //圈圈周长,0f-1F
                mProgress.setStartEndTrim(0f, n * 0.8f);
                //箭头大�,0f-1F
                mProgress.setArrowScale(n);
                //�明度,0-255
                mProgress.setAlpha((int) (255 * n));
            }
        });
        valueAnimator.addListener(new AnimatorListenerAdapter() {

            @Override
            public void onAnimationEnd(Animator animation) {
                super.onAnimationEnd(animation);
                visable = true;
            }
        });
    }
    if (!valueAnimator.isRunning()) {
        if (!visable) {
            //是�显示箭头
            mProgress.showArrow(true);
            valueAnimator.start();
        } else {
            Toast.makeText(this, "看���?", Toast.LENGTH_SHORT).show();
        }
    }
}
Example 91
Project: Android_Example_Projects-master  File: AnimationDemoActivity.java View source code
// Slide message from button up to display, then later slide out
public void onSlideMessage(View v) {
    tvMessage.setVisibility(View.VISIBLE);
    final int yPosInitial = getScreenHeight() + tvMessage.getHeight();
    int yPosDest = tvMessage.getHeight();
    tvMessage.setY(yPosInitial);
    tvMessage.animate().translationY(yPosDest).setDuration(2000).setListener(new AnimatorListenerAdapter() {

        @Override
        public void onAnimationEnd(Animator animation) {
            tvMessage.animate().translationY(yPosInitial).setDuration(2000).setStartDelay(2000);
        }
    });
}
Example 92
Project: AppCompat-Extension-Library-master  File: ValueAnimatorCompatImplHoneycombMr1.java View source code
@Override
public void setListener(final AnimatorListenerProxy listener) {
    mValueAnimator.addListener(new AnimatorListenerAdapter() {

        @Override
        public void onAnimationStart(Animator animator) {
            listener.onAnimationStart();
        }

        @Override
        public void onAnimationEnd(Animator animator) {
            listener.onAnimationEnd();
        }

        @Override
        public void onAnimationCancel(Animator animator) {
            listener.onAnimationCancel();
        }

        @Override
        public void onAnimationRepeat(Animator animator) {
            listener.onAnimationRepeat();
        }
    });
}
Example 93
Project: appJavou-master  File: OnScrollListener.java View source code
//Hide or show the FloatingActionButton based on the list scroll
private void showHideFloatButton(boolean status) {
    if (status) {
        mFloatingActionButton.setAlpha(1f);
        mFloatingActionButton.setTranslationY(0f);
        mFloatingActionButton.animate().alpha(0f).translationY(mFloatingActionButton.getHeight()).setDuration(175L).setListener(new AnimatorListenerAdapter() {

            @Override
            public void onAnimationEnd(Animator animation) {
                mFloatingActionButton.setVisibility(FrameLayout.GONE);
            }
        }).start();
    } else {
        mFloatingActionButton.setVisibility(View.VISIBLE);
        mFloatingActionButton.setAlpha(0f);
        mFloatingActionButton.setTranslationY(mFloatingActionButton.getHeight());
        mFloatingActionButton.animate().alpha(1f).translationY(0f).setDuration(175L).setListener(new AnimatorListenerAdapter() {

            @Override
            public void onAnimationEnd(Animator animation) {
                mFloatingActionButton.setVisibility(FrameLayout.VISIBLE);
            }
        }).start();
    }
}
Example 94
Project: apps-android-wikipedia-master  File: AnimatedZoomableController.java View source code
@SuppressLint("NewApi")
@Override
public void setTransformAnimated(final Matrix newTransform, long durationMs, @Nullable final Runnable onAnimationComplete) {
    FLog.v(getLogTag(), "setTransformAnimated: duration %d ms", durationMs);
    stopAnimation();
    Preconditions.checkArgument(durationMs > 0);
    Preconditions.checkState(!isAnimating());
    setAnimating(true);
    mValueAnimator.setDuration(durationMs);
    getTransform().getValues(getStartValues());
    newTransform.getValues(getStopValues());
    mValueAnimator.addUpdateListener(new ValueAnimator.AnimatorUpdateListener() {

        @Override
        public void onAnimationUpdate(ValueAnimator valueAnimator) {
            calculateInterpolation(getWorkingTransform(), (float) valueAnimator.getAnimatedValue());
            AnimatedZoomableController.super.setTransform(getWorkingTransform());
        }
    });
    mValueAnimator.addListener(new AnimatorListenerAdapter() {

        @Override
        public void onAnimationCancel(Animator animation) {
            FLog.v(getLogTag(), "setTransformAnimated: animation cancelled");
            onAnimationStopped();
        }

        @Override
        public void onAnimationEnd(Animator animation) {
            FLog.v(getLogTag(), "setTransformAnimated: animation finished");
            onAnimationStopped();
        }

        private void onAnimationStopped() {
            if (onAnimationComplete != null) {
                onAnimationComplete.run();
            }
            setAnimating(false);
            getDetector().restartGesture();
        }
    });
    mValueAnimator.start();
}
Example 95
Project: ArcProgressStackView-master  File: PresentationActivity.java View source code
@Override
protected void onCreate(final Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_presentation);
    mArcProgressStackView = (ArcProgressStackView) findViewById(R.id.apsv_presentation);
    mArcProgressStackView.setShadowColor(Color.argb(200, 0, 0, 0));
    mArcProgressStackView.setAnimationDuration(1000);
    mArcProgressStackView.setSweepAngle(270);
    final String[] stringColors = getResources().getStringArray(R.array.devlight);
    final String[] stringBgColors = getResources().getStringArray(R.array.bg);
    final int[] colors = new int[MODEL_COUNT];
    final int[] bgColors = new int[MODEL_COUNT];
    for (int i = 0; i < MODEL_COUNT; i++) {
        colors[i] = Color.parseColor(stringColors[i]);
        bgColors[i] = Color.parseColor(stringBgColors[i]);
    }
    final ArrayList<ArcProgressStackView.Model> models = new ArrayList<>();
    models.add(new Model("STRATEGY", 1, bgColors[0], colors[0]));
    models.add(new Model("DESIGN", 1, bgColors[1], colors[1]));
    models.add(new Model("DEVELOPMENT", 1, bgColors[2], colors[2]));
    models.add(new Model("QA", 1, bgColors[3], colors[3]));
    mArcProgressStackView.setModels(models);
    final ValueAnimator valueAnimator = ValueAnimator.ofFloat(1.0F, 105.0F);
    valueAnimator.setDuration(800);
    valueAnimator.setStartDelay(200);
    valueAnimator.setRepeatMode(ValueAnimator.RESTART);
    valueAnimator.setRepeatCount(MODEL_COUNT - 1);
    valueAnimator.addListener(new AnimatorListenerAdapter() {

        @Override
        public void onAnimationEnd(final Animator animation) {
            animation.removeListener(this);
            animation.addListener(this);
            mCounter = 0;
            for (final Model model : mArcProgressStackView.getModels()) model.setProgress(1);
            mArcProgressStackView.animateProgress();
        }

        @Override
        public void onAnimationRepeat(final Animator animation) {
            mCounter++;
        }
    });
    valueAnimator.addUpdateListener(new ValueAnimator.AnimatorUpdateListener() {

        @Override
        public void onAnimationUpdate(final ValueAnimator animation) {
            mArcProgressStackView.getModels().get(Math.min(mCounter, MODEL_COUNT - 1)).setProgress((Float) animation.getAnimatedValue());
            mArcProgressStackView.postInvalidate();
        }
    });
    mArcProgressStackView.setOnClickListener(new View.OnClickListener() {

        @Override
        public void onClick(final View v) {
            if (valueAnimator.isRunning())
                return;
            if (mArcProgressStackView.getProgressAnimator().isRunning())
                return;
            valueAnimator.start();
        }
    });
}
Example 96
Project: Auro-master  File: SearchAnimator.java View source code
@TargetApi(Build.VERSION_CODES.LOLLIPOP)
public static void revealOutAnimation(final Context mContext, View menuItem, final View animatedView, final int endCy, final int duration) {
    int[] location = new int[2];
    menuItem.getLocationOnScreen(location);
    int cx = location[0];
    int cy = location[1];
    if (cx != 0 && cy != 0) {
        float initialRadius = animatedView.getWidth();
        float finalRadius = 0.0f;
        Animator anim = ViewAnimationUtils.createCircularReveal(animatedView, cx, cy, initialRadius, finalRadius);
        anim.setInterpolator(new LinearOutSlowInInterpolator());
        anim.setDuration(duration);
        anim.addListener(new AnimatorListenerAdapter() {

            @Override
            public void onAnimationEnd(Animator animation) {
                super.onAnimationEnd(animation);
                animatedView.setVisibility(View.GONE);
            }
        });
        anim.start();
    }
}
Example 97
Project: banya-master  File: EntryActivity.java View source code
private void startAnim() {
    ObjectAnimator animatorX = ObjectAnimator.ofFloat(mSplashImage, "scaleX", 1f, SCALE_END);
    ObjectAnimator animatorY = ObjectAnimator.ofFloat(mSplashImage, "scaleY", 1f, SCALE_END);
    AnimatorSet set = new AnimatorSet();
    set.setDuration(ANIMATION_TIME).play(animatorX).with(animatorY);
    set.start();
    set.addListener(new AnimatorListenerAdapter() {

        @Override
        public void onAnimationEnd(Animator animation) {
            startActivity(new Intent(EntryActivity.this, MainActivity.class));
            EntryActivity.this.finish();
            overridePendingTransition(android.R.anim.fade_in, android.R.anim.fade_out);
        }
    });
}
Example 98
Project: bowser-master  File: SwipeToBoundListener.java View source code
@Override
public boolean onTouch(View v, MotionEvent event) {
    if (!callback.canSwipe()) {
        return false;
    }
    event.offsetLocation(translationX, 0);
    if (targetWidth < 2) {
        targetWidth = view.getWidth();
    }
    switch(event.getActionMasked()) {
        case MotionEvent.ACTION_DOWN:
            {
                downX = event.getRawX();
                velocityTracker = VelocityTracker.obtain();
                velocityTracker.addMovement(event);
                return false;
            }
        case MotionEvent.ACTION_UP:
            {
                if (velocityTracker == null) {
                    break;
                }
                velocityTracker.addMovement(event);
                velocityTracker.computeCurrentVelocity(1000);
                if (swiping) {
                    view.animate().translationX(0f).setDuration(animTime).setListener(new AnimatorListenerAdapter() {

                        @Override
                        public void onAnimationEnd(Animator animation) {
                            callback.onBound(canSwitch, swipingLeft);
                        }
                    });
                }
                downX = 0;
                translationX = 0;
                swiping = false;
                velocityTracker.recycle();
                velocityTracker = null;
                break;
            }
        case MotionEvent.ACTION_CANCEL:
            {
                if (velocityTracker == null) {
                    break;
                }
                view.animate().translationX(0f).setDuration(animTime).setListener(null);
                downX = 0;
                translationX = 0;
                swiping = false;
                velocityTracker.recycle();
                velocityTracker = null;
                break;
            }
        case MotionEvent.ACTION_MOVE:
            {
                if (velocityTracker == null) {
                    break;
                }
                velocityTracker.addMovement(event);
                float deltaX = event.getRawX() - downX;
                if (Math.abs(deltaX) > slop) {
                    swiping = true;
                    swipingLeft = deltaX < 0;
                    // Can switch tabs when deltaX >= 48 to prevent misuse
                    canSwitch = Math.abs(deltaX) >= ViewUnit.dp2px(view.getContext(), 48);
                    swipingSlop = (deltaX > 0 ? slop : -slop);
                    view.getParent().requestDisallowInterceptTouchEvent(true);
                    MotionEvent cancelEvent = MotionEvent.obtainNoHistory(event);
                    cancelEvent.setAction(MotionEvent.ACTION_CANCEL | (event.getActionIndex() << MotionEvent.ACTION_POINTER_INDEX_SHIFT));
                    view.onTouchEvent(cancelEvent);
                    cancelEvent.recycle();
                }
                if (swiping) {
                    translationX = deltaX;
                    view.setTranslationX(deltaX - swipingSlop);
                    callback.onSwipe();
                    return true;
                }
                break;
            }
    }
    return false;
}
Example 99
Project: CardStackView-master  File: AnimatorAdapter.java View source code
private void onItemExpand(final CardStackView.ViewHolder viewHolder, int position) {
    final int preSelectPosition = mCardStackView.getSelectPosition();
    final CardStackView.ViewHolder preSelectViewHolder = mCardStackView.getViewHolder(preSelectPosition);
    if (preSelectViewHolder != null) {
        preSelectViewHolder.onItemExpand(false);
    }
    mCardStackView.setSelectPosition(position);
    itemExpandAnimatorSet(viewHolder, position);
    mSet.addListener(new AnimatorListenerAdapter() {

        @Override
        public void onAnimationStart(Animator animation) {
            super.onAnimationStart(animation);
            mCardStackView.setScrollEnable(false);
            if (preSelectViewHolder != null) {
                preSelectViewHolder.onAnimationStateChange(CardStackView.ANIMATION_STATE_START, false);
            }
            viewHolder.onAnimationStateChange(CardStackView.ANIMATION_STATE_START, true);
        }

        @Override
        public void onAnimationEnd(Animator animation) {
            super.onAnimationEnd(animation);
            viewHolder.onItemExpand(true);
            if (preSelectViewHolder != null) {
                preSelectViewHolder.onAnimationStateChange(CardStackView.ANIMATION_STATE_END, false);
            }
            viewHolder.onAnimationStateChange(CardStackView.ANIMATION_STATE_END, true);
        }

        @Override
        public void onAnimationCancel(Animator animation) {
            super.onAnimationCancel(animation);
            if (preSelectViewHolder != null) {
                preSelectViewHolder.onAnimationStateChange(CardStackView.ANIMATION_STATE_CANCEL, false);
            }
            viewHolder.onAnimationStateChange(CardStackView.ANIMATION_STATE_CANCEL, true);
        }
    });
    mSet.start();
}
Example 100
Project: Charismatic_YiChang-master  File: RevealBackgroundView.java View source code
public void startFromLocation(int[] tapLocationOnScreen) {
    changeState(STATE_FILL_STARTED);
    startLocationX = tapLocationOnScreen[0];
    startLocationY = tapLocationOnScreen[1];
    revealAnimator = ObjectAnimator.ofInt(this, "currentRadius", 0, getWidth() + getHeight()).setDuration(FILL_TIME);
    revealAnimator.setInterpolator(INTERPOLATOR);
    revealAnimator.addListener(new AnimatorListenerAdapter() {

        @Override
        public void onAnimationEnd(Animator animation) {
            changeState(STATE_FINISHED);
        }
    });
    revealAnimator.start();
}
Example 101
Project: Common-master  File: GuiUtils.java View source code
// 圆圈爆炸效果显示
@TargetApi(Build.VERSION_CODES.LOLLIPOP)
public static void animateRevealShow(final Context context, final View view, final int startRadius, @ColorRes final int color, final OnRevealAnimationListener listener) {
    int cx = (view.getLeft() + view.getRight()) / 2;
    int cy = (view.getTop() + view.getBottom()) / 2;
    float finalRadius = (float) Math.hypot(view.getWidth(), view.getHeight());
    // 设置圆形显示动画
    Animator anim = ViewAnimationUtils.createCircularReveal(view, cx, cy, startRadius, finalRadius);
    anim.setDuration(600);
    anim.setInterpolator(new AccelerateDecelerateInterpolator());
    anim.addListener(new AnimatorListenerAdapter() {

        @Override
        public void onAnimationEnd(Animator animation) {
            super.onAnimationEnd(animation);
            view.setVisibility(View.VISIBLE);
            listener.onRevealShow();
        }

        @Override
        public void onAnimationStart(Animator animation) {
            super.onAnimationStart(animation);
            view.setBackgroundColor(ContextCompat.getColor(context, color));
        }
    });
    anim.start();
}