Commit 405e5f97 authored by Christofer Bodin's avatar Christofer Bodin

fix android intent chooser not showing camera/camcorder when all mime types are supported.

parent eaad17eb
......@@ -971,6 +971,20 @@ public class InAppWebViewChromeClient extends WebChromeClient implements PluginR
return intent;
}
private Boolean acceptsAny(String[] types) {
if (isArrayEmpty(types)) {
return true;
}
for (String type : types) {
if (type.equals("*/*")) {
return true;
}
}
return false;
}
private Boolean acceptsImages(String types) {
String mimeType = types;
if (types.matches("\\.\\w+")) {
......@@ -981,7 +995,7 @@ public class InAppWebViewChromeClient extends WebChromeClient implements PluginR
private Boolean acceptsImages(String[] types) {
String[] mimeTypes = getAcceptedMimeType(types);
return isArrayEmpty(mimeTypes) || arrayContainsString(mimeTypes, "image");
return acceptsAny(types) || arrayContainsString(mimeTypes, "image");
}
private Boolean acceptsVideo(String types) {
......@@ -994,7 +1008,7 @@ public class InAppWebViewChromeClient extends WebChromeClient implements PluginR
private Boolean acceptsVideo(String[] types) {
String[] mimeTypes = getAcceptedMimeType(types);
return isArrayEmpty(mimeTypes) || arrayContainsString(mimeTypes, "video");
return acceptsAny(types) || arrayContainsString(mimeTypes, "video");
}
private Boolean arrayContainsString(String[] array, String pattern) {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment