You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cordova.apache.org by bo...@apache.org on 2017/01/09 17:47:32 UTC
[2/8] cordova-plugin-inappbrowser git commit: CB-9148 (android) Add
Support for input[type=file] File Chooser
CB-9148 (android) Add Support for input[type=file] File Chooser
Project: http://git-wip-us.apache.org/repos/asf/cordova-plugin-inappbrowser/repo
Commit: http://git-wip-us.apache.org/repos/asf/cordova-plugin-inappbrowser/commit/26f7ef3c
Tree: http://git-wip-us.apache.org/repos/asf/cordova-plugin-inappbrowser/tree/26f7ef3c
Diff: http://git-wip-us.apache.org/repos/asf/cordova-plugin-inappbrowser/diff/26f7ef3c
Branch: refs/heads/master
Commit: 26f7ef3c671a442885ebe16d9e1c576613eaf390
Parents: 2a383a6
Author: \ubc15\uad00\uc601 <ja...@naver.com>
Authored: Tue Jan 3 14:39:25 2017 +0900
Committer: Joe Bowser <bo...@apache.org>
Committed: Mon Jan 9 09:27:53 2017 -0800
----------------------------------------------------------------------
src/android/InAppBrowser.java | 29 +++++++++++++----------------
1 file changed, 13 insertions(+), 16 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/cordova-plugin-inappbrowser/blob/26f7ef3c/src/android/InAppBrowser.java
----------------------------------------------------------------------
diff --git a/src/android/InAppBrowser.java b/src/android/InAppBrowser.java
index 94c5a68..22b1f12 100644
--- a/src/android/InAppBrowser.java
+++ b/src/android/InAppBrowser.java
@@ -29,6 +29,7 @@ import android.net.Uri;
import android.os.Build;
import android.os.Bundle;
import android.text.InputType;
+import android.util.Log;
import android.util.TypedValue;
import android.view.Gravity;
import android.view.KeyEvent;
@@ -41,6 +42,8 @@ import android.view.inputmethod.InputMethodManager;
import android.webkit.CookieManager;
import android.webkit.CookieSyncManager;
import android.webkit.HttpAuthHandler;
+import android.webkit.ValueCallback;
+import android.webkit.WebChromeClient;
import android.webkit.WebSettings;
import android.webkit.WebView;
import android.webkit.WebViewClient;
@@ -68,10 +71,6 @@ import java.lang.reflect.Method;
import java.util.HashMap;
import java.util.StringTokenizer;
-import android.util.Log;
-import android.webkit.ValueCallback;
-import android.webkit.WebChromeClient;
-
@SuppressLint("SetJavaScriptEnabled")
public class InAppBrowser extends CordovaPlugin {
@@ -107,7 +106,6 @@ public class InAppBrowser extends CordovaPlugin {
private boolean mediaPlaybackRequiresUserGesture = false;
private boolean shouldPauseInAppBrowser = false;
private boolean useWideViewPort = true;
-
private ValueCallback<Uri> mUploadCallback;
private ValueCallback<Uri[]> mUploadCallbackLollipop;
private final static int FILECHOOSER_REQUESTCODE = 1;
@@ -409,7 +407,7 @@ public class InAppBrowser extends CordovaPlugin {
intent.putExtra(Browser.EXTRA_APPLICATION_ID, cordova.getActivity().getPackageName());
this.cordova.getActivity().startActivity(intent);
return "";
- // not catching FileUriExposedException explicitly because buildtools<24 doesn't know about it
+ // not catching FileUriExposedException explicitly because buildtools<24 doesn't know about it
} catch (java.lang.RuntimeException e) {
LOG.d(LOG_TAG, "InAppBrowser: Error loading url "+url+":"+ e.toString());
return e.toString();
@@ -571,7 +569,7 @@ public class InAppBrowser extends CordovaPlugin {
}
Boolean wideViewPort = features.get(USER_WIDE_VIEW_PORT);
if (wideViewPort != null ) {
- useWideViewPort = wideViewPort.booleanValue();
+ useWideViewPort = wideViewPort.booleanValue();
}
}
@@ -586,8 +584,8 @@ public class InAppBrowser extends CordovaPlugin {
*/
private int dpToPixels(int dipValue) {
int value = (int) TypedValue.applyDimension( TypedValue.COMPLEX_UNIT_DIP,
- (float) dipValue,
- cordova.getActivity().getResources().getDisplayMetrics()
+ (float) dipValue,
+ cordova.getActivity().getResources().getDisplayMetrics()
);
return value;
@@ -695,8 +693,8 @@ public class InAppBrowser extends CordovaPlugin {
public boolean onKey(View v, int keyCode, KeyEvent event) {
// If the event is a key-down event on the "enter" button
if ((event.getAction() == KeyEvent.ACTION_DOWN) && (keyCode == KeyEvent.KEYCODE_ENTER)) {
- navigate(edittext.getText().toString());
- return true;
+ navigate(edittext.getText().toString());
+ return true;
}
return false;
}
@@ -731,8 +729,7 @@ public class InAppBrowser extends CordovaPlugin {
inAppWebView = new WebView(cordova.getActivity());
inAppWebView.setLayoutParams(new LinearLayout.LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.MATCH_PARENT));
inAppWebView.setId(Integer.valueOf(6));
-
- // File Chooser Implemented ChromeClient
+// File Chooser Implemented ChromeClient
inAppWebView.setWebChromeClient(new InAppChromeClient(thatWebView) {
// For Android 5.0+
public boolean onShowFileChooser (WebView webView, ValueCallback<Uri[]> filePathCallback, WebChromeClient.FileChooserParams fileChooserParams)
@@ -783,7 +780,6 @@ public class InAppBrowser extends CordovaPlugin {
}
});
-
WebViewClient client = new InAppBrowserClient(thatWebView, edittext);
inAppWebView.setWebViewClient(client);
WebSettings settings = inAppWebView.getSettings();
@@ -1035,7 +1031,7 @@ public class InAppBrowser extends CordovaPlugin {
// Update the UI if we haven't already
if (!newloc.equals(edittext.getText().toString())) {
edittext.setText(newloc);
- }
+ }
try {
JSONObject obj = new JSONObject();
@@ -1048,6 +1044,7 @@ public class InAppBrowser extends CordovaPlugin {
}
+
public void onPageFinished(WebView view, String url) {
super.onPageFinished(view, url);
@@ -1123,4 +1120,4 @@ public class InAppBrowser extends CordovaPlugin {
super.onReceivedHttpAuthRequest(view, handler, host, realm);
}
}
-}
\ No newline at end of file
+}
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@cordova.apache.org
For additional commands, e-mail: commits-help@cordova.apache.org