Bug 1317643 - Resolved issue where the avatar icon resets to default. r?maliu
When debug mode is toggled, hardRefresh() is called, removing and adding all preferences. However, profileAvatarTarget wasn't being updated with the new instance of profilePreference. This was resolved by moving the creation of profileAvatarTarget to refresh(), which is called in hardRefresh().
MozReview-Commit-ID: 8raarHbmR23
--- a/mobile/android/services/src/main/java/org/mozilla/gecko/fxa/activities/FxAccountStatusFragment.java
+++ b/mobile/android/services/src/main/java/org/mozilla/gecko/fxa/activities/FxAccountStatusFragment.java
@@ -466,20 +466,16 @@ public class FxAccountStatusFragment
FxAccountSyncStatusHelper.getInstance().startObserving(syncStatusDelegate);
// Register a local broadcast receiver to get profile cached notification.
final IntentFilter intentFilter = new IntentFilter();
intentFilter.addAction(FxAccountConstants.ACCOUNT_PROFILE_JSON_UPDATED_ACTION);
accountProfileInformationReceiver = new FxAccountProfileInformationReceiver();
LocalBroadcastManager.getInstance(getActivity()).registerReceiver(accountProfileInformationReceiver, intentFilter);
- // profilePreference is set during onCreate, so it's definitely not null here.
- final float cornerRadius = getResources().getDimension(R.dimen.fxaccount_profile_image_width) / 2;
- profileAvatarTarget = new PicassoPreferenceIconTarget(getResources(), profilePreference, cornerRadius);
-
refresh();
}
@Override
public void onPause() {
super.onPause();
FxAccountSyncStatusHelper.getInstance().stopObserving(syncStatusDelegate);
@@ -513,16 +509,20 @@ public class FxAccountStatusFragment
protected void refresh() {
// refresh is called from our onResume, which can happen before the owning
// Activity tells us about an account (via our public
// refresh(AndroidFxAccount) method).
if (fxAccount == null) {
throw new IllegalArgumentException("fxAccount must not be null");
}
+ // profilePreference is set during onCreate, so it's definitely not null here.
+ final float cornerRadius = getResources().getDimension(R.dimen.fxaccount_profile_image_width) / 2;
+ profileAvatarTarget = new PicassoPreferenceIconTarget(getResources(), profilePreference, cornerRadius);
+
updateProfileInformation();
updateAuthServerPreference();
updateSyncServerPreference();
try {
// There are error states determined by Android, not the login state
// machine, and we have a chance to present these states here. We handle
// them specially, since we can't surface these states as part of syncing,