List of usage examples for android.view ViewAnimationUtils createCircularReveal
public static Animator createCircularReveal(View view, int centerX, int centerY, float startRadius, float endRadius)
From source file:com.stanleyidesis.quotograph.ui.activity.LWQSettingsActivity.java
Animator animateFABActions(final boolean dismiss) { fabBackground.setVisibility(View.VISIBLE); Animator backgroundAnimator;/*from w w w . j a v a 2 s. c o m*/ if (Build.VERSION.SDK_INT >= 21) { Rect fabRect = new Rect(); fabAdd.getGlobalVisibleRect(fabRect); final Point realScreenSize = UIUtils.getRealScreenSize(); int radius = Math.max(realScreenSize.x, realScreenSize.y); backgroundAnimator = ViewAnimationUtils.createCircularReveal(fabBackground, fabRect.centerX(), fabRect.centerY(), dismiss ? radius : 0, dismiss ? 0 : radius); } else { backgroundAnimator = ObjectAnimator.ofFloat(fabBackground, "alpha", dismiss ? 1f : 0f, dismiss ? 0f : 1f); } backgroundAnimator.setDuration(300).setInterpolator(new AccelerateDecelerateInterpolator()); backgroundAnimator.addListener(new AnimatorListenerAdapter() { @Override public void onAnimationEnd(Animator animation) { if (dismiss) { fabBackground.setVisibility(View.GONE); // Tell them to swipe again for settings! showTutorialTip(TutorialTooltips.SWIPE_AGAIN); } else { // Tell them about search! showTutorialTip(TutorialTooltips.SEARCH); } } }); final long shortDelay = 50; final long longDelay = 100; final Animator createAnimator = animateFAB(fabCreate, dismiss); final Animator searchAnimator = animateFAB(fabSearch, dismiss); createAnimator.setStartDelay(dismiss ? longDelay : shortDelay); searchAnimator.setStartDelay(dismiss ? shortDelay : longDelay); AnimatorSet allAnimations = new AnimatorSet(); allAnimations.playTogether(backgroundAnimator, createAnimator, searchAnimator); return allAnimations; }
From source file:com.android.leanlauncher.LauncherTransitionable.java
private void showAppsCustomizeHelper(final boolean animated, final boolean springLoaded, final AppsCustomizePagedView.ContentType contentType) { if (mStateAnimation != null) { mStateAnimation.setDuration(0);//from w ww .jav a 2 s .c o m mStateAnimation.cancel(); mStateAnimation = null; } boolean material = Utilities.isLmpOrAbove(); final Resources res = getResources(); final int revealDuration = res.getInteger(R.integer.config_appsCustomizeRevealTime); final int itemsAlphaStagger = res.getInteger(R.integer.config_appsCustomizeItemsAlphaStagger); final View fromView = mWorkspace; final AppsCustomizeTabHost toView = mAppsCustomizeTabHost; final ArrayList<View> layerViews = new ArrayList<View>(); Workspace.State workspaceState = contentType == AppsCustomizePagedView.ContentType.Widgets ? Workspace.State.OVERVIEW_HIDDEN : Workspace.State.NORMAL_HIDDEN; Animator workspaceAnim = mWorkspace.getChangeStateAnimation(workspaceState, animated, layerViews); // Set the content type for the all apps/widgets space mAppsCustomizeTabHost.setContentTypeImmediate(contentType); // If for some reason our views aren't initialized, don't animate boolean initialized = getAllAppsButton() != null; if (animated && initialized) { mStateAnimation = LauncherAnimUtils.createAnimatorSet(); final AppsCustomizePagedView content = (AppsCustomizePagedView) toView .findViewById(R.id.apps_customize_pane_content); final View page = content.getPageAt(content.getCurrentPage()); final View revealView = toView.findViewById(R.id.fake_page); final boolean isWidgetTray = contentType == AppsCustomizePagedView.ContentType.Widgets; revealView.setBackgroundColor(getResources().getColor(R.color.widget_text_panel)); // Hide the real page background, and swap in the fake one content.setPageBackgroundsVisible(false); revealView.setVisibility(View.VISIBLE); // We need to hide this view as the animation start will be posted. revealView.setAlpha(0); int width = revealView.getMeasuredWidth(); int height = revealView.getMeasuredHeight(); float revealRadius = (float) Math.sqrt((width * width) / 4 + (height * height) / 4); revealView.setTranslationY(0); revealView.setTranslationX(0); // Get the y delta between the center of the page and the center of the all apps button int[] allAppsToPanelDelta = Utilities.getCenterDeltaInScreenSpace(revealView, getAllAppsButton(), null); float alpha = 0; float xDrift = 0; float yDrift = 0; if (material) { alpha = isWidgetTray ? 0.3f : 1f; yDrift = isWidgetTray ? height / 2 : allAppsToPanelDelta[1]; xDrift = isWidgetTray ? 0 : allAppsToPanelDelta[0]; } else { yDrift = 2 * height / 3; xDrift = 0; } final float initAlpha = alpha; revealView.setLayerType(View.LAYER_TYPE_HARDWARE, null); layerViews.add(revealView); PropertyValuesHolder panelAlpha = PropertyValuesHolder.ofFloat("alpha", initAlpha, 1f); PropertyValuesHolder panelDriftY = PropertyValuesHolder.ofFloat("translationY", yDrift, 0); PropertyValuesHolder panelDriftX = PropertyValuesHolder.ofFloat("translationX", xDrift, 0); ObjectAnimator panelAlphaAndDrift = ObjectAnimator.ofPropertyValuesHolder(revealView, panelAlpha, panelDriftY, panelDriftX); panelAlphaAndDrift.setDuration(revealDuration); panelAlphaAndDrift.setInterpolator(new LogDecelerateInterpolator(100, 0)); mStateAnimation.play(panelAlphaAndDrift); if (page != null) { page.setVisibility(View.VISIBLE); page.setLayerType(View.LAYER_TYPE_HARDWARE, null); layerViews.add(page); ObjectAnimator pageDrift = ObjectAnimator.ofFloat(page, "translationY", yDrift, 0); page.setTranslationY(yDrift); pageDrift.setDuration(revealDuration); pageDrift.setInterpolator(new LogDecelerateInterpolator(100, 0)); pageDrift.setStartDelay(itemsAlphaStagger); mStateAnimation.play(pageDrift); page.setAlpha(0f); ObjectAnimator itemsAlpha = ObjectAnimator.ofFloat(page, "alpha", 0f, 1f); itemsAlpha.setDuration(revealDuration); itemsAlpha.setInterpolator(new AccelerateInterpolator(1.5f)); itemsAlpha.setStartDelay(itemsAlphaStagger); mStateAnimation.play(itemsAlpha); } View pageIndicators = toView.findViewById(R.id.apps_customize_page_indicator); pageIndicators.setAlpha(0.01f); ObjectAnimator indicatorsAlpha = ObjectAnimator.ofFloat(pageIndicators, "alpha", 1f); indicatorsAlpha.setDuration(revealDuration); mStateAnimation.play(indicatorsAlpha); if (material) { final View allApps = getAllAppsButton(); int allAppsButtonSize = LauncherAppState.getInstance().getDynamicGrid() .getDeviceProfile().allAppsButtonVisualSize; float startRadius = isWidgetTray ? 0 : allAppsButtonSize / 2; Animator reveal = ViewAnimationUtils.createCircularReveal(revealView, width / 2, height / 2, startRadius, revealRadius); reveal.setDuration(revealDuration); reveal.setInterpolator(new LogDecelerateInterpolator(100, 0)); reveal.addListener(new AnimatorListenerAdapter() { public void onAnimationStart(Animator animation) { if (!isWidgetTray) { allApps.setVisibility(View.INVISIBLE); } } public void onAnimationEnd(Animator animation) { if (!isWidgetTray) { allApps.setVisibility(View.VISIBLE); } } }); mStateAnimation.play(reveal); } mStateAnimation.addListener(new AnimatorListenerAdapter() { @Override public void onAnimationEnd(Animator animation) { dispatchOnLauncherTransitionEnd(fromView, animated, false); dispatchOnLauncherTransitionEnd(toView, animated, false); revealView.setVisibility(View.INVISIBLE); revealView.setLayerType(View.LAYER_TYPE_NONE, null); if (page != null) { page.setLayerType(View.LAYER_TYPE_NONE, null); } content.setPageBackgroundsVisible(true); // This can hold unnecessary references to views. mStateAnimation = null; } }); if (workspaceAnim != null) { mStateAnimation.play(workspaceAnim); } dispatchOnLauncherTransitionPrepare(fromView, animated, false); dispatchOnLauncherTransitionPrepare(toView, animated, false); final AnimatorSet stateAnimation = mStateAnimation; final Runnable startAnimRunnable = new Runnable() { public void run() { // Check that mStateAnimation hasn't changed while // we waited for a layout/draw pass if (mStateAnimation != stateAnimation) return; dispatchOnLauncherTransitionStart(fromView, animated, false); dispatchOnLauncherTransitionStart(toView, animated, false); revealView.setAlpha(initAlpha); if (Utilities.isLmpOrAbove()) { for (int i = 0; i < layerViews.size(); i++) { View v = layerViews.get(i); if (v != null) { if (Utilities.isViewAttachedToWindow(v)) v.buildLayer(); } } } mStateAnimation.start(); } }; toView.bringToFront(); toView.setVisibility(View.VISIBLE); toView.post(startAnimRunnable); } else { toView.setTranslationX(0.0f); toView.setTranslationY(0.0f); toView.setScaleX(1.0f); toView.setScaleY(1.0f); toView.setVisibility(View.VISIBLE); toView.bringToFront(); dispatchOnLauncherTransitionPrepare(fromView, animated, false); dispatchOnLauncherTransitionStart(fromView, animated, false); dispatchOnLauncherTransitionEnd(fromView, animated, false); dispatchOnLauncherTransitionPrepare(toView, animated, false); dispatchOnLauncherTransitionStart(toView, animated, false); dispatchOnLauncherTransitionEnd(toView, animated, false); } }
From source file:org.awesomeapp.messenger.ui.ConversationView.java
private void toggleAttachMenu() { if (mViewAttach.getVisibility() == View.INVISIBLE) { if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) { // get the center for the clipping circle int cx = mViewAttach.getLeft(); int cy = mViewAttach.getHeight(); // get the final radius for the clipping circle float finalRadius = (float) Math.hypot(cx, cy); // create the animator for this view (the start radius is zero) Animator anim = ViewAnimationUtils.createCircularReveal(mViewAttach, cx, cy, 0, finalRadius); // make the view visible and start the animation mViewAttach.setVisibility(View.VISIBLE); anim.start();// ww w .j a v a2s.co m } else { mViewAttach.setVisibility(View.VISIBLE); } // Check if no view has focus: View view = mActivity.getCurrentFocus(); if (view != null) { InputMethodManager imm = (InputMethodManager) mActivity .getSystemService(Context.INPUT_METHOD_SERVICE); imm.hideSoftInputFromWindow(view.getWindowToken(), 0); } } else { if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) { // get the center for the clipping circle int cx = mViewAttach.getLeft(); int cy = mViewAttach.getHeight(); // get the initial radius for the clipping circle float initialRadius = (float) Math.hypot(cx, cy); // create the animation (the final radius is zero) Animator anim = ViewAnimationUtils.createCircularReveal(mViewAttach, cx, cy, initialRadius, 0); // make the view invisible when the animation is done anim.addListener(new AnimatorListenerAdapter() { @Override public void onAnimationEnd(Animator animation) { super.onAnimationEnd(animation); mViewAttach.setVisibility(View.INVISIBLE); } }); // start the animation anim.start(); } else { mViewAttach.setVisibility(View.INVISIBLE); } } if (mStickerBox != null) mStickerBox.setVisibility(View.GONE); }
From source file:org.telegram.ui.Components.ChatAttachAlert.java
@SuppressLint("NewApi") private void startRevealAnimation(final boolean open) { containerView.setTranslationY(0);/* w w w. j av a2 s . co m*/ final AnimatorSet animatorSet = new AnimatorSet(); View view = delegate.getRevealView(); if (view.getVisibility() == View.VISIBLE && ((ViewGroup) view.getParent()).getVisibility() == View.VISIBLE) { final int coords[] = new int[2]; view.getLocationInWindow(coords); float top; if (Build.VERSION.SDK_INT <= 19) { top = AndroidUtilities.displaySize.y - containerView.getMeasuredHeight() - AndroidUtilities.statusBarHeight; } else { top = containerView.getY(); } revealX = coords[0] + view.getMeasuredWidth() / 2; revealY = (int) (coords[1] + view.getMeasuredHeight() / 2 - top); if (Build.VERSION.SDK_INT <= 19) { revealY -= AndroidUtilities.statusBarHeight; } } else { revealX = AndroidUtilities.displaySize.x / 2 + backgroundPaddingLeft; revealY = (int) (AndroidUtilities.displaySize.y - containerView.getY()); } int corners[][] = new int[][] { { 0, 0 }, { 0, AndroidUtilities.dp(304) }, { containerView.getMeasuredWidth(), 0 }, { containerView.getMeasuredWidth(), AndroidUtilities.dp(304) } }; int finalRevealRadius = 0; int y = revealY - scrollOffsetY + backgroundPaddingTop; for (int a = 0; a < 4; a++) { finalRevealRadius = Math.max(finalRevealRadius, (int) Math.ceil(Math.sqrt((revealX - corners[a][0]) * (revealX - corners[a][0]) + (y - corners[a][1]) * (y - corners[a][1])))); } int finalRevealX = revealX <= containerView.getMeasuredWidth() ? revealX : containerView.getMeasuredWidth(); ArrayList<Animator> animators = new ArrayList<>(3); animators.add(ObjectAnimator.ofFloat(this, "revealRadius", open ? 0 : finalRevealRadius, open ? finalRevealRadius : 0)); animators.add(ObjectAnimator.ofInt(backDrawable, "alpha", open ? 51 : 0)); if (Build.VERSION.SDK_INT >= 21) { try { animators.add(ViewAnimationUtils.createCircularReveal(containerView, finalRevealX, revealY, open ? 0 : finalRevealRadius, open ? finalRevealRadius : 0)); } catch (Exception e) { FileLog.e("tmessages", e); } animatorSet.setDuration(320); } else { if (!open) { animatorSet.setDuration(200); containerView.setPivotX( revealX <= containerView.getMeasuredWidth() ? revealX : containerView.getMeasuredWidth()); containerView.setPivotY(revealY); animators.add(ObjectAnimator.ofFloat(containerView, "scaleX", 0.0f)); animators.add(ObjectAnimator.ofFloat(containerView, "scaleY", 0.0f)); animators.add(ObjectAnimator.ofFloat(containerView, "alpha", 0.0f)); } else { animatorSet.setDuration(250); containerView.setScaleX(1); containerView.setScaleY(1); containerView.setAlpha(1); if (Build.VERSION.SDK_INT <= 19) { animatorSet.setStartDelay(20); } } } animatorSet.playTogether(animators); animatorSet.addListener(new AnimatorListenerAdapter() { public void onAnimationEnd(Animator animation) { if (currentSheetAnimation != null && currentSheetAnimation.equals(animation)) { currentSheetAnimation = null; onRevealAnimationEnd(open); containerView.invalidate(); containerView.setLayerType(View.LAYER_TYPE_NONE, null); if (!open) { try { dismissInternal(); } catch (Exception e) { FileLog.e("tmessages", e); } } } } @Override public void onAnimationCancel(Animator animation) { if (currentSheetAnimation != null && animatorSet.equals(animation)) { currentSheetAnimation = null; } } }); if (open) { innerAnimators.clear(); NotificationCenter.getInstance() .setAllowedNotificationsDutingAnimation(new int[] { NotificationCenter.dialogsNeedReload }); NotificationCenter.getInstance().setAnimationInProgress(true); revealAnimationInProgress = true; int count = Build.VERSION.SDK_INT <= 19 ? 11 : 8; for (int a = 0; a < count; a++) { if (Build.VERSION.SDK_INT <= 19) { if (a < 8) { views[a].setScaleX(0.1f); views[a].setScaleY(0.1f); } views[a].setAlpha(0.0f); } else { views[a].setScaleX(0.7f); views[a].setScaleY(0.7f); } InnerAnimator innerAnimator = new InnerAnimator(); int buttonX = views[a].getLeft() + views[a].getMeasuredWidth() / 2; int buttonY = views[a].getTop() + attachView.getTop() + views[a].getMeasuredHeight() / 2; float dist = (float) Math.sqrt( (revealX - buttonX) * (revealX - buttonX) + (revealY - buttonY) * (revealY - buttonY)); float vecX = (revealX - buttonX) / dist; float vecY = (revealY - buttonY) / dist; views[a].setPivotX(views[a].getMeasuredWidth() / 2 + vecX * AndroidUtilities.dp(20)); views[a].setPivotY(views[a].getMeasuredHeight() / 2 + vecY * AndroidUtilities.dp(20)); innerAnimator.startRadius = dist - AndroidUtilities.dp(27 * 3); views[a].setTag(R.string.AppName, 1); animators = new ArrayList<>(); final AnimatorSet animatorSetInner; if (a < 8) { animators.add(ObjectAnimator.ofFloat(views[a], "scaleX", 0.7f, 1.05f)); animators.add(ObjectAnimator.ofFloat(views[a], "scaleY", 0.7f, 1.05f)); animatorSetInner = new AnimatorSet(); animatorSetInner.playTogether(ObjectAnimator.ofFloat(views[a], "scaleX", 1.0f), ObjectAnimator.ofFloat(views[a], "scaleY", 1.0f)); animatorSetInner.setDuration(100); animatorSetInner.setInterpolator(decelerateInterpolator); } else { animatorSetInner = null; } if (Build.VERSION.SDK_INT <= 19) { animators.add(ObjectAnimator.ofFloat(views[a], "alpha", 1.0f)); } innerAnimator.animatorSet = new AnimatorSet(); innerAnimator.animatorSet.playTogether(animators); innerAnimator.animatorSet.setDuration(150); innerAnimator.animatorSet.setInterpolator(decelerateInterpolator); innerAnimator.animatorSet.addListener(new AnimatorListenerAdapter() { @Override public void onAnimationEnd(Animator animation) { if (animatorSetInner != null) { animatorSetInner.start(); } } }); innerAnimators.add(innerAnimator); } } currentSheetAnimation = animatorSet; animatorSet.start(); }
From source file:com.ludoscity.findmybikes.activities.NearbyActivity.java
private Animator buildTripDetailsWidgetAnimators(boolean _show, long _duration, float _minRadiusMultiplier) { float minRadiusMultiplier = Math.min(1.f, _minRadiusMultiplier); Animator toReturn = null;/*from www .ja v a 2 s. c om*/ // Use native circular reveal on Android 5.0+ if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) { // Native circular reveal uses coordinates relative to the view int revealStartX = 0; int revealStartY = mTripDetailsWidget.getHeight(); float radiusMax = (float) Math.hypot(mTripDetailsWidget.getHeight(), mTripDetailsWidget.getWidth()); float radiusMin = radiusMax * minRadiusMultiplier; if (_show) { toReturn = ViewAnimationUtils.createCircularReveal(mTripDetailsWidget, revealStartX, revealStartY, radiusMin, radiusMax); } else { toReturn = ViewAnimationUtils.createCircularReveal(mTripDetailsWidget, revealStartX, revealStartY, radiusMax, radiusMin); } toReturn.setDuration(_duration); toReturn.setInterpolator(mCircularRevealInterpolator); } return toReturn; }
From source file:g7.bluesky.launcher3.Launcher.java
private void showAppsCustomizeHelper(final boolean animated, final boolean springLoaded, final AppsCustomizePagedView.ContentType contentType) { if (mStateAnimation != null) { mStateAnimation.setDuration(0);/*from ww w. j a v a2 s . c o m*/ mStateAnimation.cancel(); mStateAnimation = null; } boolean material = Utilities.isLmpOrAbove(); final Resources res = getResources(); final int duration = res.getInteger(R.integer.config_appsCustomizeZoomInTime); final int fadeDuration = res.getInteger(R.integer.config_appsCustomizeFadeInTime); final int revealDuration = res.getInteger(R.integer.config_appsCustomizeRevealTime); final int itemsAlphaStagger = res.getInteger(R.integer.config_appsCustomizeItemsAlphaStagger); final float scale = (float) res.getInteger(R.integer.config_appsCustomizeZoomScaleFactor); final View fromView = mWorkspace; final AppsCustomizeTabHost toView = mAppsCustomizeTabHost; final ArrayList<View> layerViews = new ArrayList<View>(); Workspace.State workspaceState = contentType == AppsCustomizePagedView.ContentType.Widgets ? Workspace.State.OVERVIEW_HIDDEN : Workspace.State.NORMAL_HIDDEN; Animator workspaceAnim = mWorkspace.getChangeStateAnimation(workspaceState, animated, layerViews); if (!LauncherAppState.isDisableAllApps() || contentType == AppsCustomizePagedView.ContentType.Widgets) { // Set the content type for the all apps/widgets space mAppsCustomizeTabHost.setContentTypeImmediate(contentType); } // If for some reason our views aren't initialized, don't animate boolean initialized = getAllAppsButton() != null; if (animated && initialized) { mStateAnimation = LauncherAnimUtils.createAnimatorSet(); final AppsCustomizePagedView content = (AppsCustomizePagedView) toView .findViewById(R.id.apps_customize_pane_content); final View page = content.getPageAt(content.getCurrentPage()); final View revealView = toView.findViewById(R.id.fake_page); final boolean isWidgetTray = contentType == AppsCustomizePagedView.ContentType.Widgets; if (isWidgetTray) { revealView.setBackground(ContextCompat.getDrawable(this, R.drawable.quantum_panel_dark)); } else { revealView.setBackground(currentBgDrawable); } // Hide the real page background, and swap in the fake one content.setPageBackgroundsVisible(false); revealView.setVisibility(View.VISIBLE); // We need to hide this view as the animation start will be posted. revealView.setAlpha(0); int width = revealView.getMeasuredWidth(); int height = revealView.getMeasuredHeight(); float revealRadius = (float) Math.sqrt((width * width) / 4 + (height * height) / 4); revealView.setTranslationY(0); revealView.setTranslationX(0); // Get the y delta between the center of the page and the center of the all apps button int[] allAppsToPanelDelta = Utilities.getCenterDeltaInScreenSpace(revealView, getAllAppsButton(), null); float alpha = 0; float xDrift = 0; float yDrift = 0; if (material) { alpha = isWidgetTray ? 0.3f : 1f; yDrift = isWidgetTray ? height / 2 : allAppsToPanelDelta[1]; xDrift = isWidgetTray ? 0 : allAppsToPanelDelta[0]; } else { yDrift = 2 * height / 3; xDrift = 0; } final float initAlpha = alpha; revealView.setLayerType(View.LAYER_TYPE_HARDWARE, null); layerViews.add(revealView); PropertyValuesHolder panelAlpha = PropertyValuesHolder.ofFloat("alpha", initAlpha, 1f); PropertyValuesHolder panelDriftY = PropertyValuesHolder.ofFloat("translationY", yDrift, 0); PropertyValuesHolder panelDriftX = PropertyValuesHolder.ofFloat("translationX", xDrift, 0); ObjectAnimator panelAlphaAndDrift = ObjectAnimator.ofPropertyValuesHolder(revealView, panelAlpha, panelDriftY, panelDriftX); panelAlphaAndDrift.setDuration(revealDuration); panelAlphaAndDrift.setInterpolator(new LogDecelerateInterpolator(100, 0)); mStateAnimation.play(panelAlphaAndDrift); if (page != null) { page.setVisibility(View.VISIBLE); page.setLayerType(View.LAYER_TYPE_HARDWARE, null); layerViews.add(page); ObjectAnimator pageDrift = ObjectAnimator.ofFloat(page, "translationY", yDrift, 0); page.setTranslationY(yDrift); pageDrift.setDuration(revealDuration); pageDrift.setInterpolator(new LogDecelerateInterpolator(100, 0)); pageDrift.setStartDelay(itemsAlphaStagger); mStateAnimation.play(pageDrift); page.setAlpha(0f); ObjectAnimator itemsAlpha = ObjectAnimator.ofFloat(page, "alpha", 0f, 1f); itemsAlpha.setDuration(revealDuration); itemsAlpha.setInterpolator(new AccelerateInterpolator(1.5f)); itemsAlpha.setStartDelay(itemsAlphaStagger); mStateAnimation.play(itemsAlpha); } View pageIndicators = toView.findViewById(R.id.apps_customize_page_indicator); pageIndicators.setAlpha(0.01f); ObjectAnimator indicatorsAlpha = ObjectAnimator.ofFloat(pageIndicators, "alpha", 1f); indicatorsAlpha.setDuration(revealDuration); mStateAnimation.play(indicatorsAlpha); if (material) { final View allApps = getAllAppsButton(); int allAppsButtonSize = LauncherAppState.getInstance().getDynamicGrid() .getDeviceProfile().allAppsButtonVisualSize; float startRadius = isWidgetTray ? 0 : allAppsButtonSize / 2; Animator reveal = ViewAnimationUtils.createCircularReveal(revealView, width / 2, height / 2, startRadius, revealRadius); reveal.setDuration(revealDuration); reveal.setInterpolator(new LogDecelerateInterpolator(100, 0)); reveal.addListener(new AnimatorListenerAdapter() { public void onAnimationStart(Animator animation) { if (!isWidgetTray) { allApps.setVisibility(View.INVISIBLE); } } public void onAnimationEnd(Animator animation) { if (!isWidgetTray) { allApps.setVisibility(View.VISIBLE); } } }); mStateAnimation.play(reveal); } mStateAnimation.addListener(new AnimatorListenerAdapter() { @Override public void onAnimationEnd(Animator animation) { dispatchOnLauncherTransitionEnd(fromView, animated, false); dispatchOnLauncherTransitionEnd(toView, animated, false); revealView.setVisibility(View.INVISIBLE); revealView.setLayerType(View.LAYER_TYPE_NONE, null); if (page != null) { page.setLayerType(View.LAYER_TYPE_NONE, null); } content.setPageBackgroundsVisible(true); // Hide the search bar if (mSearchDropTargetBar != null) { mSearchDropTargetBar.hideSearchBar(false); } // This can hold unnecessary references to views. mStateAnimation = null; } }); if (workspaceAnim != null) { mStateAnimation.play(workspaceAnim); } dispatchOnLauncherTransitionPrepare(fromView, animated, false); dispatchOnLauncherTransitionPrepare(toView, animated, false); final AnimatorSet stateAnimation = mStateAnimation; final Runnable startAnimRunnable = new Runnable() { public void run() { // Check that mStateAnimation hasn't changed while // we waited for a layout/draw pass if (mStateAnimation != stateAnimation) return; dispatchOnLauncherTransitionStart(fromView, animated, false); dispatchOnLauncherTransitionStart(toView, animated, false); revealView.setAlpha(initAlpha); if (Utilities.isLmpOrAbove()) { for (int i = 0; i < layerViews.size(); i++) { View v = layerViews.get(i); if (v != null) { if (Utilities.isViewAttachedToWindow(v)) v.buildLayer(); } } } mStateAnimation.start(); } }; toView.bringToFront(); toView.setVisibility(View.VISIBLE); toView.post(startAnimRunnable); } else { toView.setTranslationX(0.0f); toView.setTranslationY(0.0f); toView.setScaleX(1.0f); toView.setScaleY(1.0f); toView.setVisibility(View.VISIBLE); toView.bringToFront(); if (!springLoaded && !LauncherAppState.getInstance().isScreenLarge()) { // Hide the search bar if (mSearchDropTargetBar != null) { mSearchDropTargetBar.hideSearchBar(false); } } dispatchOnLauncherTransitionPrepare(fromView, animated, false); dispatchOnLauncherTransitionStart(fromView, animated, false); dispatchOnLauncherTransitionEnd(fromView, animated, false); dispatchOnLauncherTransitionPrepare(toView, animated, false); dispatchOnLauncherTransitionStart(toView, animated, false); dispatchOnLauncherTransitionEnd(toView, animated, false); } }