Search in sources :

Example 1 with AnticipateInterpolator

use of android.view.animation.AnticipateInterpolator in project GSYVideoPlayer by CarGuo.

the class ENPlayView method pause.

public void pause() {
    if (mCurrentState == STATE_PAUSE) {
        return;
    }
    mCurrentState = STATE_PAUSE;
    ValueAnimator valueAnimator = ValueAnimator.ofFloat(1.f, 100.f);
    valueAnimator.setDuration(mDuration);
    valueAnimator.setInterpolator(new AnticipateInterpolator());
    valueAnimator.addUpdateListener(new ValueAnimator.AnimatorUpdateListener() {

        @Override
        public void onAnimationUpdate(ValueAnimator valueAnimator) {
            mFraction = valueAnimator.getAnimatedFraction();
            invalidate();
        }
    });
    if (!valueAnimator.isRunning()) {
        valueAnimator.start();
    }
}
Also used : ValueAnimator(android.animation.ValueAnimator) AnticipateInterpolator(android.view.animation.AnticipateInterpolator)

Example 2 with AnticipateInterpolator

use of android.view.animation.AnticipateInterpolator in project GSYVideoPlayer by CarGuo.

the class ENPlayView method play.

public void play() {
    if (mCurrentState == STATE_PLAY) {
        return;
    }
    mCurrentState = STATE_PLAY;
    ValueAnimator valueAnimator = ValueAnimator.ofFloat(1.f, 100.f);
    valueAnimator.setDuration(mDuration);
    valueAnimator.setInterpolator(new AnticipateInterpolator());
    valueAnimator.addUpdateListener(new ValueAnimator.AnimatorUpdateListener() {

        @Override
        public void onAnimationUpdate(ValueAnimator valueAnimator) {
            mFraction = 1 - valueAnimator.getAnimatedFraction();
            invalidate();
        }
    });
    if (!valueAnimator.isRunning()) {
        valueAnimator.start();
    }
}
Also used : ValueAnimator(android.animation.ValueAnimator) AnticipateInterpolator(android.view.animation.AnticipateInterpolator)

Example 3 with AnticipateInterpolator

use of android.view.animation.AnticipateInterpolator in project FloatingActionButton by Clans.

the class FloatingActionMenu method init.

private void init(Context context, AttributeSet attrs) {
    TypedArray attr = context.obtainStyledAttributes(attrs, R.styleable.FloatingActionMenu, 0, 0);
    mButtonSpacing = attr.getDimensionPixelSize(R.styleable.FloatingActionMenu_menu_buttonSpacing, mButtonSpacing);
    mLabelsMargin = attr.getDimensionPixelSize(R.styleable.FloatingActionMenu_menu_labels_margin, mLabelsMargin);
    mLabelsPosition = attr.getInt(R.styleable.FloatingActionMenu_menu_labels_position, LABELS_POSITION_LEFT);
    mLabelsShowAnimation = attr.getResourceId(R.styleable.FloatingActionMenu_menu_labels_showAnimation, mLabelsPosition == LABELS_POSITION_LEFT ? R.anim.fab_slide_in_from_right : R.anim.fab_slide_in_from_left);
    mLabelsHideAnimation = attr.getResourceId(R.styleable.FloatingActionMenu_menu_labels_hideAnimation, mLabelsPosition == LABELS_POSITION_LEFT ? R.anim.fab_slide_out_to_right : R.anim.fab_slide_out_to_left);
    mLabelsPaddingTop = attr.getDimensionPixelSize(R.styleable.FloatingActionMenu_menu_labels_paddingTop, mLabelsPaddingTop);
    mLabelsPaddingRight = attr.getDimensionPixelSize(R.styleable.FloatingActionMenu_menu_labels_paddingRight, mLabelsPaddingRight);
    mLabelsPaddingBottom = attr.getDimensionPixelSize(R.styleable.FloatingActionMenu_menu_labels_paddingBottom, mLabelsPaddingBottom);
    mLabelsPaddingLeft = attr.getDimensionPixelSize(R.styleable.FloatingActionMenu_menu_labels_paddingLeft, mLabelsPaddingLeft);
    mLabelsTextColor = attr.getColorStateList(R.styleable.FloatingActionMenu_menu_labels_textColor);
    // set default value if null same as for textview
    if (mLabelsTextColor == null) {
        mLabelsTextColor = ColorStateList.valueOf(Color.WHITE);
    }
    mLabelsTextSize = attr.getDimension(R.styleable.FloatingActionMenu_menu_labels_textSize, getResources().getDimension(R.dimen.labels_text_size));
    mLabelsCornerRadius = attr.getDimensionPixelSize(R.styleable.FloatingActionMenu_menu_labels_cornerRadius, mLabelsCornerRadius);
    mLabelsShowShadow = attr.getBoolean(R.styleable.FloatingActionMenu_menu_labels_showShadow, true);
    mLabelsColorNormal = attr.getColor(R.styleable.FloatingActionMenu_menu_labels_colorNormal, 0xFF333333);
    mLabelsColorPressed = attr.getColor(R.styleable.FloatingActionMenu_menu_labels_colorPressed, 0xFF444444);
    mLabelsColorRipple = attr.getColor(R.styleable.FloatingActionMenu_menu_labels_colorRipple, 0x66FFFFFF);
    mMenuShowShadow = attr.getBoolean(R.styleable.FloatingActionMenu_menu_showShadow, true);
    mMenuShadowColor = attr.getColor(R.styleable.FloatingActionMenu_menu_shadowColor, 0x66000000);
    mMenuShadowRadius = attr.getDimension(R.styleable.FloatingActionMenu_menu_shadowRadius, mMenuShadowRadius);
    mMenuShadowXOffset = attr.getDimension(R.styleable.FloatingActionMenu_menu_shadowXOffset, mMenuShadowXOffset);
    mMenuShadowYOffset = attr.getDimension(R.styleable.FloatingActionMenu_menu_shadowYOffset, mMenuShadowYOffset);
    mMenuColorNormal = attr.getColor(R.styleable.FloatingActionMenu_menu_colorNormal, 0xFFDA4336);
    mMenuColorPressed = attr.getColor(R.styleable.FloatingActionMenu_menu_colorPressed, 0xFFE75043);
    mMenuColorRipple = attr.getColor(R.styleable.FloatingActionMenu_menu_colorRipple, 0x99FFFFFF);
    mAnimationDelayPerItem = attr.getInt(R.styleable.FloatingActionMenu_menu_animationDelayPerItem, 50);
    mIcon = attr.getDrawable(R.styleable.FloatingActionMenu_menu_icon);
    if (mIcon == null) {
        mIcon = getResources().getDrawable(R.drawable.fab_add);
    }
    mLabelsSingleLine = attr.getBoolean(R.styleable.FloatingActionMenu_menu_labels_singleLine, false);
    mLabelsEllipsize = attr.getInt(R.styleable.FloatingActionMenu_menu_labels_ellipsize, 0);
    mLabelsMaxLines = attr.getInt(R.styleable.FloatingActionMenu_menu_labels_maxLines, -1);
    mMenuFabSize = attr.getInt(R.styleable.FloatingActionMenu_menu_fab_size, FloatingActionButton.SIZE_NORMAL);
    mLabelsStyle = attr.getResourceId(R.styleable.FloatingActionMenu_menu_labels_style, 0);
    String customFont = attr.getString(R.styleable.FloatingActionMenu_menu_labels_customFont);
    try {
        if (!TextUtils.isEmpty(customFont)) {
            mCustomTypefaceFromFont = Typeface.createFromAsset(getContext().getAssets(), customFont);
        }
    } catch (RuntimeException ex) {
        throw new IllegalArgumentException("Unable to load specified custom font: " + customFont, ex);
    }
    mOpenDirection = attr.getInt(R.styleable.FloatingActionMenu_menu_openDirection, OPEN_UP);
    mBackgroundColor = attr.getColor(R.styleable.FloatingActionMenu_menu_backgroundColor, Color.TRANSPARENT);
    if (attr.hasValue(R.styleable.FloatingActionMenu_menu_fab_label)) {
        mUsingMenuLabel = true;
        mMenuLabelText = attr.getString(R.styleable.FloatingActionMenu_menu_fab_label);
    }
    if (attr.hasValue(R.styleable.FloatingActionMenu_menu_labels_padding)) {
        int padding = attr.getDimensionPixelSize(R.styleable.FloatingActionMenu_menu_labels_padding, 0);
        initPadding(padding);
    }
    mOpenInterpolator = new OvershootInterpolator();
    mCloseInterpolator = new AnticipateInterpolator();
    mLabelsContext = new ContextThemeWrapper(getContext(), mLabelsStyle);
    initBackgroundDimAnimation();
    createMenuButton();
    initMenuButtonAnimations(attr);
    attr.recycle();
}
Also used : OvershootInterpolator(android.view.animation.OvershootInterpolator) ContextThemeWrapper(android.view.ContextThemeWrapper) TypedArray(android.content.res.TypedArray) AnticipateInterpolator(android.view.animation.AnticipateInterpolator)

Example 4 with AnticipateInterpolator

use of android.view.animation.AnticipateInterpolator in project android_packages_apps_Dialer by LineageOS.

the class Bubble method hide.

/**
 * Hide the button if visible. Will run a short exit animation before hiding. If the bubble is
 * currently showing text, will hide after the text is done displaying. If the bubble is not
 * visible this method does nothing.
 */
public void hide() {
    if (visibility == Visibility.HIDDEN || visibility == Visibility.EXITING) {
        return;
    }
    if (textShowing) {
        hideAfterText = true;
        return;
    }
    if (collapseAnimation != null) {
        collapseEndAction = CollapseEnd.HIDE;
        return;
    }
    if (expanded) {
        startCollapse(CollapseEnd.HIDE);
        return;
    }
    visibility = Visibility.EXITING;
    exitAnimator = viewHolder.getPrimaryButton().animate().setInterpolator(new AnticipateInterpolator()).scaleX(0).scaleY(0).withEndAction(() -> {
        exitAnimator = null;
        windowManager.removeView(viewHolder.getRoot());
        visibility = Visibility.HIDDEN;
        updatePrimaryIconAnimation();
    });
    exitAnimator.start();
}
Also used : AnticipateInterpolator(android.view.animation.AnticipateInterpolator)

Example 5 with AnticipateInterpolator

use of android.view.animation.AnticipateInterpolator in project samourai-wallet-android by Samourai-Wallet.

the class BalanceActivity method rotateTxStatus.

private void rotateTxStatus(View view, boolean clockwise) {
    float degrees = 360f;
    if (!clockwise) {
        degrees = -360f;
    }
    ObjectAnimator animation = ObjectAnimator.ofFloat(view, "rotationY", 0.0f, degrees);
    animation.setDuration(1000);
    animation.setRepeatCount(0);
    animation.setInterpolator(new AnticipateInterpolator());
    animation.start();
}
Also used : ObjectAnimator(android.animation.ObjectAnimator) AnticipateInterpolator(android.view.animation.AnticipateInterpolator)

Aggregations

AnticipateInterpolator (android.view.animation.AnticipateInterpolator)17 OvershootInterpolator (android.view.animation.OvershootInterpolator)8 ObjectAnimator (android.animation.ObjectAnimator)6 ValueAnimator (android.animation.ValueAnimator)4 AccelerateDecelerateInterpolator (android.view.animation.AccelerateDecelerateInterpolator)4 AccelerateInterpolator (android.view.animation.AccelerateInterpolator)4 AnticipateOvershootInterpolator (android.view.animation.AnticipateOvershootInterpolator)4 BounceInterpolator (android.view.animation.BounceInterpolator)4 DecelerateInterpolator (android.view.animation.DecelerateInterpolator)4 LinearInterpolator (android.view.animation.LinearInterpolator)4 TypedArray (android.content.res.TypedArray)3 ContextThemeWrapper (android.view.ContextThemeWrapper)3 Animation (android.view.animation.Animation)2 ScaleAnimation (android.view.animation.ScaleAnimation)2 AccountManagerCallback (android.accounts.AccountManagerCallback)1 AccountManagerFuture (android.accounts.AccountManagerFuture)1 Intent (android.content.Intent)1 Resources (android.content.res.Resources)1 Bundle (android.os.Bundle)1 ActionMenuView (android.support.v7.widget.ActionMenuView)1