Plugin uses Android Log class and not Cordova LOG class

This commit is contained in:
Simon MacDonald 2016-08-22 16:41:34 -04:00
parent 4a0442b95a
commit 57b50b1d65
2 changed files with 22 additions and 24 deletions

View File

@ -29,7 +29,6 @@ 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;
@ -121,7 +120,7 @@ public class InAppBrowser extends CordovaPlugin {
final String target = t;
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() {
@Override
@ -129,7 +128,7 @@ public class InAppBrowser extends CordovaPlugin {
String result = "";
// SELF
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.
* Previously the Config class had a static method, isUrlWhitelisted(). That
* 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);
shouldAllowNavigation = (Boolean)iuw.invoke(null, url);
} catch (NoSuchMethodException e) {
Log.d(LOG_TAG, e.getLocalizedMessage());
LOG.d(LOG_TAG, e.getLocalizedMessage());
} catch (IllegalAccessException e) {
Log.d(LOG_TAG, e.getLocalizedMessage());
LOG.d(LOG_TAG, e.getLocalizedMessage());
} catch (InvocationTargetException e) {
Log.d(LOG_TAG, e.getLocalizedMessage());
LOG.d(LOG_TAG, e.getLocalizedMessage());
}
}
if (shouldAllowNavigation == null) {
@ -158,23 +157,23 @@ public class InAppBrowser extends CordovaPlugin {
Method san = pm.getClass().getMethod("shouldAllowNavigation", String.class);
shouldAllowNavigation = (Boolean)san.invoke(pm, url);
} catch (NoSuchMethodException e) {
Log.d(LOG_TAG, e.getLocalizedMessage());
LOG.d(LOG_TAG, e.getLocalizedMessage());
} catch (IllegalAccessException e) {
Log.d(LOG_TAG, e.getLocalizedMessage());
LOG.d(LOG_TAG, e.getLocalizedMessage());
} catch (InvocationTargetException e) {
Log.d(LOG_TAG, e.getLocalizedMessage());
LOG.d(LOG_TAG, e.getLocalizedMessage());
}
}
// load in webview
if (Boolean.TRUE.equals(shouldAllowNavigation)) {
Log.d(LOG_TAG, "loading in webview");
LOG.d(LOG_TAG, "loading in webview");
webView.loadUrl(url);
}
//Load the dialer
else if (url.startsWith(WebView.SCHEME_TEL))
{
try {
Log.d(LOG_TAG, "loading in dialer");
LOG.d(LOG_TAG, "loading in dialer");
Intent intent = new Intent(Intent.ACTION_DIAL);
intent.setData(Uri.parse(url));
cordova.getActivity().startActivity(intent);
@ -184,18 +183,18 @@ public class InAppBrowser extends CordovaPlugin {
}
// load in InAppBrowser
else {
Log.d(LOG_TAG, "loading in InAppBrowser");
LOG.d(LOG_TAG, "loading in InAppBrowser");
result = showWebPage(url, features);
}
}
// SYSTEM
else if (SYSTEM.equals(target)) {
Log.d(LOG_TAG, "in system");
LOG.d(LOG_TAG, "in system");
result = openExternal(url);
}
// BLANK - or anything else
else {
Log.d(LOG_TAG, "in blank");
LOG.d(LOG_TAG, "in blank");
result = showWebPage(url, features);
}
@ -384,7 +383,7 @@ public class InAppBrowser extends CordovaPlugin {
this.cordova.getActivity().startActivity(intent);
return "";
} 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();
}
}
@ -422,7 +421,7 @@ public class InAppBrowser extends CordovaPlugin {
obj.put("type", EXIT_EVENT);
sendUpdate(obj, false);
} 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);
} 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);
} 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");
pluginManager = (PluginManager)gpm.invoke(webView);
} catch (NoSuchMethodException e) {
Log.d(LOG_TAG, e.getLocalizedMessage());
LOG.d(LOG_TAG, e.getLocalizedMessage());
} catch (IllegalAccessException e) {
Log.d(LOG_TAG, e.getLocalizedMessage());
LOG.d(LOG_TAG, e.getLocalizedMessage());
} catch (InvocationTargetException e) {
Log.d(LOG_TAG, e.getLocalizedMessage());
LOG.d(LOG_TAG, e.getLocalizedMessage());
}
if (pluginManager == null) {
@ -989,9 +988,9 @@ public class InAppBrowser extends CordovaPlugin {
Field pmf = webView.getClass().getField("pluginManager");
pluginManager = (PluginManager)pmf.get(webView);
} catch (NoSuchFieldException e) {
Log.d(LOG_TAG, e.getLocalizedMessage());
LOG.d(LOG_TAG, e.getLocalizedMessage());
} catch (IllegalAccessException e) {
Log.d(LOG_TAG, e.getLocalizedMessage());
LOG.d(LOG_TAG, e.getLocalizedMessage());
}
}

View File

@ -21,7 +21,6 @@ package org.apache.cordova.inappbrowser;
import android.app.AlertDialog;
import android.app.Dialog;
import android.content.Context;
import android.util.Log;
import org.json.JSONException;
import org.json.JSONObject;