Example usage for android.animation ObjectAnimator start

List of usage examples for android.animation ObjectAnimator start

Introduction

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

Prototype

@Override
    public void start() 

Source Link

Usage

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

private void dismissCling(final Cling cling, final String flag, int duration) {
    // To catch cases where siblings of top-level views are made invisible, just check whether
    // the cling is directly set to GONE before dismissing it.
    if (cling != null && cling.getVisibility() != View.GONE) {
        ObjectAnimator anim = LauncherAnimUtils.ofFloat(cling, "alpha", 0f);
        anim.setDuration(duration);//from   w  w  w  .j  a  v a 2  s.co m
        anim.addListener(new AnimatorListenerAdapter() {
            public void onAnimationEnd(Animator animation) {
                cling.setVisibility(View.GONE);
                cling.cleanup();
                // We should update the shared preferences on a background thread
                new Thread("dismissClingThread") {
                    public void run() {
                        SharedPreferences.Editor editor = mSharedPrefs.edit();
                        editor.putBoolean(flag, true);
                        editor.commit();
                    }
                }.start();
            };
        });
        anim.start();
        mHideFromAccessibilityHelper.restoreImportantForAccessibility(mDragLayer);
    }
}

From source file:com.gxapplications.android.gxsuite.launcher.Launcher.java

private void dismissCling(final Cling cling, final String flag, int duration) {
    if (cling != null && cling.getVisibility() == View.VISIBLE) {
        ObjectAnimator anim = LauncherAnimUtils.ofFloat(cling, "alpha", 0f);
        anim.setDuration(duration);/* w  ww .jav a  2 s  . c  o  m*/
        anim.addListener(new AnimatorListenerAdapter() {
            public void onAnimationEnd(Animator animation) {
                cling.setVisibility(View.GONE);
                cling.cleanup();
                // We should update the shared preferences on a background thread
                new Thread("dismissClingThread") {
                    public void run() {
                        SharedPreferences.Editor editor = mSharedPrefs.edit();
                        editor.putBoolean(flag, true);
                        editor.commit();
                    }
                }.start();
            };
        });
        anim.start();
        mHideFromAccessibilityHelper.restoreImportantForAccessibility(mDragLayer);
    }
}

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

private void fadeAndRemoveEmptyScreen(int delay, int duration, final Runnable onComplete,
        final boolean stripEmptyScreens) {
    // XXX: Do we need to update LM workspace screens below?
    PropertyValuesHolder alpha = PropertyValuesHolder.ofFloat("alpha", 0f);
    PropertyValuesHolder bgAlpha = PropertyValuesHolder.ofFloat("backgroundAlpha", 0f);

    final CellLayout cl = mWorkspaceScreens.get(EXTRA_EMPTY_SCREEN_ID);

    mRemoveEmptyScreenRunnable = new Runnable() {
        @Override//from w w  w .j a  v  a  2s  .  c o m
        public void run() {
            if (hasExtraEmptyScreen()) {
                mWorkspaceScreens.remove(EXTRA_EMPTY_SCREEN_ID);
                mScreenOrder.remove(EXTRA_EMPTY_SCREEN_ID);
                removeView(cl);
                if (stripEmptyScreens) {
                    stripEmptyScreens();
                }
            }
        }
    };

    ObjectAnimator oa = ObjectAnimator.ofPropertyValuesHolder(cl, alpha, bgAlpha);
    oa.setDuration(duration);
    oa.setStartDelay(delay);
    oa.addListener(new AnimatorListenerAdapter() {
        @Override
        public void onAnimationEnd(Animator animation) {
            if (mRemoveEmptyScreenRunnable != null) {
                mRemoveEmptyScreenRunnable.run();
            }
            if (onComplete != null) {
                onComplete.run();
            }
        }
    });
    oa.start();
}

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

private void growAndFadeOutFolderIcon(FolderIcon fi) {
    if (fi == null)
        return;/*  ww  w.j  a v a  2 s . c o  m*/
    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.ofViewAlphaAndScale(mFolderIconImageView, 0, 1.5f, 1.5f);
    if (Utilities.ATLEAST_LOLLIPOP) {
        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 growAndFadeOutFolderIcon(FolderIcon fi) {
    if (fi == null)
        return;//from ww w.j  a va  2  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);
    if (Utilities.isLmpOrAbove()) {
        oa.setInterpolator(new LogDecelerateInterpolator(100, 0));
    }
    oa.setDuration(getResources().getInteger(R.integer.config_folderExpandDuration));
    oa.start();
}

From source file:com.phonemetra.turbo.launcher.Workspace.java

private void fadeAndRemoveEmptyScreen(int delay, int duration, final Runnable onComplete,
        final boolean stripEmptyScreens) {

    PropertyValuesHolder alpha = PropertyValuesHolder.ofFloat("alpha", 0f);
    PropertyValuesHolder bgAlpha = PropertyValuesHolder.ofFloat("backgroundAlpha", 0f);

    final CellLayout cl = mWorkspaceScreens.get(EXTRA_EMPTY_SCREEN_ID);

    mRemoveEmptyScreenRunnable = new Runnable() {
        @Override// w  w  w  . j  av  a  2 s. c o  m
        public void run() {
            if (hasExtraEmptyScreen()) {
                mWorkspaceScreens.remove(EXTRA_EMPTY_SCREEN_ID);
                mScreenOrder.remove(EXTRA_EMPTY_SCREEN_ID);
                removeView(cl);
                if (stripEmptyScreens) {
                    stripEmptyScreens();
                }
            }
        }
    };

    ObjectAnimator oa = ObjectAnimator.ofPropertyValuesHolder(cl, alpha, bgAlpha);
    oa.setDuration(duration);
    oa.setStartDelay(delay);
    oa.addListener(new AnimatorListenerAdapter() {
        @Override
        public void onAnimationEnd(Animator animation) {
            if (mRemoveEmptyScreenRunnable != null) {
                mRemoveEmptyScreenRunnable.run();
            }
            if (onComplete != null) {
                onComplete.run();
            }
        }
    });
    oa.start();
}

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

private void growAndFadeOutFolderIcon(FolderIcon fi) {
    if (fi == null)
        return;/* w  w  w . jav  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.ATLEAST_LOLLIPOP) {
        oa.setInterpolator(new LogDecelerateInterpolator(100, 0));
    }
    oa.setDuration(getResources().getInteger(R.integer.config_folderExpandDuration));
    oa.start();
}

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

private void shrinkAndFadeInFolderIcon(final FolderIcon fi, boolean animate) {
    if (fi == null)
        return;//from   ww  w  .  ja  v  a2s  .  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:com.klinker.android.launcher.launcher3.Launcher.java

private void shrinkAndFadeInFolderIcon(final FolderIcon fi) {
    if (fi == null)
        return;/*  w w w.ja  v  a 2  s .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_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:com.android.launcher3.Workspace.java

private void fadeAndRemoveEmptyScreen(int delay, int duration, final Runnable onComplete,
        final boolean stripEmptyScreens) {
    // Log to disk
    // XXX: Do we need to update LM workspace screens below?
    Launcher.addDumpLog(TAG, "11683562 - fadeAndRemoveEmptyScreen()", true);
    PropertyValuesHolder alpha = PropertyValuesHolder.ofFloat("alpha", 0f);
    PropertyValuesHolder bgAlpha = PropertyValuesHolder.ofFloat("backgroundAlpha", 0f);

    final CellLayout cl = mWorkspaceScreens.get(EXTRA_EMPTY_SCREEN_ID);

    mRemoveEmptyScreenRunnable = new Runnable() {
        @Override//  ww w.  j  av a 2  s . co m
        public void run() {
            if (hasExtraEmptyScreen()) {
                mWorkspaceScreens.remove(EXTRA_EMPTY_SCREEN_ID);
                mScreenOrder.remove(EXTRA_EMPTY_SCREEN_ID);
                removeView(cl);
                if (stripEmptyScreens) {
                    stripEmptyScreens();
                }
            }
        }
    };

    ObjectAnimator oa = ObjectAnimator.ofPropertyValuesHolder(cl, alpha, bgAlpha);
    oa.setDuration(duration);
    oa.setStartDelay(delay);
    oa.addListener(new AnimatorListenerAdapter() {
        @Override
        public void onAnimationEnd(Animator animation) {
            if (mRemoveEmptyScreenRunnable != null) {
                mRemoveEmptyScreenRunnable.run();
            }
            if (onComplete != null) {
                onComplete.run();
            }
        }
    });
    oa.start();
}