@onekeyfe/react-native-device-utils 6.7.0-alpha.344 → 6.7.0-alpha.354
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/android/src/main/java/com/margelo/nitro/reactnativedeviceutils/ReactNativeDeviceUtils.kt
CHANGED
|
@@ -4,9 +4,11 @@ import android.app.Activity
|
|
|
4
4
|
import android.content.Context
|
|
5
5
|
import android.content.pm.PackageManager
|
|
6
6
|
import android.graphics.Color
|
|
7
|
+
import android.graphics.drawable.GradientDrawable
|
|
7
8
|
import android.graphics.Rect
|
|
8
9
|
import android.os.Build
|
|
9
10
|
import android.view.Gravity
|
|
11
|
+
import android.view.WindowInsetsController
|
|
10
12
|
import android.view.View
|
|
11
13
|
import android.view.ViewGroup
|
|
12
14
|
import android.widget.FrameLayout
|
|
@@ -909,16 +911,30 @@ class ReactNativeDeviceUtils : HybridReactNativeDeviceUtilsSpec(), LifecycleEven
|
|
|
909
911
|
val window = activity.window
|
|
910
912
|
val decorView = window.decorView
|
|
911
913
|
|
|
912
|
-
|
|
913
|
-
|
|
914
|
+
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.R) {
|
|
915
|
+
// WindowInsetsControllerCompat leaves the previous value in place on
|
|
916
|
+
// Android 11-14 once the window is appearance-controlled, so runtime
|
|
917
|
+
// theme switches kept stale button colors. Use the platform API.
|
|
918
|
+
window.insetsController?.setSystemBarsAppearance(
|
|
919
|
+
if (appearance.useDarkIcons) WindowInsetsController.APPEARANCE_LIGHT_NAVIGATION_BARS else 0,
|
|
920
|
+
WindowInsetsController.APPEARANCE_LIGHT_NAVIGATION_BARS,
|
|
921
|
+
)
|
|
922
|
+
} else {
|
|
923
|
+
WindowCompat.getInsetsController(window, decorView)
|
|
924
|
+
.isAppearanceLightNavigationBars = appearance.useDarkIcons
|
|
925
|
+
}
|
|
914
926
|
|
|
915
927
|
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.Q) {
|
|
916
928
|
window.isNavigationBarContrastEnforced = false
|
|
917
929
|
}
|
|
918
930
|
|
|
919
|
-
if (
|
|
920
|
-
|
|
921
|
-
|
|
931
|
+
if (
|
|
932
|
+
Build.VERSION.SDK_INT >= Build.VERSION_CODES.VANILLA_ICE_CREAM ||
|
|
933
|
+
com.facebook.react.views.view.isEdgeToEdgeFeatureFlagOn
|
|
934
|
+
) {
|
|
935
|
+
// Edge-to-edge windows (enforced on Android 15, opted in below it) keep
|
|
936
|
+
// the platform bar transparent and draw the requested color only
|
|
937
|
+
// behind three-button navigation.
|
|
922
938
|
window.navigationBarColor = Color.TRANSPARENT
|
|
923
939
|
installNavigationBarProtection(decorView, appearance.color)
|
|
924
940
|
} else {
|
|
@@ -953,7 +969,6 @@ class ReactNativeDeviceUtils : HybridReactNativeDeviceUtilsSpec(), LifecycleEven
|
|
|
953
969
|
)
|
|
954
970
|
}
|
|
955
971
|
|
|
956
|
-
protectionView.setBackgroundColor(color)
|
|
957
972
|
protectionView.visibility = View.VISIBLE
|
|
958
973
|
protectionView.bringToFront()
|
|
959
974
|
ViewCompat.setOnApplyWindowInsetsListener(protectionView) { view, windowInsets ->
|
|
@@ -985,6 +1000,17 @@ class ReactNativeDeviceUtils : HybridReactNativeDeviceUtilsSpec(), LifecycleEven
|
|
|
985
1000
|
)
|
|
986
1001
|
else -> Triple(0, 0, Gravity.BOTTOM)
|
|
987
1002
|
}
|
|
1003
|
+
// Fade in over the first third from the content edge so the protection never
|
|
1004
|
+
// draws a hard line against the page; the buttons sit on the solid rest.
|
|
1005
|
+
val fadeOrientation = when (gravity) {
|
|
1006
|
+
Gravity.LEFT -> GradientDrawable.Orientation.RIGHT_LEFT
|
|
1007
|
+
Gravity.RIGHT -> GradientDrawable.Orientation.LEFT_RIGHT
|
|
1008
|
+
else -> GradientDrawable.Orientation.TOP_BOTTOM
|
|
1009
|
+
}
|
|
1010
|
+
view.background = GradientDrawable(
|
|
1011
|
+
fadeOrientation,
|
|
1012
|
+
intArrayOf(color and 0x00FFFFFF, color, color, color),
|
|
1013
|
+
)
|
|
988
1014
|
if (
|
|
989
1015
|
layoutParams.width != width ||
|
|
990
1016
|
layoutParams.height != height ||
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@onekeyfe/react-native-device-utils",
|
|
3
|
-
"version": "6.7.0-alpha.
|
|
3
|
+
"version": "6.7.0-alpha.354",
|
|
4
4
|
"description": "Native device, launch, system appearance and boot recovery utilities for OneKey",
|
|
5
5
|
"main": "./lib/module/index.js",
|
|
6
6
|
"types": "./lib/typescript/src/index.d.ts",
|