android.animation.ObjectAnimator Java Examples

The following examples show how to use android.animation.ObjectAnimator. 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 Project: scene   Author: bytedance   File: Case1Scene.java    License: Apache License 2.0 7 votes vote down vote up
@NonNull
@Override
protected Animator onPopAnimator(final AnimationInfo fromInfo, final AnimationInfo toInfo) {
    final View toView = toInfo.mSceneView;
    final View fromView = fromInfo.mSceneView;

    ValueAnimator fromAlphaAnimator = ObjectAnimator.ofFloat(fromView, View.ALPHA, 1.0f, 0.0f);
    fromAlphaAnimator.setInterpolator(new LinearInterpolator());
    fromAlphaAnimator.setDuration(150 * 20);
    fromAlphaAnimator.setStartDelay(50 * 20);

    ValueAnimator fromTranslateAnimator = ObjectAnimator.ofFloat(fromView, View.TRANSLATION_Y, 0, 0.08f * toView.getHeight());
    fromTranslateAnimator.setInterpolator(new AccelerateInterpolator(2));
    fromTranslateAnimator.setDuration(200 * 20);

    ValueAnimator toAlphaAnimator = ObjectAnimator.ofFloat(toView, View.ALPHA, 0.7f, 1.0f);
    toAlphaAnimator.setInterpolator(new LinearOutSlowInInterpolator());
    toAlphaAnimator.setDuration(20 * 20);
    return TransitionUtils.mergeAnimators(fromAlphaAnimator, fromTranslateAnimator, toAlphaAnimator);
}
 
Example #2
Source Project: Telegram-FOSS   Author: Telegram-FOSS-Team   File: ChannelAdminLogActivity.java    License: GNU General Public License v2.0 6 votes vote down vote up
private void hideFloatingDateView(boolean animated) {
    if (floatingDateView.getTag() != null && !currentFloatingDateOnScreen && (!scrollingFloatingDate || currentFloatingTopIsNotMessage)) {
        floatingDateView.setTag(null);
        if (animated) {
            floatingDateAnimation = new AnimatorSet();
            floatingDateAnimation.setDuration(150);
            floatingDateAnimation.playTogether(ObjectAnimator.ofFloat(floatingDateView, "alpha", 0.0f));
            floatingDateAnimation.addListener(new AnimatorListenerAdapter() {
                @Override
                public void onAnimationEnd(Animator animation) {
                    if (animation.equals(floatingDateAnimation)) {
                        floatingDateAnimation = null;
                    }
                }
            });
            floatingDateAnimation.setStartDelay(500);
            floatingDateAnimation.start();
        } else {
            if (floatingDateAnimation != null) {
                floatingDateAnimation.cancel();
                floatingDateAnimation = null;
            }
            floatingDateView.setAlpha(0.0f);
        }
    }
}
 
Example #3
Source Project: edslite   Author: sovworks   File: CategoryPropertyEditor.java    License: GNU General Public License v2.0 6 votes vote down vote up
private void rotateIconAndChangeState()
  {
IS_ANIMATING = true;
      _indicatorIcon.clearAnimation();
      ObjectAnimator anim = ObjectAnimator.ofFloat(_indicatorIcon, View.ROTATION, _isExpanded ? 0 : 180);
      anim.setDuration(200);
      if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN)
          _indicatorIcon.setHasTransientState(true);
      anim.addListener(new AnimatorListenerAdapter()
      {
          @Override
          public void onAnimationEnd(Animator animation)
          {
              if(_isExpanded)
                  collapse();
              else
                  expand();
              if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN)
                  _indicatorIcon.setHasTransientState(false);
		IS_ANIMATING = false;

          }
      });
      anim.start();
  }
 
Example #4
Source Project: Telegram   Author: DrKLO   File: DrawerLayoutContainer.java    License: GNU General Public License v2.0 6 votes vote down vote up
public void openDrawer(boolean fast) {
    if (!allowOpenDrawer) {
        return;
    }
    if (AndroidUtilities.isTablet() && parentActionBarLayout != null && parentActionBarLayout.parentActivity != null) {
        AndroidUtilities.hideKeyboard(parentActionBarLayout.parentActivity.getCurrentFocus());
    }
    cancelCurrentAnimation();
    AnimatorSet animatorSet = new AnimatorSet();
    animatorSet.playTogether(ObjectAnimator.ofFloat(this, "drawerPosition", drawerLayout.getMeasuredWidth()));
    animatorSet.setInterpolator(new DecelerateInterpolator());
    if (fast) {
        animatorSet.setDuration(Math.max((int) (200.0f / drawerLayout.getMeasuredWidth() * (drawerLayout.getMeasuredWidth() - drawerPosition)), 50));
    } else {
        animatorSet.setDuration(250);
    }
    animatorSet.addListener(new AnimatorListenerAdapter() {
        @Override
        public void onAnimationEnd(Animator animator) {
            onDrawerAnimationEnd(true);
        }
    });
    animatorSet.start();
    currentAnimation = animatorSet;
}
 
Example #5
Source Project: AndroidChromium   Author: JackyAndroid   File: InfoBarContainerLayout.java    License: Apache License 2.0 6 votes vote down vote up
@Override
Animator createAnimator() {
    int deltaHeight = mNewContents.getHeight() - mOldContents.getHeight();
    InfoBarContainerLayout.this.setTranslationY(Math.max(0, deltaHeight));
    mNewContents.setAlpha(0f);

    AnimatorSet animator = new AnimatorSet();
    animator.playSequentially(
            ObjectAnimator.ofFloat(mOldContents, View.ALPHA, 0f)
                    .setDuration(DURATION_FADE_OUT_MS),
            ObjectAnimator.ofFloat(InfoBarContainerLayout.this, View.TRANSLATION_Y,
                    Math.max(0, -deltaHeight)).setDuration(DURATION_SLIDE_UP_MS),
            ObjectAnimator.ofFloat(mNewContents, View.ALPHA, 1f)
                    .setDuration(DURATION_FADE_OUT_MS));
    return animator;
}
 
Example #6
Source Project: ColorPickerDialog   Author: fennifith   File: HSVPickerView.java    License: Apache License 2.0 6 votes vote down vote up
@Override
public void setColor(int color, boolean animate) {
    super.setColor(color, animate);
    SeekBar[] bars = new SeekBar[]{hue, saturation, brightness};
    float[] values = new float[3];
    Color.colorToHSV(color, values);
    values[1] *= 255;
    values[2] *= 255;

    for (int i = 0; i < bars.length; i++) {
        if (animate && !isTrackingTouch) {
            ObjectAnimator animator = ObjectAnimator.ofInt(bars[i], "progress", (int) values[i]);
            animator.setInterpolator(new DecelerateInterpolator());
            animator.start();
        } else {
            bars[i].setProgress((int) values[i]);
        }
    }

    updateProgressBars();
}
 
Example #7
Source Project: RxTools-master   Author: duboAndroid   File: RxAdapterUpDownStackAnimator.java    License: Apache License 2.0 6 votes vote down vote up
@Override
protected void itemCollapseAnimatorSet(RxCardStackView.ViewHolder viewHolder) {
    int childTop = mRxCardStackView.getPaddingTop();
    for (int i = 0; i < mRxCardStackView.getChildCount(); i++) {
        View child = mRxCardStackView.getChildAt(i);
        child.clearAnimation();
        final RxCardStackView.LayoutParams lp =
                (RxCardStackView.LayoutParams) child.getLayoutParams();
        childTop += lp.topMargin;
        if (i != 0) {
            childTop -= mRxCardStackView.getOverlapGaps() * 2;
        }
        ObjectAnimator oAnim = ObjectAnimator.ofFloat(child, View.Y, child.getY(),
                childTop - mRxCardStackView.getRxScrollDelegate().getViewScrollY() < mRxCardStackView.getChildAt(0).getY()
                        ? mRxCardStackView.getChildAt(0).getY() : childTop - mRxCardStackView.getRxScrollDelegate().getViewScrollY());
        mSet.play(oAnim);
        childTop += lp.mHeaderHeight;
    }
}
 
Example #8
Source Project: 365browser   Author: mogoweb   File: ToolbarPhone.java    License: Apache License 2.0 6 votes vote down vote up
private ObjectAnimator createExitTabSwitcherAnimation(
        final boolean animateNormalToolbar) {
    ObjectAnimator exitAnimation =
            ObjectAnimator.ofFloat(this, mTabSwitcherModePercentProperty, 0.f);
    exitAnimation.setDuration(animateNormalToolbar
            ? TAB_SWITCHER_MODE_EXIT_NORMAL_ANIMATION_DURATION_MS
            : TAB_SWITCHER_MODE_EXIT_FADE_ANIMATION_DURATION_MS);
    exitAnimation.setInterpolator(new LinearInterpolator());
    exitAnimation.addListener(new AnimatorListenerAdapter() {
        @Override
        public void onAnimationEnd(Animator animation) {
            updateViewsForTabSwitcherMode();
        }
    });

    return exitAnimation;
}
 
Example #9
Source Project: TurboLauncher   Author: Phonemetra   File: PagedView.java    License: Apache License 2.0 6 votes vote down vote up
void animateDragViewToOriginalPosition() {
    if (mDragView != null) {
        AnimatorSet anim = new AnimatorSet();
        anim.setDuration(REORDERING_DROP_REPOSITION_DURATION);
        anim.playTogether(
                ObjectAnimator.ofFloat(mDragView, "translationX", 0f),
                ObjectAnimator.ofFloat(mDragView, "translationY", 0f),
                ObjectAnimator.ofFloat(mDragView, "scaleX", 1f),
                ObjectAnimator.ofFloat(mDragView, "scaleY", 1f));
        anim.addListener(new AnimatorListenerAdapter() {
            @Override
            public void onAnimationEnd(Animator animation) {
                onPostReorderingAnimationCompleted();
            }
        });
        anim.start();
    }
}
 
Example #10
Source Project: droidddle   Author: goodev   File: ShotDetailsActivity.java    License: Apache License 2.0 6 votes vote down vote up
@TargetApi(Build.VERSION_CODES.LOLLIPOP)
private void updateStatusBarColor() {
    if (mShotFragment == null || true) {
        return;
    }
    final int desiredStatusBarColor;
    // Only use a custom status bar color if QuickContacts touches the top of the viewport.
    if (/*mScroller.getScrollNeededToBeFullScreen() <= 0*/ true) {
        desiredStatusBarColor = mStatusBarColor;
    } else {
        desiredStatusBarColor = Color.TRANSPARENT;
    }
    // Animate to the new color.
    if (UiUtils.hasLollipop()) {
        final ObjectAnimator animation = ObjectAnimator.ofInt(getWindow(), "statusBarColor", getWindow().getStatusBarColor(), desiredStatusBarColor);
        animation.setDuration(ANIMATION_STATUS_BAR_COLOR_CHANGE_DURATION);
        animation.setEvaluator(new ArgbEvaluator());
        animation.start();
    }
}
 
Example #11
Source Project: empty-state-recyclerview   Author: tylersuehr7   File: ContentItemLoadingStateFactory.java    License: MIT License 6 votes vote down vote up
@Override
public final void onDrawState(final EmptyStateRecyclerView rv, Canvas canvas) {
    final int width = rv.getMeasuredWidth();
    final int height = rv.getMeasuredHeight();

    // Draw all of our content items
    renderContent(numberOfContentItems, width, height, canvas, contentPaint);

    // Setup and start animation, if possible
    if (animateContentItems) {
        if (anim == null) {
            this.anim = ObjectAnimator.ofObject(contentPaint, "color", new ArgbEvaluator(),
                    Color.parseColor("#E0E0E0"), Color.parseColor("#BDBDBD"), Color.parseColor("#9E9E9E"));
            onInterceptAnimatorCreation(anim);
            this.anim.addUpdateListener(new ValueAnimator.AnimatorUpdateListener() {
                @Override
                public void onAnimationUpdate(ValueAnimator animation) {
                    rv.invalidate();
                }
            });
            this.anim.start();
        }
    }
}
 
Example #12
Source Project: XDroidAnimation   Author: robinxdroid   File: PathAnimation.java    License: Apache License 2.0 6 votes vote down vote up
@Override
public AnimatorSet createAnimatorSet() {
	ViewHelper.setClipChildren(targetView, false);

	if (path == null) {
		throw new IllegalArgumentException("You have to set up a AnimatorPath for PathAnimation!");
	}

	ObjectAnimator anim = ObjectAnimator.ofObject(this, "ViewLoc", new PathEvaluator(), path.getPoints().toArray());
	AnimatorSet animatorSet = new AnimatorSet();
	animatorSet.play(anim);
	animatorSet.setDuration(duration);
	animatorSet.setInterpolator(interpolator);
	if (listener != null) {
		animatorSet.addListener(listener);
	}

	return animatorSet;
}
 
Example #13
Source Project: Android_UE   Author: aohanyao   File: MoreMenuHelper.java    License: Apache License 2.0 5 votes vote down vote up
/**
 * 旋转菜单按钮
 */
private void rotationActionMenu(int from, int to) {
    ValueAnimator fadeAnim = ObjectAnimator.ofFloat(fabCloseMoreMenu, "rotation", from, to);
    fadeAnim.setDuration(300);
    KickBackAnimator kickAnimator = new KickBackAnimator();
    kickAnimator.setDuration(150);
    fadeAnim.setEvaluator(kickAnimator);
    fadeAnim.start();
}
 
Example #14
Source Project: C9MJ   Author: 452MJ   File: ExploreFragment.java    License: Apache License 2.0 5 votes vote down vote up
@OnClick({
        R.id.iv_expandable,
        R.id.tv_section,
        R.id.scroll_view
})
public void onClick(View view) {
    switch (view.getId()) {
        case R.id.iv_expandable:

            navigator.notifyDataSetChanged();    // must call firstly
            fragmentAdapter.notifyDataSetChanged();

            isExpanded = !isExpanded;
            iv_expandable.setImageResource(isExpanded ? R.drawable.ic_expand_close : R.drawable.ic_expand_open);
            //栏目切换的动画
            ObjectAnimator animator0 = ObjectAnimator.ofFloat(tv_section, "translationX", isExpanded ? 0 : tv_section.getWidth());
            ObjectAnimator animator1 = ObjectAnimator.ofFloat(scrollView, "translationY", isExpanded ? 0 : -scrollView.getHeight());
            AnimatorSet animatorSet = new AnimatorSet();
            animatorSet.playTogether(animator0, animator1);
            animatorSet.setDuration(500);
            animatorSet.setInterpolator(new BounceInterpolator());
            animatorSet.start();

            //保存已选择&未选择的栏目列表
            selectedTitleString = parseListToStringByColons(selectedTitleList);
            unselectedTitleString = parseListToStringByColons(unSelectedTitleList);
            App.getSpUtils().putString(Constants.STRING_TITLE_SELECTED, selectedTitleString);
            App.getSpUtils().putString(Constants.STRING_TITLE_UNSELECTED, unselectedTitleString);
            break;

        case R.id.tv_section:
            break;
        case R.id.scroll_view:
            break;
    }
}
 
Example #15
Source Project: MaterialDateRangePicker   Author: heysupratim   File: RadialSelectorView.java    License: Apache License 2.0 5 votes vote down vote up
public ObjectAnimator getReappearAnimator() {
    if (!mIsInitialized || !mDrawValuesReady) {
        Log.e(TAG, "RadialSelectorView was not ready for animation.");
        return null;
    }

    Keyframe kf0, kf1, kf2, kf3;
    float midwayPoint = 0.2f;
    int duration = 500;

    // The time points are half of what they would normally be, because this animation is
    // staggered against the disappear so they happen seamlessly. The reappear starts
    // halfway into the disappear.
    float delayMultiplier = 0.25f;
    float transitionDurationMultiplier = 1f;
    float totalDurationMultiplier = transitionDurationMultiplier + delayMultiplier;
    int totalDuration = (int) (duration * totalDurationMultiplier);
    float delayPoint = (delayMultiplier * duration) / totalDuration;
    midwayPoint = 1 - (midwayPoint * (1 - delayPoint));

    kf0 = Keyframe.ofFloat(0f, mTransitionEndRadiusMultiplier);
    kf1 = Keyframe.ofFloat(delayPoint, mTransitionEndRadiusMultiplier);
    kf2 = Keyframe.ofFloat(midwayPoint, mTransitionMidRadiusMultiplier);
    kf3 = Keyframe.ofFloat(1f, 1);
    PropertyValuesHolder radiusReappear = PropertyValuesHolder.ofKeyframe(
            "animationRadiusMultiplier", kf0, kf1, kf2, kf3);

    kf0 = Keyframe.ofFloat(0f, 0f);
    kf1 = Keyframe.ofFloat(delayPoint, 0f);
    kf2 = Keyframe.ofFloat(1f, 1f);
    PropertyValuesHolder fadeIn = PropertyValuesHolder.ofKeyframe("alpha", kf0, kf1, kf2);

    ObjectAnimator reappearAnimator = ObjectAnimator.ofPropertyValuesHolder(
            this, radiusReappear, fadeIn).setDuration(totalDuration);
    reappearAnimator.addUpdateListener(mInvalidateUpdateListener);
    return reappearAnimator;
}
 
Example #16
Source Project: LittleFreshWeather   Author: ZeusChan   File: CityWeatherActivity.java    License: Apache License 2.0 5 votes vote down vote up
@Override
public void run() {
    ++mSpecialWeatherNumCloud;
    if (mSpecialWeatherNumCloud <= mSpecialWeatherNumLimitCloud) {
        int toolbarHeight = 0;
        int screenWidth = DensityUtil.getScreenWidth(CityWeatherActivity.this);

        boolean isBack = (mSpecialWeatherNumCloud & 0x1) == 0;

        ImageView imageView = new ImageView(CityWeatherActivity.this);
        imageView.setVisibility(View.VISIBLE);
        if (isBack) {
            //imageView.setImageResource(mCloudIconBackId);
            mPresenter.getImageViewSrc(imageView, mCloudIconBackId);
        } else {
            //imageView.setImageResource(mCloudIconFrontId);
            mPresenter.getImageViewSrc(imageView, mCloudIconFrontId);
        }
        RelativeLayout.LayoutParams layoutParams = new RelativeLayout.LayoutParams(RelativeLayout.LayoutParams.WRAP_CONTENT, RelativeLayout.LayoutParams.WRAP_CONTENT);
        if (isBack) {
            layoutParams.setMargins(0, toolbarHeight, 0, 0);
        } else {
            layoutParams.setMargins(0, toolbarHeight + mRandom.nextInt(100), 0, 0);
        }
        rlBackgroundView.addView(imageView, layoutParams);

        ObjectAnimator animator = ObjectAnimator.ofFloat(imageView, "translationX", -(screenWidth * 2 / 3), screenWidth);
        if (isBack) {
            animator.setDuration(CLOUD_SPEED_L);
        } else {
            animator.setDuration(CLOUD_SPEED_H);
        }
        animator.setRepeatMode(ObjectAnimator.RESTART);
        animator.setRepeatCount(ObjectAnimator.INFINITE);
        animator.setInterpolator(new LinearInterpolator());
        animator.start();

        mHandler.postDelayed(cloudProc, CLOUD_GEN_INTERVAL);
    }
}
 
Example #17
Source Project: DragListView   Author: woxblom   File: DragItem.java    License: Apache License 2.0 5 votes vote down vote up
void startDrag(View startFromView, float touchX, float touchY) {
    show();
    mRealDragView = startFromView;
    onBindDragView(startFromView, mDragView);
    onMeasureDragView(startFromView, mDragView);
    onStartDragAnimation(mDragView);

    float startX = startFromView.getX() - (mDragView.getMeasuredWidth() - startFromView.getMeasuredWidth()) / 2f + mDragView
            .getMeasuredWidth() / 2f;
    float startY = startFromView.getY() - (mDragView.getMeasuredHeight() - startFromView.getMeasuredHeight()) / 2f + mDragView
            .getMeasuredHeight() / 2f;

    if (mSnapToTouch) {
        mPosTouchDx = 0;
        mPosTouchDy = 0;
        setPosition(touchX, touchY);
        setAnimationDx(startX - touchX);
        setAnimationDY(startY - touchY);

        PropertyValuesHolder pvhX = PropertyValuesHolder.ofFloat("AnimationDx", mAnimationDx, 0);
        PropertyValuesHolder pvhY = PropertyValuesHolder.ofFloat("AnimationDY", mAnimationDy, 0);
        ObjectAnimator anim = ObjectAnimator.ofPropertyValuesHolder(this, pvhX, pvhY);
        anim.setInterpolator(new DecelerateInterpolator());
        anim.setDuration(ANIMATION_DURATION);
        anim.start();
    } else {
        mPosTouchDx = startX - touchX;
        mPosTouchDy = startY - touchY;
        setPosition(touchX, touchY);
    }
}
 
Example #18
Source Project: ALLGO   Author: HsingPeng   File: DefaultHeaderTransformer.java    License: Apache License 2.0 5 votes vote down vote up
@Override
public void onRefreshMinimized() {
    // Here we fade out most of the header, leaving just the progress bar
    if (mContentLayout != null) {
        ObjectAnimator.ofFloat(mContentLayout, "alpha", 1f, 0f).start();
    }
}
 
Example #19
Source Project: tv-samples   Author: android   File: IconCardInChannelPublishPresenter.java    License: Apache License 2.0 5 votes vote down vote up
private void animateIconBackground(Drawable drawable, boolean hasFocus) {
    if (hasFocus) {
        ObjectAnimator.ofInt(drawable, "alpha", 0, 255).setDuration(ANIMATION_DURATION).start();
    } else {
        ObjectAnimator.ofInt(drawable, "alpha", 255, 0).setDuration(ANIMATION_DURATION).start();
    }
}
 
Example #20
Source Project: guarda-android-wallets   Author: guardaco   File: TransHistoryAdapter.java    License: GNU General Public License v3.0 5 votes vote down vote up
private void startClockwiseRotation(ImageView ivLoader) {
    loaderAnimation = ObjectAnimator.ofFloat(ivLoader, "rotation", 0.0f, 360f);
    loaderAnimation.setDuration(1500);
    loaderAnimation.setRepeatCount(ObjectAnimator.INFINITE);
    loaderAnimation.setInterpolator(new LinearInterpolator());
    loaderAnimation.start();
}
 
Example #21
Source Project: UltimateAndroid   Author: cymcsg   File: FoldingLayoutActivity.java    License: Apache License 2.0 5 votes vote down vote up
/**
 * Animates the folding view inwards (to a completely folded state) from its
 * current state and then back out to its original state.
 */
public void animateFold() {
    float foldFactor = mFoldLayout.getFoldFactor();

    ObjectAnimator animator = ObjectAnimator.ofFloat(mFoldLayout,
            "foldFactor", foldFactor, 1);
    animator.setRepeatMode(ValueAnimator.REVERSE);
    animator.setRepeatCount(1);
    animator.setDuration(FOLD_ANIMATION_DURATION);
    animator.setInterpolator(new AccelerateInterpolator());
    animator.start();
}
 
Example #22
Source Project: AllAngleExpandableButton   Author: uin3566   File: AllAngleExpandableButton.java    License: Apache License 2.0 5 votes vote down vote up
private boolean showBlur() {
    if (!blurBackground) {
        return false;
    }

    //set invisible to avoid be blurred that resulting in show the blurred button edge when expanded,
    //must be called before do blur
    setVisibility(INVISIBLE);

    final ViewGroup root = (ViewGroup) getRootView();
    root.setDrawingCacheEnabled(true);
    Bitmap bitmap = root.getDrawingCache();
    checkBlurRadius();

    blur.setParams(new Blur.Callback() {
        @Override
        public void onBlurred(Bitmap blurredBitmap) {
            blurImageView.setImageBitmap(blurredBitmap);
            root.setDrawingCacheEnabled(false);
            root.addView(blurImageView, new ViewGroup.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.MATCH_PARENT));

            blurAnimator = ObjectAnimator.ofFloat(blurImageView, "alpha", 0.0f, 1.0f).setDuration(expandAnimDuration);
            if (blurListener != null) {
                blurAnimator.removeListener(blurListener);
            }
            blurAnimator.start();

            root.addView(maskView);
            maskAttached = true;
            maskView.reset();
            maskView.initButtonRect();
            maskView.onClickMainButton();
        }
    }, getContext(), bitmap, blurRadius);
    blur.execute();

    return true;
}
 
Example #23
Source Project: RxTools-master   Author: duboAndroid   File: SpriteAnimatorBuilder.java    License: Apache License 2.0 5 votes vote down vote up
public ObjectAnimator build() {
    PropertyValuesHolder[] holders = new PropertyValuesHolder[propertyValuesHolders.size()];
    ObjectAnimator animator = ObjectAnimator.ofPropertyValuesHolder(sprite,
            propertyValuesHolders.toArray(holders));
    animator.setDuration(duration);
    animator.setRepeatCount(repeatCount);
    animator.setInterpolator(interpolator);
    return animator;
}
 
Example #24
Source Project: guarda-android-wallets   Author: guardaco   File: TransHistoryAdapter.java    License: GNU General Public License v3.0 5 votes vote down vote up
private void startClockwiseRotation(ImageView ivLoader) {
    loaderAnimation = ObjectAnimator.ofFloat(ivLoader, "rotation", 0.0f, 360f);
    loaderAnimation.setDuration(1500);
    loaderAnimation.setRepeatCount(ObjectAnimator.INFINITE);
    loaderAnimation.setInterpolator(new LinearInterpolator());
    loaderAnimation.start();
}
 
Example #25
Source Project: Genius-Android   Author: qiujuer   File: EditText.java    License: Apache License 2.0 5 votes vote down vote up
private void animateShowTitle(boolean show) {
    TitleProperty pStart = getStartProperty(show);
    TitleProperty pEnd = getEndProperty(show);

    ObjectAnimator animator = getTitleAnimator();
    animator.setObjectValues(pStart, pEnd);

    if (isAttachWindow()) {
        animator.start();
    } else {
        setTitleProperty(pEnd);
    }
}
 
Example #26
Source Project: Pixiv-Shaft   Author: CeuiLiSA   File: HeadZoomScrollView.java    License: MIT License 5 votes vote down vote up
/**
 * 回弹
 */
private void replyView() {
    final float distance = zoomView.getMeasuredWidth() - zoomViewWidth;
    // 设置动画
    ValueAnimator anim = ObjectAnimator.ofFloat(distance, 0.0F).setDuration((long) (distance * mReplyRatio));
    anim.addUpdateListener(new ValueAnimator.AnimatorUpdateListener() {
        @Override
        public void onAnimationUpdate(ValueAnimator animation) {
            setZoom((Float) animation.getAnimatedValue());
        }
    });
    anim.start();
}
 
Example #27
Source Project: materialup   Author: goodev   File: Pop.java    License: Apache License 2.0 5 votes vote down vote up
@Override
public Animator onAppear(ViewGroup sceneRoot, View view, TransitionValues startValues,
                         TransitionValues endValues) {
    return new AnimUtils.NoPauseAnimator(ObjectAnimator.ofPropertyValuesHolder(
            endValues.view,
            PropertyValuesHolder.ofFloat(View.ALPHA, 0f, 1f),
            PropertyValuesHolder.ofFloat(View.SCALE_X, 0f, 1f),
            PropertyValuesHolder.ofFloat(View.SCALE_Y, 0f, 1f)));
}
 
Example #28
Source Project: iBeebo   Author: andforce   File: GeneralPictureFragment.java    License: GNU General Public License v3.0 5 votes vote down vote up
public void animationExit(ObjectAnimator backgroundAnimator) {

        if (Math.abs(mPhotoView.getScale() - 1.0f) > 0.1f) {
            mPhotoView.setScale(1, true);
            return;
        }

        getActivity().overridePendingTransition(0, 0);
        animateClose(backgroundAnimator);

    }
 
Example #29
Source Project: UltimateAndroid   Author: cymcsg   File: AnimatedRectActivity.java    License: Apache License 2.0 5 votes vote down vote up
@Override
public void onBackPressed() {
    ObjectAnimator animator = ObjectAnimator.ofFloat(mAnimated, ANIMATED_RECT_LAYOUT_FLOAT_PROPERTY, 0).setDuration(600);
    animator.addListener(new AnimatorListenerAdapter() {
        @Override
        public void onAnimationEnd(Animator animation) {
            finish();
        }
    });
    animator.start();
}
 
Example #30
Source Project: GankGirl   Author: dalingge   File: ScaleInAnimatorAdapter.java    License: GNU Lesser General Public License v2.1 5 votes vote down vote up
@NonNull
@Override
public Animator[] getAnimators(@NonNull View view) {
    ObjectAnimator scaleX = ObjectAnimator.ofFloat(view, SCALE_X, mScaleFrom, 1f);
    ObjectAnimator scaleY = ObjectAnimator.ofFloat(view, SCALE_Y, mScaleFrom, 1f);
    return new ObjectAnimator[]{scaleX, scaleY};
}