]> gitweb.stoutner.com Git - PrivacyBrowserAndroid.git/commitdiff
Fix the current WebView sometimes being set wrong. https://redmine.stoutner.com...
authorSoren Stoutner <soren@stoutner.com>
Tue, 14 May 2019 22:30:57 +0000 (15:30 -0700)
committerSoren Stoutner <soren@stoutner.com>
Tue, 14 May 2019 22:30:57 +0000 (15:30 -0700)
app/src/main/java/com/stoutner/privacybrowser/activities/MainWebViewActivity.java
app/src/main/res/values-de/strings.xml
app/src/main/res/values-es/strings.xml
app/src/main/res/values-it/strings.xml
app/src/main/res/values-ru/strings.xml
app/src/main/res/values-tr/strings.xml
app/src/main/res/values/strings.xml

index 74faf1123ce70444afab3ef1514b2fbb79800521..43a17fa5091f63e42c793b94505a520f7d1aacf2 100644 (file)
@@ -1900,13 +1900,8 @@ public class MainWebViewActivity extends AppCompatActivity implements CreateBook
 
                 // Update the swipe refresh layout.
                 if (currentWebView.getSwipeToRefresh()) {  // Swipe to refresh is enabled.
-                    if (Build.VERSION.SDK_INT >= 23) {  // For API >= 23, the status of the scroll refresh listener is continuously updated by the on scroll change listener.
-                        // Only enable the swipe refresh layout if the WebView is scrolled to the top.
-                        swipeRefreshLayout.setEnabled(currentWebView.getY() == 0);
-                    } else {  // For API < 23, the swipe refresh layout is always enabled.
-                        // Enable the swipe refresh layout.
-                        swipeRefreshLayout.setEnabled(true);
-                    }
+                    // Only enable the swipe refresh layout if the WebView is scrolled to the top.  It is updated every time the scroll changes.
+                    swipeRefreshLayout.setEnabled(currentWebView.getY() == 0);
                 } else {  // Swipe to refresh is disabled.
                     // Disable the swipe refresh layout.
                     swipeRefreshLayout.setEnabled(false);
@@ -4283,7 +4278,7 @@ public class MainWebViewActivity extends AppCompatActivity implements CreateBook
         EditText urlEditText = findViewById(R.id.url_edittext);
         SwipeRefreshLayout swipeRefreshLayout = findViewById(R.id.swiperefreshlayout);
 
-        //Stop the swipe to refresh indicator if it is running
+        // Stop the swipe to refresh indicator if it is running
         swipeRefreshLayout.setRefreshing(false);
 
         // Get the WebView tab fragment.
@@ -4293,19 +4288,14 @@ public class MainWebViewActivity extends AppCompatActivity implements CreateBook
         View fragmentView = webViewTabFragment.getView();
 
         // Set the current WebView if the fragment view is not null.
-        if (fragmentView != null) {
+        if (fragmentView != null) {  // The fragment has been populated.
             // Store the current WebView.
             currentWebView = fragmentView.findViewById(R.id.nestedscroll_webview);
 
             // Update the status of swipe to refresh.
             if (currentWebView.getSwipeToRefresh()) {  // Swipe to refresh is enabled.
-                if (Build.VERSION.SDK_INT >= 23) {  // For API >= 23, swipe refresh layout is continuously updated with an on scroll change listener and only enabled if the WebView is scrolled to the top.
-                    // Enable the swipe refresh layout if the WebView is scrolled all the way to the top.
-                    swipeRefreshLayout.setEnabled(currentWebView.getY() == 0);
-                } else {
-                    // Enable the swipe refresh layout.
-                    swipeRefreshLayout.setEnabled(true);
-                }
+                // Enable the swipe refresh layout if the WebView is scrolled all the way to the top.  It is updated every time the scroll changes.
+                swipeRefreshLayout.setEnabled(currentWebView.getY() == 0);
             } else {  // Swipe to refresh is disabled.
                 // Disable the swipe refresh layout.
                 swipeRefreshLayout.setEnabled(false);
@@ -4369,6 +4359,18 @@ public class MainWebViewActivity extends AppCompatActivity implements CreateBook
             } else {
                 urlRelativeLayout.setBackground(getResources().getDrawable(R.color.transparent));
             }
+        } else {  // The fragment has not been populated.  Try again in 100 milliseconds.
+            // Create a handler to set the current WebView.
+            Handler setCurrentWebViewHandler = new Handler();
+
+            // Create a runnable to set the current WebView.
+            Runnable setCurrentWebWebRunnable = () -> {
+                // Set the current WebView.
+                setCurrentWebView(pageNumber);
+            };
+
+            // Try setting the current WebView again after 100 milliseconds.
+            setCurrentWebViewHandler.postDelayed(setCurrentWebWebRunnable, 100);
         }
     }
 
index 46801728a2bc25312463aa0bb20faa30cb0d3d76..54a3f11d872535d782ff83c74f18705e6f826ccc 100644 (file)
         <string name="clear_cookies">Cookies löschen</string>
         <string name="clear_dom_storage">DOM-Speicher löschen</string>
         <string name="clear_form_data">Formulardaten löschen</string>
-    <string name="options_fanboys_annoyance_list">Fanboy’s Annoyance Sperrliste</string>
-    <string name="options_fanboys_social_blocking_list">Fanboy’s Social Blocking Sperrliste</string>
-    <string name="options_block_all_third_party_requests">Alle Zugriffe auf Dritt-Anbieter-Inhalte blockieren</string>
+        <string name="options_fanboys_annoyance_list">Fanboy’s Annoyance Sperrliste</string>
+        <string name="options_fanboys_social_blocking_list">Fanboy’s Social Blocking Sperrliste</string>
+        <string name="options_block_all_third_party_requests">Alle Zugriffe auf Dritt-Anbieter-Inhalte blockieren</string>
+    <string name="page">Seite</string>
         <string name="options_user_agent">User Agent</string>
             <string name="user_agent_privacy_browser">Privacy Browser</string>
             <string name="user_agent_webview_default">WebView-Standard</string>
index a56de1916e27e7f36a44a1df15362494af6512ce..f3dc8833783f93daa1d5ff5336756dfdf7335aa2 100644 (file)
         <string name="clear_cookies">Borrar cookies</string>
         <string name="clear_dom_storage">Borrar almacenamiento DOM</string>
         <string name="clear_form_data">Borrar datos de formulario</string>  <!-- The form data strings can be removed once the minimum API >= 26. -->
-    <string name="options_fanboys_annoyance_list">Lista molesta de Fanboy</string>
-    <string name="options_fanboys_social_blocking_list">Lista de bloqueo social de Fanboy</string>
-    <string name="options_block_all_third_party_requests">Bloquear todas las solicitudes de terceros</string>
+        <string name="options_fanboys_annoyance_list">Lista molesta de Fanboy</string>
+        <string name="options_fanboys_social_blocking_list">Lista de bloqueo social de Fanboy</string>
+        <string name="options_block_all_third_party_requests">Bloquear todas las solicitudes de terceros</string>
+    <string name="page">Página</string>
         <string name="options_user_agent">Agente de usuario</string>
             <string name="user_agent_privacy_browser">Navegador Privado</string>
             <string name="user_agent_webview_default">WebView por defecto</string>
index f774fae440039642609eb2a8b2bb2855c7b31727..ed934bc7524d95ca82576f6dc851a8767b396037 100644 (file)
         <string name="clear_cookies">Elimina cookies</string>
         <string name="clear_dom_storage">Elimina DOM storage</string>
         <string name="clear_form_data">Elimina dati dei moduli</string>
-    <string name="options_fanboys_annoyance_list">Fanboy’s annoyance list</string>
-    <string name="options_fanboys_social_blocking_list">Fanboy’s social blocking list</string>
-    <string name="options_block_all_third_party_requests">Blocca tutte le richieste di Terze Parti</string>
+        <string name="options_fanboys_annoyance_list">Fanboy’s annoyance list</string>
+        <string name="options_fanboys_social_blocking_list">Fanboy’s social blocking list</string>
+        <string name="options_block_all_third_party_requests">Blocca tutte le richieste di Terze Parti</string>
+    <string name="page">Pagina</string>
         <string name="options_user_agent">User agent</string>
             <string name="user_agent_privacy_browser">Privacy Browser</string>
             <string name="user_agent_webview_default">WebView Default</string>
             <string name="one_hundred_seventy_five_percent">175%</string>
             <string name="two_hundred_percent">200%</string>
         <string name="swipe_to_refresh_options_menu">Swipe per aggiornare</string>
+        <string name="wide_viewport">Finestra grande</string>
         <string name="display_images">Mostra immagini</string>
         <string name="options_night_mode">Modalità Notte</string>
         <string name="find_on_page">Cerca nella pagina</string>
     </string-array>
     <string-array name="wide_viewport_array">
         <item>Impostazioni di default</item>
-        <item>Wide viewport enabled</item>
-        <item>Wide viewport disabled</item>
+        <item>Finestra grande abilitata</item>
+        <item>Finestra grande disabilitata</item>
     </string-array>
     <string-array name="display_webpage_images_array">
         <item>Impostazioni di default</item>
         <string name="dark_theme_summary">La modifica del tema provocherà il riavvio di Privacy Browser.</string>
         <string name="night_mode">Modalità Notte</string>
         <string name="night_mode_summary">L\'abilitazione della modalità notte attiva anche JavaScript per tutte le pagine web.</string>
+        <string name="wide_viewport_preference">Finestra grande</string>
+        <string name="wide_viewport_summary">L\'utilizzo di una finestra grande permette la visualizzazione di alcune pagine web come in modalità desktop.</string>
         <string name="display_webpage_images">Mostra immagini delle pagine web</string>
         <string name="display_webpage_images_summary">Disabilita per ridurre il consumo di dati.</string>
 
index 42c639bf165c353c7aca875f66dcd0573056c79b..ab422e04ad374f5cb738184edead7e4e8c8aaacd 100644 (file)
         <string name="clear_cookies">Очистить cookie</string>
         <string name="clear_dom_storage"> Очистить DOM-хранилище</string>
         <string name="clear_form_data">Очистить данные формы</string>
-    <string name="options_fanboys_annoyance_list">Fanboy’s annoyance list</string>
-    <string name="options_fanboys_social_blocking_list">Fanboy’s social blocking list</string>
-    <string name="options_block_all_third_party_requests">Блокировать все сторонние запросы</string>
+        <string name="options_fanboys_annoyance_list">Fanboy’s annoyance list</string>
+        <string name="options_fanboys_social_blocking_list">Fanboy’s social blocking list</string>
+        <string name="options_block_all_third_party_requests">Блокировать все сторонние запросы</string>
+    <string name="page">Страница</string>
         <string name="options_user_agent">User agent</string>
             <string name="user_agent_privacy_browser">Privacy Browser</string>
             <string name="user_agent_webview_default">WebView по умолчанию</string>
index 9994beab64150d8b446ea78ff217e45ffb252131..5eda4fab4d1db103a62cba889edf3e5b7d0cbd4a 100644 (file)
         <string name="clear_cookies">Çerezleri Temizle</string>
         <string name="clear_dom_storage">DOM Depolamasını Temizle</string>
         <string name="clear_form_data">Form Verisini Temizle</string>  <!-- The form data strings can be removed once the minimum API >= 26. -->
-    <string name="options_fanboys_annoyance_list">Fanboy’s Annoyance List</string>
-    <string name="options_fanboys_social_blocking_list">Fanboy’s Social Blocking List</string>
-    <string name="options_block_all_third_party_requests">Tüm Üçüncü Taraf İstekleri Engelle</string>
+        <string name="options_fanboys_annoyance_list">Fanboy’s Annoyance List</string>
+        <string name="options_fanboys_social_blocking_list">Fanboy’s Social Blocking List</string>
+        <string name="options_block_all_third_party_requests">Tüm Üçüncü Taraf İstekleri Engelle</string>
+    <string name="page">Sayfa</string>
         <string name="options_user_agent">Kullanıcı aracısı</string>
             <string name="user_agent_privacy_browser">Privacy Browser</string>
             <string name="user_agent_webview_default">Varsayılan WebView</string>
index dcff833fed73656b515a7b3eeae7002ca6b26e9d..3c8dd00a1737c4d272913d60995e3ad5cb899aa6 100644 (file)
         <string name="clear_cookies">Clear Cookies</string>
         <string name="clear_dom_storage">Clear DOM Storage</string>
         <string name="clear_form_data">Clear Form Data</string>  <!-- The form data strings can be removed once the minimum API >= 26. -->
-    <string name="options_fanboys_annoyance_list">Fanboy’s Annoyance List</string>
-    <string name="options_fanboys_social_blocking_list">Fanboy’s Social Blocking List</string>
-    <string name="options_block_all_third_party_requests">Block All Third-Party Requests</string>
+        <string name="options_fanboys_annoyance_list">Fanboy’s Annoyance List</string>
+        <string name="options_fanboys_social_blocking_list">Fanboy’s Social Blocking List</string>
+        <string name="options_block_all_third_party_requests">Block All Third-Party Requests</string>
     <string name="page">Page</string>
         <string name="options_user_agent">User Agent</string>
             <string name="user_agent_privacy_browser">Privacy Browser</string>