Search in sources :

Example 76 with AccelerateDecelerateInterpolator

use of android.view.animation.AccelerateDecelerateInterpolator in project PageIndicatorView by romandanylyk.

the class ThinWormAnimation method createHeightAnimator.

private ValueAnimator createHeightAnimator(int fromHeight, int toHeight, long duration) {
    ValueAnimator anim = ValueAnimator.ofInt(fromHeight, toHeight);
    anim.setInterpolator(new AccelerateDecelerateInterpolator());
    anim.setDuration(duration);
    anim.addUpdateListener(new ValueAnimator.AnimatorUpdateListener() {

        @Override
        public void onAnimationUpdate(ValueAnimator animation) {
            onAnimateUpdated(animation);
        }
    });
    return anim;
}
Also used : AccelerateDecelerateInterpolator(android.view.animation.AccelerateDecelerateInterpolator) ValueAnimator(android.animation.ValueAnimator)

Example 77 with AccelerateDecelerateInterpolator

use of android.view.animation.AccelerateDecelerateInterpolator in project PageIndicatorView by romandanylyk.

the class WormAnimation method createWormAnimator.

ValueAnimator createWormAnimator(int fromValue, int toValue, long duration, final boolean isReverse, final WormAnimationValue value) {
    ValueAnimator anim = ValueAnimator.ofInt(fromValue, toValue);
    anim.setInterpolator(new AccelerateDecelerateInterpolator());
    anim.setDuration(duration);
    anim.addUpdateListener(new ValueAnimator.AnimatorUpdateListener() {

        @Override
        public void onAnimationUpdate(ValueAnimator animation) {
            onAnimateUpdated(value, animation, isReverse);
        }
    });
    return anim;
}
Also used : AccelerateDecelerateInterpolator(android.view.animation.AccelerateDecelerateInterpolator) ValueAnimator(android.animation.ValueAnimator)

Example 78 with AccelerateDecelerateInterpolator

use of android.view.animation.AccelerateDecelerateInterpolator in project qksms by moezbhatti.

the class ComposeView method onFinishInflate.

@Override
public void onFinishInflate() {
    super.onFinishInflate();
    // Get references to the views
    mReplyText = (QKEditText) findViewById(R.id.compose_reply_text);
    mButton = (FrameLayout) findViewById(R.id.compose_button);
    mProgress = (DonutProgress) findViewById(R.id.progress);
    mButtonBackground = (ImageView) findViewById(R.id.compose_button_background);
    mComposeIcon = (ImageView) findViewById(R.id.compose_icon);
    mAttachmentPanel = findViewById(R.id.attachment_panel);
    mAttach = (ImageButton) findViewById(R.id.attach);
    mCamera = (ImageButton) findViewById(R.id.camera);
    mDelay = (ImageButton) findViewById(R.id.delay);
    mLetterCount = (QKTextView) findViewById(R.id.compose_letter_count);
    mAttachmentLayout = (FrameLayout) findViewById(R.id.attachment);
    mAttachment = (AttachmentImageView) findViewById(R.id.compose_attachment);
    mCancel = (ImageButton) findViewById(R.id.cancel);
    mButton.setOnClickListener(this);
    mAttach.setOnClickListener(this);
    mCamera.setOnClickListener(this);
    mCancel.setOnClickListener(this);
    mDelay.setOnClickListener(this);
    LiveViewManager.registerView(QKPreference.THEME, this, key -> {
        mButtonBackground.setColorFilter(ThemeManager.getColor(), PorterDuff.Mode.SRC_ATOP);
        mComposeIcon.setColorFilter(ThemeManager.getTextOnColorPrimary(), PorterDuff.Mode.SRC_ATOP);
        mAttachmentPanel.setBackgroundColor(ThemeManager.getColor());
        mAttach.setColorFilter(ThemeManager.getTextOnColorPrimary(), PorterDuff.Mode.SRC_ATOP);
        mCamera.setColorFilter(ThemeManager.getTextOnColorPrimary(), PorterDuff.Mode.SRC_ATOP);
        updateDelayButton();
        mProgress.setUnfinishedStrokeColor(ThemeManager.getTextOnColorSecondary());
        mProgress.setFinishedStrokeColor(ThemeManager.getTextOnColorPrimary());
        if (ThemeManager.getSentBubbleRes() != 0)
            mReplyText.setBackgroundResource(ThemeManager.getSentBubbleRes());
    });
    LiveViewManager.registerView(QKPreference.BACKGROUND, this, key -> {
        mReplyText.getBackground().setColorFilter(ThemeManager.getNeutralBubbleColor(), PorterDuff.Mode.SRC_ATOP);
        getBackground().setColorFilter(ThemeManager.getBackgroundColor(), PorterDuff.Mode.SRC_ATOP);
    });
    // keyboard; set that up here.
    switch(Integer.parseInt(mPrefs.getString(SettingsFragment.ENTER_BUTTON, "0"))) {
        case // emoji
        0:
            break;
        case // new line
        1:
            mReplyText.setInputType(InputType.TYPE_CLASS_TEXT | InputType.TYPE_TEXT_FLAG_CAP_SENTENCES | InputType.TYPE_TEXT_VARIATION_LONG_MESSAGE);
            mReplyText.setSingleLine(false);
            break;
        case // send
        2:
            mReplyText.setImeOptions(EditorInfo.IME_FLAG_NO_EXTRACT_UI);
            mReplyText.setInputType(InputType.TYPE_CLASS_TEXT | InputType.TYPE_TEXT_FLAG_CAP_SENTENCES);
            mReplyText.setSingleLine(false);
            mReplyText.setOnKeyListener(new // Workaround because ACTION_SEND does not support multiline mode
            OnKeyListener() {

                @Override
                public boolean onKey(View v, int keyCode, KeyEvent event) {
                    if (keyCode == 66) {
                        sendSms();
                        return true;
                    }
                    return false;
                }
            });
            break;
    }
    mReplyText.setTextChangedListener(new QKEditText.TextChangedListener() {

        @Override
        public void onTextChanged(CharSequence s) {
            int length = s.length();
            updateButtonState(length);
            // If the reply exceeds the SMS limit, it will count down until an extra message will have to be sent, and shows how many messages will currently be sent
            if (length < 150) {
                mLetterCount.setText("");
            } else if (150 <= length && length <= 160) {
                mLetterCount.setText("" + (160 - length));
            } else if (160 < length) {
                mLetterCount.setText((160 - length % 160) + "/" + (length / 160 + 1));
            }
        }
    });
    mProgressAnimator = new ValueAnimator();
    mProgressAnimator.setInterpolator(new AccelerateDecelerateInterpolator());
    mProgressAnimator.setDuration(mDelayDuration);
    mProgressAnimator.setIntValues(0, 360);
    mProgressAnimator.addUpdateListener(new ValueAnimator.AnimatorUpdateListener() {

        @Override
        public void onAnimationUpdate(ValueAnimator animation) {
            mProgress.setProgress((int) animation.getAnimatedValue());
        }
    });
    mProgressAnimator.addListener(new AnimatorListenerAdapter() {

        @Override
        public void onAnimationEnd(Animator animation) {
            super.onAnimationEnd(animation);
            mProgress.setVisibility(INVISIBLE);
            mProgress.setProgress(0);
            if (!mSendingCancelled) {
                sendSms();
                // In case they only enabled it for a particular message, let's set it back to the pref value
                mDelayedMessagingEnabled = mPrefs.getBoolean(SettingsFragment.DELAYED, false);
                updateDelayButton();
            } else {
                mSendingCancelled = false;
                updateButtonState();
            }
        }
    });
}
Also used : ValueAnimator(android.animation.ValueAnimator) ImageView(android.widget.ImageView) View(android.view.View) KeyEvent(android.view.KeyEvent) Animator(android.animation.Animator) ObjectAnimator(android.animation.ObjectAnimator) ValueAnimator(android.animation.ValueAnimator) AnimatorListenerAdapter(android.animation.AnimatorListenerAdapter) AccelerateDecelerateInterpolator(android.view.animation.AccelerateDecelerateInterpolator)

Example 79 with AccelerateDecelerateInterpolator

use of android.view.animation.AccelerateDecelerateInterpolator in project WilliamChart by diogobernardino.

the class BarCardThree method show.

@Override
public void show(Runnable action) {
    super.show(action);
    Tooltip tip = new Tooltip(mContext);
    tip.setBackgroundColor(Color.parseColor("#CC7B1F"));
    if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.ICE_CREAM_SANDWICH) {
        PropertyValuesHolder alpha = PropertyValuesHolder.ofFloat(View.ALPHA, 1);
        tip.setEnterAnimation(alpha).setDuration(150);
        alpha = PropertyValuesHolder.ofFloat(View.ALPHA, 0);
        tip.setExitAnimation(alpha).setDuration(150);
    }
    BarSet dataset = new BarSet(mLabels, mValues[0]);
    dataset.setColor(Color.parseColor("#eb993b"));
    mChart.addData(dataset);
    mChart.setTooltips(tip).show(new Animation().setInterpolator(new AccelerateDecelerateInterpolator()).withEndAction(action));
}
Also used : BarSet(com.db.chart.model.BarSet) Tooltip(com.db.chart.tooltip.Tooltip) PropertyValuesHolder(android.animation.PropertyValuesHolder) Animation(com.db.chart.animation.Animation) AccelerateDecelerateInterpolator(android.view.animation.AccelerateDecelerateInterpolator)

Example 80 with AccelerateDecelerateInterpolator

use of android.view.animation.AccelerateDecelerateInterpolator in project appsly-android-rest by 47deg.

the class MainActivity method iconFall.

/**
 * animates a view like a swing
 *
 * @param view   the view that will be animated
 * @param bounce the bounces of the animation
 */
private void iconFall(final View view, final int bounce) {
    int newdegrees = bounce;
    if (bounce % 2 == 0) {
        newdegrees *= -1;
    }
    animate(view).setDuration(bounce * 20).rotation(newdegrees).setInterpolator(new AccelerateDecelerateInterpolator()).setListener(new Animator.AnimatorListener() {

        @Override
        public void onAnimationStart(Animator animator) {
        }

        @Override
        public void onAnimationEnd(Animator animator) {
            if (bounce > 0) {
                iconFall(view, bounce - 1);
            }
        }

        @Override
        public void onAnimationCancel(Animator animator) {
        }

        @Override
        public void onAnimationRepeat(Animator animator) {
        }
    }).start();
}
Also used : Animator(com.nineoldandroids.animation.Animator) AccelerateDecelerateInterpolator(android.view.animation.AccelerateDecelerateInterpolator)

Aggregations

AccelerateDecelerateInterpolator (android.view.animation.AccelerateDecelerateInterpolator)165 ValueAnimator (android.animation.ValueAnimator)38 ObjectAnimator (android.animation.ObjectAnimator)31 Animator (android.animation.Animator)30 View (android.view.View)30 AnimatorSet (android.animation.AnimatorSet)22 Animation (android.view.animation.Animation)19 Handler (android.os.Handler)15 NonNull (android.support.annotation.NonNull)12 TranslateAnimation (android.view.animation.TranslateAnimation)12 AnimatorListenerAdapter (android.animation.AnimatorListenerAdapter)11 AccelerateInterpolator (android.view.animation.AccelerateInterpolator)10 AlphaAnimation (android.view.animation.AlphaAnimation)10 ImageView (android.widget.ImageView)10 TextView (android.widget.TextView)10 Paint (android.graphics.Paint)9 DecelerateInterpolator (android.view.animation.DecelerateInterpolator)9 LinearInterpolator (android.view.animation.LinearInterpolator)9 ScaleAnimation (android.view.animation.ScaleAnimation)9 PropertyValuesHolder (android.animation.PropertyValuesHolder)8