From: Soren Stoutner Date: Mon, 20 Mar 2023 22:05:32 +0000 (-0700) Subject: Bump the minimum API to 24 (Android 7). X-Git-Tag: v3.13.4~4 X-Git-Url: https://gitweb.stoutner.com/?a=commitdiff_plain;ds=sidebyside;h=514e93baaa8389dc9c5abdb79e68c890c260b8d3;p=PrivacyBrowserAndroid.git Bump the minimum API to 24 (Android 7). --- diff --git a/app/build.gradle b/app/build.gradle index fe17b07a..2b9ae72b 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -26,7 +26,7 @@ android { compileSdk 33 defaultConfig { - minSdk 23 + minSdk 24 targetSdk 33 versionCode 67 versionName "3.13.3" diff --git a/app/src/main/assets/de/about_changelog.html b/app/src/main/assets/de/about_changelog.html index 5ab37a96..a15bd052 100644 --- a/app/src/main/assets/de/about_changelog.html +++ b/app/src/main/assets/de/about_changelog.html @@ -33,8 +33,8 @@ -

3.13.3 (Version Code 67)

-

2. März 2023 - Mindest-API 23, Ziel-API 33

+

3.13.3 (Version Code 67)

+

13. März 2023 - Mindest-API 23, Ziel-API 33

diff --git a/app/src/main/assets/de/about_licenses.html b/app/src/main/assets/de/about_licenses.html index ee8b1b0a..86043292 100644 --- a/app/src/main/assets/de/about_licenses.html +++ b/app/src/main/assets/de/about_licenses.html @@ -66,7 +66,7 @@

are derived from security and language, which are part of the Android Material icon set and are released under the Apache License 2.0. - The full text of the license is below. Modifications copyright 2016 Soren Stoutner. + The full text of the license is below. Modifications copyright 2016-2017,2021-2022 Soren Stoutner. The resulting images are released under the GPLv3+ license.

is derived from elements of folder and exit_to_app, which are part of the Android Material icon set diff --git a/app/src/main/assets/en/about_changelog.html b/app/src/main/assets/en/about_changelog.html index 2d0075bf..5111cb93 100644 --- a/app/src/main/assets/en/about_changelog.html +++ b/app/src/main/assets/en/about_changelog.html @@ -27,8 +27,8 @@ -

3.13.3 (version code 67)

-

2 March 2023 - minimum API 23, target API 33

+

3.13.3 (version code 67)

+

13 March 2023 - minimum API 23, target API 33

diff --git a/app/src/main/assets/en/about_licenses.html b/app/src/main/assets/en/about_licenses.html index e5453f9a..efa8d3a1 100644 --- a/app/src/main/assets/en/about_licenses.html +++ b/app/src/main/assets/en/about_licenses.html @@ -63,7 +63,7 @@

are derived from security and language, which are part of the Android Material icon set and are released under the Apache License 2.0. - The full text of the license is below. Modifications copyright 2016 Soren Stoutner. + The full text of the license is below. Modifications copyright 2016-2017,2021-2022 Soren Stoutner. The resulting images are released under the GPLv3+ license.

is derived from elements of folder and exit_to_app, which are part of the Android Material icon set diff --git a/app/src/main/assets/es/about_changelog.html b/app/src/main/assets/es/about_changelog.html index c69e6389..c83a5808 100644 --- a/app/src/main/assets/es/about_changelog.html +++ b/app/src/main/assets/es/about_changelog.html @@ -29,8 +29,8 @@ -

3.13.3 (código de versión 67)

-

2 de marzo de 2023 - API mínimo 23, API objetivo 33

+

3.13.3 (código de versión 67)

+

13 de marzo de 2023 - API mínimo 23, API objetivo 33

diff --git a/app/src/main/assets/es/about_licenses.html b/app/src/main/assets/es/about_licenses.html index 0e717355..732872ec 100644 --- a/app/src/main/assets/es/about_licenses.html +++ b/app/src/main/assets/es/about_licenses.html @@ -65,7 +65,7 @@

derivan de security y de language, que son parte del conjunto de iconos Android Material y son liberados bajo la Licencia Apache 2.0. - El texto completo de la licencia se encuentra debajo. Copyright de modificaciones 2016 Soren Stoutner. + El texto completo de la licencia se encuentra debajo. Copyright de modificaciones 2016-2017,2021-2022 Soren Stoutner. Las imágenes resultantes se liberan bajo la licencia GPLv3+.

deriva de elementos de folder y exit_to_app, que son parte del conjunto de iconos Android Material y son liberados bajo la Licencia Apache 2.0. diff --git a/app/src/main/assets/fr/about_changelog.html b/app/src/main/assets/fr/about_changelog.html index 66e40d08..ed00cd59 100644 --- a/app/src/main/assets/fr/about_changelog.html +++ b/app/src/main/assets/fr/about_changelog.html @@ -29,8 +29,8 @@ -

3.13.3 (version du code 67)

-

2 Mars 2023 - API minimale : 23, API optimale : 33

+

3.13.3 (version du code 67)

+

13 Mars 2023 - API minimale : 23, API optimale : 33

diff --git a/app/src/main/assets/fr/about_licenses.html b/app/src/main/assets/fr/about_licenses.html index 2c27098d..38e1cf36 100644 --- a/app/src/main/assets/fr/about_licenses.html +++ b/app/src/main/assets/fr/about_licenses.html @@ -65,7 +65,7 @@

sont dérivés de security et de language, qui font partie de l'ensemble d'icônes Matériel Android et sont publiés sous la Licence Apache 2.0. - Le texte complet de la licence est ci-dessous. Modifications copyright 2016 Soren Stoutner. + Le texte complet de la licence est ci-dessous. Modifications copyright 2016-2017,2021-2022 Soren Stoutner. Les images résultantes sont publiées sous la licence GPLv3+.

est dérivé des éléments folder et exit_to_app, qui font partie de l'ensemble d'icônes Matériel Android diff --git a/app/src/main/assets/it/about_changelog.html b/app/src/main/assets/it/about_changelog.html index c22514d9..fd4789c5 100644 --- a/app/src/main/assets/it/about_changelog.html +++ b/app/src/main/assets/it/about_changelog.html @@ -29,8 +29,8 @@ -

3.13.3 (versione codice 67)

-

2 Marzo 2023 - minima API 23, target API 33

+

3.13.3 (versione codice 67)

+

13 Marzo 2023 - minima API 23, target API 33

diff --git a/app/src/main/assets/it/about_licenses.html b/app/src/main/assets/it/about_licenses.html index 4b0c6d92..619128b5 100644 --- a/app/src/main/assets/it/about_licenses.html +++ b/app/src/main/assets/it/about_licenses.html @@ -70,7 +70,7 @@

sono state derivate da security e language, che fanno parte dell'Android Material icon set e sono state rilasciate sotto Licenza Apache 2.0. - Il testo completo della Licenza è riportato di seguito. Copyright delle modifiche 2016 Soren Stoutner. + Il testo completo della Licenza è riportato di seguito. Copyright delle modifiche 2016-2017,2021-2022 Soren Stoutner. Le immagini risultanti sono rilasciate sotto Licenza GPLv3+.

è stata derivata da elementi di folder e di exit_to_app, che fanno parte dell'Android Material icon set e sono state rilasciate sotto Licenza Apache 2.0. diff --git a/app/src/main/assets/pt-rBR/about_changelog.html b/app/src/main/assets/pt-rBR/about_changelog.html index f9a97112..be0fce9a 100644 --- a/app/src/main/assets/pt-rBR/about_changelog.html +++ b/app/src/main/assets/pt-rBR/about_changelog.html @@ -29,8 +29,8 @@ -

3.13.3 (código de versão 67)

-

2 March 2023 - API mínimo 23, API alvo 33

+

3.13.3 (código de versão 67)

+

13 March 2023 - API mínimo 23, API alvo 33

diff --git a/app/src/main/assets/pt-rBR/about_licenses.html b/app/src/main/assets/pt-rBR/about_licenses.html index 21135069..e2a2ea45 100644 --- a/app/src/main/assets/pt-rBR/about_licenses.html +++ b/app/src/main/assets/pt-rBR/about_licenses.html @@ -65,7 +65,7 @@

are derived from security and language, which are part of the Android Material icon set and are released under the Apache License 2.0. - The full text of the license is below. Modifications copyright 2016 Soren Stoutner. + The full text of the license is below. Modifications copyright 2016-2017,2021-2022 Soren Stoutner. The resulting images are released under the GPLv3+ license.

is derived from elements of folder and exit_to_app, which are part of the Android Material icon set diff --git a/app/src/main/assets/ru/about_changelog.html b/app/src/main/assets/ru/about_changelog.html index 16c17364..cb401427 100644 --- a/app/src/main/assets/ru/about_changelog.html +++ b/app/src/main/assets/ru/about_changelog.html @@ -27,8 +27,8 @@ -

3.13.3 (код версии 67)

-

2 мая 2023 года - минимальный API 23, целевой API 33

+

3.13.3 (код версии 67)

+

13 мая 2023 года - минимальный API 23, целевой API 33

diff --git a/app/src/main/assets/ru/about_licenses.html b/app/src/main/assets/ru/about_licenses.html index b0b91fdd..8cf527f6 100644 --- a/app/src/main/assets/ru/about_licenses.html +++ b/app/src/main/assets/ru/about_licenses.html @@ -63,7 +63,7 @@

являются производными от security и language, которые являются частью Android Material icon set и выпущены под Apache License 2.0. Полный текст лицензии приведен ниже. - Модификации авторских прав 2016 Soren Stoutner. + Модификации авторских прав 2016-2017,2021-2022 Soren Stoutner. Полученные изображения выпущены под лицензией GPLv3+.

являются производными от folder и exit_to_app, которые являются частью Android Material icon set и выпущены под Apache License 2.0. diff --git a/app/src/main/assets/tr/about_changelog.html b/app/src/main/assets/tr/about_changelog.html index 4c0621ad..056a76c9 100644 --- a/app/src/main/assets/tr/about_changelog.html +++ b/app/src/main/assets/tr/about_changelog.html @@ -27,8 +27,8 @@ -

3.13.3 (version code 67)

-

2 Mart 2023 - minimum API 23, target API 33

+

3.13.3 (version code 67)

+

13 Mart 2023 - minimum API 23, target API 33

diff --git a/app/src/main/assets/tr/about_licenses.html b/app/src/main/assets/tr/about_licenses.html index 97865365..8ffaee4b 100644 --- a/app/src/main/assets/tr/about_licenses.html +++ b/app/src/main/assets/tr/about_licenses.html @@ -64,7 +64,7 @@

Apache License 2.0 altında yayınlanan ve Android Material simge setinin bir parçası olan security ve language'den elde edilmiştir. - Lisansın tüm metni aşağıdadır. Değişikliklerin telif hakkı 2016 Soren Stoutner. + Lisansın tüm metni aşağıdadır. Değişikliklerin telif hakkı 2016-2017,2021-2022 Soren Stoutner. Ortaya çıkan görüntüler GPLv3+ lisansı altında yayınlandı.

Apache License 2.0 altında yayınlanan ve Android Material simge setinin bir parçası olan folder ve exit_to_app elementlerinden elde edilmiştir. diff --git a/app/src/main/assets/zh-rCN/about_changelog.html b/app/src/main/assets/zh-rCN/about_changelog.html index 03983158..6746266f 100644 --- a/app/src/main/assets/zh-rCN/about_changelog.html +++ b/app/src/main/assets/zh-rCN/about_changelog.html @@ -29,8 +29,8 @@ -

3.13.3 (version code 67)

-

2 March 2023 - 最低支持API 23, 最高支持API 33

+

3.13.3 (version code 67)

+

13 March 2023 - 最低支持API 23, 最高支持API 33

diff --git a/app/src/main/assets/zh-rCN/about_licenses.html b/app/src/main/assets/zh-rCN/about_licenses.html index e137f654..16635dc3 100644 --- a/app/src/main/assets/zh-rCN/about_licenses.html +++ b/app/src/main/assets/zh-rCN/about_licenses.html @@ -64,7 +64,7 @@

出自 security和language, Android Material icon set中的一部分,在 Apache License 2.0下发布。 - 完整的证书内容在下面。Modifications copyright 2016 Soren Stoutner. + 完整的证书内容在下面。Modifications copyright 2016-2017,2021-2022 Soren Stoutner. 生成的图标在GPLv3+ license下发布。

出自folder和exit_to_app, 是Android Material icon set的一部分, 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 05bb2f58..985414fa 100644 --- a/app/src/main/java/com/stoutner/privacybrowser/activities/BookmarksActivity.java +++ b/app/src/main/java/com/stoutner/privacybrowser/activities/BookmarksActivity.java @@ -1,5 +1,5 @@ /* - * Copyright 2016-2022 Soren Stoutner . + * Copyright 2016-2023 Soren Stoutner . * * This file is part of Privacy Browser Android . * @@ -625,12 +625,9 @@ public class BookmarksActivity extends AppCompatActivity implements CreateBookma // Get the checked bookmarks array list. ArrayList 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)); }); } 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 3a3db0e9..39b95dca 100644 --- a/app/src/main/java/com/stoutner/privacybrowser/activities/MainWebViewActivity.java +++ b/app/src/main/java/com/stoutner/privacybrowser/activities/MainWebViewActivity.java @@ -4359,7 +4359,7 @@ public class MainWebViewActivity extends AppCompatActivity implements CreateBook // 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()); @@ -5333,9 +5333,11 @@ public class MainWebViewActivity extends AppCompatActivity implements CreateBook 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); diff --git a/app/src/main/java/com/stoutner/privacybrowser/activities/ViewSourceActivity.kt b/app/src/main/java/com/stoutner/privacybrowser/activities/ViewSourceActivity.kt index 514e3095..a8d86ecc 100644 --- a/app/src/main/java/com/stoutner/privacybrowser/activities/ViewSourceActivity.kt +++ b/app/src/main/java/com/stoutner/privacybrowser/activities/ViewSourceActivity.kt @@ -1,5 +1,5 @@ /* - * Copyright 2017-2022 Soren Stoutner . + * Copyright 2017-2023 Soren Stoutner . * * This file is part of Privacy Browser Android . * @@ -19,7 +19,6 @@ package com.stoutner.privacybrowser.activities -import android.os.Build import android.os.Bundle import android.text.SpannableStringBuilder import android.text.style.ForegroundColorSpan @@ -55,8 +54,6 @@ import com.stoutner.privacybrowser.helpers.UrlHelper 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" @@ -183,62 +180,53 @@ class ViewSourceActivity: AppCompatActivity(), UntrustedSslCertificateListener { // 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. @@ -257,7 +245,7 @@ class ViewSourceActivity: AppCompatActivity(), UntrustedSslCertificateListener { 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] diff --git a/app/src/main/java/com/stoutner/privacybrowser/fragments/AboutWebViewFragment.kt b/app/src/main/java/com/stoutner/privacybrowser/fragments/AboutWebViewFragment.kt index 8ce9e225..96a475b5 100644 --- a/app/src/main/java/com/stoutner/privacybrowser/fragments/AboutWebViewFragment.kt +++ b/app/src/main/java/com/stoutner/privacybrowser/fragments/AboutWebViewFragment.kt @@ -1,5 +1,5 @@ /* - * Copyright © 2016-2022 Soren Stoutner . + * Copyright © 2016-2023 Soren Stoutner . * * This file is part of Privacy Browser Android . * @@ -21,7 +21,6 @@ package com.stoutner.privacybrowser.fragments 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 @@ -91,14 +90,13 @@ class AboutWebViewFragment : Fragment() { // 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) diff --git a/app/src/main/java/com/stoutner/privacybrowser/fragments/GuideWebViewFragment.kt b/app/src/main/java/com/stoutner/privacybrowser/fragments/GuideWebViewFragment.kt index 62f17c5d..5c8425cc 100644 --- a/app/src/main/java/com/stoutner/privacybrowser/fragments/GuideWebViewFragment.kt +++ b/app/src/main/java/com/stoutner/privacybrowser/fragments/GuideWebViewFragment.kt @@ -1,5 +1,5 @@ /* - * Copyright 2016-2022 Soren Stoutner . + * Copyright 2016-2023 Soren Stoutner . * * This file is part of Privacy Browser Android . * @@ -21,7 +21,6 @@ package com.stoutner.privacybrowser.fragments 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 @@ -90,14 +89,13 @@ class GuideWebViewFragment : Fragment() { // 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)