Fix 3493373: back button displays blue homescreen borders

When the back button has no other function, briefly turn on
the page borders to give the user some feedback on the button
press.

Change-Id: I31cd4391821b646dffe4e8146fbffd72d934a00f
diff --git a/src/com/android/launcher2/Launcher.java b/src/com/android/launcher2/Launcher.java
index 261569e..3cd65b1 100644
--- a/src/com/android/launcher2/Launcher.java
+++ b/src/com/android/launcher2/Launcher.java
@@ -251,6 +251,7 @@
 
     private static HashMap<Long, FolderInfo> sFolders = new HashMap<Long, FolderInfo>();
 
+    // The "signpost" images along the bottom of the screen (only in some layouts)
     private ImageView mPreviousView;
     private ImageView mNextView;
 
@@ -1682,6 +1683,12 @@
         return mWorkspaceLoading || mWaitingForResult;
     }
 
+    // Is the workspace preview (brought up by long-pressing on a signpost icon) visible?
+    private boolean isPreviewVisible() {
+        return (mPreviousView != null && mPreviousView.getTag() != null) ||
+                (mNextView != null && mNextView.getTag() != null);
+    }
+
     private void addItems() {
         if (LauncherApplication.isScreenXLarge()) {
             // Animate the widget chooser up from the bottom of the screen
@@ -1975,13 +1982,14 @@
     public void onBackPressed() {
         if (mState == State.ALL_APPS || mState == State.CUSTOMIZE) {
             showWorkspace(true);
-        } else {
+        } else if (mWorkspace.getOpenFolder() != null) {
             closeFolder();
-        }
-        // Some launcher layouts don't have a previous and next view
-        if (mPreviousView != null) {
+        } else if (isPreviewVisible()) {
             dismissPreview(mPreviousView);
             dismissPreview(mNextView);
+        } else {
+            // Back button is a no-op here, but give at least some feedback for the button press
+            mWorkspace.showOutlinesTemporarily();
         }
     }