Bug 1312719 - Clear icon by setIcon with null drawable before setIcon with resId, r=sebastian draft
authormaliu <max@mxli.us>
Sat, 05 Nov 2016 19:18:59 +0800
changeset 435087 a3473ff40da1
parent 434549 673b5327afe1
child 536213 c2c6273e506d
push id34934
push userbmo:max@mxli.us
push dateTue, 08 Nov 2016 01:35:23 +0000
reviewerssebastian
bugs1312719
milestone52.0a1
Bug 1312719 - Clear icon by setIcon with null drawable before setIcon with resId, r=sebastian MozReview-Commit-ID: LTUMIoANQw7
mobile/android/base/java/org/mozilla/gecko/preferences/SyncPreference.java
--- a/mobile/android/base/java/org/mozilla/gecko/preferences/SyncPreference.java
+++ b/mobile/android/base/java/org/mozilla/gecko/preferences/SyncPreference.java
@@ -50,16 +50,19 @@ class SyncPreference extends Preference 
             ThreadUtils.postToUiThread(new Runnable() {
                 @Override
                 public void run() {
                     setTitle(R.string.pref_sync);
                     setSummary(R.string.pref_sync_summary);
                         // Cancel any pending task.
                         Picasso.with(mContext).cancelRequest(profileAvatarTarget);
                         // Clear previously set icon.
+                        // Bug 1312719 - IconDrawable is prior to IconResId, drawable must be set null before setIcon(resId)
+                        // http://androidxref.com/5.1.1_r6/xref/frameworks/base/core/java/android/preference/Preference.java#562
+                        setIcon(null);
                         setIcon(R.drawable.sync_avatar_default);
                 }
             });
             return;
         }
 
         // Update title from account email.
         ThreadUtils.postToUiThread(new Runnable() {