From: Soren Stoutner Date: Wed, 6 Mar 2024 18:45:49 +0000 (-0700) Subject: Update the stored favorite icon when navigating history. https://redmine.stoutner... X-Git-Tag: v3.18~10 X-Git-Url: https://gitweb.stoutner.com/?a=commitdiff_plain;h=a04701c277d0dfbc0d6f00fc578918589166589a;p=PrivacyBrowserAndroid.git Update the stored favorite icon when navigating history. https://redmine.stoutner.com/issues/1166 --- 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 b6086b46..5036e86a 100644 --- a/app/src/main/java/com/stoutner/privacybrowser/activities/MainWebViewActivity.kt +++ b/app/src/main/java/com/stoutner/privacybrowser/activities/MainWebViewActivity.kt @@ -5899,11 +5899,14 @@ class MainWebViewActivity : AppCompatActivity(), CreateBookmarkDialog.CreateBook // Get the favorite icon image view from the tab. val tabFavoriteIconImageView = tabView.findViewById(R.id.favorite_icon_imageview) - // Set the previous favorite icon. + // Store the previous favorite icon. if (previousFavoriteIcon == null) - tabFavoriteIconImageView.setImageBitmap(defaultFavoriteIconBitmap) + currentWebView!!.setFavoriteIcon(defaultFavoriteIconBitmap) else - tabFavoriteIconImageView.setImageBitmap(Bitmap.createScaledBitmap(previousFavoriteIcon, 64, 64, true)) + currentWebView!!.setFavoriteIcon(previousFavoriteIcon) + + // Display the previous favorite icon in the tab. + tabFavoriteIconImageView.setImageBitmap(Bitmap.createScaledBitmap(currentWebView!!.getFavoriteIcon(), 64, 64, true)) // Load the history entry. currentWebView!!.goBackOrForward(steps) 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 45133be5..683c7aef 100644 --- a/app/src/main/java/com/stoutner/privacybrowser/views/NestedScrollWebView.kt +++ b/app/src/main/java/com/stoutner/privacybrowser/views/NestedScrollWebView.kt @@ -157,12 +157,10 @@ class NestedScrollWebView @JvmOverloads constructor(context: Context, attributeS favoriteIconHeight = icon.height // Scale the favorite icon bitmap down if it is larger than 256 x 256. Filtering uses bilinear interpolation. - favoriteIcon = if (icon.height > 256 || icon.width > 256) { + favoriteIcon = if (icon.height > 256 || icon.width > 256) // Scale the icon before storing it. Bitmap.createScaledBitmap(icon, 256, 256, true) - } else { - // Store the icon as presented. + else // Store the icon as presented. icon - } } fun getFavoriteIcon(): Bitmap {