Plugin uses Android Log class and not Cordova LOG class
This commit is contained in:
parent
4a0442b95a
commit
57b50b1d65
@ -29,7 +29,6 @@ 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;
|
||||||
@ -121,7 +120,7 @@ public class InAppBrowser extends CordovaPlugin {
|
|||||||
final String target = t;
|
final String target = t;
|
||||||
final HashMap<String, Boolean> features = parseFeature(args.optString(2));
|
final HashMap<String, Boolean> features = parseFeature(args.optString(2));
|
||||||
|
|
||||||
Log.d(LOG_TAG, "target = " + target);
|
LOG.d(LOG_TAG, "target = " + target);
|
||||||
|
|
||||||
this.cordova.getActivity().runOnUiThread(new Runnable() {
|
this.cordova.getActivity().runOnUiThread(new Runnable() {
|
||||||
@Override
|
@Override
|
||||||
@ -129,7 +128,7 @@ public class InAppBrowser extends CordovaPlugin {
|
|||||||
String result = "";
|
String result = "";
|
||||||
// SELF
|
// SELF
|
||||||
if (SELF.equals(target)) {
|
if (SELF.equals(target)) {
|
||||||
Log.d(LOG_TAG, "in self");
|
LOG.d(LOG_TAG, "in self");
|
||||||
/* This code exists for compatibility between 3.x and 4.x versions of Cordova.
|
/* This code exists for compatibility between 3.x and 4.x versions of Cordova.
|
||||||
* Previously the Config class had a static method, isUrlWhitelisted(). That
|
* Previously the Config class had a static method, isUrlWhitelisted(). That
|
||||||
* responsibility has been moved to the plugins, with an aggregating method in
|
* responsibility has been moved to the plugins, with an aggregating method in
|
||||||
@ -144,11 +143,11 @@ public class InAppBrowser extends CordovaPlugin {
|
|||||||
Method iuw = Config.class.getMethod("isUrlWhiteListed", String.class);
|
Method iuw = Config.class.getMethod("isUrlWhiteListed", String.class);
|
||||||
shouldAllowNavigation = (Boolean)iuw.invoke(null, url);
|
shouldAllowNavigation = (Boolean)iuw.invoke(null, url);
|
||||||
} catch (NoSuchMethodException e) {
|
} catch (NoSuchMethodException e) {
|
||||||
Log.d(LOG_TAG, e.getLocalizedMessage());
|
LOG.d(LOG_TAG, e.getLocalizedMessage());
|
||||||
} catch (IllegalAccessException e) {
|
} catch (IllegalAccessException e) {
|
||||||
Log.d(LOG_TAG, e.getLocalizedMessage());
|
LOG.d(LOG_TAG, e.getLocalizedMessage());
|
||||||
} catch (InvocationTargetException e) {
|
} catch (InvocationTargetException e) {
|
||||||
Log.d(LOG_TAG, e.getLocalizedMessage());
|
LOG.d(LOG_TAG, e.getLocalizedMessage());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (shouldAllowNavigation == null) {
|
if (shouldAllowNavigation == null) {
|
||||||
@ -158,23 +157,23 @@ public class InAppBrowser extends CordovaPlugin {
|
|||||||
Method san = pm.getClass().getMethod("shouldAllowNavigation", String.class);
|
Method san = pm.getClass().getMethod("shouldAllowNavigation", String.class);
|
||||||
shouldAllowNavigation = (Boolean)san.invoke(pm, url);
|
shouldAllowNavigation = (Boolean)san.invoke(pm, url);
|
||||||
} catch (NoSuchMethodException e) {
|
} catch (NoSuchMethodException e) {
|
||||||
Log.d(LOG_TAG, e.getLocalizedMessage());
|
LOG.d(LOG_TAG, e.getLocalizedMessage());
|
||||||
} catch (IllegalAccessException e) {
|
} catch (IllegalAccessException e) {
|
||||||
Log.d(LOG_TAG, e.getLocalizedMessage());
|
LOG.d(LOG_TAG, e.getLocalizedMessage());
|
||||||
} catch (InvocationTargetException e) {
|
} catch (InvocationTargetException e) {
|
||||||
Log.d(LOG_TAG, e.getLocalizedMessage());
|
LOG.d(LOG_TAG, e.getLocalizedMessage());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// load in webview
|
// load in webview
|
||||||
if (Boolean.TRUE.equals(shouldAllowNavigation)) {
|
if (Boolean.TRUE.equals(shouldAllowNavigation)) {
|
||||||
Log.d(LOG_TAG, "loading in webview");
|
LOG.d(LOG_TAG, "loading in webview");
|
||||||
webView.loadUrl(url);
|
webView.loadUrl(url);
|
||||||
}
|
}
|
||||||
//Load the dialer
|
//Load the dialer
|
||||||
else if (url.startsWith(WebView.SCHEME_TEL))
|
else if (url.startsWith(WebView.SCHEME_TEL))
|
||||||
{
|
{
|
||||||
try {
|
try {
|
||||||
Log.d(LOG_TAG, "loading in dialer");
|
LOG.d(LOG_TAG, "loading in dialer");
|
||||||
Intent intent = new Intent(Intent.ACTION_DIAL);
|
Intent intent = new Intent(Intent.ACTION_DIAL);
|
||||||
intent.setData(Uri.parse(url));
|
intent.setData(Uri.parse(url));
|
||||||
cordova.getActivity().startActivity(intent);
|
cordova.getActivity().startActivity(intent);
|
||||||
@ -184,18 +183,18 @@ public class InAppBrowser extends CordovaPlugin {
|
|||||||
}
|
}
|
||||||
// load in InAppBrowser
|
// load in InAppBrowser
|
||||||
else {
|
else {
|
||||||
Log.d(LOG_TAG, "loading in InAppBrowser");
|
LOG.d(LOG_TAG, "loading in InAppBrowser");
|
||||||
result = showWebPage(url, features);
|
result = showWebPage(url, features);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// SYSTEM
|
// SYSTEM
|
||||||
else if (SYSTEM.equals(target)) {
|
else if (SYSTEM.equals(target)) {
|
||||||
Log.d(LOG_TAG, "in system");
|
LOG.d(LOG_TAG, "in system");
|
||||||
result = openExternal(url);
|
result = openExternal(url);
|
||||||
}
|
}
|
||||||
// BLANK - or anything else
|
// BLANK - or anything else
|
||||||
else {
|
else {
|
||||||
Log.d(LOG_TAG, "in blank");
|
LOG.d(LOG_TAG, "in blank");
|
||||||
result = showWebPage(url, features);
|
result = showWebPage(url, features);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -384,7 +383,7 @@ public class InAppBrowser extends CordovaPlugin {
|
|||||||
this.cordova.getActivity().startActivity(intent);
|
this.cordova.getActivity().startActivity(intent);
|
||||||
return "";
|
return "";
|
||||||
} catch (android.content.ActivityNotFoundException e) {
|
} catch (android.content.ActivityNotFoundException e) {
|
||||||
Log.d(LOG_TAG, "InAppBrowser: Error loading url "+url+":"+ e.toString());
|
LOG.d(LOG_TAG, "InAppBrowser: Error loading url "+url+":"+ e.toString());
|
||||||
return e.toString();
|
return e.toString();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -422,7 +421,7 @@ public class InAppBrowser extends CordovaPlugin {
|
|||||||
obj.put("type", EXIT_EVENT);
|
obj.put("type", EXIT_EVENT);
|
||||||
sendUpdate(obj, false);
|
sendUpdate(obj, false);
|
||||||
} catch (JSONException ex) {
|
} catch (JSONException ex) {
|
||||||
Log.d(LOG_TAG, "Should never happen");
|
LOG.d(LOG_TAG, "Should never happen");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
@ -945,7 +944,7 @@ public class InAppBrowser extends CordovaPlugin {
|
|||||||
|
|
||||||
sendUpdate(obj, true);
|
sendUpdate(obj, true);
|
||||||
} catch (JSONException ex) {
|
} catch (JSONException ex) {
|
||||||
Log.d(LOG_TAG, "Should never happen");
|
LOG.d(LOG_TAG, "Should never happen");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -961,7 +960,7 @@ public class InAppBrowser extends CordovaPlugin {
|
|||||||
|
|
||||||
sendUpdate(obj, true, PluginResult.Status.ERROR);
|
sendUpdate(obj, true, PluginResult.Status.ERROR);
|
||||||
} catch (JSONException ex) {
|
} catch (JSONException ex) {
|
||||||
Log.d(LOG_TAG, "Should never happen");
|
LOG.d(LOG_TAG, "Should never happen");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -977,11 +976,11 @@ public class InAppBrowser extends CordovaPlugin {
|
|||||||
Method gpm = webView.getClass().getMethod("getPluginManager");
|
Method gpm = webView.getClass().getMethod("getPluginManager");
|
||||||
pluginManager = (PluginManager)gpm.invoke(webView);
|
pluginManager = (PluginManager)gpm.invoke(webView);
|
||||||
} catch (NoSuchMethodException e) {
|
} catch (NoSuchMethodException e) {
|
||||||
Log.d(LOG_TAG, e.getLocalizedMessage());
|
LOG.d(LOG_TAG, e.getLocalizedMessage());
|
||||||
} catch (IllegalAccessException e) {
|
} catch (IllegalAccessException e) {
|
||||||
Log.d(LOG_TAG, e.getLocalizedMessage());
|
LOG.d(LOG_TAG, e.getLocalizedMessage());
|
||||||
} catch (InvocationTargetException e) {
|
} catch (InvocationTargetException e) {
|
||||||
Log.d(LOG_TAG, e.getLocalizedMessage());
|
LOG.d(LOG_TAG, e.getLocalizedMessage());
|
||||||
}
|
}
|
||||||
|
|
||||||
if (pluginManager == null) {
|
if (pluginManager == null) {
|
||||||
@ -989,9 +988,9 @@ public class InAppBrowser extends CordovaPlugin {
|
|||||||
Field pmf = webView.getClass().getField("pluginManager");
|
Field pmf = webView.getClass().getField("pluginManager");
|
||||||
pluginManager = (PluginManager)pmf.get(webView);
|
pluginManager = (PluginManager)pmf.get(webView);
|
||||||
} catch (NoSuchFieldException e) {
|
} catch (NoSuchFieldException e) {
|
||||||
Log.d(LOG_TAG, e.getLocalizedMessage());
|
LOG.d(LOG_TAG, e.getLocalizedMessage());
|
||||||
} catch (IllegalAccessException e) {
|
} catch (IllegalAccessException e) {
|
||||||
Log.d(LOG_TAG, e.getLocalizedMessage());
|
LOG.d(LOG_TAG, e.getLocalizedMessage());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -21,7 +21,6 @@ package org.apache.cordova.inappbrowser;
|
|||||||
import android.app.AlertDialog;
|
import android.app.AlertDialog;
|
||||||
import android.app.Dialog;
|
import android.app.Dialog;
|
||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
import android.util.Log;
|
|
||||||
|
|
||||||
import org.json.JSONException;
|
import org.json.JSONException;
|
||||||
import org.json.JSONObject;
|
import org.json.JSONObject;
|
||||||
|
Loading…
Reference in New Issue
Block a user