Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
30 changes: 16 additions & 14 deletions src/plugins/browser/android/com/foxdebug/browser/Browser.java
Original file line number Diff line number Diff line change
Expand Up @@ -117,11 +117,10 @@ public void onClick(View v) {
);

faviconFrame = new FrameLayout(context);
faviconFrameParams =
new LinearLayout.LayoutParams(
ViewGroup.LayoutParams.WRAP_CONTENT,
ViewGroup.LayoutParams.WRAP_CONTENT
);
faviconFrameParams = new LinearLayout.LayoutParams(
ViewGroup.LayoutParams.WRAP_CONTENT,
ViewGroup.LayoutParams.WRAP_CONTENT
);
faviconFrameParams.gravity = Gravity.CENTER_VERTICAL;
faviconFrame.setLayoutParams(faviconFrameParams);
faviconFrame.addView(favicon);
Expand Down Expand Up @@ -568,21 +567,24 @@ public boolean onShowFileChooser(
if (browser.filePathCallback != null) {
browser.filePathCallback.onReceiveValue(null);
}

browser.filePathCallback = filePathCallback;
Intent selectDocument = new Intent(Intent.ACTION_GET_CONTENT);
Boolean isMultiple =
(
fileChooserParams.getMode() ==
WebChromeClient.FileChooserParams.MODE_OPEN_MULTIPLE
);
String mimeType = fileChooserParams.getAcceptTypes()[0];

mimeType = mimeType == null ? "*/*" : mimeType;
String[] acceptTypes = fileChooserParams.getAcceptTypes();
String mimeType = "*/*"; // default if empty or null
if (acceptTypes != null && acceptTypes.length > 0) {
String firstType = acceptTypes[0];
if (firstType != null && !firstType.trim().isEmpty()) {
mimeType = firstType;
}
}

Intent selectDocument = new Intent(Intent.ACTION_GET_CONTENT);
selectDocument.addCategory(Intent.CATEGORY_OPENABLE);
selectDocument.setType(mimeType);

boolean isMultiple =
(fileChooserParams.getMode() ==
WebChromeClient.FileChooserParams.MODE_OPEN_MULTIPLE);
if (isMultiple) {
selectDocument.putExtra(Intent.EXTRA_ALLOW_MULTIPLE, true);
}
Expand Down
Loading