Skip to content

Commit

Permalink
fix: Migrate plugins from Color.parseColor() to WebColor.parseColor() (
Browse files Browse the repository at this point in the history
  • Loading branch information
thomasvidas committed Dec 17, 2020
1 parent 48c49c1 commit 26625cf
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
import android.content.DialogInterface;
import android.graphics.Color;
import android.view.View;
import android.view.Window;
import android.widget.LinearLayout;
import android.widget.TextView;
import androidx.annotation.NonNull;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
package com.capacitorjs.plugins.browser;

import android.graphics.Color;
import android.net.Uri;
import com.getcapacitor.Logger;
import com.getcapacitor.Plugin;
import com.getcapacitor.PluginCall;
import com.getcapacitor.PluginMethod;
import com.getcapacitor.annotation.CapacitorPlugin;
import com.getcapacitor.util.WebColor;

@CapacitorPlugin(name = "Browser")
public class BrowserPlugin extends Plugin {
Expand Down Expand Up @@ -42,7 +42,7 @@ public void open(PluginCall call) {
String colorString = call.getString("toolbarColor");
Integer toolbarColor = null;
if (colorString != null) try {
toolbarColor = Color.parseColor(colorString);
toolbarColor = WebColor.parseColor(colorString);
} catch (IllegalArgumentException ex) {
Logger.error(getLogTag(), "Invalid color provided for toolbarColor. Using default", null);
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
package com.capacitorjs.plugins.statusbar;

import android.graphics.Color;
import com.getcapacitor.JSObject;
import com.getcapacitor.Plugin;
import com.getcapacitor.PluginCall;
import com.getcapacitor.PluginMethod;
import com.getcapacitor.annotation.CapacitorPlugin;
import com.getcapacitor.util.WebColor;

@CapacitorPlugin(name = "StatusBar")
public class StatusBarPlugin extends Plugin {
Expand Down Expand Up @@ -46,7 +46,7 @@ public void setBackgroundColor(final PluginCall call) {
.executeOnMainThread(
() -> {
try {
final int parsedColor = Color.parseColor(color.toUpperCase());
final int parsedColor = WebColor.parseColor(color.toUpperCase());
implementation.setBackgroundColor(parsedColor);
call.resolve();
} catch (IllegalArgumentException ex) {
Expand Down

0 comments on commit 26625cf

Please sign in to comment.