dpogue commented on code in PR #1609: URL: https://github.com/apache/cordova-android/pull/1609#discussion_r1178382538
########## templates/project/res/xml/opener_paths.xml: ########## @@ -0,0 +1,14 @@ +<?xml version="1.0" encoding="utf-8"?> +<!-- https://developer.android.com/reference/android/support/v4/content/FileProvider.html#SpecifyFiles --> +<paths xmlns:android="http://schemas.android.com/apk/res/android"> Review Comment: Should this file be managed as part of the cordova-file-plugin (which provides API to exposes those paths) or is this also exposed by cordova-android directly? ########## framework/src/org/apache/cordova/engine/SystemWebChromeClient.java: ########## @@ -211,54 +216,137 @@ public View getVideoLoadingProgressView() { return mVideoProgressView; } + // <input type=file> support: + // openFileChooser() is for pre KitKat and in KitKat mr1 (it's known broken in + // KitKat). + // For Lollipop, we use onShowFileChooser(). + public void openFileChooser(ValueCallback<Uri> uploadMsg) { + this.openFileChooser(uploadMsg, "*/*"); + } + + public void openFileChooser(ValueCallback<Uri> uploadMsg, String acceptType) { + this.openFileChooser(uploadMsg, acceptType, null); + } + + public void openFileChooser(final ValueCallback<Uri> uploadMsg, String acceptType, String capture) { + Intent intent = new Intent(Intent.ACTION_GET_CONTENT); + intent.addCategory(Intent.CATEGORY_OPENABLE); + intent.setType("*/*"); + parentEngine.cordova.startActivityForResult(new CordovaPlugin() { Review Comment: This anonymous inner-class CordovaPlugin feels sketchy to me, but I see it's the same pattern that already exists so... I guess it's okay? If you have ideas for a better way to handle this that has less potential for weird side-effects, I'd love to hear it. ########## framework/src/org/apache/cordova/engine/SystemWebChromeClient.java: ########## @@ -211,54 +216,137 @@ public View getVideoLoadingProgressView() { return mVideoProgressView; } + // <input type=file> support: + // openFileChooser() is for pre KitKat and in KitKat mr1 (it's known broken in + // KitKat). + // For Lollipop, we use onShowFileChooser(). Review Comment: TODO: double check Cordova supported versions, I'm 99% sure we've dropped KitKat support already, and I'm pretty sure Lollipop is also out (or will be out in the upcoming major version bump) -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: issues-unsubscr...@cordova.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org --------------------------------------------------------------------- To unsubscribe, e-mail: issues-unsubscr...@cordova.apache.org For additional commands, e-mail: issues-h...@cordova.apache.org