Java Code Examples for com.nineoldandroids.animation.ObjectAnimator#ofInt()
The following examples show how to use
com.nineoldandroids.animation.ObjectAnimator#ofInt() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: AbstractWheelView.java From RxTools-master with Apache License 2.0 | 6 votes |
@Override protected void initData(Context context) { super.initData(context); // creating animators mDimSelectorWheelAnimator = ObjectAnimator.ofFloat(this, PROPERTY_SELECTOR_PAINT_COEFF, 1, 0); mDimSeparatorsAnimator = ObjectAnimator.ofInt(this, PROPERTY_SEPARATORS_PAINT_ALPHA, mSelectionDividerActiveAlpha, mSelectionDividerDimmedAlpha ); // creating paints mSeparatorsPaint = new Paint(); mSeparatorsPaint.setXfermode(new PorterDuffXfermode(PorterDuff.Mode.DST_IN)); mSeparatorsPaint.setAlpha(mSelectionDividerDimmedAlpha); mSelectorWheelPaint = new Paint(); mSelectorWheelPaint.setXfermode(new PorterDuffXfermode(PorterDuff.Mode.DST_IN)); }
Example 2
Source File: QuickAttachmentDrawer.java From deltachat-android with GNU General Public License v3.0 | 6 votes |
private void slideTo(int slideOffset, boolean forceInstant) { if (animator != null) { animator.cancel(); animator = null; } if (!forceInstant) { animator = ObjectAnimator.ofInt(this, "slideOffset", this.slideOffset, slideOffset); animator.setInterpolator(new FastOutSlowInInterpolator()); animator.setDuration(400); animator.start(); ViewCompat.postInvalidateOnAnimation(this); } else { this.slideOffset = slideOffset; requestLayout(); invalidate(); } }
Example 3
Source File: LoadingImageView.java From LoadingImageView with MIT License | 6 votes |
private void initAnim() { stopAnim(); //animator = ObjectAnimator.ofInt(this, "maskHeight", 0, imageHeight); animator = ObjectAnimator.ofInt(clipDrawable, "level", 0, 10000); animator.setDuration(animDuration); animator.setRepeatCount(ValueAnimator.INFINITE); animator.setRepeatMode(ValueAnimator.RESTART); animator.addUpdateListener(new ValueAnimator.AnimatorUpdateListener() { @Override public void onAnimationUpdate(ValueAnimator animation) { invalidate(); } }); if(autoStart){ animator.start(); } }
Example 4
Source File: AbstractWheelView.java From iSCAU-Android with GNU General Public License v3.0 | 6 votes |
@Override protected void initData(Context context) { super.initData(context); // creating animators mDimSelectorWheelAnimator = ObjectAnimator.ofFloat(this, PROPERTY_SELECTOR_PAINT_COEFF, 1, 0); mDimSeparatorsAnimator = ObjectAnimator.ofInt(this, PROPERTY_SEPARATORS_PAINT_ALPHA, mSelectionDividerActiveAlpha, mSelectionDividerDimmedAlpha ); // creating paints mSeparatorsPaint = new Paint(); mSeparatorsPaint.setXfermode(new PorterDuffXfermode(PorterDuff.Mode.DST_IN)); mSeparatorsPaint.setAlpha(mSelectionDividerDimmedAlpha); mSelectorWheelPaint = new Paint(); mSelectorWheelPaint.setXfermode(new PorterDuffXfermode(PorterDuff.Mode.DST_IN)); }
Example 5
Source File: CardFaceView.java From CardView with Apache License 2.0 | 6 votes |
private void onFlagChanged(final CardFlag oldFlag, final CardFlag newFlag) { int flagColor = CARD_BACKGROUND_COLOR_NOFLAG; if (newFlag != null) { flagColor = newFlag.getColor(); } ValueAnimator fade = ObjectAnimator.ofInt(mCardPaint, "color", mCardPaint.getColor(), flagColor); fade.setDuration(500); fade.setEvaluator(new ArgbEvaluator()); fade.addUpdateListener(new AnimatorUpdateListener() { @Override public void onAnimationUpdate(ValueAnimator value) { onFlagChangedUpdate(oldFlag, newFlag, value); invalidate(); } }); fade.start(); }
Example 6
Source File: MaterialSpinner.java From XERUNG with Apache License 2.0 | 5 votes |
private void startErrorScrollingAnimator() { int textWidth = Math.round(textPaint.measureText(error.toString())); if (errorLabelAnimator == null) { errorLabelAnimator = ObjectAnimator.ofInt(this, "errorLabelPosX", 0, textWidth + getWidth() / 2); errorLabelAnimator.setStartDelay(1000); errorLabelAnimator.setInterpolator(new LinearInterpolator()); errorLabelAnimator.setDuration(150 * error.length()); errorLabelAnimator.addUpdateListener(this); errorLabelAnimator.setRepeatCount(ValueAnimator.INFINITE); } else { errorLabelAnimator.setIntValues(0, textWidth + getWidth() / 2); } errorLabelAnimator.start(); }
Example 7
Source File: MaterialSpinner.java From XERUNG with Apache License 2.0 | 5 votes |
private void startErrorScrollingAnimator() { int textWidth = Math.round(textPaint.measureText(error.toString())); if (errorLabelAnimator == null) { errorLabelAnimator = ObjectAnimator.ofInt(this, "errorLabelPosX", 0, textWidth + getWidth() / 2); errorLabelAnimator.setStartDelay(1000); errorLabelAnimator.setInterpolator(new LinearInterpolator()); errorLabelAnimator.setDuration(150 * error.length()); errorLabelAnimator.addUpdateListener(this); errorLabelAnimator.setRepeatCount(ValueAnimator.INFINITE); } else { errorLabelAnimator.setIntValues(0, textWidth + getWidth() / 2); } errorLabelAnimator.start(); }
Example 8
Source File: ImagePagerFragment.java From PhotoPicker with Apache License 2.0 | 5 votes |
/** * The enter animation scales the picture in from its previous thumbnail * size/location, colorizing it in parallel. In parallel, the background of the * activity is fading in. When the pictue is in place, the text description * drops down. */ private void runEnterAnimation() { final long duration = ANIM_DURATION; // Set starting values for properties we're going to animate. These // values scale and position the full size version down to the thumbnail // size/location, from which we'll animate it back up ViewHelper.setPivotX(mViewPager, 0); ViewHelper.setPivotY(mViewPager, 0); ViewHelper.setScaleX(mViewPager, (float) thumbnailWidth / mViewPager.getWidth()); ViewHelper.setScaleY(mViewPager, (float) thumbnailHeight / mViewPager.getHeight()); ViewHelper.setTranslationX(mViewPager, thumbnailLeft); ViewHelper.setTranslationY(mViewPager, thumbnailTop); // Animate scale and translation to go from thumbnail to full size ViewPropertyAnimator.animate(mViewPager) .setDuration(duration) .scaleX(1) .scaleY(1) .translationX(0) .translationY(0) .setInterpolator(new DecelerateInterpolator()); // Fade in the black background ObjectAnimator bgAnim = ObjectAnimator.ofInt(mViewPager.getBackground(), "alpha", 0, 255); bgAnim.setDuration(duration); bgAnim.start(); // Animate a color filter to take the image from grayscale to full color. // This happens in parallel with the image scaling and moving into place. ObjectAnimator colorizer = ObjectAnimator.ofFloat(ImagePagerFragment.this, "saturation", 0, 1); colorizer.setDuration(duration); colorizer.start(); }
Example 9
Source File: ImagePagerFragment.java From PhotoPicker with Apache License 2.0 | 5 votes |
/** * The enter animation scales the picture in from its previous thumbnail * size/location, colorizing it in parallel. In parallel, the background of the * activity is fading in. When the pictue is in place, the text description * drops down. */ private void runEnterAnimation() { final long duration = ANIM_DURATION; // Set starting values for properties we're going to animate. These // values scale and position the full size version down to the thumbnail // size/location, from which we'll animate it back up ViewHelper.setPivotX(mViewPager, 0); ViewHelper.setPivotY(mViewPager, 0); ViewHelper.setScaleX(mViewPager, (float) thumbnailWidth / mViewPager.getWidth()); ViewHelper.setScaleY(mViewPager, (float) thumbnailHeight / mViewPager.getHeight()); ViewHelper.setTranslationX(mViewPager, thumbnailLeft); ViewHelper.setTranslationY(mViewPager, thumbnailTop); // Animate scale and translation to go from thumbnail to full size ViewPropertyAnimator.animate(mViewPager) .setDuration(duration) .scaleX(1) .scaleY(1) .translationX(0) .translationY(0) .setInterpolator(new DecelerateInterpolator()); // Fade in the black background ObjectAnimator bgAnim = ObjectAnimator.ofInt(mViewPager.getBackground(), "alpha", 0, 255); bgAnim.setDuration(duration); bgAnim.start(); // Animate a color filter to take the image from grayscale to full color. // This happens in parallel with the image scaling and moving into place. ObjectAnimator colorizer = ObjectAnimator.ofFloat(ImagePagerFragment.this, "saturation", 0, 1); colorizer.setDuration(duration); colorizer.start(); }
Example 10
Source File: PullLayout.java From AndroidStudyDemo with GNU General Public License v2.0 | 5 votes |
private void reset() { if (mObjectAnimator != null && mObjectAnimator.isRunning()) { return; } mObjectAnimator = ObjectAnimator.ofInt(this, "t", (int) -mDetalY / 5, 0); mObjectAnimator.setDuration(150); mObjectAnimator.start(); }
Example 11
Source File: MemoFragment.java From MaterialCalendar with Apache License 2.0 | 5 votes |
void raise() { startBluePairBottom = mBluePair.getBottom(); ObjectAnimator objectAnimator = ObjectAnimator.ofInt(mBluePair, "bottom", mBluePair.getBottom(), mBluePair.getTop() + dpToPx(100)); objectAnimator.addListener(new SimpleListener() { @Override public void onAnimationEnd(Animator animation) { appearRed(); } }); objectAnimator.setInterpolator(ACCELERATE_DECELERATE); objectAnimator.start(); }
Example 12
Source File: MemoFragment.java From MaterialCalendar with Apache License 2.0 | 5 votes |
void release() { ObjectAnimator objectAnimator = ObjectAnimator.ofInt(mBluePair, "bottom", mBluePair.getBottom(), startBluePairBottom); objectAnimator.addListener(new SimpleListener() { @Override public void onAnimationEnd(Animator animator) { disappearBluePair(); } }); objectAnimator.setInterpolator(ACCELERATE_DECELERATE); objectAnimator.start(); }
Example 13
Source File: PullPushLayout.java From Android-PullPushScrollView with MIT License | 5 votes |
private void reset() { if (oa != null && oa.isRunning()) { return; } oa = ObjectAnimator.ofInt(this, "t", (int) -deltaY / 5, 0); oa.setDuration(150); oa.start(); }
Example 14
Source File: SyncProgressView.java From bither-android with Apache License 2.0 | 5 votes |
public void setProgress(final double progress) { removeCallbacks(delayedShowProgress); removeCallbacks(delayHide); this.progress = progress; LogUtil.d("progress", "progress:" + progress); if (progress >= 0 && progress <= 1) { if (getWidth() <= 0) { postDelayed(delayedShowProgress, 100); return; } double p = Math.max(Math.min(progress, 1.0f), 0.2f); if(animator != null && animator.isRunning()){ animator.cancel(); } animator = ObjectAnimator.ofInt(new WrapLayoutParamsForAnimator(iv), "width", (int) (p * getWidth())); animator.setDuration(AnimationDuration); animator.start(); setVisibility(View.VISIBLE); } if(progress < 0 || progress >= 1) { if (getVisibility() == VISIBLE) { postDelayed(delayHide, AnimationDuration); } else { setVisibility(View.GONE); } } }
Example 15
Source File: MaterialRippleLayoutNineOld.java From AdvancedMaterialDrawer with Apache License 2.0 | 5 votes |
private void startRipple(final Runnable animationEndRunnable) { if (eventCancelled) return; float endRadius = getEndRadius(); cancelAnimations(); rippleAnimator = new AnimatorSet(); rippleAnimator.addListener(new AnimatorListenerAdapter() { @Override public void onAnimationEnd(Animator animation) { if (!ripplePersistent) { setRadius(0); setRippleAlpha(rippleAlpha); } if (animationEndRunnable != null && rippleDelayClick) { animationEndRunnable.run(); } childView.setPressed(false); } }); ObjectAnimator ripple = ObjectAnimator.ofFloat(this, radiusProperty, radius, endRadius); ripple.setDuration(rippleDuration); ripple.setInterpolator(new DecelerateInterpolator()); ObjectAnimator fade = ObjectAnimator.ofInt(this, circleAlphaProperty, rippleAlpha, 0); fade.setDuration(rippleFadeDuration); fade.setInterpolator(new AccelerateInterpolator()); fade.setStartDelay(rippleDuration - rippleFadeDuration - FADE_EXTRA_DELAY); if (ripplePersistent) { rippleAnimator.play(ripple); } else if (getRadius() > endRadius) { fade.setStartDelay(0); rippleAnimator.play(fade); } else { rippleAnimator.playTogether(ripple, fade); } rippleAnimator.start(); }