moving onBackPressed up
This commit is contained in:
parent
db3a2d0c92
commit
cf9326d323
|
@ -142,6 +142,30 @@ class MainActivity : SimpleActivity() {
|
||||||
config.temporarilyShowHidden = false
|
config.temporarilyShowHidden = false
|
||||||
}
|
}
|
||||||
|
|
||||||
|
override fun onBackPressed() {
|
||||||
|
if (getCurrentFragment() !is ItemsFragment) {
|
||||||
|
super.onBackPressed()
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
if (main_menu.isSearchOpen) {
|
||||||
|
main_menu.closeSearch()
|
||||||
|
} else if (getCurrentFragment()!!.breadcrumbs.getItemCount() <= 1) {
|
||||||
|
if (!wasBackJustPressed && config.pressBackTwice) {
|
||||||
|
wasBackJustPressed = true
|
||||||
|
toast(R.string.press_back_again)
|
||||||
|
Handler().postDelayed({
|
||||||
|
wasBackJustPressed = false
|
||||||
|
}, BACK_PRESS_TIMEOUT.toLong())
|
||||||
|
} else {
|
||||||
|
finish()
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
getCurrentFragment()!!.breadcrumbs.removeBreadcrumb()
|
||||||
|
openPath(getCurrentFragment()!!.breadcrumbs.getLastItem().path)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
fun refreshMenuItems() {
|
fun refreshMenuItems() {
|
||||||
val currentFragment = getCurrentFragment() ?: return
|
val currentFragment = getCurrentFragment() ?: return
|
||||||
val isCreateDocumentIntent = intent.action == Intent.ACTION_CREATE_DOCUMENT
|
val isCreateDocumentIntent = intent.action == Intent.ACTION_CREATE_DOCUMENT
|
||||||
|
@ -624,30 +648,6 @@ class MainActivity : SimpleActivity() {
|
||||||
startAboutActivity(R.string.app_name, licenses, BuildConfig.VERSION_NAME, faqItems, true)
|
startAboutActivity(R.string.app_name, licenses, BuildConfig.VERSION_NAME, faqItems, true)
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun onBackPressed() {
|
|
||||||
if (getCurrentFragment() !is ItemsFragment) {
|
|
||||||
super.onBackPressed()
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
if (main_menu.isSearchOpen) {
|
|
||||||
main_menu.closeSearch()
|
|
||||||
} else if (getCurrentFragment()!!.breadcrumbs.getItemCount() <= 1) {
|
|
||||||
if (!wasBackJustPressed && config.pressBackTwice) {
|
|
||||||
wasBackJustPressed = true
|
|
||||||
toast(R.string.press_back_again)
|
|
||||||
Handler().postDelayed({
|
|
||||||
wasBackJustPressed = false
|
|
||||||
}, BACK_PRESS_TIMEOUT.toLong())
|
|
||||||
} else {
|
|
||||||
finish()
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
getCurrentFragment()!!.breadcrumbs.removeBreadcrumb()
|
|
||||||
openPath(getCurrentFragment()!!.breadcrumbs.getLastItem().path)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private fun checkIfRootAvailable() {
|
private fun checkIfRootAvailable() {
|
||||||
ensureBackgroundThread {
|
ensureBackgroundThread {
|
||||||
config.isRootAvailable = RootTools.isRootAvailable()
|
config.isRootAvailable = RootTools.isRootAvailable()
|
||||||
|
|
Loading…
Reference in New Issue