Search in sources :

Example 6 with FastOutLinearInInterpolator

use of android.support.v4.view.animation.FastOutLinearInInterpolator in project Transitions-Everywhere by andkulikov.

the class ScaleSample method onCreateView.

@Nullable
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
    View view = inflater.inflate(R.layout.fragment_scale, container, false);
    final ViewGroup transitionsContainer = (ViewGroup) view.findViewById(R.id.transitions_container);
    final TextView text1 = (TextView) transitionsContainer.findViewById(R.id.text1);
    transitionsContainer.findViewById(R.id.button1).setOnClickListener(new VisibleToggleClickListener() {

        @Override
        protected void changeVisibility(boolean visible) {
            TransitionManager.beginDelayedTransition(transitionsContainer, new Scale());
            text1.setVisibility(visible ? View.VISIBLE : View.INVISIBLE);
        }
    });
    final TextView text2 = (TextView) transitionsContainer.findViewById(R.id.text2);
    transitionsContainer.findViewById(R.id.button2).setOnClickListener(new VisibleToggleClickListener() {

        @Override
        protected void changeVisibility(boolean visible) {
            TransitionSet set = new TransitionSet().addTransition(new Scale(0.7f)).addTransition(new Fade()).setInterpolator(visible ? new LinearOutSlowInInterpolator() : new FastOutLinearInInterpolator());
            TransitionManager.beginDelayedTransition(transitionsContainer, set);
            text2.setVisibility(visible ? View.VISIBLE : View.INVISIBLE);
        }
    });
    return view;
}
Also used : LinearOutSlowInInterpolator(android.support.v4.view.animation.LinearOutSlowInInterpolator) TransitionSet(com.transitionseverywhere.TransitionSet) ViewGroup(android.view.ViewGroup) FastOutLinearInInterpolator(android.support.v4.view.animation.FastOutLinearInInterpolator) TextView(android.widget.TextView) Scale(com.transitionseverywhere.extra.Scale) TextView(android.widget.TextView) View(android.view.View) Fade(com.transitionseverywhere.Fade) Nullable(android.support.annotation.Nullable)

Example 7 with FastOutLinearInInterpolator

use of android.support.v4.view.animation.FastOutLinearInInterpolator in project Android-Week-View by alamkanak.

the class WeekView method init.

private void init() {
    // Scrolling initialization.
    mGestureDetector = new GestureDetectorCompat(mContext, mGestureListener);
    mScroller = new OverScroller(mContext, new FastOutLinearInInterpolator());
    mMinimumFlingVelocity = ViewConfiguration.get(mContext).getScaledMinimumFlingVelocity();
    mScaledTouchSlop = ViewConfiguration.get(mContext).getScaledTouchSlop();
    // Measure settings for time column.
    mTimeTextPaint = new Paint(Paint.ANTI_ALIAS_FLAG);
    mTimeTextPaint.setTextAlign(Paint.Align.RIGHT);
    mTimeTextPaint.setTextSize(mTextSize);
    mTimeTextPaint.setColor(mHeaderColumnTextColor);
    Rect rect = new Rect();
    mTimeTextPaint.getTextBounds("00 PM", 0, "00 PM".length(), rect);
    mTimeTextHeight = rect.height();
    mHeaderMarginBottom = mTimeTextHeight / 2;
    initTextTimeWidth();
    // Measure settings for header row.
    mHeaderTextPaint = new Paint(Paint.ANTI_ALIAS_FLAG);
    mHeaderTextPaint.setColor(mHeaderColumnTextColor);
    mHeaderTextPaint.setTextAlign(Paint.Align.CENTER);
    mHeaderTextPaint.setTextSize(mTextSize);
    mHeaderTextPaint.getTextBounds("00 PM", 0, "00 PM".length(), rect);
    mHeaderTextHeight = rect.height();
    mHeaderTextPaint.setTypeface(Typeface.DEFAULT_BOLD);
    // Prepare header background paint.
    mHeaderBackgroundPaint = new Paint();
    mHeaderBackgroundPaint.setColor(mHeaderRowBackgroundColor);
    // Prepare day background color paint.
    mDayBackgroundPaint = new Paint();
    mDayBackgroundPaint.setColor(mDayBackgroundColor);
    mFutureBackgroundPaint = new Paint();
    mFutureBackgroundPaint.setColor(mFutureBackgroundColor);
    mPastBackgroundPaint = new Paint();
    mPastBackgroundPaint.setColor(mPastBackgroundColor);
    mFutureWeekendBackgroundPaint = new Paint();
    mFutureWeekendBackgroundPaint.setColor(mFutureWeekendBackgroundColor);
    mPastWeekendBackgroundPaint = new Paint();
    mPastWeekendBackgroundPaint.setColor(mPastWeekendBackgroundColor);
    // Prepare hour separator color paint.
    mHourSeparatorPaint = new Paint();
    mHourSeparatorPaint.setStyle(Paint.Style.STROKE);
    mHourSeparatorPaint.setStrokeWidth(mHourSeparatorHeight);
    mHourSeparatorPaint.setColor(mHourSeparatorColor);
    // Prepare the "now" line color paint
    mNowLinePaint = new Paint();
    mNowLinePaint.setStrokeWidth(mNowLineThickness);
    mNowLinePaint.setColor(mNowLineColor);
    // Prepare today background color paint.
    mTodayBackgroundPaint = new Paint();
    mTodayBackgroundPaint.setColor(mTodayBackgroundColor);
    // Prepare today header text color paint.
    mTodayHeaderTextPaint = new Paint(Paint.ANTI_ALIAS_FLAG);
    mTodayHeaderTextPaint.setTextAlign(Paint.Align.CENTER);
    mTodayHeaderTextPaint.setTextSize(mTextSize);
    mTodayHeaderTextPaint.setTypeface(Typeface.DEFAULT_BOLD);
    mTodayHeaderTextPaint.setColor(mTodayHeaderTextColor);
    // Prepare event background color.
    mEventBackgroundPaint = new Paint();
    mEventBackgroundPaint.setColor(Color.rgb(174, 208, 238));
    // Prepare header column background color.
    mHeaderColumnBackgroundPaint = new Paint();
    mHeaderColumnBackgroundPaint.setColor(mHeaderColumnBackgroundColor);
    // Prepare event text size and color.
    mEventTextPaint = new TextPaint(Paint.ANTI_ALIAS_FLAG | Paint.LINEAR_TEXT_FLAG);
    mEventTextPaint.setStyle(Paint.Style.FILL);
    mEventTextPaint.setColor(mEventTextColor);
    mEventTextPaint.setTextSize(mEventTextSize);
    // Set default event color.
    mDefaultEventColor = Color.parseColor("#9fc6e7");
    mScaleDetector = new ScaleGestureDetector(mContext, new ScaleGestureDetector.OnScaleGestureListener() {

        @Override
        public void onScaleEnd(ScaleGestureDetector detector) {
            mIsZooming = false;
        }

        @Override
        public boolean onScaleBegin(ScaleGestureDetector detector) {
            mIsZooming = true;
            goToNearestOrigin();
            return true;
        }

        @Override
        public boolean onScale(ScaleGestureDetector detector) {
            mNewHourHeight = Math.round(mHourHeight * detector.getScaleFactor());
            invalidate();
            return true;
        }
    });
}
Also used : Rect(android.graphics.Rect) FastOutLinearInInterpolator(android.support.v4.view.animation.FastOutLinearInInterpolator) TextPaint(android.text.TextPaint) Paint(android.graphics.Paint) ScaleGestureDetector(android.view.ScaleGestureDetector) GestureDetectorCompat(android.support.v4.view.GestureDetectorCompat) OverScroller(android.widget.OverScroller) TextPaint(android.text.TextPaint)

Example 8 with FastOutLinearInInterpolator

use of android.support.v4.view.animation.FastOutLinearInInterpolator in project Douya by DreaminginCodeZH.

the class FriendlyFloatingActionButton method hide.

public void hide() {
    if (!mShowing) {
        return;
    }
    mShowing = false;
    cancelAnimator();
    mAnimator = ObjectAnimator.ofFloat(this, TRANSLATION_Y, getTranslationY(), getHideTranslationY()).setDuration(mAnimationDuration);
    mAnimator.setInterpolator(new FastOutLinearInInterpolator());
    mAnimator.start();
}
Also used : FastOutLinearInInterpolator(android.support.v4.view.animation.FastOutLinearInInterpolator)

Example 9 with FastOutLinearInInterpolator

use of android.support.v4.view.animation.FastOutLinearInInterpolator in project Douya by DreaminginCodeZH.

the class AppBarWrapperLayout method hide.

public void hide() {
    if (!mShowing) {
        return;
    }
    mShowing = false;
    cancelAnimator();
    mAnimator = new AnimatorSet().setDuration(mAnimationDuration);
    mAnimator.setInterpolator(new FastOutLinearInInterpolator());
    AnimatorSet.Builder builder = mAnimator.play(ObjectAnimator.ofFloat(this, TRANSLATION_Y, getTranslationY(), getHideTranslationY()));
    if (Build.VERSION.SDK_INT < Build.VERSION_CODES.LOLLIPOP) {
        builder.before(ObjectAnimator.ofFloat(mShadowCompatView, ALPHA, mShadowCompatView.getAlpha(), 0));
    } else {
        builder.before(ObjectAnimator.ofFloat(mAppbarView, TRANSLATION_Z, mAppbarView.getTranslationZ(), -mAppbarView.getElevation()));
    }
    mAnimator.start();
}
Also used : FastOutLinearInInterpolator(android.support.v4.view.animation.FastOutLinearInInterpolator) AnimatorSet(android.animation.AnimatorSet)

Aggregations

FastOutLinearInInterpolator (android.support.v4.view.animation.FastOutLinearInInterpolator)9 Animator (android.animation.Animator)4 AnimatorListenerAdapter (android.animation.AnimatorListenerAdapter)3 ObjectAnimator (android.animation.ObjectAnimator)3 AnimatorSet (android.animation.AnimatorSet)2 View (android.view.View)2 ArgbEvaluator (android.animation.ArgbEvaluator)1 SuppressLint (android.annotation.SuppressLint)1 TargetApi (android.annotation.TargetApi)1 Paint (android.graphics.Paint)1 Rect (android.graphics.Rect)1 Nullable (android.support.annotation.Nullable)1 GestureDetectorCompat (android.support.v4.view.GestureDetectorCompat)1 ViewPropertyAnimatorListenerAdapter (android.support.v4.view.ViewPropertyAnimatorListenerAdapter)1 LinearOutSlowInInterpolator (android.support.v4.view.animation.LinearOutSlowInInterpolator)1 CardView (android.support.v7.widget.CardView)1 TextPaint (android.text.TextPaint)1 ScaleGestureDetector (android.view.ScaleGestureDetector)1 ViewGroup (android.view.ViewGroup)1 OverScroller (android.widget.OverScroller)1