File tree Expand file tree Collapse file tree 1 file changed +14
-2
lines changed
app/src/main/java/com/duckduckgo/app/browser Expand file tree Collapse file tree 1 file changed +14
-2
lines changed Original file line number Diff line number Diff line change @@ -891,19 +891,31 @@ class BrowserTabFragment :
891
891
Timber .d(" Resuming webview: $tabId " )
892
892
webView?.let { webView ->
893
893
if (webView.isShown) {
894
+ webView.ensureVisible()
894
895
webView.onResume()
895
896
} else if (swipingTabsFeature.isEnabled) {
896
- // Sometimes the tab is brought back from the background but the WebView is not visible yet due to
897
- // ViewPager page change delay; this fixes an issue when a tab was blank .
897
+ // Sometimes a tab is brought back from the background but the WebView is not shown yet due to
898
+ // ViewPager page change delay; this makes sure the WebView is resumed when it is shown .
898
899
webView.post {
899
900
if (webView.isShown) {
901
+ webView.ensureVisible()
900
902
webView.onResume()
901
903
}
902
904
}
905
+ } else {
906
+ Timber .d(" WebView is not shown, not resuming" )
903
907
}
904
908
}
905
909
}
906
910
911
+ // This is a hack to make sure the WebView content is always rendered when the fragment is resumed
912
+ private fun DuckDuckGoWebView.ensureVisible () = postDelayed(100 ) {
913
+ if (swipingTabsFeature.isEnabled) {
914
+ scrollBy(0 , 1 )
915
+ scrollBy(0 , - 1 )
916
+ }
917
+ }
918
+
907
919
override fun onActivityCreated (savedInstanceState : Bundle ? ) {
908
920
super .onActivityCreated(savedInstanceState)
909
921
omnibar = Omnibar (settingsDataStore.omnibarPosition, visualDesignExperimentDataStore.getOmnibarType(), binding)
You can’t perform that action at this time.
0 commit comments