Merge "Additional Logging." into jb-ub-gel-agar
diff --git a/res/layout/overview_panel.xml b/res/layout/overview_panel.xml
index 713adea..e05adf2 100644
--- a/res/layout/overview_panel.xml
+++ b/res/layout/overview_panel.xml
@@ -36,4 +36,13 @@
         android:layout_height="wrap_content"
         android:text="@string/wallpaper_button_text"
         android:textSize="18dp" />
+    <Space
+        android:layout_width="@dimen/overview_panel_buttonSpacing"
+        android:layout_height="wrap_content"/>
+    <TextView
+        android:id="@+id/settings_button"
+        android:layout_width="wrap_content"
+        android:layout_height="wrap_content"
+        android:text="@string/settings_button_text"
+        android:textSize="18dp" />
 </LinearLayout>
diff --git a/res/values/strings.xml b/res/values/strings.xml
index 7b97889..b860d42 100644
--- a/res/values/strings.xml
+++ b/res/values/strings.xml
@@ -289,4 +289,6 @@
     <string name="widget_button_text">Add Widget</string>
     <!-- Text for wallpaper change button -->
     <string name="wallpaper_button_text">Wallpaper</string>
+    <!-- Text for settings button -->
+    <string name="settings_button_text">Settings</string>
 </resources>
diff --git a/src/com/android/launcher3/Launcher.java b/src/com/android/launcher3/Launcher.java
index 35e166f..509560c 100644
--- a/src/com/android/launcher3/Launcher.java
+++ b/src/com/android/launcher3/Launcher.java
@@ -919,6 +919,12 @@
 
         // 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() {
     }
 
     public interface QSBScroller {
@@ -1123,6 +1129,12 @@
                 startWallpaper();
             }
         });
+        findViewById(R.id.settings_button).setOnClickListener(new OnClickListener() {
+            @Override
+            public void onClick(View arg0) {
+                startSettings();
+            }
+        });
 
         // Setup the workspace
         mWorkspace.setHapticFeedbackEnabled(false);
diff --git a/src/com/android/launcher3/Workspace.java b/src/com/android/launcher3/Workspace.java
index b6ef27d..339f0ab 100644
--- a/src/com/android/launcher3/Workspace.java
+++ b/src/com/android/launcher3/Workspace.java
@@ -134,6 +134,7 @@
 
     CustomContentCallbacks mCustomContentCallbacks;
     boolean mCustomContentShowing;
+    private float mLastCustomContentScrollProgress = -1f;
 
     /**
      * The CellLayout that is currently being dragged over
@@ -1258,6 +1259,9 @@
                     (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 @@
                 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 @@
                     pi.setVisibility(VISIBLE);
                 }
             }
+
+            if (mCustomContentCallbacks != null) {
+                mCustomContentCallbacks.onScrollProgressChanged(progress);
+            }
         }
     }