extracting common breaker background selection to ftue extensions

This commit is contained in:
Adam Brown 2022-06-29 17:47:28 +01:00
parent 1361852721
commit c603b780cf
6 changed files with 11 additions and 14 deletions

View File

@ -54,12 +54,7 @@ class FtueAuthResetPasswordBreakerFragment : AbstractFtueAuthFragment<FragmentFt
} }
private fun setupUi() { private fun setupUi() {
views.resetPasswordBreakerGradientContainer.setBackgroundResource( views.resetPasswordBreakerGradientContainer.setBackgroundResource(themeProvider.ftueBreakerBackground())
when (themeProvider.isLightTheme()) {
true -> R.drawable.bg_waiting_for_email_verification
false -> R.drawable.bg_color_background
}
)
views.resetPasswordBreakerTitle.text = getString(R.string.ftue_auth_reset_password_breaker_title) views.resetPasswordBreakerTitle.text = getString(R.string.ftue_auth_reset_password_breaker_title)
.colorTerminatingFullStop(ThemeUtils.getColor(requireContext(), R.attr.colorSecondary)) .colorTerminatingFullStop(ThemeUtils.getColor(requireContext(), R.attr.colorSecondary))
views.resetPasswordBreakerSubtitle.text = getString(R.string.ftue_auth_email_verification_subtitle, params.email) views.resetPasswordBreakerSubtitle.text = getString(R.string.ftue_auth_email_verification_subtitle, params.email)

View File

@ -58,12 +58,7 @@ class FtueAuthWaitForEmailFragment @Inject constructor(
} }
private fun setupUi() { private fun setupUi() {
views.emailVerificationGradientContainer.setBackgroundResource( views.emailVerificationGradientContainer.setBackgroundResource(themeProvider.ftueBreakerBackground())
when (themeProvider.isLightTheme()) {
true -> R.drawable.bg_waiting_for_email_verification
false -> R.drawable.bg_color_background
}
)
views.emailVerificationTitle.text = getString(R.string.ftue_auth_email_verification_title) views.emailVerificationTitle.text = getString(R.string.ftue_auth_email_verification_title)
.colorTerminatingFullStop(ThemeUtils.getColor(requireContext(), R.attr.colorSecondary)) .colorTerminatingFullStop(ThemeUtils.getColor(requireContext(), R.attr.colorSecondary))
views.emailVerificationSubtitle.text = getString(R.string.ftue_auth_email_verification_subtitle, params.email) views.emailVerificationSubtitle.text = getString(R.string.ftue_auth_email_verification_subtitle, params.email)

View File

@ -18,9 +18,11 @@ package im.vector.app.features.onboarding.ftueauth
import android.widget.Button import android.widget.Button
import com.google.android.material.textfield.TextInputLayout import com.google.android.material.textfield.TextInputLayout
import im.vector.app.R
import im.vector.app.core.extensions.hasContentFlow import im.vector.app.core.extensions.hasContentFlow
import im.vector.app.features.login.SignMode import im.vector.app.features.login.SignMode
import im.vector.app.features.onboarding.OnboardingAction import im.vector.app.features.onboarding.OnboardingAction
import im.vector.app.features.themes.ThemeProvider
import kotlinx.coroutines.flow.Flow import kotlinx.coroutines.flow.Flow
import kotlinx.coroutines.flow.combine import kotlinx.coroutines.flow.combine
import kotlinx.coroutines.flow.onEach import kotlinx.coroutines.flow.onEach
@ -49,3 +51,8 @@ fun observeContentChangesAndResetErrors(username: TextInputLayout, password: Tex
submit.isEnabled = it submit.isEnabled = it
} }
} }
fun ThemeProvider.ftueBreakerBackground() = when (isLightTheme()) {
true -> R.drawable.bg_gradient_ftue_breaker
false -> R.drawable.bg_color_background
}

View File

@ -25,7 +25,7 @@
android:layout_height="0dp" android:layout_height="0dp"
app:layout_constraintHeight_percent="0.60" app:layout_constraintHeight_percent="0.60"
app:layout_constraintTop_toTopOf="parent" app:layout_constraintTop_toTopOf="parent"
tools:background="@drawable/bg_waiting_for_email_verification" /> tools:background="@drawable/bg_gradient_ftue_breaker" />
<Space <Space
android:id="@+id/resetPasswordBreakerSpace1" android:id="@+id/resetPasswordBreakerSpace1"

View File

@ -25,7 +25,7 @@
android:layout_height="0dp" android:layout_height="0dp"
app:layout_constraintHeight_percent="0.60" app:layout_constraintHeight_percent="0.60"
app:layout_constraintTop_toTopOf="parent" app:layout_constraintTop_toTopOf="parent"
tools:background="@drawable/bg_waiting_for_email_verification" /> tools:background="@drawable/bg_gradient_ftue_breaker" />
<Space <Space
android:id="@+id/emailVerificationSpace1" android:id="@+id/emailVerificationSpace1"