OSDN Git Service

Fixing issue with flash during overview transition.
authorWinson Chung <winsonc@google.com>
Fri, 31 Jul 2015 19:39:57 +0000 (12:39 -0700)
committerWinson Chung <winsonc@google.com>
Fri, 31 Jul 2015 19:59:11 +0000 (12:59 -0700)
- This is due to the TransitionDrawable which does not actually
  start an animation until it is first drawn.  This workaround
  will just immediately reset the transition if it is not currently
  visible instead of animating (which is actually deferred until
  the next animation into overview mode).

Bug: 22414257
Change-Id: Id481303d0c99a20c1d16396c024ab50303f45576

src/com/android/launcher3/CellLayout.java

index 8096887..b875d22 100644 (file)
@@ -211,6 +211,7 @@ public class CellLayout extends ViewGroup implements BubbleTextShadowHandler {
 
         mBackground = (TransitionDrawable) res.getDrawable(R.drawable.bg_screenpanel);
         mBackground.setCallback(this);
+        mBackground.setAlpha((int) (mBackgroundAlpha * 255));
 
         mReorderPreviewAnimationMagnitude = (REORDER_PREVIEW_MAGNITUDE *
                 grid.iconSizePx);
@@ -414,7 +415,11 @@ public class CellLayout extends ViewGroup implements BubbleTextShadowHandler {
             if (mIsDragOverlapping) {
                 mBackground.startTransition(BACKGROUND_ACTIVATE_DURATION);
             } else {
-                mBackground.reverseTransition(BACKGROUND_ACTIVATE_DURATION);
+                if (mBackgroundAlpha > 0f) {
+                    mBackground.reverseTransition(BACKGROUND_ACTIVATE_DURATION);
+                } else {
+                    mBackground.resetTransition();
+                }
             }
             invalidate();
         }