use of android.view.animation.OvershootInterpolator in project FloatingActionButton by Clans.
the class MenusFragment method createCustomAnimation.
private void createCustomAnimation() {
AnimatorSet set = new AnimatorSet();
ObjectAnimator scaleOutX = ObjectAnimator.ofFloat(menuGreen.getMenuIconView(), "scaleX", 1.0f, 0.2f);
ObjectAnimator scaleOutY = ObjectAnimator.ofFloat(menuGreen.getMenuIconView(), "scaleY", 1.0f, 0.2f);
ObjectAnimator scaleInX = ObjectAnimator.ofFloat(menuGreen.getMenuIconView(), "scaleX", 0.2f, 1.0f);
ObjectAnimator scaleInY = ObjectAnimator.ofFloat(menuGreen.getMenuIconView(), "scaleY", 0.2f, 1.0f);
scaleOutX.setDuration(50);
scaleOutY.setDuration(50);
scaleInX.setDuration(150);
scaleInY.setDuration(150);
scaleInX.addListener(new AnimatorListenerAdapter() {
@Override
public void onAnimationStart(Animator animation) {
menuGreen.getMenuIconView().setImageResource(menuGreen.isOpened() ? R.drawable.ic_close : R.drawable.ic_star);
}
});
set.play(scaleOutX).with(scaleOutY);
set.play(scaleInX).with(scaleInY).after(scaleOutX);
set.setInterpolator(new OvershootInterpolator(2));
menuGreen.setIconToggleAnimatorSet(set);
}
use of android.view.animation.OvershootInterpolator in project GSYVideoPlayer by CarGuo.
the class ENDownloadView method start.
public void start() {
if (mValueAnimator != null) {
mValueAnimator.removeAllListeners();
mValueAnimator.removeAllUpdateListeners();
if (mValueAnimator.isRunning())
mValueAnimator.cancel();
mValueAnimator = null;
}
mCurrentState = STATE_DOWNLOADING;
mValueAnimator = ValueAnimator.ofFloat(1.f, 100.f);
mValueAnimator.setDuration(1500);
mValueAnimator.setInterpolator(new OvershootInterpolator());
mValueAnimator.addUpdateListener(new ValueAnimator.AnimatorUpdateListener() {
@Override
public void onAnimationUpdate(ValueAnimator valueAnimator) {
mFraction = valueAnimator.getAnimatedFraction();
invalidate();
}
});
mValueAnimator.addListener(new AnimatorListenerAdapter() {
@Override
public void onAnimationEnd(Animator animation) {
mCurrentState = STATE_DOWNLOADING;
downloadAnim();
}
});
mValueAnimator.start();
}
use of android.view.animation.OvershootInterpolator in project ElasticDownload by Tibolte.
the class ProgressDownloadView method drawFail.
public void drawFail() {
mState = State.STATE_FAILED;
ObjectAnimator failAnim = ObjectAnimator.ofFloat(this, "failAngle", 0, 180);
failAnim.setInterpolator(new OvershootInterpolator());
//This one doesn't do much actually, we just use it to take advantage of associating two different interpolators
ObjectAnimator anim = ObjectAnimator.ofFloat(this, "progress", getProgress(), mTarget);
anim.setInterpolator(new AccelerateInterpolator());
AnimatorSet set = new AnimatorSet();
set.setDuration((long) (ANIMATION_DURATION_BASE / 1.7f));
set.playTogether(failAnim, anim);
set.start();
}
use of android.view.animation.OvershootInterpolator in project ElasticDownload by Tibolte.
the class ProgressDownloadView method drawSuccess.
public void drawSuccess() {
mTarget = 100;
final ObjectAnimator successAnim = ObjectAnimator.ofFloat(this, "flip", 1, -1);
successAnim.setInterpolator(new OvershootInterpolator());
successAnim.setDuration(ANIMATION_DURATION_BASE);
ObjectAnimator anim = ObjectAnimator.ofFloat(this, "progress", getProgress(), mTarget);
anim.setInterpolator(new DecelerateInterpolator());
anim.setDuration((long) (ANIMATION_DURATION_BASE + Math.abs(mTarget * 10 - getProgress() * 10) / 2));
anim.addListener(new Animator.AnimatorListener() {
@Override
public void onAnimationStart(Animator animation) {
}
@Override
public void onAnimationEnd(Animator animation) {
mState = State.STATE_SUCCESS;
successAnim.start();
}
@Override
public void onAnimationCancel(Animator animation) {
}
@Override
public void onAnimationRepeat(Animator animation) {
}
});
anim.start();
}
use of android.view.animation.OvershootInterpolator in project android-floating-action-menu by sephiroth74.
the class MainActivity method onCreate.
@Override
protected void onCreate(Bundle savedInstanceState) {
Log.i(TAG, "onCreate: " + savedInstanceState);
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
List<String> objects = new ArrayList<>();
populateData(objects);
ArrayAdapter<String> adapter = new ArrayAdapter<>(this, android.R.layout.simple_list_item_1, android.R.id.text1, objects);
mListView.setAdapter(adapter);
mListView.setOnItemClickListener(this);
boolean visible = true;
if (null != savedInstanceState) {
visible = savedInstanceState.getBoolean("floating-menu-visible", true);
}
FloatingActionItem item1 = new FloatingActionItem.Builder(this, 0, R.style.FloatingActionMenuItemStyle).withResId(R.drawable.ic_facebook).withDelay(0).build();
FloatingActionItem item2 = new FloatingActionItem.Builder(this, 1, R.style.FloatingActionMenuItemStyle).withResId(R.drawable.ic_googleplus).withDelay(50).build();
FloatingActionItem item3 = new FloatingActionItem.Builder(this, 2, R.style.FloatingActionMenuItemStyle).withResId(R.drawable.ic_twitter).withDelay(100).build();
mFloatingMenu = new FloatingActionMenu.Builder(this, R.style.FloatingActionMenuStyle).addItem(item1).addItem(item2).addItem(item3).withScrollDelegate(new FloatingActionMenu.AbsListViewScrollDelegate(mListView)).withThreshold(R.dimen.float_action_threshold).withGap(R.dimen.float_action_item_gap).withVerticalPadding(R.dimen.float_action_v_padding).withGravity(FloatingActionMenu.Gravity.CENTER_HORIZONTAL | FloatingActionMenu.Gravity.BOTTOM).withDirection(FloatingActionMenu.Direction.Vertical).animationDuration(400).animationInterpolator(new OvershootInterpolator()).visible(visible).build();
mFloatingMenu.setOnItemClickListener(this);
}
Aggregations