Bug 976176 - Clear animations before trying to hide home banner on pre-honeycomb devices. r=lucsar
authorMargaret Leibovic <margaret.leibovic@gmail.com>
Tue, 25 Feb 2014 09:40:56 -0800
changeset 170891 7ab155a7aa6767b9a0e047d0b08e27ed946ddebe
parent 170890 95ff5102419c0e9f741a0792c9b0d0205e93b8f8
child 170892 4f3ea4de80fccd03966b3798ddc804c8e0dbf34e
push id270
push userpvanderbeken@mozilla.com
push dateThu, 06 Mar 2014 09:24:21 +0000
reviewerslucsar
bugs976176
milestone30.0a1
Bug 976176 - Clear animations before trying to hide home banner on pre-honeycomb devices. r=lucsar
mobile/android/base/home/HomeBanner.java
--- a/mobile/android/base/home/HomeBanner.java
+++ b/mobile/android/base/home/HomeBanner.java
@@ -14,16 +14,17 @@ import org.mozilla.gecko.animation.Prope
 import org.mozilla.gecko.animation.PropertyAnimator.Property;
 import org.mozilla.gecko.animation.ViewHelper;
 import org.mozilla.gecko.gfx.BitmapUtils;
 import org.mozilla.gecko.util.GeckoEventListener;
 import org.mozilla.gecko.util.ThreadUtils;
 
 import android.content.Context;
 import android.graphics.drawable.Drawable;
+import android.os.Build;
 import android.text.Html;
 import android.text.Spanned;
 import android.text.TextUtils;
 import android.util.AttributeSet;
 import android.util.Log;
 import android.view.LayoutInflater;
 import android.view.MotionEvent;
 import android.view.View;
@@ -100,21 +101,32 @@ public class HomeBanner extends LinearLa
         GeckoAppShell.sendEventToGecko(GeckoEvent.createBroadcastEvent("HomeBanner:Get", null));
     }
 
     @Override
     public void onDetachedFromWindow() {
         super.onDetachedFromWindow();
 
         GeckoAppShell.getEventDispatcher().unregisterEventListener("HomeBanner:Data", this);
-     }
+    }
 
-     public void setScrollingPages(boolean scrollingPages) {
-         mScrollingPages = scrollingPages;
-     }
+    @Override
+    public void setVisibility(int visibility) {
+        // On pre-Honeycomb devices, setting the visibility to GONE won't actually
+        // hide the view unless we clear animations first.
+        if (Build.VERSION.SDK_INT < 11 && visibility == View.GONE) {
+            clearAnimation();
+        }
+
+        super.setVisibility(visibility);
+    }
+
+    public void setScrollingPages(boolean scrollingPages) {
+        mScrollingPages = scrollingPages;
+    }
 
     @Override
     public void handleMessage(String event, JSONObject message) {
         try {
             // Store the current message id to pass back to JS in the view's OnClickListener.
             setTag(message.getString("id"));
 
             // Display styled text from an HTML string.