Closed Bug 1177855 Opened 9 years ago Closed 9 years ago

Firefox Account profile images/avatars UI polish

Categories

(Firefox for Android Graveyard :: General, defect)

Unspecified
Android
defect
Not set
normal

Tracking

(firefox42 fixed)

RESOLVED FIXED
Firefox 42
Tracking Status
firefox42 --- fixed

People

(Reporter: vivek, Assigned: vivek, Mentored)

Details

Attachments

(8 files, 1 obsolete file)

This is bug to track the following improvements 1) Load the avatar in a neat rounded image 2) Cleanup profile fetch logic 3) Add profile fetch to a background services may be to sync services
Attached patch part1.patch (obsolete) — Splinter Review
Used picasso to download and show the avatar as preference icon.
Attachment #8626683 - Flags: review?(nalexander)
Comment on attachment 8626683 [details] [diff] [review] part1.patch Review of attachment 8626683 [details] [diff] [review]: ----------------------------------------------------------------- Nifty! This will be tricky to upstream to android-sync, because of Picasso, but I think we should go ahead and deal with that later. Just some nits and small changes, please. ::: mobile/android/base/fxa/activities/FxAccountStatusFragment.java @@ +654,5 @@ > handler.removeCallbacks(profileFetchRunnable); > } > > + if (!profileJson.containsKey(FxAccountConstants.KEY_PROFILE_JSON_AVATAR) > + && !profileJson.containsKey(FxAccountConstants.KEY_PROFILE_JSON_USERNAME)) { nit: && on first line, so the ! aligns. @@ +675,5 @@ > + } > + > + // Icon update from java is not supported prior to API 11, skip the avatar image fetch and update for older device. > + if (!AppConstants.Versions.feature11Plus || TextUtils.isEmpty(avatarURI)) { > + Logger.info(LOG_TAG, "Skipping profile image fetch."); Let's improve our lives later: separate checks, descriptive log messages. @@ +679,5 @@ > + Logger.info(LOG_TAG, "Skipping profile image fetch."); > + return; > + } > + > + Picasso.with(getActivity()) Move .with onto a new line so all the '.'s align. @@ +805,5 @@ > > /** > + * A Target listener to update the profile avatar image. > + */ > + private class ProfileAvatarTarget implements Target { This is generally useful. Extract it to a helper class (new file, named like PicassoPreferenceIconTarget) that takes all the parameters (fallback, corner radius, etc). @@ +815,5 @@ > + } > + > + @Override > + public void onBitmapLoaded(Bitmap bitmap, Picasso.LoadedFrom from) { > + // Icon update from java is not supported prior to API 11 nit: capitalize Java, full sentence (trailing period). ::: mobile/android/base/resources/values/fxaccount_dimens.xml @@ +26,5 @@ > > <integer name="preference_fragment_scrollbarStyle">0x02000000</integer> <!-- outsideOverlay --> > + > + <!-- Profile avatar image height. --> > + <dimen name="fxaccount_profile_target_height">48dp</dimen> nit: indentation is looking funky here. Why is this not called fxaccount_profile_avatar_image_height? What does "target" mean?
Attachment #8626683 - Flags: review?(nalexander) → feedback+
Attached patch part1.patchSplinter Review
review nits addressed
Attachment #8626683 - Attachment is obsolete: true
Attachment #8626800 - Flags: review?(nalexander)
Attached patch part2.patchSplinter Review
* Added profile fetch to SyncAdapter * Added check for cache staleness
Attachment #8626802 - Flags: review?(nalexander)
Bug 1177855 - Partial review comments. * First, the new target needed to be generalized (no reference to profile) and was not handling corner radius correctly. Please test that the new approach is correct! * Second, we shouldn't be re-creating the Picasso Target frequently. Cache it and re-use it. * Third, an AndroidFxAccount is transient, so it's not a good place to cache. Drop the cached JSON entirely and just synchronize (statically, across instances) reading and writing to the AccountManager. * Fourth, use FxAccountUtils.pii rather than Logger.pii.
Bug 1177855: Fetch and show avatar image as preference icon -r=nalexander.
Attachment #8627933 - Flags: review?(nalexander)
Attachment #8627934 - Flags: review?(nalexander)
Bug 1177855: Fetch and show avatar image as preference icon -r=nalexander.
Bug 1177855 : Miscellaneous improvements related to profile avatar caching -r=nalexander.
Attachment #8627935 - Flags: review?(nalexander)
Attachment #8627936 - Flags: review?(nalexander)
Bug 1177855 : Miscellaneous improvements related to profile avatar caching -r=nalexander.
Bug 1177855 - simplified avatar fetch logic r?nalexander. * Generalized PicassoPreferenceIcon implementation * Cleaned up profile caching and simplified the complex profile fetch rate limiter logic * profile always de-serialized from account manager rather from a cache. * UI always updated asynchronously through broadcast after sync. A defaul icon is used as fallback during the on going sync.
Attachment #8627937 - Flags: review?(nalexander)
url: https://hg.mozilla.org/integration/fx-team/rev/1aa1e439591173468690fe2868574a033a7d223d changeset: 1aa1e439591173468690fe2868574a033a7d223d user: vivek <vivekb.balakrishnan@gmail.com> date: Tue Jun 30 21:09:44 2015 -0700 description: Bug 1177855: Fetch and show avatar image as preference icon. r=nalexander The profile JSON is stored in the Account bundle. There's no need to bump the bundle version, since missing (i.e., null) profile JSON is legal. This introduces and uses a general-purpose PicassoPreferenceIcon Picasso Target that, on API 11+ devices, dynamically loads a preference icon.
Attachment #8626800 - Flags: review?(nalexander)
Attachment #8626802 - Flags: review?(nalexander)
Attachment #8627933 - Flags: review?(nalexander) → review+
Comment on attachment 8627933 [details] MozReview Request: Bug 1177855: Fetch and show avatar image as preference icon -r=nalexander. https://reviewboard.mozilla.org/r/12341/#review10821 Ship It!
Comment on attachment 8627935 [details] MozReview Request: Bug 1177855 : Miscellaneous improvements related to profile avatar caching -r=nalexander. https://reviewboard.mozilla.org/r/12343/#review10823 Ship It!
Attachment #8627935 - Flags: review?(nalexander) → review+
Attachment #8627937 - Flags: review?(nalexander) → review+
Comment on attachment 8627937 [details] MozReview Request: Bug 1177855 - simplified avatar fetch logic r?nalexander. https://reviewboard.mozilla.org/r/12345/#review10825 Ship It!
mozreview has complete lost it, so I can't clear the remaining flags. In any case, I reviewed this and landed with some further simplifications. vivek: good work! On to the next!
Status: NEW → ASSIGNED
Attachment #8627934 - Flags: review?(nalexander)
Attachment #8627936 - Flags: review?(nalexander)
Status: ASSIGNED → RESOLVED
Closed: 9 years ago
Resolution: --- → FIXED
Target Milestone: --- → Firefox 41
Target Milestone: Firefox 41 → Firefox 42
Product: Firefox for Android → Firefox for Android Graveyard
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: