@capawesome/capacitor-android-edge-to-edge-support 7.0.0 → 7.0.1
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.
package/README.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# @capawesome/capacitor-android-edge-to-edge-support
|
|
2
2
|
|
|
3
|
-
Capacitor plugin to support edge-to-edge display on Android.
|
|
3
|
+
Capacitor plugin to support [edge-to-edge](https://developer.android.com/develop/ui/views/layout/edge-to-edge) display on Android.
|
|
4
4
|
|
|
5
5
|
| Before | After | Before | After |
|
|
6
6
|
| ----------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------- |
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
package io.capawesome.capacitorjs.plugins.androidedgetoedgesupport;
|
|
2
2
|
|
|
3
3
|
import android.graphics.Color;
|
|
4
|
+
import android.os.Build;
|
|
4
5
|
import android.view.View;
|
|
5
6
|
import android.view.ViewGroup;
|
|
6
7
|
import androidx.annotation.NonNull;
|
|
@@ -42,8 +43,20 @@ public class EdgeToEdge {
|
|
|
42
43
|
// Apply insets to disable the edge-to-edge feature
|
|
43
44
|
ViewCompat.setOnApplyWindowInsetsListener(view, (v, windowInsets) -> {
|
|
44
45
|
Insets insets = windowInsets.getInsets(WindowInsetsCompat.Type.systemBars());
|
|
46
|
+
Boolean keyboardVisible = windowInsets.isVisible(WindowInsetsCompat.Type.ime());
|
|
47
|
+
|
|
45
48
|
ViewGroup.MarginLayoutParams mlp = (ViewGroup.MarginLayoutParams) v.getLayoutParams();
|
|
46
|
-
|
|
49
|
+
|
|
50
|
+
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.VANILLA_ICE_CREAM) {
|
|
51
|
+
if (keyboardVisible) {
|
|
52
|
+
mlp.bottomMargin = 0;
|
|
53
|
+
} else {
|
|
54
|
+
mlp.bottomMargin = insets.bottom;
|
|
55
|
+
}
|
|
56
|
+
} else if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.R) {
|
|
57
|
+
mlp.bottomMargin = insets.bottom;
|
|
58
|
+
}
|
|
59
|
+
|
|
47
60
|
mlp.leftMargin = insets.left;
|
|
48
61
|
mlp.rightMargin = insets.right;
|
|
49
62
|
mlp.topMargin = insets.top;
|
package/package.json
CHANGED