use of android.view.animation.DecelerateInterpolator in project paper-onboarding-android by Ramotion.
the class PaperOnboardingEngine method createContentIconShowAnimation.
/**
* @param currentContentIcon currently displayed view with icon
* @param newContentIcon newly created and prepared view to display
* @return animator set with this animation
*/
protected AnimatorSet createContentIconShowAnimation(final View currentContentIcon, final View newContentIcon) {
int positionDeltaPx = dpToPixels(CONTENT_ICON_POS_DELTA_Y_DP);
AnimatorSet animations = new AnimatorSet();
Animator currentContentMoveUp = ObjectAnimator.ofFloat(currentContentIcon, "y", 0, -positionDeltaPx);
currentContentMoveUp.setDuration(ANIM_CONTENT_ICON_HIDE_TIME);
currentContentMoveUp.addListener(new AnimatorEndListener() {
@Override
public void onAnimationEnd(Animator animation) {
mContentIconContainer.removeView(currentContentIcon);
}
});
Animator currentContentFadeOut = ObjectAnimator.ofFloat(currentContentIcon, "alpha", 1, 0);
currentContentFadeOut.setDuration(ANIM_CONTENT_ICON_HIDE_TIME);
animations.playTogether(currentContentMoveUp, currentContentFadeOut);
Animator newContentMoveUp = ObjectAnimator.ofFloat(newContentIcon, "y", positionDeltaPx, 0);
newContentMoveUp.setDuration(ANIM_CONTENT_ICON_SHOW_TIME);
Animator newContentFadeIn = ObjectAnimator.ofFloat(newContentIcon, "alpha", 0, 1);
newContentFadeIn.setDuration(ANIM_CONTENT_ICON_SHOW_TIME);
animations.playTogether(newContentMoveUp, newContentFadeIn);
animations.setInterpolator(new DecelerateInterpolator());
return animations;
}
use of android.view.animation.DecelerateInterpolator in project android_frameworks_base by ParanoidAndroid.
the class VelocityTest method testDragDeceleration.
@MediumTest
public void testDragDeceleration() {
long t = System.currentTimeMillis();
VelocityTracker vt = VelocityTracker.obtain();
drag(vt, 100, 200, 100, 200, 15, t, 400, new DecelerateInterpolator());
vt.computeCurrentVelocity(1000);
assertLower(250.0f, vt.getXVelocity());
assertLower(250.0f, vt.getYVelocity());
vt.recycle();
}
use of android.view.animation.DecelerateInterpolator in project Timber by naman14.
the class PlayPauseDrawable method toggle.
private void toggle() {
if (animator != null) {
animator.cancel();
}
animator = ObjectAnimator.ofFloat(this, PROGRESS, isPlay ? 1.0F : 0.0F, isPlay ? 0.0F : 1.0F);
animator.addListener(new AnimatorListenerAdapter() {
@Override
public void onAnimationEnd(Animator animation) {
isPlay = !isPlay;
}
});
animator.setInterpolator(new DecelerateInterpolator());
animator.setDuration(200);
animator.start();
}
use of android.view.animation.DecelerateInterpolator in project OneClickAndroid by cyngn.
the class UsbActivity method onCreate.
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
OneClickStats.sendEvent(this, OneClickStats.Categories.PAGE_SHOWN, OneClickStats.Actions.PAGE_ADB);
if (adbIsEnabled()) {
startActivity(new Intent(getBaseContext(), PtpActivity.class));
finish();
return;
}
setContentView(R.layout.usb);
ImageView instructionView = (ImageView) findViewById(R.id.usb_instructions);
DecelerateInterpolator interpolator = new DecelerateInterpolator(2.0f);
AnimationSet instructionAnimations = new AnimationSet(true);
instructionAnimations.setInterpolator(interpolator);
TranslateAnimation instructionMoveAnimation = new TranslateAnimation(0, 0, 250, 0);
instructionMoveAnimation.setDuration(1000);
instructionMoveAnimation.setStartTime(Animation.START_ON_FIRST_FRAME);
instructionAnimations.addAnimation(instructionMoveAnimation);
// we want them to read the instructions first! so we give them a few seconds
AlphaAnimation instructionFadeAnimation = new AlphaAnimation(0.0f, 1.0f);
instructionFadeAnimation.setDuration(1000);
instructionFadeAnimation.setStartOffset(500);
instructionFadeAnimation.setStartTime(Animation.START_ON_FIRST_FRAME);
instructionAnimations.addAnimation(instructionFadeAnimation);
instructionView.setAnimation(instructionAnimations);
// continue button should take even longer
AlphaAnimation buttonAnimation = new AlphaAnimation(0.0f, 1.0f);
buttonAnimation.setDuration(750);
buttonAnimation.setStartTime(Animation.START_ON_FIRST_FRAME);
buttonAnimation.setStartOffset(1000);
findViewById(R.id.next).setAnimation(buttonAnimation);
OnClickListener openUsbListener = new View.OnClickListener() {
@Override
public void onClick(View view) {
Intent intent = new Intent();
intent.setClassName("com.android.settings", "com.android.settings.DevelopmentSettings");
try {
OneClickStats.sendEvent(view.getContext(), OneClickStats.Categories.BUTTON_CLICK, OneClickStats.Actions.BTN_ADB);
startActivity(intent);
startService(new Intent(getBaseContext(), UsbDebuggingMonitorService.class));
} catch (ActivityNotFoundException e) {
// we want to know if this happens, right?
OneClickStats.sendEvent(view.getContext(), OneClickStats.Categories.SWITCH_ERROR, OneClickStats.Actions.ERR_ADB);
}
}
};
findViewById(R.id.next).setOnClickListener(openUsbListener);
}
use of android.view.animation.DecelerateInterpolator in project ArcMenu by daCapricorn.
the class ArcMenu method createHintSwitchAnimation.
private static Animation createHintSwitchAnimation(final boolean expanded) {
Animation animation = new RotateAnimation(expanded ? 45 : 0, expanded ? 0 : 45, Animation.RELATIVE_TO_SELF, 0.5f, Animation.RELATIVE_TO_SELF, 0.5f);
animation.setStartOffset(0);
animation.setDuration(100);
animation.setInterpolator(new DecelerateInterpolator());
animation.setFillAfter(true);
return animation;
}
Aggregations