From: Soren Stoutner Date: Wed, 29 Nov 2023 20:08:16 +0000 (-0700) Subject: Update favorite icons when navigating history. https://redmine.stoutner.com/issues/747 X-Git-Tag: v3.17~12 X-Git-Url: https://gitweb.stoutner.com/?a=commitdiff_plain;h=bc29bcf998135032c958dc1926f70f3749173f3e;p=PrivacyBrowserAndroid.git Update favorite icons when navigating history. https://redmine.stoutner.com/issues/747 --- diff --git a/app/src/main/java/com/stoutner/privacybrowser/activities/MainWebViewActivity.kt b/app/src/main/java/com/stoutner/privacybrowser/activities/MainWebViewActivity.kt index 44304593..7dd983a0 100644 --- a/app/src/main/java/com/stoutner/privacybrowser/activities/MainWebViewActivity.kt +++ b/app/src/main/java/com/stoutner/privacybrowser/activities/MainWebViewActivity.kt @@ -695,12 +695,25 @@ class MainWebViewActivity : AppCompatActivity(), CreateBookmarkDialog.CreateBook // Get the current web back forward list. val webBackForwardList = currentWebView!!.copyBackForwardList() - // Get the previous entry URL. + // Get the previous entry data. val previousUrl = webBackForwardList.getItemAtIndex(webBackForwardList.currentIndex - 1).url + val previousFavoriteIcon = webBackForwardList.getItemAtIndex(webBackForwardList.currentIndex - 1).favicon!! // Apply the domain settings. applyDomainSettings(currentWebView!!, previousUrl, resetTab = false, reloadWebsite = false, loadUrl = false) + // Get the current tab. + val tab = tabLayout.getTabAt(tabLayout.selectedTabPosition)!! + + // Get the custom view from the tab. + val tabView = tab.customView!! + + // Get the favorite icon image view from the tab. + val tabFavoriteIconImageView = tabView.findViewById(R.id.favorite_icon_imageview) + + // Set the previous favorite icon. + tabFavoriteIconImageView.setImageBitmap(Bitmap.createScaledBitmap(previousFavoriteIcon, 64, 64, true)) + // Go back. currentWebView!!.goBack() @@ -2334,12 +2347,25 @@ class MainWebViewActivity : AppCompatActivity(), CreateBookmarkDialog.CreateBook // Get the current web back forward list. val webBackForwardList = currentWebView!!.copyBackForwardList() - // Get the previous entry URL. + // Get the previous entry data. val previousUrl = webBackForwardList.getItemAtIndex(webBackForwardList.currentIndex - 1).url + val previousFavoriteIcon = webBackForwardList.getItemAtIndex(webBackForwardList.currentIndex - 1).favicon!! // Apply the domain settings. applyDomainSettings(currentWebView!!, previousUrl, resetTab = false, reloadWebsite = false, loadUrl = false) + // Get the current tab. + val tab = tabLayout.getTabAt(tabLayout.selectedTabPosition)!! + + // Get the custom view from the tab. + val tabView = tab.customView!! + + // Get the favorite icon image view from the tab. + val tabFavoriteIconImageView = tabView.findViewById(R.id.favorite_icon_imageview) + + // Set the previous favorite icon. + tabFavoriteIconImageView.setImageBitmap(Bitmap.createScaledBitmap(previousFavoriteIcon, 64, 64, true)) + // Load the previous website in the history. currentWebView!!.goBack() @@ -2354,12 +2380,25 @@ class MainWebViewActivity : AppCompatActivity(), CreateBookmarkDialog.CreateBook // Get the current web back forward list. val webBackForwardList = currentWebView!!.copyBackForwardList() - // Get the next entry URL. + // Get the next entry data. val nextUrl = webBackForwardList.getItemAtIndex(webBackForwardList.currentIndex + 1).url + val nextFavoriteIcon = webBackForwardList.getItemAtIndex(webBackForwardList.currentIndex + 1).favicon!! // Apply the domain settings. applyDomainSettings(currentWebView!!, nextUrl, resetTab = false, reloadWebsite = false, loadUrl = false) + // Get the current tab. + val tab = tabLayout.getTabAt(tabLayout.selectedTabPosition)!! + + // Get the custom view from the tab. + val tabView = tab.customView!! + + // Get the favorite icon image view from the tab. + val tabFavoriteIconImageView = tabView.findViewById(R.id.favorite_icon_imageview) + + // Set the next favorite icon. + tabFavoriteIconImageView.setImageBitmap(Bitmap.createScaledBitmap(nextFavoriteIcon, 64, 64, true)) + // Load the next website in the history. currentWebView!!.goForward() diff --git a/app/src/main/res/values-de/strings.xml b/app/src/main/res/values-de/strings.xml index cabfeb47..09f25b8a 100644 --- a/app/src/main/res/values-de/strings.xml +++ b/app/src/main/res/values-de/strings.xml @@ -635,6 +635,8 @@ Doppel-Tippen, um zwischen normalem und Vollbild-Modus umzuschalten. App-Leiste verstecken Versteckt die App-Leiste, die die URL enthält. + Unter Aussparungen anzeigen + Zeigt die Internetseite unterhalb von Ausschnitten wie etwa Kamera-Einbuchtungen. Das Ändern dieser Einstellung startet Privacy Browser neu. Alles löschen Löscht Cookies, DOM-Storage, Formular-Daten, das Logcat Systemlogbuch und den WebView-Cache, sowie die gesamten “app_webview”- und “cache”-Ordner. diff --git a/app/src/main/res/values-es/strings.xml b/app/src/main/res/values-es/strings.xml index 6fc87050..d1aa1313 100644 --- a/app/src/main/res/values-es/strings.xml +++ b/app/src/main/res/values-es/strings.xml @@ -638,6 +638,8 @@ Doble toque para alternar a modo de navegación de pantalla completa. Ocultar la barra de aplicaciones Ocultar la barra de aplicaciones que contiene la URL. + Mostrar bajo los recortes + Mostrar el sitio web bajo los recortes, como las muescas de la cámara. Al cambiar esta configuración se reiniciará Navegador Privado. Borrar todo Borra cookies, almacenamiento DOM, datos de formulario, el logcat y la caché de WebView. diff --git a/app/src/main/res/values-it/strings.xml b/app/src/main/res/values-it/strings.xml index 5dba259f..50e4103d 100644 --- a/app/src/main/res/values-it/strings.xml +++ b/app/src/main/res/values-it/strings.xml @@ -638,6 +638,8 @@ Toccare due volte per avviare la navigazione a schermo intero. Nascondi la barra dell\'applicazione Nasconde la barra che contiene l\'URL. + Visualizza sotto i ritagli dello schermo + Visualizza il sito web sotto i ritagli dello schermo come quello della fotocamera. La modifica di questa impostazione provoca il riavvio di Privacy Browser. Elimina tutto Cancella i cookies, il DOM storage, i dati dei moduli, il logcat e la cache di WebView. Cancella completamente le cartelle “app_webview” e “cache”.