|
@@ -152,16 +152,19 @@ class WebViewActivity : BaseActivity() {
|
|
|
return true
|
|
|
}
|
|
|
|
|
|
- override fun onPrepareOptionsMenu(menu: Menu?): Boolean {
|
|
|
- val backItem = menu?.findItem(R.id.action_web_back)
|
|
|
- val forwardItem = menu?.findItem(R.id.action_web_forward)
|
|
|
- backItem?.isEnabled = binding.webview.canGoBack()
|
|
|
- forwardItem?.isEnabled = binding.webview.canGoForward()
|
|
|
-
|
|
|
+ override fun onPrepareOptionsMenu(menu: Menu): Boolean {
|
|
|
val iconTintColor = getResourceColor(R.attr.colorOnSurface)
|
|
|
val translucentIconTintColor = ColorUtils.setAlphaComponent(iconTintColor, 127)
|
|
|
- backItem?.icon?.setTint(if (binding.webview.canGoBack()) iconTintColor else translucentIconTintColor)
|
|
|
- forwardItem?.icon?.setTint(if (binding.webview.canGoForward()) iconTintColor else translucentIconTintColor)
|
|
|
+
|
|
|
+ menu.findItem(R.id.action_web_back).apply {
|
|
|
+ isEnabled = binding.webview.canGoBack()
|
|
|
+ icon.setTint(if (binding.webview.canGoBack()) iconTintColor else translucentIconTintColor)
|
|
|
+ }
|
|
|
+
|
|
|
+ menu.findItem(R.id.action_web_forward).apply {
|
|
|
+ isEnabled = binding.webview.canGoForward()
|
|
|
+ icon.setTint(if (binding.webview.canGoForward()) iconTintColor else translucentIconTintColor)
|
|
|
+ }
|
|
|
|
|
|
return super.onPrepareOptionsMenu(menu)
|
|
|
}
|