Example usage for android.animation PropertyValuesHolder ofFloat

List of usage examples for android.animation PropertyValuesHolder ofFloat

Introduction

In this page you can find the example usage for android.animation PropertyValuesHolder ofFloat.

Prototype

public static PropertyValuesHolder ofFloat(Property<?, Float> property, float... values) 

Source Link

Document

Constructs and returns a PropertyValuesHolder with a given property and set of float values.

Usage

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

private void growAndFadeOutFolderIcon(FolderIcon fi) {
    if (fi == null)
        return;/*w ww. j  ava2 s  . c o  m*/
    PropertyValuesHolder alpha = PropertyValuesHolder.ofFloat("alpha", 0);
    PropertyValuesHolder scaleX = PropertyValuesHolder.ofFloat("scaleX", 1.5f);
    PropertyValuesHolder scaleY = PropertyValuesHolder.ofFloat("scaleY", 1.5f);

    FolderInfo info = (FolderInfo) fi.getTag();
    if (info.container == LauncherSettings.Favorites.CONTAINER_HOTSEAT) {
        CellLayout cl = (CellLayout) fi.getParent().getParent();
        CellLayout.LayoutParams lp = (CellLayout.LayoutParams) fi.getLayoutParams();
        cl.setFolderLeaveBehindCell(lp.cellX, lp.cellY);
    }

    // Push an ImageView copy of the FolderIcon into the DragLayer and hide the original
    copyFolderIconToImage(fi);
    fi.setVisibility(View.INVISIBLE);

    ObjectAnimator oa = LauncherAnimUtils.ofPropertyValuesHolder(mFolderIconImageView, alpha, scaleX, scaleY);
    oa.setDuration(getResources().getInteger(R.integer.config_folderAnimDuration));
    oa.start();
}

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

private void shrinkAndFadeInFolderIcon(final FolderIcon fi) {
    if (fi == null)
        return;//from   w w w.  j a v a2s  .c o 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_folderAnimDuration));
    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();
}

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

private void growAndFadeOutFolderIcon(FolderIcon fi) {
    if (fi == null)
        return;/*from   w  w w  .  j a  v a  2s  .c  o  m*/
    PropertyValuesHolder alpha = PropertyValuesHolder.ofFloat("alpha", 0);
    PropertyValuesHolder scaleX = PropertyValuesHolder.ofFloat("scaleX", 1.5f);
    PropertyValuesHolder scaleY = PropertyValuesHolder.ofFloat("scaleY", 1.5f);

    FolderInfo info = (FolderInfo) fi.getTag();
    if (info.container == LauncherSettings.Favorites.CONTAINER_HOTSEAT) {
        CellLayout cl = (CellLayout) fi.getParent().getParent();
        CellLayout.LayoutParams lp = (CellLayout.LayoutParams) fi.getLayoutParams();
        cl.setFolderLeaveBehindCell(lp.cellX, lp.cellY);
    }

    // Push an ImageView copy of the FolderIcon into the DragLayer and hide the original
    copyFolderIconToImage(fi);
    fi.setVisibility(View.INVISIBLE);

    ObjectAnimator oa = LauncherAnimUtils.ofPropertyValuesHolder(mFolderIconImageView, alpha, scaleX, scaleY);
    if (Utilities.isLmpOrAbove()) {
        oa.setInterpolator(new LogDecelerateInterpolator(100, 0));
    }
    oa.setDuration(getResources().getInteger(R.integer.config_folderExpandDuration));
    oa.start();
}

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

private void shrinkAndFadeInFolderIcon(final FolderIcon fi) {
    if (fi == null)
        return;//from  ww w.java  2 s . com
    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();
}

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

private void growAndFadeOutFolderIcon(FolderIcon fi) {
    if (fi == null)
        return;//from  w  ww  .ja  va2 s .  co  m
    PropertyValuesHolder alpha = PropertyValuesHolder.ofFloat("alpha", 0);
    PropertyValuesHolder scaleX = PropertyValuesHolder.ofFloat("scaleX", 1.5f);
    PropertyValuesHolder scaleY = PropertyValuesHolder.ofFloat("scaleY", 1.5f);

    FolderInfo info = (FolderInfo) fi.getTag();
    if (info.container == LauncherSettings.Favorites.CONTAINER_HOTSEAT) {
        CellLayout cl = (CellLayout) fi.getParent().getParent();
        CellLayout.LayoutParams lp = (CellLayout.LayoutParams) fi.getLayoutParams();
        cl.setFolderLeaveBehindCell(lp.cellX, lp.cellY);
    }

    // Push an ImageView copy of the FolderIcon into the DragLayer and hide the original
    copyFolderIconToImage(fi);
    fi.setVisibility(View.INVISIBLE);

    ObjectAnimator oa = LauncherAnimUtils.ofPropertyValuesHolder(mFolderIconImageView, alpha, scaleX, scaleY);
    if (Utilities.ATLEAST_LOLLIPOP) {
        oa.setInterpolator(new LogDecelerateInterpolator(100, 0));
    }
    oa.setDuration(getResources().getInteger(R.integer.config_folderExpandDuration));
    oa.start();
}

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

private void shrinkAndFadeInFolderIcon(final FolderIcon fi, boolean animate) {
    if (fi == null)
        return;/*  ww  w  . j  a  v a 2 s. com*/
    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();
    }
}

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

/**
 * Runs a new animation that scales up icons that were added while Launcher was in the
 * background.//from   w  ww . ja va 2s  . c om
 *
 * @param immediate whether to run the animation or show the results immediately
 */
private void runNewAppsAnimation(boolean immediate) {
    AnimatorSet anim = LauncherAnimUtils.createAnimatorSet();
    Collection<Animator> bounceAnims = new ArrayList<Animator>();

    // Order these new views spatially so that they animate in order
    Collections.sort(mNewShortcutAnimateViews, new Comparator<View>() {
        @Override
        public int compare(View a, View b) {
            CellLayout.LayoutParams alp = (CellLayout.LayoutParams) a.getLayoutParams();
            CellLayout.LayoutParams blp = (CellLayout.LayoutParams) b.getLayoutParams();
            int cellCountX = LauncherModel.getCellCountX();
            return (alp.cellY * cellCountX + alp.cellX) - (blp.cellY * cellCountX + blp.cellX);
        }
    });

    // Animate each of the views in place (or show them immediately if requested)
    if (immediate) {
        for (View v : mNewShortcutAnimateViews) {
            v.setAlpha(1f);
            v.setScaleX(1f);
            v.setScaleY(1f);
        }
    } else {
        for (int i = 0; i < mNewShortcutAnimateViews.size(); ++i) {
            View v = mNewShortcutAnimateViews.get(i);
            ValueAnimator bounceAnim = LauncherAnimUtils.ofPropertyValuesHolder(v,
                    PropertyValuesHolder.ofFloat("alpha", 1f), PropertyValuesHolder.ofFloat("scaleX", 1f),
                    PropertyValuesHolder.ofFloat("scaleY", 1f));
            bounceAnim.setDuration(InstallShortcutReceiver.NEW_SHORTCUT_BOUNCE_DURATION);
            bounceAnim.setStartDelay(i * InstallShortcutReceiver.NEW_SHORTCUT_STAGGER_DELAY);
            bounceAnim.setInterpolator(new SmoothPagedView.OvershootInterpolator());
            bounceAnims.add(bounceAnim);
        }
        anim.playTogether(bounceAnims);
        anim.addListener(new AnimatorListenerAdapter() {
            @Override
            public void onAnimationEnd(Animator animation) {
                if (mWorkspace != null) {
                    mWorkspace.postDelayed(mBuildLayersRunnable, 500);
                }
            }
        });
        anim.start();
    }

    // Clean up
    mNewShortcutAnimatePage = -1;
    mNewShortcutAnimateViews.clear();
    new Thread("clearNewAppsThread") {
        public void run() {
            mSharedPrefs.edit().putInt(InstallShortcutReceiver.NEW_APPS_PAGE_KEY, -1)
                    .putStringSet(InstallShortcutReceiver.NEW_APPS_LIST_KEY, null).commit();
        }
    }.start();
}

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

private ValueAnimator createNewAppBounceAnimation(View v, int i) {
    ValueAnimator bounceAnim = LauncherAnimUtils.ofPropertyValuesHolder(v,
            PropertyValuesHolder.ofFloat("alpha", 1f), PropertyValuesHolder.ofFloat("scaleX", 1f),
            PropertyValuesHolder.ofFloat("scaleY", 1f));
    bounceAnim.setDuration(InstallShortcutReceiver.NEW_SHORTCUT_BOUNCE_DURATION);
    bounceAnim.setStartDelay(i * InstallShortcutReceiver.NEW_SHORTCUT_STAGGER_DELAY);
    bounceAnim.setInterpolator(new SmoothPagedView.OvershootInterpolator());
    return bounceAnim;
}

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

private ValueAnimator createNewAppBounceAnimation(View v, int i) {
    ValueAnimator bounceAnim = LauncherAnimUtils.ofPropertyValuesHolder(v,
            PropertyValuesHolder.ofFloat("alpha", 1f), PropertyValuesHolder.ofFloat("scaleX", 1f),
            PropertyValuesHolder.ofFloat("scaleY", 1f));
    bounceAnim.setDuration(InstallShortcutReceiver.NEW_SHORTCUT_BOUNCE_DURATION);
    bounceAnim.setStartDelay(i * InstallShortcutReceiver.NEW_SHORTCUT_STAGGER_DELAY);
    bounceAnim.setInterpolator(new OvershootInterpolator(BOUNCE_ANIMATION_TENSION));
    return bounceAnim;
}