Skip to content

Commit 26625cf

Browse files
authored
fix: Migrate plugins from Color.parseColor() to WebColor.parseColor() (#140)
1 parent 48c49c1 commit 26625cf

File tree

3 files changed

+4
-5
lines changed

3 files changed

+4
-5
lines changed

action-sheet/android/src/main/java/com/capacitorjs/plugins/actionsheet/ActionSheet.java

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@
55
import android.content.DialogInterface;
66
import android.graphics.Color;
77
import android.view.View;
8-
import android.view.Window;
98
import android.widget.LinearLayout;
109
import android.widget.TextView;
1110
import androidx.annotation.NonNull;

browser/android/src/main/java/com/capacitorjs/plugins/browser/BrowserPlugin.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
11
package com.capacitorjs.plugins.browser;
22

3-
import android.graphics.Color;
43
import android.net.Uri;
54
import com.getcapacitor.Logger;
65
import com.getcapacitor.Plugin;
76
import com.getcapacitor.PluginCall;
87
import com.getcapacitor.PluginMethod;
98
import com.getcapacitor.annotation.CapacitorPlugin;
9+
import com.getcapacitor.util.WebColor;
1010

1111
@CapacitorPlugin(name = "Browser")
1212
public class BrowserPlugin extends Plugin {
@@ -42,7 +42,7 @@ public void open(PluginCall call) {
4242
String colorString = call.getString("toolbarColor");
4343
Integer toolbarColor = null;
4444
if (colorString != null) try {
45-
toolbarColor = Color.parseColor(colorString);
45+
toolbarColor = WebColor.parseColor(colorString);
4646
} catch (IllegalArgumentException ex) {
4747
Logger.error(getLogTag(), "Invalid color provided for toolbarColor. Using default", null);
4848
}

status-bar/android/src/main/java/com/capacitorjs/plugins/statusbar/StatusBarPlugin.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
package com.capacitorjs.plugins.statusbar;
22

3-
import android.graphics.Color;
43
import com.getcapacitor.JSObject;
54
import com.getcapacitor.Plugin;
65
import com.getcapacitor.PluginCall;
76
import com.getcapacitor.PluginMethod;
87
import com.getcapacitor.annotation.CapacitorPlugin;
8+
import com.getcapacitor.util.WebColor;
99

1010
@CapacitorPlugin(name = "StatusBar")
1111
public class StatusBarPlugin extends Plugin {
@@ -46,7 +46,7 @@ public void setBackgroundColor(final PluginCall call) {
4646
.executeOnMainThread(
4747
() -> {
4848
try {
49-
final int parsedColor = Color.parseColor(color.toUpperCase());
49+
final int parsedColor = WebColor.parseColor(color.toUpperCase());
5050
implementation.setBackgroundColor(parsedColor);
5151
call.resolve();
5252
} catch (IllegalArgumentException ex) {

0 commit comments

Comments
 (0)