diff options
author | Adam Cohen <adamcohen@google.com> | 2013-08-29 11:54:42 -0700 |
---|---|---|
committer | Adam Cohen <adamcohen@google.com> | 2013-08-29 11:55:07 -0700 |
commit | c36fa5ce395bd39d16f6a998372700ed53d5d9d6 (patch) | |
tree | 46eff8769a892465c46d1ecc8ce1e7c065c35f47 /src/com/android/launcher3/Workspace.java | |
parent | 4caf298a2c9d861d69f5a47b747ada911b125b6d (diff) | |
download | android_packages_apps_Trebuchet-c36fa5ce395bd39d16f6a998372700ed53d5d9d6.tar.gz android_packages_apps_Trebuchet-c36fa5ce395bd39d16f6a998372700ed53d5d9d6.tar.bz2 android_packages_apps_Trebuchet-c36fa5ce395bd39d16f6a998372700ed53d5d9d6.zip |
Adding custom content scroll progress callback
Change-Id: I23b007f6ac30809c03127f5d9030d8f367694310
Diffstat (limited to 'src/com/android/launcher3/Workspace.java')
-rw-r--r-- | src/com/android/launcher3/Workspace.java | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/src/com/android/launcher3/Workspace.java b/src/com/android/launcher3/Workspace.java index 05f9e2d7f..458c4e712 100644 --- a/src/com/android/launcher3/Workspace.java +++ b/src/com/android/launcher3/Workspace.java @@ -134,6 +134,7 @@ public class Workspace extends SmoothPagedView CustomContentCallbacks mCustomContentCallbacks; boolean mCustomContentShowing; + private float mLastCustomContentScrollProgress = -1f; /** * The CellLayout that is currently being dragged over @@ -1233,6 +1234,9 @@ public class Workspace extends SmoothPagedView (getScrollForPage(index + 1) - getScrollForPage(index)); progress = Math.max(0, progress); + if (Float.compare(progress, mLastCustomContentScrollProgress) == 0) return; + mLastCustomContentScrollProgress = progress; + setBackgroundAlpha(progress * 0.8f); float height = getViewportHeight(); if (getPageIndicator() != null) { @@ -1246,6 +1250,7 @@ public class Workspace extends SmoothPagedView mLauncher.getHotseat().setTranslationY(transY); mLauncher.getHotseat().setAlpha(1 - progress); } + if (getPageIndicator() != null) { final float alpha = 1 - progress; final View pi = getPageIndicator(); @@ -1256,6 +1261,10 @@ public class Workspace extends SmoothPagedView pi.setVisibility(VISIBLE); } } + + if (mCustomContentCallbacks != null) { + mCustomContentCallbacks.onScrollProgressChanged(progress); + } } } |