Skip to content
This repository has been archived by the owner on Mar 30, 2022. It is now read-only.

Design flaw #33

Closed
krischik opened this issue Jan 2, 2014 · 2 comments
Closed

Design flaw #33

krischik opened this issue Jan 2, 2014 · 2 comments

Comments

@krischik
Copy link

krischik commented Jan 2, 2014

I have two apps into which which a added aFileChooser (patched version with extension filter and base path).

When I started the demo for testing I saw:

device-2014-01-02-140928

Now I have three identical choose files options.

That makes me wonder if there is not fundamental design flaw inside aFileChooser. I beginn to think that one library can not be an external and internal file chooser at the same time.

@iPaulPro
Copy link
Owner

iPaulPro commented Jan 2, 2014

So, when 4.4 introduced the Storage Access Framework and this DocumentProvider Activity, they made it so the Activity intercepting the GET_CONTENT Intent must be exported. If you're going to export FileChooserActivity you should be using your own icon so the user is able to tell that it's your app they can select a file from. I will update the README to include this direction.

FileChooserActivity can be used independently from GET_CONTENT method, which has it's own utility. For this type of usage, the icon doesn't matter, and exported should be false.

Also, as noted in the README:

Using FileChooserActivity and LocalStorageProvider together are redundant if you're only trying to insure your user has access to local storage. If this is the case, you should enable/disable based on the API level (above: @bool/use_provider and @bool/use_activity).

@iPaulPro iPaulPro closed this as completed Jan 2, 2014
@iPaulPro
Copy link
Owner

iPaulPro commented Jan 2, 2014

Remember, if you're only trying to determine if the user has an app that supports the GET_CONTENT Intent that you want, you can always check for it at runtime with something like this:

public static boolean isChooserAvailable(Context context, Intent intent) {
    final PackageManager mgr = context.getPackageManager();
    List<ResolveInfo> activities = mgr.queryIntentActivities(intent, 0);
    return activities.size() > 0;
}

I will add this to FileUtils at some point, and update the README.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants