From c36fa5ce395bd39d16f6a998372700ed53d5d9d6 Mon Sep 17 00:00:00 2001 From: Adam Cohen Date: Thu, 29 Aug 2013 11:54:42 -0700 Subject: Adding custom content scroll progress callback Change-Id: I23b007f6ac30809c03127f5d9030d8f367694310 --- src/com/android/launcher3/Workspace.java | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'src/com/android/launcher3/Workspace.java') 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); + } } } -- cgit v1.2.3