zhanghai / zhanghai/MaterialFiles

[Feature Request] Exit the app by triggering the Back once

Open
#462 1 comment 1 reaction 1 assignee View on GitHub

@zhanghai is already working on this.

Since Mar 14, 2021.

enhancement
Dominant language
Kotlin
Stars
9k
Forks
736
PR merge metrics
No merged PRs in 30d

Description

As a user, I used to exit the app through the Back gesture, but when I entered a deep folder directory, I need to repeatedly trigger a Back(onBackPressed()) event to return to the root folder, then I can exit the app. This is very inefficient and troublesome for me.

So I would love to have at least one preference item that allows the user to choose "one-click to exit the application via Back". I think this will not hurt the original experience, because we already have an explicit trail path view at the top (the bar shows A > B > C).

If possible, I would also like the FileListActivity to accept an intent parameter/extra (boolean) to temporarily configure this, because one of our apps will use MaterialFiles to open a deep folder, and once the user goes to this FileListActivity, he will need to click back multiple times to get back to our original Activity.

This is how we use MaterialFiles to open a deep folder:

val openInFilesIntent = Intent(Intent.ACTION_VIEW)
openInFilesIntent.type = "vnd.android.document/directory"
openInFilesIntent.component = ComponentName("me.zhanghai.android.files", "me.zhanghai.android.files.filelist.FileListActivity")
openInFilesIntent.putExtra("org.openintents.extra.ABSOLUTE_PATH", <path>)
// need a boolean extra to set one-click to exit
// ...
startActivity(openInFilesIntent)

Thanks!

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.