Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open files with "Show in Amaze" option #4069

Open
wants to merge 4 commits into
base: release/4.0
Choose a base branch
from

Conversation

seelchen
Copy link
Contributor

@seelchen seelchen commented Feb 3, 2024

Description

When users open an arbitrary file, there is now an option "Show in Amaze". Amaze then tries to find the path of the file and navigate to it.

show-in-amaze.mp4

Issue tracker

Fixes #2714

Automatic tests

  • Added test cases

Manual tests

  • Done

Devices:

  • Pixel 7 emulator running Android 13
  • HTC U11 life running Android 10

Build tasks success

Successfully running following tasks on local:

  • ./gradlew assembledebug
  • ./gradlew spotlessCheck

@seelchen
Copy link
Contributor Author

seelchen commented Feb 3, 2024

This issue was more complicated than I thought. I tried my best, but I am not very satisfied with my implementation.

This PR adds an intent filter for all ACTION_VIEW intents. I could not find a way to restrict it to intents which show files that are on the filesystem, so the "Show in Amaze" option could also be shown for intents that want to view something else than files.

To resolve the URI from the intents I added a new function which tries to find the file path using the ContentProvider. I think that this only works if the URI was constructed with the default ContentProvider. In the other cases, the function tries to guess the path using the URI path, but this only works if the file path is in the URI. When I tested this, the files downloaded from Chrome for example could not be found because the URI only contained the file ID.

@seelchen seelchen marked this pull request as ready for review February 4, 2024 16:37
@VishnuSanal
Copy link
Member

hi @seelchen, the code looks good to me.

I could not find a way to restrict it to intents which show files that are on the filesystem, so the "Show in Amaze" option could also be shown for intents that want to view something else than files.

is this the only issue right now? users selecting "open with amaze" on non-files?

When I tested this, the files downloaded from Chrome for example could not be found because the URI only contained the file ID.

I see that you are handling the issue it gracefully (by giving the heads-up to the user).

if this works in most cases, we will be good to go! but, create issues for the things that don't work after merging.

also, there's a current implementation for the same from AmazeFileUtilities that uses (com.amaze.fileutilities.AFM_LOCATE_FILE_NAME); can you please check whether that can be done along with your implementation?

@seelchen
Copy link
Contributor Author

seelchen commented Jul 6, 2024

Hi @VishnuSanal, unfortunately I currently don't have time to investigate this further.
It seems that Android tries to reduce the exposure of file paths when files are shared, so there will probably be no reliable solution for this. I think that my solution is too hacky, so I will close this PR.

@seelchen seelchen closed this Jul 6, 2024
@VishnuSanal
Copy link
Member

Hi @VishnuSanal, unfortunately I currently don't have time to investigate this further. It seems that Android tries to reduce the exposure of file paths when files are shared, so there will probably be no reliable solution for this. I think that my solution is too hacky, so I will close this PR.

since this PR works well as of now, we'll take it from here. :)

@VishnuSanal VishnuSanal reopened this Jul 9, 2024
@VishnuSanal VishnuSanal self-assigned this Jul 9, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Add "show in folder" for opening arbitrary files
2 participants