Search in sources :

Example 61 with AccelerateInterpolator

use of android.view.animation.AccelerateInterpolator in project ToastBar by SwiftyWang.

the class Toast method show.

public void show(final long delay) {
    if (intent != null) {
        intent.putExtra("delay", delay);
        getContext().startService(intent);
        intent = null;
    } else {
        post(new Runnable() {

            @Override
            public void run() {
                Toast.this.setVisibility(VISIBLE);
                if (position == Position.BOTTOM)
                    Toast.this.setY((getY() + getHeight()));
                else
                    Toast.this.setY((getY() - getHeight()));
            }
        });
        postDelayed(new Runnable() {

            @Override
            public void run() {
                Toast.this.animate().translationY(0).setDuration(DEFAULT_DURATION).setInterpolator(enterInterpolator == null ? new BounceInterpolator() : enterInterpolator).setListener(new AnimatorListenerAdapter() {

                    @Override
                    public void onAnimationStart(Animator animation) {
                        super.onAnimationStart(animation);
                        Toast.this.setVisibility(VISIBLE);
                        if (Toast.this.getParent() instanceof View && "service_parent".equals(((View) Toast.this.getParent()).getTag())) {
                            ((View) Toast.this.getParent()).setVisibility(VISIBLE);
                        }
                    }
                }).start();
            }
        }, delay);
        if (time != -1) {
            postDelayed(new Runnable() {

                @Override
                public void run() {
                    Toast.this.animate().translationY(position == Position.BOTTOM ? getHeight() : -getHeight()).setDuration(DEFAULT_DURATION).setInterpolator(exitInterpolator == null ? new AccelerateInterpolator() : exitInterpolator).setListener(new AnimatorListenerAdapter() {

                        @Override
                        public void onAnimationEnd(Animator animation) {
                            super.onAnimationEnd(animation);
                            if (Toast.this.getParent() instanceof View && "service_parent".equals(((View) Toast.this.getParent()).getTag())) {
                                ((View) Toast.this.getParent()).setVisibility(GONE);
                            }
                            if (Toast.this.getParent() instanceof ViewGroup) {
                                ((ViewGroup) Toast.this.getParent()).removeView(Toast.this);
                            }
                        }
                    }).start();
                }
            }, time > 0 ? delay + time + DEFAULT_DURATION : delay + DEFAULT_TIME + DEFAULT_DURATION);
        }
    }
}
Also used : Animator(android.animation.Animator) AccelerateInterpolator(android.view.animation.AccelerateInterpolator) BounceInterpolator(android.view.animation.BounceInterpolator) AnimatorListenerAdapter(android.animation.AnimatorListenerAdapter) ViewGroup(android.view.ViewGroup) TextView(android.widget.TextView) View(android.view.View)

Example 62 with AccelerateInterpolator

use of android.view.animation.AccelerateInterpolator in project android_frameworks_base by ResurrectionRemix.

the class DessertCaseView method place.

public synchronized void place(View v, Point pt, boolean animate) {
    final int i = pt.x;
    final int j = pt.y;
    final float rnd = frand();
    if (v.getTag(TAG_POS) != null) {
        for (final Point oc : getOccupied(v)) {
            mFreeList.add(oc);
            mCells[oc.y * mColumns + oc.x] = null;
        }
    }
    int scale = 1;
    if (rnd < PROB_4X) {
        if (!(i >= mColumns - 3 || j >= mRows - 3)) {
            scale = 4;
        }
    } else if (rnd < PROB_3X) {
        if (!(i >= mColumns - 2 || j >= mRows - 2)) {
            scale = 3;
        }
    } else if (rnd < PROB_2X) {
        if (!(i == mColumns - 1 || j == mRows - 1)) {
            scale = 2;
        }
    }
    v.setTag(TAG_POS, pt);
    v.setTag(TAG_SPAN, scale);
    tmpSet.clear();
    final Point[] occupied = getOccupied(v);
    for (final Point oc : occupied) {
        final View squatter = mCells[oc.y * mColumns + oc.x];
        if (squatter != null) {
            tmpSet.add(squatter);
        }
    }
    for (final View squatter : tmpSet) {
        for (final Point sq : getOccupied(squatter)) {
            mFreeList.add(sq);
            mCells[sq.y * mColumns + sq.x] = null;
        }
        if (squatter != v) {
            squatter.setTag(TAG_POS, null);
            if (animate) {
                squatter.animate().withLayer().scaleX(0.5f).scaleY(0.5f).alpha(0).setDuration(DURATION).setInterpolator(new AccelerateInterpolator()).setListener(new Animator.AnimatorListener() {

                    public void onAnimationStart(Animator animator) {
                    }

                    public void onAnimationEnd(Animator animator) {
                        removeView(squatter);
                    }

                    public void onAnimationCancel(Animator animator) {
                    }

                    public void onAnimationRepeat(Animator animator) {
                    }
                }).start();
            } else {
                removeView(squatter);
            }
        }
    }
    for (final Point oc : occupied) {
        mCells[oc.y * mColumns + oc.x] = v;
        mFreeList.remove(oc);
    }
    final float rot = (float) irand(0, 4) * 90f;
    if (animate) {
        v.bringToFront();
        AnimatorSet set1 = new AnimatorSet();
        set1.playTogether(ObjectAnimator.ofFloat(v, View.SCALE_X, (float) scale), ObjectAnimator.ofFloat(v, View.SCALE_Y, (float) scale));
        set1.setInterpolator(new AnticipateOvershootInterpolator());
        set1.setDuration(DURATION);
        AnimatorSet set2 = new AnimatorSet();
        set2.playTogether(ObjectAnimator.ofFloat(v, View.ROTATION, rot), ObjectAnimator.ofFloat(v, View.X, i * mCellSize + (scale - 1) * mCellSize / 2), ObjectAnimator.ofFloat(v, View.Y, j * mCellSize + (scale - 1) * mCellSize / 2));
        set2.setInterpolator(new DecelerateInterpolator());
        set2.setDuration(DURATION);
        set1.addListener(makeHardwareLayerListener(v));
        set1.start();
        set2.start();
    } else {
        v.setX(i * mCellSize + (scale - 1) * mCellSize / 2);
        v.setY(j * mCellSize + (scale - 1) * mCellSize / 2);
        v.setScaleX((float) scale);
        v.setScaleY((float) scale);
        v.setRotation(rot);
    }
}
Also used : DecelerateInterpolator(android.view.animation.DecelerateInterpolator) Animator(android.animation.Animator) ObjectAnimator(android.animation.ObjectAnimator) AccelerateInterpolator(android.view.animation.AccelerateInterpolator) AnimatorSet(android.animation.AnimatorSet) Point(android.graphics.Point) AnticipateOvershootInterpolator(android.view.animation.AnticipateOvershootInterpolator) ImageView(android.widget.ImageView) View(android.view.View) Point(android.graphics.Point) Paint(android.graphics.Paint)

Example 63 with AccelerateInterpolator

use of android.view.animation.AccelerateInterpolator in project android_frameworks_base by ResurrectionRemix.

the class PieMenu method getDimensions.

private void getDimensions() {
    // fetch orientation
    mPanelDegree = mPanel.getDegree();
    mPanelOrientation = mPanel.getOrientation();
    // fetch modes
    mHapticFeedback = Settings.System.getInt(mContext.getContentResolver(), Settings.System.HAPTIC_FEEDBACK_ENABLED, 1) != 0;
    mPieSize = Settings.System.getFloat(mContext.getContentResolver(), Settings.System.PA_PIE_SIZE, 1.0f);
    mStatusMode = Settings.System.getInt(mContext.getContentResolver(), Settings.System.PA_PIE_MODE, 2);
    mPieAngle = Settings.System.getInt(mContext.getContentResolver(), Settings.System.PA_PIE_ANGLE, 12);
    mPieGap = Settings.System.getInt(mContext.getContentResolver(), Settings.System.PA_PIE_GAP, 2);
    mUseMenuAlways = Settings.System.getInt(mContext.getContentResolver(), Settings.System.PA_PIE_MENU, 0) == 1;
    mUseLastApp = Settings.System.getInt(mContext.getContentResolver(), Settings.System.PA_PIE_LAST_APP, 0) == 1;
    mUseKillTask = Settings.System.getInt(mContext.getContentResolver(), Settings.System.PA_PIE_KILL_TASK, 0) == 1;
    mUseNotifications = Settings.System.getInt(mContext.getContentResolver(), Settings.System.PA_PIE_NOTIFICATIONS, 0) == 1;
    mSettingsPanel = Settings.System.getInt(mContext.getContentResolver(), Settings.System.PA_PIE_SETTINGS_PANEL, 0) == 1;
    mUseScreenshot = Settings.System.getInt(mContext.getContentResolver(), Settings.System.PA_PIE_SCREENSHOT, 0) == 1;
    mHasAssistant = mPieHelper.isAssistantAvailable();
    // snap
    mSnapRadius = (int) (mResources.getDimensionPixelSize(R.dimen.pie_snap_radius) * mPieSize);
    mSnapThickness = (int) (mResources.getDimensionPixelSize(R.dimen.pie_snap_thickness) * mPieSize);
    Point outSize = new Point(0, 0);
    WindowManager windowManager = (WindowManager) mContext.getSystemService(Context.WINDOW_SERVICE);
    windowManager.getDefaultDisplay().getRealSize(outSize);
    int mWidth = outSize.x;
    int mHeight = outSize.y;
    int snapIndex = 0;
    if (mPanelOrientation != Gravity.LEFT)
        mSnapPoint[snapIndex++] = new SnapPoint(0 + mSnapThickness / 2, mHeight / 2, mSnapRadius, 0x22, Gravity.LEFT);
    if (mPanelOrientation != Gravity.RIGHT)
        mSnapPoint[snapIndex++] = new SnapPoint(mWidth - mSnapThickness / 2, mHeight / 2, mSnapRadius, 0x22, Gravity.RIGHT);
    if (mPanelOrientation != Gravity.BOTTOM)
        mSnapPoint[snapIndex++] = new SnapPoint(mWidth / 2, mHeight - mSnapThickness / 2, mSnapRadius, 0x22, Gravity.BOTTOM);
    mNumberOfSnapPoints = snapIndex;
    // create pie
    mAngle = (int) (mPieAngle * mPieSize);
    mInnerPieRadius = (int) (mResources.getDimensionPixelSize(R.dimen.pie_radius_start) * mPieSize);
    mOuterPieRadius = (int) (mInnerPieRadius + mResources.getDimensionPixelSize(R.dimen.pie_radius_increment) * mPieSize);
    // calculate chevrons
    mInnerChevronRadius = (int) (mResources.getDimensionPixelSize(R.dimen.pie_chevron_start) * mPieSize);
    mOuterChevronRadius = (int) (mInnerChevronRadius + mResources.getDimensionPixelSize(R.dimen.pie_chevron_increment) * mPieSize);
    // create full chevron
    mChevronPath = makeSlice(mPanelDegree, mPanelDegree + 180, mInnerChevronRadius, mOuterChevronRadius, mCenter);
    // calculate text circle
    mStatusRadius = (int) (mResources.getDimensionPixelSize(R.dimen.pie_status_start) * mPieSize);
    mStatusPath.reset();
    mStatusPath.addCircle(mCenter.x, mCenter.y, mStatusRadius, Path.Direction.CW);
    mClockPaint.setTextSize(mResources.getDimensionPixelSize(R.dimen.pie_clock_size) * mPieSize);
    mClockOffset = mResources.getDimensionPixelSize(R.dimen.pie_clock_offset) * mPieSize;
    mAmPmPaint.setTextSize(mResources.getDimensionPixelSize(R.dimen.pie_am_pm_size) * mPieSize);
    mAmPmOffset = mResources.getDimensionPixelSize(R.dimen.pie_am_pm_offset) * mPieSize;
    mStatusPaint.setTextSize((int) (mResources.getDimensionPixelSize(R.dimen.pie_status_size) * mPieSize));
    mStatusOffset = mResources.getDimensionPixelSize(R.dimen.pie_status_offset) * mPieSize;
    // battery
    mInnerBatteryRadius = (int) (mResources.getDimensionPixelSize(R.dimen.pie_battery_start) * mPieSize);
    mOuterBatteryRadius = (int) (mInnerBatteryRadius + mResources.getDimensionPixelSize(R.dimen.pie_battery_increment) * mPieSize);
    mBatteryBackground.setColor(getResources().getColor(R.color.battery_background));
    mBatteryLevel = mPieHelper.getBatteryLevel();
    if (mBatteryLevel <= PieHelper.LOW_BATTERY_LEVEL && mBatteryLevel > PieHelper.CRITICAL_BATTERY_LEVEL) {
        mBatteryJuice.setColor(getResources().getColor(R.color.battery_juice_low));
    } else if (mBatteryLevel <= mPieHelper.CRITICAL_BATTERY_LEVEL) {
        mBatteryJuice.setColor(getResources().getColor(R.color.battery_juice_critical));
    } else {
        mBatteryJuice.setColor(getResources().getColor(R.color.battery_juice));
    }
    mStartBattery = mPanel.getDegree() + mAngle + mPieGap;
    mEndBattery = mPanel.getDegree() + (mPieGap <= 2 ? 88 : 90 - mPieGap);
    mBatteryPathBackground = makeSlice(mStartBattery, mEndBattery, mInnerBatteryRadius, mOuterBatteryRadius, mCenter);
    mBatteryPathJuice = makeSlice(mStartBattery, mStartBattery, mInnerBatteryRadius, mOuterBatteryRadius, mCenter);
    // Colors
    mEnableColor = (Settings.System.getInt(mContext.getContentResolver(), Settings.System.PA_PIE_ENABLE_COLOR, 0) == 1);
    mSnapBackground.setColor(getResources().getColor(R.color.snap_background));
    if (mEnableColor) {
        mPieBackground.setColor(Settings.System.getInt(mContext.getContentResolver(), Settings.System.PA_PIE_BACKGROUND, COLOR_PIE_BACKGROUND));
        mPieSelected.setColor(Settings.System.getInt(mContext.getContentResolver(), Settings.System.PA_PIE_SELECT, COLOR_PIE_SELECT));
        mPieOutlines.setColor(Settings.System.getInt(mContext.getContentResolver(), Settings.System.PA_PIE_OUTLINES, COLOR_PIE_OUTLINES));
        mClockPaint.setColor(Settings.System.getInt(mContext.getContentResolver(), Settings.System.PA_PIE_STATUS_CLOCK, COLOR_STATUS));
        mAmPmPaint.setColor(Settings.System.getInt(mContext.getContentResolver(), Settings.System.PA_PIE_STATUS_CLOCK, COLOR_STATUS));
        mStatusPaint.setColor(Settings.System.getInt(mContext.getContentResolver(), Settings.System.PA_PIE_STATUS, COLOR_STATUS));
        mChevronBackground.setColor(Settings.System.getInt(mContext.getContentResolver(), Settings.System.PA_PIE_CHEVRON, COLOR_CHEVRON));
        mBatteryJuice.setColorFilter(new PorterDuffColorFilter(extractRGB(Settings.System.getInt(mContext.getContentResolver(), Settings.System.PA_PIE_JUICE, COLOR_BATTERY_JUICE)) | COLOR_OPAQUE_MASK, Mode.SRC_ATOP));
        for (PieItem item : mItems) {
            item.setColor(Settings.System.getInt(mContext.getContentResolver(), Settings.System.PA_PIE_BUTTON_COLOR, COLOR_PIE_BUTTON));
        }
    } else {
        mPieBackground.setColor(getResources().getColor(R.color.pie_background));
        mPieSelected.setColor(getResources().getColor(R.color.pie_select));
        mPieOutlines.setColor(getResources().getColor(R.color.pie_outlines));
        mClockPaint.setColor(getResources().getColor(R.color.status));
        mAmPmPaint.setColor(getResources().getColor(R.color.status));
        mStatusPaint.setColor(getResources().getColor(R.color.status));
        mChevronBackground.setColor(getResources().getColor(R.color.chevron));
        mBatteryJuice.setColorFilter(null);
        for (PieItem item : mItems) {
            item.setColor(COLOR_PIE_BUTTON);
        }
    }
    // measure clock
    measureClock(mPieHelper.getSimpleTime());
    // Determine animationspeed
    mOverallSpeed = BASE_SPEED / 4;
    int mInitialSpeed = BASE_SPEED * (mStatusMode == -1 ? 0 : mStatusMode) / 2;
    // create animators
    for (int i = 0; i < mAnimators.length; i++) {
        mAnimators[i] = new CustomValueAnimator(i);
    }
    // linear animators
    mAnimators[ANIMATOR_DEC_SPEED15].duration = (int) (mOverallSpeed * 1.5);
    mAnimators[ANIMATOR_DEC_SPEED15].animator.setInterpolator(new DecelerateInterpolator());
    mAnimators[ANIMATOR_DEC_SPEED15].animator.setStartDelay((int) (mInitialSpeed * 1.5));
    mAnimators[ANIMATOR_ACC_SPEED15].duration = (int) (mOverallSpeed * 1.5);
    mAnimators[ANIMATOR_ACC_SPEED15].animator.setInterpolator(new AccelerateInterpolator());
    mAnimators[ANIMATOR_ACC_SPEED15].animator.setStartDelay((int) (mInitialSpeed * 1.5));
    // cascade accelerators
    int count = 0;
    for (int i = ANIMATOR_ACC_INC_1; i < ANIMATOR_ACC_INC_15 + 1; i++) {
        mAnimators[i].duration = 150;
        mAnimators[i].animator.setInterpolator(new DecelerateInterpolator());
        mAnimators[i].animator.setStartDelay((int) (mInitialSpeed * 1.5f + (++count * 75)));
    }
    // special purpose
    mAnimators[ANIMATOR_BATTERY_METER].duration = (int) (mOverallSpeed * 1.5);
    mAnimators[ANIMATOR_BATTERY_METER].animator.setInterpolator(new DecelerateInterpolator());
    mAnimators[ANIMATOR_BATTERY_METER].animator.setStartDelay((int) (mInitialSpeed * 1.5));
    mAnimators[ANIMATOR_SNAP_GROW].manual = true;
    mAnimators[ANIMATOR_SNAP_GROW].animator.setDuration(1000);
    mAnimators[ANIMATOR_SNAP_GROW].animator.setInterpolator(new AccelerateInterpolator());
    mAnimators[ANIMATOR_SNAP_GROW].animator.addListener(new Animator.AnimatorListener() {

        @Override
        public void onAnimationCancel(Animator animation) {
        }

        @Override
        public void onAnimationRepeat(Animator animation) {
        }

        @Override
        public void onAnimationStart(Animator animation) {
        }

        @Override
        public void onAnimationEnd(Animator animation) {
            if (mAnimators[ANIMATOR_SNAP_GROW].fraction == 1) {
                for (int i = 0; i < 2; i++) {
                    SnapPoint snap = mSnapPoint[i];
                    if (snap != null && snap.active && snap.isCurrentlyPossible()) {
                        if (mHapticFeedback)
                            mVibrator.vibrate(2);
                        deselect();
                        animateOut();
                        mPanel.reorient(snap.gravity);
                    }
                }
            }
        }
    });
}
Also used : DecelerateInterpolator(android.view.animation.DecelerateInterpolator) Animator(android.animation.Animator) ValueAnimator(android.animation.ValueAnimator) AccelerateInterpolator(android.view.animation.AccelerateInterpolator) AnimatorListener(android.animation.Animator.AnimatorListener) PorterDuffColorFilter(android.graphics.PorterDuffColorFilter) Point(android.graphics.Point) Point(android.graphics.Point) Paint(android.graphics.Paint) WindowManager(android.view.WindowManager)

Example 64 with AccelerateInterpolator

use of android.view.animation.AccelerateInterpolator in project android_frameworks_base by ResurrectionRemix.

the class BatteryBar method start.

@Override
public void start() {
    if (!shouldAnimateCharging)
        return;
    if (vertical) {
        TranslateAnimation a = new TranslateAnimation(getX(), getX(), getHeight(), mBatteryBarLayout.getHeight());
        a.setInterpolator(new AccelerateInterpolator());
        a.setDuration(ANIM_DURATION);
        a.setRepeatCount(Animation.INFINITE);
        mChargerLayout.startAnimation(a);
        mChargerLayout.setVisibility(View.VISIBLE);
    } else {
        TranslateAnimation a = new TranslateAnimation(getWidth(), mBatteryBarLayout.getWidth(), getTop(), getTop());
        a.setInterpolator(new AccelerateInterpolator());
        a.setDuration(ANIM_DURATION);
        a.setRepeatCount(Animation.INFINITE);
        mChargerLayout.startAnimation(a);
        mChargerLayout.setVisibility(View.VISIBLE);
    }
    isAnimating = true;
}
Also used : AccelerateInterpolator(android.view.animation.AccelerateInterpolator) TranslateAnimation(android.view.animation.TranslateAnimation)

Example 65 with AccelerateInterpolator

use of android.view.animation.AccelerateInterpolator in project Bitocle by mthli.

the class SmoothProgressBar method applyStyle.

public void applyStyle(int styleResId) {
    TypedArray a = getContext().obtainStyledAttributes(null, R.styleable.SmoothProgressBar, 0, styleResId);
    if (a.hasValue(R.styleable.SmoothProgressBar_spb_color)) {
        setSmoothProgressDrawableColor(a.getColor(R.styleable.SmoothProgressBar_spb_color, 0));
    }
    if (a.hasValue(R.styleable.SmoothProgressBar_spb_colors)) {
        int colorsId = a.getResourceId(R.styleable.SmoothProgressBar_spb_colors, 0);
        if (colorsId != 0) {
            int[] colors = getResources().getIntArray(colorsId);
            if (colors != null && colors.length > 0)
                setSmoothProgressDrawableColors(colors);
        }
    }
    if (a.hasValue(R.styleable.SmoothProgressBar_spb_sections_count)) {
        setSmoothProgressDrawableSectionsCount(a.getInteger(R.styleable.SmoothProgressBar_spb_sections_count, 0));
    }
    if (a.hasValue(R.styleable.SmoothProgressBar_spb_stroke_separator_length)) {
        setSmoothProgressDrawableSeparatorLength(a.getDimensionPixelSize(R.styleable.SmoothProgressBar_spb_stroke_separator_length, 0));
    }
    if (a.hasValue(R.styleable.SmoothProgressBar_spb_stroke_width)) {
        setSmoothProgressDrawableStrokeWidth(a.getDimension(R.styleable.SmoothProgressBar_spb_stroke_width, 0));
    }
    if (a.hasValue(R.styleable.SmoothProgressBar_spb_speed)) {
        setSmoothProgressDrawableSpeed(a.getFloat(R.styleable.SmoothProgressBar_spb_speed, 0));
    }
    if (a.hasValue(R.styleable.SmoothProgressBar_spb_progressiveStart_speed)) {
        setSmoothProgressDrawableProgressiveStartSpeed(a.getFloat(R.styleable.SmoothProgressBar_spb_progressiveStart_speed, 0));
    }
    if (a.hasValue(R.styleable.SmoothProgressBar_spb_progressiveStop_speed)) {
        setSmoothProgressDrawableProgressiveStopSpeed(a.getFloat(R.styleable.SmoothProgressBar_spb_progressiveStop_speed, 0));
    }
    if (a.hasValue(R.styleable.SmoothProgressBar_spb_reversed)) {
        setSmoothProgressDrawableReversed(a.getBoolean(R.styleable.SmoothProgressBar_spb_reversed, false));
    }
    if (a.hasValue(R.styleable.SmoothProgressBar_spb_mirror_mode)) {
        setSmoothProgressDrawableMirrorMode(a.getBoolean(R.styleable.SmoothProgressBar_spb_mirror_mode, false));
    }
    if (a.hasValue(R.styleable.SmoothProgressBar_spb_progressiveStart_activated)) {
        setProgressiveStartActivated(a.getBoolean(R.styleable.SmoothProgressBar_spb_progressiveStart_activated, false));
    }
    if (a.hasValue(R.styleable.SmoothProgressBar_spb_progressiveStart_activated)) {
        setProgressiveStartActivated(a.getBoolean(R.styleable.SmoothProgressBar_spb_progressiveStart_activated, false));
    }
    if (a.hasValue(R.styleable.SmoothProgressBar_spb_gradients)) {
        setSmoothProgressDrawableUseGradients(a.getBoolean(R.styleable.SmoothProgressBar_spb_gradients, false));
    }
    if (a.hasValue(R.styleable.SmoothProgressBar_spb_generate_background_with_colors)) {
        if (a.getBoolean(R.styleable.SmoothProgressBar_spb_generate_background_with_colors, false)) {
            setSmoothProgressDrawableBackgroundDrawable(SmoothProgressBarUtils.generateDrawableWithColors(checkIndeterminateDrawable().getColors(), checkIndeterminateDrawable().getStrokeWidth()));
        }
    }
    if (a.hasValue(R.styleable.SmoothProgressBar_spb_interpolator)) {
        int iInterpolator = a.getInteger(R.styleable.SmoothProgressBar_spb_interpolator, -1);
        Interpolator interpolator;
        switch(iInterpolator) {
            case INTERPOLATOR_ACCELERATEDECELERATE:
                interpolator = new AccelerateDecelerateInterpolator();
                break;
            case INTERPOLATOR_DECELERATE:
                interpolator = new DecelerateInterpolator();
                break;
            case INTERPOLATOR_LINEAR:
                interpolator = new LinearInterpolator();
                break;
            case INTERPOLATOR_ACCELERATE:
                interpolator = new AccelerateInterpolator();
                break;
            default:
                interpolator = null;
        }
        if (interpolator != null) {
            setInterpolator(interpolator);
        }
    }
    a.recycle();
}
Also used : AccelerateDecelerateInterpolator(android.view.animation.AccelerateDecelerateInterpolator) DecelerateInterpolator(android.view.animation.DecelerateInterpolator) AccelerateInterpolator(android.view.animation.AccelerateInterpolator) LinearInterpolator(android.view.animation.LinearInterpolator) TypedArray(android.content.res.TypedArray) AccelerateDecelerateInterpolator(android.view.animation.AccelerateDecelerateInterpolator) Interpolator(android.view.animation.Interpolator) AccelerateDecelerateInterpolator(android.view.animation.AccelerateDecelerateInterpolator) LinearInterpolator(android.view.animation.LinearInterpolator) AccelerateInterpolator(android.view.animation.AccelerateInterpolator) DecelerateInterpolator(android.view.animation.DecelerateInterpolator)

Aggregations

AccelerateInterpolator (android.view.animation.AccelerateInterpolator)186 Animator (android.animation.Animator)62 DecelerateInterpolator (android.view.animation.DecelerateInterpolator)54 View (android.view.View)52 ObjectAnimator (android.animation.ObjectAnimator)41 AnimatorListenerAdapter (android.animation.AnimatorListenerAdapter)40 ImageView (android.widget.ImageView)26 AnimatorSet (android.animation.AnimatorSet)24 TextView (android.widget.TextView)23 Animation (android.view.animation.Animation)21 ValueAnimator (android.animation.ValueAnimator)17 AccelerateDecelerateInterpolator (android.view.animation.AccelerateDecelerateInterpolator)14 LinearInterpolator (android.view.animation.LinearInterpolator)14 TranslateAnimation (android.view.animation.TranslateAnimation)14 OvershootInterpolator (android.view.animation.OvershootInterpolator)13 Point (android.graphics.Point)12 Paint (android.graphics.Paint)10 Interpolator (android.view.animation.Interpolator)9 AlphaAnimation (android.view.animation.AlphaAnimation)8 AnticipateOvershootInterpolator (android.view.animation.AnticipateOvershootInterpolator)8