Example usage for android.animation ObjectAnimator end

List of usage examples for android.animation ObjectAnimator end

Introduction

In this page you can find the example usage for android.animation ObjectAnimator end.

Prototype

@Override
    public void end() 

Source Link

Usage

From source file:com.android.launcher3.Launcher.java

private void shrinkAndFadeInFolderIcon(final FolderIcon fi, boolean animate) {
    if (fi == null)
        return;//from   w  w  w  .ja v  a 2  s  .com
    final CellLayout cl = (CellLayout) fi.getParent().getParent();

    // We remove and re-draw the FolderIcon in-case it has changed
    mDragLayer.removeView(mFolderIconImageView);
    copyFolderIconToImage(fi);

    if (cl != null) {
        cl.clearFolderLeaveBehind();
    }

    ObjectAnimator oa = LauncherAnimUtils.ofViewAlphaAndScale(mFolderIconImageView, 1, 1, 1);
    oa.setDuration(getResources().getInteger(R.integer.config_folderExpandDuration));
    oa.addListener(new AnimatorListenerAdapter() {
        @Override
        public void onAnimationEnd(Animator animation) {
            if (cl != null) {
                // Remove the ImageView copy of the FolderIcon and make the original visible.
                mDragLayer.removeView(mFolderIconImageView);
                fi.setVisibility(View.VISIBLE);
            }
        }
    });
    oa.start();
    if (!animate) {
        oa.end();
    }
}

From source file:xyz.klinker.blur.launcher3.Launcher.java

private void shrinkAndFadeInFolderIcon(final FolderIcon fi, boolean animate) {
    if (fi == null)
        return;//from  ww w.  jav  a 2  s .co m
    PropertyValuesHolder alpha = PropertyValuesHolder.ofFloat("alpha", 1.0f);
    PropertyValuesHolder scaleX = PropertyValuesHolder.ofFloat("scaleX", 1.0f);
    PropertyValuesHolder scaleY = PropertyValuesHolder.ofFloat("scaleY", 1.0f);

    final CellLayout cl = (CellLayout) fi.getParent().getParent();

    // We remove and re-draw the FolderIcon in-case it has changed
    mDragLayer.removeView(mFolderIconImageView);
    copyFolderIconToImage(fi);
    ObjectAnimator oa = LauncherAnimUtils.ofPropertyValuesHolder(mFolderIconImageView, alpha, scaleX, scaleY);
    oa.setDuration(getResources().getInteger(R.integer.config_folderExpandDuration));
    oa.addListener(new AnimatorListenerAdapter() {
        @Override
        public void onAnimationEnd(Animator animation) {
            if (cl != null) {
                cl.clearFolderLeaveBehind();
                // Remove the ImageView copy of the FolderIcon and make the original visible.
                mDragLayer.removeView(mFolderIconImageView);
                fi.setVisibility(View.VISIBLE);
            }
        }
    });
    oa.start();
    if (!animate) {
        oa.end();
    }
}