Skip to content

Commit

Permalink
Simplify the process to configure WebView
Browse files Browse the repository at this point in the history
  • Loading branch information
AbandonedCart committed Apr 25, 2024
1 parent 7beb24f commit 5aec30a
Showing 1 changed file with 7 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -135,15 +135,13 @@ class WebsiteFragment : Fragment() {

fun loadWebsite(address: String?) {
var website = address
if (null != mWebView) {
mWebView?.let { view ->
if (null == website) website = WEBSITE_README
val webViewSettings = mWebView?.settings
if (null != webViewSettings) {
webViewSettings.setSupportZoom(true)
webViewSettings.builtInZoomControls = true
}
mWebView?.loadUrl(website)
} else {
val webViewSettings = view.settings
webViewSettings.setSupportZoom(true)
webViewSettings.builtInZoomControls = true
website?.let { view.loadUrl(it) }
} ?: {
val delayedUrl = website
webHandler.postDelayed({ loadWebsite(delayedUrl) }, TagMo.uiDelay.toLong())
}
Expand Down Expand Up @@ -254,4 +252,4 @@ class WebsiteFragment : Fragment() {
companion object {
private const val WEBSITE_README = "https://tagmo.gitlab.io/"
}
}
}

0 comments on commit 5aec30a

Please sign in to comment.