From: Soren Stoutner Date: Fri, 30 May 2025 22:08:42 +0000 (-0700) Subject: Restore display image status on reload. https://redmine.stoutner.com/issues/1274 X-Git-Url: https://gitweb.stoutner.com/?a=commitdiff_plain;h=59401f4257c2dab39f2962a3954eff27565e68c6;p=PrivacyBrowserAndroid.git Restore display image status on reload. https://redmine.stoutner.com/issues/1274 --- diff --git a/app/src/main/java/com/stoutner/privacybrowser/adapters/AboutStateAdapter.kt b/app/src/main/java/com/stoutner/privacybrowser/adapters/AboutStateAdapter.kt index 9e110a59..6fe1969d 100644 --- a/app/src/main/java/com/stoutner/privacybrowser/adapters/AboutStateAdapter.kt +++ b/app/src/main/java/com/stoutner/privacybrowser/adapters/AboutStateAdapter.kt @@ -1,20 +1,20 @@ -/* - * Copyright © 2016-2023 Soren Stoutner . +/* SPDX-License-Identifier: GPL-3.0-or-later + * SPDX-FileCopyrightText: 2016-2023 Soren Stoutner * - * This file is part of Privacy Browser Android . + * This file is part of 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 . + * You should have received a copy of the GNU General Public License along with + * this program. If not, see . */ package com.stoutner.privacybrowser.adapters diff --git a/app/src/main/java/com/stoutner/privacybrowser/adapters/GuideStateAdapter.kt b/app/src/main/java/com/stoutner/privacybrowser/adapters/GuideStateAdapter.kt index 50a1162c..3f4fda1f 100644 --- a/app/src/main/java/com/stoutner/privacybrowser/adapters/GuideStateAdapter.kt +++ b/app/src/main/java/com/stoutner/privacybrowser/adapters/GuideStateAdapter.kt @@ -1,20 +1,20 @@ -/* - * Copyright 2016-2020,2022-2023 Soren Stoutner . +/* SPDX-License-Identifier: GPL-3.0-or-later + * SPDX-FileCopyrightText: 2016-2020, 2022-2023 Soren Stoutner * - * This file is part of Privacy Browser Android . + * This file is part of 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 . + * You should have received a copy of the GNU General Public License along with + * this program. If not, see . */ package com.stoutner.privacybrowser.adapters diff --git a/app/src/main/java/com/stoutner/privacybrowser/adapters/HistoryArrayAdapter.kt b/app/src/main/java/com/stoutner/privacybrowser/adapters/HistoryArrayAdapter.kt index 3c746957..37aa48f2 100644 --- a/app/src/main/java/com/stoutner/privacybrowser/adapters/HistoryArrayAdapter.kt +++ b/app/src/main/java/com/stoutner/privacybrowser/adapters/HistoryArrayAdapter.kt @@ -1,20 +1,20 @@ -/* - * Copyright 2016-2019,2021-2022 Soren Stoutner . +/* SPDX-License-Identifier: GPL-3.0-or-later + * SPDX-FileCopyrightText: 2016-2019, 2021-2022 Soren Stoutner * - * This file is part of Privacy Browser Android . + * This file is part of 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 . + * You should have received a copy of the GNU General Public License along with + * this program. If not, see . */ package com.stoutner.privacybrowser.adapters diff --git a/app/src/main/java/com/stoutner/privacybrowser/adapters/PinnedMismatchPagerAdapter.kt b/app/src/main/java/com/stoutner/privacybrowser/adapters/PinnedMismatchPagerAdapter.kt index 9a0d1090..ecd61d0b 100644 --- a/app/src/main/java/com/stoutner/privacybrowser/adapters/PinnedMismatchPagerAdapter.kt +++ b/app/src/main/java/com/stoutner/privacybrowser/adapters/PinnedMismatchPagerAdapter.kt @@ -1,26 +1,25 @@ -/* - * Copyright © 2021-2023 Soren Stoutner . +/* SPDX-License-Identifier: GPL-3.0-or-later + * SPDX-FileCopyrightText: 2021-2023, 2025 Soren Stoutner * - * This file is part of Privacy Browser Android . + * This file is part of 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 . + * You should have received a copy of the GNU General Public License along with + * this program. If not, see . */ 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 diff --git a/app/src/main/java/com/stoutner/privacybrowser/adapters/RequestsArrayAdapter.kt b/app/src/main/java/com/stoutner/privacybrowser/adapters/RequestsArrayAdapter.kt index 965158d7..47f6ee03 100644 --- a/app/src/main/java/com/stoutner/privacybrowser/adapters/RequestsArrayAdapter.kt +++ b/app/src/main/java/com/stoutner/privacybrowser/adapters/RequestsArrayAdapter.kt @@ -1,20 +1,20 @@ -/* - * Copyright 2018-2023 Soren Stoutner . +/* SPDX-License-Identifier: GPL-3.0-or-later + * SPDX-FileCopyrightText: 2018-2023 Soren Stoutner * - * This file is part of Privacy Browser Android . + * This file is part of 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 . + * You should have received a copy of the GNU General Public License along with + * this program. If not, see . */ package com.stoutner.privacybrowser.adapters 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 f43bca5a..094b41bd 100644 --- a/app/src/main/java/com/stoutner/privacybrowser/fragments/AboutWebViewFragment.kt +++ b/app/src/main/java/com/stoutner/privacybrowser/fragments/AboutWebViewFragment.kt @@ -1,20 +1,20 @@ -/* - * Copyright 2016-2023 Soren Stoutner . +/* SPDX-License-Identifier: GPL-3.0-or-later + * SPDX-FileCopyrightText: 2016-2023 Soren Stoutner * * This file is part of 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 . + * You should have received a copy of the GNU General Public License along with + * this program. If not, see . */ package com.stoutner.privacybrowser.fragments diff --git a/app/src/main/java/com/stoutner/privacybrowser/fragments/DomainSettingsFragment.kt b/app/src/main/java/com/stoutner/privacybrowser/fragments/DomainSettingsFragment.kt index e59a9c44..15517992 100644 --- a/app/src/main/java/com/stoutner/privacybrowser/fragments/DomainSettingsFragment.kt +++ b/app/src/main/java/com/stoutner/privacybrowser/fragments/DomainSettingsFragment.kt @@ -1,20 +1,20 @@ -/* - * Copyright 2017-2024 Soren Stoutner . +/* SPDX-License-Identifier: GPL-3.0-or-later + * SPDX-FileCopyrightText: 2017-2025 Soren Stoutner * * This file is part of 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 . + * You should have received a copy of the GNU General Public License along with + * this program. If not, see . */ 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 diff --git a/app/src/main/java/com/stoutner/privacybrowser/fragments/DomainsListFragment.kt b/app/src/main/java/com/stoutner/privacybrowser/fragments/DomainsListFragment.kt index 307480c8..7d6be7eb 100644 --- a/app/src/main/java/com/stoutner/privacybrowser/fragments/DomainsListFragment.kt +++ b/app/src/main/java/com/stoutner/privacybrowser/fragments/DomainsListFragment.kt @@ -1,20 +1,20 @@ -/* - * Copyright 2017-2020, 2022, 2024 Soren Stoutner . +/* SPDX-License-Identifier: GPL-3.0-or-later + * SPDX-FileCopyrightText: 2017-2020, 2022, 2024 Soren Stoutner * * This file is part of 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 . + * You should have received a copy of the GNU General Public License along with + * this program. If not, see . */ package com.stoutner.privacybrowser.fragments 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 a8cc8448..ebe59c30 100644 --- a/app/src/main/java/com/stoutner/privacybrowser/fragments/GuideWebViewFragment.kt +++ b/app/src/main/java/com/stoutner/privacybrowser/fragments/GuideWebViewFragment.kt @@ -1,20 +1,20 @@ -/* - * Copyright 2016-2024 Soren Stoutner . +/* SPDX-License-Identifier: GPL-3.0-or-later + * SPDX-FileCopyrightText: 2016-2024 Soren Stoutner * * This file is part of 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 . + * You should have received a copy of the GNU General Public License along with + * this program. If not, see . */ package com.stoutner.privacybrowser.fragments diff --git a/app/src/main/java/com/stoutner/privacybrowser/fragments/WebViewTabFragment.kt b/app/src/main/java/com/stoutner/privacybrowser/fragments/WebViewTabFragment.kt index a923ae79..c379957a 100644 --- a/app/src/main/java/com/stoutner/privacybrowser/fragments/WebViewTabFragment.kt +++ b/app/src/main/java/com/stoutner/privacybrowser/fragments/WebViewTabFragment.kt @@ -1,5 +1,5 @@ /* SPDX-License-Identifier: GPL-3.0-or-later - * SPDX-FileCopyrightText: 2019-2020, 2022-2023 Soren Stoutner + * SPDX-FileCopyrightText: 2019-2020, 2022-2023, 2025 Soren Stoutner * * This file is part of 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) diff --git a/app/src/main/java/com/stoutner/privacybrowser/views/CheckedLinearLayout.kt b/app/src/main/java/com/stoutner/privacybrowser/views/CheckedLinearLayout.kt index a0b6e8fd..d5fecca8 100644 --- a/app/src/main/java/com/stoutner/privacybrowser/views/CheckedLinearLayout.kt +++ b/app/src/main/java/com/stoutner/privacybrowser/views/CheckedLinearLayout.kt @@ -1,24 +1,23 @@ -/* - * Copyright © 2019,2021-2022 Soren Stoutner . +/* SPDX-License-Identifier: GPL-3.0-or-later + * SPDX-FileCopyrightText: 2019, 2021-2022 Soren Stoutner * - * This file is part of Privacy Browser Android . + * This file is part of 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 . + * You should have received a copy of the GNU General Public License along with + * this program. If not, see . * * - * - * This file is a modified version of . + * * This file is a modified version of . * * The original licensing information is below. * diff --git a/app/src/main/java/com/stoutner/privacybrowser/views/NestedScrollWebView.kt b/app/src/main/java/com/stoutner/privacybrowser/views/NestedScrollWebView.kt index f2ec71d5..ad2d51e6 100644 --- a/app/src/main/java/com/stoutner/privacybrowser/views/NestedScrollWebView.kt +++ b/app/src/main/java/com/stoutner/privacybrowser/views/NestedScrollWebView.kt @@ -1,20 +1,20 @@ -/* - * Copyright 2019-2024 Soren Stoutner . +/* SPDX-License-Identifier: GPL-3.0-or-later + * SPDX-FileCopyrightText: 2019-2025 Soren Stoutner * * This file is part of 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 . + * You should have received a copy of the GNU General Public License along with + * this program. If not, see . */ 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) diff --git a/app/src/main/java/com/stoutner/privacybrowser/views/WrapVerticalContentViewPager.kt b/app/src/main/java/com/stoutner/privacybrowser/views/WrapVerticalContentViewPager.kt index d6f159a1..cf416d16 100644 --- a/app/src/main/java/com/stoutner/privacybrowser/views/WrapVerticalContentViewPager.kt +++ b/app/src/main/java/com/stoutner/privacybrowser/views/WrapVerticalContentViewPager.kt @@ -1,20 +1,20 @@ -/* - * Copyright © 2017,2019,2021-2022 Soren Stoutner . +/* SPDX-License-Identifier: GPL-3.0-or-later + * SPDX-FileCopyrightText: 2017, 2019, 2021-2022 Soren Stoutner * - * This file is part of Privacy Browser Android . + * This file is part of 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 . + * You should have received a copy of the GNU General Public License along with + * this program. If not, see . */ package com.stoutner.privacybrowser.views diff --git a/build.gradle b/build.gradle index cb161dea..7f1bf308 100644 --- a/build.gradle +++ b/build.gradle @@ -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