diff --git a/RELEASE-NOTES.txt b/RELEASE-NOTES.txt index 115ee2e7e026..98526510ef91 100644 --- a/RELEASE-NOTES.txt +++ b/RELEASE-NOTES.txt @@ -1,6 +1,7 @@ 14.7 ----- - +* Added user Gravatar to the Me menu in My Site. + 14.6 ----- * Block editor: You can now crop, zoom in/out and rotate images that are already inserted in a post. diff --git a/WordPress/src/main/java/org/wordpress/android/ui/main/MeFragment.java b/WordPress/src/main/java/org/wordpress/android/ui/main/MeFragment.java index 8ad592918f39..53a275771caf 100644 --- a/WordPress/src/main/java/org/wordpress/android/ui/main/MeFragment.java +++ b/WordPress/src/main/java/org/wordpress/android/ui/main/MeFragment.java @@ -265,11 +265,11 @@ private void showGravatarProgressBar(boolean isUpdating) { private void loadAvatar(String injectFilePath) { final boolean newAvatarUploaded = injectFilePath != null && !injectFilePath.isEmpty(); - final String rawAvatarUrl = mAccountStore.getAccount().getAvatarUrl(); + final String avatarUrl = mMeGravatarLoader.constructGravatarUrl(mAccountStore.getAccount().getAvatarUrl()); mMeGravatarLoader.load( newAvatarUploaded, - rawAvatarUrl, + avatarUrl, injectFilePath, mAvatarImageView, ImageType.AVATAR_WITHOUT_BACKGROUND, @@ -297,7 +297,7 @@ public void onResourceReady(@NotNull Drawable resource, @Nullable Object model) // create a copy since the original bitmap may by automatically recycled bitmap = bitmap.copy(bitmap.getConfig(), true); WordPress.getBitmapCache().put( - mMeGravatarLoader.constructGravatarUrl(rawAvatarUrl), + avatarUrl, bitmap ); } diff --git a/WordPress/src/main/java/org/wordpress/android/ui/main/MySiteFragment.java b/WordPress/src/main/java/org/wordpress/android/ui/main/MySiteFragment.java index 36a66437cfd2..0544488f9914 100644 --- a/WordPress/src/main/java/org/wordpress/android/ui/main/MySiteFragment.java +++ b/WordPress/src/main/java/org/wordpress/android/ui/main/MySiteFragment.java @@ -10,6 +10,7 @@ import android.text.Spannable; import android.text.TextUtils; import android.view.LayoutInflater; +import android.view.MenuItem; import android.view.View; import android.view.ViewGroup; import android.widget.ImageView; @@ -22,6 +23,7 @@ import androidx.annotation.Nullable; import androidx.appcompat.widget.PopupMenu; import androidx.appcompat.widget.Toolbar; +import androidx.appcompat.widget.TooltipCompat; import androidx.core.content.ContextCompat; import androidx.fragment.app.Fragment; @@ -207,11 +209,11 @@ public void onCreate(Bundle savedInstanceState) { } private void refreshMeGravatar() { - String rawGravatarUrl = mMeGravatarLoader.constructGravatarUrl(mAccountStore.getAccount().getAvatarUrl()); + String avatarUrl = mMeGravatarLoader.constructGravatarUrl(mAccountStore.getAccount().getAvatarUrl()); mMeGravatarLoader.load( false, - rawGravatarUrl, + avatarUrl, null, mAvatarImageView, ImageType.USER, @@ -378,11 +380,14 @@ public View onCreateView(@NonNull LayoutInflater inflater, ViewGroup container, mToolbar.setTitle(mToolbarTitle); mToolbar.inflateMenu(R.menu.my_site_menu); - View actionView = mToolbar.getMenu().findItem(R.id.me_item).getActionView(); + + MenuItem meMenu = mToolbar.getMenu().findItem(R.id.me_item); + View actionView = meMenu.getActionView(); mAvatarImageView = actionView.findViewById(R.id.avatar); - actionView.setOnClickListener(item -> { - ActivityLauncher.viewMeActivityForResult(getActivity()); - }); + + actionView.setOnClickListener(item -> ActivityLauncher.viewMeActivityForResult(getActivity())); + + TooltipCompat.setTooltipText(actionView, meMenu.getTitle()); return rootView; } diff --git a/WordPress/src/main/java/org/wordpress/android/ui/main/utils/MeGravatarLoader.kt b/WordPress/src/main/java/org/wordpress/android/ui/main/utils/MeGravatarLoader.kt index b81bb7302626..02a89dcd2d22 100644 --- a/WordPress/src/main/java/org/wordpress/android/ui/main/utils/MeGravatarLoader.kt +++ b/WordPress/src/main/java/org/wordpress/android/ui/main/utils/MeGravatarLoader.kt @@ -21,14 +21,12 @@ class MeGravatarLoader @Inject constructor( ) { fun load( newAvatarUploaded: Boolean, - rawAvatarUrl: String, + avatarUrl: String, injectFilePath: String?, imageView: ImageView, imageType: ImageType, listener: RequestListener? = null ) { - val avatarUrl = constructGravatarUrl(rawAvatarUrl) - if (newAvatarUploaded) { // invalidate the specific gravatar entry from the bitmap cache. It will be updated via the injected // request cache. diff --git a/WordPress/src/main/res/layout/me_action_layout.xml b/WordPress/src/main/res/layout/me_action_layout.xml index 2ec02d1976a3..33a7a7574371 100644 --- a/WordPress/src/main/res/layout/me_action_layout.xml +++ b/WordPress/src/main/res/layout/me_action_layout.xml @@ -1,9 +1,9 @@ - @@ -11,9 +11,9 @@ android:id="@+id/avatar" android:layout_width="@dimen/avatar_sz_small" android:layout_height="@dimen/avatar_sz_small" - android:contentDescription="@string/me_section_screen_title" + android:contentDescription="@null" android:background="@drawable/bg_oval_transparent_stroke_white" android:padding="@dimen/posts_list_spinner_avatar_padding" android:src="@drawable/ic_user_white_24dp"/> - + diff --git a/WordPress/src/main/res/values/dimens.xml b/WordPress/src/main/res/values/dimens.xml index a6988237b2fd..34ffc72627f3 100644 --- a/WordPress/src/main/res/values/dimens.xml +++ b/WordPress/src/main/res/values/dimens.xml @@ -8,7 +8,7 @@ 40dp 48dp - 48dp + 64dp 56dp 72dp 0dp