Login screens: Loading on Captcha step

This commit is contained in:
Benoit Marty 2019-11-19 18:23:33 +01:00
parent 3758334824
commit 8ae9544b48
2 changed files with 45 additions and 29 deletions

View File

@ -18,6 +18,7 @@ package im.vector.riotx.features.login
import android.annotation.SuppressLint
import android.content.DialogInterface
import android.graphics.Bitmap
import android.net.http.SslError
import android.os.Build
import android.os.Bundle
@ -26,6 +27,7 @@ import android.view.KeyEvent
import android.view.View
import android.webkit.*
import androidx.appcompat.app.AlertDialog
import androidx.core.view.isVisible
import com.airbnb.mvrx.args
import im.vector.matrix.android.internal.di.MoshiProvider
import im.vector.riotx.R
@ -72,10 +74,18 @@ class LoginCaptchaFragment @Inject constructor(private val assetReader: AssetRea
loginCaptchaWevView.requestLayout()
loginCaptchaWevView.webViewClient = object : WebViewClient() {
override fun onPageStarted(view: WebView?, url: String?, favicon: Bitmap?) {
super.onPageStarted(view, url, favicon)
// Show loader
loginCaptchaProgress.isVisible = true
}
override fun onPageFinished(view: WebView, url: String) {
super.onPageFinished(view, url)
// TODO Hide loader
// Hide loader
loginCaptchaProgress.isVisible = false
}
override fun onReceivedSslError(view: WebView, handler: SslErrorHandler, error: SslError) {

View File

@ -2,41 +2,47 @@
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
android:layout_height="match_parent">
android:layout_height="match_parent"
android:paddingStart="16dp"
android:paddingTop="32dp"
android:paddingEnd="16dp"
android:paddingBottom="16dp">
<LinearLayout
android:layout_width="0dp"
android:layout_height="0dp"
android:orientation="vertical"
android:paddingStart="16dp"
android:paddingTop="32dp"
android:paddingEnd="16dp"
android:paddingBottom="16dp"
app:layout_constraintBottom_toBottomOf="parent"
<ImageView
android:id="@+id/logoImageView"
style="@style/LoginTopIcon"
android:layout_gravity="center_horizontal"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent">
app:layout_constraintTop_toTopOf="parent" />
<ImageView
android:id="@+id/logoImageView"
style="@style/LoginTopIcon"
android:layout_gravity="center_horizontal" />
<TextView
android:id="@+id/loginCaptchaNotice"
style="@style/TextAppearance.Vector.Login.Text.Small"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="8dp"
android:gravity="center_horizontal"
android:text="@string/auth_recaptcha_message"
app:layout_constraintTop_toBottomOf="@+id/logoImageView" />
<TextView
style="@style/TextAppearance.Vector.Login.Text.Small"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="8dp"
android:gravity="center_horizontal"
android:text="@string/auth_recaptcha_message" />
<WebView
android:id="@+id/loginCaptchaWevView"
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_marginTop="8dp"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintTop_toBottomOf="@+id/loginCaptchaNotice" />
<WebView
android:id="@+id/loginCaptchaWevView"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_marginTop="8dp" />
</LinearLayout>
<ProgressBar
android:id="@+id/loginCaptchaProgress"
android:layout_width="60dp"
android:layout_height="60dp"
app:layout_constraintBottom_toBottomOf="@+id/loginCaptchaWevView"
app:layout_constraintEnd_toEndOf="@+id/loginCaptchaWevView"
app:layout_constraintStart_toStartOf="@+id/loginCaptchaWevView"
app:layout_constraintTop_toTopOf="@+id/loginCaptchaWevView" />
</androidx.constraintlayout.widget.ConstraintLayout>