From 1732798e2450b37f9b3ddcc43857dab0981addf1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?He=CC=81ctor=20Abraham?= Date: Mon, 12 Feb 2024 16:56:46 +0100 Subject: [PATCH] Added Gravatar message in "My profile" Showing the card with the Gravatar info in the My Profile fragment. The card should contain a link to the Gravartar.com website. Design differs between light and dark modes. --- .../android/ui/prefs/MyProfileFragment.java | 8 + .../drawable-night/ic_wordpress_gravatar.xml | 19 +++ .../drawable/bg_wordpress_gravatar_info.xml | 7 + .../res/drawable/ic_wordpress_gravatar.xml | 19 +++ .../main/res/layout/my_profile_fragment.xml | 145 ++++++++++++------ WordPress/src/main/res/values/strings.xml | 2 + 6 files changed, 150 insertions(+), 50 deletions(-) create mode 100644 WordPress/src/main/res/drawable-night/ic_wordpress_gravatar.xml create mode 100644 WordPress/src/main/res/drawable/bg_wordpress_gravatar_info.xml create mode 100644 WordPress/src/main/res/drawable/ic_wordpress_gravatar.xml diff --git a/WordPress/src/main/java/org/wordpress/android/ui/prefs/MyProfileFragment.java b/WordPress/src/main/java/org/wordpress/android/ui/prefs/MyProfileFragment.java index e9b9b1dd5181..be7827f7b552 100644 --- a/WordPress/src/main/java/org/wordpress/android/ui/prefs/MyProfileFragment.java +++ b/WordPress/src/main/java/org/wordpress/android/ui/prefs/MyProfileFragment.java @@ -5,6 +5,7 @@ import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; +import android.widget.Button; import android.widget.TextView; import androidx.annotation.Nullable; @@ -22,6 +23,7 @@ import org.wordpress.android.fluxc.store.AccountStore; import org.wordpress.android.fluxc.store.AccountStore.OnAccountChanged; import org.wordpress.android.fluxc.store.AccountStore.PushAccountSettingsPayload; +import org.wordpress.android.ui.ActivityLauncher; import org.wordpress.android.ui.TextInputDialogFragment; import org.wordpress.android.util.NetworkUtils; import org.wordpress.android.util.ToastUtils; @@ -37,6 +39,7 @@ public class MyProfileFragment extends Fragment implements TextInputDialogFragme private WPTextView mLastName; private WPTextView mDisplayName; private WPTextView mAboutMe; + private Button mLearMoreAtGravatar; @Inject Dispatcher mDispatcher; @Inject AccountStore mAccountStore; @@ -44,6 +47,7 @@ public class MyProfileFragment extends Fragment implements TextInputDialogFragme private static final String TRACK_PROPERTY_FIELD_NAME = "field_name"; private static final String TRACK_PROPERTY_PAGE = "page"; private static final String TRACK_PROPERTY_PAGE_MY_PROFILE = "my_profile"; + private static final String GRAVATAR_URL = "https://www.gravatar.com"; public static MyProfileFragment newInstance() { return new MyProfileFragment(); @@ -85,6 +89,7 @@ public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle sa mLastName = rootView.findViewById(R.id.last_name); mDisplayName = rootView.findViewById(R.id.display_name); mAboutMe = rootView.findViewById(R.id.about_me); + mLearMoreAtGravatar = rootView.findViewById(R.id.learn_more_at_gravatar); rootView.findViewById(R.id.first_name_row).setOnClickListener( createOnClickListener( @@ -110,6 +115,9 @@ public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle sa getString(R.string.about_me_hint), mAboutMe, true)); + mLearMoreAtGravatar.setOnClickListener(v -> { + ActivityLauncher.openUrlExternal(getActivity(), GRAVATAR_URL); + }); return rootView; } diff --git a/WordPress/src/main/res/drawable-night/ic_wordpress_gravatar.xml b/WordPress/src/main/res/drawable-night/ic_wordpress_gravatar.xml new file mode 100644 index 000000000000..d832e934818d --- /dev/null +++ b/WordPress/src/main/res/drawable-night/ic_wordpress_gravatar.xml @@ -0,0 +1,19 @@ + + + + + + diff --git a/WordPress/src/main/res/drawable/bg_wordpress_gravatar_info.xml b/WordPress/src/main/res/drawable/bg_wordpress_gravatar_info.xml new file mode 100644 index 000000000000..3d6c96044319 --- /dev/null +++ b/WordPress/src/main/res/drawable/bg_wordpress_gravatar_info.xml @@ -0,0 +1,7 @@ + + + + + + diff --git a/WordPress/src/main/res/drawable/ic_wordpress_gravatar.xml b/WordPress/src/main/res/drawable/ic_wordpress_gravatar.xml new file mode 100644 index 000000000000..e11c8ae2e041 --- /dev/null +++ b/WordPress/src/main/res/drawable/ic_wordpress_gravatar.xml @@ -0,0 +1,19 @@ + + + + + + diff --git a/WordPress/src/main/res/layout/my_profile_fragment.xml b/WordPress/src/main/res/layout/my_profile_fragment.xml index c18f9810d3c1..6bb3b9be7b62 100644 --- a/WordPress/src/main/res/layout/my_profile_fragment.xml +++ b/WordPress/src/main/res/layout/my_profile_fragment.xml @@ -1,79 +1,124 @@ - + android:layout_height="match_parent"> - + app:layout_constraintEnd_toEndOf="parent" + app:layout_constraintStart_toStartOf="parent" + app:layout_constraintTop_toTopOf="parent"> + android:layout_width="match_parent" + android:layout_height="wrap_content" + android:orientation="vertical"> - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + + + + + + + + - + + + + + + + - + diff --git a/WordPress/src/main/res/values/strings.xml b/WordPress/src/main/res/values/strings.xml index f7531852e2c6..f3887828dd20 100644 --- a/WordPress/src/main/res/values/strings.xml +++ b/WordPress/src/main/res/values/strings.xml @@ -2869,6 +2869,8 @@ You have active premium upgrades on your site. Please cancel your upgrades prior to deleting your site. Show purchases Checking purchases + "Gravatar keeps your profile information safe and up to date, automatically syncing any updates made here with your Gravatar profile." + Learn more on Gravatar.com Account Settings