Handle redirection
This commit is contained in:
parent
9d3a8e7c40
commit
8ff6fbb153
|
@ -20,6 +20,7 @@ package im.vector.riotredesign.core.utils
|
||||||
|
|
||||||
import android.content.Context
|
import android.content.Context
|
||||||
import android.webkit.WebView
|
import android.webkit.WebView
|
||||||
|
import android.webkit.WebViewClient
|
||||||
import androidx.appcompat.app.AlertDialog
|
import androidx.appcompat.app.AlertDialog
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -29,9 +30,13 @@ import androidx.appcompat.app.AlertDialog
|
||||||
*/
|
*/
|
||||||
fun Context.displayInWebView(url: String) {
|
fun Context.displayInWebView(url: String) {
|
||||||
val wv = WebView(this)
|
val wv = WebView(this)
|
||||||
|
|
||||||
|
// Set a WebViewClient to ensure redirection is handled directly in the WebView
|
||||||
|
wv.webViewClient = WebViewClient()
|
||||||
|
|
||||||
wv.loadUrl(url)
|
wv.loadUrl(url)
|
||||||
AlertDialog.Builder(this)
|
AlertDialog.Builder(this)
|
||||||
.setView(wv)
|
.setView(wv)
|
||||||
.setPositiveButton(android.R.string.ok, null)
|
.setPositiveButton(android.R.string.ok, null)
|
||||||
.show()
|
.show()
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue