- // Get the favorite icon.
- val favoriteIconBitmap = nestedScrollWebView.getFavoriteIcon()
-
- // Get the default favorite icon drawable. `ContextCompat` must be used until API >= 21.
- val defaultFavoriteIconDrawable = ContextCompat.getDrawable(requireContext(), R.drawable.world)
-
- // Cast the favorite icon drawable to a bitmap drawable.
- val defaultFavoriteIconBitmapDrawable = (defaultFavoriteIconDrawable as BitmapDrawable)
-
- // Store the default icon bitmap.
- val defaultFavoriteIconBitmap = defaultFavoriteIconBitmapDrawable.bitmap
-
- // Set the favorite icon as the dialog icon if it exists.
- if (favoriteIconBitmap.sameAs(defaultFavoriteIconBitmap)) { // There is no website favorite icon.