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;
}
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;
}
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;
}
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);
}
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);
}
Aggregations