Minor edits

This commit is contained in:
arkon 2020-04-28 18:45:04 -04:00
parent 548dbf4b78
commit 6a3cd0054b

View file

@ -115,14 +115,14 @@ class WebViewActivity : BaseActivity<WebviewActivityBinding>() {
}
override fun onPrepareOptionsMenu(menu: Menu?): Boolean {
val backItem = binding.toolbar.menu.findItem(R.id.action_web_back)
val forwardItem = binding.toolbar.menu.findItem(R.id.action_web_forward)
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()
val iconTintColor = getResourceColor(R.attr.colorOnPrimary)
val translucentIconTintColor = ColorUtils.setAlphaComponent(iconTintColor, 127)
backItem.icon?.setTint(if (binding.webview.canGoBack()) iconTintColor else translucentIconTintColor)
backItem?.icon?.setTint(if (binding.webview.canGoBack()) iconTintColor else translucentIconTintColor)
forwardItem?.icon?.setTint(if (binding.webview.canGoForward()) iconTintColor else translucentIconTintColor)
return super.onPrepareOptionsMenu(menu)