Search in sources :

Example 61 with Interpolator

use of android.view.animation.Interpolator in project assertj-android by square.

the class RecyclerViewSmoothScrollerActionAssert method hasInterpolator.

public RecyclerViewSmoothScrollerActionAssert hasInterpolator(Interpolator interpolator) {
    isNotNull();
    Interpolator actualInterpolator = actual.getInterpolator();
    // 
    assertThat(actualInterpolator).overridingErrorMessage("Expected interpolator <%s> but was <%s>.", interpolator, // 
    actualInterpolator).isEqualTo(interpolator);
    return this;
}
Also used : Interpolator(android.view.animation.Interpolator)

Example 62 with Interpolator

use of android.view.animation.Interpolator in project assertj-android by square.

the class AbstractLayoutAnimationControllerAssert method hasInterpolator.

public S hasInterpolator(Interpolator interpolator) {
    isNotNull();
    Interpolator actualInterpolator = actual.getInterpolator();
    // 
    assertThat(actualInterpolator).overridingErrorMessage("Expected interpolator <%s> but was <%s>.", interpolator, // 
    actualInterpolator).isSameAs(interpolator);
    return myself;
}
Also used : Interpolator(android.view.animation.Interpolator)

Example 63 with Interpolator

use of android.view.animation.Interpolator in project AndroidChromium by JackyAndroid.

the class StackAnimation method createUpdateDiscardAnimatorSet.

/**
 * Responsible for generating the animations that moves the tabs back in from
 * discard attempt or commit the current discard (if any). It also re-even the tabs
 * if one of then is removed.
 *
 * @param tabs         The tabs that make up the stack. These are the
 *                     tabs that will be affected by the TabSwitcherAnimation.
 * @param spacing      The default spacing between tabs.
 * @param warpSize     The warp size of the transform from scroll space to screen space.
 * @param discardRange The maximum value the discard amount.
 * @return             The TabSwitcherAnimation instance that will tween the
 *                     tabs to create the appropriate animation.
 */
protected ChromeAnimation<?> createUpdateDiscardAnimatorSet(StackTab[] tabs, int spacing, float warpSize, float discardRange) {
    ChromeAnimation<Animatable<?>> set = new ChromeAnimation<Animatable<?>>();
    int dyingTabsCount = 0;
    float firstDyingTabOffset = 0;
    for (int i = 0; i < tabs.length; ++i) {
        StackTab tab = tabs[i];
        addTiltScrollAnimation(set, tab.getLayoutTab(), 0.0f, UNDISCARD_ANIMATION_DURATION, 0);
        if (tab.isDying()) {
            dyingTabsCount++;
            if (dyingTabsCount == 1) {
                firstDyingTabOffset = getScreenPositionInScrollDirection(tab);
            }
        }
    }
    Interpolator interpolator = BakedBezierInterpolator.FADE_OUT_CURVE;
    int newIndex = 0;
    for (int i = 0; i < tabs.length; ++i) {
        StackTab tab = tabs[i];
        long startTime = (long) Math.max(0, TAB_REORDER_START_SPAN / getScreenSizeInScrollDirection() * (getScreenPositionInScrollDirection(tab) - firstDyingTabOffset));
        if (tab.isDying()) {
            float discard = tab.getDiscardAmount();
            if (discard == 0.0f)
                discard = isDefaultDiscardDirectionPositive() ? 0.0f : -0.0f;
            float s = Math.copySign(1.0f, discard);
            long duration = (long) (DISCARD_ANIMATION_DURATION * (1.0f - Math.abs(discard / discardRange)));
            addAnimation(set, tab, DISCARD_AMOUNT, discard, discardRange * s, duration, startTime, false, interpolator);
        } else {
            if (tab.getDiscardAmount() != 0.f) {
                addAnimation(set, tab, DISCARD_AMOUNT, tab.getDiscardAmount(), 0.0f, UNDISCARD_ANIMATION_DURATION, 0);
            }
            float newScrollOffset = StackTab.screenToScroll(spacing * newIndex, warpSize);
            // put it in the right place.
            if (tab.getDiscardAmount() >= discardRange) {
                tab.setScrollOffset(newScrollOffset);
                tab.setScale(SCALE_AMOUNT);
            } else {
                float start = tab.getScrollOffset();
                if (start != newScrollOffset) {
                    addAnimation(set, tab, SCROLL_OFFSET, start, newScrollOffset, TAB_REORDER_DURATION, startTime);
                }
            }
            newIndex++;
        }
    }
    return set;
}
Also used : ChromeAnimation(org.chromium.chrome.browser.compositor.layouts.ChromeAnimation) Animatable(org.chromium.chrome.browser.compositor.layouts.ChromeAnimation.Animatable) Interpolator(android.view.animation.Interpolator) BakedBezierInterpolator(org.chromium.ui.interpolators.BakedBezierInterpolator)

Example 64 with Interpolator

use of android.view.animation.Interpolator in project SmoothRefreshLayout by dkzwm.

the class TestScaleEffectActivity method onCreate.

@Override
protected void onCreate(@Nullable Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_test_scale_effect);
    getSupportActionBar().setDisplayHomeAsUpEnabled(true);
    getSupportActionBar().setDisplayShowHomeEnabled(true);
    getSupportActionBar().setTitle(R.string.test_scale_effect);
    ListView listView = findViewById(R.id.listView_test_scale_effect);
    ListViewAdapter adapter = new ListViewAdapter(this, getLayoutInflater());
    List<String> list = DataUtil.createList(0, 40);
    adapter.updateData(list);
    listView.setAdapter(adapter);
    SmoothRefreshLayout refreshLayout = findViewById(R.id.smoothRefreshLayout_test_scale_effect);
    refreshLayout.setDisableLoadMore(false);
    refreshLayout.setMode(Constants.MODE_SCALE);
    refreshLayout.setDurationToClose(550);
    Interpolator interpolator = new Interpolator() {

        @Override
        public float getInterpolation(float input) {
            return (float) (--input * input * ((1.7 + 1f) * input + 1.7) + 1f);
        }
    };
    refreshLayout.setSpringInterpolator(interpolator);
}
Also used : ListView(android.widget.ListView) ListViewAdapter(me.dkzwm.widget.srl.sample.adapter.ListViewAdapter) Interpolator(android.view.animation.Interpolator) SmoothRefreshLayout(me.dkzwm.widget.srl.SmoothRefreshLayout)

Example 65 with Interpolator

use of android.view.animation.Interpolator in project SmoothRefreshLayout by dkzwm.

the class TestHorizontalScaleEffectActivity method onCreate.

@Override
protected void onCreate(@Nullable Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_test_horizontal_scale_effect);
    getSupportActionBar().setDisplayHomeAsUpEnabled(true);
    getSupportActionBar().setDisplayShowHomeEnabled(true);
    getSupportActionBar().setTitle(R.string.test_horizontal_scale_effect);
    SmoothRefreshLayout refreshLayout = findViewById(R.id.smoothRefreshLayout_test_horizontal_scale_effect);
    refreshLayout.setDisableLoadMore(false);
    refreshLayout.setMode(Constants.MODE_SCALE);
    refreshLayout.setDurationToClose(800);
    Interpolator interpolator = new Interpolator() {

        @Override
        public float getInterpolation(float input) {
            return (float) (--input * input * ((1.7 + 1f) * input + 1.7) + 1f);
        }
    };
    refreshLayout.setSpringInterpolator(interpolator);
}
Also used : Interpolator(android.view.animation.Interpolator) SmoothRefreshLayout(me.dkzwm.widget.srl.SmoothRefreshLayout)

Aggregations

Interpolator (android.view.animation.Interpolator)229 Animator (android.animation.Animator)60 ValueAnimator (android.animation.ValueAnimator)49 AnimatorListenerAdapter (android.animation.AnimatorListenerAdapter)46 ObjectAnimator (android.animation.ObjectAnimator)39 AccelerateInterpolator (android.view.animation.AccelerateInterpolator)25 PathInterpolator (android.view.animation.PathInterpolator)25 DecelerateInterpolator (android.view.animation.DecelerateInterpolator)23 LinearInterpolator (android.view.animation.LinearInterpolator)18 Paint (android.graphics.Paint)17 View (android.view.View)17 PropertyValuesHolder (android.animation.PropertyValuesHolder)16 FloatKeyframe (com.actionbarsherlock.internal.nineoldandroids.animation.Keyframe.FloatKeyframe)16 IntKeyframe (com.actionbarsherlock.internal.nineoldandroids.animation.Keyframe.IntKeyframe)16 TimeAnimator (android.animation.TimeAnimator)15 AnimatorUpdateListener (android.animation.ValueAnimator.AnimatorUpdateListener)14 TypedArray (android.content.res.TypedArray)14 Animation (android.view.animation.Animation)13 AnimatorSet (android.animation.AnimatorSet)12 TimeInterpolator (android.animation.TimeInterpolator)11