updating xml ids to reflect their context

This commit is contained in:
Adam Brown 2022-06-08 11:01:08 +01:00
parent 16481df0f7
commit 0d80bdfd41
4 changed files with 71 additions and 71 deletions

View file

@ -54,17 +54,17 @@ class FtueAuthResetPasswordBreakerFragment : AbstractFtueAuthFragment<FragmentFt
} }
private fun setupUi() { private fun setupUi() {
views.emailVerificationGradientContainer.setBackgroundResource( views.resetPasswordBreakerGradientContainer.setBackgroundResource(
when (themeProvider.isLightTheme()) { when (themeProvider.isLightTheme()) {
true -> R.drawable.bg_waiting_for_email_verification true -> R.drawable.bg_waiting_for_email_verification
false -> R.drawable.bg_color_background false -> R.drawable.bg_color_background
} }
) )
views.emailVerificationTitle.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.emailVerificationSubtitle.text = getString(R.string.ftue_auth_email_verification_subtitle, params.email) views.resetPasswordBreakerSubtitle.text = getString(R.string.ftue_auth_email_verification_subtitle, params.email)
views.emailVerificationResendEmail.debouncedClicks { viewModel.handle(OnboardingAction.ResendResetPassword) } views.resetPasswordBreakerResendEmail.debouncedClicks { viewModel.handle(OnboardingAction.ResendResetPassword) }
views.emailVerificationFooter.debouncedClicks { views.resetPasswordBreakerFooter.debouncedClicks {
viewModel.handle(OnboardingAction.PostViewEvent(OnboardingViewEvents.OnResetPasswordBreakerConfirmed)) viewModel.handle(OnboardingAction.PostViewEvent(OnboardingViewEvents.OnResetPasswordBreakerConfirmed))
} }
} }

View file

@ -49,14 +49,14 @@ class FtueAuthResetPasswordEntryFragment : AbstractFtueAuthFragment<FragmentFtue
} }
private fun setupViews() { private fun setupViews() {
views.emailEntryInput.associateContentStateWith(button = views.emailEntrySubmit) views.newPasswordInput.associateContentStateWith(button = views.newPasswordSubmit)
views.emailEntryInput.setOnImeDoneListener { resetPassword() } views.newPasswordInput.setOnImeDoneListener { resetPassword() }
views.emailEntrySubmit.debouncedClicks { resetPassword() } views.newPasswordSubmit.debouncedClicks { resetPassword() }
views.emailEntryInput.editText().textChanges() views.newPasswordInput.editText().textChanges()
.onEach { .onEach {
views.emailEntryInput.error = null views.newPasswordInput.error = null
views.emailEntrySubmit.isEnabled = it.isEmail() views.newPasswordSubmit.isEnabled = it.isEmail()
} }
.launchIn(viewLifecycleOwner.lifecycleScope) .launchIn(viewLifecycleOwner.lifecycleScope)
} }
@ -64,21 +64,21 @@ class FtueAuthResetPasswordEntryFragment : AbstractFtueAuthFragment<FragmentFtue
private fun resetPassword() { private fun resetPassword() {
viewModel.handle( viewModel.handle(
OnboardingAction.ConfirmNewPassword( OnboardingAction.ConfirmNewPassword(
newPassword = views.emailEntryInput.content(), newPassword = views.newPasswordInput.content(),
signOutAllDevices = views.entrySignOutAll.isChecked signOutAllDevices = views.entrySignOutAll.isChecked
) )
) )
} }
override fun onError(throwable: Throwable) { override fun onError(throwable: Throwable) {
views.emailEntryInput.error = errorFormatter.toHumanReadable(throwable) views.newPasswordInput.error = errorFormatter.toHumanReadable(throwable)
} }
override fun updateWithState(state: OnboardingViewState) { override fun updateWithState(state: OnboardingViewState) {
views.signedOutAllGroup.isVisible = state.resetState.supportsLogoutAllDevices views.signedOutAllGroup.isVisible = state.resetState.supportsLogoutAllDevices
if (state.isLoading) { if (state.isLoading) {
views.emailEntryInput.editText().hidePassword() views.newPasswordInput.editText().hidePassword()
} }
} }

View file

@ -20,7 +20,7 @@
app:layout_constraintGuide_percent="@dimen/ftue_auth_gutter_end_percent" /> app:layout_constraintGuide_percent="@dimen/ftue_auth_gutter_end_percent" />
<View <View
android:id="@+id/emailVerificationGradientContainer" android:id="@+id/resetPasswordBreakerGradientContainer"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="0dp" android:layout_height="0dp"
app:layout_constraintHeight_percent="0.60" app:layout_constraintHeight_percent="0.60"
@ -28,16 +28,16 @@
tools:background="@drawable/bg_waiting_for_email_verification" /> tools:background="@drawable/bg_waiting_for_email_verification" />
<Space <Space
android:id="@+id/emailVerificationSpace1" android:id="@+id/resetPasswordBreakerSpace1"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="0dp" android:layout_height="0dp"
app:layout_constraintBottom_toTopOf="@id/emailVerificationLogo" app:layout_constraintBottom_toTopOf="@id/resetPasswordBreakerLogo"
app:layout_constraintHeight_percent="0.10" app:layout_constraintHeight_percent="0.10"
app:layout_constraintTop_toTopOf="parent" app:layout_constraintTop_toTopOf="parent"
app:layout_constraintVertical_chainStyle="spread_inside" /> app:layout_constraintVertical_chainStyle="spread_inside" />
<ImageView <ImageView
android:id="@+id/emailVerificationLogo" android:id="@+id/resetPasswordBreakerLogo"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="0dp" android:layout_height="0dp"
android:adjustViewBounds="true" android:adjustViewBounds="true"
@ -45,67 +45,67 @@
android:backgroundTint="?colorSecondary" android:backgroundTint="?colorSecondary"
android:importantForAccessibility="no" android:importantForAccessibility="no"
android:src="@drawable/ic_email" android:src="@drawable/ic_email"
app:layout_constraintBottom_toTopOf="@id/emailVerificationSpace2" app:layout_constraintBottom_toTopOf="@id/resetPasswordBreakerSpace2"
app:layout_constraintEnd_toEndOf="parent" app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintHeight_percent="0.12" app:layout_constraintHeight_percent="0.12"
app:layout_constraintStart_toStartOf="parent" app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/emailVerificationSpace1" /> app:layout_constraintTop_toBottomOf="@id/resetPasswordBreakerSpace1" />
<Space <Space
android:id="@+id/emailVerificationSpace2" android:id="@+id/resetPasswordBreakerSpace2"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="0dp" android:layout_height="0dp"
app:layout_constraintBottom_toTopOf="@id/emailVerificationTitle" app:layout_constraintBottom_toTopOf="@id/resetPasswordBreakerTitle"
app:layout_constraintHeight_percent="0.05" app:layout_constraintHeight_percent="0.05"
app:layout_constraintTop_toBottomOf="@id/emailVerificationLogo" /> app:layout_constraintTop_toBottomOf="@id/resetPasswordBreakerLogo" />
<TextView <TextView
android:id="@+id/emailVerificationTitle" android:id="@+id/resetPasswordBreakerTitle"
style="@style/Widget.Vector.TextView.Title" style="@style/Widget.Vector.TextView.Title"
android:layout_width="0dp" android:layout_width="0dp"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:gravity="center" android:gravity="center"
android:transitionName="loginTitleTransition" android:transitionName="loginTitleTransition"
app:layout_constraintBottom_toTopOf="@id/emailVerificationSubtitle" app:layout_constraintBottom_toTopOf="@id/resetPasswordBreakerSubtitle"
app:layout_constraintEnd_toEndOf="@id/ftueAuthGutterEnd" app:layout_constraintEnd_toEndOf="@id/ftueAuthGutterEnd"
app:layout_constraintStart_toStartOf="@id/ftueAuthGutterStart" app:layout_constraintStart_toStartOf="@id/ftueAuthGutterStart"
app:layout_constraintTop_toBottomOf="@id/emailVerificationSpace2" app:layout_constraintTop_toBottomOf="@id/resetPasswordBreakerSpace2"
tools:text="@string/ftue_auth_reset_password_breaker_title" /> tools:text="@string/ftue_auth_reset_password_breaker_title" />
<TextView <TextView
android:id="@+id/emailVerificationSubtitle" android:id="@+id/resetPasswordBreakerSubtitle"
style="@style/Widget.Vector.TextView.Subtitle" style="@style/Widget.Vector.TextView.Subtitle"
android:layout_width="0dp" android:layout_width="0dp"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_marginTop="8dp" android:layout_marginTop="8dp"
android:gravity="center" android:gravity="center"
app:layout_constraintBottom_toTopOf="@id/emailVerificationSpace4" app:layout_constraintBottom_toTopOf="@id/resetPasswordBreakerSpace4"
app:layout_constraintEnd_toEndOf="@id/ftueAuthGutterEnd" app:layout_constraintEnd_toEndOf="@id/ftueAuthGutterEnd"
app:layout_constraintStart_toStartOf="@id/ftueAuthGutterStart" app:layout_constraintStart_toStartOf="@id/ftueAuthGutterStart"
app:layout_constraintTop_toBottomOf="@id/emailVerificationTitle" app:layout_constraintTop_toBottomOf="@id/resetPasswordBreakerTitle"
tools:text="@string/ftue_auth_email_verification_subtitle" /> tools:text="@string/ftue_auth_email_verification_subtitle" />
<Space <Space
android:id="@+id/emailVerificationSpace4" android:id="@+id/resetPasswordBreakerSpace4"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="0dp" android:layout_height="0dp"
app:layout_constraintBottom_toTopOf="@id/emailVerificationResendEmail" app:layout_constraintBottom_toTopOf="@id/resetPasswordBreakerResendEmail"
app:layout_constraintTop_toBottomOf="@id/emailVerificationSubtitle" /> app:layout_constraintTop_toBottomOf="@id/resetPasswordBreakerSubtitle" />
<Button <Button
android:id="@+id/emailVerificationFooter" android:id="@+id/resetPasswordBreakerFooter"
style="@style/Widget.Vector.Button.Login" style="@style/Widget.Vector.Button.Login"
android:layout_width="0dp" android:layout_width="0dp"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:text="@string/done" android:text="@string/done"
android:textAllCaps="true" android:textAllCaps="true"
app:layout_constraintBottom_toTopOf="@id/emailVerificationResendEmail" app:layout_constraintBottom_toTopOf="@id/resetPasswordBreakerResendEmail"
app:layout_constraintEnd_toEndOf="@id/ftueAuthGutterEnd" app:layout_constraintEnd_toEndOf="@id/ftueAuthGutterEnd"
app:layout_constraintStart_toStartOf="@id/ftueAuthGutterStart" app:layout_constraintStart_toStartOf="@id/ftueAuthGutterStart"
app:layout_constraintTop_toBottomOf="@id/emailVerificationSpace4" /> app:layout_constraintTop_toBottomOf="@id/resetPasswordBreakerSpace4" />
<Button <Button
android:id="@+id/emailVerificationResendEmail" android:id="@+id/resetPasswordBreakerResendEmail"
style="@style/Widget.Vector.Button.Text.Login" style="@style/Widget.Vector.Button.Text.Login"
android:layout_width="0dp" android:layout_width="0dp"
android:layout_height="wrap_content" android:layout_height="wrap_content"
@ -114,17 +114,17 @@
android:textAllCaps="true" android:textAllCaps="true"
android:textColor="?colorSecondary" android:textColor="?colorSecondary"
android:transitionName="loginSubmitTransition" android:transitionName="loginSubmitTransition"
app:layout_constraintBottom_toTopOf="@id/emailVerificationSpace5" app:layout_constraintBottom_toTopOf="@id/resetPasswordBreakerSpace5"
app:layout_constraintEnd_toEndOf="@id/ftueAuthGutterEnd" app:layout_constraintEnd_toEndOf="@id/ftueAuthGutterEnd"
app:layout_constraintStart_toStartOf="@id/ftueAuthGutterStart" app:layout_constraintStart_toStartOf="@id/ftueAuthGutterStart"
app:layout_constraintTop_toBottomOf="@id/emailVerificationFooter" /> app:layout_constraintTop_toBottomOf="@id/resetPasswordBreakerFooter" />
<Space <Space
android:id="@+id/emailVerificationSpace5" android:id="@+id/resetPasswordBreakerSpace5"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="0dp" android:layout_height="0dp"
app:layout_constraintBottom_toBottomOf="parent" app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintHeight_percent="0.05" app:layout_constraintHeight_percent="0.05"
app:layout_constraintTop_toBottomOf="@id/emailVerificationResendEmail" /> app:layout_constraintTop_toBottomOf="@id/resetPasswordBreakerResendEmail" />
</androidx.constraintlayout.widget.ConstraintLayout> </androidx.constraintlayout.widget.ConstraintLayout>

View file

@ -13,14 +13,14 @@
android:layout_height="wrap_content"> android:layout_height="wrap_content">
<androidx.constraintlayout.widget.Guideline <androidx.constraintlayout.widget.Guideline
android:id="@+id/emailEntryGutterStart" android:id="@+id/newPasswordGutterStart"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="match_parent" android:layout_height="match_parent"
android:orientation="vertical" android:orientation="vertical"
app:layout_constraintGuide_percent="@dimen/ftue_auth_gutter_start_percent" /> app:layout_constraintGuide_percent="@dimen/ftue_auth_gutter_start_percent" />
<androidx.constraintlayout.widget.Guideline <androidx.constraintlayout.widget.Guideline
android:id="@+id/emailEntryGutterEnd" android:id="@+id/newPasswordGutterEnd"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="match_parent" android:layout_height="match_parent"
android:orientation="vertical" android:orientation="vertical"
@ -30,13 +30,13 @@
android:id="@+id/headerSpacing" android:id="@+id/headerSpacing"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="52dp" android:layout_height="52dp"
app:layout_constraintBottom_toTopOf="@id/emailEntryHeaderIcon" app:layout_constraintBottom_toTopOf="@id/newPasswordHeaderIcon"
app:layout_constraintTop_toTopOf="parent" app:layout_constraintTop_toTopOf="parent"
app:layout_constraintVertical_bias="0" app:layout_constraintVertical_bias="0"
app:layout_constraintVertical_chainStyle="packed" /> app:layout_constraintVertical_chainStyle="packed" />
<ImageView <ImageView
android:id="@+id/emailEntryHeaderIcon" android:id="@+id/newPasswordHeaderIcon"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="0dp" android:layout_height="0dp"
android:adjustViewBounds="true" android:adjustViewBounds="true"
@ -44,15 +44,15 @@
android:backgroundTint="?colorSecondary" android:backgroundTint="?colorSecondary"
android:contentDescription="@null" android:contentDescription="@null"
android:src="@drawable/ic_new_password" android:src="@drawable/ic_new_password"
app:layout_constraintBottom_toTopOf="@id/emailEntryHeaderTitle" app:layout_constraintBottom_toTopOf="@id/newPasswordHeaderTitle"
app:layout_constraintEnd_toEndOf="@id/emailEntryGutterEnd" app:layout_constraintEnd_toEndOf="@id/newPasswordGutterEnd"
app:layout_constraintHeight_percent="0.12" app:layout_constraintHeight_percent="0.12"
app:layout_constraintStart_toStartOf="@id/emailEntryGutterStart" app:layout_constraintStart_toStartOf="@id/newPasswordGutterStart"
app:layout_constraintTop_toBottomOf="@id/headerSpacing" app:layout_constraintTop_toBottomOf="@id/headerSpacing"
app:tint="@color/palette_white" /> app:tint="@color/palette_white" />
<TextView <TextView
android:id="@+id/emailEntryHeaderTitle" android:id="@+id/newPasswordHeaderTitle"
style="@style/Widget.Vector.TextView.Title.Medium" style="@style/Widget.Vector.TextView.Title.Medium"
android:layout_width="0dp" android:layout_width="0dp"
android:layout_height="wrap_content" android:layout_height="wrap_content"
@ -60,13 +60,13 @@
android:gravity="center" android:gravity="center"
android:text="@string/ftue_auth_new_password_title" android:text="@string/ftue_auth_new_password_title"
android:textColor="?vctr_content_primary" android:textColor="?vctr_content_primary"
app:layout_constraintBottom_toTopOf="@id/emailEntryHeaderSubtitle" app:layout_constraintBottom_toTopOf="@id/newPasswordHeaderSubtitle"
app:layout_constraintEnd_toEndOf="@id/emailEntryGutterEnd" app:layout_constraintEnd_toEndOf="@id/newPasswordGutterEnd"
app:layout_constraintStart_toStartOf="@id/emailEntryGutterStart" app:layout_constraintStart_toStartOf="@id/newPasswordGutterStart"
app:layout_constraintTop_toBottomOf="@id/emailEntryHeaderIcon" /> app:layout_constraintTop_toBottomOf="@id/newPasswordHeaderIcon" />
<TextView <TextView
android:id="@+id/emailEntryHeaderSubtitle" android:id="@+id/newPasswordHeaderSubtitle"
style="@style/Widget.Vector.TextView.Subtitle" style="@style/Widget.Vector.TextView.Subtitle"
android:layout_width="0dp" android:layout_width="0dp"
android:layout_height="wrap_content" android:layout_height="wrap_content"
@ -75,28 +75,28 @@
android:text="@string/ftue_auth_new_password_subtitle" android:text="@string/ftue_auth_new_password_subtitle"
android:textColor="?vctr_content_secondary" android:textColor="?vctr_content_secondary"
app:layout_constraintBottom_toTopOf="@id/titleContentSpacing" app:layout_constraintBottom_toTopOf="@id/titleContentSpacing"
app:layout_constraintEnd_toEndOf="@id/emailEntryGutterEnd" app:layout_constraintEnd_toEndOf="@id/newPasswordGutterEnd"
app:layout_constraintStart_toStartOf="@id/emailEntryGutterStart" app:layout_constraintStart_toStartOf="@id/newPasswordGutterStart"
app:layout_constraintTop_toBottomOf="@id/emailEntryHeaderTitle" /> app:layout_constraintTop_toBottomOf="@id/newPasswordHeaderTitle" />
<Space <Space
android:id="@+id/titleContentSpacing" android:id="@+id/titleContentSpacing"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="0dp" android:layout_height="0dp"
app:layout_constraintBottom_toTopOf="@id/emailEntryInput" app:layout_constraintBottom_toTopOf="@id/newPasswordInput"
app:layout_constraintHeight_percent="0.03" app:layout_constraintHeight_percent="0.03"
app:layout_constraintTop_toBottomOf="@id/emailEntryHeaderSubtitle" /> app:layout_constraintTop_toBottomOf="@id/newPasswordHeaderSubtitle" />
<com.google.android.material.textfield.TextInputLayout <com.google.android.material.textfield.TextInputLayout
android:id="@+id/emailEntryInput" android:id="@+id/newPasswordInput"
style="@style/Widget.Vector.TextInputLayout.Password" style="@style/Widget.Vector.TextInputLayout.Password"
android:layout_width="0dp" android:layout_width="0dp"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:hint="@string/ftue_auth_new_password_entry_title" android:hint="@string/ftue_auth_new_password_entry_title"
app:endIconMode="clear_text" app:endIconMode="clear_text"
app:layout_constraintBottom_toTopOf="@id/entrySignOutAll" app:layout_constraintBottom_toTopOf="@id/entrySignOutAll"
app:layout_constraintEnd_toEndOf="@id/emailEntryGutterEnd" app:layout_constraintEnd_toEndOf="@id/newPasswordGutterEnd"
app:layout_constraintStart_toStartOf="@id/emailEntryGutterStart" app:layout_constraintStart_toStartOf="@id/newPasswordGutterStart"
app:layout_constraintTop_toBottomOf="@id/titleContentSpacing"> app:layout_constraintTop_toBottomOf="@id/titleContentSpacing">
<com.google.android.material.textfield.TextInputEditText <com.google.android.material.textfield.TextInputEditText
@ -120,11 +120,11 @@
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_marginStart="-14dp" android:layout_marginStart="-14dp"
android:buttonTint="@color/checkbox_tint_selector" android:buttonTint="@color/checkbox_tint_selector"
app:layout_constraintBottom_toTopOf="@id/emailEntrySubmit" app:layout_constraintBottom_toTopOf="@id/newPasswordSubmit"
app:layout_constraintEnd_toEndOf="@id/emailEntryGutterEnd" app:layout_constraintEnd_toEndOf="@id/newPasswordGutterEnd"
app:layout_constraintHorizontal_bias="0" app:layout_constraintHorizontal_bias="0"
app:layout_constraintStart_toStartOf="@id/emailEntryGutterStart" app:layout_constraintStart_toStartOf="@id/newPasswordGutterStart"
app:layout_constraintTop_toBottomOf="@id/emailEntryInput" /> app:layout_constraintTop_toBottomOf="@id/newPasswordInput" />
<TextView <TextView
android:id="@+id/signOutAllLabel" android:id="@+id/signOutAllLabel"
@ -132,22 +132,22 @@
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:text="@string/ftue_auth_sign_out_all_devices" android:text="@string/ftue_auth_sign_out_all_devices"
app:layout_constraintBottom_toTopOf="@id/emailEntrySubmit" app:layout_constraintBottom_toTopOf="@id/newPasswordSubmit"
app:layout_constraintEnd_toEndOf="@id/emailEntryGutterEnd" app:layout_constraintEnd_toEndOf="@id/newPasswordGutterEnd"
app:layout_constraintHorizontal_bias="0" app:layout_constraintHorizontal_bias="0"
app:layout_constraintStart_toEndOf="@id/entrySignOutAll" app:layout_constraintStart_toEndOf="@id/entrySignOutAll"
app:layout_constraintTop_toBottomOf="@id/emailEntryInput" /> app:layout_constraintTop_toBottomOf="@id/newPasswordInput" />
<Button <Button
android:id="@+id/emailEntrySubmit" android:id="@+id/newPasswordSubmit"
style="@style/Widget.Vector.Button.Login" style="@style/Widget.Vector.Button.Login"
android:layout_width="0dp" android:layout_width="0dp"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:text="@string/ftue_auth_reset_password" android:text="@string/ftue_auth_reset_password"
android:textAllCaps="true" android:textAllCaps="true"
app:layout_constraintBottom_toBottomOf="parent" app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="@id/emailEntryGutterEnd" app:layout_constraintEnd_toEndOf="@id/newPasswordGutterEnd"
app:layout_constraintStart_toStartOf="@id/emailEntryGutterStart" app:layout_constraintStart_toStartOf="@id/newPasswordGutterStart"
app:layout_constraintTop_toBottomOf="@id/entrySignOutAll" /> app:layout_constraintTop_toBottomOf="@id/entrySignOutAll" />
</androidx.constraintlayout.widget.ConstraintLayout> </androidx.constraintlayout.widget.ConstraintLayout>