Search in sources :

Example 6 with AnimatorSet

use of com.nineoldandroids.animation.AnimatorSet in project Libraries-for-Android-Developers by eoecn.

the class ResideMenu method showMenuItem.

/**
     *
     * @param menuItem
     * @param menu_index the position of the menu;
     * @return
     */
private void showMenuItem(ResideMenuItem menuItem, int menu_index) {
    layout_menu.addView(menuItem);
    ViewHelper.setAlpha(menuItem, 0);
    AnimatorSet scaleUp = new AnimatorSet();
    scaleUp.playTogether(ObjectAnimator.ofFloat(menuItem, "translationX", -100.f, 0.0f), ObjectAnimator.ofFloat(menuItem, "alpha", 0.0f, 1.0f));
    scaleUp.setInterpolator(AnimationUtils.loadInterpolator(activity, android.R.anim.anticipate_overshoot_interpolator));
    // with animation;
    scaleUp.setStartDelay(50 * menu_index);
    scaleUp.setDuration(400).start();
}
Also used : AnimatorSet(com.nineoldandroids.animation.AnimatorSet)

Example 7 with AnimatorSet

use of com.nineoldandroids.animation.AnimatorSet in project Libraries-for-Android-Developers by eoecn.

the class ResideMenu method buildScaleDownAnimation.

/**
     * a helper method to build scale down animation;
     *
     * @param target
     * @param targetScaleX
     * @param targetScaleY
     * @return
     */
private AnimatorSet buildScaleDownAnimation(View target, float targetScaleX, float targetScaleY) {
    // set the pivotX and pivotY to scale;
    int pivotX = (int) (getScreenWidth() * 1.5);
    int pivotY = (int) (getScreenHeight() * 0.5);
    ViewHelper.setPivotX(target, pivotX);
    ViewHelper.setPivotY(target, pivotY);
    AnimatorSet scaleDown = new AnimatorSet();
    scaleDown.playTogether(ObjectAnimator.ofFloat(target, "scaleX", targetScaleX), ObjectAnimator.ofFloat(target, "scaleY", targetScaleY));
    scaleDown.setInterpolator(AnimationUtils.loadInterpolator(activity, android.R.anim.decelerate_interpolator));
    scaleDown.setDuration(250);
    return scaleDown;
}
Also used : AnimatorSet(com.nineoldandroids.animation.AnimatorSet)

Example 8 with AnimatorSet

use of com.nineoldandroids.animation.AnimatorSet in project Libraries-for-Android-Developers by eoecn.

the class ResideMenu method buildScaleUpAnimation.

/**
     * a helper method to build scale up animation;
     *
     * @param target
     * @param targetScaleX
     * @param targetScaleY
     * @return
     */
private AnimatorSet buildScaleUpAnimation(View target, float targetScaleX, float targetScaleY) {
    AnimatorSet scaleUp = new AnimatorSet();
    scaleUp.playTogether(ObjectAnimator.ofFloat(target, "scaleX", targetScaleX), ObjectAnimator.ofFloat(target, "scaleY", targetScaleY));
    scaleUp.setDuration(250);
    return scaleUp;
}
Also used : AnimatorSet(com.nineoldandroids.animation.AnimatorSet)

Example 9 with AnimatorSet

use of com.nineoldandroids.animation.AnimatorSet in project HoloEverywhere by Prototik.

the class RadialPickerLayout method setCurrentItemShowing.

/**
     * Set either minutes or hours as showing.
     *
     * @param animate True to animate the transition, false to show with no animation.
     */
public void setCurrentItemShowing(int index, boolean animate) {
    if (index != HOUR_INDEX && index != MINUTE_INDEX) {
        Log.e(TAG, "TimePicker does not support view at index " + index);
        return;
    }
    int lastIndex = getCurrentItemShowing();
    mCurrentItemShowing = index;
    if (animate && (index != lastIndex)) {
        ObjectAnimator[] anims = new ObjectAnimator[4];
        if (index == MINUTE_INDEX) {
            anims[0] = mHourRadialTextsView.getDisappearAnimator();
            anims[1] = mHourRadialSelectorView.getDisappearAnimator();
            anims[2] = mMinuteRadialTextsView.getReappearAnimator();
            anims[3] = mMinuteRadialSelectorView.getReappearAnimator();
        } else if (index == HOUR_INDEX) {
            anims[0] = mHourRadialTextsView.getReappearAnimator();
            anims[1] = mHourRadialSelectorView.getReappearAnimator();
            anims[2] = mMinuteRadialTextsView.getDisappearAnimator();
            anims[3] = mMinuteRadialSelectorView.getDisappearAnimator();
        }
        if (mTransition != null && mTransition.isRunning()) {
            mTransition.end();
        }
        mTransition = new AnimatorSet();
        mTransition.playTogether(anims);
        mTransition.start();
    } else {
        int hourAlpha = (index == HOUR_INDEX) ? 255 : 0;
        int minuteAlpha = (index == MINUTE_INDEX) ? 255 : 0;
        mHourRadialTextsView.setAlpha(hourAlpha);
        mHourRadialSelectorView.setAlpha(hourAlpha);
        mMinuteRadialTextsView.setAlpha(minuteAlpha);
        mMinuteRadialSelectorView.setAlpha(minuteAlpha);
    }
}
Also used : ObjectAnimator(com.nineoldandroids.animation.ObjectAnimator) AnimatorSet(com.nineoldandroids.animation.AnimatorSet) SuppressLint(android.annotation.SuppressLint)

Example 10 with AnimatorSet

use of com.nineoldandroids.animation.AnimatorSet in project AndroidResideMenu by SpecialCyCi.

the class ResideMenu method closeMenu.

/**
     * Close the menu;
     */
public void closeMenu() {
    isOpened = false;
    AnimatorSet scaleUp_activity = buildScaleUpAnimation(viewActivity, 1.0f, 1.0f);
    AnimatorSet scaleUp_shadow = buildScaleUpAnimation(imageViewShadow, 1.0f, 1.0f);
    AnimatorSet alpha_menu = buildMenuAnimation(scrollViewMenu, 0.0f);
    scaleUp_activity.addListener(animationListener);
    scaleUp_activity.playTogether(scaleUp_shadow);
    scaleUp_activity.playTogether(alpha_menu);
    scaleUp_activity.start();
}
Also used : AnimatorSet(com.nineoldandroids.animation.AnimatorSet)

Aggregations

AnimatorSet (com.nineoldandroids.animation.AnimatorSet)57 ObjectAnimator (com.nineoldandroids.animation.ObjectAnimator)42 Animator (com.nineoldandroids.animation.Animator)24 AnimatorListenerAdapter (com.nineoldandroids.animation.AnimatorListenerAdapter)11 View (android.view.View)6 AccelerateInterpolator (android.view.animation.AccelerateInterpolator)4 DecelerateInterpolator (android.view.animation.DecelerateInterpolator)4 SuppressLint (android.annotation.SuppressLint)3 Paint (android.graphics.Paint)3 OvershootInterpolator (android.view.animation.OvershootInterpolator)3 Point (android.graphics.Point)2 DisplayMetrics (android.util.DisplayMetrics)2 LinearInterpolator (android.view.animation.LinearInterpolator)2 AdapterView (android.widget.AdapterView)2 ImageView (android.widget.ImageView)2 TextView (android.widget.TextView)2 ValueAnimator (com.nineoldandroids.animation.ValueAnimator)2 IDetailView (com.yydcdut.note.views.note.IDetailView)2 FontTextView (com.yydcdut.note.widget.FontTextView)2 RevealView (com.yydcdut.note.widget.RevealView)2