Compare commits
4 Commits
master
...
banki_temp
| Author | SHA1 | Date |
|---|---|---|
|
|
64f528e3a3 | |
|
|
988388fbd7 | |
|
|
014ca85eeb | |
|
|
64ee4be35d |
|
|
@ -5,6 +5,7 @@ import android.os.Bundle
|
|||
import android.view.View
|
||||
import androidx.activity.OnBackPressedCallback
|
||||
import androidx.annotation.IdRes
|
||||
import androidx.annotation.LayoutRes
|
||||
import androidx.fragment.app.Fragment
|
||||
import me.vponomarenko.injectionmanager.customlifecycle.StoredComponent
|
||||
import ru.terrakok.cicerone.Navigator
|
||||
|
|
@ -17,7 +18,9 @@ import ru.touchin.roboswag.navigation_base.scopes.FeatureScope
|
|||
import ru.touchin.roboswag.navigation_cicerone.CiceroneTuner
|
||||
import javax.inject.Inject
|
||||
|
||||
abstract class FlowFragment<TComponent> : Fragment(R.layout.fragment_flow) {
|
||||
abstract class FlowFragment<TComponent>(
|
||||
@LayoutRes layoutId: Int = R.layout.fragment_flow
|
||||
) : Fragment(layoutId) {
|
||||
|
||||
@Inject
|
||||
@FlowNavigation
|
||||
|
|
|
|||
|
|
@ -20,20 +20,21 @@ open class BaseWebViewClient(private val callback: WebViewCallback, private val
|
|||
|
||||
private var isError = false
|
||||
private var isTimeout = true
|
||||
private var handler: Handler? = null
|
||||
|
||||
override fun onPageStarted(view: WebView, url: String, favicon: Bitmap?) {
|
||||
super.onPageStarted(view, url, favicon)
|
||||
isError = false
|
||||
isTimeout = true
|
||||
callback.onStateChanged(WebViewLoadingState.LOADING)
|
||||
|
||||
Looper.myLooper()?.let { looper ->
|
||||
val handler = Handler(looper)
|
||||
handler.postDelayed(WEB_VIEW_TIMEOUT_MS) {
|
||||
handler = Handler(looper)
|
||||
handler?.postDelayed(WEB_VIEW_TIMEOUT_MS) {
|
||||
if (isTimeout) {
|
||||
isError = true
|
||||
pageFinished()
|
||||
}
|
||||
isTimeout = true
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -45,6 +46,7 @@ open class BaseWebViewClient(private val callback: WebViewCallback, private val
|
|||
override fun onPageFinished(view: WebView, url: String) {
|
||||
super.onPageFinished(view, url)
|
||||
isTimeout = false
|
||||
handler?.removeCallbacksAndMessages(null)
|
||||
if (url == "about:blank") {
|
||||
isError = true
|
||||
}
|
||||
|
|
@ -77,7 +79,9 @@ open class BaseWebViewClient(private val callback: WebViewCallback, private val
|
|||
* onReceivedError isn't called when url is "about:blank" (url string isBlank)
|
||||
*/
|
||||
override fun onReceivedError(view: WebView, request: WebResourceRequest, error: WebResourceError) {
|
||||
isError = true
|
||||
if (view.url == request.url.toString()) {
|
||||
isError = true
|
||||
}
|
||||
}
|
||||
|
||||
private fun pageFinished() {
|
||||
|
|
|
|||
Loading…
Reference in New Issue