类android.view.animation.CycleInterpolator源码实例Demo

下面列出了怎么用android.view.animation.CycleInterpolator的API类实例代码及写法,或者点击链接到github查看源代码。

源代码1 项目: weMessage   文件: ContactSelectActivity.java
private void invalidateField(final EditText editText){
    ValueAnimator colorAnimation = ValueAnimator.ofObject(new ArgbEvaluator(), getResources().getColor(R.color.colorHeader), getResources().getColor(R.color.brightRed));
    colorAnimation.setDuration(200);
    colorAnimation.addUpdateListener(new ValueAnimator.AnimatorUpdateListener() {
        @Override
        public void onAnimationUpdate(ValueAnimator animation) {
            editText.setTextColor((int) animation.getAnimatedValue());
        }
    });

    Animation invalidShake = AnimationUtils.loadAnimation(this, R.anim.invalid_shake);
    invalidShake.setInterpolator(new CycleInterpolator(7F));

    colorAnimation.start();
    editText.startAnimation(invalidShake);
}
 
源代码2 项目: weMessage   文件: ContactSelectActivity.java
private void invalidateField(final EditText editText){
    ValueAnimator colorAnimation = ValueAnimator.ofObject(new ArgbEvaluator(), getResources().getColor(R.color.colorHeader), getResources().getColor(R.color.invalidRed));
    colorAnimation.setDuration(200);
    colorAnimation.addUpdateListener(new ValueAnimator.AnimatorUpdateListener() {
        @Override
        public void onAnimationUpdate(ValueAnimator animation) {
            editText.getBackground().setColorFilter((int) animation.getAnimatedValue(), PorterDuff.Mode.SRC_ATOP);
            editText.setTextColor((int) animation.getAnimatedValue());
        }
    });

    Animation invalidShake = AnimationUtils.loadAnimation(getActivity(), R.anim.invalid_shake);
    invalidShake.setInterpolator(new CycleInterpolator(7F));

    colorAnimation.start();
    editText.startAnimation(invalidShake);
}
 
源代码3 项目: weMessage   文件: SetNumberActivity.java
private void invalidateField(final EditText editText){
    ValueAnimator colorAnimation = ValueAnimator.ofObject(new ArgbEvaluator(), getResources().getColor(R.color.colorHeader), getResources().getColor(R.color.invalidRed));
    colorAnimation.setDuration(200);
    colorAnimation.addUpdateListener(new ValueAnimator.AnimatorUpdateListener() {
        @Override
        public void onAnimationUpdate(ValueAnimator animation) {
            editText.getBackground().setColorFilter((int) animation.getAnimatedValue(), PorterDuff.Mode.SRC_ATOP);
            editText.setTextColor((int) animation.getAnimatedValue());
        }
    });

    Animation invalidShake = AnimationUtils.loadAnimation(this, R.anim.invalid_shake);
    invalidShake.setInterpolator(new CycleInterpolator(7F));

    colorAnimation.start();
    editText.startAnimation(invalidShake);
}
 
源代码4 项目: weMessage   文件: LaunchFragment.java
private void invalidateField(final EditText editText){
    ValueAnimator colorAnimation = ValueAnimator.ofObject(new ArgbEvaluator(), getResources().getColor(R.color.colorHeader), getResources().getColor(R.color.invalidRed));
    colorAnimation.setDuration(200);
    colorAnimation.addUpdateListener(new ValueAnimator.AnimatorUpdateListener() {
        @Override
        public void onAnimationUpdate(ValueAnimator animation) {
            editText.getBackground().setColorFilter((int) animation.getAnimatedValue(), PorterDuff.Mode.SRC_ATOP);
            editText.setTextColor((int) animation.getAnimatedValue());
        }
    });

    Animation invalidShake = AnimationUtils.loadAnimation(getActivity(), R.anim.invalid_shake);
    invalidShake.setInterpolator(new CycleInterpolator(7F));

    colorAnimation.start();
    editText.startAnimation(invalidShake);
}
 
源代码5 项目: weMessage   文件: CreateChatFragment.java
private void invalidateField(final EditText editText){
    ValueAnimator colorAnimation = ValueAnimator.ofObject(new ArgbEvaluator(), getResources().getColor(R.color.colorHeader), getResources().getColor(R.color.brightRed));
    colorAnimation.setDuration(200);
    colorAnimation.addUpdateListener(new ValueAnimator.AnimatorUpdateListener() {
        @Override
        public void onAnimationUpdate(ValueAnimator animation) {
            editText.setTextColor((int) animation.getAnimatedValue());
        }
    });

    Animation invalidShake = AnimationUtils.loadAnimation(getActivity(), R.anim.invalid_shake);
    invalidShake.setInterpolator(new CycleInterpolator(7F));

    colorAnimation.start();
    editText.startAnimation(invalidShake);
}
 
源代码6 项目: Android   文件: PatterDrawActivity.java
/**
 * According to the different status display text message
 * @param resId
 * @param isError
 */
private void showErrorHint(String resId,boolean isError){
    if(resId == null){
        drawpatterTv.setVisibility(View.INVISIBLE);
    }else{
        drawpatterTv.setVisibility(View.VISIBLE);
        drawpatterTv.setText(resId);
        if(isError){
            drawpatterTv.setTextColor(mActivity.getResources().getColor(R.color.color_ff6c5a));
            Animation animationInto = AnimationUtils.loadAnimation(mActivity,R.anim.text_shake);
            animationInto.setInterpolator(new CycleInterpolator(5));
            drawpatterTv.setAnimation(animationInto);
        }else{
            drawpatterTv.setTextColor(mActivity.getResources().getColor(R.color.color_161A21));
        }
    }
}
 
源代码7 项目: SegmentedButton   文件: SegmentedButtonGroup.java
private void initInterpolations() {
    ArrayList<Class> interpolatorList = new ArrayList<Class>() {{
        add(FastOutSlowInInterpolator.class);
        add(BounceInterpolator.class);
        add(LinearInterpolator.class);
        add(DecelerateInterpolator.class);
        add(CycleInterpolator.class);
        add(AnticipateInterpolator.class);
        add(AccelerateDecelerateInterpolator.class);
        add(AccelerateInterpolator.class);
        add(AnticipateOvershootInterpolator.class);
        add(FastOutLinearInInterpolator.class);
        add(LinearOutSlowInInterpolator.class);
        add(OvershootInterpolator.class);
    }};

    try {
        interpolatorSelector = (Interpolator) interpolatorList.get(animateSelector).newInstance();
    } catch (Exception e) {
        e.printStackTrace();
    }
}
 
源代码8 项目: CircularProgressDrawable   文件: MainActivity.java
/**
 * This animation will make a pulse effect to the inner circle
 *
 * @return Animation
 */
private Animator preparePulseAnimation() {
    AnimatorSet animation = new AnimatorSet();

    Animator firstBounce = ObjectAnimator.ofFloat(drawable, CircularProgressDrawable.CIRCLE_SCALE_PROPERTY,
            drawable.getCircleScale(), 0.88f);
    firstBounce.setDuration(300);
    firstBounce.setInterpolator(new CycleInterpolator(1));
    Animator secondBounce = ObjectAnimator.ofFloat(drawable, CircularProgressDrawable.CIRCLE_SCALE_PROPERTY,
            0.75f, 0.83f);
    secondBounce.setDuration(300);
    secondBounce.setInterpolator(new CycleInterpolator(1));
    Animator thirdBounce = ObjectAnimator.ofFloat(drawable, CircularProgressDrawable.CIRCLE_SCALE_PROPERTY,
            0.75f, 0.80f);
    thirdBounce.setDuration(300);
    thirdBounce.setInterpolator(new CycleInterpolator(1));

    animation.playSequentially(firstBounce, secondBounce, thirdBounce);
    return animation;
}
 
源代码9 项目: PaymentKit-Droid   文件: AnimUtils.java
/**
 * @param shouldResetTextColor if true make sure you end the previous animation before starting this one.
 */
public static ObjectAnimator getShakeAnimation(final TextView textView, final boolean shouldResetTextColor) {
    final int textColor = textView.getCurrentTextColor();
    textView.setTextColor(Color.RED);

    ObjectAnimator shakeAnim = ObjectAnimator.ofFloat(textView, "translationX", -16);
    shakeAnim.setDuration(SHAKE_DURATION);
    shakeAnim.setInterpolator(new CycleInterpolator(2.0f));
    shakeAnim.addListener(new AnimatorListenerAdapter() {
        @Override
        public void onAnimationEnd(Animator anim) {
            if (shouldResetTextColor) {
                textView.setTextColor(textColor);
            }
        }
    });
    return shakeAnim;
}
 
源代码10 项目: VideoOS-Android-SDK   文件: UDInterpolator.java
public static Interpolator parse(Integer type, Float cycles) {
    if (type != null) {
        switch (type) {
            case 0:
                return new AccelerateDecelerateInterpolator();
            case 1:
                return new AccelerateInterpolator();
            case 2:
                return new AnticipateInterpolator();
            case 3:
                return new AnticipateOvershootInterpolator();
            case 4:
                return new BounceInterpolator();
            case 5:
                return new CycleInterpolator((cycles != null && cycles > 0) ? cycles : 1f);
            case 6:
                return new DecelerateInterpolator();
            case 7:
                return new LinearInterpolator();
            case 8:
                return new OvershootInterpolator();
            default:
                return new LinearInterpolator();
        }
    } else {
        return new LinearInterpolator();
    }
}
 
源代码11 项目: IP-Monitor   文件: ClearEditText.java
public static Animation shakeAnimation(int counts)
{
	Animation translateAnimation = new TranslateAnimation(0, 10, 0, 0);
	translateAnimation.setInterpolator(new CycleInterpolator(counts));
	translateAnimation.setDuration(1000);
	return translateAnimation;
}
 
源代码12 项目: sealrtc-android   文件: ClearWriteEditText.java
/**
 * 晃动动画
 *
 * @param counts 半秒钟晃动多少下
 * @return
 */
public static Animation shakeAnimation(int counts) {
    Animation translateAnimation = new TranslateAnimation(0, 10, 0, 0);
    translateAnimation.setInterpolator(new CycleInterpolator(counts));
    translateAnimation.setDuration(500);
    return translateAnimation;
}
 
源代码13 项目: PocketEOS-Android   文件: ClearEditText.java
/**
 * 晃动动画
 * @param counts 1秒钟晃动多少下
 * @return
 */
public static Animation shakeAnimation(int counts){
    Animation translateAnimation = new TranslateAnimation(0, 10, 0, 0);
    translateAnimation.setInterpolator(new CycleInterpolator(counts));
    translateAnimation.setDuration(1000);
    return translateAnimation;
}
 
源代码14 项目: Android_UE   文件: ClearEditText.java
/**
 * 晃动动画
 *
 * @param counts 1秒钟晃动多少下
 * @return
 */
public static Animation shakeAnimation(int counts) {
    Animation translateAnimation = new TranslateAnimation(0, 10, 0, 0);
    translateAnimation.setInterpolator(new CycleInterpolator(counts));
    translateAnimation.setDuration(800);
    return translateAnimation;
}
 
源代码15 项目: o2oa   文件: ClearWriteEditText.java
/**
 * 晃动动画
 * @param counts 半秒钟晃动多少下
 * @return
 */
public static Animation shakeAnimation(int counts) {
    Animation translateAnimation = new TranslateAnimation(0, 10, 0, 0);
    translateAnimation.setInterpolator(new CycleInterpolator(counts));
    translateAnimation.setDuration(500);
    return translateAnimation;
}
 
源代码16 项目: Android   文件: LoginPatterActivity.java
@Override
public void initView() {
    mActivity = this;
    toolbarTop.setTitleImg(R.mipmap.logo_black_middle);

    UserBean userBean = SharedPreferenceUtil.getInstance().getUser();
    idGestureLockViewGroup.setAnswer(userBean.getPriKey(),userBean.getSalt());
    idGestureLockViewGroup.setOnGestureLockViewListener(new GestureLockViewGroup.OnGestureLockViewListener() {
        @Override
        public void onBlockSelected(int cId) {

        }

        @Override
        public void onGestureEvent(boolean matched) {
            if (matched) {
                goinHome(idGestureLockViewGroup.getPriKey());
            } else {
                hintTv.setText(getString(R.string.Set_Password_incorrect_you_have_chance,idGestureLockViewGroup.getUnMatchExceedBoundary()));

                Animation animationInto = AnimationUtils.loadAnimation(mActivity,R.anim.text_shake);
                animationInto.setInterpolator(new CycleInterpolator(5));
                hintTv.setAnimation(animationInto);
            }
        }

        @Override
        public void onUnmatchedExceedBoundary() {
            SharedPreferenceUtil.getInstance().remove(SharedPreferenceUtil.USER_INFO);
            ActivityUtil.next(mActivity, LoginForPhoneActivity.class);
            finish();
        }
    });
}
 
源代码17 项目: PasscodeView   文件: BoxFingerprint.java
/**
 * Apply the error animations which will move key left to right and after right to left for two times.
 */
private ValueAnimator playErrorAnimation() {
    ValueAnimator goLeftAnimator = ValueAnimator.ofInt(0, 10);
    goLeftAnimator.setInterpolator(new CycleInterpolator(2));
    goLeftAnimator.addUpdateListener(new ValueAnimator.AnimatorUpdateListener() {
        @Override
        public void onAnimationUpdate(ValueAnimator animation) {
            mBounds.left += (int) animation.getAnimatedValue();
            mBounds.right += (int) animation.getAnimatedValue();
            getRootView().invalidate();
        }
    });
    return goLeftAnimator;
}
 
源代码18 项目: PasscodeView   文件: SquareKey.java
/**
 * Public constructor.
 */
private SquareKey(@NonNull SquareKey.Builder builder,
                  @NonNull final String keyTitle,
                  @NonNull final Rect bound) {
    super(builder, keyTitle, bound);

    mBuilder = builder;

    //Set the keyboard paint
    mKeyPaint = new Paint(Paint.ANTI_ALIAS_FLAG);
    mKeyPaint.setStyle(Paint.Style.STROKE);
    mKeyPaint.setColor(builder.mKeyStrokeColor);
    mKeyPaint.setTextSize(builder.mKeyTextSize);
    mKeyPaint.setStrokeWidth(builder.mKeyStrokeWidth);

    //Set the keyboard text paint
    mKeyTextPaint = new TextPaint(Paint.ANTI_ALIAS_FLAG);
    mKeyTextPaint.setColor(builder.mKeyTextColor);
    mKeyTextPaint.setTextSize(builder.mKeyTextSize);
    mKeyTextPaint.setFakeBoldText(true);
    mKeyTextPaint.setTextAlign(Paint.Align.CENTER);

    //Ripple paint
    mRipplePaint = new Paint(Paint.ANTI_ALIAS_FLAG);
    mRipplePaint.setStyle(Paint.Style.STROKE);
    mRipplePaint.setColor(Utils.makeColorDark(builder.mKeyStrokeColor));
    mRipplePaint.setStrokeWidth(builder.mKeyStrokeWidth);

    //Error animator
    mErrorAnimator = ValueAnimator.ofInt(0, 10);
    mErrorAnimator.setInterpolator(new CycleInterpolator(2));
    mErrorAnimator.addUpdateListener(new ValueAnimator.AnimatorUpdateListener() {
        @Override
        public void onAnimationUpdate(ValueAnimator animation) {
            getBounds().left += (int) animation.getAnimatedValue();
            getBounds().right += (int) animation.getAnimatedValue();
            getPasscodeView().invalidate();
        }
    });
}
 
源代码19 项目: PasscodeView   文件: RectKey.java
/**
 * Public constructor.
 */
private RectKey(@NonNull RectKey.Builder builder,
                @NonNull final String keyTitle,
                @NonNull final Rect bound) {
    super(builder, keyTitle, bound);

    mBuilder = builder;

    //Set the keyboard paint
    mKeyPaint = new Paint(Paint.ANTI_ALIAS_FLAG);
    mKeyPaint.setStyle(Paint.Style.STROKE);
    mKeyPaint.setColor(builder.mKeyStrokeColor);
    mKeyPaint.setTextSize(builder.mKeyTextSize);
    mKeyPaint.setStrokeWidth(builder.mKeyStrokeWidth);

    //Set the keyboard text paint
    mKeyTextPaint = new TextPaint(Paint.ANTI_ALIAS_FLAG);
    mKeyTextPaint.setColor(builder.mKeyTextColor);
    mKeyTextPaint.setTextSize(builder.mKeyTextSize);
    mKeyTextPaint.setFakeBoldText(true);
    mKeyTextPaint.setTextAlign(Paint.Align.CENTER);

    //Ripple paint
    mRipplePaint = new Paint(Paint.ANTI_ALIAS_FLAG);
    mRipplePaint.setStyle(Paint.Style.STROKE);
    mRipplePaint.setColor(Utils.makeColorDark(builder.mKeyStrokeColor));
    mRipplePaint.setStrokeWidth(builder.mKeyStrokeWidth);

    //Error animator
    mErrorAnimator = ValueAnimator.ofInt(0, 10);
    mErrorAnimator.setInterpolator(new CycleInterpolator(2));
    mErrorAnimator.addUpdateListener(new ValueAnimator.AnimatorUpdateListener() {
        @Override
        public void onAnimationUpdate(ValueAnimator animation) {
            getBounds().left += (int) animation.getAnimatedValue();
            getBounds().right += (int) animation.getAnimatedValue();
            getPasscodeView().invalidate();
        }
    });
}
 
源代码20 项目: sctalk   文件: SearchEditText.java
/**
 * 晃动动画
 * @param counts 1秒钟晃动多少下
 * @return
 */
public static Animation shakeAnimation(int counts){
    Animation translateAnimation = new TranslateAnimation(0, 10, 0, 0);
    translateAnimation.setInterpolator(new CycleInterpolator(counts));
    translateAnimation.setDuration(1000);
    return translateAnimation;
}
 
源代码21 项目: CloudPan   文件: ClearEditText.java
/**
 * �����
 * @param counts 1���ӻζ�������
 * @return
 */
public static Animation shakeAnimation(int counts){
	Animation translateAnimation = new TranslateAnimation(0, 10, 0, 0);
	translateAnimation.setInterpolator(new CycleInterpolator(counts));
	translateAnimation.setDuration(1000);
	return translateAnimation;
}
 
源代码22 项目: LittleFreshWeather   文件: SplashActivity.java
private void startAnimation() {
    ObjectAnimator animator = ObjectAnimator.ofFloat(ivSplashIcon, "translationY", 0, -(ivSplashIcon.getHeight() >> 1));
    animator.setDuration(800);
    animator.setRepeatCount(ObjectAnimator.INFINITE);
    animator.setRepeatMode(ObjectAnimator.RESTART);
    animator.setInterpolator(new CycleInterpolator(0.5f));
    animator.start();
}
 
源代码23 项目: Android-Application-ZJB   文件: ClearEditText.java
/**
 * 晃动动画
 *
 * @param counts 1秒钟晃动多少下
 * @return
 */
public static Animation shakeAnimation(int counts) {
    Animation translateAnimation = new TranslateAnimation(0, 10, 0, 0);
    translateAnimation.setInterpolator(new CycleInterpolator(counts));
    translateAnimation.setDuration(1000);
    return translateAnimation;
}
 
private void failureAnim() {
    float currentX = this.getTranslationX();
    ObjectAnimator tansXAnim = ObjectAnimator.ofFloat(this, "translationX",currentX+20);
    tansXAnim.setDuration(1000);
    tansXAnim.setInterpolator(new CycleInterpolator(3));
    tansXAnim.start();
}
 
源代码25 项目: SprintNBA   文件: ShakeHorizontal.java
@Override
public void setAnimation(View view) {
	ObjectAnimator animator = ObjectAnimator.ofFloat(view, "translationX", -10, 10);
	animator.setInterpolator(new CycleInterpolator(5));
	animatorSet.playTogether(animator);

	/**
	 * <pre>
	 *  另一种shake实现
	 * ObjectAnimator.ofFloat(view, "translationX", 0, 25, -25, 25, -25, 15, -15, 6, -6, 0);
	 * </pre>
	 */
}
 
源代码26 项目: MyHearts   文件: ClearCityEditText.java
/**
 * 抖动动动画
 * counts 1秒钟晃动多少下
 */
public static Animation shakeAnimation(int counts){
	Animation translateAnimation = new TranslateAnimation(0, 10, 0, 0);
	translateAnimation.setInterpolator(new CycleInterpolator(counts));
	translateAnimation.setDuration(1000);
	return translateAnimation;
}
 
源代码27 项目: android-passcodeview   文件: KeyRect.java
/**
 * Show animation indicated invalid pincode
 */
public void setError() {
  ValueAnimator goLeftAnimator = ValueAnimator.ofInt(0, 5);
  goLeftAnimator.setInterpolator(new CycleInterpolator(2));
  goLeftAnimator.addUpdateListener(new ValueAnimator.AnimatorUpdateListener() {
    @Override public void onAnimationUpdate(ValueAnimator animation) {
      rect.left += (int) animation.getAnimatedValue();
      rect.right += (int) animation.getAnimatedValue();
      view.invalidate();
    }
  });
  goLeftAnimator.start();
}
 
源代码28 项目: sealtalk-android   文件: ClearWriteEditText.java
/**
 * 晃动动画
 * @param counts 半秒钟晃动多少下
 * @return
 */
public static Animation shakeAnimation(int counts){
    Animation translateAnimation = new TranslateAnimation(0, 10, 0, 0);
    translateAnimation.setInterpolator(new CycleInterpolator(counts));
    translateAnimation.setDuration(500);
    return translateAnimation;
}
 
源代码29 项目: MaterialHome   文件: AnimationUtils.java
/**
 * 晃动动画
 *
 * @param counts 1秒钟晃动多少下
 * @return
 */
public static Animation shakeAnimation(int counts) {
    Animation translateAnimation = new TranslateAnimation(0, 10, 0, 0);
    translateAnimation.setInterpolator(new CycleInterpolator(counts));
    translateAnimation.setDuration(1000);
    return translateAnimation;
}
 
源代码30 项目: ticdesign   文件: SwipeTodoView.java
private void startRotationAnimation() {
    if (!mHasCenterIcon) {
        return;
    }
    mIconAnimator = ObjectAnimator.ofFloat(mCenterIv, "rotation", 0f, 15f);
    mIconAnimator.setRepeatCount(Animation.INFINITE);
    mIconAnimator.setInterpolator(new CycleInterpolator(1));
    mIconAnimator.setDuration(2000);
    mIconAnimator.start();
}