Search in sources :

Example 26 with DecelerateInterpolator

use of android.view.animation.DecelerateInterpolator in project NotificationPeekPort by lzanita09.

the class EverythingCard method hideOptions.

private void hideOptions() {
    if (!mOptionsShowing) {
        return;
    }
    mQuietHour.reset();
    if (mPanelSwitcher.getDisplayedChild() == 1) {
        mPanelSwitcher.showPrevious();
    }
    final int originalHeight = mPanelSwitcher.getHeight();
    ValueAnimator animator = ValueAnimator.ofInt(mPanelSwitcher.getHeight(), 0);
    animator.addUpdateListener(new ValueAnimator.AnimatorUpdateListener() {

        @Override
        public void onAnimationUpdate(ValueAnimator animation) {
            ViewGroup.LayoutParams params = mPanelSwitcher.getLayoutParams();
            params.height = (Integer) animation.getAnimatedValue();
            mPanelSwitcher.setLayoutParams(params);
        }
    });
    animator.setDuration(ANIM_DURATION);
    animator.setInterpolator(new DecelerateInterpolator());
    animator.addListener(new AnimatorListenerAdapter() {

        @Override
        public void onAnimationEnd(Animator animation) {
            super.onAnimationEnd(animation);
            mPanelSwitcher.setVisibility(GONE);
            ViewGroup.LayoutParams params = mPanelSwitcher.getLayoutParams();
            params.height = originalHeight;
            mPanelSwitcher.setLayoutParams(params);
            mFromBtn.setText(getContext().getString(R.string.from));
            mToBtn.setText(getContext().getString(R.string.to));
        }
    });
    animator.start();
    mOptionsShowing = false;
}
Also used : DecelerateInterpolator(android.view.animation.DecelerateInterpolator) Animator(android.animation.Animator) ValueAnimator(android.animation.ValueAnimator) AnimatorListenerAdapter(android.animation.AnimatorListenerAdapter) ValueAnimator(android.animation.ValueAnimator)

Example 27 with DecelerateInterpolator

use of android.view.animation.DecelerateInterpolator in project NotificationPeekPort by lzanita09.

the class NotificationLayout method showNotificationContent.

private void showNotificationContent() {
    if (mContentShowing) {
        // Content is already showing.
        return;
    }
    mContentShowing = true;
    StatusBarNotification selectedNotification = (StatusBarNotification) mNotificationPeek.getNotificationView().getTag();
    View contentView = PeekLayoutFactory.createPeekLayout(getContext(), PeekLayoutFactory.LAYOUT_TYPE_CONTENT, selectedNotification);
    contentView.setId(R.id.notification_content);
    RelativeLayout.LayoutParams params = new RelativeLayout.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.MATCH_PARENT);
    params.addRule(RelativeLayout.ABOVE, R.id.notification_layout);
    contentView.setLayoutParams(params);
    // Animations.
    LinearLayout contentTextLayout = (LinearLayout) contentView.findViewById(R.id.content_layout);
    contentTextLayout.setTranslationY(50);
    contentView.setAlpha(0);
    ((ViewGroup) getParent()).addView(contentView);
    contentView.animate().alpha(1f).setInterpolator(new DecelerateInterpolator()).start();
    contentTextLayout.animate().translationY(0).setInterpolator(new DecelerateInterpolator()).start();
    // Send broadcast to NotificationPeekActivity and let it hide the other components
    // when the content is displayed.
    Intent intent = new Intent(NotificationPeekActivity.NotificationPeekReceiver.ACTION_SHOW_CONTENT);
    getContext().sendBroadcast(intent);
}
Also used : DecelerateInterpolator(android.view.animation.DecelerateInterpolator) StatusBarNotification(android.service.notification.StatusBarNotification) ViewGroup(android.view.ViewGroup) RelativeLayout(android.widget.RelativeLayout) Intent(android.content.Intent) View(android.view.View) LinearLayout(android.widget.LinearLayout)

Example 28 with DecelerateInterpolator

use of android.view.animation.DecelerateInterpolator in project AdvancedMaterialDrawer by madcyph3r.

the class MaterialRippleLayoutNineOld method startRipple.

private void startRipple(final Runnable animationEndRunnable) {
    if (eventCancelled)
        return;
    float endRadius = getEndRadius();
    cancelAnimations();
    rippleAnimator = new AnimatorSet();
    rippleAnimator.addListener(new AnimatorListenerAdapter() {

        @Override
        public void onAnimationEnd(Animator animation) {
            if (!ripplePersistent) {
                setRadius(0);
                setRippleAlpha(rippleAlpha);
            }
            if (animationEndRunnable != null && rippleDelayClick) {
                animationEndRunnable.run();
            }
            childView.setPressed(false);
        }
    });
    ObjectAnimator ripple = ObjectAnimator.ofFloat(this, radiusProperty, radius, endRadius);
    ripple.setDuration(rippleDuration);
    ripple.setInterpolator(new DecelerateInterpolator());
    ObjectAnimator fade = ObjectAnimator.ofInt(this, circleAlphaProperty, rippleAlpha, 0);
    fade.setDuration(rippleFadeDuration);
    fade.setInterpolator(new AccelerateInterpolator());
    fade.setStartDelay(rippleDuration - rippleFadeDuration - FADE_EXTRA_DELAY);
    if (ripplePersistent) {
        rippleAnimator.play(ripple);
    } else if (getRadius() > endRadius) {
        fade.setStartDelay(0);
        rippleAnimator.play(fade);
    } else {
        rippleAnimator.playTogether(ripple, fade);
    }
    rippleAnimator.start();
}
Also used : DecelerateInterpolator(android.view.animation.DecelerateInterpolator) ObjectAnimator(com.nineoldandroids.animation.ObjectAnimator) Animator(com.nineoldandroids.animation.Animator) AccelerateInterpolator(android.view.animation.AccelerateInterpolator) AnimatorListenerAdapter(com.nineoldandroids.animation.AnimatorListenerAdapter) ObjectAnimator(com.nineoldandroids.animation.ObjectAnimator) AnimatorSet(com.nineoldandroids.animation.AnimatorSet)

Example 29 with DecelerateInterpolator

use of android.view.animation.DecelerateInterpolator in project AdvancedMaterialDrawer by madcyph3r.

the class MaterialRippleLayout method startRipple.

@TargetApi(14)
private void startRipple(final Runnable animationEndRunnable) {
    if (eventCancelled)
        return;
    float endRadius = getEndRadius();
    cancelAnimations();
    rippleAnimator = new AnimatorSet();
    rippleAnimator.addListener(new AnimatorListenerAdapter() {

        @Override
        public void onAnimationEnd(Animator animation) {
            if (!ripplePersistent) {
                setRadius(0);
                setRippleAlpha(rippleAlpha);
            }
            if (animationEndRunnable != null && rippleDelayClick) {
                animationEndRunnable.run();
            }
            childView.setPressed(false);
        }
    });
    ObjectAnimator ripple = ObjectAnimator.ofFloat(this, radiusProperty(), radius, endRadius);
    ripple.setDuration(rippleDuration);
    ripple.setInterpolator(new DecelerateInterpolator());
    ObjectAnimator fade = ObjectAnimator.ofInt(this, circleAlphaProperty(), rippleAlpha, 0);
    fade.setDuration(rippleFadeDuration);
    fade.setInterpolator(new AccelerateInterpolator());
    fade.setStartDelay(rippleDuration - rippleFadeDuration - FADE_EXTRA_DELAY);
    if (ripplePersistent) {
        rippleAnimator.play(ripple);
    } else if (getRadius() > endRadius) {
        fade.setStartDelay(0);
        rippleAnimator.play(fade);
    } else {
        rippleAnimator.playTogether(ripple, fade);
    }
    rippleAnimator.start();
}
Also used : DecelerateInterpolator(android.view.animation.DecelerateInterpolator) Animator(android.animation.Animator) ObjectAnimator(android.animation.ObjectAnimator) AccelerateInterpolator(android.view.animation.AccelerateInterpolator) AnimatorListenerAdapter(android.animation.AnimatorListenerAdapter) ObjectAnimator(android.animation.ObjectAnimator) AnimatorSet(android.animation.AnimatorSet) TargetApi(android.annotation.TargetApi)

Example 30 with DecelerateInterpolator

use of android.view.animation.DecelerateInterpolator in project material by rey5137.

the class DatePicker method applyStyle.

@Override
protected void applyStyle(Context context, AttributeSet attrs, int defStyleAttr, int defStyleRes) {
    super.applyStyle(context, attrs, defStyleAttr, defStyleRes);
    TypedArray a = context.obtainStyledAttributes(attrs, R.styleable.DatePicker, defStyleAttr, defStyleRes);
    String familyName = null;
    int style = -1;
    int padding = -1;
    int paddingLeft = -1;
    int paddingRight = -1;
    int paddingTop = -1;
    int paddingBottom = -1;
    boolean paddingDefined = false;
    for (int i = 0, count = a.getIndexCount(); i < count; i++) {
        int attr = a.getIndex(i);
        if (attr == R.styleable.DatePicker_dp_dayTextSize)
            mTextSize = a.getDimensionPixelSize(attr, 0);
        else if (attr == R.styleable.DatePicker_dp_textColor)
            mTextColor = a.getColor(attr, 0);
        else if (attr == R.styleable.DatePicker_dp_textHighlightColor)
            mTextHighlightColor = a.getColor(attr, 0);
        else if (attr == R.styleable.DatePicker_dp_textLabelColor)
            mTextLabelColor = a.getColor(attr, 0);
        else if (attr == R.styleable.DatePicker_dp_textDisableColor)
            mTextDisableColor = a.getColor(attr, 0);
        else if (attr == R.styleable.DatePicker_dp_selectionColor)
            mSelectionColor = a.getColor(attr, 0);
        else if (attr == R.styleable.DatePicker_dp_animDuration)
            mAnimDuration = a.getInteger(attr, 0);
        else if (attr == R.styleable.DatePicker_dp_inInterpolator)
            mInInterpolator = AnimationUtils.loadInterpolator(context, a.getResourceId(attr, 0));
        else if (attr == R.styleable.DatePicker_dp_outInterpolator)
            mOutInterpolator = AnimationUtils.loadInterpolator(context, a.getResourceId(attr, 0));
        else if (attr == R.styleable.DatePicker_dp_fontFamily)
            familyName = a.getString(attr);
        else if (attr == R.styleable.DatePicker_dp_textStyle)
            style = a.getInteger(attr, 0);
        else if (attr == R.styleable.DatePicker_android_padding) {
            padding = a.getDimensionPixelSize(attr, 0);
            paddingDefined = true;
        } else if (attr == R.styleable.DatePicker_android_paddingLeft) {
            paddingLeft = a.getDimensionPixelSize(attr, 0);
            paddingDefined = true;
        } else if (attr == R.styleable.DatePicker_android_paddingTop) {
            paddingTop = a.getDimensionPixelSize(attr, 0);
            paddingDefined = true;
        } else if (attr == R.styleable.DatePicker_android_paddingRight) {
            paddingRight = a.getDimensionPixelSize(attr, 0);
            paddingDefined = true;
        } else if (attr == R.styleable.DatePicker_android_paddingBottom) {
            paddingBottom = a.getDimensionPixelSize(attr, 0);
            paddingDefined = true;
        }
    }
    if (mTextSize < 0)
        mTextSize = context.getResources().getDimensionPixelOffset(R.dimen.abc_text_size_caption_material);
    if (mAnimDuration < 0)
        mAnimDuration = context.getResources().getInteger(android.R.integer.config_mediumAnimTime);
    if (mInInterpolator == null)
        mInInterpolator = new DecelerateInterpolator();
    if (mOutInterpolator == null)
        mOutInterpolator = new DecelerateInterpolator();
    if (familyName != null || style >= 0)
        mTypeface = TypefaceUtil.load(context, familyName, style);
    a.recycle();
    if (paddingDefined) {
        if (padding >= 0)
            setContentPadding(padding, padding, padding, padding);
        if (paddingLeft >= 0)
            mPaddingLeft = paddingLeft;
        if (paddingTop >= 0)
            mPaddingTop = paddingTop;
        if (paddingRight >= 0)
            mPaddingRight = paddingRight;
        if (paddingBottom >= 0)
            mPaddingBottom = paddingBottom;
    }
    requestLayout();
    mAdapter.notifyDataSetInvalidated();
}
Also used : DecelerateInterpolator(android.view.animation.DecelerateInterpolator) TypedArray(android.content.res.TypedArray) Paint(android.graphics.Paint)

Aggregations

DecelerateInterpolator (android.view.animation.DecelerateInterpolator)312 ObjectAnimator (android.animation.ObjectAnimator)80 Animator (android.animation.Animator)66 ValueAnimator (android.animation.ValueAnimator)59 View (android.view.View)58 AccelerateInterpolator (android.view.animation.AccelerateInterpolator)55 AnimatorSet (android.animation.AnimatorSet)52 AnimatorListenerAdapter (android.animation.AnimatorListenerAdapter)36 ImageView (android.widget.ImageView)32 AlphaAnimation (android.view.animation.AlphaAnimation)30 AccelerateDecelerateInterpolator (android.view.animation.AccelerateDecelerateInterpolator)29 Animation (android.view.animation.Animation)21 TextView (android.widget.TextView)20 Point (android.graphics.Point)18 ValueAnimator (com.nineoldandroids.animation.ValueAnimator)18 Paint (android.graphics.Paint)14 LinearInterpolator (android.view.animation.LinearInterpolator)14 ScaleAnimation (android.view.animation.ScaleAnimation)14 AnimatorSet (com.actionbarsherlock.internal.nineoldandroids.animation.AnimatorSet)14 ObjectAnimator (com.actionbarsherlock.internal.nineoldandroids.animation.ObjectAnimator)14