@onekeyfe/react-native-device-utils 6.7.0-alpha.343 → 6.7.0-alpha.344
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,11 +4,9 @@ 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
|
|
8
7
|
import android.graphics.Rect
|
|
9
8
|
import android.os.Build
|
|
10
9
|
import android.view.Gravity
|
|
11
|
-
import android.view.WindowInsetsController
|
|
12
10
|
import android.view.View
|
|
13
11
|
import android.view.ViewGroup
|
|
14
12
|
import android.widget.FrameLayout
|
|
@@ -911,30 +909,16 @@ class ReactNativeDeviceUtils : HybridReactNativeDeviceUtilsSpec(), LifecycleEven
|
|
|
911
909
|
val window = activity.window
|
|
912
910
|
val decorView = window.decorView
|
|
913
911
|
|
|
914
|
-
|
|
915
|
-
|
|
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
|
-
}
|
|
912
|
+
WindowCompat.getInsetsController(window, decorView)
|
|
913
|
+
.isAppearanceLightNavigationBars = appearance.useDarkIcons
|
|
926
914
|
|
|
927
915
|
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.Q) {
|
|
928
916
|
window.isNavigationBarContrastEnforced = false
|
|
929
917
|
}
|
|
930
918
|
|
|
931
|
-
if (
|
|
932
|
-
|
|
933
|
-
|
|
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.
|
|
919
|
+
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.VANILLA_ICE_CREAM) {
|
|
920
|
+
// Android 15 enforces edge-to-edge. Keep the platform bar transparent
|
|
921
|
+
// and draw the requested color only behind three-button navigation.
|
|
938
922
|
window.navigationBarColor = Color.TRANSPARENT
|
|
939
923
|
installNavigationBarProtection(decorView, appearance.color)
|
|
940
924
|
} else {
|
|
@@ -969,6 +953,7 @@ class ReactNativeDeviceUtils : HybridReactNativeDeviceUtilsSpec(), LifecycleEven
|
|
|
969
953
|
)
|
|
970
954
|
}
|
|
971
955
|
|
|
956
|
+
protectionView.setBackgroundColor(color)
|
|
972
957
|
protectionView.visibility = View.VISIBLE
|
|
973
958
|
protectionView.bringToFront()
|
|
974
959
|
ViewCompat.setOnApplyWindowInsetsListener(protectionView) { view, windowInsets ->
|
|
@@ -1000,17 +985,6 @@ class ReactNativeDeviceUtils : HybridReactNativeDeviceUtilsSpec(), LifecycleEven
|
|
|
1000
985
|
)
|
|
1001
986
|
else -> Triple(0, 0, Gravity.BOTTOM)
|
|
1002
987
|
}
|
|
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
|
-
)
|
|
1014
988
|
if (
|
|
1015
989
|
layoutParams.width != width ||
|
|
1016
990
|
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.344",
|
|
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",
|