diff --git a/WooCommerce/src/main/kotlin/com/woocommerce/android/ui/login/DynamicEdgeToEdgeActivity.kt b/WooCommerce/src/main/kotlin/com/woocommerce/android/ui/login/DynamicEdgeToEdgeActivity.kt new file mode 100644 index 00000000000..6d24de48c26 --- /dev/null +++ b/WooCommerce/src/main/kotlin/com/woocommerce/android/ui/login/DynamicEdgeToEdgeActivity.kt @@ -0,0 +1,8 @@ +package com.woocommerce.android.ui.login + +// The prologue screen requires an edge-to-edge layout, whereas the login screens do not. This interface allows +// LoginActivity to enable edge-edge layout needed and disable it when the login screens are displayed. +interface DynamicEdgeToEdgeActivity { + fun enableDynamicEdgeToEdge(forceDarkStatusBar: Boolean = false) + fun disableDynamicEdgeToEdge() +} diff --git a/WooCommerce/src/main/kotlin/com/woocommerce/android/ui/login/LoginActivity.kt b/WooCommerce/src/main/kotlin/com/woocommerce/android/ui/login/LoginActivity.kt index 852ad21ba2f..cec35684441 100644 --- a/WooCommerce/src/main/kotlin/com/woocommerce/android/ui/login/LoginActivity.kt +++ b/WooCommerce/src/main/kotlin/com/woocommerce/android/ui/login/LoginActivity.kt @@ -7,6 +7,7 @@ import android.os.Bundle import android.os.Parcelable import android.view.MenuItem import androidx.activity.OnBackPressedCallback +import androidx.activity.SystemBarStyle import androidx.activity.enableEdgeToEdge import androidx.appcompat.app.AppCompatActivity import androidx.core.view.ViewCompat @@ -97,11 +98,12 @@ import kotlin.text.RegexOption.IGNORE_CASE @AndroidEntryPoint class LoginActivity : AppCompatActivity(), + HasAndroidInjector, + DynamicEdgeToEdgeActivity, LoginListener, GoogleListener, PrologueListener, PrologueCarouselListener, - HasAndroidInjector, LoginNoJetpackListener, LoginEmailHelpDialogFragment.Listener, WooLoginEmailFragment.Listener, @@ -158,10 +160,6 @@ class LoginActivity : override fun onCreate(savedInstanceState: Bundle?) { super.onCreate(savedInstanceState) - // The Prologue screen requires an edge-to-edge layout, but the login screens do not. Since both the prologue - // and login screens are part of this activity, insets are manually managed based on the current fragment using - // the addWindowInsets() and removeWindowInsets() functions. - enableEdgeToEdge() ChromeCustomTabUtils.registerForPartialTabUsage(this) onBackPressedDispatcher.addCallback( @@ -331,17 +329,32 @@ class LoginActivity : override fun onPrimaryButtonClicked() { unifiedLoginTracker.trackClick(Click.LOGIN_WITH_SITE_ADDRESS) - addWindowInsets() + disableDynamicEdgeToEdge() loginViaSiteAddress() } override fun onSecondaryButtonClicked() { unifiedLoginTracker.trackClick(Click.CONTINUE_WITH_WORDPRESS_COM) - addWindowInsets() + disableDynamicEdgeToEdge() startLoginViaWPCom() } - private fun addWindowInsets() { + override fun enableDynamicEdgeToEdge(forceDarkStatusBar: Boolean) { + if (forceDarkStatusBar) { + enableEdgeToEdge(statusBarStyle = SystemBarStyle.dark(android.graphics.Color.TRANSPARENT)) + } else { + enableEdgeToEdge() + } + + // Remove system bar insets from the fragment's root + ViewCompat.setOnApplyWindowInsetsListener(binding.snackRoot, null) + binding.snackRoot.updatePadding(0, 0, 0, 0) + } + + override fun disableDynamicEdgeToEdge() { + enableEdgeToEdge() + + // Add system bar insets to the fragment's root ViewCompat.setOnApplyWindowInsetsListener(binding.snackRoot) { v, windowInsets -> val insets = windowInsets.getInsets(WindowInsetsCompat.Type.systemBars()) v.updatePadding(insets.left, insets.top, insets.right, insets.bottom) @@ -349,19 +362,10 @@ class LoginActivity : } } - private fun removeWindowInsets() { - ViewCompat.setOnApplyWindowInsetsListener(binding.snackRoot, null) - binding.snackRoot.updatePadding(0, 0, 0, 0) - } - override fun onNewToWooButtonClicked() { ChromeCustomTabUtils.launchUrl(this, AppUrls.HOSTING_OPTIONS_DOC) } - override fun onEdgeToEdgeLayoutForPrologue() = removeWindowInsets() - - override fun onEdgeToEdgeLayoutForCarousel() = removeWindowInsets() - private fun showMainActivityAndFinish() { experimentTracker.log(ExperimentTracker.LOGIN_SUCCESSFUL_EVENT) diff --git a/WooCommerce/src/main/kotlin/com/woocommerce/android/ui/login/LoginPrologueCarouselFragment.kt b/WooCommerce/src/main/kotlin/com/woocommerce/android/ui/login/LoginPrologueCarouselFragment.kt index 5a2378a343d..e0b9598a0de 100644 --- a/WooCommerce/src/main/kotlin/com/woocommerce/android/ui/login/LoginPrologueCarouselFragment.kt +++ b/WooCommerce/src/main/kotlin/com/woocommerce/android/ui/login/LoginPrologueCarouselFragment.kt @@ -35,7 +35,6 @@ class LoginPrologueCarouselFragment : Fragment(R.layout.fragment_login_prologue_ interface PrologueCarouselListener { fun onCarouselFinished() - fun onEdgeToEdgeLayoutForCarousel() } @Inject @@ -50,9 +49,9 @@ class LoginPrologueCarouselFragment : Fragment(R.layout.fragment_login_prologue_ private var prologueCarouselListener: PrologueCarouselListener? = null override fun onViewCreated(view: View, savedInstanceState: Bundle?) { - val binding = FragmentLoginPrologueCarouselBinding.bind(view) + (activity as? DynamicEdgeToEdgeActivity)?.enableDynamicEdgeToEdge() - prologueCarouselListener?.onEdgeToEdgeLayoutForCarousel() + val binding = FragmentLoginPrologueCarouselBinding.bind(view) val isTablet = DisplayUtils.isTablet(context) || DisplayUtils.isXLargeTablet(context) ViewCompat.setOnApplyWindowInsetsListener(binding.buttonSkip) { v, windowInsets -> diff --git a/WooCommerce/src/main/kotlin/com/woocommerce/android/ui/login/LoginPrologueFragment.kt b/WooCommerce/src/main/kotlin/com/woocommerce/android/ui/login/LoginPrologueFragment.kt index 69e0f87fc9c..2c9e45bcf4c 100644 --- a/WooCommerce/src/main/kotlin/com/woocommerce/android/ui/login/LoginPrologueFragment.kt +++ b/WooCommerce/src/main/kotlin/com/woocommerce/android/ui/login/LoginPrologueFragment.kt @@ -3,6 +3,10 @@ package com.woocommerce.android.ui.login import android.content.Context import android.os.Bundle import android.view.View +import android.view.ViewGroup.MarginLayoutParams +import androidx.core.view.ViewCompat +import androidx.core.view.WindowInsetsCompat +import androidx.core.view.updateLayoutParams import androidx.fragment.app.Fragment import com.woocommerce.android.AppPrefsWrapper import com.woocommerce.android.R @@ -24,7 +28,6 @@ class LoginPrologueFragment : Fragment(R.layout.fragment_login_prologue) { fun onPrimaryButtonClicked() fun onSecondaryButtonClicked() fun onNewToWooButtonClicked() - fun onEdgeToEdgeLayoutForPrologue() } @Inject @@ -36,9 +39,15 @@ class LoginPrologueFragment : Fragment(R.layout.fragment_login_prologue) { private var prologueListener: PrologueListener? = null override fun onViewCreated(view: View, savedInstanceState: Bundle?) { - prologueListener?.onEdgeToEdgeLayoutForPrologue() + (activity as? DynamicEdgeToEdgeActivity)?.enableDynamicEdgeToEdge(forceDarkStatusBar = true) with(FragmentLoginPrologueBinding.bind(view)) { + ViewCompat.setOnApplyWindowInsetsListener(loginButtons) { v, windowInsets -> + val insets = windowInsets.getInsets(WindowInsetsCompat.Type.systemBars()) + v.updateLayoutParams { bottomMargin = insets.bottom } + WindowInsetsCompat.CONSUMED + } + buttonLoginStore.setOnClickListener { // Login with site address prologueListener?.onPrimaryButtonClicked() diff --git a/WooCommerce/src/main/res/drawable-hdpi/img_prologue.webp b/WooCommerce/src/main/res/drawable-hdpi/img_prologue.webp index c8b90afe965..8d98b64e29c 100644 Binary files a/WooCommerce/src/main/res/drawable-hdpi/img_prologue.webp and b/WooCommerce/src/main/res/drawable-hdpi/img_prologue.webp differ diff --git a/WooCommerce/src/main/res/drawable-ldpi/img_prologue.webp b/WooCommerce/src/main/res/drawable-ldpi/img_prologue.webp deleted file mode 100644 index f619f8a2f4f..00000000000 Binary files a/WooCommerce/src/main/res/drawable-ldpi/img_prologue.webp and /dev/null differ diff --git a/WooCommerce/src/main/res/drawable-mdpi/img_prologue.webp b/WooCommerce/src/main/res/drawable-mdpi/img_prologue.webp index 61b8cec3d8a..d1d6336c223 100644 Binary files a/WooCommerce/src/main/res/drawable-mdpi/img_prologue.webp and b/WooCommerce/src/main/res/drawable-mdpi/img_prologue.webp differ diff --git a/WooCommerce/src/main/res/drawable-night-hdpi/img_prologue.webp b/WooCommerce/src/main/res/drawable-night-hdpi/img_prologue.webp deleted file mode 100644 index 11aae21bc33..00000000000 Binary files a/WooCommerce/src/main/res/drawable-night-hdpi/img_prologue.webp and /dev/null differ diff --git a/WooCommerce/src/main/res/drawable-night-ldpi/img_prologue.webp b/WooCommerce/src/main/res/drawable-night-ldpi/img_prologue.webp deleted file mode 100644 index db7a7da3766..00000000000 Binary files a/WooCommerce/src/main/res/drawable-night-ldpi/img_prologue.webp and /dev/null differ diff --git a/WooCommerce/src/main/res/drawable-night-mdpi/img_prologue.webp b/WooCommerce/src/main/res/drawable-night-mdpi/img_prologue.webp deleted file mode 100644 index dc77a070a27..00000000000 Binary files a/WooCommerce/src/main/res/drawable-night-mdpi/img_prologue.webp and /dev/null differ diff --git a/WooCommerce/src/main/res/drawable-night-xhdpi/img_prologue.webp b/WooCommerce/src/main/res/drawable-night-xhdpi/img_prologue.webp deleted file mode 100644 index 8cbbda2cc7a..00000000000 Binary files a/WooCommerce/src/main/res/drawable-night-xhdpi/img_prologue.webp and /dev/null differ diff --git a/WooCommerce/src/main/res/drawable-night-xxhdpi/img_prologue.webp b/WooCommerce/src/main/res/drawable-night-xxhdpi/img_prologue.webp deleted file mode 100644 index 11ae77b984e..00000000000 Binary files a/WooCommerce/src/main/res/drawable-night-xxhdpi/img_prologue.webp and /dev/null differ diff --git a/WooCommerce/src/main/res/drawable-night-xxxhdpi/img_prologue.webp b/WooCommerce/src/main/res/drawable-night-xxxhdpi/img_prologue.webp deleted file mode 100644 index f0d1b281b3b..00000000000 Binary files a/WooCommerce/src/main/res/drawable-night-xxxhdpi/img_prologue.webp and /dev/null differ diff --git a/WooCommerce/src/main/res/drawable-xhdpi/img_prologue.webp b/WooCommerce/src/main/res/drawable-xhdpi/img_prologue.webp index 500c70eaad8..71d7569db33 100644 Binary files a/WooCommerce/src/main/res/drawable-xhdpi/img_prologue.webp and b/WooCommerce/src/main/res/drawable-xhdpi/img_prologue.webp differ diff --git a/WooCommerce/src/main/res/drawable-xxhdpi/img_prologue.webp b/WooCommerce/src/main/res/drawable-xxhdpi/img_prologue.webp index 8cb1a623419..c0413592bf4 100644 Binary files a/WooCommerce/src/main/res/drawable-xxhdpi/img_prologue.webp and b/WooCommerce/src/main/res/drawable-xxhdpi/img_prologue.webp differ diff --git a/WooCommerce/src/main/res/drawable-xxxhdpi/img_prologue.webp b/WooCommerce/src/main/res/drawable-xxxhdpi/img_prologue.webp index f9f0f0a6516..f600e4c80d4 100644 Binary files a/WooCommerce/src/main/res/drawable-xxxhdpi/img_prologue.webp and b/WooCommerce/src/main/res/drawable-xxxhdpi/img_prologue.webp differ diff --git a/WooCommerce/src/main/res/drawable/img_prologue_bg.xml b/WooCommerce/src/main/res/drawable/img_prologue_bg.xml deleted file mode 100644 index 54411bc4b29..00000000000 --- a/WooCommerce/src/main/res/drawable/img_prologue_bg.xml +++ /dev/null @@ -1,10 +0,0 @@ - - - diff --git a/WooCommerce/src/main/res/drawable-night/img_prologue_bg.xml b/WooCommerce/src/main/res/drawable/img_prologue_bg_white.xml similarity index 95% rename from WooCommerce/src/main/res/drawable-night/img_prologue_bg.xml rename to WooCommerce/src/main/res/drawable/img_prologue_bg_white.xml index 732f293adfe..5762514a387 100644 --- a/WooCommerce/src/main/res/drawable-night/img_prologue_bg.xml +++ b/WooCommerce/src/main/res/drawable/img_prologue_bg_white.xml @@ -4,7 +4,7 @@ android:viewportWidth="663" android:viewportHeight="807"> diff --git a/WooCommerce/src/main/res/layout-land/fragment_login_prologue.xml b/WooCommerce/src/main/res/layout-land/fragment_login_prologue.xml index d7dbc803b05..35199433d81 100644 --- a/WooCommerce/src/main/res/layout-land/fragment_login_prologue.xml +++ b/WooCommerce/src/main/res/layout-land/fragment_login_prologue.xml @@ -1,110 +1,106 @@ + android:background="@color/prologue_login_background_color"> + + - - + app:layout_constraintTop_toBottomOf="@id/image_prologue" + app:layout_constraintVertical_chainStyle="packed" + app:layout_constraintWidth_percent="@dimen/prologue_width_percent" /> + app:layout_constraintTop_toBottomOf="@id/prologueIntro" + app:layout_constraintWidth_percent="@dimen/prologue_width_percent" /> + app:layout_constraintStart_toStartOf="parent" + app:layout_constraintWidth_percent="@dimen/prologue_width_percent"> - + android:textColor="@color/color_on_surface" /> - + + diff --git a/WooCommerce/src/main/res/layout-land/fragment_login_prologue_carousel.xml b/WooCommerce/src/main/res/layout-land/fragment_login_prologue_carousel.xml index a99ebc8f197..886e7c46a8b 100644 --- a/WooCommerce/src/main/res/layout-land/fragment_login_prologue_carousel.xml +++ b/WooCommerce/src/main/res/layout-land/fragment_login_prologue_carousel.xml @@ -12,7 +12,8 @@ android:layout_height="match_parent" android:importantForAccessibility="no" android:scaleType="fitCenter" - android:src="@drawable/img_prologue_bg" /> + android:src="@drawable/img_prologue_bg_white" + app:tint="@color/prologue_carousel_shape_color" /> + android:background="@color/prologue_login_background_color"> + app:tint="@color/prologue_login_shape_color" /> + app:layout_constraintTop_toTopOf="parent" /> + app:layout_constraintVertical_chainStyle="packed" /> + app:layout_constraintTop_toBottomOf="@id/imageView" + app:layout_constraintVertical_chainStyle="packed" + app:layout_constraintWidth_percent="@dimen/prologue_width_percent" /> + app:layout_constraintWidth_percent="@dimen/prologue_width_percent" /> + app:layout_constraintWidth_percent="@dimen/prologue_width_percent"> + android:textColor="@color/color_on_surface" /> + android:textAllCaps="false" + android:textColor="@color/white" /> diff --git a/WooCommerce/src/main/res/layout-sw600dp/fragment_login_prologue_carousel.xml b/WooCommerce/src/main/res/layout-sw600dp/fragment_login_prologue_carousel.xml index 3929e96275b..ea7a2892c37 100644 --- a/WooCommerce/src/main/res/layout-sw600dp/fragment_login_prologue_carousel.xml +++ b/WooCommerce/src/main/res/layout-sw600dp/fragment_login_prologue_carousel.xml @@ -13,9 +13,10 @@ android:adjustViewBounds="true" android:importantForAccessibility="no" android:scaleType="centerCrop" - android:src="@drawable/img_prologue_bg" + android:src="@drawable/img_prologue_bg_white" app:layout_constraintEnd_toEndOf="parent" - app:layout_constraintStart_toStartOf="parent" /> + app:layout_constraintStart_toStartOf="parent" + app:tint="@color/prologue_carousel_shape_color" /> + android:background="@color/prologue_login_background_color"> + android:scaleType="centerCrop" + android:src="@drawable/img_prologue_bg_white" + app:tint="@color/prologue_login_shape_color" /> + app:layout_constraintTop_toBottomOf="@id/image_prologue" + app:layout_constraintVertical_chainStyle="packed" /> + app:layout_constraintTop_toBottomOf="@id/imageView" + app:layout_constraintVertical_chainStyle="packed" /> + android:paddingHorizontal="16dp" + android:paddingBottom="@dimen/prologue_button_skip_bottom_margin" + app:layout_constraintBottom_toBottomOf="parent"> + android:textColor="@color/color_on_surface" /> + android:textAllCaps="false" + android:textColor="@color/white" /> diff --git a/WooCommerce/src/main/res/layout/fragment_login_prologue_carousel.xml b/WooCommerce/src/main/res/layout/fragment_login_prologue_carousel.xml index d4bcd264577..b73249bf9ae 100644 --- a/WooCommerce/src/main/res/layout/fragment_login_prologue_carousel.xml +++ b/WooCommerce/src/main/res/layout/fragment_login_prologue_carousel.xml @@ -12,7 +12,8 @@ android:layout_height="match_parent" android:importantForAccessibility="no" android:scaleType="centerCrop" - android:src="@drawable/img_prologue_bg" /> + android:src="@drawable/img_prologue_bg_white" + app:tint="@color/prologue_carousel_shape_color" /> @color/woo_white_alpha_012 @color/woo_white + + @color/woo_gray_80 + @color/color_surface + @color/woo_gray_80 + @color/color_primary + diff --git a/WooCommerce/src/main/res/values/colors_base.xml b/WooCommerce/src/main/res/values/colors_base.xml index e7435f3b823..5b4768e29db 100644 --- a/WooCommerce/src/main/res/values/colors_base.xml +++ b/WooCommerce/src/main/res/values/colors_base.xml @@ -105,6 +105,12 @@ @color/color_on_surface @color/color_on_surface_medium + + @color/woo_gray_0 + @color/woo_purple_70 + @color/woo_purple_40 + @color/white + diff --git a/WooCommerce/src/main/res/values/colors_login.xml b/WooCommerce/src/main/res/values/colors_login.xml index edc3f8d0720..51f9799fe13 100644 --- a/WooCommerce/src/main/res/values/colors_login.xml +++ b/WooCommerce/src/main/res/values/colors_login.xml @@ -3,6 +3,5 @@ Override colors in the WordPressLoginFlow library in this file. --> - @color/color_on_surface_disabled diff --git a/WooCommerce/src/main/res/values/dimens_base.xml b/WooCommerce/src/main/res/values/dimens_base.xml index de2b0732fda..a50c4f5fb7b 100644 --- a/WooCommerce/src/main/res/values/dimens_base.xml +++ b/WooCommerce/src/main/res/values/dimens_base.xml @@ -138,8 +138,6 @@ so that's the baseline as defined in `major_100`. 91dp 64dp 105dp - 36dp - 300dp 400dp 155dp 180dp diff --git a/WooCommerce/src/main/res/values/wc_colors_base.xml b/WooCommerce/src/main/res/values/wc_colors_base.xml index dc9c0c6006d..f213a0e95b6 100644 --- a/WooCommerce/src/main/res/values/wc_colors_base.xml +++ b/WooCommerce/src/main/res/values/wc_colors_base.xml @@ -7,6 +7,7 @@ #873EFF #720EEC #6108CE + #5007AA #3C087E #2C045D #99EBEBF5