Java Code Examples for android.animation.ObjectAnimator#start()

The following examples show how to use android.animation.ObjectAnimator#start() . 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: ShareView.java    From ChinaShare with MIT License 6 votes vote down vote up
private void shareViewTranslationAnimator(final float start, final float end) {
    if (Build.VERSION.SDK_INT >= 11) {
        ObjectAnimator bottomAnim = ObjectAnimator.ofFloat(llContent, "translationY", start, end);
        bottomAnim.setDuration(duration);
        bottomAnim.addListener(new AnimatorListenerAdapter() {
            @Override
            public void onAnimationEnd(Animator animation) {
                super.onAnimationEnd(animation);
                if (start < end) {//close ShareView
                    shareView.setVisibility(View.GONE);
                } else {//show ShareView
                }
            }
        });
        bottomAnim.start();
    }
}
 
Example 2
Source File: SettingsActivity.java    From WanAndroid with Apache License 2.0 6 votes vote down vote up
/**
 * 添加一个渐变的Bitmap在DecorView上
 */
@Deprecated
private void addBitmapOnDecorView() {
    final View decorView = getWindow().getDecorView();
    Bitmap cacheBitmap = getCacheBitmapFromView(decorView);
    if (decorView instanceof ViewGroup && cacheBitmap != null) {
        final View view = new View(this);
        view.setBackground(new BitmapDrawable(getResources(), cacheBitmap));
        ViewGroup.LayoutParams layoutParam = new ViewGroup.LayoutParams(
                ViewGroup.LayoutParams.MATCH_PARENT,
                ViewGroup.LayoutParams.MATCH_PARENT);
        ((ViewGroup) decorView).addView(view, layoutParam);
        ObjectAnimator objectAnimator = ObjectAnimator.ofFloat(view, "alpha", 1f, 0f);
        objectAnimator.setDuration(300);
        objectAnimator.addListener(new AnimatorListenerAdapter() {
            @Override
            public void onAnimationEnd(Animator animation) {
                super.onAnimationEnd(animation);
                ((ViewGroup) decorView).removeView(view);
            }
        });
        objectAnimator.start();
    }
}
 
Example 3
Source File: X8MainAiFollowConfirmController.java    From FimiX8-RE with MIT License 6 votes vote down vote up
public void closeAiUi() {
    this.blank.setVisibility(8);
    if (this.isShow) {
        Log.i("zdy", "closeAiUi...........");
        this.isShow = false;
        ObjectAnimator translationRight = ObjectAnimator.ofFloat(this.contentView, "translationX", new float[]{0.0f, (float) this.width});
        translationRight.setDuration(300);
        translationRight.start();
        translationRight.addListener(new AnimatorListenerAdapter() {
            public void onAnimationEnd(Animator animation) {
                super.onAnimationEnd(animation);
                X8MainAiFollowConfirmController.this.mainLayout.setVisibility(4);
                ((ViewGroup) X8MainAiFollowConfirmController.this.contentView).removeAllViews();
            }
        });
    }
}
 
Example 4
Source File: AnimationUtil.java    From DeviceConnect-Android with MIT License 5 votes vote down vote up
public static void animateAlpha(final View target, final Animator.AnimatorListener listener) {
    ObjectAnimator objectAnimator = ObjectAnimator.ofFloat(target, "alpha", 1f, 0f);
    objectAnimator.setDuration(500);
    objectAnimator.start();
    if (listener != null) {
        objectAnimator.addListener(listener);
    }
}
 
Example 5
Source File: LineIndicator.java    From android with MIT License 5 votes vote down vote up
public void animateIndicator(float progress) {
    Interpolator interpolator = new AnticipateOvershootInterpolator(1.8f);
    ObjectAnimator animation = ObjectAnimator.ofFloat(this, "progress", progress);
    animation.setDuration(3000);
    animation.setInterpolator(interpolator);
    animation.start();
}
 
Example 6
Source File: ChartAnimator.java    From Ticket-Analysis with MIT License 5 votes vote down vote up
/**
 * Animates the rendering of the chart on the y-axis with the specified
 * animation time. If animate(...) is called, no further calling of
 * invalidate() is necessary to refresh the chart.
 *
 * @param durationMillis
 * @param easing
 */
public void animateY(int durationMillis, Easing.EasingOption easing) {

    if (android.os.Build.VERSION.SDK_INT < 11)
        return;

    ObjectAnimator animatorY = ObjectAnimator.ofFloat(this, "phaseY", 0f, 1f);
    animatorY.setInterpolator(Easing.getEasingFunctionFromOption(easing));
    animatorY.setDuration(durationMillis);
    animatorY.addUpdateListener(mListener);
    animatorY.start();
}
 
Example 7
Source File: PickerView.java    From ColorPickerDialog with Apache License 2.0 5 votes vote down vote up
/**
 * Set the color's alpha, between 0-1 (inclusive).
 *
 * @param alpha         The color's alpha, between 0-1 (inclusive).
 * @param animate       Whether to animate the change in values.
 */
public void setColorAlpha(int alpha, boolean animate) {
    if (this.alpha == null)
        return;

    if (animate && !isTrackingTouch) {
        ObjectAnimator animator = ObjectAnimator.ofInt(this.alpha, "progress", alpha);
        animator.setInterpolator(new DecelerateInterpolator());
        animator.start();
    } else {
        this.alpha.setProgress(alpha);
    }
}
 
Example 8
Source File: Ripple.java    From AcDisplay with GNU General Public License v2.0 5 votes vote down vote up
private void exitSoftware(int radiusDuration, int opacityDuration) {
    final ObjectAnimator radiusAnim = ObjectAnimator.ofFloat(this, "radiusGravity", 1);
    if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN_MR2)
        radiusAnim.setAutoCancel(true);
    radiusAnim.setDuration(radiusDuration);
    radiusAnim.setInterpolator(DECEL_INTERPOLATOR);

    final ObjectAnimator xAnim = ObjectAnimator.ofFloat(this, "xGravity", 1);
    if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN_MR2) xAnim.setAutoCancel(true);
    xAnim.setDuration(radiusDuration);
    xAnim.setInterpolator(DECEL_INTERPOLATOR);

    final ObjectAnimator yAnim = ObjectAnimator.ofFloat(this, "yGravity", 1);
    if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN_MR2) yAnim.setAutoCancel(true);
    yAnim.setDuration(radiusDuration);
    yAnim.setInterpolator(DECEL_INTERPOLATOR);

    final ObjectAnimator opacityAnim = ObjectAnimator.ofFloat(this, "opacity", 0);
    if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN_MR2)
        opacityAnim.setAutoCancel(true);
    opacityAnim.setDuration(opacityDuration);
    opacityAnim.setInterpolator(LINEAR_INTERPOLATOR);
    opacityAnim.addListener(mAnimationListener);

    mAnimRadius = radiusAnim;
    mAnimOpacity = opacityAnim;
    mAnimX = xAnim;
    mAnimY = yAnim;

    radiusAnim.start();
    opacityAnim.start();
    xAnim.start();
    yAnim.start();
}
 
Example 9
Source File: DialogWithBlurredBackgroundLauncher.java    From fogger with Apache License 2.0 5 votes vote down vote up
private void showBlurredBackground(Bitmap blurredImage) {
    blurImageView.setImageBitmap(blurredImage);
    ObjectAnimator fadeInAnimator = ObjectAnimator.ofFloat(blurImageView,
            FADE_IN_ANIMATION_PARAMETER,
            FADE_IN_ANIMATION_END_VALUE);
    fadeInAnimator.setDuration(blurAnimationDuration);
    fadeInAnimator.start();
}
 
Example 10
Source File: ZhiActivity.java    From MiniPay with Apache License 2.0 5 votes vote down vote up
private void initData() {
    Config config = (Config) getIntent().getSerializableExtra(MiniPayUtils.EXTRA_KEY_PAY_CONFIG);
    this.wechatQaImage = config.getWechatQaImage();
    this.aliQaImage = config.getAliQaImage();
    this.wechatTip = config.getWechatTip();
    this.aliTip = config.getAliTip();
    this.aliZhiKey = config.getAliZhiKey();

    if (!checkLegal()) {
        throw new IllegalStateException("MiniPay Config illegal!!!");
    } else {
        if (TextUtils.isEmpty(wechatTip)) wechatTip = getString(R.string.wei_zhi_tip);
        if (TextUtils.isEmpty(aliTip)) aliTip = getString(R.string.ali_zhi_tip);

        mZhiBg.setBackgroundResource(R.drawable.common_bg);
        mTitleTv.setText(R.string.wei_zhi_title);
        mSummeryTv.setText(wechatTip);
        mQaImage.setImageResource(wechatQaImage);
    }

    ObjectAnimator animator = ObjectAnimator.ofFloat(mTip, "alpha", 0, 0.66f, 1.0f, 0);
    animator.setDuration(2888);
    animator.setRepeatCount(6);
    animator.setInterpolator(new AccelerateDecelerateInterpolator());
    animator.setRepeatMode(ValueAnimator.REVERSE);
    animator.start();
}
 
Example 11
Source File: SlideInAnimationHandler.java    From android-open-project-demo with Apache License 2.0 5 votes vote down vote up
@Override
    public void animateMenuClosing(Point center) {
        super.animateMenuOpening(center);

        setAnimating(true);

        Animator lastAnimation = null;
        for (int i = 0; i < menu.getSubActionItems().size(); i++) {
//            PropertyValuesHolder pvhX = PropertyValuesHolder.ofFloat(View.TRANSLATION_X, - (menu.getSubActionItems().get(i).x - center.x + menu.getSubActionItems().get(i).width / 2));
            PropertyValuesHolder pvhY = PropertyValuesHolder.ofFloat(View.TRANSLATION_Y, DIST_Y);
//            PropertyValuesHolder pvhsX = PropertyValuesHolder.ofFloat(View.SCALE_X, 0);
//            PropertyValuesHolder pvhsY = PropertyValuesHolder.ofFloat(View.SCALE_Y, 0);
            PropertyValuesHolder pvhA = PropertyValuesHolder.ofFloat(View.ALPHA, 0);

            final ObjectAnimator animation = ObjectAnimator.ofPropertyValuesHolder(menu.getSubActionItems().get(i).view, pvhY, pvhA);
            animation.setDuration(DURATION);
            animation.setInterpolator(new AccelerateInterpolator());
            animation.addListener(new SubActionItemAnimationListener(menu.getSubActionItems().get(i), ActionType.CLOSING));

            if(i == 0) {
                lastAnimation = animation;
            }

            if(i <= menu.getSubActionItems().size()/2) {
                animation.setStartDelay(i * LAG_BETWEEN_ITEMS);
            }
            else {
                animation.setStartDelay((menu.getSubActionItems().size() - i) * LAG_BETWEEN_ITEMS);
            }
            animation.start();
        }
        if(lastAnimation != null) {
            lastAnimation.addListener(new LastAnimationListener());
        }
    }
 
Example 12
Source File: PreciseLocationActivity.java    From VirtualLocation with Apache License 2.0 5 votes vote down vote up
private void progressAnimator(final View view) {
    PropertyValuesHolder animator = PropertyValuesHolder.ofFloat("scaleX",
            0.5f, 1f);
    PropertyValuesHolder animator2 = PropertyValuesHolder.ofFloat("scaleY",
            0.5f, 1f);
    ObjectAnimator animator3 = ObjectAnimator.ofPropertyValuesHolder(view,
            animator, animator2);
    animator3.setDuration(1000);
    animator3.setInterpolator(new JellyInterpolator());
    animator3.start();
}
 
Example 13
Source File: TimePickerDialog.java    From StyleableDateTimePicker with MIT License 5 votes vote down vote up
private void setCurrentItemShowing(int index, boolean animateCircle, boolean delayLabelAnimate,
        boolean announce) {
    mTimePicker.setCurrentItemShowing(index, animateCircle);

    TextView labelToAnimate;
    if (index == HOUR_INDEX) {
        int hours = mTimePicker.getHours();
        if (!mIs24HourMode) {
            hours = hours % 12;
        }
        mTimePicker.setContentDescription(mHourPickerDescription + ": " + hours);
        if (announce) {
            Utils.tryAccessibilityAnnounce(mTimePicker, mSelectHours);
        }
        labelToAnimate = mHourView;
    } else {
        int minutes = mTimePicker.getMinutes();
        mTimePicker.setContentDescription(mMinutePickerDescription + ": " + minutes);
        if (announce) {
            Utils.tryAccessibilityAnnounce(mTimePicker, mSelectMinutes);
        }
        labelToAnimate = mMinuteView;
    }

    mHourView.setSelected(index == HOUR_INDEX);
    mMinuteView.setSelected(index == MINUTE_INDEX);

    ObjectAnimator pulseAnimator = Utils.getPulseAnimator(labelToAnimate, 0.85f, 1.1f);
    if (delayLabelAnimate) {
        pulseAnimator.setStartDelay(PULSE_ANIMATOR_DELAY);
    }
    pulseAnimator.start();
}
 
Example 14
Source File: SquareSpinIndicator.java    From LazyRecyclerAdapter with MIT License 5 votes vote down vote up
@Override
public List<Animator> createAnimation() {
    List<Animator> animators = new ArrayList<>();
    PropertyValuesHolder rotation5 = PropertyValuesHolder.ofFloat("rotationX", 0, 180, 180, 0, 0);
    PropertyValuesHolder rotation6 = PropertyValuesHolder.ofFloat("rotationY", 0, 0, 180, 180, 0);
    ObjectAnimator animator = ObjectAnimator.ofPropertyValuesHolder(getTarget(), rotation6, rotation5);
    animator.setInterpolator(new LinearInterpolator());
    animator.setRepeatCount(-1);
    animator.setDuration(2500);
    animator.start();
    animators.add(animator);
    return animators;
}
 
Example 15
Source File: ShowPictureActivity.java    From FlyWoo with Apache License 2.0 5 votes vote down vote up
private void activityEnterAnim() {
    mImageView.setPivotX(0);
    mImageView.setPivotY(0);
    mImageView.setScaleX(mScaleX);
    mImageView.setScaleY(mScaleY);
    mImageView.setTranslationX(mLeft);
    mImageView.setTranslationY(mTop);
    mImageView.animate().scaleX(1).scaleY(1).translationX(0).translationY(0).
            setDuration(300).setInterpolator(new DecelerateInterpolator()).start();
    ObjectAnimator objectAnimator = ObjectAnimator.ofInt(mBackground, "alpha", 0, 255);
    objectAnimator.setInterpolator(new DecelerateInterpolator());
    objectAnimator.setDuration(300);
    objectAnimator.start();
}
 
Example 16
Source File: RadioRealButtonGroup.java    From RadioRealButton with Apache License 2.0 5 votes vote down vote up
private void animateSelectorSliding(int toPosition, String property, boolean hasAnimation, boolean enableDeselection) {
    boolean isViewDrawn = buttons.size() > 0 && buttons.get(0).getWidth() > 0;
    if (!isViewDrawn) {
        if (initialPosition != -1)
            v_selectors.get(initialPosition).setVisibility(INVISIBLE);
        v_selectors.get(toPosition).setVisibility(VISIBLE);
        initialPosition = toPosition;
        return;
    }

    if (initialPosition < 0) {
        initialPosition = 0;

        View view = v_selectors.get(initialPosition);
        view.setTranslationX(-buttons.get(initialPosition).getMeasuredWidth());
        view.setVisibility(VISIBLE);
    }

    if (enableDeselection && toPosition == lastPosition && buttons.get(toPosition).isChecked()) {
        toPosition = lastPosition > numberOfButtons / 2 ? numberOfButtons : -1;
    }

    float position = toPosition - initialPosition;

    float value = buttons.get(initialPosition).getMeasuredWidth() * position + dividerSize * position;
    ObjectAnimator animator = createAnimator(v_selectors.get(initialPosition), property, value, false, hasAnimation);
    animator.start();
}
 
Example 17
Source File: CaptureLayout.java    From imsdk-android with MIT License 4 votes vote down vote up
public void setTextWithAnimation(String tip) {
    txt_tip.setText(tip);
    ObjectAnimator animator_txt_tip = ObjectAnimator.ofFloat(txt_tip, "alpha", 0f, 1f, 1f, 0f);
    animator_txt_tip.setDuration(2500);
    animator_txt_tip.start();
}
 
Example 18
Source File: FirstActivity.java    From YourWeather with Apache License 2.0 4 votes vote down vote up
private void playCloud_3Anim() {
    float cloud3TranslationX = splashCould3.getTranslationX();
    ObjectAnimator anim = ObjectAnimator.ofFloat(splashCould3, "translationX",cloud3TranslationX,-300f,cloud3TranslationX);
    anim.setDuration(8 * 1000);
    anim.start();
}
 
Example 19
Source File: TransitionHelper.java    From HaiNaBaiChuan with Apache License 2.0 4 votes vote down vote up
public static void startRevertFromMenu(View root, AnimatorListenerAdapter animatorListenerAdapter) {
        DepthLayout dl = getLayout(root, R.id.root_dl);
        ObjectAnimator oa = null;
        if (dl != null) {//exitAnimate(dl, 0, 30f, 15, 190, false);
            oa = revertFromMenu(dl, 30f, 10, 0);
        }
        dl = getLayout(root, R.id.appbar);
        if (dl != null) {//exitAnimate(dl, MOVE_Y_STEP, 20f, 30, 170, false);
            oa = revertFromMenu(dl, 20f, 0, 0);
        }
        dl = getLayout(root, R.id.status);
        if (dl != null) {//exitAnimate(dl, MOVE_Y_STEP * 2, 20f, 75, 250, false);
            oa = revertFromMenu(dl, 20f, 40, 2);
        }
//        dl = getLayout(root, R.id.fab_right);
//        if (dl != null) {//exitAnimate(dl, MOVE_Y_STEP * 2f, 20f, 45, 210, false);
//            oa = revertFromMenu(dl, 20f, 20, 6);
//        }
        dl = getLayout(root, R.id.fab_container);
        if (dl != null) {//exitAnimate(dl, MOVE_Y_STEP * 2f, 20f, 45, 210, false);
            oa = revertFromMenu(dl, 20f, 20, 6);
        }
        dl = getLayout(root, R.id.dl2);
        if (dl != null) {//exitAnimate(dl, MOVE_Y_STEP, 20f, 60, 230, false);
            oa = revertFromMenu(dl, 20f, 30, 1);
        }
        dl = getLayout(root, R.id.dl3);
        if (dl != null) {//exitAnimate(dl, MOVE_Y_STEP * 2, 20f, 75, 250, false).addListener(onMenuAnimFinished);
            oa = revertFromMenu(dl, 20f, 40, 2);
        }

        if (oa != null) {
            oa.addListener(animatorListenerAdapter);
        }
//        ObjectAnimator translationY = ObjectAnimator.ofFloat(root, View.TRANSLATION_Y, -90f * root.getResources().getDisplayMetrics().density).setDuration(DURATION);
//        translationY.setInterpolator(VALUEinterpolator);
//        translationY.start();

        ObjectAnimator translationY = ObjectAnimator.ofFloat(root, View.TRANSLATION_Y, 0).setDuration(DURATION);
        translationY.setInterpolator(new QuintInOut());
        translationY.start();
    }
 
Example 20
Source File: BallView.java    From RelaxFinger with GNU General Public License v2.0 3 votes vote down vote up
public void showNotifyAnim(){

        ObjectAnimator shakeAnim = FloatingBallUtils.shakeAnim(this,1.0f);

        shakeAnim.setupEndValues();

        shakeAnim.start();


    }