mirror of
https://github.com/null2264/yokai.git
synced 2025-06-21 10:44:42 +00:00
refactor MainActivity.pressingBack
This commit is contained in:
parent
00b3cf9cf2
commit
5322c3c4b1
1 changed files with 8 additions and 14 deletions
|
@ -950,24 +950,18 @@ open class MainActivity : BaseActivity<MainActivityBinding>(), DownloadServiceLi
|
|||
}
|
||||
|
||||
private fun pressingBack() {
|
||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.TIRAMISU) {
|
||||
val insets = window.decorView.rootWindowInsets
|
||||
if (insets?.isVisible(WindowInsetsCompat.Type.ime()) == true) {
|
||||
val vic = WindowInsetsControllerCompat(window, binding.root)
|
||||
vic.hide(WindowInsetsCompat.Type.ime())
|
||||
return
|
||||
}
|
||||
}
|
||||
if (actionMode != null) {
|
||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.TIRAMISU &&
|
||||
window.decorView.rootWindowInsets?.isVisible(WindowInsetsCompat.Type.ime()) == true
|
||||
) {
|
||||
WindowInsetsControllerCompat(window, binding.root).hide(WindowInsetsCompat.Type.ime())
|
||||
} else if (actionMode != null) {
|
||||
actionMode?.finish()
|
||||
return
|
||||
}
|
||||
if (binding.searchToolbar.hasExpandedActionView() && binding.cardFrame.isVisible) {
|
||||
} else if (binding.searchToolbar.hasExpandedActionView() && binding.cardFrame.isVisible) {
|
||||
binding.searchToolbar.collapseActionView()
|
||||
return
|
||||
}
|
||||
} else {
|
||||
backPress()
|
||||
}
|
||||
}
|
||||
|
||||
override fun finish() {
|
||||
if (!preferences.backReturnsToStart().get() && this !is SearchActivity) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue