diff options
Diffstat (limited to 'src/com/android/launcher3/Launcher.java')
-rw-r--r-- | src/com/android/launcher3/Launcher.java | 47 |
1 files changed, 46 insertions, 1 deletions
diff --git a/src/com/android/launcher3/Launcher.java b/src/com/android/launcher3/Launcher.java index 5d857ce8c..be39e522c 100644 --- a/src/com/android/launcher3/Launcher.java +++ b/src/com/android/launcher3/Launcher.java @@ -19,6 +19,7 @@ package com.android.launcher3; import android.animation.Animator; import android.animation.AnimatorListenerAdapter; import android.animation.AnimatorSet; +import android.animation.ArgbEvaluator; import android.animation.ObjectAnimator; import android.animation.PropertyValuesHolder; import android.animation.TimeInterpolator; @@ -59,6 +60,7 @@ import android.graphics.Color; import android.graphics.Point; import android.graphics.PorterDuff; import android.graphics.Rect; +import android.graphics.drawable.ColorDrawable; import android.graphics.drawable.Drawable; import android.net.Uri; import android.os.AsyncTask; @@ -1724,6 +1726,17 @@ public class Launcher extends Activity } mAppDrawer.setHasFixedSize(true); mAppDrawer.setAdapter(mAppDrawerAdapter); + mAppDrawer.setOnScrollListener(new RecyclerView.OnScrollListener() { + @Override + public void onScrollStateChanged(RecyclerView recyclerView, int newState) { + mAppDrawerAdapter.onScrollStateChanged(recyclerView, newState); + } + + @Override + public void onScrolled(RecyclerView recyclerView, int dx, int dy) { + mAppDrawerAdapter.onScrolled(recyclerView, dx, dy); + } + }); initializeScrubber(); } } @@ -3645,7 +3658,7 @@ public class Launcher extends Activity } boolean material = Utilities.isLmpOrAbove(); - boolean drawer = mDrawerType == AppDrawerListAdapter.DrawerType.Drawer; + final boolean drawer = mDrawerType == AppDrawerListAdapter.DrawerType.Drawer; final Resources res = getResources(); final int duration = res.getInteger(R.integer.config_appsCustomizeZoomInTime); @@ -3828,6 +3841,14 @@ public class Launcher extends Activity mStateAnimation.addListener(new AnimatorListenerAdapter() { @Override + public void onAnimationStart(Animator animation) { + if (drawer && mAppsCustomizeContent.getContentType() + == AppsCustomizePagedView.ContentType.Applications) { + updateStatusBarColor(res.getColor(R.color.app_drawer_drag_background)); + } + } + + @Override public void onAnimationEnd(Animator animation) { dispatchOnLauncherTransitionEnd(fromView, animated, false); dispatchOnLauncherTransitionEnd(toView, animated, false); @@ -3893,6 +3914,11 @@ public class Launcher extends Activity toView.setScaleY(1.0f); toView.setVisibility(View.VISIBLE); toView.bringToFront(); + if (drawer && mAppsCustomizeContent.getContentType() + == AppsCustomizePagedView.ContentType.Applications) { + updateStatusBarColor(res.getColor(R.color.app_drawer_drag_background)); + toView.setBackgroundColor(res.getColor(R.color.app_drawer_background)); + } if (!springLoaded && !LauncherAppState.getInstance().isScreenLarge()) { // Hide the search bar @@ -4012,6 +4038,7 @@ public class Launcher extends Activity content.setPageBackgroundsVisible(false); } else { fromView.setBackgroundColor(Color.TRANSPARENT); + updateStatusBarColor(Color.TRANSPARENT); } final View allAppsButton = getAllAppsButton(); @@ -4201,6 +4228,11 @@ public class Launcher extends Activity fromView.post(startAnimRunnable); } else { fromView.setVisibility(View.GONE); + if (drawer && mAppsCustomizeContent.getContentType() + == AppsCustomizePagedView.ContentType.Applications) { + fromView.setBackgroundColor(Color.TRANSPARENT); + updateStatusBarColor(Color.TRANSPARENT, 0); + } dispatchOnLauncherTransitionPrepare(fromView, animated, true); dispatchOnLauncherTransitionStart(fromView, animated, true); dispatchOnLauncherTransitionEnd(fromView, animated, true); @@ -5591,6 +5623,19 @@ public class Launcher extends Activity if (mSearchDropTargetBar != null) mSearchDropTargetBar.showSearchBar(false); } + private void updateStatusBarColor(int color) { + updateStatusBarColor(color, 300); + } + + private void updateStatusBarColor(int color, int duration) { + final Window window = getWindow(); + ObjectAnimator animator = ObjectAnimator.ofInt(window, + "statusBarColor", window.getStatusBarColor(), color); + animator.setEvaluator(new ArgbEvaluator()); + animator.setDuration(duration); + animator.start(); + } + public ItemInfo createAppDragInfo(Intent appLaunchIntent) { // Called from search suggestion, not supported in other profiles. final UserHandleCompat myUser = UserHandleCompat.myUserHandle(); |