From: Soren Stoutner Date: Thu, 25 May 2017 17:45:41 +0000 (-0700) Subject: Fix loading of new intents failing due to display images code. X-Git-Tag: v2.3~2 X-Git-Url: https://gitweb.stoutner.com/?a=commitdiff_plain;h=0c865fd72ca80ba5c1452501ea667bbe30b41b2c;p=PrivacyBrowserAndroid.git Fix loading of new intents failing due to display images code. --- diff --git a/app/src/main/java/com/stoutner/privacybrowser/activities/MainWebViewActivity.java b/app/src/main/java/com/stoutner/privacybrowser/activities/MainWebViewActivity.java index 0c80f526..107a9cee 100644 --- a/app/src/main/java/com/stoutner/privacybrowser/activities/MainWebViewActivity.java +++ b/app/src/main/java/com/stoutner/privacybrowser/activities/MainWebViewActivity.java @@ -205,7 +205,7 @@ public class MainWebViewActivity extends AppCompatActivity implements Navigation private boolean adBlockerEnabled; // `privacyBrowserRuntime` is used in `onCreate()` and `applyAppSettings()`. - Runtime privacyBrowserRuntime; + private Runtime privacyBrowserRuntime; // `incognitoModeEnabled` is used in `onCreate()` and `applyAppSettings()`. private boolean incognitoModeEnabled; @@ -237,6 +237,9 @@ public class MainWebViewActivity extends AppCompatActivity implements Navigation // `onTheFlyDisplayImagesSet` is used in `applyDomainSettings()` and `setDisplayWebpageImages()`. private boolean onTheFlyDisplayImagesSet; + // `loadingNewIntentBoolean` is used in `onNewIntent()` and `onRestart()`. + private boolean loadingNewIntentBoolean; + // `waitingForOrbotData` is used in `onCreate()` and `applyAppSettings()`. private String waitingForOrbotHTMLString; @@ -906,6 +909,32 @@ public class MainWebViewActivity extends AppCompatActivity implements Navigation } } + @Override + protected void onNewIntent(Intent intent) { + // Set `loadingNewIntentBoolean`. + loadingNewIntentBoolean = true; + + // Sets the new intent as the activity intent, so that any future `getIntent()`s pick up this one instead of creating a new activity. + setIntent(intent); + + if (intent.getData() != null) { + // Get the intent data and convert it to a string. + final Uri intentUriData = intent.getData(); + formattedUrlString = intentUriData.toString(); + } + + // Close the navigation drawer if it is open. + if (drawerLayout.isDrawerVisible(GravityCompat.START)) { + drawerLayout.closeDrawer(GravityCompat.START); + } + + // Load the website. + loadUrl(formattedUrlString); + + // Clear the keyboard if displayed and remove the focus on the urlTextBar if it has it. + mainWebView.requestFocus(); + } + @Override public void onRestart() { super.onRestart(); @@ -919,8 +948,14 @@ public class MainWebViewActivity extends AppCompatActivity implements Navigation // Set the display webpage images mode. setDisplayWebpageImages(); - // Reload the webpage to remove images if `setDisplayWebpageImages` has turned them off. - mainWebView.reload(); + // Only reload `mainWebView` if not loading a new intent. + if (!loadingNewIntentBoolean) { + // Reload the webpage to remove images if `setDisplayWebpageImages` has turned them off. + mainWebView.reload(); + } else { + // Reset `loadingNewIntentBoolean`. + loadingNewIntentBoolean = false; + } } // `onResume()` runs after `onStart()`, which runs after `onCreate()` and `onRestart()`. @@ -956,29 +991,6 @@ public class MainWebViewActivity extends AppCompatActivity implements Navigation super.onPause(); } - @Override - protected void onNewIntent(Intent intent) { - // Sets the new intent as the activity intent, so that any future `getIntent()`s pick up this one instead of creating a new activity. - setIntent(intent); - - if (intent.getData() != null) { - // Get the intent data and convert it to a string. - final Uri intentUriData = intent.getData(); - formattedUrlString = intentUriData.toString(); - } - - // Close the navigation drawer if it is open. - if (drawerLayout.isDrawerVisible(GravityCompat.START)) { - drawerLayout.closeDrawer(GravityCompat.START); - } - - // Load the website. - loadUrl(formattedUrlString); - - // Clear the keyboard if displayed and remove the focus on the urlTextBar if it has it. - mainWebView.requestFocus(); - } - @Override public boolean onCreateOptionsMenu(Menu menu) { // Inflate the menu; this adds items to the action bar if it is present. diff --git a/app/src/main/res/values-de/strings.xml b/app/src/main/res/values-de/strings.xml index 0ab6a131..f6cf1220 100644 --- a/app/src/main/res/values-de/strings.xml +++ b/app/src/main/res/values-de/strings.xml @@ -85,7 +85,7 @@ URL URL: - + Navigationspanel Navigation Startseite @@ -100,7 +100,7 @@ Infos Leeren und verlassen - + JavaScript Erstanbieter-Cookies Drittanbieter-Cookies diff --git a/app/src/main/res/values-es/strings.xml b/app/src/main/res/values-es/strings.xml index 3d19033b..bc3caf9e 100644 --- a/app/src/main/res/values-es/strings.xml +++ b/app/src/main/res/values-es/strings.xml @@ -117,6 +117,7 @@ 150% 175% 200% + Mostrar imágenes Buscar en página Compartir Añadir a la ventana de inicio @@ -189,6 +190,11 @@ Configuración de dominio guardada Dominio eliminado *. puede ser añadido a un dominio para incluir todos los subdominios (p.ej. *.stoutner.com) + + Por defecto del sistema + Imágenes habilitadas + Imágenes deshabilitadas + Guía de Navegador Privado @@ -283,6 +289,8 @@ Algunas webs no funcionan bien si la opción deslizar para actualizar está habilitada. Mostrar iconos adicionales en la barra de aplicación Mostrar iconos para alternar entre cookies, almacenamiento DOM, y datos de formulario en la barra de aplicación, si hay espacio. + Mostrar imágenes de la página web + Deshabilitar para conservar ancho de banda. Enviar a través de Orbot no funcionará a menos que se instale Orbot. diff --git a/app/src/main/res/values-it/strings.xml b/app/src/main/res/values-it/strings.xml index 2a811071..3c6a05d4 100644 --- a/app/src/main/res/values-it/strings.xml +++ b/app/src/main/res/values-it/strings.xml @@ -86,7 +86,7 @@ URL URL: - + Menù di navigazione Navigazione Home @@ -101,16 +101,16 @@ Informazioni Elimina dati ed esci - + JavaScript Cookies proprietari Cookies di terze parti - DOM Storage + DOM storage Dati dei moduli - Elimina Cookies - Elimina DOM Storage + Elimina cookies + Elimina DOM storage Elimina dati dei moduli - Dimensione Font + Dimensione font 25% 50% 75% @@ -119,11 +119,12 @@ 150% 175% 200% + Mostra immagini Cerca nella pagina Condividi Aggiungi collegamento Stampa - Pagina Web di Privacy Browser + Pagina web di Privacy Browser Aggiorna @@ -191,6 +192,11 @@ Impostazioni Domini Salvate Dominio Eliminato è possibile anteporre *. a un dominio per includere tutti i sottodomini (es. *.stoutner.com) + + Impostazioni di default + Abilita Immagini + Disabilita Immagini + Guida di Privacy Browser @@ -285,6 +291,8 @@ Alcuni siti non funzionano correttamente se questa opzione è abilitata. Mostra icone addizionali nella barra dell\'applicazione Mostra le icone per l\'abilitazione dei cookies, del DOM storage, e dei dati dei moduli nella barra dell\'applicazione se c\'è spazio disponibile. + Mostra immagini delle pagine web + Disabilita per ridurre il consumo di dati. Il Proxy con Orbot funziona solo se è installato Orbot. diff --git a/app/src/main/res/values-zh-rTW/strings.xml b/app/src/main/res/values-zh-rTW/strings.xml index aed97ad5..d03678fa 100644 --- a/app/src/main/res/values-zh-rTW/strings.xml +++ b/app/src/main/res/values-zh-rTW/strings.xml @@ -88,7 +88,7 @@ URL URL: - + Navigation Drawer Navigation Home @@ -103,7 +103,7 @@ About Clear and Exit - + JavaScript First-Party Cookies Third-Party Cookies @@ -121,6 +121,7 @@ 150% 175% 200% + Display Images Find on Page Share Add to Home Screen @@ -193,6 +194,11 @@ Domain settings saved Domain deleted *. may be prepended to a domain to include all subdomains (eg. *.stoutner.com) + + System default + Images enabled + Images disabled + Privacy Browser Guide @@ -287,6 +293,8 @@ Some websites don\'t work well if swipe to refresh is enabled. Display additional app bar icons Display icons for toggling cookies, DOM storage, and form data in the app bar if there is room. + Display webpage images + Disable to conserve bandwidth. Orbot proxy will not work unless Orbot is installed. diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml index b7109d2e..5d1b86ae 100644 --- a/app/src/main/res/values/strings.xml +++ b/app/src/main/res/values/strings.xml @@ -88,7 +88,7 @@ URL URL: - + Navigation Drawer Navigation Home @@ -103,7 +103,7 @@ About Clear and Exit - + JavaScript First-Party Cookies Third-Party Cookies