@capawesome/capacitor-android-edge-to-edge-support 7.2.1 → 7.2.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -2,8 +2,8 @@ package io.capawesome.capacitorjs.plugins.androidedgetoedgesupport;
|
|
|
2
2
|
|
|
3
3
|
import android.graphics.Color;
|
|
4
4
|
import android.view.ViewGroup;
|
|
5
|
-
import androidx.annotation.Nullable;
|
|
6
5
|
import com.getcapacitor.JSObject;
|
|
6
|
+
import com.getcapacitor.Logger;
|
|
7
7
|
import com.getcapacitor.Plugin;
|
|
8
8
|
import com.getcapacitor.PluginCall;
|
|
9
9
|
import com.getcapacitor.PluginMethod;
|
|
@@ -27,8 +27,12 @@ public class EdgeToEdgePlugin extends Plugin {
|
|
|
27
27
|
public void enable(PluginCall call) {
|
|
28
28
|
getActivity()
|
|
29
29
|
.runOnUiThread(() -> {
|
|
30
|
-
|
|
31
|
-
|
|
30
|
+
try {
|
|
31
|
+
implementation.enable();
|
|
32
|
+
call.resolve();
|
|
33
|
+
} catch (Exception exception) {
|
|
34
|
+
call.reject(exception.getMessage());
|
|
35
|
+
}
|
|
32
36
|
});
|
|
33
37
|
}
|
|
34
38
|
|
|
@@ -36,20 +40,28 @@ public class EdgeToEdgePlugin extends Plugin {
|
|
|
36
40
|
public void disable(PluginCall call) {
|
|
37
41
|
getActivity()
|
|
38
42
|
.runOnUiThread(() -> {
|
|
39
|
-
|
|
40
|
-
|
|
43
|
+
try {
|
|
44
|
+
implementation.disable();
|
|
45
|
+
call.resolve();
|
|
46
|
+
} catch (Exception exception) {
|
|
47
|
+
call.reject(exception.getMessage());
|
|
48
|
+
}
|
|
41
49
|
});
|
|
42
50
|
}
|
|
43
51
|
|
|
44
52
|
@PluginMethod
|
|
45
53
|
public void getInsets(PluginCall call) {
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
54
|
+
try {
|
|
55
|
+
ViewGroup.MarginLayoutParams insets = implementation.getInsets();
|
|
56
|
+
JSObject result = new JSObject();
|
|
57
|
+
result.put("bottom", insets.bottomMargin);
|
|
58
|
+
result.put("left", insets.leftMargin);
|
|
59
|
+
result.put("right", insets.rightMargin);
|
|
60
|
+
result.put("top", insets.topMargin);
|
|
61
|
+
call.resolve(result);
|
|
62
|
+
} catch (Exception exception) {
|
|
63
|
+
call.reject(exception.getMessage());
|
|
64
|
+
}
|
|
53
65
|
}
|
|
54
66
|
|
|
55
67
|
@PluginMethod
|
|
@@ -61,17 +73,25 @@ public class EdgeToEdgePlugin extends Plugin {
|
|
|
61
73
|
}
|
|
62
74
|
getActivity()
|
|
63
75
|
.runOnUiThread(() -> {
|
|
64
|
-
|
|
65
|
-
|
|
76
|
+
try {
|
|
77
|
+
implementation.setBackgroundColor(color);
|
|
78
|
+
call.resolve();
|
|
79
|
+
} catch (Exception exception) {
|
|
80
|
+
call.reject(exception.getMessage());
|
|
81
|
+
}
|
|
66
82
|
});
|
|
67
83
|
}
|
|
68
84
|
|
|
69
85
|
private EdgeToEdgeConfig getEdgeToEdgeConfig() {
|
|
70
86
|
EdgeToEdgeConfig config = new EdgeToEdgeConfig();
|
|
71
87
|
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
88
|
+
try {
|
|
89
|
+
String backgroundColor = getConfig().getString("backgroundColor");
|
|
90
|
+
if (backgroundColor != null) {
|
|
91
|
+
config.setBackgroundColor(Color.parseColor(backgroundColor));
|
|
92
|
+
}
|
|
93
|
+
} catch (Exception exception) {
|
|
94
|
+
Logger.error(TAG, "Set config failed.", exception);
|
|
75
95
|
}
|
|
76
96
|
return config;
|
|
77
97
|
}
|
package/package.json
CHANGED