From feca0fdd5129f23c694c00ef171d40c65f68ffce Mon Sep 17 00:00:00 2001 From: Soren Stoutner Date: Tue, 6 Jun 2023 13:37:26 -0700 Subject: [PATCH] Fix restoring of the current page on restart. https://redmine.stoutner.com/issues/1015 --- .../activities/MainWebViewActivity.kt | 13 +++++++++++-- app/src/main/res/values-es/strings.xml | 2 ++ 2 files changed, 13 insertions(+), 2 deletions(-) diff --git a/app/src/main/java/com/stoutner/privacybrowser/activities/MainWebViewActivity.kt b/app/src/main/java/com/stoutner/privacybrowser/activities/MainWebViewActivity.kt index 8614ec7b..0dab90f1 100644 --- a/app/src/main/java/com/stoutner/privacybrowser/activities/MainWebViewActivity.kt +++ b/app/src/main/java/com/stoutner/privacybrowser/activities/MainWebViewActivity.kt @@ -3968,8 +3968,17 @@ class MainWebViewActivity : AppCompatActivity(), CreateBookmarkDialog.CreateBook // Set the first page as the current WebView. setCurrentWebView(0) } else { // The first tab is not selected. - // Move to the selected tab. - webViewViewPager2.currentItem = savedTabPosition + // Create a handler move to the page. + val setCurrentPageHandler = Handler(Looper.getMainLooper()) + + // Create a runnable to move to the page. + val setCurrentPageRunnable = Runnable { + // Move to the page. + webViewViewPager2.currentItem = savedTabPosition + } + + // Move to the page after 50 milliseconds, which should be enough time to for the WebView state adapter to populate the restored pages. + setCurrentPageHandler.postDelayed(setCurrentPageRunnable, 50) } // Get the intent that started the app. diff --git a/app/src/main/res/values-es/strings.xml b/app/src/main/res/values-es/strings.xml index aeafdde6..fa21f36f 100644 --- a/app/src/main/res/values-es/strings.xml +++ b/app/src/main/res/values-es/strings.xml @@ -270,6 +270,8 @@ Ordenados por ID de base de datos. Ordenados por orden de visualización. ID de base de datos: + ID de carpeta: + \u0020 – %1$d Carpeta: Carpeta superior: Mostrar orden: -- 2.45.2