com.nineoldandroids.animation.ValueAnimator Java Examples

The following examples show how to use com.nineoldandroids.animation.ValueAnimator. 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: PathMeasureView.java    From zone-sdk with MIT License 6 votes vote down vote up
public void setState(State state) {
    this.state = state;
    if (state == State.GetMatrix) {
        if (animator == null)
            animator = ValueAnimatorProxy.ofFloat(0, 1).setInterpolator(new LinearInterpolator()).setDuration(3000).setRepeatCount(-1)
                    .addUpdateListener(new ValueAnimator.AnimatorUpdateListener() {
                        @Override
                        public void onAnimationUpdate(ValueAnimator animation) {
                            currentValue = (Float) animation.getAnimatedValue();
                            invalidate();
                        }
                    }).source();

        animator.start();
    } else if (animator != null)
        animator.cancel();

    invalidate();
}
 
Example #2
Source File: ViewPropertyAnimatorPreHC.java    From Mover with Apache License 2.0 6 votes vote down vote up
/**
 * Starts the underlying Animator for a set of properties. We use a single animator that
 * simply runs from 0 to 1, and then use that fractional value to set each property
 * value accordingly.
 */
private void startAnimation() {
    ValueAnimator animator = ValueAnimator.ofFloat(1.0f);
    ArrayList<NameValuesHolder> nameValueList =
            (ArrayList<NameValuesHolder>) mPendingAnimations.clone();
    mPendingAnimations.clear();
    int propertyMask = 0;
    int propertyCount = nameValueList.size();
    for (int i = 0; i < propertyCount; ++i) {
        NameValuesHolder nameValuesHolder = nameValueList.get(i);
        propertyMask |= nameValuesHolder.mNameConstant;
    }
    mAnimatorMap.put(animator, new PropertyBundle(propertyMask, nameValueList));
    animator.addUpdateListener(mAnimatorEventListener);
    animator.addListener(mAnimatorEventListener);
    if (mStartDelaySet) {
        animator.setStartDelay(mStartDelay);
    }
    if (mDurationSet) {
        animator.setDuration(mDuration);
    }
    if (mInterpolatorSet) {
        animator.setInterpolator(mInterpolator);
    }
    animator.start();
}
 
Example #3
Source File: CardView.java    From example with Apache License 2.0 6 votes vote down vote up
/**
 * Create the Slide Animator invoked when the expand/collapse button is clicked
 */
protected ValueAnimator createSlideAnimator(int start, int end) {
    ValueAnimator animator = ValueAnimator.ofInt(start, end);

    animator.addUpdateListener(new ValueAnimator.AnimatorUpdateListener() {
        @Override
        public void onAnimationUpdate(ValueAnimator valueAnimator) {
            int value = (Integer) valueAnimator.getAnimatedValue();

            ViewGroup.LayoutParams layoutParams = mInternalExpandLayout.getLayoutParams();
            layoutParams.height = value;
            mInternalExpandLayout.setLayoutParams(layoutParams);
        }
    });
    return animator;
}
 
Example #4
Source File: DefaultTransitionController.java    From android-transition with Apache License 2.0 6 votes vote down vote up
private void updateState(long time) {
    if ((time == mLastTime || (!mStarted && !mSetup)) && mUpdateCount != -1) {
        return;
    }

    if (TransitionConfig.isDebug()) {
        appendLog("updateState: \t\ttime=" + time);
    }

    mSetup = false;
    mLastTime = time;
    ArrayList<Animator> animators = mAnimSet.getChildAnimations();
    final int size = animators.size();
    for (int i = 0; i < size; i++) {
        ValueAnimator va = (ValueAnimator) animators.get(i);
        long absTime = time - va.getStartDelay();
        if (absTime >= 0) {
            va.setCurrentPlayTime(absTime);
        }
    }
}
 
Example #5
Source File: BallPulseIndicator.java    From AndroidPlayground with MIT License 6 votes vote down vote up
@Override
public List<Animator> createAnimation() {
    List<Animator> animators = new ArrayList<>();
    for (int i = 0; i < CIRCLE_NUM; i++) {
        final int index = i;

        ValueAnimator scaleAnim = ValueAnimator.ofFloat(1, 0.3f, 1);

        scaleAnim.setDuration(BASE_DELAY_MILLIS * CIRCLE_NUM * 3 / 2);
        scaleAnim.setRepeatCount(-1);
        scaleAnim.setStartDelay(delays[i]);

        scaleAnim.addUpdateListener(new ValueAnimator.AnimatorUpdateListener() {
            @Override
            public void onAnimationUpdate(ValueAnimator animation) {
                scaleFloats[index] = (float) animation.getAnimatedValue();
                postInvalidate();
            }
        });
        scaleAnim.start();
        animators.add(scaleAnim);
    }
    return animators;
}
 
Example #6
Source File: CameraXVideoCaptureHelper.java    From mollyim-android with GNU General Public License v3.0 6 votes vote down vote up
CameraXVideoCaptureHelper(@NonNull Fragment fragment,
                          @NonNull CameraButtonView captureButton,
                          @NonNull CameraXView camera,
                          @NonNull MemoryFileDescriptor memoryFileDescriptor,
                          int      maxVideoDurationSec,
                          @NonNull Callback callback)
{
  this.fragment               = fragment;
  this.camera                 = camera;
  this.memoryFileDescriptor   = memoryFileDescriptor;
  this.callback               = callback;
  this.updateProgressAnimator = ValueAnimator.ofFloat(0f, 1f).setDuration(maxVideoDurationSec * 1000);

  updateProgressAnimator.setInterpolator(new LinearInterpolator());
  updateProgressAnimator.addUpdateListener(anim -> captureButton.setProgress(anim.getAnimatedFraction()));
  updateProgressAnimator.addListener(new AnimationEndCallback() {
    @Override
    public void onAnimationEnd(Animator animation) {
      if (isRecording) onVideoCaptureComplete();
    }
  });
}
 
Example #7
Source File: ViewPropertyAnimatorHC.java    From Mover with Apache License 2.0 6 votes vote down vote up
/**
 * Starts the underlying Animator for a set of properties. We use a single animator that
 * simply runs from 0 to 1, and then use that fractional value to set each property
 * value accordingly.
 */
private void startAnimation() {
    ValueAnimator animator = ValueAnimator.ofFloat(1.0f);
    ArrayList<NameValuesHolder> nameValueList =
            (ArrayList<NameValuesHolder>) mPendingAnimations.clone();
    mPendingAnimations.clear();
    int propertyMask = 0;
    int propertyCount = nameValueList.size();
    for (int i = 0; i < propertyCount; ++i) {
        NameValuesHolder nameValuesHolder = nameValueList.get(i);
        propertyMask |= nameValuesHolder.mNameConstant;
    }
    mAnimatorMap.put(animator, new PropertyBundle(propertyMask, nameValueList));
    animator.addUpdateListener(mAnimatorEventListener);
    animator.addListener(mAnimatorEventListener);
    if (mStartDelaySet) {
        animator.setStartDelay(mStartDelay);
    }
    if (mDurationSet) {
        animator.setDuration(mDuration);
    }
    if (mInterpolatorSet) {
        animator.setInterpolator(mInterpolator);
    }
    animator.start();
}
 
Example #8
Source File: ToolbarControlBaseActivity.java    From Android-ObservableScrollView with Apache License 2.0 6 votes vote down vote up
private void moveToolbar(float toTranslationY) {
    if (ViewHelper.getTranslationY(mToolbar) == toTranslationY) {
        return;
    }
    ValueAnimator animator = ValueAnimator.ofFloat(ViewHelper.getTranslationY(mToolbar), toTranslationY).setDuration(200);
    animator.addUpdateListener(new ValueAnimator.AnimatorUpdateListener() {
        @Override
        public void onAnimationUpdate(ValueAnimator animation) {
            float translationY = (float) animation.getAnimatedValue();
            ViewHelper.setTranslationY(mToolbar, translationY);
            ViewHelper.setTranslationY((View) mScrollable, translationY);
            FrameLayout.LayoutParams lp = (FrameLayout.LayoutParams) ((View) mScrollable).getLayoutParams();
            lp.height = (int) -translationY + getScreenHeight() - lp.topMargin;
            ((View) mScrollable).requestLayout();
        }
    });
    animator.start();
}
 
Example #9
Source File: DemoActivity_1.java    From android-art-res with Apache License 2.0 6 votes vote down vote up
private void performAnimate(final View target, final int start, final int end) {
    ValueAnimator valueAnimator = ValueAnimator.ofInt(1, 100);
    valueAnimator.addUpdateListener(new AnimatorUpdateListener() {

        // 持有一个IntEvaluator对象,方便下面估值的时候使用
        private IntEvaluator mEvaluator = new IntEvaluator();

        @Override
        public void onAnimationUpdate(ValueAnimator animator) {
            // 获得当前动画的进度值,整型,1-100之间
            int currentValue = (Integer) animator.getAnimatedValue();
            Log.d(TAG, "current value: " + currentValue);

            // 获得当前进度占整个动画过程的比例,浮点型,0-1之间
            float fraction = animator.getAnimatedFraction();
            // 直接调用整型估值器通过比例计算出宽度,然后再设给Button
            target.getLayoutParams().width = mEvaluator.evaluate(fraction, start, end);
            target.requestLayout();
        }
    });

    valueAnimator.setDuration(5000).start();
}
 
Example #10
Source File: ContextualUndoAdapter.java    From android-open-project-demo with Apache License 2.0 6 votes vote down vote up
private void performRemovalIfNecessary() {
    if (mCurrentRemovedId == -1) {
        return;
    }

    ContextualUndoView currentRemovedView = getCurrentRemovedView(mCurrentRemovedView, mCurrentRemovedId);
    if (currentRemovedView != null) {
        ValueAnimator animator = ValueAnimator.ofInt(currentRemovedView.getHeight(), 1).setDuration(ANIMATION_DURATION);

        RemoveViewAnimatorListenerAdapter listener = new RemoveViewAnimatorListenerAdapter(currentRemovedView, mCurrentRemovedId);
        RemoveViewAnimatorUpdateListener updateListener = new RemoveViewAnimatorUpdateListener(listener);

        animator.addListener(listener);
        animator.addUpdateListener(updateListener);
        animator.start();
    } else {
        // The hard way.
        deleteItemGivenId(mCurrentRemovedId);
    }
    clearCurrentRemovedView();
}
 
Example #11
Source File: FragmentMusicView.java    From Pas with Apache License 2.0 6 votes vote down vote up
@Override
public void initWeidget() {
    ButterKnife.bind(this, getRootView());

    //ivicon旋转
    animator = ObjectAnimator.ofFloat(ivIcon, "rotation", 0, 360);
    animator.setDuration(15000);
    animator.setInterpolator(new LinearInterpolator());
    animator.setRepeatCount(ValueAnimator.INFINITE);

    //透明度动画
    animator1 = ObjectAnimator.ofFloat(rlBg, "alpha", 0.2f, 1.0f);
    animator1.setDuration(2000);
    animator1.setInterpolator(new AccelerateDecelerateInterpolator());


}
 
Example #12
Source File: ViewPagerTab2Activity.java    From Android-ObservableScrollView with Apache License 2.0 6 votes vote down vote up
private void animateToolbar(final float toY) {
    float layoutTranslationY = ViewHelper.getTranslationY(mInterceptionLayout);
    if (layoutTranslationY != toY) {
        ValueAnimator animator = ValueAnimator.ofFloat(ViewHelper.getTranslationY(mInterceptionLayout), toY).setDuration(200);
        animator.addUpdateListener(new ValueAnimator.AnimatorUpdateListener() {
            @Override
            public void onAnimationUpdate(ValueAnimator animation) {
                float translationY = (float) animation.getAnimatedValue();
                ViewHelper.setTranslationY(mInterceptionLayout, translationY);
                if (translationY < 0) {
                    FrameLayout.LayoutParams lp = (FrameLayout.LayoutParams) mInterceptionLayout.getLayoutParams();
                    lp.height = (int) (-translationY + getScreenHeight());
                    mInterceptionLayout.requestLayout();
                }
            }
        });
        animator.start();
    }
}
 
Example #13
Source File: PlayerDiscView.java    From SimplifyReader with Apache License 2.0 6 votes vote down vote up
private void reverseDiscAnimator() {
    mDiscLayoutAnimator = ObjectAnimator.ofFloat(mDiscLayout, "rotation", mDiscLayoutAnimatorValue, 360);
    mDiscLayoutAnimator.addUpdateListener(new AnimatorUpdateListener() {

        @Override
        public void onAnimationUpdate(ValueAnimator arg0) {
            mDiscLayoutAnimatorValue = (Float) arg0.getAnimatedValue();
        }
    });
    mDiscLayoutAnimator.setDuration(DISC_REVERSE_ANIMATOR_TIME);
    mDiscLayoutAnimator.setInterpolator(new AccelerateInterpolator());

    if (mDiscLayoutAnimator.isRunning() || mDiscLayoutAnimator.isStarted()) {
        mDiscLayoutAnimator.cancel();
    }

    mDiscLayoutAnimator.start();
}
 
Example #14
Source File: PlayerDiscView.java    From SimplifyReader with Apache License 2.0 6 votes vote down vote up
private void startDiscAnimator(float animatedValue) {
    mDiscLayoutAnimator = ObjectAnimator.ofFloat(mDiscLayout, "rotation", animatedValue, 360 + animatedValue);
    mDiscLayoutAnimator.addUpdateListener(new AnimatorUpdateListener() {

        @Override
        public void onAnimationUpdate(ValueAnimator arg0) {
            mDiscLayoutAnimatorValue = (Float) arg0.getAnimatedValue();
        }
    });
    mDiscLayoutAnimator.setDuration(DISC_ANIMATOR_TIME);
    mDiscLayoutAnimator.setRepeatCount(DISC_ANIMATOR_REPEAT_COUNT);
    mDiscLayoutAnimator.setInterpolator(new LinearInterpolator());

    if (mDiscLayoutAnimator.isRunning() || mDiscLayoutAnimator.isStarted()) {
        mDiscLayoutAnimator.cancel();
    }

    mDiscLayoutAnimator.start();
}
 
Example #15
Source File: LoadingImageView.java    From LoadingImageView with MIT License 6 votes vote down vote up
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 #16
Source File: ViewPagerTab2Activity.java    From Android-ObservableScrollView with Apache License 2.0 6 votes vote down vote up
private void animateToolbar(final float toY) {
    float layoutTranslationY = ViewHelper.getTranslationY(mInterceptionLayout);
    if (layoutTranslationY != toY) {
        ValueAnimator animator = ValueAnimator.ofFloat(ViewHelper.getTranslationY(mInterceptionLayout), toY).setDuration(200);
        animator.addUpdateListener(new ValueAnimator.AnimatorUpdateListener() {
            @Override
            public void onAnimationUpdate(ValueAnimator animation) {
                float translationY = (float) animation.getAnimatedValue();
                ViewHelper.setTranslationY(mInterceptionLayout, translationY);
                if (translationY < 0) {
                    FrameLayout.LayoutParams lp = (FrameLayout.LayoutParams) mInterceptionLayout.getLayoutParams();
                    lp.height = (int) (-translationY + getScreenHeight());
                    mInterceptionLayout.requestLayout();
                }
            }
        });
        animator.start();
    }
}
 
Example #17
Source File: PopBackgroundView.java    From AndroidColorPop with Apache License 2.0 6 votes vote down vote up
/**
 * Internal void to start the circles animation.
 * <p>
 * when this void is called the circles radius would be updated by a
 * {@link ValueAnimator} and then it will call the {@link View}'s
 * invalidate() void witch calls the onDraw void each time so a bigger
 * circle would be drawn each time till the cirlce's fill the whole screen.
 * </p>
 */
private void animateCirlce() {
	if (circles_fill_type == CIRLCES_FILL_HEIGHT_TYPE) {
		circle_max_radius = screen_height + (screen_height / 4);
	} else {
		circle_max_radius = screen_width + (screen_width / 4);
	}
	ValueAnimator va = ValueAnimator.ofInt(0, circle_max_radius / 3);
	va.setDuration(1000);
	va.addListener(this);
	va.setInterpolator(new AccelerateInterpolator());
	va.addUpdateListener(new ValueAnimator.AnimatorUpdateListener() {
		public void onAnimationUpdate(ValueAnimator animation) {
			int value = (int) animation.getAnimatedValue();
			circle_radius = value * 3;
			invalidate();
		}
	});
	va.start();
}
 
Example #18
Source File: SweetView.java    From MousePaint with MIT License 5 votes vote down vote up
@Override
public void onAnimationUpdate(ValueAnimator animation) {
    int value = (int) animation.getAnimatedValue();
    mArcHeight = value;

    if (value == mMaxArcHeight) {
        duang();
    }
    invalidate();
}
 
Example #19
Source File: CameraXVideoCaptureHelper.java    From mollyim-android with GNU General Public License v3.0 5 votes vote down vote up
private void shrinkCaptureArea() {
  Size  screenSize               = getScreenSize();
  Size  videoRecordingSize       = VideoUtil.getVideoRecordingSize();
  float scale                    = getSurfaceScaleForRecording();
  float targetWidthForAnimation  = videoRecordingSize.getWidth() * scale;
  float scaleX                   = targetWidthForAnimation / screenSize.getWidth();

  if (scaleX == 1f) {
    float targetHeightForAnimation = videoRecordingSize.getHeight() * scale;

    if (screenSize.getHeight() == targetHeightForAnimation) {
      return;
    }

    cameraMetricsAnimator = ValueAnimator.ofFloat(screenSize.getHeight(), targetHeightForAnimation);
  } else {

    if (screenSize.getWidth() == targetWidthForAnimation) {
      return;
    }

    cameraMetricsAnimator = ValueAnimator.ofFloat(screenSize.getWidth(), targetWidthForAnimation);
  }

  ViewGroup.LayoutParams params = camera.getLayoutParams();
  cameraMetricsAnimator.setInterpolator(new LinearInterpolator());
  cameraMetricsAnimator.setDuration(200);
  cameraMetricsAnimator.addUpdateListener(animation -> {
    if (scaleX == 1f) {
      params.height = Math.round((float) animation.getAnimatedValue());
    } else {
      params.width = Math.round((float) animation.getAnimatedValue());
    }
    camera.setLayoutParams(params);
  });
  cameraMetricsAnimator.start();
}
 
Example #20
Source File: AnimationUtil.java    From sms-ticket with Apache License 2.0 5 votes vote down vote up
public static void setFlipAnimation(final ImageView view, final ObjectAnimator animator, final int firstImage,
                                    final int secondImage, final Context c) {
    if (secondImage == NO_ANIMATION) {
        view.setImageResource(firstImage);
        animator.end();
        ViewCompat.setHasTransientState(view, false);
    } else {
        animator.setRepeatCount(ObjectAnimator.INFINITE);
        animator.setDuration(1300);
        animator.setInterpolator(new LinearInterpolator());
        animator.setRepeatMode(ValueAnimator.RESTART);

        animator.addUpdateListener(new ValueAnimator.AnimatorUpdateListener() {
            final Drawable shape1 = c.getResources().getDrawable(firstImage);
            final Drawable shape2 = c.getResources().getDrawable(secondImage);
            Drawable currentDrawable = null;

            @Override
            public void onAnimationUpdate(ValueAnimator animation) {
                float angle = (Float)animation.getAnimatedValue();
                int quadrant = (int)(angle / 90) + 1;
                if ((quadrant == 1 || quadrant == 4) && shape1 != currentDrawable) {
                    view.setImageDrawable(shape1);
                    currentDrawable = shape1;
                } else if ((quadrant == 2 || quadrant == 3) && currentDrawable != shape2) {
                    view.setImageDrawable(shape2);
                    currentDrawable = shape2;
                }
            }
        });
        animator.start();
        ViewCompat.setHasTransientState(view, true);
    }
}
 
Example #21
Source File: ExpandableListItemAdapter.java    From UltimateAndroid with Apache License 2.0 5 votes vote down vote up
public static void animateExpanding(final View view, final AbsListView listView) {
    view.setVisibility(View.VISIBLE);

    View parent = (View) view.getParent();
    final int widthSpec = View.MeasureSpec.makeMeasureSpec(parent.getMeasuredWidth() - parent.getPaddingLeft() - parent.getPaddingRight(), View.MeasureSpec.AT_MOST);
    final int heightSpec = View.MeasureSpec.makeMeasureSpec(0, View.MeasureSpec.UNSPECIFIED);
    view.measure(widthSpec, heightSpec);

    ValueAnimator animator = createHeightAnimator(view, 0, view.getMeasuredHeight());
    animator.addUpdateListener(new ValueAnimator.AnimatorUpdateListener() {
        final int listViewHeight = listView.getHeight();
        final int listViewBottomPadding = listView.getPaddingBottom();
        final View v = findDirectChild(view, listView);

        @Override
        public void onAnimationUpdate(final ValueAnimator valueAnimator) {
            final int bottom = v.getBottom();
            if (bottom > listViewHeight) {
                final int top = v.getTop();
                if (top > 0) {
                    listView.smoothScrollBy(Math.min(bottom - listViewHeight + listViewBottomPadding, top), 0);
                }
            }
        }
    });
    animator.start();
}
 
Example #22
Source File: Glider.java    From UltimateAndroid with Apache License 2.0 5 votes vote down vote up
public static ValueAnimator glide(Skill skill, float duration, ValueAnimator animator, BaseEasingMethod.EasingListener... listeners) {
    BaseEasingMethod t = skill.getMethod(duration);

    if (listeners != null)
        t.addEasingListeners(listeners);

    animator.setEvaluator(t);
    return animator;
}
 
Example #23
Source File: ChartSeries.java    From android-DecoView-charting with Apache License 2.0 5 votes vote down vote up
/**
 * Kick off an animation to hide or show the arc. This results in an animation where
 * both the width of the line used for the arc and the transparency of the arc is
 * altered over the duration provided
 *
 * @param event   Event to process
 * @param showArc True to show the arc, false to hide
 */
public void startAnimateHideShow(@NonNull final DecoEvent event, final boolean showArc) {
    cancelAnimation();
    event.notifyStartListener();


    mDrawMode = event.getEventType();
    mPercentComplete = showArc ? 1.0f : 0f;
    mVisible = true;

    final float maxValue = 1.0f;
    mValueAnimator = ValueAnimator.ofFloat(0, maxValue);

    mValueAnimator.setDuration(event.getEffectDuration());
    mValueAnimator.setInterpolator(new LinearInterpolator());

    mValueAnimator.addUpdateListener(new ValueAnimator.AnimatorUpdateListener() {
        @Override
        public void onAnimationUpdate(ValueAnimator valueAnimator) {

            float current = Float.valueOf(valueAnimator.getAnimatedValue().toString());
            mPercentComplete = showArc ? (maxValue - current) : current;

            for (SeriesItem.SeriesItemListener seriesItemListener : mSeriesItem.getListeners()) {
                seriesItemListener.onSeriesItemDisplayProgress(mPercentComplete);
            }
        }
    });

    mValueAnimator.addListener(new AnimatorListenerAdapter() {
        @Override
        public void onAnimationEnd(Animator animation) {
            if (event.getEventType() != DecoEvent.EventType.EVENT_EFFECT) {
                event.notifyEndListener();
            }
        }
    });

    mValueAnimator.start();
}
 
Example #24
Source File: ContextualUndoAdapter.java    From ALLGO with Apache License 2.0 5 votes vote down vote up
private void performRemovalIfNecessary() {
	if (mCurrentRemovedView != null && mCurrentRemovedView.getParent() != null) {
		ValueAnimator animator = ValueAnimator.ofInt(mCurrentRemovedView.getHeight(), 1).setDuration(ANIMATION_DURATION);
		animator.addListener(new RemoveViewAnimatorListenerAdapter(mCurrentRemovedView));
		animator.addUpdateListener(new RemoveViewAnimatorUpdateListener(mCurrentRemovedView));
		animator.start();
		mActiveAnimators.put(mCurrentRemovedView, animator);
		clearCurrentRemovedView();
	}
}
 
Example #25
Source File: k.java    From MiBandDecompiled with Apache License 2.0 5 votes vote down vote up
public void onAnimationUpdate(ValueAnimator valueanimator)
    {
        float f;
        ArrayList arraylist;
        f = valueanimator.getAnimatedFraction();
        m m1 = (m)i.c(a).get(valueanimator);
        if ((0x1ff & m1.a) != 0)
        {
            View view1 = (View)i.d(a).get();
            if (view1 != null)
            {
                view1.invalidate();
            }
        }
        arraylist = m1.b;
        if (arraylist == null) goto _L2; else goto _L1
_L1:
        int j;
        int i1;
        j = arraylist.size();
        i1 = 0;
_L5:
        if (i1 < j) goto _L3; else goto _L2
_L2:
        View view = (View)i.d(a).get();
        if (view != null)
        {
            view.invalidate();
        }
        return;
_L3:
        l l1 = (l)arraylist.get(i1);
        float f1 = l1.b + f * l1.c;
        i.a(a, l1.a, f1);
        i1++;
        if (true) goto _L5; else goto _L4
_L4:
    }
 
Example #26
Source File: d.java    From MiBandDecompiled with Apache License 2.0 5 votes vote down vote up
public void onAnimationUpdate(ValueAnimator valueanimator)
    {
        float f1;
        ArrayList arraylist;
        f1 = valueanimator.getAnimatedFraction();
        f f2 = (f)b.c(a).get(valueanimator);
        if ((0x1ff & f2.a) != 0)
        {
            View view1 = (View)b.d(a).get();
            if (view1 != null)
            {
                view1.invalidate();
            }
        }
        arraylist = f2.b;
        if (arraylist == null) goto _L2; else goto _L1
_L1:
        int i;
        int j;
        i = arraylist.size();
        j = 0;
_L5:
        if (j < i) goto _L3; else goto _L2
_L2:
        View view = (View)b.d(a).get();
        if (view != null)
        {
            view.invalidate();
        }
        return;
_L3:
        e e1 = (e)arraylist.get(j);
        float f3 = e1.b + f1 * e1.c;
        b.a(a, e1.a, f3);
        j++;
        if (true) goto _L5; else goto _L4
_L4:
    }
 
Example #27
Source File: b.java    From MiBandDecompiled with Apache License 2.0 5 votes vote down vote up
private void a()
{
    ValueAnimator valueanimator = ValueAnimator.ofFloat(new float[] {
        1.0F
    });
    ArrayList arraylist = (ArrayList)a.clone();
    a.clear();
    int i1 = arraylist.size();
    int j1 = 0;
    int k1 = 0;
    do
    {
        if (j1 >= i1)
        {
            x.put(valueanimator, new f(k1, arraylist));
            valueanimator.addUpdateListener(j);
            valueanimator.addListener(j);
            if (f)
            {
                valueanimator.setStartDelay(e);
            }
            if (d)
            {
                valueanimator.setDuration(c);
            }
            if (h)
            {
                valueanimator.setInterpolator(g);
            }
            valueanimator.start();
            return;
        }
        k1 |= ((e)arraylist.get(j1)).a;
        j1++;
    } while (true);
}
 
Example #28
Source File: SwipeDismissTouchListener.java    From Pimp_my_Z1 with GNU General Public License v2.0 5 votes vote down vote up
private void performDismiss() {
	// Animate the dismissed view to zero-height and then fire the dismiss
	// callback.
	// This triggers layout on each animation frame; in the future we may
	// want to do something
	// smarter and more performant.

	final ViewGroup.LayoutParams lp = mView.getLayoutParams();
	final int originalHeight = mView.getHeight();

	ValueAnimator animator = ValueAnimator.ofInt(originalHeight, 1)
			.setDuration(mAnimationTime);

	animator.addListener(new AnimatorListenerAdapter() {
		@Override
		public void onAnimationEnd(Animator animation) {
			mCallback.onDismiss(mView, mToken);
			// Reset view presentation
			setAlpha(mView, 1f);
			ViewHelper.setTranslationX(mView, 0);
			// mView.setAlpha(1f);
			// mView.setTranslationX(0);
			lp.height = originalHeight;
			mView.setLayoutParams(lp);
		}
	});

	animator.addUpdateListener(new ValueAnimator.AnimatorUpdateListener() {
		@Override
		public void onAnimationUpdate(ValueAnimator valueAnimator) {
			lp.height = (Integer) valueAnimator.getAnimatedValue();
			mView.setLayoutParams(lp);
		}
	});

	animator.start();
}
 
Example #29
Source File: b.java    From MiBandDecompiled with Apache License 2.0 5 votes vote down vote up
public long getDuration()
{
    if (d)
    {
        return c;
    } else
    {
        return (new ValueAnimator()).getDuration();
    }
}
 
Example #30
Source File: i.java    From MiBandDecompiled with Apache License 2.0 5 votes vote down vote up
public long getDuration()
{
    if (e)
    {
        return d;
    } else
    {
        return (new ValueAnimator()).getDuration();
    }
}