X-Git-Url: https://gitweb.stoutner.com/?a=blobdiff_plain;f=app%2Fsrc%2Fmain%2Fjava%2Fcom%2Fstoutner%2Fprivacybrowser%2Fadapters%2FPinnedMismatchPagerAdapter.kt;h=9a0d10907f9ade83780834bae5620d3c5616bc8a;hb=HEAD;hp=8953d8545b53d493e5be160c49139c761530964f;hpb=38919c77d15eeacbee96ab337afc62b30ddc74ca;p=PrivacyBrowserAndroid.git 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 8953d854..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-2022 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 @@ -63,10 +63,10 @@ class PinnedMismatchPagerAdapter(private val context: Context, private val layou // Setup each tab. override fun instantiateItem(container: ViewGroup, tabNumber: Int): Any { // Get the current position of this WebView fragment. - val webViewPosition = MainWebViewActivity.webViewPagerAdapter.getPositionForId(webViewFragmentId) + val webViewPosition = MainWebViewActivity.webViewStateAdapter!!.getPositionForId(webViewFragmentId) // Get the WebView tab fragment. - val webViewTabFragment = MainWebViewActivity.webViewPagerAdapter.getPageFragment(webViewPosition) + val webViewTabFragment = MainWebViewActivity.webViewStateAdapter!!.getPageFragment(webViewPosition) // Get the WebView fragment view. val webViewFragmentView = webViewTabFragment.requireView() @@ -90,16 +90,16 @@ class PinnedMismatchPagerAdapter(private val context: Context, private val layou val endDateTextView = tabLayout.findViewById(R.id.end_date) // Setup the labels. - val domainNameLabel = context.getString(R.string.domain_label) + " " - val ipAddressesLabel = context.getString(R.string.ip_addresses) + " " - val cNameLabel = context.getString(R.string.common_name) + " " - val oNameLabel = context.getString(R.string.organization) + " " - val uNameLabel = context.getString(R.string.organizational_unit) + " " - val startDateLabel = context.getString(R.string.start_date) + " " - val endDateLabel = context.getString(R.string.end_date) + " " + val domainNameLabel = context.getString(R.string.domain_label) + val ipAddressesLabel = context.getString(R.string.ip_addresses) + val cNameLabel = context.getString(R.string.common_name) + val oNameLabel = context.getString(R.string.organization) + val uNameLabel = context.getString(R.string.organizational_unit) + val startDateLabel = context.getString(R.string.start_date) + 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 @@ -187,7 +187,7 @@ class PinnedMismatchPagerAdapter(private val context: Context, private val layou } // Create the color spans. - val blueColorSpan = ForegroundColorSpan(context.getColor(R.color.blue_text)) + val blueColorSpan = ForegroundColorSpan(context.getColor(R.color.alt_blue_text)) val redColorSpan = ForegroundColorSpan(context.getColor(R.color.red_text)) // Set the domain name to be blue. @@ -271,4 +271,4 @@ class PinnedMismatchPagerAdapter(private val context: Context, private val layou // Return the tab layout. return tabLayout } -} \ No newline at end of file +}