compileSdk 33
defaultConfig {
- minSdk 23
+ minSdk 24
targetSdk 33
versionCode 67
versionName "3.13.3"
</head>
<body>
- <h3>3.13.3 (Version Code 67)</h3>
- <p>2. März 2023 - Mindest-API 23, Ziel-API 33</p>
+ <h3><a href="https://www.stoutner.com/privacy-browser-android-3-13-3/">3.13.3</a> (Version Code 67)</h3>
+ <p><a href="https://gitweb.stoutner.com/?p=PrivacyBrowserAndroid.git;a=commitdiff;h=c5359b173d559fc154bf7e4bd8fd65c951c529b3">13. März 2023</a> - Mindest-API 23, Ziel-API 33</p>
<ul>
<li>Fehler behoben, durch welchen der <a href="https://redmine.stoutner.com/issues/963">aktuelle Tab manchmal nicht der aktive Tab war</a>.</li>
</ul>
<p><img class="left" src="../shared_images/privacy_browser.svg"/> <img class="left" src="../shared_images/warning.svg"/> <img class="left" src="../shared_images/javascript_enabled.svg"/>
are derived from <code>security</code> and <code>language</code>, which are part of the <a href="https://fonts.google.com/icons">Android Material icon set</a> and are released under the
<a href ="https://www.apache.org/licenses/LICENSE-2.0">Apache License 2.0</a>.
- The full text of the license is below. Modifications copyright 2016 <a href="mailto:soren@stoutner.com">Soren Stoutner</a>.
+ The full text of the license is below. Modifications copyright 2016-2017,2021-2022 <a href="mailto:soren@stoutner.com">Soren Stoutner</a>.
The resulting images are released under the <a href="https://www.gnu.org/licenses/gpl-3.0.html">GPLv3+ license</a>.</p>
<p><svg class="left"><use href="../shared_images/move_to_folder.svg#icon"/></svg> is derived from elements of <code>folder</code> and <code>exit_to_app</code>,
which are part of the <a href="https://fonts.google.com/icons">Android Material icon set</a>
</head>
<body>
- <h3>3.13.3 (version code 67)</h3>
- <p>2 March 2023 - minimum API 23, target API 33</p>
+ <h3><a href="https://www.stoutner.com/privacy-browser-android-3-13-3/">3.13.3</a> (version code 67)</h3>
+ <p><a href="https://gitweb.stoutner.com/?p=PrivacyBrowserAndroid.git;a=commitdiff;h=c5359b173d559fc154bf7e4bd8fd65c951c529b3">13 March 2023</a> - minimum API 23, target API 33</p>
<ul>
<li>Fix a race condition that sometimes caused the <a href="https://redmine.stoutner.com/issues/963">current tab to not be the active tab</a>.</li>
</ul>
<p><img class="left" src="../shared_images/privacy_browser.svg"/> <img class="left" src="../shared_images/warning.svg"/> <img class="left" src="../shared_images/javascript_enabled.svg"/>
are derived from <code>security</code> and <code>language</code>, which are part of the <a href="https://fonts.google.com/icons">Android Material icon set</a> and are released under the
<a href ="https://www.apache.org/licenses/LICENSE-2.0">Apache License 2.0</a>.
- The full text of the license is below. Modifications copyright 2016 <a href="mailto:soren@stoutner.com">Soren Stoutner</a>.
+ The full text of the license is below. Modifications copyright 2016-2017,2021-2022 <a href="mailto:soren@stoutner.com">Soren Stoutner</a>.
The resulting images are released under the <a href="https://www.gnu.org/licenses/gpl-3.0.html">GPLv3+ license</a>.</p>
<p><svg class="left"><use href="../shared_images/move_to_folder.svg#icon"/></svg> is derived from elements of <code>folder</code> and <code>exit_to_app</code>,
which are part of the <a href="https://fonts.google.com/icons">Android Material icon set</a>
</head>
<body>
- <h3>3.13.3 (código de versión 67)</h3>
- <p>2 de marzo de 2023 - API mínimo 23, API objetivo 33</p>
+ <h3><a href="https://www.stoutner.com/privacy-browser-android-3-13-3/">3.13.3</a> (código de versión 67)</h3>
+ <p><a href="https://gitweb.stoutner.com/?p=PrivacyBrowserAndroid.git;a=commitdiff;h=c5359b173d559fc154bf7e4bd8fd65c951c529b3">13 de marzo de 2023</a> - API mínimo 23, API objetivo 33</p>
<ul>
<li>Corregir una condición de carrera que a veces provocaba que la <a href="https://redmine.stoutner.com/issues/963">pestaña actual no fuera la pestaña activa</a>.</li>
</ul>
<p><img class="left" src="../shared_images/privacy_browser.svg"/> <img class="left" src="../shared_images/warning.svg"/> <img class="left" src="../shared_images/javascript_enabled.svg"/>
derivan de <code>security</code> y de <code>language</code>, que son parte del <a href="https://fonts.google.com/icons">conjunto de iconos Android Material</a> y son liberados bajo la
<a href ="https://www.apache.org/licenses/LICENSE-2.0">Licencia Apache 2.0</a>.
- El texto completo de la licencia se encuentra debajo. Copyright de modificaciones 2016 <a href="mailto:soren@stoutner.com">Soren Stoutner</a>.
+ El texto completo de la licencia se encuentra debajo. Copyright de modificaciones 2016-2017,2021-2022 <a href="mailto:soren@stoutner.com">Soren Stoutner</a>.
Las imágenes resultantes se liberan bajo la <a href="https://www.gnu.org/licenses/gpl-3.0.html">licencia GPLv3+</a>.</p>
<p><svg class="left"><use href="../shared_images/move_to_folder.svg#icon"/></svg> deriva de elementos de <code>folder</code> y <code>exit_to_app</code>, que son parte del
<a href="https://fonts.google.com/icons">conjunto de iconos Android Material</a> y son liberados bajo la <a href ="https://www.apache.org/licenses/LICENSE-2.0">Licencia Apache 2.0</a>.
</head>
<body>
- <h3>3.13.3 (version du code 67)</h3>
- <p>2 Mars 2023 - API minimale : 23, API optimale : 33</p>
+ <h3><a href="https://www.stoutner.com/privacy-browser-android-3-13-3/">3.13.3</a> (version du code 67)</h3>
+ <p><a href="https://gitweb.stoutner.com/?p=PrivacyBrowserAndroid.git;a=commitdiff;h=c5359b173d559fc154bf7e4bd8fd65c951c529b3">13 Mars 2023</a> - API minimale : 23, API optimale : 33</p>
<ul>
<li>Fix a race condition that sometimes caused the <a href="https://redmine.stoutner.com/issues/963">current tab to not be the active tab</a>.</li>
</ul>
<p><img class="left" src="../shared_images/privacy_browser.svg"> <img class="left" src="../shared_images/warning.svg"> <img class="left" src="../shared_images/javascript_enabled.svg"> sont dérivés de
<code>security</code> et de <code>language</code>, qui font partie de <a href="https://fonts.google.com/icons">l'ensemble d'icônes Matériel Android</a> et sont publiés sous la
<a href ="https://www.apache.org/licenses/LICENSE-2.0">Licence Apache 2.0</a>.
- Le texte complet de la licence est ci-dessous. Modifications copyright 2016 <a href="mailto:soren@stoutner.com">Soren Stoutner</a>.
+ Le texte complet de la licence est ci-dessous. Modifications copyright 2016-2017,2021-2022 <a href="mailto:soren@stoutner.com">Soren Stoutner</a>.
Les images résultantes sont publiées sous la <a href="https://www.gnu.org/licenses/gpl-3.0.html">licence GPLv3+</a>.</p>
<p><svg class="left"><use href="../shared_images/move_to_folder.svg#icon"/></svg> est dérivé des éléments <code>folder</code> et <code>exit_to_app</code>,
qui font partie de <a href="https://fonts.google.com/icons">l'ensemble d'icônes Matériel Android</a>
</head>
<body>
- <h3>3.13.3 (versione codice 67)</h3>
- <p>2 Marzo 2023 - minima API 23, target API 33</p>
+ <h3><a href="https://www.stoutner.com/privacy-browser-android-3-13-3/">3.13.3</a> (versione codice 67)</h3>
+ <p><a href="https://gitweb.stoutner.com/?p=PrivacyBrowserAndroid.git;a=commitdiff;h=c5359b173d559fc154bf7e4bd8fd65c951c529b3">13 Marzo 2023</a> - minima API 23, target API 33</p>
<ul>
<li>Correzione di una "situazione di corsa" che talvolta faceva in modo che la <a href="https://redmine.stoutner.com/issues/963">scheda in uso non fosse la scheda attiva</a>.</li>
</ul>
<p><img class="left" src="../shared_images/privacy_browser.svg"/> <img class="left" src="../shared_images/warning.svg"/> <img class="left" src="../shared_images/javascript_enabled.svg"/>
sono state derivate da <code>security</code> e <code>language</code>, che fanno parte dell'<a href="https://fonts.google.com/icons">Android Material icon set</a> e sono state rilasciate sotto
<a href ="https://www.apache.org/licenses/LICENSE-2.0">Licenza Apache 2.0</a>.
- Il testo completo della Licenza è riportato di seguito. Copyright delle modifiche 2016 <a href="mailto:soren@stoutner.com">Soren Stoutner</a>.
+ Il testo completo della Licenza è riportato di seguito. Copyright delle modifiche 2016-2017,2021-2022 <a href="mailto:soren@stoutner.com">Soren Stoutner</a>.
Le immagini risultanti sono rilasciate sotto <a href="https://www.gnu.org/licenses/gpl-3.0.html">Licenza GPLv3+</a>.</p>
<p><svg class="left"><use href="../shared_images/move_to_folder.svg#icon"/></svg> è stata derivata da elementi di <code>folder</code> e di <code>exit_to_app</code>, che fanno parte
dell'<a href="https://fonts.google.com/icons">Android Material icon set</a> e sono state rilasciate sotto <a href ="https://www.apache.org/licenses/LICENSE-2.0">Licenza Apache 2.0</a>.
</head>
<body>
- <h3>3.13.3 (código de versão 67)</h3>
- <p>2 March 2023 - API mínimo 23, API alvo 33</p>
+ <h3><a href="https://www.stoutner.com/privacy-browser-android-3-13-3/">3.13.3</a> (código de versão 67)</h3>
+ <p><a href="https://gitweb.stoutner.com/?p=PrivacyBrowserAndroid.git;a=commitdiff;h=c5359b173d559fc154bf7e4bd8fd65c951c529b3">13 March 2023</a> - API mínimo 23, API alvo 33</p>
<ul>
<li>Fix a race condition that sometimes caused the <a href="https://redmine.stoutner.com/issues/963">current tab to not be the active tab</a>.</li>
</ul>
<p><img class="left" src="../shared_images/privacy_browser.svg"/> <img class="left" src="../shared_images/warning.svg"/> <img class="left" src="../shared_images/javascript_enabled.svg"/>
are derived from <code>security</code> and <code>language</code>, which are part of the <a href="https://fonts.google.com/icons">Android Material icon set</a> and are released under the
<a href ="https://www.apache.org/licenses/LICENSE-2.0">Apache License 2.0</a>.
- The full text of the license is below. Modifications copyright 2016 <a href="mailto:soren@stoutner.com">Soren Stoutner</a>.
+ The full text of the license is below. Modifications copyright 2016-2017,2021-2022 <a href="mailto:soren@stoutner.com">Soren Stoutner</a>.
The resulting images are released under the <a href="https://www.gnu.org/licenses/gpl-3.0.html">GPLv3+ license</a>.</p>
<p><svg class="left"><use href="../shared_images/move_to_folder.svg#icon"/></svg> is derived from elements of <code>folder</code> and <code>exit_to_app</code>,
which are part of the <a href="https://fonts.google.com/icons">Android Material icon set</a>
</head>
<body>
- <h3>3.13.3 (код версии 67)</h3>
- <p>2 мая 2023 года - минимальный API 23, целевой API 33</p>
+ <h3><a href="https://www.stoutner.com/privacy-browser-android-3-13-3/">3.13.3</a> (код версии 67)</h3>
+ <p><a href="https://gitweb.stoutner.com/?p=PrivacyBrowserAndroid.git;a=commitdiff;h=c5359b173d559fc154bf7e4bd8fd65c951c529b3">13 мая 2023 года</a> - минимальный API 23, целевой API 33</p>
<ul>
<li>Исправлена ошибка, из-за которой <a href="https://redmine.stoutner.com/issues/963">текущая вкладка иногда не становилась активной</a>.</li>
</ul>
<p><img class="left" src="../shared_images/privacy_browser.svg"/> <img class="left" src="../shared_images/warning.svg"/> <img class="left" src="../shared_images/javascript_enabled.svg"/>
являются производными от <code>security</code> и <code>language</code>, которые являются частью <a href="https://fonts.google.com/icons">Android Material icon set</a> и выпущены под
<a href ="https://www.apache.org/licenses/LICENSE-2.0">Apache License 2.0</a>. Полный текст лицензии приведен ниже.
- Модификации авторских прав 2016 <a href="mailto:soren@stoutner.com">Soren Stoutner</a>.
+ Модификации авторских прав 2016-2017,2021-2022 <a href="mailto:soren@stoutner.com">Soren Stoutner</a>.
Полученные изображения выпущены под <a href="https://www.gnu.org/licenses/gpl-3.0.html">лицензией GPLv3+</a>.</p>
<p><svg class="left"><use href="../shared_images/move_to_folder.svg#icon"/></svg> являются производными от <code>folder</code> и <code>exit_to_app</code>, которые являются частью
<a href="https://fonts.google.com/icons">Android Material icon set</a> и выпущены под <a href ="https://www.apache.org/licenses/LICENSE-2.0">Apache License 2.0</a>.
</head>
<body>
- <h3>3.13.3 (version code 67)</h3>
- <p>2 Mart 2023 - minimum API 23, target API 33</p>
+ <h3><a href="https://www.stoutner.com/privacy-browser-android-3-13-3/">3.13.3</a> (version code 67)</h3>
+ <p><a href="https://gitweb.stoutner.com/?p=PrivacyBrowserAndroid.git;a=commitdiff;h=c5359b173d559fc154bf7e4bd8fd65c951c529b3">13 Mart 2023</a> - minimum API 23, target API 33</p>
<ul>
<li>Fix a race condition that sometimes caused the <a href="https://redmine.stoutner.com/issues/963">current tab to not be the active tab</a>.</li>
</ul>
<p><img class="left" src="../shared_images/privacy_browser.svg"/> <img class="left" src="../shared_images/warning.svg"/> <img class="left" src="../shared_images/javascript_enabled.svg"/>
<a href ="https://www.apache.org/licenses/LICENSE-2.0">Apache License 2.0</a> altında yayınlanan ve
<a href="https://fonts.google.com/icons">Android Material</a> simge setinin bir parçası olan <code>security</code> ve <code>language</code>'den elde edilmiştir.
- Lisansın tüm metni aşağıdadır. Değişikliklerin telif hakkı 2016 <a href="mailto:soren@stoutner.com">Soren Stoutner</a>.
+ Lisansın tüm metni aşağıdadır. Değişikliklerin telif hakkı 2016-2017,2021-2022 <a href="mailto:soren@stoutner.com">Soren Stoutner</a>.
Ortaya çıkan görüntüler <a href="https://www.gnu.org/licenses/gpl-3.0.html">GPLv3+</a> lisansı altında yayınlandı.</p>
<p><svg class="left"><use href="../shared_images/move_to_folder.svg#icon"/></svg> <a href ="https://www.apache.org/licenses/LICENSE-2.0">Apache License 2.0</a> altında yayınlanan ve
<a href="https://fonts.google.com/icons">Android Material</a> simge setinin bir parçası olan <code>folder</code> ve <code>exit_to_app</code> elementlerinden elde edilmiştir.
</head>
<body>
- <h3>3.13.3 (version code 67)</h3>
- <p>2 March 2023 - 最低支持API 23, 最高支持API 33</p>
+ <h3><a href="https://www.stoutner.com/privacy-browser-android-3-13-3/">3.13.3</a> (version code 67)</h3>
+ <p><a href="https://gitweb.stoutner.com/?p=PrivacyBrowserAndroid.git;a=commitdiff;h=c5359b173d559fc154bf7e4bd8fd65c951c529b3">13 March 2023</a> - 最低支持API 23, 最高支持API 33</p>
<ul>
<li>修复由<a href="https://redmine.stoutner.com/issues/963">引起的当前选项卡不工作场景</a>。</li>
</ul>
<p><img class="left" src="../shared_images/privacy_browser.svg"/> <img class="left" src="../shared_images/warning.svg"/> <img class="left" src="../shared_images/javascript_enabled.svg"/>
出自 <code>security</code>和<code>language</code>, <a href="https://fonts.google.com/icons">Android Material icon set</a>中的一部分,在
<a href ="https://www.apache.org/licenses/LICENSE-2.0">Apache License 2.0</a>下发布。
- 完整的证书内容在下面。Modifications copyright 2016 <a href="mailto:soren@stoutner.com">Soren Stoutner</a>.
+ 完整的证书内容在下面。Modifications copyright 2016-2017,2021-2022 <a href="mailto:soren@stoutner.com">Soren Stoutner</a>.
生成的图标在<a href="https://www.gnu.org/licenses/gpl-3.0.html">GPLv3+ license</a>下发布。</p>
<p><svg class="left"><use href="../shared_images/move_to_folder.svg#icon"/></svg>出自<code>folder</code>和<code>exit_to_app</code>,
是<a href="https://fonts.google.com/icons">Android Material icon set</a>的一部分,
/*
- * Copyright 2016-2022 Soren Stoutner <soren@stoutner.com>.
+ * Copyright 2016-2023 Soren Stoutner <soren@stoutner.com>.
*
* This file is part of Privacy Browser Android <https://www.stoutner.com/privacy-browser-android>.
*
// Get the checked bookmarks array list.
ArrayList<Integer> checkedBookmarksArrayList = savedInstanceState.getIntegerArrayList(CHECKED_BOOKMARKS_ARRAY_LIST);
- // Check each previously checked bookmark in the list view. When the minimum API >= 24 a `forEach()` command can be used instead.
- if (checkedBookmarksArrayList != null) {
- for (int i = 0; i < checkedBookmarksArrayList.size(); i++) {
- bookmarksListView.setItemChecked(checkedBookmarksArrayList.get(i), true);
- }
- }
+ // Check each previously checked bookmark in the list view.
+ if (checkedBookmarksArrayList != null)
+ checkedBookmarksArrayList.forEach((position) -> bookmarksListView.setItemChecked(position, true));
});
}
// Add the first tab.
addNewTab("", true);
} else { // The activity has been restarted.
- // Restore each tab. Once the minimum API >= 24, a `forEach()` command can be used.
+ // Restore each tab.
for (int i = 0; i < savedStateArrayList.size(); i++) {
// Add a new tab.
tabLayout.addTab(tabLayout.newTab());
nestedScrollWebView.setWebViewClient(new WebViewClient() {
// `shouldOverrideUrlLoading` makes this WebView the default handler for URLs inside the app, so that links are not kicked out to other apps.
- // The deprecated `shouldOverrideUrlLoading` must be used until API >= 24.
@Override
- public boolean shouldOverrideUrlLoading(WebView view, String url) {
+ public boolean shouldOverrideUrlLoading(WebView view, WebResourceRequest webResourceRequest) {
+ // Get the URL from the web resource request.
+ String url = webResourceRequest.getUrl().toString();
+
// Sanitize the url.
url = sanitizeUrl(url);
/*
- * Copyright 2017-2022 Soren Stoutner <soren@stoutner.com>.
+ * Copyright 2017-2023 Soren Stoutner <soren@stoutner.com>.
*
* This file is part of Privacy Browser Android <https://www.stoutner.com/privacy-browser-android>.
*
package com.stoutner.privacybrowser.activities
-import android.os.Build
import android.os.Bundle
import android.text.SpannableStringBuilder
import android.text.style.ForegroundColorSpan
import com.stoutner.privacybrowser.viewmodelfactories.WebViewSourceFactory
import com.stoutner.privacybrowser.viewmodels.WebViewSource
-import java.util.Locale
-
// Define the public constants.
const val CURRENT_URL = "current_url"
const val USER_AGENT = "user_agent"
// Set the swipe refresh background color.
swipeRefreshLayout.setProgressBackgroundColorSchemeColor(colorBackgroundInt)
- // Populate the locale string.
- val localeString = if (Build.VERSION.SDK_INT >= 24) { // SDK >= 24 has a list of locales.
- // Get the list of locales.
- val localeList = resources.configuration.locales
-
- // Initialize a string builder to extract the locales from the list.
- val localesStringBuilder = StringBuilder()
+ // Get the list of locales.
+ val localeList = resources.configuration.locales
- // Initialize a `q` value, which is used by `WebView` to indicate the order of importance of the languages.
- var q = 10
-
- // Populate the string builder with the contents of the locales list.
- for (i in 0 until localeList.size()) {
- // Append a comma if there is already an item in the string builder.
- if (i > 0) {
- localesStringBuilder.append(",")
- }
+ // Initialize a string builder to extract the locales from the list.
+ val localesStringBuilder = StringBuilder()
- // Get the locale from the list.
- val locale = localeList[i]
+ // Initialize a `q` value, which is used by `WebView` to indicate the order of importance of the languages.
+ var q = 10
- // Add the locale to the string. `locale` by default displays as `en_US`, but WebView uses the `en-US` format.
- localesStringBuilder.append(locale.language)
- localesStringBuilder.append("-")
- localesStringBuilder.append(locale.country)
+ // Populate the string builder with the contents of the locales list.
+ for (i in 0 until localeList.size()) {
+ // Append a comma if there is already an item in the string builder.
+ if (i > 0) {
+ localesStringBuilder.append(",")
+ }
- // If not the first locale, append `;q=0.x`, which drops by .1 for each removal from the main locale until q=0.1.
- if (q < 10) {
- localesStringBuilder.append(";q=0.")
- localesStringBuilder.append(q)
- }
+ // Get the locale from the list.
+ val locale = localeList[i]
- // Decrement `q` if it is greater than 1.
- if (q > 1) {
- q--
- }
+ // Add the locale to the string. `locale` by default displays as `en_US`, but WebView uses the `en-US` format.
+ localesStringBuilder.append(locale.language)
+ localesStringBuilder.append("-")
+ localesStringBuilder.append(locale.country)
- // Add a second entry for the language only portion of the locale.
- localesStringBuilder.append(",")
- localesStringBuilder.append(locale.language)
-
- // Append `1;q=0.x`, which drops by .1 for each removal form the main locale until q=0.1.
+ // If not the first locale, append `;q=0.x`, which drops by .1 for each removal from the main locale until q=0.1.
+ if (q < 10) {
localesStringBuilder.append(";q=0.")
localesStringBuilder.append(q)
+ }
- // Decrement `q` if it is greater than 1.
- if (q > 1) {
- q--
- }
+ // Decrement `q` if it is greater than 1.
+ if (q > 1) {
+ q--
}
- // Store the populated string builder in the locale string.
- localesStringBuilder.toString()
- } else { // SDK < 24 only has a primary locale.
- // Store the locale in the locale string.
- Locale.getDefault().toString()
+ // Add a second entry for the language only portion of the locale.
+ localesStringBuilder.append(",")
+ localesStringBuilder.append(locale.language)
+
+ // Append `1;q=0.x`, which drops by .1 for each removal form the main locale until q=0.1.
+ localesStringBuilder.append(";q=0.")
+ localesStringBuilder.append(q)
+
+ // Decrement `q` if it is greater than 1.
+ if (q > 1) {
+ q--
+ }
}
// Instantiate the proxy helper.
updateLayout(currentUrl)
// Instantiate the WebView source factory.
- val webViewSourceFactory: ViewModelProvider.Factory = WebViewSourceFactory(currentUrl, userAgent, localeString, proxy, contentResolver, MainWebViewActivity.executorService)
+ val webViewSourceFactory: ViewModelProvider.Factory = WebViewSourceFactory(currentUrl, userAgent, localesStringBuilder.toString(), proxy, contentResolver, MainWebViewActivity.executorService)
// Instantiate the WebView source view model class.
webViewSource = ViewModelProvider(this, webViewSourceFactory)[WebViewSource::class.java]
/*
- * Copyright © 2016-2022 Soren Stoutner <soren@stoutner.com>.
+ * Copyright © 2016-2023 Soren Stoutner <soren@stoutner.com>.
*
* This file is part of Privacy Browser Android <https://www.stoutner.com/privacy-browser-android>.
*
import android.content.Intent
import android.content.res.Configuration
-import android.net.Uri
import android.os.Build
import android.os.Bundle
import android.view.LayoutInflater
// Set a WebView client.
tabWebView.webViewClient = object : WebViewClient() {
- // // Send external links back to the main Privacy Browser WebView. The deprecated `shouldOverrideUrlLoading` must be used until API >= 24.
- @Deprecated("Deprecated in Java")
- override fun shouldOverrideUrlLoading(view: WebView, url: String): Boolean {
+ // Send external links back to the main Privacy Browser WebView.
+ override fun shouldOverrideUrlLoading(view: WebView, webResourceRequest: WebResourceRequest): Boolean {
// Create an intent to view the URL.
val urlIntent = Intent(Intent.ACTION_VIEW)
// Add the URL to the intent.
- urlIntent.data = Uri.parse(url)
+ urlIntent.data = webResourceRequest.url
// Make it so.
startActivity(urlIntent)
/*
- * Copyright 2016-2022 Soren Stoutner <soren@stoutner.com>.
+ * Copyright 2016-2023 Soren Stoutner <soren@stoutner.com>.
*
* This file is part of Privacy Browser Android <https://www.stoutner.com/privacy-browser-android>.
*
import android.content.Intent
import android.content.res.Configuration
-import android.net.Uri
import android.os.Build
import android.os.Bundle
import android.view.LayoutInflater
// Set a WebView client.
tabWebView.webViewClient = object : WebViewClient() {
- // Send external links back to the main Privacy Browser WebView. The deprecated `shouldOverrideUrlLoading` must be used until API >= 24.
- @Deprecated("Deprecated in Java")
- override fun shouldOverrideUrlLoading(view: WebView, url: String): Boolean {
+ // Send external links back to the main Privacy Browser WebView.
+ override fun shouldOverrideUrlLoading(view: WebView, webResourceRequest: WebResourceRequest): Boolean {
// Create an intent to view the URL.
val urlIntent = Intent(Intent.ACTION_VIEW)
// Add the URL to the intent.
- urlIntent.data = Uri.parse(url)
+ urlIntent.data = webResourceRequest.url
// Make it so.
startActivity(urlIntent)