summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/com/android/launcher3/Launcher.java3
-rw-r--r--src/com/android/launcher3/Workspace.java9
2 files changed, 12 insertions, 0 deletions
diff --git a/src/com/android/launcher3/Launcher.java b/src/com/android/launcher3/Launcher.java
index 7970b71be..509560c74 100644
--- a/src/com/android/launcher3/Launcher.java
+++ b/src/com/android/launcher3/Launcher.java
@@ -919,6 +919,9 @@ public class Launcher extends Activity
// Custom content is completely hidden
public void onHide();
+
+ // Custom content scroll progress changed. From 0 (not showing) to 1 (fully showing).
+ public void onScrollProgressChanged(float progress);
}
protected void startSettings() {
diff --git a/src/com/android/launcher3/Workspace.java b/src/com/android/launcher3/Workspace.java
index b6ef27d6d..339f0abe6 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
@@ -1258,6 +1259,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) {
@@ -1271,6 +1275,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();
@@ -1281,6 +1286,10 @@ public class Workspace extends SmoothPagedView
pi.setVisibility(VISIBLE);
}
}
+
+ if (mCustomContentCallbacks != null) {
+ mCustomContentCallbacks.onScrollProgressChanged(progress);
+ }
}
}