private void logState(View v, String title) { Log.v(TAG, title + ": ROT (" + ViewHelper.getRotation(v) + ", " + ViewHelper.getRotationX(v) + ", " + ViewHelper.getRotationY(v) + "), TRANS (" + ViewHelper.getTranslationX(v) + ", " + ViewHelper.getTranslationY(v) + "), SCALE (" + ViewHelper.getScaleX(v) + ", " + ViewHelper.getScaleY(v) + "), ALPHA " + ViewHelper.getAlpha(v)); }
public static Animator startRotation(View view, float toRotation) { Animator animator = ObjectAnimator.ofFloat(view, "rotation", ViewHelper.getRotation(view), toRotation); animator.start(); return animator; }
@Override protected void onStateChange(int state) { this.state = state; for (Animator animator : animators) { animator.cancel(); } animators.clear(); stateImg.setVisibility(View.INVISIBLE); progress.setVisibility(View.VISIBLE); ViewHelper.setAlpha(progress, 1f); switch (state) { case NONE: break; case PULLING: break; case LOOSENT_O_LOAD: break; case LOADING: animators.add(AnimUtil.startRotation(progress, ViewHelper.getRotation(progress) + 359.99f, 500, 0, -1)); break; case LOAD_CLONE: animators.add(AnimUtil.startShow(stateImg, 0.1f, 400, 200)); animators.add(AnimUtil.startHide(progress)); break; } }
@Override protected void onStateChange(int state) { this.state = state; for (Animator animator : animators) { animator.cancel(); } animators.clear(); stateImg.setVisibility(View.INVISIBLE); progress.setVisibility(View.VISIBLE); ViewHelper.setAlpha(progress, 1f); switch (state) { case NONE: break; case PULLING: break; case LOOSENT_O_REFRESH: break; case REFRESHING: animators.add(AnimUtil.startRotation(progress, ViewHelper.getRotation(progress) + 359.99f, 500, 0, -1)); break; case REFRESH_CLONE: animators.add(AnimUtil.startShow(stateImg, 0.1f, 400, 200)); animators.add(AnimUtil.startHide(progress)); break; } }
@Override protected void onStateChange(int state) { this.state = state; for (Animator animator : animators) { animator.cancel(); } animators.clear(); stateImg.setVisibility(View.INVISIBLE); progress.setVisibility(View.INVISIBLE); ViewHelper.setAlpha(progress, 1f); switch (state) { case NONE: break; case PULLING: break; case LOOSENT_O_LOAD: break; case LOADING: animators.add(AnimUtil.startShow(progress, 0.1f, 200, 0)); animators.add(AnimUtil.startRotation(progress, ViewHelper.getRotation(progress) + 359.99f, 500, 0, -1)); break; case LOAD_CLONE: animators.add(AnimUtil.startShow(stateImg, 0.1f, 400, 200)); animators.add(AnimUtil.startHide(progress)); break; } }
@Override protected void onStateChange(int state) { this.state = state; for (Animator animator : animators) { animator.cancel(); } animators.clear(); stateImg.setVisibility(View.INVISIBLE); progress.setVisibility(View.INVISIBLE); ViewHelper.setAlpha(progress, 1f); switch (state) { case NONE: break; case PULLING: break; case LOOSENT_O_REFRESH: break; case REFRESHING: animators.add(AnimUtil.startShow(progress, 0.1f, 200, 0)); animators.add(AnimUtil.startRotation(progress, ViewHelper.getRotation(progress) + 359.99f, 500, 0, -1)); break; case REFRESH_CLONE: animators.add(AnimUtil.startShow(stateImg, 0.1f, 400, 200)); animators.add(AnimUtil.startHide(progress)); break; } }
public static Animator startRotation(View view, float toRotation, long duration, long startDelay) { ObjectAnimator objectAnimator = ObjectAnimator.ofFloat(view, "rotation", ViewHelper.getRotation(view), toRotation).setDuration(duration); objectAnimator.setStartDelay(startDelay); objectAnimator.start(); return objectAnimator; }
public static Animator startRotation(View view, float toRotation, long duration, long startDelay, int times) { ObjectAnimator objectAnimator = ObjectAnimator.ofFloat(view, "rotation", ViewHelper.getRotation(view), toRotation).setDuration(duration); objectAnimator.setStartDelay(startDelay); objectAnimator.setRepeatCount(times); objectAnimator.setInterpolator(new LinearInterpolator()); objectAnimator.start(); return objectAnimator; }