Example usage for android.view.animation Animation setInterpolator

List of usage examples for android.view.animation Animation setInterpolator

Introduction

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

Prototype

public void setInterpolator(Interpolator i) 

Source Link

Document

Sets the acceleration curve for this animation.

Usage

From source file:ly.kite.journey.selection.ProductOverviewFragment.java

/*****************************************************
 *
 * Returns the content view for this fragment
 *
 *****************************************************/
@Override//from ww  w.  j av  a2s.c om
public View onCreateView(LayoutInflater layoutInflator, ViewGroup container, Bundle savedInstanceState) {
    boolean slidingDrawerIsExpanded = false;

    // Get any saved instance state

    if (savedInstanceState != null) {
        slidingDrawerIsExpanded = savedInstanceState.getBoolean(BUNDLE_KEY_SLIDING_DRAWER_IS_EXPANDED, false);
    } else {
        Analytics.getInstance(mKiteActivity).trackProductOverviewScreenViewed(mProduct);
    }

    // Set up the screen. Note that the SDK allows for different layouts to be used in place of the standard
    // one, so some of these views are optional and may not actually exist in the current layout.

    View view = layoutInflator.inflate(R.layout.screen_product_overview, container, false);

    mProductImageViewPager = (ViewPager) view.findViewById(R.id.view_pager);
    mOverlaidComponents = view.findViewById(R.id.overlaid_components);
    mPagingDots = (PagingDots) view.findViewById(R.id.paging_dots);
    mOverlaidStartButton = (Button) view.findViewById(R.id.overlaid_start_button);
    mSlidingOverlayFrame = (SlidingOverlayFrame) view.findViewById(R.id.sliding_overlay_frame);
    mDrawerControlLayout = view.findViewById(R.id.drawer_control_layout);
    mOpenCloseDrawerIconImageView = (ImageView) view.findViewById(R.id.open_close_drawer_icon_image_view);
    mProceedOverlayButton = (Button) view.findViewById(R.id.proceed_overlay_button);
    TextView priceTextView = (TextView) view.findViewById(R.id.price_text_view);
    TextView summaryDescriptionTextView = (TextView) view.findViewById(R.id.summary_description_text_view);
    TextView summaryShippingTextView = (TextView) view.findViewById(R.id.summary_shipping_text_view);
    View descriptionLayout = view.findViewById(R.id.description_layout);
    TextView descriptionTextView = (TextView) view.findViewById(R.id.description_text_view);
    View sizeLayout = view.findViewById(R.id.size_layout);
    TextView sizeTextView = (TextView) view.findViewById(R.id.size_text_view);
    View quantityLayout = view.findViewById(R.id.quantity_layout);
    TextView quantityTextView = (TextView) view.findViewById(R.id.quantity_text_view);
    TextView shippingTextView = (TextView) view.findViewById(R.id.shipping_text_view);

    // Paging dots

    Animation pagingDotOutAlphaAnimation = new AlphaAnimation(PAGING_DOT_ANIMATION_OPAQUE,
            PAGING_DOT_ANIMATION_TRANSLUCENT);
    pagingDotOutAlphaAnimation.setFillAfter(true);
    pagingDotOutAlphaAnimation.setDuration(PAGING_DOT_ANIMATION_DURATION_MILLIS);

    Animation pagingDotOutScaleAnimation = new ScaleAnimation(0f, PAGING_DOT_ANIMATION_NORMAL_SCALE, 0f,
            PAGING_DOT_ANIMATION_NORMAL_SCALE, Animation.RELATIVE_TO_SELF, 0.5f, Animation.RELATIVE_TO_SELF,
            0.5f);

    pagingDotOutScaleAnimation.setFillAfter(true);
    pagingDotOutScaleAnimation.setDuration(PAGING_DOT_ANIMATION_DURATION_MILLIS);
    pagingDotOutScaleAnimation.setInterpolator(new BellInterpolator(1.0f, 0.8f, true));

    AnimationSet pagingDotOutAnimation = new AnimationSet(false);
    pagingDotOutAnimation.addAnimation(pagingDotOutAlphaAnimation);
    pagingDotOutAnimation.addAnimation(pagingDotOutScaleAnimation);
    pagingDotOutAnimation.setFillAfter(true);

    Animation pagingDotInAlphaAnimation = new AlphaAnimation(PAGING_DOT_ANIMATION_TRANSLUCENT,
            PAGING_DOT_ANIMATION_OPAQUE);
    pagingDotInAlphaAnimation.setFillAfter(true);
    pagingDotInAlphaAnimation.setDuration(PAGING_DOT_ANIMATION_DURATION_MILLIS);

    Animation pagingDotInScaleAnimation = new ScaleAnimation(0f, PAGING_DOT_ANIMATION_NORMAL_SCALE, 0f,
            PAGING_DOT_ANIMATION_NORMAL_SCALE, Animation.RELATIVE_TO_SELF, 0.5f, Animation.RELATIVE_TO_SELF,
            0.5f);

    pagingDotInScaleAnimation.setFillAfter(true);
    pagingDotInScaleAnimation.setDuration(PAGING_DOT_ANIMATION_DURATION_MILLIS);
    pagingDotInScaleAnimation.setInterpolator(new BellInterpolator(1.0f, 1.2f));

    AnimationSet pagingDotInAnimation = new AnimationSet(false);
    pagingDotInAnimation.addAnimation(pagingDotInAlphaAnimation);
    pagingDotInAnimation.addAnimation(pagingDotInScaleAnimation);
    pagingDotInAnimation.setFillAfter(true);

    mPagingDots.setProperties(mProduct.getImageURLList().size(), R.drawable.paging_dot_unselected,
            R.drawable.paging_dot_selected);
    mPagingDots.setOutAnimation(pagingDotOutAlphaAnimation);
    mPagingDots.setInAnimation(pagingDotInAnimation);

    mProductImageViewPager.setOnPageChangeListener(mPagingDots);

    mOverlaidComponents.setAlpha(slidingDrawerIsExpanded ? 0f : 1f); // If the drawer starts open, these components need to be invisible

    if (mSlidingOverlayFrame != null) {
        mSlidingOverlayFrame.snapToExpandedState(slidingDrawerIsExpanded);
        mSlidingOverlayFrame.setSlideAnimationDuration(SLIDE_ANIMATION_DURATION_MILLIS);
        mOpenCloseDrawerIconImageView.setRotation(
                slidingDrawerIsExpanded ? OPEN_CLOSE_ICON_ROTATION_DOWN : OPEN_CLOSE_ICON_ROTATION_UP);
    }

    SingleUnitSize size = mProduct.getSizeWithFallback(UnitOfLength.CENTIMETERS);
    boolean formatAsInt = size.getWidth() == (int) size.getWidth()
            && size.getHeight() == (int) size.getHeight();
    String sizeFormatString = getString(
            formatAsInt ? R.string.product_size_format_string_int : R.string.product_size_format_string_float);
    String sizeString = String.format(sizeFormatString, size.getWidth(), size.getHeight(),
            size.getUnit().shortString(mKiteActivity));

    int quantityPerSheet = mProduct.getQuantityPerSheet();
    MultipleDestinationShippingCosts shippingCosts = mProduct.getShippingCosts();

    Locale locale = Locale.getDefault();
    Country country = Country.getInstance(locale);

    SingleCurrencyAmount singleCurrencyCost;

    // Price

    if (isVisible(priceTextView)) {
        singleCurrencyCost = mProduct.getCostWithFallback(locale);

        if (singleCurrencyCost != null)
            priceTextView.setText(singleCurrencyCost.getDisplayAmountForLocale(locale));
    }

    // Summary description. This is a short description - not to be confused with the (full) description.

    if (isVisible(summaryDescriptionTextView)) {
        String summaryDescription = String.valueOf(quantityPerSheet) + " " + mProduct.getName()
                + (Product.isSensibleSize(size) ? " (" + sizeString + ")" : "");

        summaryDescriptionTextView.setText(summaryDescription);
    }

    // (Full) description

    String description = mProduct.getDescription();

    boolean haveDescription = (description != null && (!description.trim().equals("")));

    if (haveDescription && descriptionLayout != null && descriptionTextView != null) {
        descriptionLayout.setVisibility(View.VISIBLE);
        descriptionTextView.setVisibility(View.VISIBLE);

        descriptionTextView.setText(description);
    } else {
        if (descriptionLayout != null)
            descriptionLayout.setVisibility(View.GONE);
        if (descriptionTextView != null)
            descriptionTextView.setVisibility(View.GONE);
    }

    // Size

    if (isVisible(sizeTextView)) {
        if (Product.isSensibleSize(size)) {
            sizeTextView.setText(String.format(sizeFormatString, size.getWidth(), size.getHeight(),
                    size.getUnit().shortString(mKiteActivity)));
        } else {
            sizeLayout.setVisibility(View.GONE);
        }
    }

    // Quantity

    if (isVisible(quantityTextView)) {
        if (quantityPerSheet > 1) {
            quantityLayout.setVisibility(View.VISIBLE);

            quantityTextView.setText(getString(R.string.product_quantity_format_string, quantityPerSheet));
        } else {
            quantityLayout.setVisibility(View.GONE);
        }
    }

    // Shipping description

    if (isVisible(summaryShippingTextView)) {
        // Currently we just check that shipping is free everywhere. If it isn't - we don't display
        // anything.

        boolean freeShippingEverywhere = true;

        MultipleDestinationShippingCosts multipleDestinationShippingCosts = shippingCosts;

        for (SingleDestinationShippingCost singleDestinationShippingCosts : multipleDestinationShippingCosts
                .asList()) {
            MultipleCurrencyAmount multipleCurrencyShippingCost = singleDestinationShippingCosts.getCost();

            for (SingleCurrencyAmount singleCurrencyShippingCost : multipleCurrencyShippingCost
                    .asCollection()) {
                if (singleCurrencyShippingCost.isNonZero()) {
                    freeShippingEverywhere = false;
                }
            }
        }

        if (freeShippingEverywhere) {
            summaryShippingTextView.setText(R.string.product_free_worldwide_shipping);
        } else {
            summaryShippingTextView.setText(getString(R.string.product_shipping_summary_format_string,
                    shippingCosts.getDisplayCost(locale)));
        }
    }

    // Shipping (postage)

    if (isVisible(shippingTextView)) {
        List<SingleDestinationShippingCost> sortedShippingCostList = mProduct.getSortedShippingCosts(country);

        StringBuilder shippingCostsStringBuilder = new StringBuilder();

        String newlineString = "";

        for (SingleDestinationShippingCost singleDestinationShippingCost : sortedShippingCostList) {
            // We want to prepend a new line for every shipping destination except the first

            shippingCostsStringBuilder.append(newlineString);

            newlineString = "\n";

            // Get the cost in the default currency for the locale, and format the amount.

            singleCurrencyCost = singleDestinationShippingCost.getCost().getDefaultAmountWithFallback();

            if (singleCurrencyCost != null) {
                String formatString = getString(R.string.product_shipping_format_string);

                String costString = (singleCurrencyCost.isNonZero()
                        ? singleCurrencyCost.getDisplayAmountForLocale(locale)
                        : getString(R.string.product_free_shipping));

                shippingCostsStringBuilder.append(String.format(formatString,
                        singleDestinationShippingCost.getDestinationDescription(mKiteActivity), costString));
            }

            shippingTextView.setText(shippingCostsStringBuilder.toString());
        }
    }

    if (mProceedOverlayButton != null) {
        mProceedOverlayButton.setText(R.string.product_overview_start_button_text);

        mProceedOverlayButton.setOnClickListener(this);
    }

    mProductImageViewPager.setOnClickListener(this);

    if (mDrawerControlLayout != null)
        mDrawerControlLayout.setOnClickListener(this);

    mOverlaidStartButton.setOnClickListener(this);

    return (view);
}

From source file:com.wanderingcan.floatingactionmenu.FloatingActionMenu.java

/**
 * Sets the menu Open Animation for all the Floating Action Buttons that are part of the Floating
 * Action Menu/*w w  w.  java  2s .  co m*/
 * @param resId the Resource Id of the Animation Resource
 */
public void setMenuOpenAnimation(@AnimRes int resId) {
    mMenuShowAnimation = resId;
    for (int i = mButtonsCount - 1; i >= 0; i--) {
        final View child = getChildAt(i);
        if (child != mMenuButton) {
            Animation showAnimation = AnimationUtils.loadAnimation(getContext(), mMenuShowAnimation);
            if (mMenuShowAnimation == R.anim.fab_in) {
                showAnimation.setInterpolator(new FastOutSlowInInterpolator());
            }

            ((FloatingActionButton) child).setShowAnimation(showAnimation, mAnimationDuration);
        }
    }
}

From source file:com.wanderingcan.floatingactionmenu.FloatingActionMenu.java

/**
 * Sets the menu Close Animation for all the Floating Action Buttons that are part of the Floating
 * Action Menu/*from   w ww  .  jav  a  2  s .com*/
 * @param resId the Resource Id of the Animation Resource
 */
public void setMenuCloseAnimation(@AnimRes int resId) {
    mMenuHideAnimation = resId;
    for (int i = mButtonsCount - 1; i >= 0; i--) {
        final View child = getChildAt(i);
        if (child != mMenuButton) {
            Animation hideAnimation = AnimationUtils.loadAnimation(getContext(), mMenuHideAnimation);
            if (mMenuHideAnimation == R.anim.fab_in) {
                hideAnimation.setInterpolator(new FastOutSlowInInterpolator());
            }

            ((FloatingActionButton) child).setHideAnimation(hideAnimation, mAnimationDuration);
        }
    }
}

From source file:org.huxizhijian.hhcomicviewer.ui.entry.ComicDetailsActivity.java

private void updateViews() {
    //?//from  w ww  . j  a  v a 2  s  .co  m
    mBinding.comicAuthorComicDetails.setVisibility(View.VISIBLE);
    mBinding.comicAuthorComicDetails.setText(mComic.getAuthor());
    mBinding.comicVolStatusComicDetails.setText(mComic.getComicStatus());
    mBinding.comicFavoriteNumberComicDetails.setText(mComic.getComicFavorite());
    mBinding.comicUpdateTimeComicDetails.setText(mComic.getComicUpdateTime());

    //
    mBinding.comicDescriptionComicDetails.setText(mComic.getDescription());
    //?
    mBinding.comicDescriptionComicDetailsBack.setVisibility(View.VISIBLE);
    mBinding.comicDescriptionComicDetailsBack.setText(mComic.getDescription());
    final ViewTreeObserver vto1 = mBinding.comicDescriptionComicDetails.getViewTreeObserver();
    vto1.addOnGlobalLayoutListener(new ViewTreeObserver.OnGlobalLayoutListener() {
        @Override
        public void onGlobalLayout() {
            mDetailsHeight = mBinding.comicDescriptionComicDetails.getHeight();
            //??
            mBinding.comicDescriptionComicDetails.getViewTreeObserver().removeGlobalOnLayoutListener(this);
        }
    });
    //?tv_back 
    ViewTreeObserver vto = mBinding.comicDescriptionComicDetailsBack.getViewTreeObserver();
    vto.addOnGlobalLayoutListener(new ViewTreeObserver.OnGlobalLayoutListener() {

        @Override
        public void onGlobalLayout() {
            mBackHeight = mBinding.comicDescriptionComicDetailsBack.getHeight();
            mBinding.comicDescriptionComicDetailsBack.getViewTreeObserver().removeGlobalOnLayoutListener(this);

            //
            if (mBackHeight > mDetailsHeight) {
                //
                mBinding.ivArrow.setVisibility(View.VISIBLE);
                //?
                mBinding.comicDescriptionComicDetails.setTag(true);
                isDescriptionCanOpen = true;
            } else {
                mBinding.ivArrow.setVisibility(View.GONE);
                isDescriptionCanOpen = false;
            }

            mBinding.comicDescriptionComicDetailsBack.setVisibility(View.GONE);
        }
    });

    //?
    mBinding.ratingBarComicDetails.setRating((mComic.getRatingNumber() / 10.0f) * 5.0f);
    mBinding.ratingBarDescriptionComicDetails.setText(mComic.getRatingNumber() + "(10), " + ""
            + mComic.getRatingPeopleNum() + "");

    //
    if (mComic.isMark() || mComic.isDownload()) {
        mVolAdapter = new VolRecyclerViewAdapter(ComicDetailsActivity.this, mComic.getChapterName(),
                mComic.getReadChapter(), mFinishedComicChapters);
    } else {
        mVolAdapter = new VolRecyclerViewAdapter(ComicDetailsActivity.this, mComic.getChapterName(),
                mFinishedComicChapters);
    }

    //?RecyclerView
    mBinding.recyclerViewComicDetails
            .setLayoutManager(new FullyGridLayoutManager(ComicDetailsActivity.this, 4));
    mBinding.recyclerViewComicDetails.setItemAnimator(new DefaultItemAnimator());
    mBinding.recyclerViewComicDetails.setHasFixedSize(true);
    mBinding.recyclerViewComicDetails.setNestedScrollingEnabled(false);
    mVolAdapter.setOnItemClickListener(new VolRecyclerViewAdapter.OnItemClickListener() {
        @Override
        public void onItemClick(View view, int position) {
            Intent intent = new Intent(ComicDetailsActivity.this, GalleryActivity.class);
            intent.putExtra("comic", mComic);
            intent.putExtra("position", position);
            startActivityForResult(intent, 0);
        }

        @Override
        public void onItemLongClick(View view, int position) {
        }
    });
    mBinding.recyclerViewComicDetails.setAdapter(mVolAdapter);
    mBinding.recyclerViewComicDetails.setFocusable(false);
    mBinding.nestScrollViewComicDetails.setFocusable(true);
    mBinding.nestScrollViewComicDetails.smoothScrollBy(0, 0);

    //??
    if (mComic.isMark()) {
        mBinding.btnFavoriteComicDetails.setImageResource(R.mipmap.my_favorite);
        mBinding.buttonTextFavoriteComicDetails.setText("?");
    }

    //?
    mBinding.FABComicDetails.setOnClickListener(this);
    mBinding.readButton.setOnClickListener(this);
    //
    mBinding.btnFavorite.setOnClickListener(this);
    mBinding.btnShare.setOnClickListener(this);
    mBinding.btnFind.setOnClickListener(this);
    mBinding.btnDownload.setOnClickListener(this);
    //
    mBinding.comicAuthorComicDetails.setOnClickListener(this);
    mBinding.comicDescriptionComicDetailsLl.setOnClickListener(this);

    //??
    mBinding.FABComicDetails
            .setBackgroundTintList(ColorStateList.valueOf(getResources().getColor(R.color.colorAccent)));
    mBinding.linearLayoutComicDetails.setVisibility(View.VISIBLE);
    Animation alpha = AnimationUtils.loadAnimation(this, R.anim.alpha_in);
    //?
    alpha.setInterpolator(new AccelerateInterpolator());
    mBinding.linearLayoutComicDetails.startAnimation(alpha);
}

From source file:com.wanderingcan.floatingactionmenu.FloatingActionMenu.java

@Override
protected void onFinishInflate() {
    super.onFinishInflate();

    bringChildToFront(mMenuButton);// w w w. j  a va 2s  .  c  o  m
    mButtonsCount = getChildCount();

    for (int i = 0; i < mButtonsCount; i++) {
        final View child = getChildAt(i);
        if (child != mMenuButton) {
            Animation showAnimation = AnimationUtils.loadAnimation(getContext(), mMenuShowAnimation);
            if (mMenuShowAnimation == R.anim.fab_in) {
                showAnimation.setInterpolator(new FastOutSlowInInterpolator());
            }

            Animation hideAnimation = AnimationUtils.loadAnimation(getContext(), mMenuHideAnimation);
            if (mMenuHideAnimation == R.anim.fab_out) {
                hideAnimation.setInterpolator(new FastOutSlowInInterpolator());
            }

            ((FloatingActionButton) child).setShowAnimation(showAnimation, mAnimationDuration);
            ((FloatingActionButton) child).setHideAnimation(hideAnimation, mAnimationDuration);
            ((FloatingActionButton) child).hide(false);
        }
    }

    if (mLabelsStyle != 0 || mLabelsType != 0) {
        createLabels();
    }
}

From source file:com.wanderingcan.floatingactionmenu.FloatingActionMenu.java

private void createLabels() {
    Context context = new ContextThemeWrapper(getContext(), mLabelsStyle);

    for (int i = 0; i < mButtonsCount; i++) {
        FloatingActionButton button = (FloatingActionButton) getChildAt(i);
        String title = button.getLabelText();

        if (button == mMenuButton || title == null || button.getTag(R.id.fab_label) != null)
            continue;

        LabelView label = new LabelView(context);
        if (mLabelsType == LABELS_CARD) {
            label.setLabelType(LabelView.Type.CARD);
        } else {/*from  w  w w.  j a v a  2  s. co  m*/
            label.setLabelType(LabelView.Type.TEXT);
        }

        int style;
        if (mLabelsStyle != 0) {
            style = mLabelsStyle;
        } else {
            style = R.style.menu_labels_style_blank;
        }

        label.setTextAppearance(getContext(), style);

        Animation showAnimation = AnimationUtils.loadAnimation(getContext(), mMenuShowAnimation);
        if (mMenuHideAnimation == R.anim.fab_in) {
            showAnimation.setInterpolator(new FastOutSlowInInterpolator());
        }

        Animation hideAnimation = AnimationUtils.loadAnimation(getContext(), mMenuHideAnimation);
        if (mMenuHideAnimation == R.anim.fab_out) {
            hideAnimation.setInterpolator(new FastOutSlowInInterpolator());
        }

        label.setShowAnimation(showAnimation, mAnimationDuration);
        label.setHideAnimation(hideAnimation, mAnimationDuration);

        label.setText(button.getLabelText());
        addView(label);

        button.setLabelView(label);
    }
}

From source file:com.box.myview.MyTopSnackBar.TSnackbar.java

private void animateViewIn() {
    Animation anim;
    if (appearDirection == APPEAR_FROM_TOP_TO_DOWN) {
        anim = getAnimationInFromTopToDown();
    } else {//from  www  .j  a  v a2s.  c om
        anim = getAnimationInFromBottomToTop();
    }
    anim.setInterpolator(FAST_OUT_SLOW_IN_INTERPOLATOR);
    anim.setDuration(ANIMATION_DURATION);
    anim.setAnimationListener(new Animation.AnimationListener() {
        @Override
        public void onAnimationEnd(Animation animation) {
            onViewShown();
        }

        @Override
        public void onAnimationStart(Animation animation) {
        }

        @Override
        public void onAnimationRepeat(Animation animation) {
        }
    });
    mView.startAnimation(anim);
}

From source file:com.box.myview.MyTopSnackBar.TSnackbar.java

private void animateViewOut(final int event) {
    Animation anim;

    if (appearDirection == APPEAR_FROM_TOP_TO_DOWN) {
        anim = getAnimationOutFromTopToDown();
    } else {/*  w  w  w . j  a va 2s.c om*/
        anim = getAnimationOutFromBottomToTop();
    }
    anim.setInterpolator(FAST_OUT_SLOW_IN_INTERPOLATOR);
    anim.setDuration(ANIMATION_DURATION);
    anim.setAnimationListener(new Animation.AnimationListener() {
        @Override
        public void onAnimationEnd(Animation animation) {
            onViewHidden(event);
        }

        @Override
        public void onAnimationStart(Animation animation) {
        }

        @Override
        public void onAnimationRepeat(Animation animation) {
        }
    });
    mView.startAnimation(anim);
}

From source file:com.appolica.interactiveinfowindow.InfoWindowManager.java

private void internalHide(@NonNull final View container, @NonNull final InfoWindow toHideWindow,
        final boolean animated) {

    if (animated) {

        final Animation animation;

        if (hideAnimation == null) {

            final int containerWidth = container.getWidth();
            final int containerHeight = container.getHeight();

            final float pivotX = container.getX() + containerWidth / 2;
            final float pivotY = container.getY() + containerHeight;

            animation = new ScaleAnimation(1f, 0f, 1f, 0f, pivotX, pivotY);

            animation.setDuration(DURATION_WINDOW_ANIMATION);
            animation.setInterpolator(new DecelerateInterpolator());

        } else {/*from ww  w.j av  a 2 s  .  c  om*/
            animation = hideAnimation;
        }

        animation.setAnimationListener(new SimpleAnimationListener() {

            @Override
            public void onAnimationStart(Animation animation) {
                toHideWindow.setWindowState(InfoWindow.State.HIDING);
                propagateShowEvent(toHideWindow, InfoWindow.State.HIDING);
            }

            @Override
            public void onAnimationEnd(Animation animation) {
                removeWindow(toHideWindow, container);

                if (container.getId() != InfoWindowManager.this.currentContainer.getId()) {
                    parent.removeView(container);
                }

                toHideWindow.setWindowState(InfoWindow.State.HIDDEN);
                propagateShowEvent(toHideWindow, InfoWindow.State.HIDDEN);
            }
        });

        this.currentContainer.startAnimation(animation);

    } else {

        removeWindow(toHideWindow, container);
        propagateShowEvent(toHideWindow, InfoWindow.State.HIDDEN);

    }
}

From source file:com.oginotihiro.snackbar.Snackbar.java

private void animateViewOut(final int event) {
    if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.ICE_CREAM_SANDWICH) {
        ViewPropertyAnimatorCompat vpac = ViewCompat.animate(mView);

        if (mDirection == LEFT_RIGHT) {
            vpac.translationX(-mView.getWidth());
        } else if (mDirection == TOP_BOTTOM) {
            vpac.translationY(-mView.getHeight());
        } else if (mDirection == RIGHT_LEFT) {
            vpac.translationX(mView.getWidth());
        } else if (mDirection == BOTTOM_TOP) {
            vpac.translationY(mView.getHeight());
        }//from  w ww .  j a v a2  s .  c  o m

        vpac.setInterpolator(new FastOutSlowInInterpolator()).setDuration(mAnimDuration)
                .setListener(new ViewPropertyAnimatorListenerAdapter() {
                    @Override
                    public void onAnimationStart(View view) {
                        mView.animateChildrenOut(0, mAnimFadeDuration);
                    }

                    @Override
                    public void onAnimationEnd(View view) {
                        onViewHidden(event);
                    }
                }).start();
    } else {
        Animation anim = null;

        if (mDirection == LEFT_RIGHT) {
            anim = AnimationUtils.loadAnimation(mView.getContext(), R.anim.oginotihiro_snackbar_left_out);
        } else if (mDirection == TOP_BOTTOM) {
            anim = AnimationUtils.loadAnimation(mView.getContext(), R.anim.oginotihiro_snackbar_top_out);
        } else if (mDirection == RIGHT_LEFT) {
            anim = AnimationUtils.loadAnimation(mView.getContext(), R.anim.oginotihiro_snackbar_right_out);
        } else if (mDirection == BOTTOM_TOP) {
            anim = AnimationUtils.loadAnimation(mView.getContext(), R.anim.oginotihiro_snackbar_bottom_out);
        }

        if (anim == null)
            return;

        anim.setInterpolator(new FastOutSlowInInterpolator());
        anim.setDuration(ANIMATION_DURATION);
        anim.setAnimationListener(new Animation.AnimationListener() {
            @Override
            public void onAnimationStart(Animation animation) {
            }

            @Override
            public void onAnimationEnd(Animation animation) {
                onViewHidden(event);
            }

            @Override
            public void onAnimationRepeat(Animation animation) {
            }
        });
        mView.startAnimation(anim);
    }
}