From: Soren Stoutner Date: Sat, 7 Jul 2018 10:38:59 +0000 (-0700) Subject: Add a requests activity. https://redmine.stoutner.com/issues/170 X-Git-Tag: v2.11~2 X-Git-Url: https://gitweb.stoutner.com/?a=commitdiff_plain;h=012e5595c82d6e8d0b8a46f1ef18a02a56341182;p=PrivacyBrowserAndroid.git Add a requests activity. https://redmine.stoutner.com/issues/170 --- diff --git a/app/build.gradle b/app/build.gradle index f9d18aa9..9e2cc421 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -77,5 +77,5 @@ dependencies { freeImplementation 'com.google.firebase:firebase-ads:15.0.1' // Only compile the consent library for the free flavor. It is used to comply with the GDPR in Europe. - freeImplementation 'com.google.android.ads.consent:consent-library:1.0.4' + freeImplementation 'com.google.android.ads.consent:consent-library:1.0.6' } \ No newline at end of file diff --git a/app/src/main/AndroidManifest.xml b/app/src/main/AndroidManifest.xml index 8f6a8a50..de72063f 100644 --- a/app/src/main/AndroidManifest.xml +++ b/app/src/main/AndroidManifest.xml @@ -115,8 +115,8 @@ `android:persistableMode="persistNever"` removes Privacy Browser from the recent apps list on a device reboot. `tools:ignore="unusedAttribute"` removes the lint warning that `persistableMode` does not apply to API < 21. --> + + + diff --git a/app/src/main/assets/de/about_links_dark.html b/app/src/main/assets/de/about_links_dark.html index 27c7a331..0c7f3213 100644 --- a/app/src/main/assets/de/about_links_dark.html +++ b/app/src/main/assets/de/about_links_dark.html @@ -28,19 +28,19 @@

Websites

-

+

News

-

+

Roadmap

-

+

Bug-Tracker und Feature-Anfragen

-

+

Forum

-

+

GitWeb

\ No newline at end of file diff --git a/app/src/main/assets/de/about_links_light.html b/app/src/main/assets/de/about_links_light.html index b65cead0..256e94f5 100644 --- a/app/src/main/assets/de/about_links_light.html +++ b/app/src/main/assets/de/about_links_light.html @@ -28,19 +28,19 @@

Websites

-

+

News

-

+

Roadmap

-

+

Bug-Tracker und Feature-Anfragen

-

+

Forum

-

+

GitWeb

\ No newline at end of file diff --git a/app/src/main/assets/de/guide_bookmarks_dark.html b/app/src/main/assets/de/guide_bookmarks_dark.html index 623cc265..87d17efa 100644 --- a/app/src/main/assets/de/guide_bookmarks_dark.html +++ b/app/src/main/assets/de/guide_bookmarks_dark.html @@ -24,7 +24,7 @@ -

Lesezeichen

+

Lesezeichen

Bookmarks can be accessed in a drawer layout by swiping from the right of the screen.

diff --git a/app/src/main/assets/de/guide_bookmarks_light.html b/app/src/main/assets/de/guide_bookmarks_light.html index 6e6b3962..1e7eb3a1 100644 --- a/app/src/main/assets/de/guide_bookmarks_light.html +++ b/app/src/main/assets/de/guide_bookmarks_light.html @@ -24,7 +24,7 @@ -

Lesezeichen

+

Lesezeichen

Bookmarks can be accessed in a drawer layout by swiping from the right of the screen.

diff --git a/app/src/main/assets/de/guide_domain_settings_dark.html b/app/src/main/assets/de/guide_domain_settings_dark.html index 0573cd99..fad6583e 100644 --- a/app/src/main/assets/de/guide_domain_settings_dark.html +++ b/app/src/main/assets/de/guide_domain_settings_dark.html @@ -24,7 +24,7 @@ -

Secure Web Browsing

+

Secure Web Browsing

Privacy Browser’s default is to browse with JavaScript, cookies, and DOM storage disabled. However, some websites legitimately need these features enabled to function correctly. diff --git a/app/src/main/assets/de/guide_domain_settings_light.html b/app/src/main/assets/de/guide_domain_settings_light.html index dbc135f4..a110bc34 100644 --- a/app/src/main/assets/de/guide_domain_settings_light.html +++ b/app/src/main/assets/de/guide_domain_settings_light.html @@ -24,7 +24,7 @@ -

Secure Web Browsing

+

Secure Web Browsing

Privacy Browser’s default is to browse with JavaScript, cookies, and DOM storage disabled. However, some websites legitimately need these features enabled to function correctly. diff --git a/app/src/main/assets/de/guide_local_storage_dark.html b/app/src/main/assets/de/guide_local_storage_dark.html index 5a327736..40f34e6d 100644 --- a/app/src/main/assets/de/guide_local_storage_dark.html +++ b/app/src/main/assets/de/guide_local_storage_dark.html @@ -77,14 +77,14 @@ Deshalb aktiviert das Aktivieren von Erstanbieter-Cookies zugleich auch Drittanbieter-Cookies.

-

DOM-Speicher

+

DOM-Speicher

Der Document Object Model-Speicher, auch bekannt als Web-Speicher, ist wie Cookies auf Steroiden. Während die maximale Gesamtspeichergrße für alle Cookies von einer einzigen URL 4kb beträgt, kann der DOM-Speicher zwischen 5-25 Megabytes pro Seite betragen. Da der DOM-Speicher Javascript zum Lesen und Schreiben von Daten nutzt, ändert das Aktivieren also nichts, solange nicht auch Javascript aktiviert ist.

-

Formulardaten

+

Formulardaten

Formulardaten beinhalten die Informationen, die in Web-Formularen eingegeben werden, wie Benutzernamen, Adressen, Telefonnummern etc. und listet sie als Auswahlmenü auf künftig besuchten Websites auf. Ungleich der anderen Arten der lokalen Datenspeicherung werden Formulardaten nicht ohne die explizite Handlung des Nutzers an den Webserver gesendet.

diff --git a/app/src/main/assets/de/guide_local_storage_light.html b/app/src/main/assets/de/guide_local_storage_light.html index 19026265..e15db6ad 100644 --- a/app/src/main/assets/de/guide_local_storage_light.html +++ b/app/src/main/assets/de/guide_local_storage_light.html @@ -76,14 +76,14 @@ Deshalb aktiviert das Aktivieren von Erstanbieter-Cookies zugleich auch Drittanbieter-Cookies.

-

DOM-Speicher

+

DOM-Speicher

Der Document Object Model-Speicher, auch bekannt als Web-Speicher, ist wie Cookies auf Steroiden. Während die maximale Gesamtspeichergrße für alle Cookies von einer einzigen URL 4kb beträgt, kann der DOM-Speicher zwischen 5-25 Megabytes pro Seite betragen. Da der DOM-Speicher Javascript zum Lesen und Schreiben von Daten nutzt, ändert das Aktivieren also nichts, solange nicht auch Javascript aktiviert ist.

-

Formulardaten

+

Formulardaten

Formulardaten beinhalten die Informationen, die in Web-Formularen eingegeben werden, wie Benutzernamen, Adressen, Telefonnummern etc. und listet sie als Auswahlmenü auf künftig besuchten Websites auf. Ungleich der anderen Arten der lokalen Datenspeicherung werden Formulardaten nicht ohne die explizite Handlung des Nutzers an den Webserver gesendet.

diff --git a/app/src/main/assets/de/guide_ssl_certificates_dark.html b/app/src/main/assets/de/guide_ssl_certificates_dark.html index f59deec1..d24d78c6 100644 --- a/app/src/main/assets/de/guide_ssl_certificates_dark.html +++ b/app/src/main/assets/de/guide_ssl_certificates_dark.html @@ -24,7 +24,7 @@ -

Connect with Confidence

+

Connect with Confidence

When visiting an encrypted URL (one that begins with HTTPS), the webserver uses an SSL certificate to both encrypt the information sent to the browser and to identify the server. The purpose of the server identification is to prevent a machine located between the browser and the webserver from pretending to be the server and decrypting the information in transit. diff --git a/app/src/main/assets/de/guide_ssl_certificates_light.html b/app/src/main/assets/de/guide_ssl_certificates_light.html index 8b1b0a75..21a12f2f 100644 --- a/app/src/main/assets/de/guide_ssl_certificates_light.html +++ b/app/src/main/assets/de/guide_ssl_certificates_light.html @@ -24,7 +24,7 @@ -

Connect with Confidence

+

Connect with Confidence

When visiting an encrypted URL (one that begins with HTTPS), the webserver uses an SSL certificate to both encrypt the information sent to the browser and to identify the server. The purpose of the server identification is to prevent a machine located between the browser and the webserver from pretending to be the server and decrypting the information in transit. diff --git a/app/src/main/assets/de/guide_tracking_ids_dark.html b/app/src/main/assets/de/guide_tracking_ids_dark.html index 9f02c1c8..70079102 100644 --- a/app/src/main/assets/de/guide_tracking_ids_dark.html +++ b/app/src/main/assets/de/guide_tracking_ids_dark.html @@ -26,7 +26,7 @@ -

Do Not Track

+

Do Not Track

A few years ago the W3C (World Wide Web Consortium) created a mechanism for browsers to inform web servers that they would not like to be tracked. This is accomplished by including a DNT (Do Not Track) header with web requests.

diff --git a/app/src/main/assets/de/guide_tracking_ids_light.html b/app/src/main/assets/de/guide_tracking_ids_light.html index 09b98a81..345372be 100644 --- a/app/src/main/assets/de/guide_tracking_ids_light.html +++ b/app/src/main/assets/de/guide_tracking_ids_light.html @@ -26,7 +26,7 @@ -

Do Not Track

+

Do Not Track

A few years ago the W3C (World Wide Web Consortium) created a mechanism for browsers to inform web servers that they would not like to be tracked. This is accomplished by including a DNT (Do Not Track) header with web requests.

diff --git a/app/src/main/assets/de/guide_user_agent_dark.html b/app/src/main/assets/de/guide_user_agent_dark.html index 7036bf88..52c4b80d 100644 --- a/app/src/main/assets/de/guide_user_agent_dark.html +++ b/app/src/main/assets/de/guide_user_agent_dark.html @@ -26,7 +26,7 @@ -

Browser-Identifikation

+

Browser-Identifikation

Wenn Internetbrowser sich mit Websites verbinden senden sie einen sog. User Agent, welcher den Browser und die Rendering-Möglichkeiten an die Website kommuniziert. Die Website kann diese Informationen nutzen, um zu entscheiden, welche Version der Website diff --git a/app/src/main/assets/de/guide_user_agent_light.html b/app/src/main/assets/de/guide_user_agent_light.html index db3856c1..9b9cfec9 100644 --- a/app/src/main/assets/de/guide_user_agent_light.html +++ b/app/src/main/assets/de/guide_user_agent_light.html @@ -26,7 +26,7 @@ -

Browser-Identifikation

+

Browser-Identifikation

Wenn Internetbrowser sich mit Websites verbinden senden sie einen sog. User Agent, welcher den Browser und die Rendering-Möglichkeiten an die Website kommuniziert. Die Website kann diese Informationen nutzen, um zu entscheiden, welche Version der Website diff --git a/app/src/main/assets/en/about_links_dark.html b/app/src/main/assets/en/about_links_dark.html index 7b5e4a62..7f5cd124 100644 --- a/app/src/main/assets/en/about_links_dark.html +++ b/app/src/main/assets/en/about_links_dark.html @@ -26,19 +26,19 @@

Websites

-

+

News

-

+

Roadmap

-

+

Bug Tracker and Feature Requests

-

+

Forum

-

+

GitWeb

\ No newline at end of file diff --git a/app/src/main/assets/en/about_links_light.html b/app/src/main/assets/en/about_links_light.html index 4e5d9605..8bc38d67 100644 --- a/app/src/main/assets/en/about_links_light.html +++ b/app/src/main/assets/en/about_links_light.html @@ -26,19 +26,19 @@

Websites

-

+

News

-

+

Roadmap

-

+

Bug Tracker and Feature Requests

-

+

Forum

-

+

GitWeb

\ No newline at end of file diff --git a/app/src/main/assets/en/guide_bookmarks_dark.html b/app/src/main/assets/en/guide_bookmarks_dark.html index 3d781bc8..1fb1b097 100644 --- a/app/src/main/assets/en/guide_bookmarks_dark.html +++ b/app/src/main/assets/en/guide_bookmarks_dark.html @@ -24,7 +24,7 @@ -

Bookmarks

+

Bookmarks

Bookmarks can be accessed in a drawer layout by swiping from the right of the screen.

diff --git a/app/src/main/assets/en/guide_bookmarks_light.html b/app/src/main/assets/en/guide_bookmarks_light.html index 6b95654a..d82bbe73 100644 --- a/app/src/main/assets/en/guide_bookmarks_light.html +++ b/app/src/main/assets/en/guide_bookmarks_light.html @@ -24,7 +24,7 @@ -

Bookmarks

+

Bookmarks

Bookmarks can be accessed in a drawer layout by swiping from the right of the screen.

diff --git a/app/src/main/assets/en/guide_domain_settings_dark.html b/app/src/main/assets/en/guide_domain_settings_dark.html index acc25a81..57f7d294 100644 --- a/app/src/main/assets/en/guide_domain_settings_dark.html +++ b/app/src/main/assets/en/guide_domain_settings_dark.html @@ -24,7 +24,7 @@ -

Secure Web Browsing

+

Secure Web Browsing

Privacy Browser’s default is to browse with JavaScript, cookies, and DOM storage disabled. However, some websites legitimately need these features enabled to function correctly. diff --git a/app/src/main/assets/en/guide_domain_settings_light.html b/app/src/main/assets/en/guide_domain_settings_light.html index a58851c9..3edf86ff 100644 --- a/app/src/main/assets/en/guide_domain_settings_light.html +++ b/app/src/main/assets/en/guide_domain_settings_light.html @@ -24,7 +24,7 @@ -

Secure Web Browsing

+

Secure Web Browsing

Privacy Browser’s default is to browse with JavaScript, cookies, and DOM storage disabled. However, some websites legitimately need these features enabled to function correctly. diff --git a/app/src/main/assets/en/guide_local_storage_dark.html b/app/src/main/assets/en/guide_local_storage_dark.html index c0020ed6..8a3b0e79 100644 --- a/app/src/main/assets/en/guide_local_storage_dark.html +++ b/app/src/main/assets/en/guide_local_storage_dark.html @@ -76,14 +76,14 @@ between first-party and third-party cookies. Thus, enabling first-party cookies will also enable third-party cookies.

-

DOM Storage

+

DOM Storage

Document Object Model storage, also known as web storage, is like cookies on steroids. Whereas the maximum combined storage size for all cookies from a single URL is 4 kilobytes, DOM storage can hold megabytes per site. Because DOM storage uses JavaScript to read and write data, enabling it will do nothing unless JavaScript is also enabled.

-

Form Data

+

Form Data

Form data contains information typed into web forms, like user names, addresses, phone numbers, etc., and lists them in a drop-down box on future visits. Unlike the other forms of local storage, form data is not sent to the web server without specific user interaction.

diff --git a/app/src/main/assets/en/guide_local_storage_light.html b/app/src/main/assets/en/guide_local_storage_light.html index 4a249ea4..72f17672 100644 --- a/app/src/main/assets/en/guide_local_storage_light.html +++ b/app/src/main/assets/en/guide_local_storage_light.html @@ -76,14 +76,14 @@ between first-party and third-party cookies. Thus, enabling first-party cookies will also enable third-party cookies.

-

DOM Storage

+

DOM Storage

Document Object Model storage, also known as web storage, is like cookies on steroids. Whereas the maximum combined storage size for all cookies from a single URL is 4 kilobytes, DOM storage can hold megabytes per site. Because DOM storage uses JavaScript to read and write data, enabling it will do nothing unless JavaScript is also enabled.

-

Form Data

+

Form Data

Form data contains information typed into web forms, like user names, addresses, phone numbers, etc., and lists them in a drop-down box on future visits. Unlike the other forms of local storage, form data is not sent to the web server without specific user interaction.

diff --git a/app/src/main/assets/en/guide_ssl_certificates_dark.html b/app/src/main/assets/en/guide_ssl_certificates_dark.html index f59deec1..d24d78c6 100644 --- a/app/src/main/assets/en/guide_ssl_certificates_dark.html +++ b/app/src/main/assets/en/guide_ssl_certificates_dark.html @@ -24,7 +24,7 @@ -

Connect with Confidence

+

Connect with Confidence

When visiting an encrypted URL (one that begins with HTTPS), the webserver uses an SSL certificate to both encrypt the information sent to the browser and to identify the server. The purpose of the server identification is to prevent a machine located between the browser and the webserver from pretending to be the server and decrypting the information in transit. diff --git a/app/src/main/assets/en/guide_ssl_certificates_light.html b/app/src/main/assets/en/guide_ssl_certificates_light.html index 8b1b0a75..21a12f2f 100644 --- a/app/src/main/assets/en/guide_ssl_certificates_light.html +++ b/app/src/main/assets/en/guide_ssl_certificates_light.html @@ -24,7 +24,7 @@ -

Connect with Confidence

+

Connect with Confidence

When visiting an encrypted URL (one that begins with HTTPS), the webserver uses an SSL certificate to both encrypt the information sent to the browser and to identify the server. The purpose of the server identification is to prevent a machine located between the browser and the webserver from pretending to be the server and decrypting the information in transit. diff --git a/app/src/main/assets/en/guide_tracking_ids_dark.html b/app/src/main/assets/en/guide_tracking_ids_dark.html index 60697c10..021a4055 100644 --- a/app/src/main/assets/en/guide_tracking_ids_dark.html +++ b/app/src/main/assets/en/guide_tracking_ids_dark.html @@ -24,7 +24,7 @@ -

Do Not Track

+

Do Not Track

A few years ago the W3C (World Wide Web Consortium) created a mechanism for browsers to inform web servers that they would not like to be tracked. This is accomplished by including a DNT (Do Not Track) header with web requests.

diff --git a/app/src/main/assets/en/guide_tracking_ids_light.html b/app/src/main/assets/en/guide_tracking_ids_light.html index 51b0e892..3f6cc044 100644 --- a/app/src/main/assets/en/guide_tracking_ids_light.html +++ b/app/src/main/assets/en/guide_tracking_ids_light.html @@ -24,7 +24,7 @@ -

Do Not Track

+

Do Not Track

A few years ago the W3C (World Wide Web Consortium) created a mechanism for browsers to inform web servers that they would not like to be tracked. This is accomplished by including a DNT (Do Not Track) header with web requests.

diff --git a/app/src/main/assets/en/guide_user_agent_dark.html b/app/src/main/assets/en/guide_user_agent_dark.html index a676db63..b8a8e9e7 100644 --- a/app/src/main/assets/en/guide_user_agent_dark.html +++ b/app/src/main/assets/en/guide_user_agent_dark.html @@ -24,7 +24,7 @@ -

Browser Identification

+

Browser Identification

When web browsers connect to websites, they send a user agent, which identifies the browser and the rendering capabilities it possesses. The web server can use this information to decide which version of the website to send to the browser. diff --git a/app/src/main/assets/en/guide_user_agent_light.html b/app/src/main/assets/en/guide_user_agent_light.html index bcfee5f0..3a40c54f 100644 --- a/app/src/main/assets/en/guide_user_agent_light.html +++ b/app/src/main/assets/en/guide_user_agent_light.html @@ -24,7 +24,7 @@ -

Browser Identification

+

Browser Identification

When web browsers connect to websites, they send a user agent, which identifies the browser and the rendering capabilities it possesses. The web server can use this information to decide which version of the website to send to the browser. diff --git a/app/src/main/assets/es/about_links_dark.html b/app/src/main/assets/es/about_links_dark.html index 8ab2399a..6c29029b 100644 --- a/app/src/main/assets/es/about_links_dark.html +++ b/app/src/main/assets/es/about_links_dark.html @@ -28,14 +28,19 @@

Páginas web

-

Noticias

+

+ Noticias

-

Hoja de ruta

+

+ Hoja de ruta

-

Seguimiento de errores y petición de funciones

+

+ Seguimiento de errores y petición de funciones

-

Foro

+

+ Foro

-

GitWeb

+

+ GitWeb

\ No newline at end of file diff --git a/app/src/main/assets/es/about_links_light.html b/app/src/main/assets/es/about_links_light.html index 8ad430b9..5b96f8a6 100644 --- a/app/src/main/assets/es/about_links_light.html +++ b/app/src/main/assets/es/about_links_light.html @@ -28,14 +28,19 @@

Páginas web

-

Noticias

+

+ Noticias

-

Hoja de ruta

+

+ Hoja de ruta

-

Seguimiento de errores y petición de funciones

+

+ Seguimiento de errores y petición de funciones

-

Foro

+

+ Foro

-

GitWeb

+

+ GitWeb

\ No newline at end of file diff --git a/app/src/main/assets/es/guide_bookmarks_dark.html b/app/src/main/assets/es/guide_bookmarks_dark.html index a8138b6f..6321df28 100644 --- a/app/src/main/assets/es/guide_bookmarks_dark.html +++ b/app/src/main/assets/es/guide_bookmarks_dark.html @@ -26,7 +26,7 @@ -

Favoritos

+

Favoritos

Se puede acceder a los favoritos en un diseño de cajón deslizando desde la derecha de la pantalla.

diff --git a/app/src/main/assets/es/guide_bookmarks_light.html b/app/src/main/assets/es/guide_bookmarks_light.html index c0b462c9..a62c5fa7 100644 --- a/app/src/main/assets/es/guide_bookmarks_light.html +++ b/app/src/main/assets/es/guide_bookmarks_light.html @@ -26,7 +26,7 @@ -

Favoritos

+

Favoritos

Se puede acceder a los favoritos en un diseño de cajón deslizando desde la derecha de la pantalla.

diff --git a/app/src/main/assets/es/guide_domain_settings_dark.html b/app/src/main/assets/es/guide_domain_settings_dark.html index 6e6109b8..248f1f4f 100644 --- a/app/src/main/assets/es/guide_domain_settings_dark.html +++ b/app/src/main/assets/es/guide_domain_settings_dark.html @@ -26,7 +26,7 @@ -

Navegación web segura

+

Navegación web segura

Por defecto Navegador Privado navega con Javascript, cookies y almacenamiento DOM desactivados. Sin embargo, algunas páginas web necesitan legítimamente estas características para funcionar correctamente. diff --git a/app/src/main/assets/es/guide_domain_settings_light.html b/app/src/main/assets/es/guide_domain_settings_light.html index c15c2f85..30620516 100644 --- a/app/src/main/assets/es/guide_domain_settings_light.html +++ b/app/src/main/assets/es/guide_domain_settings_light.html @@ -26,7 +26,7 @@ -

Navegación web segura

+

Navegación web segura

Por defecto Navegador Privado navega con Javascript, cookies y almacenamiento DOM desactivados. Sin embargo, algunas páginas web necesitan legítimamente estas características para funcionar correctamente. diff --git a/app/src/main/assets/es/guide_local_storage_dark.html b/app/src/main/assets/es/guide_local_storage_dark.html index a758ea7f..37f1dd83 100644 --- a/app/src/main/assets/es/guide_local_storage_dark.html +++ b/app/src/main/assets/es/guide_local_storage_dark.html @@ -71,7 +71,7 @@ y de terceras partes. Así que habilitando las cookies de primera parte se habilitarán también las de terceras partes.

-

Almacenamiento DOM

+

Almacenamiento DOM

El almacenamiento Modelo de Objeto de Documento (Document Object Model), también conocido como almacenamiento web, es como cookies pero más poderoso. Mientras el tamaño de almacenamiento combinado máximo para todas las cookies de una única URL es de 4 kilobytes, @@ -79,7 +79,7 @@ Debido a que el almacenamiento DOM usa Javascript para leer y escribir los datos, habilitarlo no hará nada a menos que Javascript sea habilitado también.

-

Datos de formulario

+

Datos de formulario

Los datos de formulario contienen información escrita en formularios web, como nombres de usuario, direcciones, números de teléfono, etcétera, y los enumera en un cuadro desplegable en futuras visitas. diff --git a/app/src/main/assets/es/guide_local_storage_light.html b/app/src/main/assets/es/guide_local_storage_light.html index b532b7da..e2ec4909 100644 --- a/app/src/main/assets/es/guide_local_storage_light.html +++ b/app/src/main/assets/es/guide_local_storage_light.html @@ -72,7 +72,7 @@ y de terceras partes. Así que habilitando las cookies de primera parte se habilitarán también las de terceras partes.

-

Almacenamiento DOM

+

Almacenamiento DOM

El almacenamiento Modelo de Objeto de Documento (Document Object Model), también conocido como almacenamiento web, es como cookies pero más poderoso. Mientras el tamaño de almacenamiento combinado máximo para todas las cookies de una única URL es de 4 kilobytes, @@ -80,7 +80,7 @@ Debido a que el almacenamiento DOM usa Javascript para leer y escribir los datos, habilitarlo no hará nada a menos que Javascript sea habilitado también.

-

Datos de formulario

+

Datos de formulario

Los datos de formulario contienen información escrita en formularios web, como nombres de usuario, direcciones, números de teléfono, etcétera, y los enumera en un cuadro desplegable en futuras visitas. diff --git a/app/src/main/assets/es/guide_ssl_certificates_dark.html b/app/src/main/assets/es/guide_ssl_certificates_dark.html index 93b0192b..0b21cc4d 100644 --- a/app/src/main/assets/es/guide_ssl_certificates_dark.html +++ b/app/src/main/assets/es/guide_ssl_certificates_dark.html @@ -26,7 +26,7 @@ -

Conectar con confianza

+

Conectar con confianza

Al visitar una URL cifrada (que empieza con HTTPS), el servidor web usa un certificado SSL para cifrar tanto la información enviada al navegador como asimismo para identificar al servidor. El propósito de la identificación del servidor es para prevenir que una máquina ubicada entre el navegador y el servidor web pretenda ser el servidor y descifrar la información en tránsito. diff --git a/app/src/main/assets/es/guide_ssl_certificates_light.html b/app/src/main/assets/es/guide_ssl_certificates_light.html index 5bdb367a..49c422d3 100644 --- a/app/src/main/assets/es/guide_ssl_certificates_light.html +++ b/app/src/main/assets/es/guide_ssl_certificates_light.html @@ -26,7 +26,7 @@ -

Conectar con confianza

+

Conectar con confianza

Al visitar una URL cifrada (que empieza con HTTPS), el servidor web usa un certificado SSL para cifrar tanto la información enviada al navegador como asimismo para identificar al servidor. El propósito de la identificación del servidor es para prevenir que una máquina ubicada entre el navegador y el servidor web pretenda ser el servidor y descifrar la información en tránsito. diff --git a/app/src/main/assets/es/guide_tracking_ids_dark.html b/app/src/main/assets/es/guide_tracking_ids_dark.html index a00544e8..20cca827 100644 --- a/app/src/main/assets/es/guide_tracking_ids_dark.html +++ b/app/src/main/assets/es/guide_tracking_ids_dark.html @@ -26,7 +26,7 @@ -

No Rastrear

+

No Rastrear

Hace algunos años la W3C (Consorcio Mundial de la Red) creó un mecanismo para que los navegadores informaran a los servidores web que no les gustaría ser rastreados. Esto se logra incluyendo un encabezado DNT (Do Not Track o No Rastrear) con las solicitudes web.

diff --git a/app/src/main/assets/es/guide_tracking_ids_light.html b/app/src/main/assets/es/guide_tracking_ids_light.html index 0739b34f..376b9b6c 100644 --- a/app/src/main/assets/es/guide_tracking_ids_light.html +++ b/app/src/main/assets/es/guide_tracking_ids_light.html @@ -26,7 +26,7 @@ -

No Rastrear

+

No Rastrear

Hace algunos años la W3C (Consorcio Mundial de la Red) creó un mecanismo para que los navegadores informaran a los servidores web que no les gustaría ser rastreados. Esto se logra incluyendo un encabezado DNT (Do Not Track o No Rastrear) con las solicitudes web.

diff --git a/app/src/main/assets/es/guide_user_agent_dark.html b/app/src/main/assets/es/guide_user_agent_dark.html index 6a0f55dd..b222a0e5 100644 --- a/app/src/main/assets/es/guide_user_agent_dark.html +++ b/app/src/main/assets/es/guide_user_agent_dark.html @@ -26,7 +26,7 @@ -

Identificación del navegador

+

Identificación del navegador

Cuando los navegadores web se conectan a las páginas web, envían un agente de usuario, que identifica al navegador y a las capacidades de rendering que posee. El servidor web puede usar esta información para decidir qué versión de página web enviar al navegador. diff --git a/app/src/main/assets/es/guide_user_agent_light.html b/app/src/main/assets/es/guide_user_agent_light.html index 78e28da6..c4145405 100644 --- a/app/src/main/assets/es/guide_user_agent_light.html +++ b/app/src/main/assets/es/guide_user_agent_light.html @@ -26,7 +26,7 @@ -

Identificación del navegador

+

Identificación del navegador

Cuando los navegadores web se conectan a las páginas web, envían un agente de usuario, que identifica al navegador y a las capacidades de rendering que posee. El servidor web puede usar esta información para decidir qué versión de página web enviar al navegador. diff --git a/app/src/main/assets/it/about_links_dark.html b/app/src/main/assets/it/about_links_dark.html index e3e7782d..e9e451dd 100644 --- a/app/src/main/assets/it/about_links_dark.html +++ b/app/src/main/assets/it/about_links_dark.html @@ -28,18 +28,18 @@

Collegamenti

-

+

Novità

-

Roadmap

+

Roadmap

-

+

Segnalazioni di Bug e richieste di nuove funzionalità

-

+

Forum

-

+

GitWeb

\ No newline at end of file diff --git a/app/src/main/assets/it/about_links_light.html b/app/src/main/assets/it/about_links_light.html index 5d058c65..8756e15a 100644 --- a/app/src/main/assets/it/about_links_light.html +++ b/app/src/main/assets/it/about_links_light.html @@ -28,18 +28,18 @@

Collegamenti

-

+

Novità

-

Roadmap

+

Roadmap

-

+

Segnalazioni di Bug e richieste di nuove funzionalità

-

+

Forum

-

+

GitWeb

\ No newline at end of file diff --git a/app/src/main/assets/it/guide_bookmarks_dark.html b/app/src/main/assets/it/guide_bookmarks_dark.html index 7ca33e80..2b3514c1 100644 --- a/app/src/main/assets/it/guide_bookmarks_dark.html +++ b/app/src/main/assets/it/guide_bookmarks_dark.html @@ -26,7 +26,7 @@ -

Segnalibri

+

Segnalibri

E' possibile visualizzare i segnalibri attraverso un cassetto che si apre scorrendo dal lato destro dello schermo.

diff --git a/app/src/main/assets/it/guide_bookmarks_light.html b/app/src/main/assets/it/guide_bookmarks_light.html index 514cfa98..0c30500d 100644 --- a/app/src/main/assets/it/guide_bookmarks_light.html +++ b/app/src/main/assets/it/guide_bookmarks_light.html @@ -26,7 +26,7 @@ -

Segnalibri

+

Segnalibri

E' possibile visualizzare i segnalibri attraverso un cassetto che si apre scorrendo dal lato destro dello schermo.

diff --git a/app/src/main/assets/ru/about_links_dark.html b/app/src/main/assets/ru/about_links_dark.html index 92035ded..151ec018 100644 --- a/app/src/main/assets/ru/about_links_dark.html +++ b/app/src/main/assets/ru/about_links_dark.html @@ -26,19 +26,19 @@

Websites

-

+

Новости

-

+

Дорожная карта

-

+

Система отслеживания ошибок и пожеланий

-

+

Форум

-

+

GitWeb

\ No newline at end of file diff --git a/app/src/main/assets/ru/about_links_light.html b/app/src/main/assets/ru/about_links_light.html index ae3b8b12..eeb9e5c6 100644 --- a/app/src/main/assets/ru/about_links_light.html +++ b/app/src/main/assets/ru/about_links_light.html @@ -26,19 +26,19 @@

Websites

-

+

Новости

-

+

Дорожная карта

-

+

Система отслеживания ошибок и пожеланий

-

+

Форум

-

+

GitWeb

\ No newline at end of file diff --git a/app/src/main/assets/ru/guide_bookmarks_dark.html b/app/src/main/assets/ru/guide_bookmarks_dark.html index ce412f34..3bd043d7 100644 --- a/app/src/main/assets/ru/guide_bookmarks_dark.html +++ b/app/src/main/assets/ru/guide_bookmarks_dark.html @@ -24,7 +24,7 @@ -

Закладки

+

Закладки

К закладкам можно получить доступ из боковой панели, выполнив свайп от правой части экрана.

diff --git a/app/src/main/assets/ru/guide_bookmarks_light.html b/app/src/main/assets/ru/guide_bookmarks_light.html index 3508bf5e..a3d3d6fe 100644 --- a/app/src/main/assets/ru/guide_bookmarks_light.html +++ b/app/src/main/assets/ru/guide_bookmarks_light.html @@ -24,7 +24,7 @@ -

Закладки

+

Закладки

К закладкам можно получить доступ из боковой панели, выполнив свайп от правой части экрана.

diff --git a/app/src/main/assets/ru/guide_domain_settings_dark.html b/app/src/main/assets/ru/guide_domain_settings_dark.html index b7da2e7a..2dd3d129 100644 --- a/app/src/main/assets/ru/guide_domain_settings_dark.html +++ b/app/src/main/assets/ru/guide_domain_settings_dark.html @@ -24,7 +24,7 @@ -

Безопасный просмотр веб-страниц

+

Безопасный просмотр веб-страниц

По умолчанию в Privacy Browser отключены JavaScript, файлы cookie и хранилище DOM. Однако, для правильной работы, некоторым веб-сайтам эти опции необходимы. Настройки домена могут автоматически включать нужный набор опций при посещении определенного домена.

diff --git a/app/src/main/assets/ru/guide_domain_settings_light.html b/app/src/main/assets/ru/guide_domain_settings_light.html index 89385d55..15e9ff57 100644 --- a/app/src/main/assets/ru/guide_domain_settings_light.html +++ b/app/src/main/assets/ru/guide_domain_settings_light.html @@ -24,7 +24,7 @@ -

Безопасный просмотр веб-страниц

+

Безопасный просмотр веб-страниц

По умолчанию в Privacy Browser отключены JavaScript, файлы cookie и хранилище DOM. Однако, для правильной работы, некоторым веб-сайтам эти опции необходимы. Настройки домена могут автоматически включать нужный набор опций при посещении определенного домена.

diff --git a/app/src/main/assets/ru/guide_local_storage_dark.html b/app/src/main/assets/ru/guide_local_storage_dark.html index c885d43f..9116af9b 100644 --- a/app/src/main/assets/ru/guide_local_storage_dark.html +++ b/app/src/main/assets/ru/guide_local_storage_dark.html @@ -75,7 +75,7 @@ Таким образом, включение первичных файлов cookie также разрешит и сторонние.

-

Хранилище DOM

+

Хранилище DOM

Хранилище объектной модели документа (Document Object Model), также известное как веб-хранилище, называют cookie (печенье) на стероидах. В то время как максимальный объем хранения для всех файлов cookie с одного URL-адреса составляет 4 килобайта, @@ -83,7 +83,7 @@ Поскольку хранилище DOM использует JavaScript для чтения и записи данных, включение его ни на что не влияет при отключенном JavaScript.

-

Данные формы

+

Данные формы

Данные формы содержат информацию, вводимую в веб-формы, такие как имена пользователей, адреса, телефонные номера и т. д., и перечисляются в раскрывающемся списке при будущих посещениях. В отличие от других форм локального хранилища данные формы не отправляются на веб-сервер без специального взаимодействия с пользователем.

diff --git a/app/src/main/assets/ru/guide_local_storage_light.html b/app/src/main/assets/ru/guide_local_storage_light.html index 7f6fc938..43733933 100644 --- a/app/src/main/assets/ru/guide_local_storage_light.html +++ b/app/src/main/assets/ru/guide_local_storage_light.html @@ -75,7 +75,7 @@ Таким образом, включение первичных файлов cookie также разрешит и сторонние.

-

Хранилище DOM

+

Хранилище DOM

Хранилище объектной модели документа (Document Object Model), также известное как веб-хранилище, называют cookie (печенье) на стероидах. В то время как максимальный объем хранения для всех файлов cookie с одного URL-адреса составляет 4 килобайта, @@ -83,7 +83,7 @@ Поскольку хранилище DOM использует JavaScript для чтения и записи данных, включение его ни на что не влияет при отключенном JavaScript.

-

Данные формы

+

Данные формы

Данные формы содержат информацию, вводимую в веб-формы, такие как имена пользователей, адреса, телефонные номера и т. д., и перечисляются в раскрывающемся списке при будущих посещениях. В отличие от других форм локального хранилища данные формы не отправляются на веб-сервер без специального взаимодействия с пользователем.

diff --git a/app/src/main/assets/ru/guide_ssl_certificates_dark.html b/app/src/main/assets/ru/guide_ssl_certificates_dark.html index e067d059..871c4c1a 100644 --- a/app/src/main/assets/ru/guide_ssl_certificates_dark.html +++ b/app/src/main/assets/ru/guide_ssl_certificates_dark.html @@ -24,7 +24,7 @@ -

Подключение с уверенностью

+

Подключение с уверенностью

При посещении зашифрованного URL (тот, который начинается с HTTPS) веб-сервер использует сертификат SSL для шифрования информации, отправленной в браузер, и для идентификации сервера. Цель идентификации сервера состоит в том, чтобы запретить машине, расположенной между браузером и веб-сервером, притворяться сервером и дешифровать информацию во время ее транзита. diff --git a/app/src/main/assets/ru/guide_ssl_certificates_light.html b/app/src/main/assets/ru/guide_ssl_certificates_light.html index debb7c4b..8c67ae15 100644 --- a/app/src/main/assets/ru/guide_ssl_certificates_light.html +++ b/app/src/main/assets/ru/guide_ssl_certificates_light.html @@ -24,7 +24,7 @@ -

Подключение с уверенностью

+

Подключение с уверенностью

При посещении зашифрованного URL (тот, который начинается с HTTPS) веб-сервер использует сертификат SSL для шифрования информации, отправленной в браузер, и для идентификации сервера. Цель идентификации сервера состоит в том, чтобы запретить машине, расположенной между браузером и веб-сервером, притворяться сервером и дешифровать информацию во время ее транзита. diff --git a/app/src/main/assets/ru/guide_tracking_ids_dark.html b/app/src/main/assets/ru/guide_tracking_ids_dark.html index ed8c2b0f..aeff868f 100644 --- a/app/src/main/assets/ru/guide_tracking_ids_dark.html +++ b/app/src/main/assets/ru/guide_tracking_ids_dark.html @@ -24,7 +24,7 @@ -

Не отслеживать

+

Не отслеживать

Несколько лет назад W3C (консорциум World Wide Web) создал механизм для браузеров для информирования веб-серверов о том, что они не хотели бы отслеживаться. Это достигается путем включения заголовка DNT (Не отслеживать) в веб-запросы.

diff --git a/app/src/main/assets/ru/guide_tracking_ids_light.html b/app/src/main/assets/ru/guide_tracking_ids_light.html index 3b23acbf..595282f0 100644 --- a/app/src/main/assets/ru/guide_tracking_ids_light.html +++ b/app/src/main/assets/ru/guide_tracking_ids_light.html @@ -24,7 +24,7 @@ -

Не отслеживать

+

Не отслеживать

Несколько лет назад W3C (консорциум World Wide Web) создал механизм для браузеров для информирования веб-серверов о том, что они не хотели бы отслеживаться. Это достигается путем включения заголовка DNT (Не отслеживать) в веб-запросы.

diff --git a/app/src/main/assets/ru/guide_user_agent_dark.html b/app/src/main/assets/ru/guide_user_agent_dark.html index eba45f6d..376aeca8 100644 --- a/app/src/main/assets/ru/guide_user_agent_dark.html +++ b/app/src/main/assets/ru/guide_user_agent_dark.html @@ -24,7 +24,7 @@ -

Идентификация браузера

+

Идентификация браузера

При подключении браузера к веб-сайтам происходит отправка пользовательского агента, который идентифицирует браузер и возможности визуализации, которыми он обладает. Веб-сервер может использовать эту информацию, чтобы решить, какую версию сайта отправить в браузер. diff --git a/app/src/main/assets/ru/guide_user_agent_light.html b/app/src/main/assets/ru/guide_user_agent_light.html index bda99591..8428944b 100644 --- a/app/src/main/assets/ru/guide_user_agent_light.html +++ b/app/src/main/assets/ru/guide_user_agent_light.html @@ -24,7 +24,7 @@ -

Идентификация браузера

+

Идентификация браузера

При подключении браузера к веб-сайтам происходит отправка пользовательского агента, который идентифицирует браузер и возможности визуализации, которыми он обладает. Веб-сервер может использовать эту информацию, чтобы решить, какую версию сайта отправить в браузер. diff --git a/app/src/main/java/com/stoutner/privacybrowser/activities/BookmarksActivity.java b/app/src/main/java/com/stoutner/privacybrowser/activities/BookmarksActivity.java index 35a1eff6..9f4231ab 100644 --- a/app/src/main/java/com/stoutner/privacybrowser/activities/BookmarksActivity.java +++ b/app/src/main/java/com/stoutner/privacybrowser/activities/BookmarksActivity.java @@ -136,15 +136,15 @@ public class BookmarksActivity extends AppCompatActivity implements CreateBookma final Toolbar bookmarksAppBar = findViewById(R.id.bookmarks_toolbar); setSupportActionBar(bookmarksAppBar); - // Get a handle for the activity, the app bar, and the `ListView`. + // Get a handle for the activity, the app bar, and the ListView. final Activity bookmarksActivity = this; appBar = getSupportActionBar(); bookmarksListView = findViewById(R.id.bookmarks_listview); - // This assert removes the incorrect warning in Android Studio on the following line that `appBar` might be null. + // Remove the incorrect lint warning that `appBar` might be null. assert appBar != null; - // Display the home arrow on `SupportActionBar`. + // Display the home arrow on the app bar. appBar.setDisplayHomeAsUpEnabled(true); // Initialize the database helper. `this` specifies the context. The two `nulls` do not specify the database name or a `CursorFactory`. diff --git a/app/src/main/java/com/stoutner/privacybrowser/activities/BookmarksDatabaseViewActivity.java b/app/src/main/java/com/stoutner/privacybrowser/activities/BookmarksDatabaseViewActivity.java index d66ae03c..006af07a 100644 --- a/app/src/main/java/com/stoutner/privacybrowser/activities/BookmarksDatabaseViewActivity.java +++ b/app/src/main/java/com/stoutner/privacybrowser/activities/BookmarksDatabaseViewActivity.java @@ -108,14 +108,14 @@ public class BookmarksDatabaseViewActivity extends AppCompatActivity implements // Remove the incorrect warning in Android Studio that `appBar` might be null. assert appBar != null; - // Display the `Spinner` and the back arrow in the `AppBar`. + // Display the spinner and the back arrow in the app bar. appBar.setCustomView(R.layout.bookmarks_databaseview_spinner); appBar.setDisplayOptions(ActionBar.DISPLAY_SHOW_CUSTOM | ActionBar.DISPLAY_HOME_AS_UP); // Initialize the database handler. `this` specifies the context. The two `null`s do not specify the database name or a `CursorFactory`. The `0` is to specify a database version, but that is set instead using a constant in `BookmarksDatabaseHelper`. bookmarksDatabaseHelper = new BookmarksDatabaseHelper(this, null, null, 0); - // Setup a `MatrixCursor` for "All Folders" and "Home Folder". + // Setup a matrix cursor for "All Folders" and "Home Folder". String[] matrixCursorColumnNames = {BookmarksDatabaseHelper._ID, BookmarksDatabaseHelper.BOOKMARK_NAME}; MatrixCursor matrixCursor = new MatrixCursor(matrixCursorColumnNames); matrixCursor.addRow(new Object[]{ALL_FOLDERS_DATABASE_ID, getString(R.string.all_folders)}); @@ -127,28 +127,26 @@ public class BookmarksDatabaseViewActivity extends AppCompatActivity implements // Combine `matrixCursor` and `foldersCursor`. MergeCursor foldersMergeCursor = new MergeCursor(new Cursor[]{matrixCursor, foldersCursor}); - // Create a `ResourceCursorAdapter` for the `Spinner` with `this` context. `0` specifies no flags.; + // Create a resource cursor adapter for the spinner. ResourceCursorAdapter foldersCursorAdapter = new ResourceCursorAdapter(this, R.layout.bookmarks_databaseview_spinner_item, foldersMergeCursor, 0) { @Override public void bindView(View view, Context context, Cursor cursor) { - // Get a handle for the `Spinner` item `TextView`. + // Get a handle for the spinner item text view. TextView spinnerItemTextView = view.findViewById(R.id.spinner_item_textview); - // Set the `TextView` to display the folder name. + // Set the text view to display the folder name. spinnerItemTextView.setText(cursor.getString(cursor.getColumnIndex(BookmarksDatabaseHelper.BOOKMARK_NAME))); } }; - // Set the `ResourceCursorAdapter` drop drown view resource. + // Set the resource cursor adapter drop drown view resource. foldersCursorAdapter.setDropDownViewResource(R.layout.bookmarks_databaseview_spinner_dropdown_item); - // Get a handle for the folder `Spinner`. + // Get a handle for the folder spinner and set the adapter. Spinner folderSpinner = findViewById(R.id.bookmarks_databaseview_spinner); - - // Set the adapter for the folder `Spinner`. folderSpinner.setAdapter(foldersCursorAdapter); - // Handle clicks on the `Spinner` dropdown. + // Handle clicks on the spinner dropdown. folderSpinner.setOnItemSelectedListener(new AdapterView.OnItemSelectedListener() { @Override public void onItemSelected(AdapterView parent, View view, int position, long id) { @@ -158,7 +156,7 @@ public class BookmarksDatabaseViewActivity extends AppCompatActivity implements // Store the current folder database ID. currentFolderDatabaseId = databaseId; - // Populate the bookmarks `ListView` based on the `Spinner` selection. + // Populate the bookmarks list view based on the spinner selection. switch (databaseId) { // Get a cursor with all the folders. case ALL_FOLDERS_DATABASE_ID: @@ -185,7 +183,7 @@ public class BookmarksDatabaseViewActivity extends AppCompatActivity implements currentFolderName = folderName; } - // Update the `ListView`. + // Update the list view. bookmarksCursorAdapter.changeCursor(bookmarksCursor); } 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 97362dfe..f594c595 100644 --- a/app/src/main/java/com/stoutner/privacybrowser/activities/MainWebViewActivity.java +++ b/app/src/main/java/com/stoutner/privacybrowser/activities/MainWebViewActivity.java @@ -154,10 +154,7 @@ public class MainWebViewActivity extends AppCompatActivity implements CreateBook HttpAuthenticationDialog.HttpAuthenticationListener, NavigationView.OnNavigationItemSelectedListener, PinnedSslCertificateMismatchDialog.PinnedSslCertificateMismatchListener, SslCertificateErrorDialog.SslCertificateErrorListener, UrlHistoryDialog.UrlHistoryListener { - // `darkTheme` is public static so it can be accessed from `AboutActivity`, `GuideActivity`, `AddDomainDialog`, `SettingsActivity`, `DomainsActivity`, `DomainsListFragment`, `BookmarksActivity`, - // `BookmarksDatabaseViewActivity`, `CreateBookmarkDialog`, `CreateBookmarkFolderDialog`, `DownloadFileDialog`, `DownloadImageDialog`, `EditBookmarkDialog`, `EditBookmarkFolderDialog`, - // `EditBookmarkDatabaseViewDialog`, `HttpAuthenticationDialog`, `MoveToFolderDialog`, `SslCertificateErrorDialog`, `UrlHistoryDialog`, `ViewSslCertificateDialog`, `CreateHomeScreenShortcutDialog`, - // and `OrbotProxyHelper`. It is also used in `onCreate()`, `applyAppSettings()`, `applyDomainSettings()`, and `updatePrivacyIcons()`. + // `darkTheme` is public static so it can be accessed from everywhere. public static boolean darkTheme; // `allowScreenshots` is public static so it can be accessed from everywhere. It is also used in `onCreate()`. @@ -200,6 +197,44 @@ public class MainWebViewActivity extends AppCompatActivity implements CreateBook public static String fanboyAnnoyanceVersion; public static String fanboySocialVersion; + // The request items are public static so they can be accessed by `BlockListHelper`, `RequestsArrayAdapter`, and `ViewRequestsDialog`. They are also used in `onCreate()`. + public static List resourceRequests; + public static String[] whiteListResultStringArray; + public final static int REQUEST_DISPOSITION = 0; + public final static int REQUEST_URL = 1; + public final static int REQUEST_BLOCKLIST = 2; + public final static int REQUEST_SUBLIST = 3; + public final static int REQUEST_BLOCKLIST_ENTRIES = 4; + public final static int REQUEST_BLOCKLIST_ORIGINAL_ENTRY = 5; + + public final static int REQUEST_DEFAULT = 0; + public final static int REQUEST_ALLOWED = 1; + public final static int REQUEST_BLOCKED = 2; + + public final static int MAIN_WHITELIST = 1; + public final static int FINAL_WHITELIST = 2; + public final static int DOMAIN_WHITELIST = 3; + public final static int DOMAIN_INITIAL_WHITELIST = 4; + public final static int DOMAIN_FINAL_WHITELIST = 5; + public final static int THIRD_PARTY_WHITELIST = 6; + public final static int THIRD_PARTY_DOMAIN_WHITELIST = 7; + public final static int THIRD_PARTY_DOMAIN_INITIAL_WHITELIST = 8; + + public final static int MAIN_BLACKLIST = 9; + public final static int INITIAL_BLACKLIST = 10; + public final static int FINAL_BLACKLIST = 11; + public final static int DOMAIN_BLACKLIST = 12; + public final static int DOMAIN_INITIAL_BLACKLIST = 13; + public final static int DOMAIN_FINAL_BLACKLIST = 14; + public final static int DOMAIN_REGULAR_EXPRESSION_BLACKLIST = 15; + public final static int THIRD_PARTY_BLACKLIST = 16; + public final static int THIRD_PARTY_INITIAL_BLACKLIST = 17; + public final static int THIRD_PARTY_DOMAIN_BLACKLIST = 18; + public final static int THIRD_PARTY_DOMAIN_INITIAL_BLACKLIST = 19; + public final static int THIRD_PARTY_REGULAR_EXPRESSION_BLACKLIST = 20; + public final static int THIRD_PARTY_DOMAIN_REGULAR_EXPRESSION_BLACKLIST = 21; + public final static int REGULAR_EXPRESSION_BLACKLIST = 22; + // `currentBookmarksFolder` is public static so it can be accessed from `BookmarksActivity`. It is also used in `onCreate()`, `onBackPressed()`, `onCreateBookmark()`, `onCreateBookmarkFolder()`, // `onSaveEditBookmark()`, `onSaveEditBookmarkFolder()`, and `loadBookmarksFolder()`. public static String currentBookmarksFolder; @@ -754,6 +789,7 @@ public class MainWebViewActivity extends AppCompatActivity implements CreateBook final MenuItem navigationBackMenuItem = navigationMenu.getItem(1); final MenuItem navigationForwardMenuItem = navigationMenu.getItem(2); final MenuItem navigationHistoryMenuItem = navigationMenu.getItem(3); + final MenuItem navigationRequestsMenuItem = navigationMenu.getItem(4); // Initialize the bookmarks database helper. `this` specifies the context. The two `nulls` do not specify the database name or a `CursorFactory`. // The `0` specifies a database version, but that is ignored and set instead using a constant in `BookmarksDatabaseHelper`. @@ -816,7 +852,7 @@ public class MainWebViewActivity extends AppCompatActivity implements CreateBook return true; }); - // The `DrawerListener` allows us to update the Navigation Menu. + // The `DrawerListener` is used to update the Navigation Menu. drawerLayout.addDrawerListener(new DrawerLayout.DrawerListener() { @Override public void onDrawerSlide(@NonNull View drawerView, float slideOffset) { @@ -833,10 +869,21 @@ public class MainWebViewActivity extends AppCompatActivity implements CreateBook @Override public void onDrawerStateChanged(int newState) { if ((newState == DrawerLayout.STATE_SETTLING) || (newState == DrawerLayout.STATE_DRAGGING)) { // The drawer is opening or closing. - // Update the `Back`, `Forward`, and `History` menu items. + // Initialize a the blocked requests counter. + int blockedRequests = 0; + + // Count the number of blocked requests. + for (int i = 0; i < resourceRequests.size(); i++) { + if (Integer.valueOf(resourceRequests.get(i)[REQUEST_DISPOSITION]) == REQUEST_BLOCKED) { + blockedRequests++; + } + } + + // Update the back, forward, history, and requests menu items. navigationBackMenuItem.setEnabled(mainWebView.canGoBack()); navigationForwardMenuItem.setEnabled(mainWebView.canGoForward()); navigationHistoryMenuItem.setEnabled((mainWebView.canGoBack() || mainWebView.canGoForward())); + navigationRequestsMenuItem.setTitle(getResources().getString(R.string.requests) + " - " + blockedRequests); // Hide the keyboard (if displayed) so we can see the navigation menu. `0` indicates no additional flags. inputMethodManager.hideSoftInputFromWindow(mainWebView.getWindowToken(), 0); @@ -1103,6 +1150,9 @@ public class MainWebViewActivity extends AppCompatActivity implements CreateBook // Instantiate the block list helper. BlockListHelper blockListHelper = new BlockListHelper(); + // Initialize the list of resource requests. + resourceRequests = new ArrayList<>(); + // Parse the block lists. final ArrayList> easyList = blockListHelper.parseBlockList(getAssets(), "blocklists/easylist.txt"); final ArrayList> easyPrivacy = blockListHelper.parseBlockList(getAssets(), "blocklists/easyprivacy.txt"); @@ -1188,13 +1238,16 @@ public class MainWebViewActivity extends AppCompatActivity implements CreateBook } } - // Check requests against the block lists. The deprecated `shouldInterceptRequest` must be used until minimum API >= 21. + // Check requests against the block lists. The deprecated `shouldInterceptRequest()` must be used until minimum API >= 21. @SuppressWarnings("deprecation") @Override public WebResourceResponse shouldInterceptRequest(WebView view, String url){ // Create an empty web resource response to be used if the resource request is blocked. WebResourceResponse emptyWebResourceResponse = new WebResourceResponse("text/plain", "utf8", new ByteArrayInputStream("".getBytes())); + // Reset `whiteListResultStringArray`. + whiteListResultStringArray = null; + // Check EasyList if it is enabled. if (easyListEnabled) { if (blockListHelper.isBlocked(formattedUrlString, url, easyList)) { @@ -1224,6 +1277,13 @@ public class MainWebViewActivity extends AppCompatActivity implements CreateBook } } + // Add the request to the log. + if (whiteListResultStringArray != null ) { // The request was processed by a whitelist. + resourceRequests.add(whiteListResultStringArray); + } else { // The request didn't match any blocklist entry. Log it as a defult request. + resourceRequests.add(new String[]{String.valueOf(REQUEST_DEFAULT), url}); + } + // The resource request has not been blocked. `return null` loads the requested resource. return null; } @@ -1241,7 +1301,11 @@ public class MainWebViewActivity extends AppCompatActivity implements CreateBook // Update the URL in urlTextBox when the page starts to load. @Override - public void onPageStarted(WebView view, String url, Bitmap favicon) {// If night mode is enabled, hide `mainWebView` until after the night mode CSS is applied. + public void onPageStarted(WebView view, String url, Bitmap favicon) { + // Reset the list of resource requests. + resourceRequests.clear(); + + // If night mode is enabled, hide `mainWebView` until after the night mode CSS is applied. if (nightMode) { mainWebView.setVisibility(View.INVISIBLE); } @@ -2184,6 +2248,12 @@ public class MainWebViewActivity extends AppCompatActivity implements CreateBook urlHistoryDialogFragment.show(getSupportFragmentManager(), getString(R.string.history)); break; + case R.id.requests: + // Launch the requests activity. + Intent requestsIntent = new Intent(this, RequestsActivity.class); + startActivity(requestsIntent); + break; + case R.id.downloads: // Launch the system Download Manager. Intent downloadManagerIntent = new Intent(DownloadManager.ACTION_VIEW_DOWNLOADS); @@ -2199,7 +2269,7 @@ public class MainWebViewActivity extends AppCompatActivity implements CreateBook reapplyDomainSettingsOnRestart = true; currentDomainName = ""; - // Launch `DomainsActivity`. + // Launch the domains activity. Intent domainsIntent = new Intent(this, DomainsActivity.class); startActivity(domainsIntent); break; @@ -2212,7 +2282,7 @@ public class MainWebViewActivity extends AppCompatActivity implements CreateBook reapplyDomainSettingsOnRestart = true; currentDomainName = ""; - // Launch `SettingsActivity`. + // Launch the settings activity. Intent settingsIntent = new Intent(this, SettingsActivity.class); startActivity(settingsIntent); break; @@ -3123,11 +3193,11 @@ public class MainWebViewActivity extends AppCompatActivity implements CreateBook // Apply any custom domain settings. applyDomainSettings(url, true, false); - // Load the URL. - mainWebView.loadUrl(url, customHeaders); - // Set `urlIsLoading` to prevent changes in the user agent on websites with redirects from reloading the current website. urlIsLoading = true; + + // Load the URL. + mainWebView.loadUrl(url, customHeaders); } public void findPreviousOnPage(View view) { diff --git a/app/src/main/java/com/stoutner/privacybrowser/activities/RequestsActivity.java b/app/src/main/java/com/stoutner/privacybrowser/activities/RequestsActivity.java new file mode 100644 index 00000000..8d91126d --- /dev/null +++ b/app/src/main/java/com/stoutner/privacybrowser/activities/RequestsActivity.java @@ -0,0 +1,217 @@ +/* + * Copyright © 2018 Soren Stoutner . + * + * This file is part of Privacy Browser . + * + * Privacy Browser is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * Privacy Browser is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with Privacy Browser. If not, see . + */ + +package com.stoutner.privacybrowser.activities; + +import android.content.Context; +import android.database.Cursor; +import android.database.MatrixCursor; +import android.os.Bundle; +import android.support.v7.app.ActionBar; +import android.support.v7.app.AppCompatActivity; +import android.support.v7.app.AppCompatDialogFragment; +import android.support.v7.widget.Toolbar; +import android.view.View; +import android.view.WindowManager; +import android.widget.AdapterView; +import android.widget.ArrayAdapter; +import android.widget.ListView; +import android.widget.ResourceCursorAdapter; +import android.widget.Spinner; +import android.widget.TextView; + +import com.stoutner.privacybrowser.R; +import com.stoutner.privacybrowser.adapters.RequestsArrayAdapter; +import com.stoutner.privacybrowser.dialogs.ViewRequestDialog; + +import java.util.ArrayList; +import java.util.List; + +public class RequestsActivity extends AppCompatActivity implements ViewRequestDialog.ViewRequestListener { + // The list view is used in `onCreate()` and `launchViewRequestDialog()`. + private ListView resourceRequestsListView; + + @Override + public void onCreate(Bundle savedInstanceState) { + // Disable screenshots if not allowed. + if (!MainWebViewActivity.allowScreenshots) { + getWindow().addFlags(WindowManager.LayoutParams.FLAG_SECURE); + } + + // Set the activity theme. + if (MainWebViewActivity.darkTheme) { + setTheme(R.style.PrivacyBrowserDark_SecondaryActivity); + } else { + setTheme(R.style.PrivacyBrowserLight_SecondaryActivity); + } + + // Run the default commands. + super.onCreate(savedInstanceState); + + // Set the content view. + setContentView(R.layout.requests_coordinatorlayout); + + // Use the `SupportActionBar` from `android.support.v7.app.ActionBar` until the minimum API is >= 21. + Toolbar blockListsAppBar = findViewById(R.id.blocklists_toolbar); + setSupportActionBar(blockListsAppBar); + + // Get a handle for the app bar and the list view. + ActionBar appBar = getSupportActionBar(); + resourceRequestsListView = findViewById(R.id.resource_requests_listview); + + // Remove the incorrect lint warning that `appBar` might be null. + assert appBar != null; + + // Display the spinner and the back arrow in the app bar. + appBar.setCustomView(R.layout.requests_spinner); + appBar.setDisplayOptions(ActionBar.DISPLAY_SHOW_CUSTOM | ActionBar.DISPLAY_HOME_AS_UP); + + // Initialize the resource array lists. + List defaultResourceRequests = new ArrayList<>(); + List allowedResourceRequests = new ArrayList<>(); + List blockedResourceRequests = new ArrayList<>(); + + // Populate the resource array lists. + for (String[] request : MainWebViewActivity.resourceRequests) { + switch (Integer.valueOf(request[MainWebViewActivity.REQUEST_DISPOSITION])) { + case MainWebViewActivity.REQUEST_DEFAULT: + defaultResourceRequests.add(request); + break; + + case MainWebViewActivity.REQUEST_ALLOWED: + allowedResourceRequests.add(request); + break; + + case MainWebViewActivity.REQUEST_BLOCKED: + blockedResourceRequests.add(request); + break; + } + } + + // Setup a matrix cursor for the resource lists. + MatrixCursor spinnerCursor = new MatrixCursor(new String[]{"_id", "Requests"}); + spinnerCursor.addRow(new Object[]{0, getString(R.string.all) + " - " + MainWebViewActivity.resourceRequests.size()}); + spinnerCursor.addRow(new Object[]{1, getString(R.string.default_label) + " - " + defaultResourceRequests.size()}); + spinnerCursor.addRow(new Object[]{2, getString(R.string.allowed) + " - " + allowedResourceRequests.size()}); + spinnerCursor.addRow(new Object[]{3, getString(R.string.blocked) + " - " + blockedResourceRequests.size()}); + + // Create a resource cursor adapter for the spinner. + ResourceCursorAdapter spinnerCursorAdapter = new ResourceCursorAdapter(this, R.layout.requests_spinner_item, spinnerCursor, 0) { + @Override + public void bindView(View view, Context context, Cursor cursor) { + // Get a handle for the spinner item text view. + TextView spinnerItemTextView = view.findViewById(R.id.spinner_item_textview); + + // Set the text view to display the resource list. + spinnerItemTextView.setText(cursor.getString(1)); + } + }; + + // Set the resource cursor adapter drop down view resource. + spinnerCursorAdapter.setDropDownViewResource(R.layout.requests_spinner_dropdown_item); + + // Get a handle for the app bar spinner and set the adapter. + Spinner appBarSpinner = findViewById(R.id.requests_spinner); + appBarSpinner.setAdapter(spinnerCursorAdapter); + + // Handle clicks on the spinner dropdown. + appBarSpinner.setOnItemSelectedListener(new AdapterView.OnItemSelectedListener() { + @Override + public void onItemSelected(AdapterView parent, View view, int position, long id) { + switch (position) { + case 0: // All requests. + // Get an adapter for all the request. + ArrayAdapter allResourceRequestsArrayAdapter = new RequestsArrayAdapter(getApplicationContext(), MainWebViewActivity.resourceRequests); + + // Display the adapter in the list view. + resourceRequestsListView.setAdapter(allResourceRequestsArrayAdapter); + break; + + case 1: // Default requests. + // Get an adapter for the default requests. + ArrayAdapter defaultResourceRequestsArrayAdapter = new RequestsArrayAdapter(getApplicationContext(), defaultResourceRequests); + + // Display the adapter in the list view. + resourceRequestsListView.setAdapter(defaultResourceRequestsArrayAdapter); + break; + + case 2: // Allowed requests. + // Get an adapter for the allowed requests. + ArrayAdapter allowedResourceRequestsArrayAdapter = new RequestsArrayAdapter(getApplicationContext(), allowedResourceRequests); + + // Display the adapter in the list view. + resourceRequestsListView.setAdapter(allowedResourceRequestsArrayAdapter); + break; + + case 3: // Blocked requests. + // Get an adapter fo the blocked requests. + ArrayAdapter blockedResourceRequestsArrayAdapter = new RequestsArrayAdapter(getApplicationContext(), blockedResourceRequests); + + // Display the adapter in the list view. + resourceRequestsListView.setAdapter(blockedResourceRequestsArrayAdapter); + break; + } + } + + @Override + public void onNothingSelected(AdapterView parent) { + // Do nothing. + } + }); + + // Create an array adapter with the list of the resource requests. + ArrayAdapter resourceRequestsArrayAdapter = new RequestsArrayAdapter(getApplicationContext(), MainWebViewActivity.resourceRequests); + + // Populate the list view with the resource requests adapter. + resourceRequestsListView.setAdapter(resourceRequestsArrayAdapter); + + // Listen for taps on entries in the list view. + resourceRequestsListView.setOnItemClickListener((AdapterView parent, View view, int position, long id) -> { + // Display the view request dialog. The list view is 0 based, so the position must be incremented by 1. + launchViewRequestDialog(position + 1); + }); + } + + @Override + public void onPrevious(int id) { + // Show the previous dialog. + launchViewRequestDialog(id -1); + } + + @Override + public void onNext(int id) { + // Show the next dialog. + launchViewRequestDialog(id + 1); + } + + private void launchViewRequestDialog(int id) { + // Determine if this is the last request in the list. + boolean isLastRequest = (id == resourceRequestsListView.getCount()); + + // Get the string array for the selected resource request. The resource requests list view is zero based. + String[] selectedRequestStringArray = (String[]) resourceRequestsListView.getItemAtPosition(id - 1); + + // Remove the warning that `selectedRequest` might be null. + assert selectedRequestStringArray != null; + + // Show the request detail dialog. + AppCompatDialogFragment viewRequestDialogFragment = ViewRequestDialog.request(id, isLastRequest, selectedRequestStringArray); + viewRequestDialogFragment.show(getSupportFragmentManager(), getString(R.string.request_details)); + } +} \ No newline at end of file diff --git a/app/src/main/java/com/stoutner/privacybrowser/adapters/HistoryArrayAdapter.java b/app/src/main/java/com/stoutner/privacybrowser/adapters/HistoryArrayAdapter.java index 0ebed74a..be6d11a8 100644 --- a/app/src/main/java/com/stoutner/privacybrowser/adapters/HistoryArrayAdapter.java +++ b/app/src/main/java/com/stoutner/privacybrowser/adapters/HistoryArrayAdapter.java @@ -1,5 +1,5 @@ /* - * Copyright © 2016-2017 Soren Stoutner . + * Copyright © 2016-2018 Soren Stoutner . * * This file is part of Privacy Browser . * @@ -40,7 +40,7 @@ public class HistoryArrayAdapter extends ArrayAdapter { private final int currentPage; public HistoryArrayAdapter(Context context, ArrayList historyArrayList, int currentPageId) { - // We need to call `super` from the base `ArrayAdapter`. `0` is the `textViewResourceId`. + // `super` must be called from the base `ArrayAdapter`. `0` is the `textViewResourceId`, which is unused. super(context, 0, historyArrayList); // Store `currentPageId` in the class variable. @@ -50,15 +50,15 @@ public class HistoryArrayAdapter extends ArrayAdapter { @Override @NonNull public View getView(int position, View convertView, @NonNull ViewGroup parent) { - // Inflate the view if it is `null`. + // Inflate the view if it is null. if (convertView == null) { // `false` does not attach `url_history_item_linearlayout` to `parent`. convertView = LayoutInflater.from(getContext()).inflate(R.layout.url_history_item_linearlayout, parent, false); } // Get handles for `favoriteIconImageView` and `urlTextView`. - ImageView favoriteIconImageView = (ImageView) convertView.findViewById(R.id.history_favorite_icon_imageview); - TextView urlTextView = (TextView) convertView.findViewById(R.id.history_url_textview); + ImageView favoriteIconImageView = convertView.findViewById(R.id.history_favorite_icon_imageview); + TextView urlTextView = convertView.findViewById(R.id.history_url_textview); // Get the URL history for this position. History history = getItem(position); diff --git a/app/src/main/java/com/stoutner/privacybrowser/adapters/RequestsArrayAdapter.java b/app/src/main/java/com/stoutner/privacybrowser/adapters/RequestsArrayAdapter.java new file mode 100644 index 00000000..e0c58cea --- /dev/null +++ b/app/src/main/java/com/stoutner/privacybrowser/adapters/RequestsArrayAdapter.java @@ -0,0 +1,127 @@ +/* + * Copyright © 2018 Soren Stoutner . + * + * This file is part of Privacy Browser . + * + * Privacy Browser is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * Privacy Browser is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with Privacy Browser. If not, see . + */ + +package com.stoutner.privacybrowser.adapters; + +import android.content.Context; +import android.support.annotation.NonNull; +import android.view.LayoutInflater; +import android.view.View; +import android.view.ViewGroup; +import android.widget.ArrayAdapter; +import android.widget.LinearLayout; +import android.widget.TextView; + +import com.stoutner.privacybrowser.R; +import com.stoutner.privacybrowser.activities.MainWebViewActivity; + +import java.util.List; + +public class RequestsArrayAdapter extends ArrayAdapter { + public RequestsArrayAdapter(Context context, List resourceRequestsList) { + // `super` must be called form the base ArrayAdapter. `0` is the `textViewResourceId`, which is unused. + super(context, 0, resourceRequestsList); + } + + @Override + @NonNull + public View getView(int position, View view, @NonNull ViewGroup parent) { + // Get a handle for the context. + Context context = getContext(); + + // Inflate the view if it is null. + if (view == null) { + view = LayoutInflater.from(context).inflate(R.layout.requests_item_linearlayout, parent, false); + } + + // Get handles for the views. + LinearLayout linearLayout = view.findViewById(R.id.request_item_linearlayout); + TextView actionTextView = view.findViewById(R.id.request_item_action); + TextView urlTextView = view.findViewById(R.id.request_item_url); + + // Get the string array for this entry. + String[] entryStringArray = getItem(position); + + // Remove the lint warning below that `entryStringArray` might be null. + assert entryStringArray != null; + + // The ID is one greater than the position because it is 0 based. + int id = position + 1; + + // Set the action text and the background color. + switch (Integer.valueOf(entryStringArray[0])) { + case MainWebViewActivity.REQUEST_DEFAULT: + // Create the disposition string. + String requestDefault = id + ". " + context.getResources().getString(R.string.allowed); + + // Set the disposition text. + actionTextView.setText(requestDefault); + + // Set the background color. + linearLayout.setBackgroundColor(context.getResources().getColor(R.color.transparent)); + break; + + case MainWebViewActivity.REQUEST_ALLOWED: + // Create the disposition string. + String requestAllowed = id + ". " + context.getResources().getString(R.string.allowed); + + // Set the disposition text. + actionTextView.setText(requestAllowed); + + // Set the background color. + if (MainWebViewActivity.darkTheme) { + linearLayout.setBackgroundColor(context.getResources().getColor(R.color.blue_700_50)); + } else { + linearLayout.setBackgroundColor(context.getResources().getColor(R.color.blue_100)); + } + break; + + + case MainWebViewActivity.REQUEST_BLOCKED: + // Create the disposition string. + String requestBlocked = id + ". " + context.getResources().getString(R.string.blocked); + + // Set the disposition text. + actionTextView.setText(requestBlocked); + + // Set the background color. + if (MainWebViewActivity.darkTheme) { + linearLayout.setBackgroundColor(context.getResources().getColor(R.color.red_700_50)); + } else { + linearLayout.setBackgroundColor(context.getResources().getColor(R.color.red_100)); + } + break; + } + + // Set the URL text. + urlTextView.setText(entryStringArray[1]); + + // Set the text color. For some unexplained reason, `android:textColor="?android:textColorPrimary"` doesn't work in the layout file. Probably some bug relating to array adapters. + if (MainWebViewActivity.darkTheme) { + actionTextView.setTextColor(context.getResources().getColor(R.color.gray_200)); + urlTextView.setTextColor(context.getResources().getColor(R.color.gray_200)); + } else { + actionTextView.setTextColor(context.getResources().getColor(R.color.black)); + urlTextView.setTextColor(context.getResources().getColor(R.color.black)); + } + + // Return the modified view. + return view; + } +} diff --git a/app/src/main/java/com/stoutner/privacybrowser/dialogs/AddDomainDialog.java b/app/src/main/java/com/stoutner/privacybrowser/dialogs/AddDomainDialog.java index c67c3aed..edffc63f 100644 --- a/app/src/main/java/com/stoutner/privacybrowser/dialogs/AddDomainDialog.java +++ b/app/src/main/java/com/stoutner/privacybrowser/dialogs/AddDomainDialog.java @@ -53,14 +53,11 @@ public class AddDomainDialog extends AppCompatDialogFragment { public void onAttach(Context context) { + // Run the default commands. super.onAttach(context); - // Get a handle for `AddDomainListener` from `context`. - try { - addDomainListener = (AddDomainListener) context; - } catch(ClassCastException exception) { - throw new ClassCastException(context.toString() + " must implement `AddDomainListener`."); - } + // Get a handle for the listener from the launching context. + addDomainListener = (AddDomainListener) context; } // `@SuppressLing("InflateParams")` removes the warning about using `null` as the parent view group when inflating the `AlertDialog`. diff --git a/app/src/main/java/com/stoutner/privacybrowser/dialogs/CreateBookmarkDialog.java b/app/src/main/java/com/stoutner/privacybrowser/dialogs/CreateBookmarkDialog.java index caadd02a..d034aac7 100644 --- a/app/src/main/java/com/stoutner/privacybrowser/dialogs/CreateBookmarkDialog.java +++ b/app/src/main/java/com/stoutner/privacybrowser/dialogs/CreateBookmarkDialog.java @@ -51,12 +51,8 @@ public class CreateBookmarkDialog extends AppCompatDialogFragment { public void onAttach(Context context) { super.onAttach(context); - // Get a handle for `CreateBookmarkListener` from `context`. - try { - createBookmarkListener = (CreateBookmarkListener) context; - } catch(ClassCastException exception) { - throw new ClassCastException(context.toString() + " must implement `CreateBookmarkListener`."); - } + // Get a handle for `CreateBookmarkListener` from the launching context. + createBookmarkListener = (CreateBookmarkListener) context; } // `@SuppressLing("InflateParams")` removes the warning about using `null` as the parent view group when inflating the `AlertDialog`. diff --git a/app/src/main/java/com/stoutner/privacybrowser/dialogs/CreateBookmarkFolderDialog.java b/app/src/main/java/com/stoutner/privacybrowser/dialogs/CreateBookmarkFolderDialog.java index 98fb9dcb..670d237b 100644 --- a/app/src/main/java/com/stoutner/privacybrowser/dialogs/CreateBookmarkFolderDialog.java +++ b/app/src/main/java/com/stoutner/privacybrowser/dialogs/CreateBookmarkFolderDialog.java @@ -54,12 +54,8 @@ public class CreateBookmarkFolderDialog extends AppCompatDialogFragment { public void onAttach(Context context) { super.onAttach(context); - // Get a handle for `createBookmarkFolderListener` from `context`. - try { - createBookmarkFolderListener = (CreateBookmarkFolderListener) context; - } catch(ClassCastException exception) { - throw new ClassCastException(context.toString() + " must implement CreateBookmarkFolderListener."); - } + // Get a handle for `createBookmarkFolderListener` from the launching context. + createBookmarkFolderListener = (CreateBookmarkFolderListener) context; } // `@SuppressLing("InflateParams")` removes the warning about using `null` as the parent view group when inflating the `AlertDialog`. diff --git a/app/src/main/java/com/stoutner/privacybrowser/dialogs/CreateHomeScreenShortcutDialog.java b/app/src/main/java/com/stoutner/privacybrowser/dialogs/CreateHomeScreenShortcutDialog.java index f3321280..ca8d72bd 100644 --- a/app/src/main/java/com/stoutner/privacybrowser/dialogs/CreateHomeScreenShortcutDialog.java +++ b/app/src/main/java/com/stoutner/privacybrowser/dialogs/CreateHomeScreenShortcutDialog.java @@ -50,12 +50,11 @@ public class CreateHomeScreenShortcutDialog extends AppCompatDialogFragment { // Check to make sure that the parent activity implements the listener. public void onAttach(Context context) { + // Run the default commands. super.onAttach(context); - try { - createHomeScreenShortcutListener = (CreateHomeScreenShortcutListener) context; - } catch(ClassCastException exception) { - throw new ClassCastException(context.toString() + " must implement CreateHomeScreenShortcutListener."); - } + + // Get a handle for `CreateHomeScreenShortcutListener` from the launching context. + createHomeScreenShortcutListener = (CreateHomeScreenShortcutListener) context; } // `@SuppressLing("InflateParams")` removes the warning about using `null` as the parent view group when inflating the `AlertDialog`. diff --git a/app/src/main/java/com/stoutner/privacybrowser/dialogs/DownloadFileDialog.java b/app/src/main/java/com/stoutner/privacybrowser/dialogs/DownloadFileDialog.java index 5ff4a851..cf948124 100644 --- a/app/src/main/java/com/stoutner/privacybrowser/dialogs/DownloadFileDialog.java +++ b/app/src/main/java/com/stoutner/privacybrowser/dialogs/DownloadFileDialog.java @@ -42,10 +42,22 @@ import com.stoutner.privacybrowser.activities.MainWebViewActivity; import java.util.Locale; public class DownloadFileDialog extends AppCompatDialogFragment { + // `downloadFileListener` is used in `onAttach()` and `onCreateDialog()`. + private DownloadFileListener downloadFileListener; + + // The public interface is used to send information back to the parent activity. + public interface DownloadFileListener { + void onDownloadFile(AppCompatDialogFragment dialogFragment, String downloadUrl); + } + + @Override + public void onAttach(Context context) { + // Run the default commands. + super.onAttach(context); - private String downloadUrl; - private String downloadFileName; - private String fileSize; + // Get a handle for `DownloadFileListener` from the launching context. + downloadFileListener = (DownloadFileListener) context; + } public static DownloadFileDialog fromUrl(String urlString, String contentDisposition, long contentLength) { // Create an arguments bundle. @@ -78,52 +90,28 @@ public class DownloadFileDialog extends AppCompatDialogFragment { } @Override - public void onCreate(Bundle savedInstanceState) { - super.onCreate(savedInstanceState); - + @NonNull + // `@SuppressLing("InflateParams")` removes the warning about using `null` as the parent view group when inflating the `AlertDialog`. + @SuppressLint("InflateParams") + public Dialog onCreateDialog(Bundle savedInstanceState) { // Remove the warning below that `getArguments()` might be null. assert getArguments() != null; - // Store the strings in the local class variables. - downloadUrl = getArguments().getString("URL"); - downloadFileName = getArguments().getString("File_Name"); - - // Get the `File_Size`. + // Store the variables from the bundle. + String downloadUrl = getArguments().getString("URL"); + String downloadFileName = getArguments().getString("File_Name"); long fileSizeLong = getArguments().getLong("File_Size"); + // Initialize the file size string. + String fileSize; + // Convert `fileSizeLong` to a String. if (fileSizeLong == -1) { // We don't know the file size. fileSize = getString(R.string.unknown_size); } else { // Convert `fileSize` to MB and store it in `fileSizeString`. `%.3g` displays the three most significant digits. fileSize = String.format(Locale.getDefault(), "%.3g", (float) fileSizeLong / 1048576) + " MB"; } - } - - // The public interface is used to send information back to the parent activity. - public interface DownloadFileListener { - void onDownloadFile(AppCompatDialogFragment dialogFragment, String downloadUrl); - } - - // `downloadFileListener` is used in `onAttach()` and `onCreateDialog()`. - private DownloadFileListener downloadFileListener; - - @Override - public void onAttach(Context context) { - super.onAttach(context); - - // Check to make sure the parent activity implements the listener. - try { - downloadFileListener = (DownloadFileListener) context; - } catch (ClassCastException exception) { - throw new ClassCastException(context.toString() + " must implement DownloadFileListener."); - } - } - @Override - @NonNull - // `@SuppressLing("InflateParams")` removes the warning about using `null` as the parent view group when inflating the `AlertDialog`. - @SuppressLint("InflateParams") - public Dialog onCreateDialog(Bundle savedInstanceState) { // Remove the warning below that `getActivity()` might be null; assert getActivity() != null; diff --git a/app/src/main/java/com/stoutner/privacybrowser/dialogs/DownloadImageDialog.java b/app/src/main/java/com/stoutner/privacybrowser/dialogs/DownloadImageDialog.java index 2221bfe9..94f25868 100644 --- a/app/src/main/java/com/stoutner/privacybrowser/dialogs/DownloadImageDialog.java +++ b/app/src/main/java/com/stoutner/privacybrowser/dialogs/DownloadImageDialog.java @@ -41,9 +41,23 @@ import com.stoutner.privacybrowser.activities.MainWebViewActivity; // `android.support.v7.app.AlertDialog` uses more of the horizontal screen real estate versus `android.app.AlertDialog's` smaller width. // We have to use `AppCompatDialogFragment` instead of `DialogFragment` or an error is produced on API <=22. public class DownloadImageDialog extends AppCompatDialogFragment { + // `downloadImageListener` is used in `onAttach()` and `onCreateDialog()`. + private DownloadImageListener downloadImageListener; + + // The public interface is used to send information back to the parent activity. + public interface DownloadImageListener { + void onDownloadImage(AppCompatDialogFragment dialogFragment, String downloadUrl); + } + + // Check to make sure tha the parent activity implements the listener. + @Override + public void onAttach(Context context) { + // Run the default commands. + super.onAttach(context); - private String imageUrl; - private String imageFileName; + // Get a handle for `DownloadImageListener` from the launching context. + downloadImageListener = (DownloadImageListener) context; + } public static DownloadImageDialog imageUrl(String imageUrlString) { // Create an arguments bundle. @@ -66,42 +80,18 @@ public class DownloadImageDialog extends AppCompatDialogFragment { return thisDownloadFileDialog; } - @Override - public void onCreate(Bundle savedInstanceState) { - super.onCreate(savedInstanceState); - - // Remove the warning below that `getArguments()` might be null. - assert getArguments() != null; - - // Store the strings in the local class variables. - imageUrl = getArguments().getString("URL"); - imageFileName = getArguments().getString("Image_Name"); - } - - // The public interface is used to send information back to the parent activity. - public interface DownloadImageListener { - void onDownloadImage(AppCompatDialogFragment dialogFragment, String downloadUrl); - } - - // `downloadImageListener` is used in `onAttach()` and `onCreateDialog()`. - private DownloadImageListener downloadImageListener; - - // Check to make sure tha the parent activity implements the listener. - @Override - public void onAttach(Context context) { - super.onAttach(context); - try { - downloadImageListener = (DownloadImageListener) context; - } catch (ClassCastException exception) { - throw new ClassCastException(context.toString() + " must implement DownloadImageListener."); - } - } - // `@SuppressLing("InflateParams")` removes the warning about using `null` as the parent view group when inflating the `AlertDialog`. @SuppressLint("InflateParams") @Override @NonNull public Dialog onCreateDialog(Bundle savedInstanceState) { + // Remove the warning below that `getArguments()` might be null. + assert getArguments() != null; + + // Get the strings from the bundle. + String imageUrl = getArguments().getString("URL"); + String imageFileName = getArguments().getString("Image_Name"); + // Remove the warning below that `.getActivity()` might be null. assert getActivity() != null; diff --git a/app/src/main/java/com/stoutner/privacybrowser/dialogs/DownloadLocationPermissionDialog.java b/app/src/main/java/com/stoutner/privacybrowser/dialogs/DownloadLocationPermissionDialog.java index 57b3889d..117f000b 100644 --- a/app/src/main/java/com/stoutner/privacybrowser/dialogs/DownloadLocationPermissionDialog.java +++ b/app/src/main/java/com/stoutner/privacybrowser/dialogs/DownloadLocationPermissionDialog.java @@ -34,7 +34,22 @@ public class DownloadLocationPermissionDialog extends DialogFragment { public static final int DOWNLOAD_FILE = 1; public static final int DOWNLOAD_IMAGE = 2; - private int downloadType; + // `downloadLocationPermissionDialogListener` is used in `onAttach()` and `onCreateDialog()`. + private DownloadLocationPermissionDialogListener downloadLocationPermissionDialogListener; + + // The public interface is used to send information back to the parent activity. + public interface DownloadLocationPermissionDialogListener { + void onCloseDownloadLocationPermissionDialog(int downloadType); + } + + @Override + public void onAttach(Context context) { + // Run the default commands. + super.onAttach(context); + + // Get a handle for `DownloadLocationPermissionDialogListener` from the launching context. + downloadLocationPermissionDialogListener = (DownloadLocationPermissionDialogListener) context; + } public static DownloadLocationPermissionDialog downloadType(int type) { // Create an arguments bundle. @@ -50,35 +65,10 @@ public class DownloadLocationPermissionDialog extends DialogFragment { } @Override - public void onCreate(Bundle savedInstanceState) { - super.onCreate(savedInstanceState); - + public Dialog onCreateDialog(Bundle savedInstanceState) { // Store the download type in the local class variable. - downloadType = getArguments().getInt("Download_Type"); - } + int downloadType = getArguments().getInt("Download_Type"); - // The public interface is used to send information back to the parent activity. - public interface DownloadLocationPermissionDialogListener { - void onCloseDownloadLocationPermissionDialog(int downloadType); - } - - // `downloadLocationPermissionDialogListener` is used in `onAttach()` and `onCreateDialog()`. - private DownloadLocationPermissionDialogListener downloadLocationPermissionDialogListener; - - @Override - public void onAttach(Context context) { - super.onAttach(context); - - // Check to make sure the parent activity implements the listener. - try { - downloadLocationPermissionDialogListener = (DownloadLocationPermissionDialogListener) context; - } catch (ClassCastException exception) { - throw new ClassCastException(context.toString() + " must implement DownloadLocationPermissionDialogListener."); - } - } - - @Override - public Dialog onCreateDialog(Bundle savedInstanceState) { // Use a builder to create the alert dialog. AlertDialog.Builder dialogBuilder; diff --git a/app/src/main/java/com/stoutner/privacybrowser/dialogs/EditBookmarkDatabaseViewDialog.java b/app/src/main/java/com/stoutner/privacybrowser/dialogs/EditBookmarkDatabaseViewDialog.java index 028db1b7..e24c893b 100644 --- a/app/src/main/java/com/stoutner/privacybrowser/dialogs/EditBookmarkDatabaseViewDialog.java +++ b/app/src/main/java/com/stoutner/privacybrowser/dialogs/EditBookmarkDatabaseViewDialog.java @@ -58,7 +58,6 @@ public class EditBookmarkDatabaseViewDialog extends AppCompatDialogFragment { // Instantiate the class variables. private EditBookmarkDatabaseViewListener editBookmarkDatabaseViewListener; - private int bookmarkDatabaseId; private String currentBookmarkName; private String currentUrl; private int currentFolderDatabaseId; @@ -80,12 +79,9 @@ public class EditBookmarkDatabaseViewDialog extends AppCompatDialogFragment { // Run the default commands. super.onAttach(context); - // Get a handle for `EditBookmarkDatabaseViewListener` from `context`. - try { - editBookmarkDatabaseViewListener = (EditBookmarkDatabaseViewListener) context; - } catch(ClassCastException exception) { - throw new ClassCastException(context.toString() + " must implement EditBookmarkDatabaseViewListener."); - } + // Get a handle for `EditBookmarkDatabaseViewListener` from the launching context. + + editBookmarkDatabaseViewListener = (EditBookmarkDatabaseViewListener) context; } // Store the database ID in the arguments bundle. @@ -104,24 +100,18 @@ public class EditBookmarkDatabaseViewDialog extends AppCompatDialogFragment { return editBookmarkDatabaseViewDialog; } + // `@SuppressLing("InflateParams")` removes the warning about using `null` as the parent view group when inflating the `AlertDialog`. + @SuppressLint("InflateParams") @Override - public void onCreate(Bundle savedInstanceState) { - // Run the default commands. - super.onCreate(savedInstanceState); - + @NonNull + public Dialog onCreateDialog(Bundle savedInstanceState) { // Remove the incorrect lint warning below that `getInt()` might be null. assert getArguments() != null; - // Store the bookmark database ID in the class variable. - bookmarkDatabaseId = getArguments().getInt("Database ID"); - } + // Get the bookmark database ID from the bundle. + int bookmarkDatabaseId = getArguments().getInt("Database ID"); - // `@SuppressLing("InflateParams")` removes the warning about using `null` as the parent view group when inflating the `AlertDialog`. - @SuppressLint("InflateParams") - @Override - @NonNull - public Dialog onCreateDialog(Bundle savedInstanceState) { - // Initialize the database helper. The two `nulls` do not specify the database name or a `CursorFactory`. The `0` specifies a database version, but that is ignored and set instead using a constant in `BookmarksDatabaseHelper`. + // Initialize the database helper. The `0` specifies a database version, but that is ignored and set instead using a constant in `BookmarksDatabaseHelper`. BookmarksDatabaseHelper bookmarksDatabaseHelper = new BookmarksDatabaseHelper(getContext(), null, null, 0); // Get a cursor with the selected bookmark and move it to the first position. diff --git a/app/src/main/java/com/stoutner/privacybrowser/dialogs/EditBookmarkDialog.java b/app/src/main/java/com/stoutner/privacybrowser/dialogs/EditBookmarkDialog.java index 492c113a..27be599c 100644 --- a/app/src/main/java/com/stoutner/privacybrowser/dialogs/EditBookmarkDialog.java +++ b/app/src/main/java/com/stoutner/privacybrowser/dialogs/EditBookmarkDialog.java @@ -49,7 +49,6 @@ import com.stoutner.privacybrowser.helpers.BookmarksDatabaseHelper; public class EditBookmarkDialog extends AppCompatDialogFragment { // Instantiate the class variables. private EditBookmarkListener editBookmarkListener; - private int selectedBookmarkDatabaseId; private EditText nameEditText; private EditText urlEditText; private RadioButton newIconRadioButton; @@ -66,12 +65,8 @@ public class EditBookmarkDialog extends AppCompatDialogFragment { // Run the default commands. super.onAttach(context); - // Get a handle for `EditBookmarkListener` from `context`. - try { - editBookmarkListener = (EditBookmarkListener) context; - } catch(ClassCastException exception) { - throw new ClassCastException(context.toString() + " must implement EditBookmarkListener."); - } + // Get a handle for `EditBookmarkListener` from the launching context. + editBookmarkListener = (EditBookmarkListener) context; } // Store the database ID in the arguments bundle. @@ -90,24 +85,18 @@ public class EditBookmarkDialog extends AppCompatDialogFragment { return editBookmarkDialog; } + // `@SuppressLing("InflateParams")` removes the warning about using `null` as the parent view group when inflating the `AlertDialog`. + @SuppressLint("InflateParams") @Override - public void onCreate(Bundle savedInstanceState) { - // Run the default commands. - super.onCreate(savedInstanceState); - + @NonNull + public Dialog onCreateDialog(Bundle savedInstanceState) { // Remove the incorrect lint warning that `getInt()` might be null. assert getArguments() != null; // Store the bookmark database ID in the class variable. - selectedBookmarkDatabaseId = getArguments().getInt("Database ID"); - } + int selectedBookmarkDatabaseId = getArguments().getInt("Database ID"); - // `@SuppressLing("InflateParams")` removes the warning about using `null` as the parent view group when inflating the `AlertDialog`. - @SuppressLint("InflateParams") - @Override - @NonNull - public Dialog onCreateDialog(Bundle savedInstanceState) { - // Initialize the database helper. The two `nulls` do not specify the database name or a `CursorFactory`. The `0` specifies a database version, but that is ignored and set instead using a constant in `BookmarksDatabaseHelper`. + // Initialize the database helper. The `0` specifies a database version, but that is ignored and set instead using a constant in `BookmarksDatabaseHelper`. BookmarksDatabaseHelper bookmarksDatabaseHelper = new BookmarksDatabaseHelper(getContext(), null, null, 0); // Get a `Cursor` with the selected bookmark and move it to the first position. @@ -130,7 +119,7 @@ public class EditBookmarkDialog extends AppCompatDialogFragment { // Remove the incorrect lint warning that `getActivity()` might be null. assert getActivity() != null; - // Set the view. The parent view is `null` because it will be assigned by `AlertDialog`. + // Set the view. The parent view is null because it will be assigned by the alert dialog. dialogBuilder.setView(getActivity().getLayoutInflater().inflate(R.layout.edit_bookmark_dialog, null)); // Set the listener for the negative button. diff --git a/app/src/main/java/com/stoutner/privacybrowser/dialogs/EditBookmarkFolderDatabaseViewDialog.java b/app/src/main/java/com/stoutner/privacybrowser/dialogs/EditBookmarkFolderDatabaseViewDialog.java index af26e0b9..0fb537b8 100644 --- a/app/src/main/java/com/stoutner/privacybrowser/dialogs/EditBookmarkFolderDatabaseViewDialog.java +++ b/app/src/main/java/com/stoutner/privacybrowser/dialogs/EditBookmarkFolderDatabaseViewDialog.java @@ -60,7 +60,6 @@ public class EditBookmarkFolderDatabaseViewDialog extends AppCompatDialogFragmen // Instantiate the class variables. private EditBookmarkFolderDatabaseViewListener editBookmarkFolderDatabaseViewListener; private BookmarksDatabaseHelper bookmarksDatabaseHelper; - private int folderDatabaseId; private StringBuilder exceptFolders; private String currentFolderName; private int currentParentFolderDatabaseId; @@ -80,12 +79,8 @@ public class EditBookmarkFolderDatabaseViewDialog extends AppCompatDialogFragmen // Run the default commands. super.onAttach(context); - // Get a handle for `EditBookmarkDatabaseViewListener` from `context`. - try { - editBookmarkFolderDatabaseViewListener = (EditBookmarkFolderDatabaseViewListener) context; - } catch(ClassCastException exception) { - throw new ClassCastException(context.toString() + " must implement EditBookmarkFolderDatabaseViewListener."); - } + // Get a handle for `EditBookmarkDatabaseViewListener` from the launching context. + editBookmarkFolderDatabaseViewListener = (EditBookmarkFolderDatabaseViewListener) context; } // Store the database ID in the arguments bundle. @@ -104,23 +99,17 @@ public class EditBookmarkFolderDatabaseViewDialog extends AppCompatDialogFragmen return editBookmarkFolderDatabaseViewDialog; } - @Override - public void onCreate(Bundle savedInstanceState) { - // Run the default commands. - super.onCreate(savedInstanceState); - - // Remove the incorrect lint warning that `getInt()` might be null. - assert getArguments() != null; - - // Store the bookmark database ID in the class variable. - folderDatabaseId = getArguments().getInt("Database ID"); - } - // `@SuppressLing("InflateParams")` removes the warning about using `null` as the parent view group when inflating the `AlertDialog`. @SuppressLint("InflateParams") @Override @NonNull public Dialog onCreateDialog(Bundle savedInstanceState) { + // Remove the incorrect lint warning that `getInt()` might be null. + assert getArguments() != null; + + // Get the bookmark database ID from the bundle. + int folderDatabaseId = getArguments().getInt("Database ID"); + // Initialize the database helper. The two `nulls` do not specify the database name or a `CursorFactory`. The `0` specifies a database version, but that is ignored and set instead using a constant in `BookmarksDatabaseHelper`. bookmarksDatabaseHelper = new BookmarksDatabaseHelper(getContext(), null, null, 0); @@ -250,7 +239,7 @@ public class EditBookmarkFolderDatabaseViewDialog extends AppCompatDialogFragmen // Select the current folder in the `Spinner` if the bookmark isn't in the "Home Folder". if (!parentFolder.equals("")) { // Get the database ID of the parent folder. - int folderDatabaseId = bookmarksDatabaseHelper.getFolderDatabaseId(folderCursor.getString(folderCursor.getColumnIndex(BookmarksDatabaseHelper.PARENT_FOLDER))); + int parentFolderDatabaseId = bookmarksDatabaseHelper.getFolderDatabaseId(folderCursor.getString(folderCursor.getColumnIndex(BookmarksDatabaseHelper.PARENT_FOLDER))); // Initialize `parentFolderPosition` and the iteration variable. int parentFolderPosition = 0; @@ -258,7 +247,7 @@ public class EditBookmarkFolderDatabaseViewDialog extends AppCompatDialogFragmen // Find the parent folder position in folders `ResourceCursorAdapter`. do { - if (foldersCursorAdapter.getItemId(i) == folderDatabaseId) { + if (foldersCursorAdapter.getItemId(i) == parentFolderDatabaseId) { // Store the current position for the parent folder. parentFolderPosition = i; } else { diff --git a/app/src/main/java/com/stoutner/privacybrowser/dialogs/EditBookmarkFolderDialog.java b/app/src/main/java/com/stoutner/privacybrowser/dialogs/EditBookmarkFolderDialog.java index 8f41bfc7..0ef29c74 100644 --- a/app/src/main/java/com/stoutner/privacybrowser/dialogs/EditBookmarkFolderDialog.java +++ b/app/src/main/java/com/stoutner/privacybrowser/dialogs/EditBookmarkFolderDialog.java @@ -47,25 +47,20 @@ import com.stoutner.privacybrowser.activities.MainWebViewActivity; import com.stoutner.privacybrowser.helpers.BookmarksDatabaseHelper; public class EditBookmarkFolderDialog extends AppCompatDialogFragment { + // Instantiate the class variable. + private EditBookmarkFolderListener editBookmarkFolderListener; + // The public interface is used to send information back to the parent activity. public interface EditBookmarkFolderListener { void onSaveBookmarkFolder(AppCompatDialogFragment dialogFragment, int selectedFolderDatabaseId); } - // Instantiate the class variables. - private EditBookmarkFolderListener editBookmarkFolderListener; - private int selectedFolderDatabaseId; - public void onAttach(Context context) { // Run the default commands. super.onAttach(context); - // Get a handle for `EditFolderListener` from `parentActivity`. - try { - editBookmarkFolderListener = (EditBookmarkFolderListener) context; - } catch(ClassCastException exception) { - throw new ClassCastException(context.toString() + " must implement EditBookmarkFolderListener."); - } + // Get a handle for `EditFolderListener` from the launching context. + editBookmarkFolderListener = (EditBookmarkFolderListener) context; } // Store the database ID in the arguments bundle. @@ -84,23 +79,17 @@ public class EditBookmarkFolderDialog extends AppCompatDialogFragment { return editBookmarkFolderDialog; } + // `@SuppressLing("InflateParams")` removes the warning about using `null` as the parent view group when inflating the `AlertDialog`. + @SuppressLint("InflateParams") @Override - public void onCreate(Bundle savedInstanceState) { - // Run the default commands. - super.onCreate(savedInstanceState); - + @NonNull + public Dialog onCreateDialog(Bundle savedInstanceState) { // Remove the incorrect lint warning that `getInt()` might be null. assert getArguments() != null; // Store the folder database ID in the class variable. - selectedFolderDatabaseId = getArguments().getInt("Database ID"); - } + int selectedFolderDatabaseId = getArguments().getInt("Database ID"); - // `@SuppressLing("InflateParams")` removes the warning about using `null` as the parent view group when inflating the `AlertDialog`. - @SuppressLint("InflateParams") - @Override - @NonNull - public Dialog onCreateDialog(Bundle savedInstanceState) { // Initialize the database helper. The two `nulls` do not specify the database name or a `CursorFactory`. The `0` specifies a database version, but that is ignored and set instead using a constant in `BookmarksDatabaseHelper`. final BookmarksDatabaseHelper bookmarksDatabaseHelper = new BookmarksDatabaseHelper(getContext(), null, null, 0); diff --git a/app/src/main/java/com/stoutner/privacybrowser/dialogs/HttpAuthenticationDialog.java b/app/src/main/java/com/stoutner/privacybrowser/dialogs/HttpAuthenticationDialog.java index 6110ed54..46af64e7 100644 --- a/app/src/main/java/com/stoutner/privacybrowser/dialogs/HttpAuthenticationDialog.java +++ b/app/src/main/java/com/stoutner/privacybrowser/dialogs/HttpAuthenticationDialog.java @@ -42,34 +42,8 @@ import com.stoutner.privacybrowser.R; import com.stoutner.privacybrowser.activities.MainWebViewActivity; public class HttpAuthenticationDialog extends AppCompatDialogFragment{ - - // The private variables are used in `onCreate()` and `onCreateDialog()`. - private String httpAuthHost; - private String httpAuthRealm; - - public static HttpAuthenticationDialog displayDialog(String host, String realm) { - // Store the strings in a `Bundle`. - Bundle argumentsBundle = new Bundle(); - argumentsBundle.putString("Host", host); - argumentsBundle.putString("Realm", realm); - - // Add `argumentsBundle` to this instance of `HttpAuthenticationDialog`. - HttpAuthenticationDialog thisHttpAuthenticationDialog = new HttpAuthenticationDialog(); - thisHttpAuthenticationDialog.setArguments(argumentsBundle); - return thisHttpAuthenticationDialog; - } - - @Override - public void onCreate(Bundle savedInstanceState) { - super.onCreate(savedInstanceState); - - // Remove the incorrect lint warnings that `getString()` might be null. - assert getArguments() != null; - - // Save the host and realm in class variables. - httpAuthHost = getArguments().getString("Host"); - httpAuthRealm = getArguments().getString("Realm"); - } + // `httpAuthenticationListener` is used in `onAttach()` and `onCreateDialog()` + private HttpAuthenticationListener httpAuthenticationListener; // The public interface is used to send information back to the parent activity. public interface HttpAuthenticationListener { @@ -78,18 +52,23 @@ public class HttpAuthenticationDialog extends AppCompatDialogFragment{ void onHttpAuthenticationProceed(AppCompatDialogFragment dialogFragment); } - // `httpAuthenticationListener` is used in `onAttach()` and `onCreateDialog()` - private HttpAuthenticationListener httpAuthenticationListener; - public void onAttach(Context context) { super.onAttach(context); // Get a handle for `httpAuthenticationListener` from `context`. - try { - httpAuthenticationListener = (HttpAuthenticationListener) context; - } catch(ClassCastException exception) { - throw new ClassCastException(context.toString() + " must implement `HttpAuthenticationListener`."); - } + httpAuthenticationListener = (HttpAuthenticationListener) context; + } + + public static HttpAuthenticationDialog displayDialog(String host, String realm) { + // Store the strings in a `Bundle`. + Bundle argumentsBundle = new Bundle(); + argumentsBundle.putString("Host", host); + argumentsBundle.putString("Realm", realm); + + // Add `argumentsBundle` to this instance of `HttpAuthenticationDialog`. + HttpAuthenticationDialog thisHttpAuthenticationDialog = new HttpAuthenticationDialog(); + thisHttpAuthenticationDialog.setArguments(argumentsBundle); + return thisHttpAuthenticationDialog; } // `@SuppressLing("InflateParams")` removes the warning about using `null` as the parent view group when inflating the `AlertDialog`. @@ -97,6 +76,13 @@ public class HttpAuthenticationDialog extends AppCompatDialogFragment{ @Override @NonNull public Dialog onCreateDialog(Bundle savedInstanceState) { + // Remove the incorrect lint warnings that `getString()` might be null. + assert getArguments() != null; + + // Get the host and realm variables from the bundle. + String httpAuthHost = getArguments().getString("Host"); + String httpAuthRealm = getArguments().getString("Realm"); + // Remove the incorrect lint warning that `getActivity()` might be null. assert getActivity() != null; diff --git a/app/src/main/java/com/stoutner/privacybrowser/dialogs/MoveToFolderDialog.java b/app/src/main/java/com/stoutner/privacybrowser/dialogs/MoveToFolderDialog.java index 2dfda361..2bbd4e66 100644 --- a/app/src/main/java/com/stoutner/privacybrowser/dialogs/MoveToFolderDialog.java +++ b/app/src/main/java/com/stoutner/privacybrowser/dialogs/MoveToFolderDialog.java @@ -55,7 +55,8 @@ import com.stoutner.privacybrowser.helpers.BookmarksDatabaseHelper; import java.io.ByteArrayOutputStream; public class MoveToFolderDialog extends AppCompatDialogFragment { - // Instantiate class variables. + // Instantiate the class variables. + private MoveToFolderListener moveToFolderListener; private BookmarksDatabaseHelper bookmarksDatabaseHelper; private StringBuilder exceptFolders; @@ -64,18 +65,12 @@ public class MoveToFolderDialog extends AppCompatDialogFragment { void onMoveToFolder(AppCompatDialogFragment dialogFragment); } - // `moveToFolderListener` is used in `onAttach()` and `onCreateDialog`. - private MoveToFolderListener moveToFolderListener; - public void onAttach(Context context) { + // Run the default commands. super.onAttach(context); - // Get a handle for `MoveToFolderListener` from `parentActivity`. - try { - moveToFolderListener = (MoveToFolderListener) context; - } catch(ClassCastException exception) { - throw new ClassCastException(context.toString() + " must implement EditBookmarkFolderListener."); - } + // Get a handle for `MoveToFolderListener` from the launching context. + moveToFolderListener = (MoveToFolderListener) context; } // `@SuppressLing("InflateParams")` removes the warning about using `null` as the parent view group when inflating the `AlertDialog`. diff --git a/app/src/main/java/com/stoutner/privacybrowser/dialogs/PinnedSslCertificateMismatchDialog.java b/app/src/main/java/com/stoutner/privacybrowser/dialogs/PinnedSslCertificateMismatchDialog.java index 6796b50e..7404708b 100644 --- a/app/src/main/java/com/stoutner/privacybrowser/dialogs/PinnedSslCertificateMismatchDialog.java +++ b/app/src/main/java/com/stoutner/privacybrowser/dialogs/PinnedSslCertificateMismatchDialog.java @@ -49,10 +49,9 @@ import java.text.DateFormat; import java.util.Date; public class PinnedSslCertificateMismatchDialog extends AppCompatDialogFragment { - // `layoutInflater` is used in `onCreateDialog()` and `pagerAdapter`. + // Instantiate the class variables. + private PinnedSslCertificateMismatchListener pinnedSslCertificateMismatchListener; private LayoutInflater layoutInflater; - - // The current website SSL certificate variables are used in `onCreateDialog()` and `pagerAdapter()`. private String currentSslIssuedToCNameString; private String currentSslIssuedToONameString; private String currentSslIssuedToUNameString; @@ -69,18 +68,13 @@ public class PinnedSslCertificateMismatchDialog extends AppCompatDialogFragment void onSslMismatchProceed(); } - // `sslCertificateErrorListener` is used in `onAttach` and `onCreateDialog`. - private PinnedSslCertificateMismatchDialog.PinnedSslCertificateMismatchListener pinnedSslCertificateMismatchListener; - // Check to make sure that the parent activity implements the listener. public void onAttach(Context context) { + // Run the default commands. super.onAttach(context); - try { - pinnedSslCertificateMismatchListener = (PinnedSslCertificateMismatchDialog.PinnedSslCertificateMismatchListener) context; - } catch(ClassCastException exception) { - throw new ClassCastException(context.toString() + " must implement PinnedSslCertificateMismatchListener"); - } + // Get a handle for `PinnedSslCertificateMismatchListener` from the launching context. + pinnedSslCertificateMismatchListener = (PinnedSslCertificateMismatchListener) context; } // `@SuppressLing("InflateParams")` removes the warning about using `null` as the parent view group when inflating the `AlertDialog`. diff --git a/app/src/main/java/com/stoutner/privacybrowser/dialogs/SslCertificateErrorDialog.java b/app/src/main/java/com/stoutner/privacybrowser/dialogs/SslCertificateErrorDialog.java index 8bde8de0..0c930259 100644 --- a/app/src/main/java/com/stoutner/privacybrowser/dialogs/SslCertificateErrorDialog.java +++ b/app/src/main/java/com/stoutner/privacybrowser/dialogs/SslCertificateErrorDialog.java @@ -44,18 +44,23 @@ import java.text.DateFormat; import java.util.Date; public class SslCertificateErrorDialog extends AppCompatDialogFragment { + // `sslCertificateErrorListener` is used in `onAttach` and `onCreateDialog`. + private SslCertificateErrorListener sslCertificateErrorListener; + + // The public interface is used to send information back to the parent activity. + public interface SslCertificateErrorListener { + void onSslErrorCancel(); + + void onSslErrorProceed(); + } + + public void onAttach(Context context) { + // Run the default commands. + super.onAttach(context); - // The private variables are used in `onCreate()` and `onCreateDialog()`. - private int primaryErrorInt; - private String urlWithError; - private String issuedToCName; - private String issuedToOName; - private String issuedToUName; - private String issuedByCName; - private String issuedByOName; - private String issuedByUName; - private String startDate; - private String endDate; + // Get a handle for `SslCertificateErrorListener` from the launching context. + sslCertificateErrorListener = (SslCertificateErrorListener) context; + } public static SslCertificateErrorDialog displayDialog(SslError error) { // Get the various components of the SSL error message. @@ -90,53 +95,27 @@ public class SslCertificateErrorDialog extends AppCompatDialogFragment { return thisSslCertificateErrorDialog; } - @Override - public void onCreate(Bundle savedInstanceState) { - super.onCreate(savedInstanceState); - - // Remove the incorrect lint warning that `getArguments()` might be null. - assert getArguments() != null; - - // Save the components of the SSL error message in class variables. - primaryErrorInt = getArguments().getInt("PrimaryErrorInt"); - urlWithError = getArguments().getString("UrlWithError"); - issuedToCName = getArguments().getString("IssuedToCName"); - issuedToOName = getArguments().getString("IssuedToOName"); - issuedToUName = getArguments().getString("IssuedToUName"); - issuedByCName = getArguments().getString("IssuedByCName"); - issuedByOName = getArguments().getString("IssuedByOName"); - issuedByUName = getArguments().getString("IssuedByUName"); - startDate = getArguments().getString("StartDate"); - endDate = getArguments().getString("EndDate"); - } - - // The public interface is used to send information back to the parent activity. - public interface SslCertificateErrorListener { - void onSslErrorCancel(); - - void onSslErrorProceed(); - } - - // `sslCertificateErrorListener` is used in `onAttach` and `onCreateDialog`. - private SslCertificateErrorListener sslCertificateErrorListener; - - // Check to make sure that the parent activity implements the listener. - public void onAttach(Context context) { - super.onAttach(context); - - try { - sslCertificateErrorListener = (SslCertificateErrorListener) context; - } catch(ClassCastException exception) { - throw new ClassCastException(context.toString() + " must implement SslCertificateErrorListener"); - } - } - // `@SuppressLing("InflateParams")` removes the warning about using `null` as the parent view group when inflating the `AlertDialog`. @SuppressLint("InflateParams") @SuppressWarnings("deprecation") @Override @NonNull public Dialog onCreateDialog(Bundle savedInstanceState) { + // Remove the incorrect lint warning that `getArguments()` might be null. + assert getArguments() != null; + + // Get the components of the SSL error message from the bundle. + int primaryErrorInt = getArguments().getInt("PrimaryErrorInt"); + String urlWithError = getArguments().getString("UrlWithError"); + String issuedToCName = getArguments().getString("IssuedToCName"); + String issuedToOName = getArguments().getString("IssuedToOName"); + String issuedToUName = getArguments().getString("IssuedToUName"); + String issuedByCName = getArguments().getString("IssuedByCName"); + String issuedByOName = getArguments().getString("IssuedByOName"); + String issuedByUName = getArguments().getString("IssuedByUName"); + String startDate = getArguments().getString("StartDate"); + String endDate = getArguments().getString("EndDate"); + // Remove the incorrect lint warning that `getActivity()` might be null. assert getActivity() != null; diff --git a/app/src/main/java/com/stoutner/privacybrowser/dialogs/UrlHistoryDialog.java b/app/src/main/java/com/stoutner/privacybrowser/dialogs/UrlHistoryDialog.java index 00938102..9b9d9f61 100644 --- a/app/src/main/java/com/stoutner/privacybrowser/dialogs/UrlHistoryDialog.java +++ b/app/src/main/java/com/stoutner/privacybrowser/dialogs/UrlHistoryDialog.java @@ -31,7 +31,8 @@ import android.graphics.drawable.Drawable; import android.os.Bundle; import android.support.annotation.NonNull; import android.support.v4.content.ContextCompat; -// We have to use `AppCompatDialogFragment` instead of `DialogFragment` or an error is produced on API <= 22. `android.support.v7.app.AlertDialog` also uses more of the horizontal screen real estate versus `android.app.AlertDialog's` smaller width. +// `AppCompatDialogFragment` must be used instead of `DialogFragment` or an error is produced on API <= 22. +// `android.support.v7.app.AlertDialog` also uses more of the horizontal screen real estate versus `android.app.AlertDialog's` smaller width. import android.support.v7.app.AppCompatDialogFragment; import android.util.Base64; import android.view.LayoutInflater; @@ -239,7 +240,7 @@ public class UrlHistoryDialog extends AppCompatDialogFragment{ alertDialog.show(); // Instantiate a `HistoryArrayAdapter`. - final HistoryArrayAdapter historyArrayAdapter = new HistoryArrayAdapter(getContext(), historyArrayList, currentPageId); + HistoryArrayAdapter historyArrayAdapter = new HistoryArrayAdapter(getContext(), historyArrayList, currentPageId); // Get a handle for the list view. ListView listView = alertDialog.findViewById(R.id.history_listview); @@ -249,7 +250,7 @@ public class UrlHistoryDialog extends AppCompatDialogFragment{ // Listen for clicks on entries in the list view. listView.setOnItemClickListener((AdapterView parent, View view, int position, long id) -> { - // Convert the `long` `id` to an `int`. + // Convert the long ID to an int. int itemId = (int) id; // Only consume the click if it is not on the `currentPageId`. diff --git a/app/src/main/java/com/stoutner/privacybrowser/dialogs/ViewRequestDialog.java b/app/src/main/java/com/stoutner/privacybrowser/dialogs/ViewRequestDialog.java new file mode 100644 index 00000000..45bdbab6 --- /dev/null +++ b/app/src/main/java/com/stoutner/privacybrowser/dialogs/ViewRequestDialog.java @@ -0,0 +1,310 @@ +/* + * Copyright © 2018 Soren Stoutner . + * + * This file is part of Privacy Browser . + * + * Privacy Browser is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * Privacy Browser is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with Privacy Browser. If not, see . + */ + +package com.stoutner.privacybrowser.dialogs; + +import android.annotation.SuppressLint; +import android.app.AlertDialog; +import android.app.Dialog; +import android.content.Context; +import android.content.DialogInterface; +import android.os.Bundle; +import android.support.annotation.NonNull; +import android.support.v7.app.AppCompatDialogFragment; +import android.view.View; +import android.view.WindowManager; +import android.widget.Button; +import android.widget.TextView; + +import com.stoutner.privacybrowser.R; +import com.stoutner.privacybrowser.activities.MainWebViewActivity; + +public class ViewRequestDialog extends AppCompatDialogFragment { + // The public interface is used to send information back to the parent activity. + public interface ViewRequestListener { + void onPrevious(int id); + + void onNext(int id); + } + + // `viewRequestListener` is used in `onAttach()` and `onCreateDialog()`. + private ViewRequestListener viewRequestListener; + + public void onAttach(Context context) { + // Run the default commands. + super.onAttach(context); + + // Get a handle for the listener from the launching context. + viewRequestListener = (ViewRequestListener) context; + } + + public static ViewRequestDialog request(int id, boolean isLastRequest, String[] requestDetails) { + // Create a bundle. + Bundle bundle = new Bundle(); + + // Store the request details. + bundle.putInt("ID", id); + bundle.putBoolean("Is Last Request", isLastRequest); + bundle.putStringArray("Request Details", requestDetails); + + // Add the bundle to the dialog. + ViewRequestDialog viewRequestDialog = new ViewRequestDialog(); + viewRequestDialog.setArguments(bundle); + + // Return the new dialog. + return viewRequestDialog; + } + + @Override + @NonNull + // `@SuppressLing("InflateParams")` removes the warning about using `null` as the parent view group when inflating the `AlertDialog`. + @SuppressLint("InflateParams") + public Dialog onCreateDialog(Bundle savedInstanceState) { + // Remove the incorrect lint warning that `getInt()` might be null. + assert getArguments() != null; + + // Get the info from the bundle. + int id = getArguments().getInt("ID"); + boolean isLastRequest = getArguments().getBoolean("Is Last Request"); + String[] requestDetails = getArguments().getStringArray("Request Details"); + + // Use an alert dialog builder to create the alert dialog. + AlertDialog.Builder dialogBuilder; + + // Set the style and icon according to the theme. + if (MainWebViewActivity.darkTheme) { + dialogBuilder = new AlertDialog.Builder(getActivity(), R.style.PrivacyBrowserAlertDialogDark); + dialogBuilder.setIcon(R.drawable.block_ads_enabled_dark); + } else { + dialogBuilder = new AlertDialog.Builder(getActivity(), R.style.PrivacyBrowserAlertDialogLight); + dialogBuilder.setIcon(R.drawable.block_ads_enabled_light); + } + + // Create the dialog title. + String title = getResources().getString(R.string.request_details) + " - " + id; + + // Set the title. + dialogBuilder.setTitle(title); + + // Remove the incorrect lint warnings about items being null. + assert requestDetails != null; + assert getActivity() != null; + + // Set the view. The parent view is null because it will be assigned by the alert dialog. + dialogBuilder.setView(getActivity().getLayoutInflater().inflate(R.layout.view_request_dialog, null)); + + // Set the close button. + dialogBuilder.setNeutralButton(R.string.close, (DialogInterface dialog, int which) -> { + // Do nothing. The dialog will close automatically. + }); + + // Set the previous button. + dialogBuilder.setNegativeButton(R.string.previous, (DialogInterface dialog, int which) -> { + // Load the previous request. + viewRequestListener.onPrevious(id); + }); + + // Set the next button. + dialogBuilder.setPositiveButton(R.string.next, (DialogInterface dialog, int which) -> { + // Load the next request. + viewRequestListener.onNext(id); + }); + + // Create an alert dialog from the alert dialog builder. + final AlertDialog alertDialog = dialogBuilder.create(); + + // Disable screenshots if not allowed. + if (!MainWebViewActivity.allowScreenshots) { + // Remove the warning below that `getWindow()` might be null. + assert alertDialog.getWindow() != null; + + // Disable screenshots. + alertDialog.getWindow().addFlags(WindowManager.LayoutParams.FLAG_SECURE); + } + + //The alert dialog must be shown before the contents can be modified. + alertDialog.show(); + + // Get handles for the dialog views. + TextView requestAction = alertDialog.findViewById(R.id.request_action); + TextView requestUrl = alertDialog.findViewById(R.id.request_url); + TextView requestBlockListLabel = alertDialog.findViewById(R.id.request_blocklist_label); + TextView requestBlockList = alertDialog.findViewById(R.id.request_blocklist); + TextView requestSubListLabel = alertDialog.findViewById(R.id.request_sublist_label); + TextView requestSubList = alertDialog.findViewById(R.id.request_sublist); + TextView requestBlockListEntriesLabel = alertDialog.findViewById(R.id.request_blocklist_entries_label); + TextView requestBlockListEntries = alertDialog.findViewById(R.id.request_blocklist_entries); + TextView requestBlockListOriginalEntryLabel = alertDialog.findViewById(R.id.request_blocklist_original_entry_label); + TextView requestBlockListOriginalEntry = alertDialog.findViewById(R.id.request_blocklist_original_entry); + Button previousButton = alertDialog.getButton(DialogInterface.BUTTON_NEGATIVE); + Button nextButton = alertDialog.getButton(DialogInterface.BUTTON_POSITIVE); + + // Disable the previous button if the first resource request is displayed. + previousButton.setEnabled(!(id == 1)); + + // Disable the next button if the last resource request is displayed. + nextButton.setEnabled(!isLastRequest); + + // Set the request action text. + switch (Integer.valueOf(requestDetails[MainWebViewActivity.REQUEST_DISPOSITION])) { + case MainWebViewActivity.REQUEST_DEFAULT: + // Set the text. + requestAction.setText(R.string.default_allowed); + + // Set the background color. + requestAction.setBackgroundColor(getResources().getColor(R.color.transparent)); + break; + + case MainWebViewActivity.REQUEST_ALLOWED: + // Set the text. + requestAction.setText(R.string.allowed); + + // Set the background color. + if (MainWebViewActivity.darkTheme) { + requestAction.setBackgroundColor(getResources().getColor(R.color.blue_700_50)); + } else { + requestAction.setBackgroundColor(getResources().getColor(R.color.blue_100)); + } + break; + + case MainWebViewActivity.REQUEST_BLOCKED: + // Set the text. + requestAction.setText(R.string.blocked); + + // Set the background color. + if (MainWebViewActivity.darkTheme) { + requestAction.setBackgroundColor(getResources().getColor(R.color.red_700_50)); + } else { + requestAction.setBackgroundColor(getResources().getColor(R.color.red_100)); + } + break; + } + + // Display the request URL. + requestUrl.setText(requestDetails[MainWebViewActivity.REQUEST_URL]); + + // Modify the dialog based on the request action. + if (requestDetails.length == 2) { // A default request. + // Hide the unused views. + requestBlockListLabel.setVisibility(View.GONE); + requestBlockList.setVisibility(View.GONE); + requestSubListLabel.setVisibility(View.GONE); + requestSubList.setVisibility(View.GONE); + requestBlockListEntriesLabel.setVisibility(View.GONE); + requestBlockListEntries.setVisibility(View.GONE); + requestBlockListOriginalEntryLabel.setVisibility(View.GONE); + requestBlockListOriginalEntry.setVisibility(View.GONE); + } else { // A blocked or allowed request. + // Set the text on the text views. + requestBlockList.setText(requestDetails[MainWebViewActivity.REQUEST_BLOCKLIST]); + requestBlockListEntries.setText(requestDetails[MainWebViewActivity.REQUEST_BLOCKLIST_ENTRIES]); + requestBlockListOriginalEntry.setText(requestDetails[MainWebViewActivity.REQUEST_BLOCKLIST_ORIGINAL_ENTRY]); + + // Set the sublist text. + switch (Integer.valueOf(requestDetails[MainWebViewActivity.REQUEST_SUBLIST])) { + case MainWebViewActivity.MAIN_WHITELIST: + requestSubList.setText(R.string.main_whitelist); + break; + + case MainWebViewActivity.FINAL_WHITELIST: + requestSubList.setText(R.string.final_whitelist); + break; + + case MainWebViewActivity.DOMAIN_WHITELIST: + requestSubList.setText(R.string.domain_whitelist); + break; + + case MainWebViewActivity.DOMAIN_INITIAL_WHITELIST: + requestSubList.setText(R.string.domain_initial_whitelist); + break; + + case MainWebViewActivity.DOMAIN_FINAL_WHITELIST: + requestSubList.setText(R.string.domain_final_whitelist); + break; + + case MainWebViewActivity.THIRD_PARTY_WHITELIST: + requestSubList.setText(R.string.third_party_whiteist); + break; + + case MainWebViewActivity.THIRD_PARTY_DOMAIN_WHITELIST: + requestSubList.setText(R.string.third_party_domain_whitelist); + break; + + case MainWebViewActivity.THIRD_PARTY_DOMAIN_INITIAL_WHITELIST: + requestSubList.setText(R.string.third_party_domain_initial_whitelist); + break; + + case MainWebViewActivity.MAIN_BLACKLIST: + requestSubList.setText(R.string.main_blacklist); + break; + + case MainWebViewActivity.INITIAL_BLACKLIST: + requestSubList.setText(R.string.initial_blacklist); + break; + + case MainWebViewActivity.FINAL_BLACKLIST: + requestSubList.setText(R.string.final_blacklist); + break; + + case MainWebViewActivity.DOMAIN_BLACKLIST: + requestSubList.setText(R.string.domain_blacklist); + break; + + case MainWebViewActivity.DOMAIN_INITIAL_BLACKLIST: + requestSubList.setText(R.string.domain_initial_blacklist); + break; + + case MainWebViewActivity.DOMAIN_FINAL_BLACKLIST: + requestSubList.setText(R.string.domain_final_blacklist); + break; + + case MainWebViewActivity.DOMAIN_REGULAR_EXPRESSION_BLACKLIST: + requestSubList.setText(R.string.domain_regular_expression_blacklist); + break; + + case MainWebViewActivity.THIRD_PARTY_BLACKLIST: + requestSubList.setText(R.string.third_party_blacklist); + break; + + case MainWebViewActivity.THIRD_PARTY_DOMAIN_BLACKLIST: + requestSubList.setText(R.string.third_party_domain_blacklist); + break; + + case MainWebViewActivity.THIRD_PARTY_DOMAIN_INITIAL_BLACKLIST: + requestSubList.setText(R.string.third_party_domain_initial_blacklist); + break; + + case MainWebViewActivity.THIRD_PARTY_REGULAR_EXPRESSION_BLACKLIST: + requestSubList.setText(R.string.third_party_regular_expression_blacklist); + break; + + case MainWebViewActivity.THIRD_PARTY_DOMAIN_REGULAR_EXPRESSION_BLACKLIST: + requestSubList.setText(R.string.third_party_domain_regular_expression_blacklist); + break; + + case MainWebViewActivity.REGULAR_EXPRESSION_BLACKLIST: + requestSubList.setText(R.string.regular_expression_blacklist); + break; + } + } + + // `onCreateDialog` requires the return of an alert dialog. + return alertDialog; + } +} diff --git a/app/src/main/java/com/stoutner/privacybrowser/helpers/BlockListHelper.java b/app/src/main/java/com/stoutner/privacybrowser/helpers/BlockListHelper.java index ec449a50..55ad050a 100644 --- a/app/src/main/java/com/stoutner/privacybrowser/helpers/BlockListHelper.java +++ b/app/src/main/java/com/stoutner/privacybrowser/helpers/BlockListHelper.java @@ -21,46 +21,46 @@ package com.stoutner.privacybrowser.helpers; import android.content.res.AssetManager; import android.net.Uri; -import android.util.Log; + +import com.stoutner.privacybrowser.activities.MainWebViewActivity; import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.util.ArrayList; -import java.util.LinkedList; import java.util.List; import java.util.regex.Pattern; public class BlockListHelper { public ArrayList> parseBlockList(AssetManager assets, String blockListName) { // Initialize the header list. - List headers = new ArrayList<>(); + List headers = new ArrayList<>(); // 0. // Initialize the white lists. - List mainWhiteList = new ArrayList<>(); - List finalWhiteList = new ArrayList<>(); - List domainWhiteList = new ArrayList<>(); - List domainInitialWhiteList = new ArrayList<>(); - List domainFinalWhiteList = new ArrayList<>(); - List thirdPartyWhiteList = new ArrayList<>(); - List thirdPartyDomainWhiteList = new ArrayList<>(); - List thirdPartyDomainInitialWhiteList = new ArrayList<>(); + List mainWhiteList = new ArrayList<>(); // 1. + List finalWhiteList = new ArrayList<>(); // 2. + List domainWhiteList = new ArrayList<>(); // 3. + List domainInitialWhiteList = new ArrayList<>(); // 4. + List domainFinalWhiteList = new ArrayList<>(); // 5. + List thirdPartyWhiteList = new ArrayList<>(); // 6. + List thirdPartyDomainWhiteList = new ArrayList<>(); // 7. + List thirdPartyDomainInitialWhiteList = new ArrayList<>(); // 8. // Initialize the black lists - List mainBlackList = new ArrayList<>(); - List initialBlackList = new ArrayList<>(); - List finalBlackList = new ArrayList<>(); - List domainBlackList = new ArrayList<>(); - List domainInitialBlackList = new ArrayList<>(); - List domainFinalBlackList = new ArrayList<>(); - List thirdPartyBlackList = new ArrayList<>(); - List thirdPartyInitialBlackList = new ArrayList<>(); - List thirdPartyDomainBlackList = new ArrayList<>(); - List thirdPartyDomainInitialBlackList = new ArrayList<>(); - List regularExpressionBlackList = new ArrayList<>(); - List domainRegularExpressionBlackList = new ArrayList<>(); - List thirdPartyRegularExpressionBlackList = new ArrayList<>(); - List thirdPartyDomainRegularExpressionBlackList = new ArrayList<>(); + List mainBlackList = new ArrayList<>(); // 9. + List initialBlackList = new ArrayList<>(); // 10. + List finalBlackList = new ArrayList<>(); // 11. + List domainBlackList = new ArrayList<>(); // 12. + List domainInitialBlackList = new ArrayList<>(); // 13. + List domainFinalBlackList = new ArrayList<>(); // 14. + List domainRegularExpressionBlackList = new ArrayList<>(); // 15. + List thirdPartyBlackList = new ArrayList<>(); // 16. + List thirdPartyInitialBlackList = new ArrayList<>(); // 17. + List thirdPartyDomainBlackList = new ArrayList<>(); // 18. + List thirdPartyDomainInitialBlackList = new ArrayList<>(); // 19. + List regularExpressionBlackList = new ArrayList<>(); // 20. + List thirdPartyRegularExpressionBlackList = new ArrayList<>(); // 21. + List thirdPartyDomainRegularExpressionBlackList = new ArrayList<>(); // 22. // Populate the block lists. The `try` is required by `InputStreamReader`. @@ -73,6 +73,7 @@ public class BlockListHelper { // Parse the block list. while ((blockListEntry = bufferedReader.readLine()) != null) { + // Store the original block list entry. String originalBlockListEntry = blockListEntry; // Remove any `^` from the block list entry. Privacy Browser does not process them in the interest of efficiency. @@ -163,7 +164,7 @@ public class BlockListHelper { String secondEntry = entry.substring(wildcardIndex + 1); // Create an entry string array. - String[] domainDoubleEntry = {domain, firstEntry, secondEntry}; + String[] domainDoubleEntry = {domain, firstEntry, secondEntry, originalBlockListEntry}; // Add the entry to the white list. thirdPartyDomainInitialWhiteList.add(domainDoubleEntry); @@ -172,7 +173,7 @@ public class BlockListHelper { // " - " + originalBlockListEntry); } else { // Process a third-party domain initial white list single entry. // Create a domain entry string array. - String[] domainEntry = {domain, entry}; + String[] domainEntry = {domain, entry, originalBlockListEntry}; // Add the entry to the third party domain initial white list. thirdPartyDomainInitialWhiteList.add(domainEntry); @@ -211,7 +212,7 @@ public class BlockListHelper { String secondEntry = entry.substring(wildcardIndex + 1); // Create an entry string array. - String[] domainDoubleEntry = {domain, firstEntry, secondEntry}; + String[] domainDoubleEntry = {domain, firstEntry, secondEntry, originalBlockListEntry}; // Add the entry to the white list. thirdPartyDomainWhiteList.add(domainDoubleEntry); @@ -220,7 +221,7 @@ public class BlockListHelper { // originalBlockListEntry); } else { // Process a third-party domain single entry. // Create an entry string array. - String[] domainEntry = {domain, entry}; + String[] domainEntry = {domain, entry, originalBlockListEntry}; // Add the entry to the white list. thirdPartyDomainWhiteList.add(domainEntry); @@ -266,7 +267,7 @@ public class BlockListHelper { String fifthEntry = fourthEntry.substring(fourthWildcardIndex + 1); // Create an entry string array. - String[] quintupleEntry = {firstEntry, realSecondEntry, realThirdEntry, realFourthEntry, fifthEntry}; + String[] quintupleEntry = {firstEntry, realSecondEntry, realThirdEntry, realFourthEntry, fifthEntry, originalBlockListEntry}; // Add the entry to the white list. thirdPartyWhiteList.add(quintupleEntry); @@ -275,7 +276,7 @@ public class BlockListHelper { // realFourthEntry + " , " + fifthEntry + " - " + originalBlockListEntry); } else { // Process a third-party white list quadruple entry. // Create an entry string array. - String[] quadrupleEntry = {firstEntry, realSecondEntry, realThirdEntry, fourthEntry}; + String[] quadrupleEntry = {firstEntry, realSecondEntry, realThirdEntry, fourthEntry, originalBlockListEntry}; // Add the entry to the white list. thirdPartyWhiteList.add(quadrupleEntry); @@ -285,7 +286,7 @@ public class BlockListHelper { } } else { // Process a third-party white list triple entry. // Create an entry string array. - String[] tripleEntry = {firstEntry, realSecondEntry, thirdEntry}; + String[] tripleEntry = {firstEntry, realSecondEntry, thirdEntry, originalBlockListEntry}; // Add the entry to the white list. thirdPartyWhiteList.add(tripleEntry); @@ -295,7 +296,7 @@ public class BlockListHelper { } } else { // Process a third-party white list double entry. // Create an entry string array. - String[] doubleEntry = {firstEntry, secondEntry}; + String[] doubleEntry = {firstEntry, secondEntry, originalBlockListEntry}; // Add the entry to the white list. thirdPartyWhiteList.add(doubleEntry); @@ -304,7 +305,7 @@ public class BlockListHelper { } } else { // Process a third-party white list single entry. // Create an entry string array. - String[] singleEntry = {entry}; + String[] singleEntry = {entry, originalBlockListEntry}; // Add the entry to the white list. thirdPartyWhiteList.add(singleEntry); @@ -360,7 +361,7 @@ public class BlockListHelper { String thirdEntry = secondEntry.substring(secondWildcardIndex + 1); // Create an entry string array. - String[] domainTripleEntry = {domain, firstEntry, realSecondEntry, thirdEntry}; + String[] domainTripleEntry = {domain, firstEntry, realSecondEntry, thirdEntry, originalBlockListEntry}; // Add the entry to the white list. domainInitialWhiteList.add(domainTripleEntry); @@ -369,7 +370,7 @@ public class BlockListHelper { // thirdEntry + " - " + originalBlockListEntry); } else { // Process a domain initial double entry. // Create an entry string array. - String[] domainDoubleEntry = {domain, firstEntry, secondEntry}; + String[] domainDoubleEntry = {domain, firstEntry, secondEntry, originalBlockListEntry}; // Add the entry to the white list. domainInitialWhiteList.add(domainDoubleEntry); @@ -379,7 +380,7 @@ public class BlockListHelper { } } else { // Process a domain initial single entry. // Create an entry string array. - String[] domainEntry = {domain, entry}; + String[] domainEntry = {domain, entry, originalBlockListEntry}; // Add the entry to the white list. domainInitialWhiteList.add(domainEntry); @@ -416,7 +417,7 @@ public class BlockListHelper { String secondEntry = entry.substring(wildcardIndex + 1); // Create an entry string array. - String[] domainDoubleEntry = {domain, firstEntry, secondEntry}; + String[] domainDoubleEntry = {domain, firstEntry, secondEntry, originalBlockListEntry}; // Add the entry to the white list. domainFinalWhiteList.add(domainDoubleEntry); @@ -425,7 +426,7 @@ public class BlockListHelper { // originalBlockListEntry); } else { // Process a domain final white list single entry. // create an entry string array. - String[] domainEntry = {domain, entry}; + String[] domainEntry = {domain, entry, originalBlockListEntry}; // Add the entry to the white list. domainFinalWhiteList.add(domainEntry); @@ -481,7 +482,7 @@ public class BlockListHelper { String fourthEntry = thirdEntry.substring(thirdWildcardIndex + 1); // Create an entry string array. - String[] domainQuadrupleEntry = {domain, firstEntry, realSecondEntry, realThirdEntry, fourthEntry}; + String[] domainQuadrupleEntry = {domain, firstEntry, realSecondEntry, realThirdEntry, fourthEntry, originalBlockListEntry}; // Add the entry to the white list. domainWhiteList.add(domainQuadrupleEntry); @@ -490,7 +491,7 @@ public class BlockListHelper { // realThirdEntry + " , " + fourthEntry + " - " + originalBlockListEntry); } else { // Process a domain white list triple entry. // Create an entry string array. - String[] domainTripleEntry = {domain, firstEntry, realSecondEntry, thirdEntry}; + String[] domainTripleEntry = {domain, firstEntry, realSecondEntry, thirdEntry, originalBlockListEntry}; // Add the entry to the white list. domainWhiteList.add(domainTripleEntry); @@ -500,7 +501,7 @@ public class BlockListHelper { } } else { // Process a domain white list double entry. // Create an entry string array. - String[] domainDoubleEntry = {domain, firstEntry, secondEntry}; + String[] domainDoubleEntry = {domain, firstEntry, secondEntry, originalBlockListEntry}; // Add the entry to the white list. domainWhiteList.add(domainDoubleEntry); @@ -510,7 +511,7 @@ public class BlockListHelper { } } else { // Process a domain white list single entry. // Create an entry string array. - String[] domainEntry = {domain, entry}; + String[] domainEntry = {domain, entry, originalBlockListEntry}; // Add the entry to the white list. domainWhiteList.add(domainEntry); @@ -534,7 +535,7 @@ public class BlockListHelper { String secondEntry = entry.substring(wildcardIndex + 1); // Create an entry string array. - String[] doubleEntry = {firstEntry, secondEntry}; + String[] doubleEntry = {firstEntry, secondEntry, originalBlockListEntry}; // Add the entry to the white list. finalWhiteList.add(doubleEntry); @@ -542,7 +543,7 @@ public class BlockListHelper { //Log.i("BlockLists", headers.get(1)[0] + " final white list added: " + firstEntry + " , " + secondEntry + " - " + originalBlockListEntry); } else { // Process a final white list single entry. // Create an entry string array. - String[] singleEntry = {entry}; + String[] singleEntry = {entry, originalBlockListEntry}; // Add the entry to the white list. finalWhiteList.add(singleEntry); @@ -567,7 +568,7 @@ public class BlockListHelper { String thirdEntry = secondEntry.substring(secondWildcardIndex + 1); // Create an entry string array. - String[] tripleEntry = {firstEntry, realSecondEntry, thirdEntry}; + String[] tripleEntry = {firstEntry, realSecondEntry, thirdEntry, originalBlockListEntry}; // Add the entry to the white list. mainWhiteList.add(tripleEntry); @@ -575,7 +576,7 @@ public class BlockListHelper { //Log.i("BlockLists", headers.get(1)[0] + " main white list added: " + firstEntry + " , " + realSecondEntry + " , " + thirdEntry + " - " + originalBlockListEntry); } else { // Process a main white list double entry. // Create an entry string array. - String[] doubleEntry = {firstEntry, secondEntry}; + String[] doubleEntry = {firstEntry, secondEntry, originalBlockListEntry}; // Add the entry to the white list. mainWhiteList.add(doubleEntry); @@ -584,7 +585,7 @@ public class BlockListHelper { } } else { // Process a main white list single entry. // Create an entry string array. - String[] singleEntry = {blockListEntry}; + String[] singleEntry = {blockListEntry, originalBlockListEntry}; // Add the entry to the white list. mainWhiteList.add(singleEntry); @@ -610,7 +611,7 @@ public class BlockListHelper { String secondEntry = entry.substring(wildcardIndex + 1); // Create an entry string array. - String[] doubleEntry = {firstEntry, secondEntry}; + String[] doubleEntry = {firstEntry, secondEntry, originalBlockListEntry}; // Add the entry to the black list. finalBlackList.add(doubleEntry); @@ -618,7 +619,7 @@ public class BlockListHelper { //Log.i("BlockLists", headers.get(1)[0] + " final black list added: " + firstEntry + " , " + secondEntry + " - " + originalBlockListEntry); } else { // Process a final black list single entry. // create an entry string array. - String[] singleEntry = {entry}; + String[] singleEntry = {entry, originalBlockListEntry}; // Add the entry to the black list. finalBlackList.add(singleEntry); @@ -686,7 +687,7 @@ public class BlockListHelper { String thirdEntry = secondEntry.substring(secondWildcardIndex + 1); // Create an entry string array. - String[] tripleDomainEntry = {domain, firstEntry, realSecondEntry, thirdEntry}; + String[] tripleDomainEntry = {domain, firstEntry, realSecondEntry, thirdEntry, originalBlockListEntry}; // Add the entry to the black list. thirdPartyDomainInitialBlackList.add(tripleDomainEntry); @@ -695,7 +696,7 @@ public class BlockListHelper { // " , " + thirdEntry + " - " + originalBlockListEntry); } else { // Process a third-party domain initial black list double entry. // Create an entry string array. - String[] doubleDomainEntry = {domain, firstEntry, secondEntry}; + String[] doubleDomainEntry = {domain, firstEntry, secondEntry, originalBlockListEntry}; // Add the entry to the black list. thirdPartyDomainInitialBlackList.add(doubleDomainEntry); @@ -705,7 +706,7 @@ public class BlockListHelper { } } else { // Process a third-party domain initial black list single entry. // Create an entry string array. - String[] singleEntry = {domain, entry}; + String[] singleEntry = {domain, entry, originalBlockListEntry}; // Add the entry to the black list. thirdPartyDomainInitialBlackList.add(singleEntry); @@ -736,7 +737,7 @@ public class BlockListHelper { } // Create an entry string array. - String[] domainEntry = {domain, entry}; + String[] domainEntry = {domain, entry, originalBlockListEntry}; // Add the entry to the black list. thirdPartyDomainRegularExpressionBlackList.add(domainEntry); @@ -789,7 +790,7 @@ public class BlockListHelper { String secondEntry = entry.substring(wildcardIndex + 1); // Create an entry string array. - String[] domainDoubleEntry = {domain, firstEntry, secondEntry}; + String[] domainDoubleEntry = {domain, firstEntry, secondEntry, originalBlockListEntry}; // Add the entry to the white list. thirdPartyDomainWhiteList.add(domainDoubleEntry); @@ -798,7 +799,7 @@ public class BlockListHelper { // originalBlockListEntry); } else { // Process a third-party domain white list single entry. // Create an entry string array. - String[] domainEntry = {domain, entry}; + String[] domainEntry = {domain, entry, originalBlockListEntry}; // Add the entry to the white list. thirdPartyDomainWhiteList.add(domainEntry); @@ -815,7 +816,7 @@ public class BlockListHelper { String secondEntry = entry.substring(wildcardIndex + 1); // Create an entry string array. - String[] domainDoubleEntry = {domain, firstEntry, secondEntry}; + String[] domainDoubleEntry = {domain, firstEntry, secondEntry, originalBlockListEntry}; // Add the entry to the black list thirdPartyDomainBlackList.add(domainDoubleEntry); @@ -824,7 +825,7 @@ public class BlockListHelper { // originalBlockListEntry); } else { // Process a third-party domain black list single entry. // Create an entry string array. - String[] domainEntry = {domain, entry}; + String[] domainEntry = {domain, entry, originalBlockListEntry}; // Add the entry to the black list. thirdPartyDomainBlackList.add(domainEntry); @@ -845,7 +846,7 @@ public class BlockListHelper { String secondEntry = entry.substring(wildcardIndex + 1); // Create an entry string array. - String[] doubleEntry = {firstEntry, secondEntry}; + String[] doubleEntry = {firstEntry, secondEntry, originalBlockListEntry}; // Add the entry to the black list. thirdPartyBlackList.add(doubleEntry); @@ -853,7 +854,7 @@ public class BlockListHelper { //Log.i("BlockLists", headers.get(1)[0] + " third-party black list added: " + firstEntry + " , " + secondEntry + " - " + originalBlockListEntry); } else { // Process a third-party black list single entry. // Create an entry string array. - String[] singleEntry = {entry}; + String[] singleEntry = {entry, originalBlockListEntry}; // Add an entry to the black list. thirdPartyBlackList.add(singleEntry); @@ -878,7 +879,7 @@ public class BlockListHelper { String secondEntry = entry.substring(wildcardIndex + 1); // Create an entry string array. - String[] thirdPartyDoubleEntry = {firstEntry, secondEntry}; + String[] thirdPartyDoubleEntry = {firstEntry, secondEntry, originalBlockListEntry}; // Add the entry to the black list. thirdPartyInitialBlackList.add(thirdPartyDoubleEntry); @@ -886,7 +887,7 @@ public class BlockListHelper { //Log.i("BlockLists", headers.get(1)[0] + " third-party initial black list added: " + firstEntry + " , " + secondEntry + " - " + originalBlockListEntry); } else { // Process a third-party initial black list single entry. // Create an entry string array. - String[] singleEntry = {entry}; + String[] singleEntry = {entry, originalBlockListEntry}; // Add the entry to the black list. thirdPartyInitialBlackList.add(singleEntry); @@ -905,7 +906,7 @@ public class BlockListHelper { } // Create an entry string array. - String[] singleEntry = {entry}; + String[] singleEntry = {entry, originalBlockListEntry}; // Add the entry to the black list. thirdPartyRegularExpressionBlackList.add(singleEntry); @@ -920,7 +921,7 @@ public class BlockListHelper { entry = entry.substring(0, entry.length() - 1); // Create an entry string array. - String[] singleEntry = {entry}; + String[] singleEntry = {entry, originalBlockListEntry}; // Add the entry to the black list. thirdPartyBlackList.add(singleEntry); @@ -951,7 +952,7 @@ public class BlockListHelper { String fourthEntry = thirdEntry.substring(thirdWildcardIndex + 1); // Create an entry string array. - String[] quadrupleEntry = {firstEntry, realSecondEntry, realThirdEntry, fourthEntry}; + String[] quadrupleEntry = {firstEntry, realSecondEntry, realThirdEntry, fourthEntry, originalBlockListEntry}; // Add the entry to the black list. thirdPartyBlackList.add(quadrupleEntry); @@ -960,7 +961,7 @@ public class BlockListHelper { // fourthEntry + " - " + originalBlockListEntry); } else { // Process a third-party black list triple entry. // Create an entry string array. - String[] tripleEntry = {firstEntry, realSecondEntry, thirdEntry}; + String[] tripleEntry = {firstEntry, realSecondEntry, thirdEntry, originalBlockListEntry}; // Add the entry to the black list. thirdPartyBlackList.add(tripleEntry); @@ -970,7 +971,7 @@ public class BlockListHelper { } } else { // Process a third-party black list double entry. // Create an entry string array. - String[] doubleEntry = {firstEntry, secondEntry}; + String[] doubleEntry = {firstEntry, secondEntry, originalBlockListEntry}; // Add the entry to the black list. thirdPartyBlackList.add(doubleEntry); @@ -983,7 +984,7 @@ public class BlockListHelper { String entry = blockListEntry.substring(0, blockListEntry.indexOf("$")); // Create an entry string array. - String[] singleEntry = {entry}; + String[] singleEntry = {entry, originalBlockListEntry}; // Add the entry to the black list. thirdPartyBlackList.add(singleEntry); @@ -1037,7 +1038,7 @@ public class BlockListHelper { String thirdEntry = secondEntry.substring((secondWildcardIndex + 1)); // Create an entry string array. - String[] domainTripleEntry = {domain, firstEntry, realSecondEntry, thirdEntry}; + String[] domainTripleEntry = {domain, firstEntry, realSecondEntry, thirdEntry, originalBlockListEntry}; // Add the entry to the white list. domainWhiteList.add(domainTripleEntry); @@ -1046,7 +1047,7 @@ public class BlockListHelper { // " - " + originalBlockListEntry); } else { // Process a domain white list double entry. // Create an entry string array. - String[] domainDoubleEntry = {domain, firstEntry, secondEntry}; + String[] domainDoubleEntry = {domain, firstEntry, secondEntry, originalBlockListEntry}; // Add the entry to the white list. domainWhiteList.add(domainDoubleEntry); @@ -1055,7 +1056,7 @@ public class BlockListHelper { } } else { // Process a domain white list single entry. // Create an entry string array. - String[] domainEntry = {domain, entry}; + String[] domainEntry = {domain, entry, originalBlockListEntry}; // Add the entry to the white list. domainWhiteList.add(domainEntry); @@ -1098,7 +1099,7 @@ public class BlockListHelper { //Log.i("BlockLists", headers.get(1)[0] + " not added: " + originalBlockListEntry); } else { // Process a domain initial black list entry // Create an entry string array. - String[] domainEntry = {domain, entryBase}; + String[] domainEntry = {domain, entryBase, originalBlockListEntry}; // Add the entry to the black list. domainInitialBlackList.add(domainEntry); @@ -1118,7 +1119,7 @@ public class BlockListHelper { String secondEntry = entryBase.substring(wildcardIndex + 1); // Create an entry string array. - String[] domainDoubleEntry = {domain, firstEntry, secondEntry}; + String[] domainDoubleEntry = {domain, firstEntry, secondEntry, originalBlockListEntry}; // Add the entry to the black list. domainFinalBlackList.add(domainDoubleEntry); @@ -1127,7 +1128,7 @@ public class BlockListHelper { // originalBlockListEntry); } else { // Process a domain final black list single entry. // Create an entry string array. - String[] domainEntry = {domain, entryBase}; + String[] domainEntry = {domain, entryBase, originalBlockListEntry}; // Add the entry to the black list. domainFinalBlackList.add(domainEntry); @@ -1136,7 +1137,7 @@ public class BlockListHelper { } } else if (entry.contains("\\")) { // Process a domain regular expression black list entry. // Create an entry string array. - String[] domainEntry = {domain, entry}; + String[] domainEntry = {domain, entry, originalBlockListEntry}; // Add the entry to the black list. domainRegularExpressionBlackList.add(domainEntry); @@ -1159,7 +1160,7 @@ public class BlockListHelper { String thirdEntry = secondEntry.substring(secondWildcardIndex + 1); // Create an entry string array. - String[] domainTripleEntry = {domain, firstEntry, realSecondEntry, thirdEntry}; + String[] domainTripleEntry = {domain, firstEntry, realSecondEntry, thirdEntry, originalBlockListEntry}; // Add the entry to the black list. domainBlackList.add(domainTripleEntry); @@ -1168,7 +1169,7 @@ public class BlockListHelper { // " - " + originalBlockListEntry); } else { // Process a domain black list double entry. // Create an entry string array. - String[] domainDoubleEntry = {domain, firstEntry, secondEntry}; + String[] domainDoubleEntry = {domain, firstEntry, secondEntry, originalBlockListEntry}; // Add the entry to the black list. domainBlackList.add(domainDoubleEntry); @@ -1178,7 +1179,7 @@ public class BlockListHelper { } } else { // Process a domain black list single entry. // Create an entry string array. - String[] domainEntry = {domain, entry}; + String[] domainEntry = {domain, entry, originalBlockListEntry}; // Add the entry to the black list. domainBlackList.add(domainEntry); @@ -1206,7 +1207,7 @@ public class BlockListHelper { String secondEntry = blockListEntry.substring(wildcardIndex + 1); // Create an entry string array. - String[] doubleEntry = {firstEntry, secondEntry}; + String[] doubleEntry = {firstEntry, secondEntry, originalBlockListEntry}; // Add the entry to the white list. mainWhiteList.add(doubleEntry); @@ -1214,7 +1215,7 @@ public class BlockListHelper { //Log.i("BlockLists", headers.get(1)[0] + " main white list added: " + firstEntry + " , " + secondEntry + " - " + originalBlockListEntry); } else { // Process a white list single entry. // Create an entry string array. - String[] singleEntry = {blockListEntry}; + String[] singleEntry = {blockListEntry, originalBlockListEntry}; // Add the entry to the white list. mainWhiteList.add(singleEntry); @@ -1226,7 +1227,7 @@ public class BlockListHelper { blockListEntry = blockListEntry.substring(0, blockListEntry.indexOf("$")); // Create an entry string array. - String[] singleEntry = {blockListEntry}; + String[] singleEntry = {blockListEntry, originalBlockListEntry}; // Add the entry to the black list. regularExpressionBlackList.add(singleEntry); @@ -1256,7 +1257,7 @@ public class BlockListHelper { String secondEntry = entry.substring(wildcardIndex + 1); // Create an entry string array. - String[] doubleEntry = {firstEntry, secondEntry}; + String[] doubleEntry = {firstEntry, secondEntry, originalBlockListEntry}; // Add the entry to the black list. initialBlackList.add(doubleEntry); @@ -1264,7 +1265,7 @@ public class BlockListHelper { //Log.i("BlockLists", headers.get(1)[0] + " initial black list added: " + firstEntry + " , " + secondEntry + " - " + originalBlockListEntry); } else { // Process an initial black list single entry. // Create an entry string array. - String[] singleEntry = {entry}; + String[] singleEntry = {entry, originalBlockListEntry}; // Add the entry to the black list. initialBlackList.add(singleEntry); @@ -1294,7 +1295,7 @@ public class BlockListHelper { String thirdEntry = secondEntry.substring(secondWildcardIndex + 1); // Create an entry string array. - String[] tripleEntry = {firstEntry, realSecondEntry, thirdEntry}; + String[] tripleEntry = {firstEntry, realSecondEntry, thirdEntry, originalBlockListEntry}; // Add the entry to the black list. finalBlackList.add(tripleEntry); @@ -1303,7 +1304,7 @@ public class BlockListHelper { // originalBlockListEntry); } else { // Process a final black list double entry. // Create an entry string array. - String[] doubleEntry = {firstEntry, secondEntry}; + String[] doubleEntry = {firstEntry, secondEntry, originalBlockListEntry}; // Add the entry to the black list. finalBlackList.add(doubleEntry); @@ -1312,7 +1313,7 @@ public class BlockListHelper { } } else { // Process a final black list single entry. // Create an entry sting array. - String[] singleEntry = {entry}; + String[] singleEntry = {entry, originalBlockListEntry}; // Add the entry to the black list. finalBlackList.add(singleEntry); @@ -1337,7 +1338,7 @@ public class BlockListHelper { String thirdEntry = secondEntry.substring(secondWildcardIndex + 1); // Create an entry string array. - String[] tripleEntry = {firstEntry, realSecondEntry, thirdEntry}; + String[] tripleEntry = {firstEntry, realSecondEntry, thirdEntry, originalBlockListEntry}; // Add the entry to the black list. mainBlackList.add(tripleEntry); @@ -1345,7 +1346,7 @@ public class BlockListHelper { //Log.i("BlockLists", headers.get(1)[0] + " main black list added: " + firstEntry + " , " + realSecondEntry + " , " + thirdEntry + " - " + originalBlockListEntry); } else { // Process a main black list double entry. // Create an entry string array. - String[] doubleEntry = {firstEntry, secondEntry}; + String[] doubleEntry = {firstEntry, secondEntry, originalBlockListEntry}; // Add the entry to the black list. mainBlackList.add(doubleEntry); @@ -1354,7 +1355,7 @@ public class BlockListHelper { } } else { // Process a main black list single entry. // Create an entry string array. - String[] singleEntry = {blockListEntry}; + String[] singleEntry = {blockListEntry, originalBlockListEntry}; // Add the entry to the black list. mainBlackList.add(singleEntry); @@ -1391,7 +1392,7 @@ public class BlockListHelper { String secondEntry = entry.substring(wildcardIndex + 1); // Create an entry string array. - String[] doubleEntry = {firstEntry, secondEntry}; + String[] doubleEntry = {firstEntry, secondEntry, originalBlockListEntry}; // Add the entry to the black list. initialBlackList.add(doubleEntry); @@ -1399,7 +1400,7 @@ public class BlockListHelper { //Log.i("BlockLists", headers.get(1)[0] + " initial black list added: " + firstEntry + " , " + secondEntry + " - " + originalBlockListEntry); } else { // Process an initial black list single entry. // Create an entry string array. - String[] singleEntry = {entry}; + String[] singleEntry = {entry, originalBlockListEntry}; // Add the entry to the black list. initialBlackList.add(singleEntry); @@ -1427,7 +1428,7 @@ public class BlockListHelper { String thirdEntry = secondEntry.substring(secondWildcardIndex + 1); // Create an entry string array. - String[] tripleEntry = {firstEntry, realSecondEntry, thirdEntry}; + String[] tripleEntry = {firstEntry, realSecondEntry, thirdEntry, originalBlockListEntry}; // Add the entry to the black list. finalBlackList.add(tripleEntry); @@ -1436,7 +1437,7 @@ public class BlockListHelper { // originalBlockListEntry); } else { // Process a final black list double entry. // Create an entry string array. - String[] doubleEntry = {firstEntry, secondEntry}; + String[] doubleEntry = {firstEntry, secondEntry, originalBlockListEntry}; // Add the entry to the black list. finalBlackList.add(doubleEntry); @@ -1445,7 +1446,7 @@ public class BlockListHelper { } } else { // Process a final black list single entry. // Create an entry string array. - String[] singleEntry = {entry}; + String[] singleEntry = {entry, originalBlockListEntry}; // Add the entry to the black list. finalBlackList.add(singleEntry); @@ -1486,7 +1487,7 @@ public class BlockListHelper { String fifthEntry = fourthEntry.substring(fourthWildcardIndex + 1); // Create an entry string array. - String[] quintupleEntry = {firstEntry, realSecondEntry, realThirdEntry, realFourthEntry, fifthEntry}; + String[] quintupleEntry = {firstEntry, realSecondEntry, realThirdEntry, realFourthEntry, fifthEntry, originalBlockListEntry}; // Add the entry to the black list. mainBlackList.add(quintupleEntry); @@ -1495,7 +1496,7 @@ public class BlockListHelper { // realFourthEntry + " , " + fifthEntry + " - " + originalBlockListEntry); } else { // Process a main black list quadruple entry. // Create an entry string array. - String[] quadrupleEntry = {firstEntry, realSecondEntry, realThirdEntry, fourthEntry}; + String[] quadrupleEntry = {firstEntry, realSecondEntry, realThirdEntry, fourthEntry, originalBlockListEntry}; // Add the entry to the black list. mainBlackList.add(quadrupleEntry); @@ -1505,7 +1506,7 @@ public class BlockListHelper { } } else { // Process a main black list triple entry. // Create an entry string array. - String[] tripleEntry = {firstEntry, realSecondEntry, thirdEntry}; + String[] tripleEntry = {firstEntry, realSecondEntry, thirdEntry, originalBlockListEntry}; // Add the entry to the black list. mainBlackList.add(tripleEntry); @@ -1514,7 +1515,7 @@ public class BlockListHelper { } } else { // Process a main black list double entry. // Create an entry string array. - String[] doubleEntry = {firstEntry, secondEntry}; + String[] doubleEntry = {firstEntry, secondEntry, originalBlockListEntry}; // Add the entry to the black list. mainBlackList.add(doubleEntry); @@ -1523,7 +1524,7 @@ public class BlockListHelper { } } else { // Process a main black list single entry. // Create an entry string array. - String[] singleEntry = {blockListEntry}; + String[] singleEntry = {blockListEntry, originalBlockListEntry}; // Add the entry to the black list. mainBlackList.add(singleEntry); @@ -1575,15 +1576,18 @@ public class BlockListHelper { } public boolean isBlocked(String currentUrl, String resourceUrl, ArrayList> blockList) { - // Get the list title. - String blockListTitle = blockList.get(0).get(1)[0]; + // Get the block list name. + String BLOCK_LIST_NAME_STRING = blockList.get(0).get(1)[0]; + // Get the current domain. Uri currentUri = Uri.parse(currentUrl); String currentDomain = currentUri.getHost(); + // Get the resource domain. Uri resourceUri = Uri.parse(resourceUrl); String resourceDomain = resourceUri.getHost(); + // Initialize the third-party request tracker. boolean thirdPartyRequest = false; // If one of the domains is `about:blank` it will throw a null object reference on the string comparison. @@ -1593,30 +1597,36 @@ public class BlockListHelper { // Process the white lists. // Main white list. - for (String[] whiteListEntry : blockList.get(1)) { + for (String[] whiteListEntry : blockList.get(MainWebViewActivity.MAIN_WHITELIST)) { switch (whiteListEntry.length) { - case 1: // There is one entry. + case 2: // There is one entry. if (resourceUrl.contains(whiteListEntry[0])) { - Log.i("BlockLists", "Request allowed by " + blockListTitle + " main white list: " + whiteListEntry[0] + " - " + resourceUrl); + // Store the entry in the resource request log. + MainWebViewActivity.whiteListResultStringArray = new String[] {String.valueOf(MainWebViewActivity.REQUEST_ALLOWED), resourceUrl, BLOCK_LIST_NAME_STRING, + String.valueOf(MainWebViewActivity.MAIN_WHITELIST), whiteListEntry[0], whiteListEntry[1]}; // Not blocked. return false; } break; - case 2: + case 3: // There are two entries. if (resourceUrl.contains(whiteListEntry[0]) && resourceUrl.contains(whiteListEntry[1])) { - Log.i("BlockLists", "Request allowed by " + blockListTitle + " main white list: " + whiteListEntry[0] + " , " + whiteListEntry[1] + " - " + resourceUrl); + // Store the entry in the resource request log. + MainWebViewActivity.whiteListResultStringArray = new String[] {String.valueOf(MainWebViewActivity.REQUEST_ALLOWED), resourceUrl, BLOCK_LIST_NAME_STRING, + String.valueOf(MainWebViewActivity.MAIN_WHITELIST), whiteListEntry[0] + "\n" + whiteListEntry[1], + whiteListEntry[2]}; // Not blocked. return false; } break; - case 3: + case 4: // There are three entries. if (resourceUrl.contains(whiteListEntry[0]) && resourceUrl.contains(whiteListEntry[1]) && resourceUrl.contains(whiteListEntry[2])) { - Log.i("BlockLists", "Request allowed by " + blockListTitle + " main white list: " + whiteListEntry[0] + " , " + whiteListEntry[1] + " , " + whiteListEntry[2] + " - " + - resourceUrl); + // Store the entry in the resource request log. + MainWebViewActivity.whiteListResultStringArray = new String[] {String.valueOf(MainWebViewActivity.REQUEST_ALLOWED), resourceUrl, BLOCK_LIST_NAME_STRING, + String.valueOf(MainWebViewActivity.MAIN_WHITELIST), whiteListEntry[0] + "\n" + whiteListEntry[1] + "\n" + whiteListEntry[2], whiteListEntry[3]}; // Not blocked. return false; @@ -1626,17 +1636,21 @@ public class BlockListHelper { } // Final white list. - for (String[] whiteListEntry : blockList.get(2)) { - if (whiteListEntry.length == 1) { // There is one entry. + for (String[] whiteListEntry : blockList.get(MainWebViewActivity.FINAL_WHITELIST)) { + if (whiteListEntry.length == 2) { // There is one entry. if (resourceUrl.contains(whiteListEntry[0])) { - Log.i("BlockLists", "Request allowed by " + blockListTitle + " final white list: " + whiteListEntry[0] + " - " + resourceUrl); + // Store the entry in the resource request log. + MainWebViewActivity.whiteListResultStringArray = new String[] {String.valueOf(MainWebViewActivity.REQUEST_ALLOWED), resourceUrl, BLOCK_LIST_NAME_STRING, + String.valueOf(MainWebViewActivity.FINAL_WHITELIST), whiteListEntry[0], whiteListEntry[1]}; // Not blocked. return false; } } else { // There are two entries. if (resourceUrl.contains(whiteListEntry[0]) && resourceUrl.contains(whiteListEntry[1])) { - Log.i("BlockLists", "Request allowed by " + blockListTitle + " final white list: " + whiteListEntry[0] + " , " + whiteListEntry[1] + " - " + resourceUrl); + // Store the entry in the resource request log. + MainWebViewActivity.whiteListResultStringArray = new String[] {String.valueOf(MainWebViewActivity.REQUEST_ALLOWED), resourceUrl, BLOCK_LIST_NAME_STRING, + String.valueOf(MainWebViewActivity.FINAL_WHITELIST), whiteListEntry[0] + "\n" + whiteListEntry[1], whiteListEntry[2]}; // Not blocked. return false; @@ -1647,42 +1661,49 @@ public class BlockListHelper { // Only check the domain lists if the current domain is not null (like `about:blank`). if (currentDomain != null) { // Domain white list. - for (String[] whiteListEntry : blockList.get(3)) { + for (String[] whiteListEntry : blockList.get(MainWebViewActivity.DOMAIN_WHITELIST)) { switch (whiteListEntry.length) { - case 2: // There is one entry. + case 3: // There is one entry. if (currentDomain.endsWith(whiteListEntry[0]) && resourceUrl.contains(whiteListEntry[1])) { - Log.i("BlockLists", "Request allowed by " + blockListTitle + " domain white list: " + whiteListEntry[0] + " , " + whiteListEntry[1] + " --" + resourceUrl); + // Store the entry in the resource request log. + MainWebViewActivity.whiteListResultStringArray = new String[] {String.valueOf(MainWebViewActivity.REQUEST_ALLOWED), resourceUrl, BLOCK_LIST_NAME_STRING, + String.valueOf(MainWebViewActivity.DOMAIN_WHITELIST), whiteListEntry[0] + "\n" + whiteListEntry[1], whiteListEntry[2]}; // Not blocked. return false; } break; - case 3: // There are two entries. + case 4: // There are two entries. if (currentDomain.endsWith(whiteListEntry[0]) && resourceUrl.contains(whiteListEntry[1]) && resourceUrl.contains(whiteListEntry[2])) { - Log.i("BlockLists", "Request allowed by " + blockListTitle + " domain white list: " + whiteListEntry[0] + " , " + whiteListEntry[1] + " , " + whiteListEntry[2] + - " - " + resourceUrl); + // Store the entry in the resource request log. + MainWebViewActivity.whiteListResultStringArray = new String[] {String.valueOf(MainWebViewActivity.REQUEST_ALLOWED), resourceUrl, BLOCK_LIST_NAME_STRING, + String.valueOf(MainWebViewActivity.DOMAIN_WHITELIST), whiteListEntry[0] + "\n" + whiteListEntry[1] + "\n" + whiteListEntry[2], whiteListEntry[3]}; // Not blocked. return false; } break; - case 4: // There are three entries. + case 5: // There are three entries. if (currentDomain.endsWith(whiteListEntry[0]) && resourceUrl.contains(whiteListEntry[1]) && resourceUrl.contains(whiteListEntry[2]) && resourceUrl.contains(whiteListEntry[3])) { - Log.i("BlockLists", "Request allowed by " + blockListTitle + " domain white list: " + whiteListEntry[0] + " , " + whiteListEntry[1] + " , " + whiteListEntry[2] + - " , " + whiteListEntry[3] + " - " + resourceUrl); + // Store the entry in the resource request log. + MainWebViewActivity.whiteListResultStringArray = new String[] {String.valueOf(MainWebViewActivity.REQUEST_ALLOWED), resourceUrl, BLOCK_LIST_NAME_STRING, + String.valueOf(MainWebViewActivity.DOMAIN_WHITELIST), whiteListEntry[0] + "\n" + whiteListEntry[1] + "\n" + whiteListEntry[2] + "\n" + whiteListEntry[3], + whiteListEntry[4]}; // Not blocked. return false; } break; - case 5: // There are four entries. + case 6: // There are four entries. if (currentDomain.endsWith(whiteListEntry[0]) && resourceUrl.contains(whiteListEntry[1]) && resourceUrl.contains(whiteListEntry[2]) && resourceUrl.contains(whiteListEntry[3]) && resourceUrl.contains(whiteListEntry[4])) { - Log.i("BlockLists", "Request allowed by " + blockListTitle + " domain white list: " + whiteListEntry[0] + " , " + whiteListEntry[1] + " , " + whiteListEntry[2] + - " , " + whiteListEntry[3] + " , " + whiteListEntry[4] + " - " + resourceUrl); + // Store the entry in the resource request log. + MainWebViewActivity.whiteListResultStringArray = new String[] {String.valueOf(MainWebViewActivity.REQUEST_ALLOWED), resourceUrl, BLOCK_LIST_NAME_STRING, + String.valueOf(MainWebViewActivity.DOMAIN_WHITELIST), whiteListEntry[0] + "\n" + whiteListEntry[1] + "\n" + whiteListEntry[2] + "\n" + whiteListEntry[3] + "\n" + + whiteListEntry[4], whiteListEntry[5]}; // Not blocked. return false; @@ -1692,31 +1713,36 @@ public class BlockListHelper { } // Domain initial white list. - for (String[] whiteListEntry : blockList.get(4)) { + for (String[] whiteListEntry : blockList.get(MainWebViewActivity.DOMAIN_INITIAL_WHITELIST)) { switch (whiteListEntry.length) { - case 2: // There is one entry. + case 3: // There is one entry. if (currentDomain.endsWith(whiteListEntry[0]) && resourceUrl.startsWith(whiteListEntry[1])) { - Log.i("BlockLists", "Request allowed by " + blockListTitle + " domain initial white list: " + whiteListEntry[0] + " , " + whiteListEntry[1] + " - " + resourceUrl); + // Store the entry in the resource request log. + MainWebViewActivity.whiteListResultStringArray = new String[] {String.valueOf(MainWebViewActivity.REQUEST_ALLOWED), resourceUrl, BLOCK_LIST_NAME_STRING, + String.valueOf(MainWebViewActivity.DOMAIN_INITIAL_WHITELIST), whiteListEntry[0] + "\n" + whiteListEntry[1], whiteListEntry[2]}; // Not blocked. return false; } break; - case 3: // There are two entries. + case 4: // There are two entries. if (currentDomain.endsWith(whiteListEntry[0]) && resourceUrl.startsWith(whiteListEntry[1]) && resourceUrl.contains(whiteListEntry[2])) { - Log.i("BlockLists", "Request allowed by " + blockListTitle + " domain initial white list: " + whiteListEntry[0] + " , " + whiteListEntry[1] + " , " + - whiteListEntry[2] + " - " + resourceUrl); + // Store the entry in the resource request log. + MainWebViewActivity.whiteListResultStringArray = new String[] {String.valueOf(MainWebViewActivity.REQUEST_ALLOWED), resourceUrl, BLOCK_LIST_NAME_STRING, + String.valueOf(MainWebViewActivity.DOMAIN_INITIAL_WHITELIST), whiteListEntry[0] + "\n" + whiteListEntry[1] + "\n" + whiteListEntry[2], whiteListEntry[3]}; // Not blocked. return false; } break; - case 4: // There are three entries. + case 5: // There are three entries. if (currentDomain.endsWith(whiteListEntry[0]) && resourceUrl.startsWith(whiteListEntry[1]) && resourceUrl.contains(whiteListEntry[2]) && resourceUrl.startsWith(whiteListEntry[3])) { - Log.i("BlockLists", "Request allowed by " + blockListTitle + " domain initial white list: " + whiteListEntry[0] + " , " + whiteListEntry[1] + " , " + - whiteListEntry[2] + " , " + whiteListEntry[3] + " - " + resourceUrl); + // Store the entry in the resource request log. + MainWebViewActivity.whiteListResultStringArray = new String[] {String.valueOf(MainWebViewActivity.REQUEST_ALLOWED), resourceUrl, BLOCK_LIST_NAME_STRING, + String.valueOf(MainWebViewActivity.DOMAIN_INITIAL_WHITELIST), whiteListEntry[0] + "\n" + whiteListEntry[1] + "\n" + whiteListEntry[2] + "\n" + whiteListEntry[3], + whiteListEntry[4]}; // Not blocked. return false; @@ -1726,21 +1752,25 @@ public class BlockListHelper { } // Domain final white list. - for (String[] whiteListEntry : blockList.get(5)) { + for (String[] whiteListEntry : blockList.get(MainWebViewActivity.DOMAIN_FINAL_WHITELIST)) { switch (whiteListEntry.length) { - case 2: // There is one entry; + case 3: // There is one entry; if (currentDomain.endsWith(whiteListEntry[0]) && resourceUrl.endsWith(whiteListEntry[1])) { - Log.i("BlockLists", "Request allowed by " + blockListTitle + " domain final white list: " + whiteListEntry[0] + " , " + whiteListEntry[1] + " - " + resourceUrl); + // Store the entry in the resource request log. + MainWebViewActivity.whiteListResultStringArray = new String[] {String.valueOf(MainWebViewActivity.REQUEST_ALLOWED), resourceUrl, BLOCK_LIST_NAME_STRING, + String.valueOf(MainWebViewActivity.DOMAIN_FINAL_WHITELIST), whiteListEntry[0] + "\n" + whiteListEntry[1], whiteListEntry[2]}; // Not blocked. return false; } break; - case 3: // There are two entries; + case 4: // There are two entries; if (currentDomain.endsWith(whiteListEntry[0]) && resourceUrl.contains(whiteListEntry[1]) && resourceUrl.endsWith(whiteListEntry[2])) { - Log.i("BlockLists", "Request allowed by " + blockListTitle + " domain final white list: " + whiteListEntry[0] + " , " + whiteListEntry[1] + " , " + - whiteListEntry[2] + " - " + resourceUrl); + // Store the entry in the resource request log. + MainWebViewActivity.whiteListResultStringArray = new String[] {String.valueOf(MainWebViewActivity.REQUEST_ALLOWED), resourceUrl, BLOCK_LIST_NAME_STRING, + String.valueOf(MainWebViewActivity.DOMAIN_FINAL_WHITELIST), whiteListEntry[0] + "\n" + whiteListEntry[1] + "\n" + whiteListEntry[2], whiteListEntry[3]}; + // Not blocked. return false; @@ -1753,51 +1783,59 @@ public class BlockListHelper { // Only check the third-party white lists if this is a third-party request. if (thirdPartyRequest) { // Third-party white list. - for (String[] whiteListEntry : blockList.get(6)) { + for (String[] whiteListEntry : blockList.get(MainWebViewActivity.THIRD_PARTY_WHITELIST)) { switch (whiteListEntry.length) { - case 1: // There is one entry + case 2: // There is one entry if (resourceUrl.contains(whiteListEntry[0])) { - Log.i("BlockLists", "Request allowed by " + blockListTitle + " third-party white list: " + whiteListEntry[0] + " - " + resourceUrl); + // Store the entry in the resource request log. + MainWebViewActivity.whiteListResultStringArray = new String[] {String.valueOf(MainWebViewActivity.REQUEST_ALLOWED), resourceUrl, BLOCK_LIST_NAME_STRING, + String.valueOf(MainWebViewActivity.THIRD_PARTY_WHITELIST), whiteListEntry[0], whiteListEntry[1]}; // Not blocked. return false; } break; - case 2: // There are two entries. + case 3: // There are two entries. if (resourceUrl.contains(whiteListEntry[0]) && resourceUrl.contains(whiteListEntry[1])) { - Log.i("BlockLists", "Request allowed by " + blockListTitle + " third-party white list: " + whiteListEntry[0] + " , " + whiteListEntry[1] + " - " + resourceUrl); + // Store the entry in the resource request log. + MainWebViewActivity.whiteListResultStringArray = new String[] {String.valueOf(MainWebViewActivity.REQUEST_ALLOWED), resourceUrl, BLOCK_LIST_NAME_STRING, + String.valueOf(MainWebViewActivity.THIRD_PARTY_WHITELIST), whiteListEntry[0] + "\n" + whiteListEntry[1], whiteListEntry[2]}; // Not blocked. return false; } break; - case 3: // There are three entries. + case 4: // There are three entries. if (resourceUrl.contains(whiteListEntry[0]) && resourceUrl.contains(whiteListEntry[1]) && resourceUrl.contains(whiteListEntry[2])) { - Log.i("BlockLists", "Request allowed by " + blockListTitle + " third-party white list: " + whiteListEntry[0] + " , " + whiteListEntry[1] + " , " + whiteListEntry[2] + - " - " + resourceUrl); + // Store the entry in the resource request log. + MainWebViewActivity.whiteListResultStringArray = new String[] {String.valueOf(MainWebViewActivity.REQUEST_ALLOWED), resourceUrl, BLOCK_LIST_NAME_STRING, + String.valueOf(MainWebViewActivity.THIRD_PARTY_WHITELIST), whiteListEntry[0] + "\n" + whiteListEntry[1] + "\n" + whiteListEntry[2], whiteListEntry[3]}; // Not blocked. return false; } break; - case 4: // There are four entries. + case 5: // There are four entries. if (resourceUrl.contains(whiteListEntry[0]) && resourceUrl.contains(whiteListEntry[1]) && resourceUrl.contains(whiteListEntry[2]) && resourceUrl.contains(whiteListEntry[3])) { - Log.i("BlockLists", "Request allowed by " + blockListTitle + " third-party white list: " + whiteListEntry[0] + " , " + whiteListEntry[1] + " , " + whiteListEntry[2] + - " , " + whiteListEntry[3] + " - " + resourceUrl); - + // Store the entry in the resource request log. + MainWebViewActivity.whiteListResultStringArray = new String[] {String.valueOf(MainWebViewActivity.REQUEST_ALLOWED), resourceUrl, BLOCK_LIST_NAME_STRING, + String.valueOf(MainWebViewActivity.THIRD_PARTY_WHITELIST), whiteListEntry[0] + "\n" + whiteListEntry[1] + "\n" + whiteListEntry[2] + "\n" + whiteListEntry[3], + whiteListEntry[4]}; // Not blocked. return false; } break; - case 5: // There are five entries. + case 6: // There are five entries. if (resourceUrl.contains(whiteListEntry[0]) && resourceUrl.contains(whiteListEntry[1]) && resourceUrl.contains(whiteListEntry[2]) && resourceUrl.contains(whiteListEntry[3]) && resourceUrl.contains(whiteListEntry[4])) { - Log.i("BlockLists", "Request allowed by " + blockListTitle + " third-party white list: " + whiteListEntry[0] + " , " + whiteListEntry[1] + " , " + whiteListEntry[2] + - " , " + whiteListEntry[3] + " , " + whiteListEntry[4] + " - " + resourceUrl); + // Store the entry in the resource request log. + MainWebViewActivity.whiteListResultStringArray = new String[] {String.valueOf(MainWebViewActivity.REQUEST_ALLOWED), resourceUrl, BLOCK_LIST_NAME_STRING, + String.valueOf(MainWebViewActivity.THIRD_PARTY_WHITELIST), whiteListEntry[0] + "\n" + whiteListEntry[1] + "\n" + whiteListEntry[2] + "\n" + whiteListEntry[3] + "\n" + + whiteListEntry[4], whiteListEntry[5]}; // Not blocked. return false; @@ -1807,18 +1845,21 @@ public class BlockListHelper { } // Third-party domain white list. - for (String[] whiteListEntry : blockList.get(7)) { - if (whiteListEntry.length == 2) { // There is one entry. + for (String[] whiteListEntry : blockList.get(MainWebViewActivity.THIRD_PARTY_DOMAIN_WHITELIST)) { + if (whiteListEntry.length == 3) { // There is one entry. if (currentDomain.endsWith(whiteListEntry[0]) && resourceUrl.contains(whiteListEntry[1])) { - Log.i("BlockLists", "Request allowed by " + blockListTitle + " third-party domain white list: " + whiteListEntry[0] + " , " + whiteListEntry[1] + " - " + resourceUrl); + // Store the entry in the resource request log. + MainWebViewActivity.whiteListResultStringArray = new String[] {String.valueOf(MainWebViewActivity.REQUEST_ALLOWED), resourceUrl, BLOCK_LIST_NAME_STRING, + String.valueOf(MainWebViewActivity.THIRD_PARTY_DOMAIN_WHITELIST), whiteListEntry[0] + "\n" + whiteListEntry[1], whiteListEntry[2]}; // Not blocked. return false; } } else { // There are two entries. if (currentDomain.endsWith(whiteListEntry[0]) && resourceUrl.contains(whiteListEntry[1]) && resourceUrl.contains(whiteListEntry[2])) { - Log.i("BlockLists", "Request allowed by " + blockListTitle + " third-party domain white list: " + whiteListEntry[0] + " , " + whiteListEntry[1] + " , " + - whiteListEntry[2] + " - " + resourceUrl); + // Store the entry in the resource request log. + MainWebViewActivity.whiteListResultStringArray = new String[] {String.valueOf(MainWebViewActivity.REQUEST_ALLOWED), resourceUrl, BLOCK_LIST_NAME_STRING, + String.valueOf(MainWebViewActivity.THIRD_PARTY_DOMAIN_WHITELIST), whiteListEntry[0] + "\n" + whiteListEntry[1] + "\n" + whiteListEntry[2], whiteListEntry[3]}; // Not blocked. return false; @@ -1827,19 +1868,21 @@ public class BlockListHelper { } // Third-party domain initial white list. - for (String[] whiteListEntry : blockList.get(8)) { - if (whiteListEntry.length == 2) { // There is one entry. + for (String[] whiteListEntry : blockList.get(MainWebViewActivity.THIRD_PARTY_DOMAIN_INITIAL_WHITELIST)) { + if (whiteListEntry.length == 3) { // There is one entry. if (currentDomain.endsWith(whiteListEntry[0]) && resourceUrl.startsWith(whiteListEntry[1])) { - Log.i("BlockLists", "Request allowed by " + blockListTitle + " third-party domain initial white list: " + whiteListEntry[0] + " , " + whiteListEntry[1] + " - " + - resourceUrl); + // Store the entry in the resource request log. + MainWebViewActivity.whiteListResultStringArray = new String[] {String.valueOf(MainWebViewActivity.REQUEST_ALLOWED), resourceUrl, BLOCK_LIST_NAME_STRING, + String.valueOf(MainWebViewActivity.THIRD_PARTY_DOMAIN_INITIAL_WHITELIST), whiteListEntry[0] + "\n" + whiteListEntry[1], whiteListEntry[2]}; // Not blocked. return false; } } else { // There are two entries. if (currentDomain.endsWith(whiteListEntry[0]) && resourceUrl.startsWith(whiteListEntry[1]) && resourceUrl.contains(whiteListEntry[2])) { - Log.i("BlockLists", "Request allowed by " + blockListTitle + " third-party domain initial white list: " + whiteListEntry[0] + " , " + whiteListEntry[1] + " , " + - whiteListEntry[2] + " - " + resourceUrl); + // Store the entry in the resource request log. + MainWebViewActivity.whiteListResultStringArray = new String[] {String.valueOf(MainWebViewActivity.REQUEST_ALLOWED), resourceUrl, BLOCK_LIST_NAME_STRING, + String.valueOf(MainWebViewActivity.THIRD_PARTY_DOMAIN_WHITELIST), whiteListEntry[0] + "\n" + whiteListEntry[1] + "\n" + whiteListEntry[2], whiteListEntry[3]}; // Not blocked. return false; @@ -1850,51 +1893,59 @@ public class BlockListHelper { // Process the black lists. // Main black list. - for (String[] blackListEntry : blockList.get(9)) { + for (String[] blackListEntry : blockList.get(MainWebViewActivity.MAIN_BLACKLIST)) { switch (blackListEntry.length) { - case 1: // There is one entry. + case 2: // There is one entry. if (resourceUrl.contains(blackListEntry[0])) { - Log.i("BlockLists", "Request blocked by " + blockListTitle + " main black list: " + blackListEntry[0] + " - " + resourceUrl); + // Store the entry in the resource request log. + MainWebViewActivity.resourceRequests.add(new String[] {String.valueOf(MainWebViewActivity.REQUEST_BLOCKED), resourceUrl, BLOCK_LIST_NAME_STRING, + String.valueOf(MainWebViewActivity.MAIN_BLACKLIST), blackListEntry[0], blackListEntry[1]}); // Blocked. return true; } break; - case 2: // There are two entries. + case 3: // There are two entries. if (resourceUrl.contains(blackListEntry[0]) && resourceUrl.contains(blackListEntry[1])) { - Log.i("BlockLists", "Request blocked by " + blockListTitle + " main black list: " + blackListEntry[0] + " , " + blackListEntry[1] + " - " + resourceUrl); + // Store the entry in the resource request log. + MainWebViewActivity.resourceRequests.add(new String[] {String.valueOf(MainWebViewActivity.REQUEST_BLOCKED), resourceUrl, BLOCK_LIST_NAME_STRING, + String.valueOf(MainWebViewActivity.MAIN_BLACKLIST), blackListEntry[0] + "\n" + blackListEntry[1], blackListEntry[2]}); // Blocked. return true; } break; - case 3: // There are three entries. + case 4: // There are three entries. if (resourceUrl.contains(blackListEntry[0]) && resourceUrl.contains(blackListEntry[1]) && resourceUrl.contains(blackListEntry[2])) { - Log.i("BlockLists", "Request blocked by " + blockListTitle + " main black list: " + blackListEntry[0] + " , " + blackListEntry[1] + " , " + blackListEntry[2] + " - " + - resourceUrl); + // Store the entry in the resource request log. + MainWebViewActivity.resourceRequests.add(new String[] {String.valueOf(MainWebViewActivity.REQUEST_BLOCKED), resourceUrl, BLOCK_LIST_NAME_STRING, + String.valueOf(MainWebViewActivity.MAIN_BLACKLIST), blackListEntry[0] + "\n" + blackListEntry[1] + "\n" + blackListEntry[2], blackListEntry[3]}); // Blocked. return true; } break; - case 4: // There are four entries. + case 5: // There are four entries. if (resourceUrl.contains(blackListEntry[0]) && resourceUrl.contains(blackListEntry[1]) && resourceUrl.contains(blackListEntry[2]) && resourceUrl.contains(blackListEntry[3])) { - Log.i("BlockLists", "Request blocked by " + blockListTitle + " main black list: " + blackListEntry[0] + " , " + blackListEntry[1] + " , " + blackListEntry[2] + " , " + - blackListEntry[3] + " - " + resourceUrl); + // Store the entry in the resource request log. + MainWebViewActivity.resourceRequests.add(new String[] {String.valueOf(MainWebViewActivity.REQUEST_BLOCKED), resourceUrl, BLOCK_LIST_NAME_STRING, + String.valueOf(MainWebViewActivity.MAIN_BLACKLIST), blackListEntry[0] + "\n" + blackListEntry[1] + "\n" + blackListEntry[2] + "\n" + blackListEntry[3], blackListEntry[4]}); // Blocked. return true; } break; - case 5: // There are five entries. + case 6: // There are five entries. if (resourceUrl.contains(blackListEntry[0]) && resourceUrl.contains(blackListEntry[1]) && resourceUrl.contains(blackListEntry[2]) && resourceUrl.contains(blackListEntry[3]) && resourceUrl.contains(blackListEntry[4])) { - Log.i("BlockLists", "Request blocked by " + blockListTitle + " main black list: " + blackListEntry[0] + " , " + blackListEntry[1] + " , " + blackListEntry[2] + " , " + - blackListEntry[3] + ", " + blackListEntry[4] + " - " + resourceUrl); + // Store the entry in the resource request log. + MainWebViewActivity.resourceRequests.add(new String[] {String.valueOf(MainWebViewActivity.REQUEST_BLOCKED), resourceUrl, BLOCK_LIST_NAME_STRING, + String.valueOf(MainWebViewActivity.MAIN_BLACKLIST), blackListEntry[0] + "\n" + blackListEntry[1] + "\n" + blackListEntry[2] + "\n" + blackListEntry[3] + "\n" + + blackListEntry[4], blackListEntry[5]}); // Blocked. return true; @@ -1904,17 +1955,21 @@ public class BlockListHelper { } // Initial black list. - for (String[] blackListEntry : blockList.get(10)) { - if (blackListEntry.length == 1) { // There is one entry. + for (String[] blackListEntry : blockList.get(MainWebViewActivity.INITIAL_BLACKLIST)) { + if (blackListEntry.length == 2) { // There is one entry. if (resourceUrl.startsWith(blackListEntry[0])) { - Log.i("BlockLists", "Request blocked by " + blockListTitle + " initial black list: " + blackListEntry[0] + " - " + resourceUrl); + // Store the entry in the resource request log. + MainWebViewActivity.resourceRequests.add(new String[] {String.valueOf(MainWebViewActivity.REQUEST_BLOCKED), resourceUrl, BLOCK_LIST_NAME_STRING, + String.valueOf(MainWebViewActivity.INITIAL_BLACKLIST), blackListEntry[0], blackListEntry[1]}); // Blocked. return true; } } else { // There are two entries if (resourceUrl.startsWith(blackListEntry[0]) && resourceUrl.contains(blackListEntry[1])) { - Log.i("BlockLists", "Request blocked by " + blockListTitle + " initial black list: " + blackListEntry[0] + " , " + blackListEntry[1] + " - " + resourceUrl); + // Store the entry in the resource request log. + MainWebViewActivity.resourceRequests.add(new String[] {String.valueOf(MainWebViewActivity.REQUEST_BLOCKED), resourceUrl, BLOCK_LIST_NAME_STRING, + String.valueOf(MainWebViewActivity.INITIAL_BLACKLIST), blackListEntry[0] + "\n" + blackListEntry[1], blackListEntry[2]}); // Blocked. return true; @@ -1923,30 +1978,35 @@ public class BlockListHelper { } // Final black list. - for (String[] blackListEntry : blockList.get(11)) { + for (String[] blackListEntry : blockList.get(MainWebViewActivity.FINAL_BLACKLIST)) { switch (blackListEntry.length) { - case 1: // There is one entry. + case 2: // There is one entry. if (resourceUrl.endsWith(blackListEntry[0])) { - Log.i("BlockLists", "Request blocked by " + blockListTitle + " final black list: " + blackListEntry[0] + " - " + resourceUrl); + // Store the entry in the resource request log. + MainWebViewActivity.resourceRequests.add(new String[] {String.valueOf(MainWebViewActivity.REQUEST_BLOCKED), resourceUrl, BLOCK_LIST_NAME_STRING, + String.valueOf(MainWebViewActivity.FINAL_BLACKLIST), blackListEntry[0], blackListEntry[1]}); // Blocked. return true; } break; - case 2: // There are two entries. + case 3: // There are two entries. if (resourceUrl.contains(blackListEntry[0]) && resourceUrl.endsWith(blackListEntry[1])) { - Log.i("BlockLists", "Request blocked by " + blockListTitle + " final black list: " + blackListEntry[0] + " , " + blackListEntry[1] + " - " + resourceUrl); + // Store the entry in the resource request log. + MainWebViewActivity.resourceRequests.add(new String[] {String.valueOf(MainWebViewActivity.REQUEST_BLOCKED), resourceUrl, BLOCK_LIST_NAME_STRING, + String.valueOf(MainWebViewActivity.FINAL_BLACKLIST), blackListEntry[0] + "\n" + blackListEntry[1], blackListEntry[2]}); // Blocked. return true; } break; - case 3: // There are three entries. + case 4: // There are three entries. if (resourceUrl.contains(blackListEntry[0]) && resourceUrl.contains(blackListEntry[1]) && resourceUrl.endsWith(blackListEntry[2])) { - Log.i("BlockLists", "Request blocked by " + blockListTitle + " final black list: " + blackListEntry[0] + " , " + blackListEntry[1] + " , " + blackListEntry[2] + " - " + - resourceUrl); + // Store the entry in the resource request log. + MainWebViewActivity.resourceRequests.add(new String[] {String.valueOf(MainWebViewActivity.REQUEST_BLOCKED), resourceUrl, BLOCK_LIST_NAME_STRING, + String.valueOf(MainWebViewActivity.FINAL_BLACKLIST), blackListEntry[0] + "\n" + blackListEntry[1] + "\n" + blackListEntry[2], blackListEntry[3]}); // Blocked. return true; @@ -1958,31 +2018,36 @@ public class BlockListHelper { // Only check the domain lists if the current domain is not null (like `about:blank`). if (currentDomain != null) { // Domain black list. - for (String[] blackListEntry : blockList.get(12)) { + for (String[] blackListEntry : blockList.get(MainWebViewActivity.DOMAIN_BLACKLIST)) { switch (blackListEntry.length) { - case 2: // There is one entry. + case 3: // There is one entry. if (currentDomain.endsWith(blackListEntry[0]) && resourceUrl.contains(blackListEntry[1])) { - Log.i("BlockLists", "Request blocked by " + blockListTitle + " domain black list: " + blackListEntry[0] + " , " + blackListEntry[1] + " - " + resourceUrl); + // Store the entry in the resource request log. + MainWebViewActivity.resourceRequests.add(new String[] {String.valueOf(MainWebViewActivity.REQUEST_BLOCKED), resourceUrl, BLOCK_LIST_NAME_STRING, + String.valueOf(MainWebViewActivity.DOMAIN_BLACKLIST), blackListEntry[0] + "\n" + blackListEntry[1], blackListEntry[2]}); // Blocked. return true; } break; - case 3: // There are two entries. + case 4: // There are two entries. if (currentDomain.endsWith(blackListEntry[0]) && resourceUrl.contains(blackListEntry[1]) && resourceUrl.contains(blackListEntry[2])) { - Log.i("BlockLists", "Request blocked by " + blockListTitle + " domain black list: " + blackListEntry[0] + " , " + blackListEntry[1] + " , " + blackListEntry[2] + - " - " + resourceUrl); + // Store the entry in the resource request log. + MainWebViewActivity.resourceRequests.add(new String[] {String.valueOf(MainWebViewActivity.REQUEST_BLOCKED), resourceUrl, BLOCK_LIST_NAME_STRING, + String.valueOf(MainWebViewActivity.DOMAIN_BLACKLIST), blackListEntry[0] + "\n" + blackListEntry[1] + "\n" + blackListEntry[2], blackListEntry[3]}); // Blocked. return true; } break; - case 4: // There are three entries. + case 5: // There are three entries. if (currentDomain.endsWith(blackListEntry[0]) && resourceUrl.contains(blackListEntry[1]) && resourceUrl.contains(blackListEntry[2]) && resourceUrl.contains(blackListEntry[3])) { - Log.i("BlockLists", "Request blocked by " + blockListTitle + " domain black list: " + blackListEntry[0] + " , " + blackListEntry[1] + " , " + blackListEntry[2] + - " , " + blackListEntry[3] + " - " + resourceUrl); + // Store the entry in the resource request log. + MainWebViewActivity.resourceRequests.add(new String[] {String.valueOf(MainWebViewActivity.REQUEST_BLOCKED), resourceUrl, BLOCK_LIST_NAME_STRING, + String.valueOf(MainWebViewActivity.DOMAIN_BLACKLIST), blackListEntry[0] + "\n" + blackListEntry[1] + "\n" + blackListEntry[2] + "\n" + blackListEntry[3], + blackListEntry[4]}); // Blocked. return true; @@ -1992,9 +2057,12 @@ public class BlockListHelper { } // Domain initial black list. - for (String[] blackListEntry : blockList.get(13)) { + for (String[] blackListEntry : blockList.get(MainWebViewActivity.DOMAIN_INITIAL_BLACKLIST)) { + // Store the entry in the resource request log. if (currentDomain.endsWith(blackListEntry[0]) && resourceUrl.startsWith(blackListEntry[1])) { - Log.i("BlockLists", "Request blocked by " + blockListTitle + " domain initial black list: " + blackListEntry[0] + " , " + blackListEntry[1] + " - " + resourceUrl); + MainWebViewActivity.resourceRequests.add(new String[] {String.valueOf(MainWebViewActivity.REQUEST_BLOCKED), resourceUrl, BLOCK_LIST_NAME_STRING, + String.valueOf(MainWebViewActivity.DOMAIN_INITIAL_BLACKLIST), blackListEntry[0] + "\n" + blackListEntry[1], + blackListEntry[2]}); // Blocked. return true; @@ -2002,21 +2070,24 @@ public class BlockListHelper { } // Domain final black list. - for (String[] blackListEntry : blockList.get(14)) { + for (String[] blackListEntry : blockList.get(MainWebViewActivity.DOMAIN_FINAL_BLACKLIST)) { switch (blackListEntry.length) { - case 2: // There is one entry. + case 3: // There is one entry. if (currentDomain.endsWith(blackListEntry[0]) && resourceUrl.endsWith(blackListEntry[1])) { - Log.i("BlockLists", "Request blocked by " + blockListTitle + " domain final black list: " + blackListEntry[0] + " , " + blackListEntry[1] + " - " + resourceUrl); + // Store the entry in the resource request log. + MainWebViewActivity.resourceRequests.add(new String[] {String.valueOf(MainWebViewActivity.REQUEST_BLOCKED), resourceUrl, BLOCK_LIST_NAME_STRING, + String.valueOf(MainWebViewActivity.DOMAIN_FINAL_BLACKLIST), blackListEntry[0] + "\n" + blackListEntry[1], blackListEntry[2]}); // Blocked. return true; } break; - case 3: // There are two entries. + case 4: // There are two entries. if (currentDomain.endsWith(blackListEntry[0]) && resourceUrl.contains(blackListEntry[1]) && resourceUrl.endsWith(blackListEntry[2])) { - Log.i("BlockLists", "Request blocked by " + blockListTitle + " domain final black list: " + blackListEntry[0] + " , " + blackListEntry[1] + " , " + blackListEntry[2] + - " - " + resourceUrl); + // Store the entry in the resource request log. + MainWebViewActivity.resourceRequests.add(new String[] {String.valueOf(MainWebViewActivity.REQUEST_BLOCKED), resourceUrl, BLOCK_LIST_NAME_STRING, + String.valueOf(MainWebViewActivity.DOMAIN_FINAL_BLACKLIST), blackListEntry[0] + "\n" + blackListEntry[1] + "\n" + blackListEntry[2], blackListEntry[3]}); // Blocked. return true; @@ -2026,9 +2097,11 @@ public class BlockListHelper { } // Domain regular expression black list. - for (String[] blackListEntry : blockList.get(15)) { + for (String[] blackListEntry : blockList.get(MainWebViewActivity.DOMAIN_REGULAR_EXPRESSION_BLACKLIST)) { if (currentDomain.endsWith(blackListEntry[0]) && Pattern.matches(blackListEntry[1], resourceUrl)) { - Log.i("BlockLists", "Request blocked by " + blockListTitle + " domain regular expression black list: " + blackListEntry[0] + " , " + blackListEntry[1] + " - " + resourceUrl); + // Store the entry in the resource request log. + MainWebViewActivity.resourceRequests.add(new String[] {String.valueOf(MainWebViewActivity.REQUEST_BLOCKED), resourceUrl, BLOCK_LIST_NAME_STRING, + String.valueOf(MainWebViewActivity.DOMAIN_REGULAR_EXPRESSION_BLACKLIST), blackListEntry[0] + "\n" + blackListEntry[1], blackListEntry[2]}); // Blocked. return true; @@ -2039,40 +2112,47 @@ public class BlockListHelper { // Only check the third-party black lists if this is a third-party request. if (thirdPartyRequest) { // Third-party black list. - for (String[] blackListEntry : blockList.get(16)) { + for (String[] blackListEntry : blockList.get(MainWebViewActivity.THIRD_PARTY_BLACKLIST)) { switch (blackListEntry.length) { - case 1: // There is one entry. + case 2: // There is one entry. if (resourceUrl.contains(blackListEntry[0])) { - Log.i("BlockLists", "Request blocked by " + blockListTitle + " third-party black list: " + blackListEntry[0] + " - " + resourceUrl); + // Store the entry in the resource request log. + MainWebViewActivity.resourceRequests.add(new String[] {String.valueOf(MainWebViewActivity.REQUEST_BLOCKED), resourceUrl, BLOCK_LIST_NAME_STRING, + String.valueOf(MainWebViewActivity.THIRD_PARTY_BLACKLIST), blackListEntry[0], blackListEntry[1]}); // Blocked. return true; } break; - case 2: // There are two entries. + case 3: // There are two entries. if (resourceUrl.contains(blackListEntry[0]) && resourceUrl.contains(blackListEntry[1])) { - Log.i("BlockLists", "Request blocked by " + blockListTitle + " third-party black list: " + blackListEntry[0] + " , " + blackListEntry[1] + " - " + resourceUrl); + // Store the entry in the resource request log. + MainWebViewActivity.resourceRequests.add(new String[] {String.valueOf(MainWebViewActivity.REQUEST_BLOCKED), resourceUrl, BLOCK_LIST_NAME_STRING, + String.valueOf(MainWebViewActivity.THIRD_PARTY_BLACKLIST), blackListEntry[0] + "\n" + blackListEntry[1], blackListEntry[2]}); // Blocked. return true; } break; - case 3: // There are three entries. + case 4: // There are three entries. if (resourceUrl.contains(blackListEntry[0]) && resourceUrl.contains(blackListEntry[1]) && resourceUrl.contains(blackListEntry[2])) { - Log.i("BlockLists", "Request blocked by " + blockListTitle + " third-party black list: " + blackListEntry[0] + " , " + blackListEntry[1] + " , " + blackListEntry[2] + - " - " + resourceUrl); + // Store the entry in the resource request log. + MainWebViewActivity.resourceRequests.add(new String[] {String.valueOf(MainWebViewActivity.REQUEST_BLOCKED), resourceUrl, BLOCK_LIST_NAME_STRING, + String.valueOf(MainWebViewActivity.THIRD_PARTY_BLACKLIST), blackListEntry[0] + "\n" + blackListEntry[1] + "\n" + blackListEntry[2], blackListEntry[3]}); // Blocked. return true; } break; - case 4: // There are four entries. + case 5: // There are four entries. if (resourceUrl.contains(blackListEntry[0]) && resourceUrl.contains(blackListEntry[1]) && resourceUrl.contains(blackListEntry[2]) && resourceUrl.contains(blackListEntry[3])) { - Log.i("BlockLists", "Request blocked by " + blockListTitle + " third-party black list: " + blackListEntry[0] + " , " + blackListEntry[1] + " , " + blackListEntry[2] + - " , " + blackListEntry[3] + " - " + resourceUrl); + // Store the entry in the resource request log. + MainWebViewActivity.resourceRequests.add(new String[] {String.valueOf(MainWebViewActivity.REQUEST_BLOCKED), resourceUrl, BLOCK_LIST_NAME_STRING, + String.valueOf(MainWebViewActivity.THIRD_PARTY_BLACKLIST), blackListEntry[0] + "\n" + blackListEntry[1] + "\n" + blackListEntry[2] + "\n" + blackListEntry[3], + blackListEntry[4]}); // Blocked. return true; @@ -2082,17 +2162,21 @@ public class BlockListHelper { } // Third-party initial black list. - for (String[] blackListEntry : blockList.get(17)) { - if (blackListEntry.length == 1) { // There is one entry. + for (String[] blackListEntry : blockList.get(MainWebViewActivity.THIRD_PARTY_INITIAL_BLACKLIST)) { + if (blackListEntry.length == 2) { // There is one entry. if (resourceUrl.startsWith(blackListEntry[0])) { - Log.i("BlockLists", "Request blocked by " + blockListTitle + " third-party initial black list: " + blackListEntry[0] + " - " + resourceUrl); + // Store the entry in the resource request log. + MainWebViewActivity.resourceRequests.add(new String[] {String.valueOf(MainWebViewActivity.REQUEST_BLOCKED), resourceUrl, BLOCK_LIST_NAME_STRING, + String.valueOf(MainWebViewActivity.THIRD_PARTY_INITIAL_BLACKLIST), blackListEntry[0], blackListEntry[1]}); // Blocked. return true; } } else { // There are two entries. if (resourceUrl.startsWith(blackListEntry[0]) && resourceUrl.contains(blackListEntry[1])) { - Log.i("BlockLists", "Request blocked by " + blockListTitle + " third-party initial black list: " + blackListEntry[0] + " , " + blackListEntry[1] + " - " + resourceUrl); + // Store the entry in the resource request log. + MainWebViewActivity.resourceRequests.add(new String[] {String.valueOf(MainWebViewActivity.REQUEST_BLOCKED), resourceUrl, BLOCK_LIST_NAME_STRING, + String.valueOf(MainWebViewActivity.THIRD_PARTY_INITIAL_BLACKLIST), blackListEntry[0] + "\n" + blackListEntry[1], blackListEntry[2]}); // Blocked. return true; @@ -2101,18 +2185,21 @@ public class BlockListHelper { } // Third-party domain black list. - for (String[] blackListEntry : blockList.get(18)) { - if (blackListEntry.length == 2) { // There is one entry. + for (String[] blackListEntry : blockList.get(MainWebViewActivity.THIRD_PARTY_DOMAIN_BLACKLIST)) { + if (blackListEntry.length == 3) { // There is one entry. if (currentDomain.endsWith(blackListEntry[0]) && resourceUrl.contains(blackListEntry[1])) { - Log.i("BlockLists", "Request blocked by " + blockListTitle + " third-party domain black list: " + blackListEntry[0] + " , " + blackListEntry[1] + " - " + resourceUrl); + // Store the entry in the resource request log. + MainWebViewActivity.resourceRequests.add(new String[] {String.valueOf(MainWebViewActivity.REQUEST_BLOCKED), resourceUrl, BLOCK_LIST_NAME_STRING, + String.valueOf(MainWebViewActivity.THIRD_PARTY_DOMAIN_BLACKLIST), blackListEntry[0] + "\n" + blackListEntry[1], blackListEntry[2]}); // Blocked. return true; } } else { // There are two entries. if (currentDomain.endsWith(blackListEntry[0]) && resourceUrl.contains(blackListEntry[1]) && resourceUrl.contains(blackListEntry[2])) { - Log.i("BlockLists", "Request blocked by " + blockListTitle + " third-party domain black list: " + blackListEntry[0] + " , " + blackListEntry[1] + " , " + - blackListEntry[2] + " - " + resourceUrl); + // Store the entry in the resource request log. + MainWebViewActivity.resourceRequests.add(new String[] {String.valueOf(MainWebViewActivity.REQUEST_BLOCKED), resourceUrl, BLOCK_LIST_NAME_STRING, + String.valueOf(MainWebViewActivity.THIRD_PARTY_DOMAIN_BLACKLIST), blackListEntry[0] + "\n" + blackListEntry[1] + "\n" + blackListEntry[2], blackListEntry[3]}); // Blocked. return true; @@ -2121,32 +2208,35 @@ public class BlockListHelper { } // Third-party domain initial black list. - for (String[] blackListEntry : blockList.get(19)) { + for (String[] blackListEntry : blockList.get(MainWebViewActivity.THIRD_PARTY_DOMAIN_INITIAL_BLACKLIST)) { switch (blackListEntry.length) { - case 2: // There is one entry. + case 3: // There is one entry. if (currentDomain.endsWith(blackListEntry[0]) && resourceUrl.startsWith(blackListEntry[1])) { - Log.i("BlockLists", "Request blocked by " + blockListTitle + " third-party domain initial black list: " + blackListEntry[0] + " , " + blackListEntry[1] + " - " + - resourceUrl); - + // Store the entry in the resource request log. + MainWebViewActivity.resourceRequests.add(new String[] {String.valueOf(MainWebViewActivity.REQUEST_BLOCKED), resourceUrl, BLOCK_LIST_NAME_STRING, + String.valueOf(MainWebViewActivity.THIRD_PARTY_DOMAIN_INITIAL_BLACKLIST), blackListEntry[0] + "\n" + blackListEntry[1], blackListEntry[2]}); // Blocked. return true; } break; - case 3: // There are two entries. + case 4: // There are two entries. if (currentDomain.endsWith(blackListEntry[0]) && resourceUrl.startsWith(blackListEntry[1]) && resourceUrl.contains(blackListEntry[2])) { - Log.i("BlockLists", "Request blocked by " + blockListTitle + " third-party domain initial black list: " + blackListEntry[0] + " , " + blackListEntry[1] + " , " + - blackListEntry[2] + " - " + resourceUrl); + // Store the entry in the resource request log. + MainWebViewActivity.resourceRequests.add(new String[] {String.valueOf(MainWebViewActivity.REQUEST_BLOCKED), resourceUrl, BLOCK_LIST_NAME_STRING, + String.valueOf(MainWebViewActivity.THIRD_PARTY_DOMAIN_INITIAL_BLACKLIST), blackListEntry[0] + "\n" + blackListEntry[1] + "\n" + blackListEntry[2], blackListEntry[3]}); // Blocked. return true; } break; - case 4: // There are three entries. + case 5: // There are three entries. if (currentDomain.endsWith(blackListEntry[0]) && resourceUrl.startsWith(blackListEntry[1]) && resourceUrl.contains(blackListEntry[2]) && resourceUrl.contains(blackListEntry[3])) { - Log.i("BlockLists", "Request blocked by " + blockListTitle + " third-party domain initial black list: " + blackListEntry[0] + " , " + blackListEntry[1] + " , " + - blackListEntry[2] + blackListEntry[3] + " - " + resourceUrl); + // Store the entry in the resource request log. + MainWebViewActivity.resourceRequests.add(new String[] {String.valueOf(MainWebViewActivity.REQUEST_BLOCKED), resourceUrl, BLOCK_LIST_NAME_STRING, + String.valueOf(MainWebViewActivity.THIRD_PARTY_DOMAIN_INITIAL_BLACKLIST), blackListEntry[0] + "\n" + blackListEntry[1] + "\n" + blackListEntry[2] + "\n" + blackListEntry[3], + blackListEntry[4]}); // Blocked. return true; @@ -2156,9 +2246,11 @@ public class BlockListHelper { } // Third-party regular expression black list. - for (String[] blackListEntry : blockList.get(20)) { + for (String[] blackListEntry : blockList.get(MainWebViewActivity.THIRD_PARTY_REGULAR_EXPRESSION_BLACKLIST)) { if (Pattern.matches(blackListEntry[0], resourceUrl)) { - Log.i("BlockLists", "Request blocked by " + blockListTitle + " third-party regular expression black list: " + blackListEntry[0] + " - " + resourceUrl); + // Store the entry in the resource request log. + MainWebViewActivity.resourceRequests.add(new String[] {String.valueOf(MainWebViewActivity.REQUEST_BLOCKED), resourceUrl, BLOCK_LIST_NAME_STRING, + String.valueOf(MainWebViewActivity.THIRD_PARTY_REGULAR_EXPRESSION_BLACKLIST), blackListEntry[0], blackListEntry[1]}); // Blocked. return true; @@ -2166,10 +2258,11 @@ public class BlockListHelper { } // Third-party domain regular expression black list. - for (String[] blackListEntry : blockList.get(21)) { + for (String[] blackListEntry : blockList.get(MainWebViewActivity.THIRD_PARTY_DOMAIN_REGULAR_EXPRESSION_BLACKLIST)) { if (currentDomain.endsWith(blackListEntry[0]) && Pattern.matches(blackListEntry[1], resourceUrl)) { - Log.i("BlockLists", "Request blocked by " + blockListTitle + " third-party domain regular expression black list: " + blackListEntry[0] + " , " + blackListEntry[1] + " - " + - resourceUrl); + // Store the entry in the resource request log. + MainWebViewActivity.resourceRequests.add(new String[] {String.valueOf(MainWebViewActivity.REQUEST_BLOCKED), resourceUrl, BLOCK_LIST_NAME_STRING, + String.valueOf(MainWebViewActivity.THIRD_PARTY_DOMAIN_REGULAR_EXPRESSION_BLACKLIST), blackListEntry[0] + "\n" + blackListEntry[1], blackListEntry[2]}); // Blocked. return true; @@ -2178,9 +2271,11 @@ public class BlockListHelper { } // Regular expression black list. - for (String[] blackListEntry : blockList.get(22)) { + for (String[] blackListEntry : blockList.get(MainWebViewActivity.REGULAR_EXPRESSION_BLACKLIST)) { if (Pattern.matches(blackListEntry[0], resourceUrl)) { - Log.i("BlockLists", "Request blocked by " + blockListTitle + " regular expression black list: " + blackListEntry[0] + " - " + resourceUrl); + // Store the entry in the resource request log. + MainWebViewActivity.resourceRequests.add(new String[] {String.valueOf(MainWebViewActivity.REQUEST_BLOCKED), resourceUrl, BLOCK_LIST_NAME_STRING, + String.valueOf(MainWebViewActivity.REGULAR_EXPRESSION_BLACKLIST), blackListEntry[0], blackListEntry[1]}); // blocked. return true; diff --git a/app/src/main/java/com/stoutner/privacybrowser/helpers/OrbotProxyHelper.java b/app/src/main/java/com/stoutner/privacybrowser/helpers/OrbotProxyHelper.java index b56269b1..f02c00f6 100644 --- a/app/src/main/java/com/stoutner/privacybrowser/helpers/OrbotProxyHelper.java +++ b/app/src/main/java/com/stoutner/privacybrowser/helpers/OrbotProxyHelper.java @@ -57,7 +57,7 @@ public class OrbotProxyHelper { mLoadedApkField.setAccessible(true); Object mLoadedApkObject = mLoadedApkField.get(privacyBrowserContext); - // Suppress the lint warning that reflection may not alwasy work in the future and on all devices. + // Suppress the lint warning that reflection may not always work in the future and on all devices. @SuppressLint("PrivateApi") Class loadedApkClass = Class.forName("android.app.LoadedApk"); Field mReceiversField = loadedApkClass.getDeclaredField("mReceivers"); diff --git a/app/src/main/res/color/requests_spinner_color_selector_dark.xml b/app/src/main/res/color/requests_spinner_color_selector_dark.xml new file mode 100644 index 00000000..06e0fa42 --- /dev/null +++ b/app/src/main/res/color/requests_spinner_color_selector_dark.xml @@ -0,0 +1,25 @@ + + + + + + + + + \ No newline at end of file diff --git a/app/src/main/res/color/requests_spinner_color_selector_light.xml b/app/src/main/res/color/requests_spinner_color_selector_light.xml new file mode 100644 index 00000000..3e8f830e --- /dev/null +++ b/app/src/main/res/color/requests_spinner_color_selector_light.xml @@ -0,0 +1,25 @@ + + + + + + + + + \ No newline at end of file diff --git a/app/src/main/res/layout/about_tab_version.xml b/app/src/main/res/layout/about_tab_version.xml index 221781dd..bfaa7f4d 100644 --- a/app/src/main/res/layout/about_tab_version.xml +++ b/app/src/main/res/layout/about_tab_version.xml @@ -162,7 +162,7 @@ - + - + - + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/app/src/main/res/layout/requests_item_linearlayout.xml b/app/src/main/res/layout/requests_item_linearlayout.xml new file mode 100644 index 00000000..33d48cbf --- /dev/null +++ b/app/src/main/res/layout/requests_item_linearlayout.xml @@ -0,0 +1,43 @@ + + + + + + + + + + \ No newline at end of file diff --git a/app/src/main/res/layout/requests_spinner.xml b/app/src/main/res/layout/requests_spinner.xml new file mode 100644 index 00000000..517f8543 --- /dev/null +++ b/app/src/main/res/layout/requests_spinner.xml @@ -0,0 +1,25 @@ + + + + + diff --git a/app/src/main/res/layout/requests_spinner_dropdown_item.xml b/app/src/main/res/layout/requests_spinner_dropdown_item.xml new file mode 100644 index 00000000..eb6771bd --- /dev/null +++ b/app/src/main/res/layout/requests_spinner_dropdown_item.xml @@ -0,0 +1,34 @@ + + + + + + \ No newline at end of file diff --git a/app/src/main/res/layout/requests_spinner_item.xml b/app/src/main/res/layout/requests_spinner_item.xml new file mode 100644 index 00000000..085c2a28 --- /dev/null +++ b/app/src/main/res/layout/requests_spinner_item.xml @@ -0,0 +1,30 @@ + + + + + \ No newline at end of file diff --git a/app/src/main/res/layout/url_history_item_linearlayout.xml b/app/src/main/res/layout/url_history_item_linearlayout.xml index df4a1363..b6e7338d 100644 --- a/app/src/main/res/layout/url_history_item_linearlayout.xml +++ b/app/src/main/res/layout/url_history_item_linearlayout.xml @@ -1,7 +1,7 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/app/src/main/res/menu/webview_navigation_menu.xml b/app/src/main/res/menu/webview_navigation_menu.xml index fbab7391..9032af7e 100644 --- a/app/src/main/res/menu/webview_navigation_menu.xml +++ b/app/src/main/res/menu/webview_navigation_menu.xml @@ -48,23 +48,29 @@ + + + android:orderInCategory="60" /> + android:orderInCategory="70" /> + android:orderInCategory="80" /> @@ -74,13 +80,13 @@ android:id="@+id/guide" android:title="@string/guide" android:icon="@drawable/guide" - android:orderInCategory="80" /> + android:orderInCategory="90" /> + android:orderInCategory="100" /> @@ -90,6 +96,6 @@ android:id="@+id/clearAndExit" android:title="@string/clear_and_exit" android:icon="@drawable/clear_and_exit" - android:orderInCategory="100" /> + android:orderInCategory="110" /> \ No newline at end of file diff --git a/app/src/main/res/values-es/strings.xml b/app/src/main/res/values-es/strings.xml index 93c0fc0b..3712878e 100644 --- a/app/src/main/res/values-es/strings.xml +++ b/app/src/main/res/values-es/strings.xml @@ -309,7 +309,7 @@ Enviar la cabecera de no rastrear (DNT) que educadamente sugiere que los servidores web no rastreen este navegador. Permitir capturas de pantalla Permitir capturas de pantalla, grabación de vídeo y visualización en pantallas inseguras. Cambiar esta configuración reiniciará Navegador Privado. - Listas de bloqueo + Listas de bloqueo EasyList Lista principal de bloqueo de anuncios. EasyPrivacy diff --git a/app/src/main/res/values-it/strings.xml b/app/src/main/res/values-it/strings.xml index 5142d939..8f309ed0 100644 --- a/app/src/main/res/values-it/strings.xml +++ b/app/src/main/res/values-it/strings.xml @@ -308,7 +308,7 @@ Permetti gli screenshot Permette gli screenshot, la registrazione di video, e la possibilità di visualizzare su schermi non sicuri. La modifica di questa impostazione provoca il riavvio di Privacy Browser. - Block List + Blocklist EasyList Blocking list principale. EasyPrivacy diff --git a/app/src/main/res/values-ru/strings.xml b/app/src/main/res/values-ru/strings.xml index 0f76be5a..32f408f4 100644 --- a/app/src/main/res/values-ru/strings.xml +++ b/app/src/main/res/values-ru/strings.xml @@ -308,7 +308,7 @@ Отправлять заголовок \'Не отслеживать\', предлагающий веб-серверу не отслеживать этот браузер. Разрешить скриншоты Разрешить скриншоты, запись видео и просмотр на незащищенных дисплеях. При изменении этого параметра Privacy Browser будет перезапущен. - Списки блокировки + Списки блокировки EasyList Основной список блокировки рекламы. EasyPrivacy diff --git a/app/src/main/res/values/attrs.xml b/app/src/main/res/values/attrs.xml index dd6710b4..06f63c00 100644 --- a/app/src/main/res/values/attrs.xml +++ b/app/src/main/res/values/attrs.xml @@ -34,6 +34,9 @@ + + + diff --git a/app/src/main/res/values/colors.xml b/app/src/main/res/values/colors.xml index 94c863b8..8c17b837 100644 --- a/app/src/main/res/values/colors.xml +++ b/app/src/main/res/values/colors.xml @@ -68,6 +68,12 @@ #FFDCEDC8 #FF64DD17 + #FFFFCDD2 + #FFEF9A9A + #FFE53935 + #FFD32F2F + #55D32F2F + #FFC62828 #FFB71C1C #FFD50000 diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml index 84a28419..f7263b1e 100644 --- a/app/src/main/res/values/strings.xml +++ b/app/src/main/res/values/strings.xml @@ -222,6 +222,42 @@ Parent folder: Display order: + + Requests + Request details + Disposition + All + Default + Default - Allowed + Allowed + Blocked + Blocklist + Sublist + Main whitelist + Final whitelist + Domain whitelist + Domain initial whitelist + Domain final whitelist + Third-party whitelist + Third-party domain whitelist + Third-party domain initial whitelist + Main blacklist + Initial blacklist + Final blacklist + Domain blacklist + Domain initial blacklist + Domain final blacklist + Domain regular expression blacklist + Third-party blacklist + Third-party blacklist + Third-party domain blacklist + Third-party domain initial blacklist + Third-party regular expression blacklist + Third-party domain regular expression blacklist + Regular expression blacklist + Blocklist entries + Blocklist original entry + Domains Domain Settings @@ -340,7 +376,7 @@ Send the Do Not Track header, which politely suggests that web servers not track this browser. Allow screenshots Allow screenshots, video recording, and viewing on non-secure displays. Changing this setting will restart Privacy Browser. - Block Lists + Blocklists EasyList Main ad blocking list. EasyPrivacy diff --git a/app/src/main/res/values/styles.xml b/app/src/main/res/values/styles.xml index 45f62497..b785fde0 100644 --- a/app/src/main/res/values/styles.xml +++ b/app/src/main/res/values/styles.xml @@ -52,6 +52,9 @@ @color/bookmarks_spinner_color_selector_light @color/blue_750 @color/edit_bookmark_spinner_color_selector_light + @color/white + @color/requests_spinner_color_selector_light + @color/blue_750 @drawable/list_selector_light @color/blue_900 @color/blue_700 @@ -142,6 +145,9 @@ @color/bookmarks_spinner_color_selector_dark @color/blue_830 @color/edit_bookmark_spinner_color_selector_dark + @color/gray_300 + @color/requests_spinner_color_selector_dark + @color/blue_830 @color/blue_600 @color/blue_400 @color/gray_850 diff --git a/app/src/main/res/xml/preferences.xml b/app/src/main/res/xml/preferences.xml index e38eed88..55547577 100644 --- a/app/src/main/res/xml/preferences.xml +++ b/app/src/main/res/xml/preferences.xml @@ -89,8 +89,8 @@ + android:key="blocklists" + android:title="@string/blocklists" >