OSDN Git Service

Making current screen background always transparent
authorAdam Cohen <adamcohen@google.com>
Thu, 11 Nov 2010 00:32:54 +0000 (16:32 -0800)
committerAdam Cohen <adamcohen@google.com>
Thu, 11 Nov 2010 21:39:35 +0000 (13:39 -0800)
Change-Id: I3cc61f85c36f80a71d60228f5f8570758b1b0e3b

src/com/android/launcher2/CellLayout.java
src/com/android/launcher2/Workspace.java

index 11c0c18..63871a7 100644 (file)
@@ -839,6 +839,10 @@ public class CellLayout extends ViewGroup implements Dimmable {
         mBackgroundAlphaMultiplier = multiplier;
     }
 
+    public float getBackgroundAlphaMultiplier() {
+        return mBackgroundAlphaMultiplier;
+    }
+
     public void setBackgroundAlpha(float alpha) {
         mBackgroundAlpha = alpha;
         invalidate();
index e068a76..393c65b 100644 (file)
@@ -558,12 +558,11 @@ public class Workspace extends SmoothPagedView
                 int delta = screenCenter - (getChildOffset(i) -
                         getRelativeChildOffset(i) + halfScreenSize);
 
-                float scrollProgress = delta/(totalDistance*1.0f);
+                float scrollProgress = delta / (totalDistance * 1.0f);
                 scrollProgress = Math.min(scrollProgress, 1.0f);
                 scrollProgress = Math.max(scrollProgress, -1.0f);
 
-                float mult =  mInDragMode ? 1.0f : Math.abs(scrollProgress);
-                cl.setBackgroundAlphaMultiplier(mult);
+                cl.setBackgroundAlphaMultiplier(Math.abs(scrollProgress));
 
                 float rotation = WORKSPACE_ROTATION * scrollProgress;
                 cl.setRotationY(rotation);
@@ -779,6 +778,9 @@ public class Workspace extends SmoothPagedView
         mActivePointerId = INVALID_POINTER;
 
         CellLayout currentPage = (CellLayout) getChildAt(mCurrentPage);
+        if (currentPage.getBackgroundAlphaMultiplier() < 1.0f) {
+            currentPage.setBackgroundAlpha(0.0f);
+        }
         currentPage.setBackgroundAlphaMultiplier(1.0f);
 
         final Resources res = getResources();
@@ -1351,8 +1353,6 @@ public class Workspace extends SmoothPagedView
             mDragTargetLayout.onDragEnter();
             showOutlines();
             mInDragMode = true;
-            CellLayout cl = (CellLayout) getChildAt(mCurrentPage);
-            cl.setBackgroundAlphaMultiplier(1.0f);
         }
     }