// Get the favorite icon image view from the tab.
val tabFavoriteIconImageView = tabView.findViewById<ImageView>(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)
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 {