Example usage for android.view.animation AccelerateDecelerateInterpolator AccelerateDecelerateInterpolator

List of usage examples for android.view.animation AccelerateDecelerateInterpolator AccelerateDecelerateInterpolator

Introduction

In this page you can find the example usage for android.view.animation AccelerateDecelerateInterpolator AccelerateDecelerateInterpolator.

Prototype

public AccelerateDecelerateInterpolator() 

Source Link

Usage

From source file:com.xiaoxin.apktools.Fragment.AppListFragment.java

private void setupRecyclerView(View rootView) {
    mRecyclerView = (RecyclerView) rootView.findViewById(R.id.recyclerview);
    LinearLayoutManager mLayoutManager = new LinearLayoutManager(getActivity());
    mRecyclerView.setLayoutManager(mLayoutManager);
    mRecyclerView/* w  ww. j  a  v a2s  .  c om*/
            .addItemDecoration(new DividerItemDecoration(getActivity(), DividerItemDecoration.VERTICAL_LIST));
    mRecyclerView.setHasFixedSize(true);
    mAdapter = new AppInfoListAdapter(getActivity(), Utils.isBriefMode(getActivity()));
    mAdapter.setClickPopupMenuItem(this);
    mAdapter.setClickListItem(this);

    SlideInBottomAnimationAdapter slideInLeftAdapter = new SlideInBottomAnimationAdapter(mAdapter);
    slideInLeftAdapter.setDuration(300);
    slideInLeftAdapter.setInterpolator(new AccelerateDecelerateInterpolator());

    mRecyclerView.setAdapter(slideInLeftAdapter);
}

From source file:ca.mymenuapp.ui.activities.RestaurantActivity.java

/**
 * Initialize some global variables/*from www  .  j a  va2  s. c o m*/
 */
private void init() {
    smoothInterpolator = new AccelerateDecelerateInterpolator();
    headerHeight = getResources().getDimensionPixelSize(R.dimen.restaurant_header_height);
    // we have tabs, so we need twice the space of the actionbar
    minHeaderTranslation = -headerHeight + (2 * getActionBarHeight());
    actionBarTitleColor = getResources().getColor(android.R.color.white);
    alphaForegroundColorSpan = new AlphaForegroundColorSpan(actionBarTitleColor);
}

From source file:org.telegram.ui.LoginActivity.java

public void setPage(int page, boolean animated, Bundle params, boolean back) {
    if (android.os.Build.VERSION.SDK_INT > 13) {
        Point displaySize = new Point();
        Display display = getWindowManager().getDefaultDisplay();
        display.getSize(displaySize);// w  w  w .ja  va2  s .  c o m

        final SlideView outView = views[currentViewNum];
        final SlideView newView = views[page];
        currentViewNum = page;

        newView.setParams(params);
        getSupportActionBar().setTitle(newView.getHeaderName());
        newView.onShow();
        newView.setX(back ? -displaySize.x : displaySize.x);
        outView.animate().setInterpolator(new AccelerateDecelerateInterpolator())
                .setListener(new Animator.AnimatorListener() {
                    @Override
                    public void onAnimationStart(Animator animator) {
                    }

                    @Override
                    public void onAnimationEnd(Animator animator) {
                        outView.setVisibility(View.GONE);
                        outView.setX(0);
                    }

                    @Override
                    public void onAnimationCancel(Animator animator) {
                    }

                    @Override
                    public void onAnimationRepeat(Animator animator) {
                    }
                }).setDuration(300).translationX(back ? displaySize.x : -displaySize.x).start();
        newView.animate().setInterpolator(new AccelerateDecelerateInterpolator())
                .setListener(new Animator.AnimatorListener() {
                    @Override
                    public void onAnimationStart(Animator animator) {
                        newView.setVisibility(View.VISIBLE);
                    }

                    @Override
                    public void onAnimationEnd(Animator animator) {
                    }

                    @Override
                    public void onAnimationCancel(Animator animator) {
                    }

                    @Override
                    public void onAnimationRepeat(Animator animator) {
                    }
                }).setDuration(300).translationX(0).start();
    } else {
        views[currentViewNum].setVisibility(View.GONE);
        currentViewNum = page;
        views[page].setParams(params);
        views[page].setVisibility(View.VISIBLE);
        getSupportActionBar().setTitle(views[page].getHeaderName());
        views[page].onShow();
    }
}

From source file:com.yahala.ui.LoginActivity.java

public void setPage(int page, boolean animated, Bundle params, boolean back) {
    if (android.os.Build.VERSION.SDK_INT > 13) {
        Point displaySize = new Point();
        Display display = getWindowManager().getDefaultDisplay();
        display.getSize(displaySize);//from w  ww  .  j a  v a  2s .c  o  m

        final SlideView outView = views[currentViewNum];
        final SlideView newView = views[page];
        currentViewNum = page;

        newView.setParams(params);
        getSupportActionBar().setTitle(newView.getHeaderName());
        newView.onShow();
        newView.setX(back ? -displaySize.x : displaySize.x);
        outView.animate().setInterpolator(new AccelerateDecelerateInterpolator())
                .setListener(new Animator.AnimatorListener() {
                    @Override
                    public void onAnimationStart(Animator animator) {
                    }

                    @Override
                    public void onAnimationEnd(Animator animator) {
                        outView.setVisibility(View.GONE);
                        outView.setX(0);
                    }

                    @Override
                    public void onAnimationCancel(Animator animator) {
                    }

                    @Override
                    public void onAnimationRepeat(Animator animator) {
                    }
                }).setDuration(300).translationX(back ? displaySize.x : -displaySize.x).start();

        newView.animate().setInterpolator(new AccelerateDecelerateInterpolator())
                .setListener(new Animator.AnimatorListener() {
                    @Override
                    public void onAnimationStart(Animator animator) {
                        newView.setVisibility(View.VISIBLE);
                    }

                    @Override
                    public void onAnimationEnd(Animator animator) {
                    }

                    @Override
                    public void onAnimationCancel(Animator animator) {
                    }

                    @Override
                    public void onAnimationRepeat(Animator animator) {
                    }
                }).setDuration(300).translationX(0).start();
    } else {
        views[currentViewNum].setVisibility(View.GONE);
        currentViewNum = page;
        views[page].setParams(params);
        views[page].setVisibility(View.VISIBLE);
        getSupportActionBar().setTitle(views[page].getHeaderName());
        views[page].onShow();
    }
}

From source file:net.bither.fragment.hot.MarketFragment.java

public void showPriceAlertAnimTo(int fromX, int fromY, Market toMarket) {
    int[] containerOffset = new int[2];
    v.getLocationInWindow(containerOffset);
    containerOffset[0] += v.getPaddingLeft();
    containerOffset[1] += v.getPaddingTop();
    ViewGroup.MarginLayoutParams lp = (ViewGroup.MarginLayoutParams) ivMarketPriceAnimIcon.getLayoutParams();
    lp.topMargin = fromY - containerOffset[1];
    lp.leftMargin = fromX - containerOffset[0];
    int marketIndex = markets.indexOf(toMarket);
    if (marketIndex < lv.getFirstVisiblePosition() || marketIndex > lv.getLastVisiblePosition()) {
        lv.setSelection(marketIndex);//from  ww  w  .  j a va  2s  .  c om
    }
    View marketView = lv.getChildAt(marketIndex - lv.getFirstVisiblePosition());
    View toIconView = marketView.findViewById(R.id.iv_price_alert);
    int[] toLocation = new int[2];
    toIconView.getLocationInWindow(toLocation);
    TranslateAnimation anim = new TranslateAnimation(0, toLocation[0] - fromX, 0, toLocation[1] - fromY);
    anim.setDuration(300);
    anim.setInterpolator(new AccelerateDecelerateInterpolator());
    anim.setAnimationListener(new Animation.AnimationListener() {
        @Override
        public void onAnimationStart(Animation animation) {

        }

        @Override
        public void onAnimationEnd(Animation animation) {
            doRefresh();
            ivMarketPriceAnimIcon.setVisibility(View.INVISIBLE);
        }

        @Override
        public void onAnimationRepeat(Animation animation) {

        }
    });
    ivMarketPriceAnimIcon.setVisibility(View.VISIBLE);
    ivMarketPriceAnimIcon.startAnimation(anim);
}

From source file:arun.com.chromer.shared.views.TabView.java

private void unSelectedAnimation() {
    clearAnimations();//  w w  w .  j av  a 2 s.c  o m
    final AnimatorSet transformAnimator = new AnimatorSet();
    transformAnimator.playTogether(ObjectAnimator.ofFloat(tabIcon, "translationX", initialIconX),
            ObjectAnimator.ofFloat(tabIcon, "scaleX", 0.75f), ObjectAnimator.ofFloat(tabIcon, "scaleY", 0.75f),
            ObjectAnimator.ofFloat(text, "scaleX", 1f), ObjectAnimator.ofFloat(text, "scaleY", 1f),
            ObjectAnimator.ofFloat(text, "alpha", 1f));
    transformAnimator.setDuration(275);
    transformAnimator.setInterpolator(new AccelerateDecelerateInterpolator());

    final AnimatorSet sequentialAnimator = new AnimatorSet();
    sequentialAnimator.playTogether(transformAnimator, getIconUnSelectionAnimator());
    sequentialAnimator.start();
}

From source file:com.ae.apps.messagecounter.fragments.SentCountFragment.java

/**
 * Sets the progress value to a progressbar, with animation if the OS supports it
 * // w w  w  . j  a v a 2 s .  c  o m
 * @param progressBar
 * @param progress
 */
@TargetApi(Build.VERSION_CODES.HONEYCOMB)
private static void setProgressWithAnimation(ProgressBar progressBar, int progress, long animDelay) {
    // We try to add animation for newer APIs here
    if (android.os.Build.VERSION.SDK_INT > android.os.Build.VERSION_CODES.HONEYCOMB) {
        android.animation.ObjectAnimator animation = android.animation.ObjectAnimator.ofInt(progressBar,
                PROGRESS_VALUE, 0, progress);
        animation.setDuration(100);
        animation.setStartDelay(animDelay);
        animation.setInterpolator(new AccelerateDecelerateInterpolator());
        animation.start();
    } else {
        progressBar.setProgress(progress);
    }
}

From source file:com.unipiazza.material2stepslogin.fragments.SecondStepFragment.java

private void createReveal(final View myView) {

    // get the center for the clipping circle
    int cx = (myView.getWidth()) / 2;
    int cy = (myView.getHeight()) / 2;

    // get the final radius for the clipping circle
    int finalRadius = Math.max(myView.getWidth(), myView.getHeight());

    if (android.os.Build.VERSION.SDK_INT >= android.os.Build.VERSION_CODES.LOLLIPOP) {
        Animator animator = android.view.ViewAnimationUtils.createCircularReveal(myView, cx, cy, 0,
                finalRadius);/*from  ww  w . j a  v  a  2  s .c  o m*/
        animator.setDuration(800);
        animator.start();
    } else {
        SupportAnimator animator = ViewAnimationUtils.createCircularReveal(myView, cx, cy, 0, finalRadius);
        animator.setInterpolator(new AccelerateDecelerateInterpolator());
        animator.setDuration(800);
        animator.start();
    }
}

From source file:com.zandbee.floatingtitlebar.FloatingTitleBarActivity.java

@Override
public void onScrollChanged(int deltaX, int deltaY) {
    final int scrollY = scrollView.getScrollY();

    /** title is going up and has not yet collided with a toolbar */
    if (getLocationYonScreen(bodyLayout) <= (toolbarHeight + titleViewHeight)) {
        titleLayout.setTranslationY(scrollY);
        quasiFab.setTranslationY(scrollY + toolbarHeight + titleViewHeight - quasiFabCenterHeight);

        // TODO try without delta
        if (!titleInUpperPosition
        //&& deltaY > 0
        ) {/*w  w  w . j  av a  2 s  . c  o  m*/
            titleInUpperPosition = true;
            final ObjectAnimator animPd = ObjectAnimator.ofFloat(titleBackDrawable, "progress",
                    titleBackDrawable.max - titleViewHeight, 0f);
            animPd.setInterpolator(new DecelerateInterpolator(2f));
            animPd.setDuration(200).start();
        }
    }

    /** title is going down */
    if (titleInUpperPosition && getLocationYonScreen(titleView) > toolbarHeight
    // + getLocationYonScreen(toolbar)
            && deltaY < 0) {
        titleInUpperPosition = false;
        final ObjectAnimator animPd = ObjectAnimator.ofFloat(titleBackDrawable, "progress", 0f,
                titleBackDrawable.max - titleViewHeight);
        animPd.setInterpolator(new AccelerateDecelerateInterpolator());
        animPd.setDuration(250).start();
    }

    imageView.setTranslationY(scrollY * 0.5f);
}

From source file:com.druk.bonjour.browser.ui.fragment.ServiceBrowserFragment.java

protected boolean showList(int itemsBefore) {
    if (itemsBefore > 0 && mAdapter.getItemCount() == 0) {
        mRecyclerView.animate().alpha(0.0f).setInterpolator(new AccelerateDecelerateInterpolator())
                .setListener(new AnimatorListenerAdapter() {
                    @Override//from  w  w  w. j av  a2 s.  c  om
                    public void onAnimationEnd(Animator animation) {
                        mRecyclerView.setVisibility(View.GONE);
                    }
                }).start();
        mProgressView.setAlpha(0.0f);
        mProgressView.setVisibility(View.VISIBLE);
        mProgressView.animate().alpha(1.0f).setInterpolator(new AccelerateDecelerateInterpolator()).start();
        return true;
    }
    if (itemsBefore == 0 && mAdapter.getItemCount() > 0) {
        mProgressView.animate().alpha(0.0f).setInterpolator(new AccelerateDecelerateInterpolator())
                .setListener(new AnimatorListenerAdapter() {
                    @Override
                    public void onAnimationEnd(Animator animation) {
                        mProgressView.setVisibility(View.GONE);
                    }
                }).start();
        mRecyclerView.setAlpha(0.0f);
        mRecyclerView.setVisibility(View.VISIBLE);
        mRecyclerView.animate().alpha(1.0f).setInterpolator(new AccelerateDecelerateInterpolator()).start();
        return false;
    }
    return mAdapter.getItemCount() > 0;
}