From 8a53eafa7257b99528d98539d196c0bc413a2cd2 Mon Sep 17 00:00:00 2001 From: Adam Brown Date: Thu, 28 Apr 2022 12:08:05 +0100 Subject: [PATCH] adding gradient background to the waiting for verification screen, matching designs - renames drawable which redirects to the attribute colorBackground --- ..._page_dark.xml => bg_color_background.xml} | 0 .../bg_waiting_for_email_verification.xml | 19 +++++++++++++++++++ .../ftueauth/FtueAuthWaitForEmailFragment.kt | 11 ++++++++++- .../ftueauth/SplashCarouselStateFactory.kt | 4 +--- ...gment_ftue_wait_for_email_verification.xml | 7 +++++++ 5 files changed, 37 insertions(+), 4 deletions(-) rename library/ui-styles/src/main/res/drawable/{bg_carousel_page_dark.xml => bg_color_background.xml} (100%) create mode 100644 library/ui-styles/src/main/res/drawable/bg_waiting_for_email_verification.xml diff --git a/library/ui-styles/src/main/res/drawable/bg_carousel_page_dark.xml b/library/ui-styles/src/main/res/drawable/bg_color_background.xml similarity index 100% rename from library/ui-styles/src/main/res/drawable/bg_carousel_page_dark.xml rename to library/ui-styles/src/main/res/drawable/bg_color_background.xml diff --git a/library/ui-styles/src/main/res/drawable/bg_waiting_for_email_verification.xml b/library/ui-styles/src/main/res/drawable/bg_waiting_for_email_verification.xml new file mode 100644 index 0000000000..cdd4c20a4d --- /dev/null +++ b/library/ui-styles/src/main/res/drawable/bg_waiting_for_email_verification.xml @@ -0,0 +1,19 @@ + + + + + + + + + + + + + diff --git a/vector/src/main/java/im/vector/app/features/onboarding/ftueauth/FtueAuthWaitForEmailFragment.kt b/vector/src/main/java/im/vector/app/features/onboarding/ftueauth/FtueAuthWaitForEmailFragment.kt index 648b24f095..5921f25bf4 100644 --- a/vector/src/main/java/im/vector/app/features/onboarding/ftueauth/FtueAuthWaitForEmailFragment.kt +++ b/vector/src/main/java/im/vector/app/features/onboarding/ftueauth/FtueAuthWaitForEmailFragment.kt @@ -29,6 +29,7 @@ import im.vector.app.core.utils.colorTerminatingFullStop import im.vector.app.databinding.FragmentFtueWaitForEmailVerificationBinding import im.vector.app.features.onboarding.OnboardingAction import im.vector.app.features.onboarding.RegisterAction +import im.vector.app.features.themes.ThemeProvider import im.vector.app.features.themes.ThemeUtils import kotlinx.parcelize.Parcelize import javax.inject.Inject @@ -41,7 +42,9 @@ data class FtueAuthWaitForEmailFragmentArgument( /** * In this screen, the user is asked to check their emails. */ -class FtueAuthWaitForEmailFragment @Inject constructor() : AbstractFtueAuthFragment() { +class FtueAuthWaitForEmailFragment @Inject constructor( + private val themeProvider: ThemeProvider +) : AbstractFtueAuthFragment() { private val params: FtueAuthWaitForEmailFragmentArgument by args() private var inferHasLeftAndReturnedToScreen = false @@ -56,6 +59,12 @@ class FtueAuthWaitForEmailFragment @Inject constructor() : AbstractFtueAuthFragm } private fun setupUi() { + views.emailVerificationGradientContainer.setBackgroundResource( + when (themeProvider.isLightTheme()) { + true -> R.drawable.bg_waiting_for_email_verification + false -> R.drawable.bg_color_background + } + ) views.emailVerificationTitle.text = R.string.ftue_auth_email_verification_title.colorTerminatingFullStop(R.attr.colorSecondary) views.emailVerificationSubtitle.text = getString(R.string.ftue_auth_email_verification_subtitle, params.email) views.emailVerificationResendEmail.debouncedClicks { diff --git a/vector/src/main/java/im/vector/app/features/onboarding/ftueauth/SplashCarouselStateFactory.kt b/vector/src/main/java/im/vector/app/features/onboarding/ftueauth/SplashCarouselStateFactory.kt index 6d34764584..f8b885ddee 100644 --- a/vector/src/main/java/im/vector/app/features/onboarding/ftueauth/SplashCarouselStateFactory.kt +++ b/vector/src/main/java/im/vector/app/features/onboarding/ftueauth/SplashCarouselStateFactory.kt @@ -18,7 +18,6 @@ package im.vector.app.features.onboarding.ftueauth import android.content.Context import androidx.annotation.AttrRes -import androidx.annotation.ColorInt import androidx.annotation.DrawableRes import im.vector.app.R import im.vector.app.core.resources.LocaleProvider @@ -29,7 +28,6 @@ import im.vector.app.features.themes.ThemeProvider import im.vector.app.features.themes.ThemeUtils import im.vector.lib.core.utils.epoxy.charsequence.EpoxyCharSequence import im.vector.lib.core.utils.epoxy.charsequence.toEpoxyCharSequence -import me.gujun.android.span.span import javax.inject.Inject class SplashCarouselStateFactory @Inject constructor( @@ -41,7 +39,7 @@ class SplashCarouselStateFactory @Inject constructor( fun create(): SplashCarouselState { val lightTheme = themeProvider.isLightTheme() - fun background(@DrawableRes lightDrawable: Int) = if (lightTheme) lightDrawable else R.drawable.bg_carousel_page_dark + fun background(@DrawableRes lightDrawable: Int) = if (lightTheme) lightDrawable else R.drawable.bg_color_background fun hero(@DrawableRes lightDrawable: Int, @DrawableRes darkDrawable: Int) = if (lightTheme) lightDrawable else darkDrawable return SplashCarouselState( listOf( diff --git a/vector/src/main/res/layout/fragment_ftue_wait_for_email_verification.xml b/vector/src/main/res/layout/fragment_ftue_wait_for_email_verification.xml index 8ce1c25707..4c9911d797 100644 --- a/vector/src/main/res/layout/fragment_ftue_wait_for_email_verification.xml +++ b/vector/src/main/res/layout/fragment_ftue_wait_for_email_verification.xml @@ -19,6 +19,13 @@ android:orientation="vertical" app:layout_constraintGuide_percent="@dimen/ftue_auth_gutter_end_percent" /> + +