- // Get the current web back forward list.
- val webBackForwardList = currentWebView!!.copyBackForwardList()
-
- // 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<ImageView>(R.id.favorite_icon_imageview)
-
- // Set the previous favorite icon if it isn't null.
- if (previousFavoriteIcon != null)
- tabFavoriteIconImageView.setImageBitmap(Bitmap.createScaledBitmap(previousFavoriteIcon, 64, 64, true))
-
- // Go back.
- currentWebView!!.goBack()
-
- // Update the URL edit text after a delay.
- updateUrlEditTextAfterDelay()