Plugin uses Android Log class and not Cordova LOG class

This commit is contained in:
Simon MacDonald 2016-08-22 16:52:13 -04:00
parent aca5eceaf9
commit f2c49454da

View File

@ -22,7 +22,6 @@ package org.apache.cordova.statusbar;
import android.app.Activity; import android.app.Activity;
import android.graphics.Color; import android.graphics.Color;
import android.os.Build; import android.os.Build;
import android.util.Log;
import android.view.View; import android.view.View;
import android.view.Window; import android.view.Window;
import android.view.WindowManager; import android.view.WindowManager;
@ -32,6 +31,7 @@ import org.apache.cordova.CordovaArgs;
import org.apache.cordova.CordovaInterface; import org.apache.cordova.CordovaInterface;
import org.apache.cordova.CordovaPlugin; import org.apache.cordova.CordovaPlugin;
import org.apache.cordova.CordovaWebView; import org.apache.cordova.CordovaWebView;
import org.apache.cordova.LOG;
import org.apache.cordova.PluginResult; import org.apache.cordova.PluginResult;
import org.json.JSONException; import org.json.JSONException;
@ -47,7 +47,7 @@ public class StatusBar extends CordovaPlugin {
*/ */
@Override @Override
public void initialize(final CordovaInterface cordova, CordovaWebView webView) { public void initialize(final CordovaInterface cordova, CordovaWebView webView) {
Log.v(TAG, "StatusBar: initialization"); LOG.v(TAG, "StatusBar: initialization");
super.initialize(cordova, webView); super.initialize(cordova, webView);
this.cordova.getActivity().runOnUiThread(new Runnable() { this.cordova.getActivity().runOnUiThread(new Runnable() {
@ -74,7 +74,7 @@ public class StatusBar extends CordovaPlugin {
*/ */
@Override @Override
public boolean execute(final String action, final CordovaArgs args, final CallbackContext callbackContext) throws JSONException { public boolean execute(final String action, final CordovaArgs args, final CallbackContext callbackContext) throws JSONException {
Log.v(TAG, "Executing action: " + action); LOG.v(TAG, "Executing action: " + action);
final Activity activity = this.cordova.getActivity(); final Activity activity = this.cordova.getActivity();
final Window window = activity.getWindow(); final Window window = activity.getWindow();
@ -135,7 +135,7 @@ public class StatusBar extends CordovaPlugin {
try { try {
setStatusBarBackgroundColor(args.getString(0)); setStatusBarBackgroundColor(args.getString(0));
} catch (JSONException ignore) { } catch (JSONException ignore) {
Log.e(TAG, "Invalid hexString argument, use f.i. '#777777'"); LOG.e(TAG, "Invalid hexString argument, use f.i. '#777777'");
} }
} }
}); });
@ -156,10 +156,10 @@ public class StatusBar extends CordovaPlugin {
// Using reflection makes sure any 5.0+ device will work without having to compile with SDK level 21 // Using reflection makes sure any 5.0+ device will work without having to compile with SDK level 21
window.getClass().getDeclaredMethod("setStatusBarColor", int.class).invoke(window, Color.parseColor(colorPref)); window.getClass().getDeclaredMethod("setStatusBarColor", int.class).invoke(window, Color.parseColor(colorPref));
} catch (IllegalArgumentException ignore) { } catch (IllegalArgumentException ignore) {
Log.e(TAG, "Invalid hexString argument, use f.i. '#999999'"); LOG.e(TAG, "Invalid hexString argument, use f.i. '#999999'");
} catch (Exception ignore) { } catch (Exception ignore) {
// this should not happen, only in case Android removes this method in a version > 21 // this should not happen, only in case Android removes this method in a version > 21
Log.w(TAG, "Method window.setStatusBarColor not found for SDK level " + Build.VERSION.SDK_INT); LOG.w(TAG, "Method window.setStatusBarColor not found for SDK level " + Build.VERSION.SDK_INT);
} }
} }
} }