Verification: migrate to Epoxy - Cleanup

This commit is contained in:
Benoit Marty 2020-01-15 16:22:14 +01:00 committed by Valere
parent fc22b7988f
commit 92f26bc20a
4 changed files with 33 additions and 22 deletions

View file

@ -60,13 +60,13 @@ class VerificationEmojiCodeController @Inject constructor(
}
private fun buildEmojiItem(state: VerificationEmojiCodeViewState) {
bottomSheetVerificationNoticeItem {
id("notice")
notice(stringProvider.getString(R.string.verification_emoji_notice))
}
when (val emojiDescription = state.emojiDescription) {
is Success -> {
bottomSheetVerificationNoticeItem {
id("notice")
notice(stringProvider.getString(R.string.verification_emoji_notice))
}
bottomSheetVerificationEmojisItem {
id("emojis")
emojiRepresentation0(emojiDescription()[0])
@ -96,17 +96,33 @@ class VerificationEmojiCodeController @Inject constructor(
}
private fun buildDecimal(state: VerificationEmojiCodeViewState) {
bottomSheetVerificationNoticeItem {
id("notice")
notice(stringProvider.getString(R.string.verification_code_notice))
}
when (val decimalDescription = state.decimalDescription) {
is Success -> {
bottomSheetVerificationNoticeItem {
id("notice")
notice(stringProvider.getString(R.string.verification_code_notice))
}
bottomSheetVerificationDecimalCodeItem {
id("decimal")
code(state.decimalDescription.invoke() ?: "")
}
bottomSheetVerificationDecimalCodeItem {
id("decimal")
code(state.decimalDescription.invoke() ?: "")
}
buildActions(state)
buildActions(state)
}
is Fail -> {
errorWithRetryItem {
id("error")
text(errorFormatter.toHumanReadable(decimalDescription.error))
}
}
else -> {
bottomSheetVerificationWaitingItem {
id("waiting")
title(stringProvider.getString(R.string.please_wait))
}
}
}
}
private fun buildActions(state: VerificationEmojiCodeViewState) {

View file

@ -5,8 +5,8 @@
android:id="@+id/itemVerificationDecimalCode"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="8dp"
android:layout_marginBottom="8dp"
android:layout_marginTop="16dp"
android:layout_marginBottom="16dp"
android:gravity="center_horizontal"
android:textColor="?riotx_text_primary"
android:textSize="28sp"

View file

@ -4,11 +4,7 @@
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_margin="@dimen/layout_vertical_margin"
app:layout_constrainedWidth="true"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/sas_emoji_description_2">
android:layout_margin="@dimen/layout_vertical_margin">
<include
android:id="@+id/emoji0"

View file

@ -21,7 +21,6 @@
app:layout_constraintEnd_toStartOf="@+id/itemVerificationWaitingProgress"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintVertical_chainStyle="packed"
tools:text="Waiting for..." />
<ProgressBar