CB-9148 (android) Add Support for input[type=file] File Chooser

This commit is contained in:
박관영 2017-01-03 14:39:25 +09:00 committed by Joe Bowser
parent 2a383a66c5
commit 26f7ef3c67

View File

@ -29,6 +29,7 @@ import android.net.Uri;
import android.os.Build; import android.os.Build;
import android.os.Bundle; import android.os.Bundle;
import android.text.InputType; import android.text.InputType;
import android.util.Log;
import android.util.TypedValue; import android.util.TypedValue;
import android.view.Gravity; import android.view.Gravity;
import android.view.KeyEvent; import android.view.KeyEvent;
@ -41,6 +42,8 @@ import android.view.inputmethod.InputMethodManager;
import android.webkit.CookieManager; import android.webkit.CookieManager;
import android.webkit.CookieSyncManager; import android.webkit.CookieSyncManager;
import android.webkit.HttpAuthHandler; import android.webkit.HttpAuthHandler;
import android.webkit.ValueCallback;
import android.webkit.WebChromeClient;
import android.webkit.WebSettings; import android.webkit.WebSettings;
import android.webkit.WebView; import android.webkit.WebView;
import android.webkit.WebViewClient; import android.webkit.WebViewClient;
@ -68,10 +71,6 @@ import java.lang.reflect.Method;
import java.util.HashMap; import java.util.HashMap;
import java.util.StringTokenizer; import java.util.StringTokenizer;
import android.util.Log;
import android.webkit.ValueCallback;
import android.webkit.WebChromeClient;
@SuppressLint("SetJavaScriptEnabled") @SuppressLint("SetJavaScriptEnabled")
public class InAppBrowser extends CordovaPlugin { public class InAppBrowser extends CordovaPlugin {
@ -107,7 +106,6 @@ public class InAppBrowser extends CordovaPlugin {
private boolean mediaPlaybackRequiresUserGesture = false; private boolean mediaPlaybackRequiresUserGesture = false;
private boolean shouldPauseInAppBrowser = false; private boolean shouldPauseInAppBrowser = false;
private boolean useWideViewPort = true; private boolean useWideViewPort = true;
private ValueCallback<Uri> mUploadCallback; private ValueCallback<Uri> mUploadCallback;
private ValueCallback<Uri[]> mUploadCallbackLollipop; private ValueCallback<Uri[]> mUploadCallbackLollipop;
private final static int FILECHOOSER_REQUESTCODE = 1; private final static int FILECHOOSER_REQUESTCODE = 1;
@ -731,7 +729,6 @@ public class InAppBrowser extends CordovaPlugin {
inAppWebView = new WebView(cordova.getActivity()); inAppWebView = new WebView(cordova.getActivity());
inAppWebView.setLayoutParams(new LinearLayout.LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.MATCH_PARENT)); inAppWebView.setLayoutParams(new LinearLayout.LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.MATCH_PARENT));
inAppWebView.setId(Integer.valueOf(6)); inAppWebView.setId(Integer.valueOf(6));
// File Chooser Implemented ChromeClient // File Chooser Implemented ChromeClient
inAppWebView.setWebChromeClient(new InAppChromeClient(thatWebView) { inAppWebView.setWebChromeClient(new InAppChromeClient(thatWebView) {
// For Android 5.0+ // For Android 5.0+
@ -783,7 +780,6 @@ public class InAppBrowser extends CordovaPlugin {
} }
}); });
WebViewClient client = new InAppBrowserClient(thatWebView, edittext); WebViewClient client = new InAppBrowserClient(thatWebView, edittext);
inAppWebView.setWebViewClient(client); inAppWebView.setWebViewClient(client);
WebSettings settings = inAppWebView.getSettings(); WebSettings settings = inAppWebView.getSettings();
@ -1048,6 +1044,7 @@ public class InAppBrowser extends CordovaPlugin {
} }
public void onPageFinished(WebView view, String url) { public void onPageFinished(WebView view, String url) {
super.onPageFinished(view, url); super.onPageFinished(view, url);