override fun onOptionsItemSelected(menuItem: MenuItem): Boolean {
// Run the commands that correlate to the selected menu item.
- return when (menuItem.itemId) {
+ when (menuItem.itemId) {
R.id.search -> { // Search was selected.
// Set the minimum height of the search linear layout to match the toolbar.
searchLinearLayout.minimumHeight = toolbar.height
logcatWebView.resumeTimers()
// Consume the event.
- true
+ return true
}
R.id.copy -> { // Copy was selected.
Snackbar.make(logcatWebView, R.string.logcat_copied, Snackbar.LENGTH_SHORT).show()
// Consume the event.
- true
+ return true
}
R.id.save -> { // Save was selected.
saveLogcatActivityResultLauncher.launch(getString(R.string.privacy_browser_logcat_txt, BuildConfig.VERSION_NAME))
// Consume the event.
- true
+ return true
}
R.id.clear -> { // Clear was selected.
}
// Consume the event.
- true
+ return true
}
- else -> { // The home button was pushed.
+ else -> { // The home button was selected.
// Do not consume the event. The system will process the home command.
- super.onOptionsItemSelected(menuItem)
+ return super.onOptionsItemSelected(menuItem)
}
}
}
- public override fun onSaveInstanceState(savedInstanceState: Bundle) {
+ public override fun onSaveInstanceState(outState: Bundle) {
// Run the default commands.
- super.onSaveInstanceState(savedInstanceState)
+ super.onSaveInstanceState(outState)
// Store the scroll Y position in the bundle.
- savedInstanceState.putInt(SCROLL_Y, logcatWebView.scrollY)
+ outState.putInt(SCROLL_Y, logcatWebView.scrollY)
}
// The view parameter cannot be removed because it is called from the layout onClick.