From 0ac6a26b6e1128175c0ef532b09473aa1d844b78 Mon Sep 17 00:00:00 2001 From: Benoit Marty Date: Fri, 24 Apr 2020 17:22:05 +0200 Subject: [PATCH] Add "continue" button to the bootstrap bottom sheet --- .../recover/BootstrapConfirmPassphraseFragment.kt | 10 ++++++++-- .../crypto/recover/BootstrapEnterPassphraseFragment.kt | 10 ++++++++-- .../res/layout/fragment_bootstrap_enter_passphrase.xml | 9 +++++++-- 3 files changed, 23 insertions(+), 6 deletions(-) diff --git a/vector/src/main/java/im/vector/riotx/features/crypto/recover/BootstrapConfirmPassphraseFragment.kt b/vector/src/main/java/im/vector/riotx/features/crypto/recover/BootstrapConfirmPassphraseFragment.kt index 34a49e852e..d09eafee58 100644 --- a/vector/src/main/java/im/vector/riotx/features/crypto/recover/BootstrapConfirmPassphraseFragment.kt +++ b/vector/src/main/java/im/vector/riotx/features/crypto/recover/BootstrapConfirmPassphraseFragment.kt @@ -95,6 +95,14 @@ class BootstrapConfirmPassphraseFragment @Inject constructor( sharedViewModel.handle(BootstrapActions.TogglePasswordVisibility) } .disposeOnDestroyView() + + bootstrapSubmit.clicks() + .debounce(300, TimeUnit.MILLISECONDS) + .observeOn(AndroidSchedulers.mainThread()) + .subscribe { + submit() + } + .disposeOnDestroyView() } private fun submit() = withState(sharedViewModel) { state -> @@ -113,8 +121,6 @@ class BootstrapConfirmPassphraseFragment @Inject constructor( } override fun invalidate() = withState(sharedViewModel) { state -> - super.invalidate() - if (state.step is BootstrapStep.ConfirmPassphrase) { val isPasswordVisible = state.step.isPasswordVisible ssss_passphrase_enter_edittext.showPassword(isPasswordVisible, updateCursor = false) diff --git a/vector/src/main/java/im/vector/riotx/features/crypto/recover/BootstrapEnterPassphraseFragment.kt b/vector/src/main/java/im/vector/riotx/features/crypto/recover/BootstrapEnterPassphraseFragment.kt index 35e2e1373c..952b0e5d03 100644 --- a/vector/src/main/java/im/vector/riotx/features/crypto/recover/BootstrapEnterPassphraseFragment.kt +++ b/vector/src/main/java/im/vector/riotx/features/crypto/recover/BootstrapEnterPassphraseFragment.kt @@ -90,6 +90,14 @@ class BootstrapEnterPassphraseFragment @Inject constructor( sharedViewModel.handle(BootstrapActions.TogglePasswordVisibility) } .disposeOnDestroyView() + + bootstrapSubmit.clicks() + .debounce(300, TimeUnit.MILLISECONDS) + .observeOn(AndroidSchedulers.mainThread()) + .subscribe { + submit() + } + .disposeOnDestroyView() } private fun submit() = withState(sharedViewModel) { state -> @@ -108,8 +116,6 @@ class BootstrapEnterPassphraseFragment @Inject constructor( } override fun invalidate() = withState(sharedViewModel) { state -> - super.invalidate() - if (state.step is BootstrapStep.SetupPassphrase) { val isPasswordVisible = state.step.isPasswordVisible ssss_passphrase_enter_edittext.showPassword(isPasswordVisible, updateCursor = false) diff --git a/vector/src/main/res/layout/fragment_bootstrap_enter_passphrase.xml b/vector/src/main/res/layout/fragment_bootstrap_enter_passphrase.xml index c4289aa3be..b344f2819d 100644 --- a/vector/src/main/res/layout/fragment_bootstrap_enter_passphrase.xml +++ b/vector/src/main/res/layout/fragment_bootstrap_enter_passphrase.xml @@ -1,5 +1,4 @@ - @@ -78,6 +76,13 @@ app:layout_constraintStart_toEndOf="@+id/ssss_passphrase_enter_til" app:layout_constraintTop_toTopOf="@+id/ssss_passphrase_enter_til" /> +