From a97b17db968557676d85560f98fef36909252472 Mon Sep 17 00:00:00 2001 From: Nick Alexander Date: Mon, 26 May 2014 18:12:07 -0700 Subject: [PATCH] Bug 1015974 - Prophylactically stop Sync icon animation on creation. r=rnewman It appears that Android 4.4.2 is a special snow-flake that starts the animation on creation: http://stackoverflow.com/q/21699985. This patch works around that special behaviour. Don't you love when you need to update your comment -- gleaned from working code and documentation -- to account for Android inexplicably changing behaviour? --- mobile/android/base/tabspanel/TabsPanel.java | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/mobile/android/base/tabspanel/TabsPanel.java b/mobile/android/base/tabspanel/TabsPanel.java index 844a58ae1244..26b8315aa093 100644 --- a/mobile/android/base/tabspanel/TabsPanel.java +++ b/mobile/android/base/tabspanel/TabsPanel.java @@ -20,6 +20,7 @@ import org.mozilla.gecko.widget.IconTabWidget; import android.content.Context; import android.content.res.Resources; import android.graphics.Rect; +import android.graphics.drawable.AnimationDrawable; import android.graphics.drawable.Drawable; import android.os.Build; import android.util.AttributeSet; @@ -34,6 +35,7 @@ import android.widget.RelativeLayout; public class TabsPanel extends LinearLayout implements LightweightTheme.OnChangeListener, IconTabWidget.OnTabChangedListener { + @SuppressWarnings("unused") private static final String LOGTAG = "Gecko" + TabsPanel.class.getSimpleName(); public static enum Panel { @@ -141,8 +143,12 @@ public class TabsPanel extends LinearLayout mTabWidget.addTab(R.drawable.tabs_private, R.string.tabs_private); if (!GeckoProfile.get(mContext).inGuestMode()) { - // n.b.: the animation does not start automatically. mTabWidget.addTab(R.drawable.tabs_synced_animation, R.string.tabs_synced); + // The animation does not start automatically, except on Android 4.4.2, when it does. + final Drawable iconDrawable = getIconDrawable(Panel.REMOTE_TABS); + if (iconDrawable instanceof AnimationDrawable) { + ((AnimationDrawable) iconDrawable).stop(); + } } mTabWidget.setTabSelectionListener(this);