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() {
views.resetPasswordBreakerGradientContainer.setBackgroundResource(
when (themeProvider.isLightTheme()) {
true -> R.drawable.bg_waiting_for_email_verification
false -> R.drawable.bg_color_background
}
)
views.resetPasswordBreakerGradientContainer.setBackgroundResource(themeProvider.ftueBreakerBackground())
views.resetPasswordBreakerTitle.text = getString(R.string.ftue_auth_reset_password_breaker_title)
.colorTerminatingFullStop(ThemeUtils.getColor(requireContext(), R.attr.colorSecondary))
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() {
views.emailVerificationGradientContainer.setBackgroundResource(
when (themeProvider.isLightTheme()) {
true -> R.drawable.bg_waiting_for_email_verification
false -> R.drawable.bg_color_background
}
)
views.emailVerificationGradientContainer.setBackgroundResource(themeProvider.ftueBreakerBackground())
views.emailVerificationTitle.text = getString(R.string.ftue_auth_email_verification_title)
.colorTerminatingFullStop(ThemeUtils.getColor(requireContext(), R.attr.colorSecondary))
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 com.google.android.material.textfield.TextInputLayout
import im.vector.app.R
import im.vector.app.core.extensions.hasContentFlow
import im.vector.app.features.login.SignMode
import im.vector.app.features.onboarding.OnboardingAction
import im.vector.app.features.themes.ThemeProvider
import kotlinx.coroutines.flow.Flow
import kotlinx.coroutines.flow.combine
import kotlinx.coroutines.flow.onEach
@ -49,3 +51,8 @@ fun observeContentChangesAndResetErrors(username: TextInputLayout, password: Tex
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"
app:layout_constraintHeight_percent="0.60"
app:layout_constraintTop_toTopOf="parent"
tools:background="@drawable/bg_waiting_for_email_verification" />
tools:background="@drawable/bg_gradient_ftue_breaker" />
<Space
android:id="@+id/resetPasswordBreakerSpace1"

View file

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