]> gitweb.stoutner.com Git - PrivacyBrowserAndroid.git/commitdiff
Restore display image status on reload. https://redmine.stoutner.com/issues/1274
authorSoren Stoutner <soren@stoutner.com>
Fri, 30 May 2025 22:08:42 +0000 (15:08 -0700)
committerSoren Stoutner <soren@stoutner.com>
Fri, 30 May 2025 22:08:42 +0000 (15:08 -0700)
14 files changed:
app/src/main/java/com/stoutner/privacybrowser/adapters/AboutStateAdapter.kt
app/src/main/java/com/stoutner/privacybrowser/adapters/GuideStateAdapter.kt
app/src/main/java/com/stoutner/privacybrowser/adapters/HistoryArrayAdapter.kt
app/src/main/java/com/stoutner/privacybrowser/adapters/PinnedMismatchPagerAdapter.kt
app/src/main/java/com/stoutner/privacybrowser/adapters/RequestsArrayAdapter.kt
app/src/main/java/com/stoutner/privacybrowser/fragments/AboutWebViewFragment.kt
app/src/main/java/com/stoutner/privacybrowser/fragments/DomainSettingsFragment.kt
app/src/main/java/com/stoutner/privacybrowser/fragments/DomainsListFragment.kt
app/src/main/java/com/stoutner/privacybrowser/fragments/GuideWebViewFragment.kt
app/src/main/java/com/stoutner/privacybrowser/fragments/WebViewTabFragment.kt
app/src/main/java/com/stoutner/privacybrowser/views/CheckedLinearLayout.kt
app/src/main/java/com/stoutner/privacybrowser/views/NestedScrollWebView.kt
app/src/main/java/com/stoutner/privacybrowser/views/WrapVerticalContentViewPager.kt
build.gradle

index 9e110a5959d6214ea6038b41cc784ab428a1506d..6fe1969dd6178c6c436ba13679292bca163fa8a8 100644 (file)
@@ -1,20 +1,20 @@
-/*
- * Copyright © 2016-2023 Soren Stoutner <soren@stoutner.com>.
+/* SPDX-License-Identifier: GPL-3.0-or-later
+ * SPDX-FileCopyrightText: 2016-2023 Soren Stoutner <soren@stoutner.com>
  *
- * This file is part of Privacy Browser Android <https://www.stoutner.com/privacy-browser-android>.
+ * This file is part of Privacy Browser Android <https://www.stoutner.com/privacy-browser-android/>.
  *
- * Privacy Browser Android 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.
+ * This program 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 Android 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.
+ * This program 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 Android.  If not, see <http://www.gnu.org/licenses/>.
+ * You should have received a copy of the GNU General Public License along with
+ * this program.  If not, see <https://www.gnu.org/licenses/>.
  */
 
 package com.stoutner.privacybrowser.adapters
index 50a1162cf052b4e1af5f563919e3e2c9d657476d..3f4fda1f5ffd83977602d2dd511498f21172f064 100644 (file)
@@ -1,20 +1,20 @@
-/*
- * Copyright 2016-2020,2022-2023 Soren Stoutner <soren@stoutner.com>.
+/* SPDX-License-Identifier: GPL-3.0-or-later
+ * SPDX-FileCopyrightText: 2016-2020, 2022-2023 Soren Stoutner <soren@stoutner.com>
  *
- * This file is part of Privacy Browser Android <https://www.stoutner.com/privacy-browser-android>.
+ * This file is part of Privacy Browser Android <https://www.stoutner.com/privacy-browser-android/>.
  *
- * Privacy Browser Android 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.
+ * This program 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 Android 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.
+ * This program 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 Android.  If not, see <http://www.gnu.org/licenses/>.
+ * You should have received a copy of the GNU General Public License along with
+ * this program.  If not, see <https://www.gnu.org/licenses/>.
  */
 
 package com.stoutner.privacybrowser.adapters
index 3c7469579b2c82c8858a127293f9e599b9eb0bfe..37aa48f2826eb66d6552b53da3cb3f2b95cbe3e9 100644 (file)
@@ -1,20 +1,20 @@
-/*
- * Copyright 2016-2019,2021-2022 Soren Stoutner <soren@stoutner.com>.
+/* SPDX-License-Identifier: GPL-3.0-or-later
+ * SPDX-FileCopyrightText: 2016-2019, 2021-2022 Soren Stoutner <soren@stoutner.com>
  *
- * This file is part of Privacy Browser Android <https://www.stoutner.com/privacy-browser-android>.
+ * This file is part of Privacy Browser Android <https://www.stoutner.com/privacy-browser-android/>.
  *
- * Privacy Browser Android 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.
+ * This program 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 Android 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.
+ * This program 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 Android.  If not, see <http://www.gnu.org/licenses/>.
+ * You should have received a copy of the GNU General Public License along with
+ * this program.  If not, see <https://www.gnu.org/licenses/>.
  */
 
 package com.stoutner.privacybrowser.adapters
index 9a0d10907f9ade83780834bae5620d3c5616bc8a..ecd61d0bc55c103fa1930db89b8e45a1e92f3d7a 100644 (file)
@@ -1,26 +1,25 @@
-/*
- * Copyright © 2021-2023 Soren Stoutner <soren@stoutner.com>.
+/* SPDX-License-Identifier: GPL-3.0-or-later
+ * SPDX-FileCopyrightText: 2021-2023, 2025 Soren Stoutner <soren@stoutner.com>
  *
- * This file is part of Privacy Browser Android <https://www.stoutner.com/privacy-browser-android>.
+ * This file is part of Privacy Browser Android <https://www.stoutner.com/privacy-browser-android/>.
  *
- * Privacy Browser Android 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.
+ * This program 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 Android 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.
+ * This program 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 Android.  If not, see <http://www.gnu.org/licenses/>.
+ * You should have received a copy of the GNU General Public License along with
+ * this program.  If not, see <https://www.gnu.org/licenses/>.
  */
 
 package com.stoutner.privacybrowser.adapters
 
 import android.content.Context
-import android.net.Uri
 import android.text.SpannableStringBuilder
 import android.text.Spanned
 import android.text.style.ForegroundColorSpan
@@ -29,6 +28,7 @@ import android.view.View
 import android.view.ViewGroup
 import android.widget.TextView
 
+import androidx.core.net.toUri
 import androidx.viewpager.widget.PagerAdapter
 
 import com.stoutner.privacybrowser.R
@@ -99,7 +99,7 @@ class PinnedMismatchPagerAdapter(private val context: Context, private val layou
         val endDateLabel = context.getString(R.string.end_date)
 
         // Convert the URL to a URI.
-        val currentUri = Uri.parse(nestedScrollWebView.url)
+        val currentUri = nestedScrollWebView.url!!.toUri()
 
         // Get the current host from the URI.
         val domainName = currentUri.host
index 965158d7d4dab41d09fc3d5d502981f6ef7abaa6..47f6ee03aeb2695cd9da1f2e3d9b3ec703d73dc8 100644 (file)
@@ -1,20 +1,20 @@
-/*
- * Copyright 2018-2023 Soren Stoutner <soren@stoutner.com>.
+/* SPDX-License-Identifier: GPL-3.0-or-later
+ * SPDX-FileCopyrightText: 2018-2023 Soren Stoutner <soren@stoutner.com>
  *
- * This file is part of Privacy Browser Android <https://www.stoutner.com/privacy-browser-android>.
+ * This file is part of Privacy Browser Android <https://www.stoutner.com/privacy-browser-android/>.
  *
- * Privacy Browser Android 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.
+ * This program 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 Android 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.
+ * This program 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 Android.  If not, see <http://www.gnu.org/licenses/>.
+ * You should have received a copy of the GNU General Public License along with
+ * this program.  If not, see <https://www.gnu.org/licenses/>.
  */
 
 package com.stoutner.privacybrowser.adapters
index f43bca5a7a5f838febdab47b21af4e0b4f8fbe50..094b41bd6396c75b6436319b3b08110157a44ad5 100644 (file)
@@ -1,20 +1,20 @@
-/*
- * Copyright 2016-2023 Soren Stoutner <soren@stoutner.com>.
+/* SPDX-License-Identifier: GPL-3.0-or-later
+ * SPDX-FileCopyrightText: 2016-2023 Soren Stoutner <soren@stoutner.com>
  *
  * This file is part of Privacy Browser Android <https://www.stoutner.com/privacy-browser-android/>.
  *
- * Privacy Browser Android 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.
+ * This program 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 Android 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.
+ * This program 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 Android.  If not, see <http://www.gnu.org/licenses/>.
+ * You should have received a copy of the GNU General Public License along with
+ * this program.  If not, see <https://www.gnu.org/licenses/>.
  */
 
 package com.stoutner.privacybrowser.fragments
index e59a9c446ca94d56b9a55e13305493e5495e6ff1..15517992087c70960b2bce0ab80eb25e15d6c251 100644 (file)
@@ -1,20 +1,20 @@
-/*
- * Copyright 2017-2024 Soren Stoutner <soren@stoutner.com>.
+/* SPDX-License-Identifier: GPL-3.0-or-later
+ * SPDX-FileCopyrightText: 2017-2025 Soren Stoutner <soren@stoutner.com>
  *
  * This file is part of Privacy Browser Android <https://www.stoutner.com/privacy-browser-android/>.
  *
- * Privacy Browser Android 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.
+ * This program 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 Android 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.
+ * This program 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 Android.  If not, see <http://www.gnu.org/licenses/>.
+ * You should have received a copy of the GNU General Public License along with
+ * this program.  If not, see <https://www.gnu.org/licenses/>.
  */
 
 package com.stoutner.privacybrowser.fragments
@@ -47,6 +47,7 @@ import androidx.appcompat.widget.SwitchCompat
 import androidx.cardview.widget.CardView
 import androidx.core.content.ContextCompat.getColor
 import androidx.core.content.res.ResourcesCompat
+import androidx.core.view.isVisible
 import androidx.fragment.app.Fragment
 import androidx.preference.PreferenceManager
 
@@ -885,7 +886,7 @@ class DomainSettingsFragment : Fragment() {
             }
 
             // Set the status of the radio buttons and the card view backgrounds.
-            if (savedSslCardView.visibility == View.VISIBLE) {  // The saved SSL certificate is displayed.
+            if (savedSslCardView.isVisible) {  // The saved SSL certificate is displayed.
                 // Check the saved SSL certificate radio button.
                 savedSslCertificateRadioButton.isChecked = true
 
@@ -894,7 +895,7 @@ class DomainSettingsFragment : Fragment() {
 
                 // Darken the background of the current website SSL certificate linear layout.
                 currentWebsiteCertificateLinearLayout.setBackgroundResource(R.color.translucent_background)
-            } else if (currentSslCardView.visibility == View.VISIBLE) {  // The saved SSL certificate is hidden but the current website SSL certificate is visible.
+            } else if (currentSslCardView.isVisible) {  // The saved SSL certificate is hidden but the current website SSL certificate is visible.
                 // Check the current website SSL certificate radio button.
                 currentWebsiteCertificateRadioButton.isChecked = true
 
@@ -932,7 +933,7 @@ class DomainSettingsFragment : Fragment() {
             currentIpAddressesCardView.visibility = View.VISIBLE
 
             // Set the status of the radio buttons and the card view backgrounds.
-            if (savedIpAddressesCardView.visibility == View.VISIBLE) {  // The saved IP addresses are displayed.
+            if (savedIpAddressesCardView.isVisible) {  // The saved IP addresses are displayed.
                 // Check the saved IP addresses radio button.
                 savedIpAddressesRadioButton.isChecked = true
 
@@ -1358,7 +1359,7 @@ class DomainSettingsFragment : Fragment() {
                 }
 
                 // Set the status of the radio buttons.
-                if (savedSslCardView.visibility == View.VISIBLE) {  // The saved SSL certificate is displayed.
+                if (savedSslCardView.isVisible) {  // The saved SSL certificate is displayed.
                     // Check the saved SSL certificate radio button.
                     savedSslCertificateRadioButton.isChecked = true
 
@@ -1373,7 +1374,7 @@ class DomainSettingsFragment : Fragment() {
 
                     // Scroll to the current website SSL certificate card.
                     savedSslCardView.parent.requestChildFocus(savedSslCardView, savedSslCardView)
-                } else if (currentSslCardView.visibility == View.VISIBLE) {  // The saved SSL certificate is hidden but the current website SSL certificate is visible.
+                } else if (currentSslCardView.isVisible) {  // The saved SSL certificate is hidden but the current website SSL certificate is visible.
                     // Check the current website SSL certificate radio button.
                     currentWebsiteCertificateRadioButton.isChecked = true
 
@@ -1485,7 +1486,7 @@ class DomainSettingsFragment : Fragment() {
                 currentIpAddressesCardView.visibility = View.VISIBLE
 
                 // Set the status of the radio buttons.
-                if (savedIpAddressesCardView.visibility == View.VISIBLE) {  // The saved IP addresses are visible.
+                if (savedIpAddressesCardView.isVisible) {  // The saved IP addresses are visible.
                     // Check the saved IP addresses radio button.
                     savedIpAddressesRadioButton.isChecked = true
 
index 307480c843d808a5d9c0fa7024418dab77cc9f4a..7d6be7eb3c6b5b0b55e57f4beb4ecbebf459ae31 100644 (file)
@@ -1,20 +1,20 @@
-/*
- * Copyright 2017-2020, 2022, 2024 Soren Stoutner <soren@stoutner.com>.
+/* SPDX-License-Identifier: GPL-3.0-or-later
+ * SPDX-FileCopyrightText: 2017-2020, 2022, 2024 Soren Stoutner <soren@stoutner.com>
  *
  * This file is part of Privacy Browser Android <https://www.stoutner.com/privacy-browser-android/>.
  *
- * Privacy Browser Android 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.
+ * This program 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 Android 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.
+ * This program 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 Android.  If not, see <http://www.gnu.org/licenses/>.
+ * You should have received a copy of the GNU General Public License along with
+ * this program.  If not, see <https://www.gnu.org/licenses/>.
  */
 
 package com.stoutner.privacybrowser.fragments
index a8cc844880076ed1d93d450933f15afd25d53fb6..ebe59c30d1a7b88ef1e7c9287edf41ea2e741d70 100644 (file)
@@ -1,20 +1,20 @@
-/*
- * Copyright 2016-2024 Soren Stoutner <soren@stoutner.com>.
+/* SPDX-License-Identifier: GPL-3.0-or-later
+ * SPDX-FileCopyrightText: 2016-2024 Soren Stoutner <soren@stoutner.com>
  *
  * This file is part of Privacy Browser Android <https://www.stoutner.com/privacy-browser-android/>.
  *
- * Privacy Browser Android 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.
+ * This program 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 Android 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.
+ * This program 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 Android.  If not, see <http://www.gnu.org/licenses/>.
+ * You should have received a copy of the GNU General Public License along with
+ * this program.  If not, see <https://www.gnu.org/licenses/>.
  */
 
 package com.stoutner.privacybrowser.fragments
index a923ae79a48632429e51ee1b8c02441379ba6757..c379957a384dd0419ce4497df1f568dc2d593b3d 100644 (file)
@@ -1,5 +1,5 @@
 /* SPDX-License-Identifier: GPL-3.0-or-later
- * SPDX-FileCopyrightText: 2019-2020, 2022-2023 Soren Stoutner <soren@stoutner.com>
+ * SPDX-FileCopyrightText: 2019-2020, 2022-2023, 2025 Soren Stoutner <soren@stoutner.com>
  *
  * This file is part of Privacy Browser Android <https://www.stoutner.com/privacy-browser-android/>.
  *
@@ -143,12 +143,12 @@ class WebViewTabFragment : Fragment() {
                 val savedState = requireArguments().getBundle(SAVED_STATE)!!
                 val savedNestedScrollWebViewState = requireArguments().getBundle(SAVED_NESTED_SCROLL_WEBVIEW_STATE)!!
 
-                // Restore the nested scroll WebView state.
-                nestedScrollWebView.restoreNestedScrollWebViewState(savedNestedScrollWebViewState)
-
                 // Restore the WebView state.
                 nestedScrollWebView.restoreState(savedState)
 
+                // Restore the nested scroll WebView state.
+                nestedScrollWebView.restoreNestedScrollWebViewState(savedNestedScrollWebViewState)
+
                 // Initialize the WebView.
                 newTabListener.initializeWebView(nestedScrollWebView, 0, progressBar, "", true)
 
index a0b6e8fdf5f0345cf56aa1cca90a1207c622f9e2..d5fecca833b00fbbc9c3c5ece4a551d6763d8190 100644 (file)
@@ -1,24 +1,23 @@
-/*
- * Copyright © 2019,2021-2022 Soren Stoutner <soren@stoutner.com>.
+/* SPDX-License-Identifier: GPL-3.0-or-later
+ * SPDX-FileCopyrightText: 2019, 2021-2022 Soren Stoutner <soren@stoutner.com>
  *
- * This file is part of Privacy Browser Android <https://www.stoutner.com/privacy-browser-android>.
+ * This file is part of Privacy Browser Android <https://www.stoutner.com/privacy-browser-android/>.
  *
- * Privacy Browser Android 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.
+ * This program 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 Android 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.
+ * This program 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 Android.  If not, see <http://www.gnu.org/licenses/>.
+ * You should have received a copy of the GNU General Public License along with
+ * this program.  If not, see <https://www.gnu.org/licenses/>.
  *
  *
- *
- * This file is a modified version of <https://android.googlesource.com/platform/packages/apps/Camera/+/master/src/com/android/camera/ui/CheckedLinearLayout.java>.
+ * * This file is a modified version of <https://android.googlesource.com/platform/packages/apps/Camera/+/master/src/com/android/camera/ui/CheckedLinearLayout.java>.
  *
  * The original licensing information is below.
  *
index f2ec71d59c8eb59415889523e1cabdd9c4a0981b..ad2d51e6969b0a27e2d4d450229e147e8d9a7e17 100644 (file)
@@ -1,20 +1,20 @@
-/*
- * Copyright 2019-2024 Soren Stoutner <soren@stoutner.com>.
+/* SPDX-License-Identifier: GPL-3.0-or-later
+ * SPDX-FileCopyrightText: 2019-2025 Soren Stoutner <soren@stoutner.com>
  *
  * This file is part of Privacy Browser Android <https://www.stoutner.com/privacy-browser-android/>.
  *
- * Privacy Browser Android 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.
+ * This program 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 Android 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.
+ * This program 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 Android.  If not, see <https://www.gnu.org/licenses/>.
+ * You should have received a copy of the GNU General Public License along with
+ * this program.  If not, see <https://www.gnu.org/licenses/>.
  */
 
 package com.stoutner.privacybrowser.views
@@ -31,6 +31,7 @@ import android.webkit.HttpAuthHandler
 import android.webkit.SslErrorHandler
 import android.webkit.WebView
 
+import androidx.core.graphics.scale
 import androidx.core.view.NestedScrollingChild2
 import androidx.core.view.NestedScrollingChildHelper
 import androidx.core.view.ViewCompat
@@ -53,35 +54,36 @@ const val ULTRAPRIVACY = 6
 const val THIRD_PARTY_REQUESTS = 7
 
 // Define the private class constants.
-private const val ACCEPT_COOKIES = "A"
-private const val BLOCK_ALL_THIRD_PARTY_REQUESTS = "B"
-private const val CURRENT_DOMAIN_NAME = "C"
-private const val CURRENT_URL = "D"
-private const val DOM_STORAGE_ENABLED = "E"
-private const val DOMAIN_SETTINGS_APPLIED = "F"
-private const val DOMAIN_SETTINGS_DATABASE_ID = "G"
-private const val EASYLIST_ENABLED = "H"
-private const val EASYPRIVACY_ENABLED = "I"
-private const val FANBOYS_ANNOYANCE_LIST_ENABLED = "J"
-private const val FANBOYS_SOCIAL_BLOCKING_LIST_ENABLED = "K"
-private const val FONT_SIZE = "L"
-private const val HAS_PINNED_SSL_CERTIFICATE = "M"
-private const val IGNORE_PINNED_DOMAIN_INFORMATION = "N"
-private const val JAVASCRIPT_ENABLED = "O"
-private const val PINNED_IP_ADDRESSES = "P"
-private const val PINNED_SSL_END_DATE = "Q"
-private const val PINNED_SSL_ISSUED_BY_CNAME = "R"
-private const val PINNED_SSL_ISSUED_BY_ONAME = "S"
-private const val PINNED_SSL_ISSUED_BY_UNAME = "T"
-private const val PINNED_SSL_ISSUED_TO_CNAME = "U"
-private const val PINNED_SSL_ISSUED_TO_ONAME = "V"
-private const val PINNED_SSL_ISSUED_TO_UNAME = "W"
-private const val PINNED_SSL_START_DATE = "X"
-private const val SWIPE_TO_REFRESH = "Y"
-private const val ULTRALIST_ENABLED = "Z"
-private const val ULTRAPRIVACY_ENABLED = "AA"
-private const val USER_AGENT = "AB"
-private const val WIDE_VIEWPORT = "AC"
+private const val ACCEPT_COOKIES = "accept_cookies"
+private const val BLOCK_ALL_THIRD_PARTY_REQUESTS = "block_all_third_party_requests"
+private const val CURRENT_DOMAIN_NAME = "current_domain_name"
+private const val CURRENT_URL = "current_url"
+private const val DOM_STORAGE_ENABLED = "dom_storage_enabled"
+private const val DOMAIN_SETTINGS_APPLIED = "domain_settings_applied"
+private const val DOMAIN_SETTINGS_DATABASE_ID = "domain_settings_database_id"
+private const val DISPLAY_IMAGES = "display_images"
+private const val EASYLIST_ENABLED = "easylist_enabled"
+private const val EASYPRIVACY_ENABLED = "easyprivacy_enabled"
+private const val FANBOYS_ANNOYANCE_LIST_ENABLED = "fanboys_annoyance_list_enabled"
+private const val FANBOYS_SOCIAL_BLOCKING_LIST_ENABLED = "fanboys_social_blocking_list_enabled"
+private const val FONT_SIZE = "font_size"
+private const val HAS_PINNED_SSL_CERTIFICATE = "has_pinned_ssl_certificate"
+private const val IGNORE_PINNED_DOMAIN_INFORMATION = "ignore_pinned_domain_information"
+private const val JAVASCRIPT_ENABLED = "javascript_enabled"
+private const val PINNED_IP_ADDRESSES = "pinned_ip_addresses"
+private const val PINNED_SSL_END_DATE = "pinned_ssl_end_date"
+private const val PINNED_SSL_ISSUED_BY_CNAME = "pinned_ssl_issued_by_cname"
+private const val PINNED_SSL_ISSUED_BY_ONAME = "pinned_ssl_issued_by_oname"
+private const val PINNED_SSL_ISSUED_BY_UNAME = "pinned_ssl_issued_by_uname"
+private const val PINNED_SSL_ISSUED_TO_CNAME = "pinned_ssl_issued_to_cname"
+private const val PINNED_SSL_ISSUED_TO_ONAME = "pinned_ssl_issued_to_oname"
+private const val PINNED_SSL_ISSUED_TO_UNAME = "pinned_ssl_issued_to_uname"
+private const val PINNED_SSL_START_DATE = "pinned_ssl_start_date"
+private const val SWIPE_TO_REFRESH = "swipe_to_refresh"
+private const val ULTRALIST_ENABLED = "ultralist_enabled"
+private const val ULTRAPRIVACY_ENABLED = "ultraprivacy_enabled"
+private const val USER_AGENT = "user_agent"
+private const val WIDE_VIEWPORT = "wide_viewport"
 
 // NestedScrollWebView extends WebView to handle nested scrolls (scrolling the app bar off the screen).  It also stores extra information about the state of the WebView used by Privacy Browser.
 class NestedScrollWebView @JvmOverloads constructor(context: Context, attributeSet: AttributeSet? = null, defaultStyle: Int = android.R.attr.webViewStyle) : WebView(context, attributeSet, defaultStyle),
@@ -158,7 +160,7 @@ class NestedScrollWebView @JvmOverloads constructor(context: Context, attributeS
 
         // Scale the favorite icon bitmap down if it is larger than 128 in either direction.  Filtering uses bilinear interpolation.
         favoriteIcon = if (icon.height > 128 || icon.width > 128)  // Scale the icon before storing it.
-            Bitmap.createScaledBitmap(icon, 128, 128, true)
+            icon.scale(128, 128)
         else  // Store the icon as presented.
             icon
     }
@@ -394,6 +396,7 @@ class NestedScrollWebView @JvmOverloads constructor(context: Context, attributeS
         savedState.putBoolean(DOM_STORAGE_ENABLED, this.settings.domStorageEnabled)
         savedState.putBoolean(DOMAIN_SETTINGS_APPLIED, domainSettingsApplied)
         savedState.putInt(DOMAIN_SETTINGS_DATABASE_ID, domainSettingsDatabaseId)
+        savedState.putBoolean(DISPLAY_IMAGES, settings.loadsImagesAutomatically)
         savedState.putBoolean(EASYLIST_ENABLED, easyListEnabled)
         savedState.putBoolean(EASYPRIVACY_ENABLED, easyPrivacyEnabled)
         savedState.putBoolean(FANBOYS_ANNOYANCE_LIST_ENABLED, fanboysAnnoyanceListEnabled)
@@ -431,6 +434,7 @@ class NestedScrollWebView @JvmOverloads constructor(context: Context, attributeS
         this.settings.domStorageEnabled = savedState.getBoolean(DOM_STORAGE_ENABLED)
         domainSettingsApplied = savedState.getBoolean(DOMAIN_SETTINGS_APPLIED)
         domainSettingsDatabaseId = savedState.getInt(DOMAIN_SETTINGS_DATABASE_ID)
+        settings.loadsImagesAutomatically = savedState.getBoolean(DISPLAY_IMAGES)
         easyListEnabled = savedState.getBoolean(EASYLIST_ENABLED)
         easyPrivacyEnabled = savedState.getBoolean(EASYPRIVACY_ENABLED)
         fanboysAnnoyanceListEnabled = savedState.getBoolean(FANBOYS_ANNOYANCE_LIST_ENABLED)
index d6f159a1e49384d9797e63751f614aa68cf36a94..cf416d16615bf3cf77979a6345f5a8655ad80353 100644 (file)
@@ -1,20 +1,20 @@
-/*
- * Copyright © 2017,2019,2021-2022 Soren Stoutner <soren@stoutner.com>.
+/* SPDX-License-Identifier: GPL-3.0-or-later
+ * SPDX-FileCopyrightText: 2017, 2019, 2021-2022 Soren Stoutner <soren@stoutner.com>
  *
- * This file is part of Privacy Browser Android <https://www.stoutner.com/privacy-browser-android>.
+ * This file is part of Privacy Browser Android <https://www.stoutner.com/privacy-browser-android/>.
  *
- * Privacy Browser Android 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.
+ * This program 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 Android 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.
+ * This program 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 Android.  If not, see <http://www.gnu.org/licenses/>.
+ * You should have received a copy of the GNU General Public License along with
+ * this program.  If not, see <https://www.gnu.org/licenses/>.
  */
 
 package com.stoutner.privacybrowser.views
index cb161dea4301226f81bdc65ab20e5b06f0f65873..7f1bf3087bd9369c1f877cd3ee22dd94aac47f52 100644 (file)
@@ -26,7 +26,7 @@ buildscript {
     }
 
     dependencies {
-        classpath 'com.android.tools.build:gradle:8.10.0'
+        classpath 'com.android.tools.build:gradle:8.10.1'
         classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:2.1.0"
 
         // NOTE: Do not place your application dependencies here; they belong