@truewatchtech/react-native-mobile 0.4.0-alpha.4 → 0.4.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.
- package/FTMobileReactNativeSDK.podspec +31 -2
- package/android/build.gradle +7 -19
- package/android/src/main/java/com/ft/sdk/reactnative/FTMobileImpl.java +472 -5
- package/android/src/main/java/com/ft/sdk/reactnative/FTRUMImpl.java +12 -0
- package/android/src/newarch/java/com/ft/sdk/reactnative/FTLogModule.java +7 -14
- package/android/src/newarch/java/com/ft/sdk/reactnative/FTMobileModule.java +46 -12
- package/android/src/newarch/java/com/ft/sdk/reactnative/FTRUMModule.java +12 -13
- package/android/src/newarch/java/com/ft/sdk/reactnative/FTTraceModule.java +6 -8
- package/android/src/oldarch/java/com/ft/sdk/reactnative/FTMobileModule.java +34 -2
- package/android/src/oldarch/java/com/ft/sdk/reactnative/FTRUMModule.java +5 -0
- package/android/src/rnpost74/java/com/ft/sdk/reactnative/FTMobilePackage.java +14 -3
- package/android/src/rnpre74/java/com/ft/sdk/reactnative/FTMobilePackage.java +0 -3
- package/ios/FTMobileReactNative.h +9 -5
- package/ios/FTMobileReactNative.mm +625 -0
- package/ios/FTReactNativeLog.h +8 -3
- package/ios/FTReactNativeLog.mm +79 -0
- package/ios/FTReactNativeRUM.h +8 -3
- package/ios/{FTReactNativeRUM.m → FTReactNativeRUM.mm} +143 -84
- package/ios/FTReactNativeTrace.h +8 -2
- package/ios/FTReactNativeTrace.mm +74 -0
- package/ios/FtMobileAgent.xcodeproj/project.pbxproj +17 -1
- package/lib/commonjs/ft_logger.js +14 -13
- package/lib/commonjs/ft_logger.js.map +1 -1
- package/lib/commonjs/ft_mobile_agent.js +155 -6
- package/lib/commonjs/ft_mobile_agent.js.map +1 -1
- package/lib/commonjs/ft_rum.js +55 -21
- package/lib/commonjs/ft_rum.js.map +1 -1
- package/lib/commonjs/ft_tracing.js +29 -10
- package/lib/commonjs/ft_tracing.js.map +1 -1
- package/lib/commonjs/index.js +24 -13
- package/lib/commonjs/index.js.map +1 -1
- package/lib/commonjs/rum/FTRumActionTracking.js +10 -4
- package/lib/commonjs/rum/FTRumActionTracking.js.map +1 -1
- package/lib/commonjs/rum/FTRumErrorTracking.js +4 -4
- package/lib/commonjs/rum/FTRumErrorTracking.js.map +1 -1
- package/lib/commonjs/specs/NativeFTMobileReactNative.js +10 -0
- package/lib/commonjs/specs/NativeFTMobileReactNative.js.map +1 -0
- package/lib/commonjs/specs/NativeFTReactNativeLog.js +10 -0
- package/lib/commonjs/specs/NativeFTReactNativeLog.js.map +1 -0
- package/lib/commonjs/specs/NativeFTReactNativeRUM.js +10 -0
- package/lib/commonjs/specs/NativeFTReactNativeRUM.js.map +1 -0
- package/lib/commonjs/specs/NativeFTReactNativeTrace.js +10 -0
- package/lib/commonjs/specs/NativeFTReactNativeTrace.js.map +1 -0
- package/lib/commonjs/version.js +1 -1
- package/lib/commonjs/version.js.map +1 -1
- package/lib/module/ft_logger.js +14 -12
- package/lib/module/ft_logger.js.map +1 -1
- package/lib/module/ft_mobile_agent.js +161 -5
- package/lib/module/ft_mobile_agent.js.map +1 -1
- package/lib/module/ft_rum.js +54 -16
- package/lib/module/ft_rum.js.map +1 -1
- package/lib/module/ft_tracing.js +29 -9
- package/lib/module/ft_tracing.js.map +1 -1
- package/lib/module/index.js +3 -4
- package/lib/module/index.js.map +1 -1
- package/lib/module/rum/FTRumActionTracking.js +10 -4
- package/lib/module/rum/FTRumActionTracking.js.map +1 -1
- package/lib/module/rum/FTRumErrorTracking.js +4 -4
- package/lib/module/rum/FTRumErrorTracking.js.map +1 -1
- package/lib/module/specs/NativeFTMobileReactNative.js +5 -0
- package/lib/module/specs/NativeFTMobileReactNative.js.map +1 -0
- package/lib/module/specs/NativeFTReactNativeLog.js +5 -0
- package/lib/module/specs/NativeFTReactNativeLog.js.map +1 -0
- package/lib/module/specs/NativeFTReactNativeRUM.js +5 -0
- package/lib/module/specs/NativeFTReactNativeRUM.js.map +1 -0
- package/lib/module/specs/NativeFTReactNativeTrace.js +5 -0
- package/lib/module/specs/NativeFTReactNativeTrace.js.map +1 -0
- package/lib/module/version.js +1 -1
- package/lib/module/version.js.map +1 -1
- package/lib/typescript/ft_logger.d.ts +6 -6
- package/lib/typescript/ft_mobile_agent.d.ts +169 -14
- package/lib/typescript/ft_rum.d.ts +32 -8
- package/lib/typescript/ft_tracing.d.ts +6 -6
- package/lib/typescript/index.d.ts +3 -4
- package/lib/typescript/specs/NativeFTMobileReactNative.d.ts +75 -0
- package/lib/typescript/specs/NativeFTReactNativeLog.d.ts +23 -0
- package/lib/typescript/specs/NativeFTReactNativeRUM.d.ts +89 -0
- package/lib/typescript/specs/NativeFTReactNativeTrace.d.ts +24 -0
- package/lib/typescript/version.d.ts +1 -1
- package/package.json +26 -93
- package/scripts/replace-react-require.js +37 -38
- package/src/ft_logger.tsx +72 -40
- package/src/ft_mobile_agent.tsx +378 -91
- package/src/ft_rum.tsx +227 -121
- package/src/ft_tracing.tsx +58 -37
- package/src/index.tsx +58 -18
- package/src/rum/FTRumActionTracking.tsx +212 -204
- package/src/rum/FTRumErrorTracking.tsx +70 -71
- package/src/specs/NativeFTMobileReactNative.ts +83 -0
- package/src/specs/NativeFTReactNativeLog.ts +29 -0
- package/src/specs/NativeFTReactNativeRUM.ts +104 -0
- package/src/specs/NativeFTReactNativeTrace.ts +26 -0
- package/src/version.ts +1 -1
- package/LICENSE +0 -201
- package/android/.project +0 -17
- package/android/.settings/org.eclipse.buildship.core.prefs +0 -13
- package/android/gradlew +0 -185
- package/android/local.properties +0 -8
- package/android/src/main/java/com/ft/sdk/InnerClassProxy.java +0 -8
- package/android/src/main/java/com/ft/sdk/reactnative/FTSessionReplayImpl.java +0 -60
- package/android/src/main/java/com/ft/sdk/reactnative/extensions/ReactDrawablesExt.java +0 -155
- package/android/src/main/java/com/ft/sdk/reactnative/sessionreplay/NoopTextPropertiesResolver.java +0 -23
- package/android/src/main/java/com/ft/sdk/reactnative/sessionreplay/ReactNativeSessionReplayExtensionSupport.java +0 -57
- package/android/src/main/java/com/ft/sdk/reactnative/sessionreplay/ShadowNodeWrapper.java +0 -84
- package/android/src/main/java/com/ft/sdk/reactnative/sessionreplay/TextPropertiesResolver.java +0 -20
- package/android/src/main/java/com/ft/sdk/reactnative/sessionreplay/mappers/DefaultMapper.java +0 -78
- package/android/src/main/java/com/ft/sdk/reactnative/sessionreplay/mappers/Pair.java +0 -11
- package/android/src/main/java/com/ft/sdk/reactnative/sessionreplay/mappers/ReactEditTextMapper.java +0 -136
- package/android/src/main/java/com/ft/sdk/reactnative/sessionreplay/mappers/ReactNativeImageViewMapper.java +0 -117
- package/android/src/main/java/com/ft/sdk/reactnative/sessionreplay/mappers/ReactTextMapper.java +0 -57
- package/android/src/main/java/com/ft/sdk/reactnative/sessionreplay/mappers/ReactViewGroupMapper.java +0 -22
- package/android/src/main/java/com/ft/sdk/reactnative/sessionreplay/mappers/ReactViewModalMapper.java +0 -21
- package/android/src/main/java/com/ft/sdk/reactnative/sessionreplay/resources/ReactDrawableCopier.java +0 -35
- package/android/src/main/java/com/ft/sdk/reactnative/sessionreplay/utils/DrawableUtils.java +0 -34
- package/android/src/main/java/com/ft/sdk/reactnative/sessionreplay/utils/ReflectionUtils.java +0 -43
- package/android/src/main/java/com/ft/sdk/reactnative/sessionreplay/utils/text/FabricTextViewUtils.java +0 -69
- package/android/src/main/java/com/ft/sdk/reactnative/sessionreplay/utils/text/LegacyTextViewUtils.java +0 -97
- package/android/src/main/java/com/ft/sdk/reactnative/sessionreplay/utils/text/TextViewUtils.java +0 -184
- package/android/src/main/java/com/ft/sdk/reactnative/utils/ColorUtils.java +0 -24
- package/android/src/newarch/java/com/ft/sdk/reactnative/FTSessionReplayModule.java +0 -30
- package/android/src/oldarch/java/com/ft/sdk/reactnative/FTSessionReplayModule.java +0 -25
- package/android/src/rn69/java/com/ft/sdk/reactnative/sessionreplay/utils/ReactViewBackgroundDrawableUtils.java +0 -100
- package/android/src/rn75/java/com/ft/sdk/reactnative/sessionreplay/extensions/LengthPercentageExt.java +0 -27
- package/android/src/rn75/java/com/ft/sdk/reactnative/sessionreplay/utils/ReactViewBackgroundDrawableUtils.java +0 -116
- package/android/src/rn76/java/com/ft/sdk/reactnative/sessionreplay/extensions/LengthPercentageExt.java +0 -38
- package/android/src/rn76/java/com/ft/sdk/reactnative/sessionreplay/utils/ReactViewBackgroundDrawableUtils.java +0 -117
- package/android/src/rn79/java/com/ft/sdk/reactnative/sessionreplay/extensions/LengthPercentageExt.java +0 -38
- package/android/src/rn79/java/com/ft/sdk/reactnative/sessionreplay/utils/ReactViewBackgroundDrawableUtils.java +0 -132
- package/android/src/rn80/java/com/ft/sdk/reactnative/sessionreplay/extensions/ComputedBorderRadiusExt.java +0 -58
- package/android/src/rn80/java/com/ft/sdk/reactnative/sessionreplay/utils/ReactViewBackgroundDrawableUtils.java +0 -190
- package/android/src/rnlegacy/java/com/ft/sdk/reactnative/sessionreplay/utils/ReactViewBackgroundDrawableUtils.java +0 -120
- package/ios/.idea/.name +0 -1
- package/ios/.idea/ios.iml +0 -2
- package/ios/.idea/modules.xml +0 -8
- package/ios/.idea/vcs.xml +0 -6
- package/ios/.idea/xcode.xml +0 -4
- package/ios/FTMobileReactNative.m +0 -184
- package/ios/FTRCTTextViewRecorder.h +0 -33
- package/ios/FTRCTTextViewRecorder.m +0 -120
- package/ios/FTReactNativeLog.m +0 -60
- package/ios/FTReactNativeSessionReplay.h +0 -6
- package/ios/FTReactNativeSessionReplay.mm +0 -44
- package/ios/FTReactNativeTrace.m +0 -56
- package/ios/FtMobileAgent.xcodeproj/project.xcworkspace/contents.xcworkspacedata +0 -4
- package/ios/FtMobileAgent.xcodeproj/project.xcworkspace/xcuserdata/Brandon.xcuserdatad/UserInterfaceState.xcuserstate +0 -0
- package/ios/FtMobileAgent.xcodeproj/project.xcworkspace/xcuserdata/Brandon.xcuserdatad/xcschemes/xcschememanagement.plist +0 -5
- package/ios/FtMobileAgent.xcodeproj/xcuserdata/Brandon.xcuserdatad/xcschemes/FtMobileAgent.xcscheme +0 -56
- package/ios/FtMobileAgent.xcodeproj/xcuserdata/Brandon.xcuserdatad/xcschemes/xcschememanagement.plist +0 -14
- package/ios/RCTVersion.h +0 -8
- package/lib/commonjs/ft_session_replay.js +0 -34
- package/lib/commonjs/ft_session_replay.js.map +0 -1
- package/lib/module/ft_session_replay.js +0 -29
- package/lib/module/ft_session_replay.js.map +0 -1
- package/lib/typescript/ft_session_replay.d.ts +0 -27
- package/src/ft_session_replay.tsx +0 -34
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
/*
|
|
2
|
-
* Unless explicitly stated otherwise all files in this repository are licensed under the Apache License Version 2.0.
|
|
3
|
-
* This product includes software developed at Datadog (https://www.datadoghq.com/).
|
|
4
|
-
* Copyright 2016-Present Datadog, Inc.
|
|
5
|
-
*/
|
|
6
|
-
|
|
7
|
-
package com.ft.sdk.reactnative.utils;
|
|
8
|
-
|
|
9
|
-
public class ColorUtils {
|
|
10
|
-
private static final int HEX_COLOR_INCLUDING_ALPHA_LENGTH = 8;
|
|
11
|
-
|
|
12
|
-
public static String formatAsRgba(int backgroundColor) {
|
|
13
|
-
String colorHexString = Integer.toHexString(backgroundColor);
|
|
14
|
-
return "#" + convertArgbToRgba(colorHexString);
|
|
15
|
-
}
|
|
16
|
-
|
|
17
|
-
private static String convertArgbToRgba(String hexString) {
|
|
18
|
-
if (hexString.length() == HEX_COLOR_INCLUDING_ALPHA_LENGTH) {
|
|
19
|
-
return hexString.substring(2, 8) + hexString.substring(0, 2);
|
|
20
|
-
} else {
|
|
21
|
-
return hexString;
|
|
22
|
-
}
|
|
23
|
-
}
|
|
24
|
-
}
|
|
@@ -1,30 +0,0 @@
|
|
|
1
|
-
package com.ft.sdk.reactnative;
|
|
2
|
-
|
|
3
|
-
import androidx.annotation.NonNull;
|
|
4
|
-
import com.facebook.react.turbomodule.core.interfaces.TurboModule;
|
|
5
|
-
import com.facebook.react.bridge.ReactApplicationContext;
|
|
6
|
-
import com.facebook.react.module.annotations.ReactModule;
|
|
7
|
-
import com.facebook.react.bridge.ReactMethod;
|
|
8
|
-
import com.facebook.react.bridge.Promise;
|
|
9
|
-
import com.facebook.react.bridge.ReadableMap;
|
|
10
|
-
|
|
11
|
-
@ReactModule(name = FTSessionReplayModule.NAME)
|
|
12
|
-
public class FTSessionReplayModule extends NativeFTSessionReplaySpec {
|
|
13
|
-
public static final String NAME = FTSessionReplayImpl.NAME;
|
|
14
|
-
private final FTSessionReplayImpl impl = new FTSessionReplayImpl();
|
|
15
|
-
|
|
16
|
-
public FTSessionReplayModule(ReactApplicationContext reactContext) {
|
|
17
|
-
super(reactContext);
|
|
18
|
-
}
|
|
19
|
-
|
|
20
|
-
@Override
|
|
21
|
-
public String getName() {
|
|
22
|
-
return NAME;
|
|
23
|
-
}
|
|
24
|
-
|
|
25
|
-
@Override
|
|
26
|
-
@ReactMethod
|
|
27
|
-
public void sessionReplayConfig(ReadableMap context, Promise promise) {
|
|
28
|
-
impl.sessionReplayConfig(context, promise, getReactApplicationContext());
|
|
29
|
-
}
|
|
30
|
-
}
|
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
package com.ft.sdk.reactnative;
|
|
2
|
-
|
|
3
|
-
import com.facebook.react.bridge.Promise;
|
|
4
|
-
import com.facebook.react.bridge.ReactApplicationContext;
|
|
5
|
-
import com.facebook.react.bridge.ReactContextBaseJavaModule;
|
|
6
|
-
import com.facebook.react.bridge.ReactMethod;
|
|
7
|
-
import com.facebook.react.bridge.ReadableMap;
|
|
8
|
-
|
|
9
|
-
public class FTSessionReplayModule extends ReactContextBaseJavaModule {
|
|
10
|
-
private final FTSessionReplayImpl impl = new FTSessionReplayImpl();
|
|
11
|
-
|
|
12
|
-
public FTSessionReplayModule(ReactApplicationContext reactContext) {
|
|
13
|
-
super(reactContext);
|
|
14
|
-
}
|
|
15
|
-
|
|
16
|
-
@Override
|
|
17
|
-
public String getName() {
|
|
18
|
-
return FTSessionReplayImpl.NAME;
|
|
19
|
-
}
|
|
20
|
-
|
|
21
|
-
@ReactMethod
|
|
22
|
-
public void sessionReplayConfig(ReadableMap context, Promise promise) {
|
|
23
|
-
impl.sessionReplayConfig(context, promise, getReactApplicationContext());
|
|
24
|
-
}
|
|
25
|
-
}
|
|
@@ -1,100 +0,0 @@
|
|
|
1
|
-
/*
|
|
2
|
-
* Unless explicitly stated otherwise all files in this repository are licensed under the Apache License Version 2.0.
|
|
3
|
-
* This product includes software developed at Datadog (https://www.datadoghq.com/).
|
|
4
|
-
* Copyright 2016-Present Datadog, Inc.
|
|
5
|
-
*/
|
|
6
|
-
package com.ft.sdk.reactnative.sessionreplay.utils;
|
|
7
|
-
|
|
8
|
-
import android.graphics.drawable.Drawable;
|
|
9
|
-
import android.graphics.drawable.InsetDrawable;
|
|
10
|
-
import android.graphics.drawable.LayerDrawable;
|
|
11
|
-
|
|
12
|
-
import com.ft.sdk.reactnative.sessionreplay.mappers.Pair;
|
|
13
|
-
import com.ft.sdk.reactnative.utils.ColorUtils;
|
|
14
|
-
import com.facebook.react.uimanager.Spacing;
|
|
15
|
-
import com.facebook.react.views.view.ReactViewBackgroundDrawable;
|
|
16
|
-
import com.ft.sdk.sessionreplay.model.ShapeBorder;
|
|
17
|
-
import com.ft.sdk.sessionreplay.model.ShapeStyle;
|
|
18
|
-
|
|
19
|
-
public class ReactViewBackgroundDrawableUtils extends DrawableUtils {
|
|
20
|
-
|
|
21
|
-
private static final String COLOR_FIELD_NAME = "mColor";
|
|
22
|
-
|
|
23
|
-
public ReactViewBackgroundDrawableUtils() {
|
|
24
|
-
super();
|
|
25
|
-
}
|
|
26
|
-
|
|
27
|
-
@Override
|
|
28
|
-
public Pair<ShapeStyle, ShapeBorder> resolveShapeAndBorder(
|
|
29
|
-
Drawable drawable,
|
|
30
|
-
float opacity,
|
|
31
|
-
float pixelDensity) {
|
|
32
|
-
if (!(drawable instanceof ReactViewBackgroundDrawable)) {
|
|
33
|
-
return new Pair<>(null, null);
|
|
34
|
-
}
|
|
35
|
-
|
|
36
|
-
ReactViewBackgroundDrawable backgroundDrawable = (ReactViewBackgroundDrawable) drawable;
|
|
37
|
-
ShapeBorder borderProps = resolveBorder(backgroundDrawable, pixelDensity);
|
|
38
|
-
long cornerRadius = (long) (backgroundDrawable.getFullBorderWidth() / pixelDensity);
|
|
39
|
-
|
|
40
|
-
Integer backgroundColor = getBackgroundColor(backgroundDrawable);
|
|
41
|
-
String colorHexString = null;
|
|
42
|
-
if (backgroundColor != null) {
|
|
43
|
-
colorHexString = ColorUtils.formatAsRgba(backgroundColor);
|
|
44
|
-
} else {
|
|
45
|
-
return new Pair<>(null, borderProps);
|
|
46
|
-
}
|
|
47
|
-
|
|
48
|
-
ShapeStyle shapeStyle = new ShapeStyle(
|
|
49
|
-
colorHexString,
|
|
50
|
-
opacity,
|
|
51
|
-
cornerRadius
|
|
52
|
-
);
|
|
53
|
-
|
|
54
|
-
return new Pair<>(shapeStyle, borderProps);
|
|
55
|
-
}
|
|
56
|
-
|
|
57
|
-
@Override
|
|
58
|
-
public Drawable getReactBackgroundFromDrawable(Drawable drawable) {
|
|
59
|
-
if (drawable instanceof ReactViewBackgroundDrawable) {
|
|
60
|
-
return drawable;
|
|
61
|
-
} else if (drawable instanceof InsetDrawable) {
|
|
62
|
-
return getReactBackgroundFromDrawable(((InsetDrawable) drawable).getDrawable());
|
|
63
|
-
} else if (drawable instanceof LayerDrawable) {
|
|
64
|
-
return getDrawableFromLayerDrawable((LayerDrawable) drawable);
|
|
65
|
-
} else {
|
|
66
|
-
return null;
|
|
67
|
-
}
|
|
68
|
-
}
|
|
69
|
-
|
|
70
|
-
private Drawable getDrawableFromLayerDrawable(LayerDrawable layerDrawable) {
|
|
71
|
-
for (int layerNumber = 0; layerNumber < layerDrawable.getNumberOfLayers(); layerNumber++) {
|
|
72
|
-
Drawable layer = layerDrawable.getDrawable(layerNumber);
|
|
73
|
-
if (layer instanceof ReactViewBackgroundDrawable) {
|
|
74
|
-
return layer;
|
|
75
|
-
}
|
|
76
|
-
}
|
|
77
|
-
return null;
|
|
78
|
-
}
|
|
79
|
-
|
|
80
|
-
private ShapeBorder resolveBorder(
|
|
81
|
-
ReactViewBackgroundDrawable backgroundDrawable,
|
|
82
|
-
float pixelDensity) {
|
|
83
|
-
long borderWidth = (long) (backgroundDrawable.getFullBorderWidth() / pixelDensity);
|
|
84
|
-
String borderColor = ColorUtils.formatAsRgba(backgroundDrawable.getBorderColor(Spacing.ALL));
|
|
85
|
-
|
|
86
|
-
return new ShapeBorder(
|
|
87
|
-
borderColor,
|
|
88
|
-
borderWidth
|
|
89
|
-
);
|
|
90
|
-
}
|
|
91
|
-
|
|
92
|
-
private Integer getBackgroundColor(ReactViewBackgroundDrawable backgroundDrawable) {
|
|
93
|
-
Object result = reflectionUtils.getDeclaredField(backgroundDrawable, COLOR_FIELD_NAME);
|
|
94
|
-
if (result instanceof Integer) {
|
|
95
|
-
return (Integer) result;
|
|
96
|
-
}
|
|
97
|
-
return null;
|
|
98
|
-
}
|
|
99
|
-
|
|
100
|
-
}
|
|
@@ -1,27 +0,0 @@
|
|
|
1
|
-
/*
|
|
2
|
-
* Unless explicitly stated otherwise all files in this repository are licensed under the Apache License Version 2.0.
|
|
3
|
-
* This product includes software developed at Datadog (https://www.datadoghq.com/).
|
|
4
|
-
* Copyright 2016-Present Datadog, Inc.
|
|
5
|
-
*/
|
|
6
|
-
package com.ft.sdk.reactnative.sessionreplay.extensions;
|
|
7
|
-
|
|
8
|
-
import com.facebook.react.uimanager.LengthPercentage;
|
|
9
|
-
|
|
10
|
-
public final class LengthPercentageExt {
|
|
11
|
-
|
|
12
|
-
private LengthPercentageExt() {
|
|
13
|
-
// Utility class, prevent instantiation
|
|
14
|
-
}
|
|
15
|
-
|
|
16
|
-
/**
|
|
17
|
-
* Gets the radius value from a LengthPercentage, or returns 0f if the LengthPercentage is null.
|
|
18
|
-
*
|
|
19
|
-
* @param lengthPercentage the LengthPercentage to resolve, can be null
|
|
20
|
-
* @param width the width to resolve against
|
|
21
|
-
* @param height the height to resolve against
|
|
22
|
-
* @return the resolved radius value, or 0f if lengthPercentage is null
|
|
23
|
-
*/
|
|
24
|
-
public static float getRadius(LengthPercentage lengthPercentage, float width, float height) {
|
|
25
|
-
return lengthPercentage != null ? lengthPercentage.resolve(width, height) : 0f;
|
|
26
|
-
}
|
|
27
|
-
}
|
|
@@ -1,116 +0,0 @@
|
|
|
1
|
-
package com.ft.sdk.reactnative.sessionreplay.utils;
|
|
2
|
-
|
|
3
|
-
import android.graphics.drawable.Drawable;
|
|
4
|
-
import android.graphics.drawable.InsetDrawable;
|
|
5
|
-
import android.graphics.drawable.LayerDrawable;
|
|
6
|
-
|
|
7
|
-
import com.ft.sdk.reactnative.sessionreplay.extensions.LengthPercentageExt;
|
|
8
|
-
import com.ft.sdk.reactnative.sessionreplay.mappers.Pair;
|
|
9
|
-
import com.ft.sdk.reactnative.utils.ColorUtils;
|
|
10
|
-
import com.facebook.react.common.annotations.UnstableReactNativeAPI;
|
|
11
|
-
import com.facebook.react.uimanager.Spacing;
|
|
12
|
-
import com.facebook.react.uimanager.drawable.CSSBackgroundDrawable;
|
|
13
|
-
import com.ft.sdk.sessionreplay.model.ShapeBorder;
|
|
14
|
-
import com.ft.sdk.sessionreplay.model.ShapeStyle;
|
|
15
|
-
|
|
16
|
-
public class ReactViewBackgroundDrawableUtils extends DrawableUtils {
|
|
17
|
-
private static final String COLOR_FIELD_NAME = "mColor";
|
|
18
|
-
|
|
19
|
-
private final ReflectionUtils reflectionUtils;
|
|
20
|
-
|
|
21
|
-
public ReactViewBackgroundDrawableUtils() {
|
|
22
|
-
this(new ReflectionUtils());
|
|
23
|
-
}
|
|
24
|
-
|
|
25
|
-
public ReactViewBackgroundDrawableUtils(ReflectionUtils reflectionUtils) {
|
|
26
|
-
this.reflectionUtils = reflectionUtils;
|
|
27
|
-
}
|
|
28
|
-
|
|
29
|
-
@UnstableReactNativeAPI
|
|
30
|
-
@Override
|
|
31
|
-
public Pair<ShapeStyle, ShapeBorder> resolveShapeAndBorder(
|
|
32
|
-
Drawable drawable,
|
|
33
|
-
float opacity,
|
|
34
|
-
float pixelDensity
|
|
35
|
-
) {
|
|
36
|
-
if (!(drawable instanceof CSSBackgroundDrawable)) {
|
|
37
|
-
return new Pair<>(null, null);
|
|
38
|
-
}
|
|
39
|
-
CSSBackgroundDrawable cssDrawable = (CSSBackgroundDrawable) drawable;
|
|
40
|
-
ShapeBorder borderProps = resolveBorder(cssDrawable, pixelDensity);
|
|
41
|
-
Integer backgroundColor = getBackgroundColor(cssDrawable);
|
|
42
|
-
String colorHexString;
|
|
43
|
-
if (backgroundColor != null) {
|
|
44
|
-
colorHexString = ColorUtils.formatAsRgba(backgroundColor);
|
|
45
|
-
} else {
|
|
46
|
-
return new Pair<>(null, borderProps);
|
|
47
|
-
}
|
|
48
|
-
return new Pair<>(
|
|
49
|
-
new ShapeStyle(
|
|
50
|
-
colorHexString,
|
|
51
|
-
opacity,
|
|
52
|
-
getBorderRadius(cssDrawable)
|
|
53
|
-
),
|
|
54
|
-
borderProps
|
|
55
|
-
);
|
|
56
|
-
}
|
|
57
|
-
|
|
58
|
-
@UnstableReactNativeAPI
|
|
59
|
-
@Override
|
|
60
|
-
public Drawable getReactBackgroundFromDrawable(Drawable drawable) {
|
|
61
|
-
if (drawable instanceof CSSBackgroundDrawable) {
|
|
62
|
-
return drawable;
|
|
63
|
-
} else if (drawable instanceof InsetDrawable) {
|
|
64
|
-
return getReactBackgroundFromDrawable(((InsetDrawable) drawable).getDrawable());
|
|
65
|
-
} else if (drawable instanceof LayerDrawable) {
|
|
66
|
-
return getDrawableFromLayerDrawable((LayerDrawable) drawable);
|
|
67
|
-
} else {
|
|
68
|
-
return null;
|
|
69
|
-
}
|
|
70
|
-
}
|
|
71
|
-
|
|
72
|
-
@UnstableReactNativeAPI
|
|
73
|
-
private Drawable getDrawableFromLayerDrawable(LayerDrawable layerDrawable) {
|
|
74
|
-
for (int layerNumber = 0; layerNumber < layerDrawable.getNumberOfLayers(); layerNumber++) {
|
|
75
|
-
Drawable layer = layerDrawable.getDrawable(layerNumber);
|
|
76
|
-
if (layer instanceof CSSBackgroundDrawable) {
|
|
77
|
-
return layer;
|
|
78
|
-
}
|
|
79
|
-
}
|
|
80
|
-
return null;
|
|
81
|
-
}
|
|
82
|
-
|
|
83
|
-
@UnstableReactNativeAPI
|
|
84
|
-
private float getBorderRadius(CSSBackgroundDrawable drawable) {
|
|
85
|
-
float width = (float) drawable.getIntrinsicWidth();
|
|
86
|
-
float height = (float) drawable.getIntrinsicHeight();
|
|
87
|
-
if (drawable.getBorderRadius().getUniform() != null) {
|
|
88
|
-
return LengthPercentageExt.getRadius(drawable.getBorderRadius().getUniform(), width, height);
|
|
89
|
-
} else {
|
|
90
|
-
return 0f;
|
|
91
|
-
}
|
|
92
|
-
}
|
|
93
|
-
|
|
94
|
-
@UnstableReactNativeAPI
|
|
95
|
-
private Integer getBackgroundColor(CSSBackgroundDrawable backgroundDrawable) {
|
|
96
|
-
Object value = reflectionUtils.getDeclaredField(
|
|
97
|
-
backgroundDrawable,
|
|
98
|
-
COLOR_FIELD_NAME
|
|
99
|
-
);
|
|
100
|
-
return value instanceof Integer ? (Integer) value : null;
|
|
101
|
-
}
|
|
102
|
-
|
|
103
|
-
@UnstableReactNativeAPI
|
|
104
|
-
private ShapeBorder resolveBorder(
|
|
105
|
-
CSSBackgroundDrawable backgroundDrawable,
|
|
106
|
-
float pixelDensity
|
|
107
|
-
) {
|
|
108
|
-
long borderWidth = (long) (backgroundDrawable.getFullBorderWidth() / pixelDensity);
|
|
109
|
-
String borderColor = ColorUtils.formatAsRgba(backgroundDrawable.getBorderColor(Spacing.ALL));
|
|
110
|
-
return new ShapeBorder(
|
|
111
|
-
borderColor,
|
|
112
|
-
borderWidth
|
|
113
|
-
);
|
|
114
|
-
}
|
|
115
|
-
|
|
116
|
-
}
|
|
@@ -1,38 +0,0 @@
|
|
|
1
|
-
/*
|
|
2
|
-
* Unless explicitly stated otherwise all files in this repository are licensed under the Apache License Version 2.0.
|
|
3
|
-
* This product includes software developed at Datadog (https://www.datadoghq.com/).
|
|
4
|
-
* Copyright 2016-Present Datadog, Inc.
|
|
5
|
-
*/
|
|
6
|
-
package com.ft.sdk.reactnative.sessionreplay.extensions;
|
|
7
|
-
|
|
8
|
-
import com.facebook.react.uimanager.LengthPercentage;
|
|
9
|
-
import com.facebook.react.uimanager.style.CornerRadii;
|
|
10
|
-
|
|
11
|
-
public final class LengthPercentageExt {
|
|
12
|
-
|
|
13
|
-
private LengthPercentageExt() {
|
|
14
|
-
// Utility class, prevent instantiation
|
|
15
|
-
}
|
|
16
|
-
|
|
17
|
-
/**
|
|
18
|
-
* Gets the average radius value from a LengthPercentage, or returns 0f if the LengthPercentage is null.
|
|
19
|
-
* The radius is calculated as the average of horizontal and vertical values.
|
|
20
|
-
*
|
|
21
|
-
* @param lengthPercentage the LengthPercentage to resolve, can be null
|
|
22
|
-
* @param width the width to resolve against
|
|
23
|
-
* @param height the height to resolve against
|
|
24
|
-
* @return the average radius value, or 0f if lengthPercentage is null
|
|
25
|
-
*/
|
|
26
|
-
public static float getRadius(LengthPercentage lengthPercentage, float width, float height) {
|
|
27
|
-
if (lengthPercentage == null) {
|
|
28
|
-
return 0f;
|
|
29
|
-
}
|
|
30
|
-
|
|
31
|
-
CornerRadii value = lengthPercentage.resolve(width, height);
|
|
32
|
-
if (value == null) {
|
|
33
|
-
return 0f;
|
|
34
|
-
}
|
|
35
|
-
|
|
36
|
-
return (value.getHorizontal() + value.getVertical()) / 2f;
|
|
37
|
-
}
|
|
38
|
-
}
|
|
@@ -1,117 +0,0 @@
|
|
|
1
|
-
package com.ft.sdk.reactnative.sessionreplay.utils;
|
|
2
|
-
|
|
3
|
-
import android.graphics.drawable.Drawable;
|
|
4
|
-
import android.graphics.drawable.InsetDrawable;
|
|
5
|
-
import android.graphics.drawable.LayerDrawable;
|
|
6
|
-
|
|
7
|
-
import com.ft.sdk.reactnative.sessionreplay.extensions.LengthPercentageExt;
|
|
8
|
-
import com.ft.sdk.reactnative.sessionreplay.mappers.Pair;
|
|
9
|
-
import com.ft.sdk.reactnative.utils.ColorUtils;
|
|
10
|
-
import com.facebook.react.common.annotations.UnstableReactNativeAPI;
|
|
11
|
-
import com.facebook.react.uimanager.Spacing;
|
|
12
|
-
import com.facebook.react.uimanager.drawable.CSSBackgroundDrawable;
|
|
13
|
-
import com.ft.sdk.sessionreplay.model.ShapeBorder;
|
|
14
|
-
import com.ft.sdk.sessionreplay.model.ShapeStyle;
|
|
15
|
-
|
|
16
|
-
public class ReactViewBackgroundDrawableUtils extends DrawableUtils {
|
|
17
|
-
private static final String COLOR_FIELD_NAME = "mColor";
|
|
18
|
-
|
|
19
|
-
private final ReflectionUtils reflectionUtils;
|
|
20
|
-
|
|
21
|
-
public ReactViewBackgroundDrawableUtils() {
|
|
22
|
-
this(new ReflectionUtils());
|
|
23
|
-
}
|
|
24
|
-
|
|
25
|
-
public ReactViewBackgroundDrawableUtils(ReflectionUtils reflectionUtils) {
|
|
26
|
-
this.reflectionUtils = reflectionUtils;
|
|
27
|
-
}
|
|
28
|
-
|
|
29
|
-
@UnstableReactNativeAPI
|
|
30
|
-
@Override
|
|
31
|
-
public Pair<ShapeStyle, ShapeBorder> resolveShapeAndBorder(
|
|
32
|
-
Drawable drawable,
|
|
33
|
-
float opacity,
|
|
34
|
-
float pixelDensity
|
|
35
|
-
) {
|
|
36
|
-
if (!(drawable instanceof CSSBackgroundDrawable)) {
|
|
37
|
-
return new Pair<>(null, null);
|
|
38
|
-
}
|
|
39
|
-
CSSBackgroundDrawable cssDrawable = (CSSBackgroundDrawable) drawable;
|
|
40
|
-
ShapeBorder borderProps = resolveBorder(cssDrawable, pixelDensity);
|
|
41
|
-
Integer backgroundColor = getBackgroundColor(cssDrawable);
|
|
42
|
-
String colorHexString;
|
|
43
|
-
if (backgroundColor != null) {
|
|
44
|
-
colorHexString = ColorUtils.formatAsRgba(backgroundColor);
|
|
45
|
-
} else {
|
|
46
|
-
return new Pair<>(null, borderProps);
|
|
47
|
-
}
|
|
48
|
-
return new Pair<>(
|
|
49
|
-
new ShapeStyle(
|
|
50
|
-
colorHexString,
|
|
51
|
-
opacity,
|
|
52
|
-
getBorderRadius(cssDrawable)
|
|
53
|
-
),
|
|
54
|
-
borderProps
|
|
55
|
-
);
|
|
56
|
-
}
|
|
57
|
-
|
|
58
|
-
@UnstableReactNativeAPI
|
|
59
|
-
@Override
|
|
60
|
-
public Drawable getReactBackgroundFromDrawable(Drawable drawable) {
|
|
61
|
-
if (drawable instanceof CSSBackgroundDrawable) {
|
|
62
|
-
return drawable;
|
|
63
|
-
} else if (drawable instanceof InsetDrawable) {
|
|
64
|
-
return getReactBackgroundFromDrawable(((InsetDrawable) drawable).getDrawable());
|
|
65
|
-
} else if (drawable instanceof LayerDrawable) {
|
|
66
|
-
return getDrawableFromLayerDrawable((LayerDrawable) drawable);
|
|
67
|
-
} else {
|
|
68
|
-
return null;
|
|
69
|
-
}
|
|
70
|
-
}
|
|
71
|
-
|
|
72
|
-
@UnstableReactNativeAPI
|
|
73
|
-
private Drawable getDrawableFromLayerDrawable(LayerDrawable layerDrawable) {
|
|
74
|
-
for (int layerNumber = 0; layerNumber < layerDrawable.getNumberOfLayers(); layerNumber++) {
|
|
75
|
-
Drawable layer = layerDrawable.getDrawable(layerNumber);
|
|
76
|
-
if (layer instanceof CSSBackgroundDrawable) {
|
|
77
|
-
return layer;
|
|
78
|
-
}
|
|
79
|
-
}
|
|
80
|
-
return null;
|
|
81
|
-
}
|
|
82
|
-
|
|
83
|
-
@UnstableReactNativeAPI
|
|
84
|
-
private float getBorderRadius(CSSBackgroundDrawable drawable) {
|
|
85
|
-
float width = (float) drawable.getIntrinsicWidth();
|
|
86
|
-
float height = (float) drawable.getIntrinsicHeight();
|
|
87
|
-
|
|
88
|
-
if (drawable.getBorderRadius().getUniform() != null) {
|
|
89
|
-
return LengthPercentageExt.getRadius(drawable.getBorderRadius().getUniform(), width, height);
|
|
90
|
-
} else {
|
|
91
|
-
return 0f;
|
|
92
|
-
}
|
|
93
|
-
}
|
|
94
|
-
|
|
95
|
-
@UnstableReactNativeAPI
|
|
96
|
-
private Integer getBackgroundColor(CSSBackgroundDrawable backgroundDrawable) {
|
|
97
|
-
Object value = reflectionUtils.getDeclaredField(
|
|
98
|
-
backgroundDrawable,
|
|
99
|
-
COLOR_FIELD_NAME
|
|
100
|
-
);
|
|
101
|
-
return value instanceof Integer ? (Integer) value : null;
|
|
102
|
-
}
|
|
103
|
-
|
|
104
|
-
@UnstableReactNativeAPI
|
|
105
|
-
private ShapeBorder resolveBorder(
|
|
106
|
-
CSSBackgroundDrawable backgroundDrawable,
|
|
107
|
-
float pixelDensity
|
|
108
|
-
) {
|
|
109
|
-
long borderWidth = (long) (backgroundDrawable.getFullBorderWidth() / pixelDensity);
|
|
110
|
-
String borderColor = ColorUtils.formatAsRgba(backgroundDrawable.getBorderColor(Spacing.ALL));
|
|
111
|
-
return new ShapeBorder(
|
|
112
|
-
borderColor,
|
|
113
|
-
borderWidth
|
|
114
|
-
);
|
|
115
|
-
}
|
|
116
|
-
|
|
117
|
-
}
|
|
@@ -1,38 +0,0 @@
|
|
|
1
|
-
/*
|
|
2
|
-
* Unless explicitly stated otherwise all files in this repository are licensed under the Apache License Version 2.0.
|
|
3
|
-
* This product includes software developed at Datadog (https://www.datadoghq.com/).
|
|
4
|
-
* Copyright 2016-Present Datadog, Inc.
|
|
5
|
-
*/
|
|
6
|
-
package com.ft.sdk.reactnative.sessionreplay.extensions;
|
|
7
|
-
|
|
8
|
-
import com.facebook.react.uimanager.LengthPercentage;
|
|
9
|
-
import com.facebook.react.uimanager.style.CornerRadii;
|
|
10
|
-
|
|
11
|
-
public final class LengthPercentageExt {
|
|
12
|
-
|
|
13
|
-
private LengthPercentageExt() {
|
|
14
|
-
// Utility class, prevent instantiation
|
|
15
|
-
}
|
|
16
|
-
|
|
17
|
-
/**
|
|
18
|
-
* Gets the average radius value from a LengthPercentage, or returns 0f if the LengthPercentage is null.
|
|
19
|
-
* The radius is calculated as the average of horizontal and vertical values.
|
|
20
|
-
*
|
|
21
|
-
* @param lengthPercentage the LengthPercentage to resolve, can be null
|
|
22
|
-
* @param width the width to resolve against
|
|
23
|
-
* @param height the height to resolve against
|
|
24
|
-
* @return the average radius value, or 0f if lengthPercentage is null
|
|
25
|
-
*/
|
|
26
|
-
public static float getRadius(LengthPercentage lengthPercentage, float width, float height) {
|
|
27
|
-
if (lengthPercentage == null) {
|
|
28
|
-
return 0f;
|
|
29
|
-
}
|
|
30
|
-
|
|
31
|
-
CornerRadii value = lengthPercentage.resolve(width, height);
|
|
32
|
-
if (value == null) {
|
|
33
|
-
return 0f;
|
|
34
|
-
}
|
|
35
|
-
|
|
36
|
-
return (value.getHorizontal() + value.getVertical()) / 2f;
|
|
37
|
-
}
|
|
38
|
-
}
|
|
@@ -1,132 +0,0 @@
|
|
|
1
|
-
/*
|
|
2
|
-
* Unless explicitly stated otherwise all files in this repository are licensed under the Apache License Version 2.0.
|
|
3
|
-
* This product includes software developed at Datadog (https://www.datadoghq.com/).
|
|
4
|
-
* Copyright 2016-Present Datadog, Inc.
|
|
5
|
-
*/
|
|
6
|
-
package com.ft.sdk.reactnative.sessionreplay.utils;
|
|
7
|
-
|
|
8
|
-
import android.graphics.drawable.Drawable;
|
|
9
|
-
import android.graphics.drawable.InsetDrawable;
|
|
10
|
-
import android.graphics.drawable.LayerDrawable;
|
|
11
|
-
|
|
12
|
-
import com.ft.sdk.reactnative.sessionreplay.extensions.LengthPercentageExt;
|
|
13
|
-
import com.ft.sdk.reactnative.sessionreplay.mappers.Pair;
|
|
14
|
-
import com.ft.sdk.reactnative.utils.ColorUtils;
|
|
15
|
-
import com.facebook.react.common.annotations.UnstableReactNativeAPI;
|
|
16
|
-
import com.facebook.react.uimanager.LengthPercentage;
|
|
17
|
-
import com.facebook.react.uimanager.Spacing;
|
|
18
|
-
import com.facebook.react.uimanager.drawable.CSSBackgroundDrawable;
|
|
19
|
-
import com.ft.sdk.sessionreplay.model.ShapeBorder;
|
|
20
|
-
import com.ft.sdk.sessionreplay.model.ShapeStyle;
|
|
21
|
-
|
|
22
|
-
public class ReactViewBackgroundDrawableUtils extends DrawableUtils {
|
|
23
|
-
private static final String COLOR_FIELD_NAME = "mColor";
|
|
24
|
-
private static final String UNIFORM_FIELD_NAME = "uniform";
|
|
25
|
-
private final ReflectionUtils reflectionUtils;
|
|
26
|
-
|
|
27
|
-
public ReactViewBackgroundDrawableUtils() {
|
|
28
|
-
this(new ReflectionUtils());
|
|
29
|
-
}
|
|
30
|
-
|
|
31
|
-
public ReactViewBackgroundDrawableUtils(ReflectionUtils reflectionUtils) {
|
|
32
|
-
this.reflectionUtils = reflectionUtils;
|
|
33
|
-
}
|
|
34
|
-
|
|
35
|
-
@UnstableReactNativeAPI
|
|
36
|
-
@Override
|
|
37
|
-
public Pair<ShapeStyle, ShapeBorder> resolveShapeAndBorder(
|
|
38
|
-
Drawable drawable,
|
|
39
|
-
float opacity,
|
|
40
|
-
float pixelDensity
|
|
41
|
-
) {
|
|
42
|
-
if (!(drawable instanceof CSSBackgroundDrawable)) {
|
|
43
|
-
return new Pair<>(null, null);
|
|
44
|
-
}
|
|
45
|
-
CSSBackgroundDrawable cssDrawable = (CSSBackgroundDrawable) drawable;
|
|
46
|
-
ShapeBorder borderProps = resolveBorder(cssDrawable, pixelDensity);
|
|
47
|
-
Integer backgroundColor = getBackgroundColor(cssDrawable);
|
|
48
|
-
String colorHexString;
|
|
49
|
-
if (backgroundColor != null) {
|
|
50
|
-
colorHexString = ColorUtils.formatAsRgba(backgroundColor);
|
|
51
|
-
} else {
|
|
52
|
-
return new Pair<>(null, borderProps);
|
|
53
|
-
}
|
|
54
|
-
return new Pair<>(
|
|
55
|
-
new ShapeStyle(
|
|
56
|
-
colorHexString,
|
|
57
|
-
opacity,
|
|
58
|
-
getBorderRadius(cssDrawable)
|
|
59
|
-
),
|
|
60
|
-
borderProps
|
|
61
|
-
);
|
|
62
|
-
}
|
|
63
|
-
|
|
64
|
-
@UnstableReactNativeAPI
|
|
65
|
-
@Override
|
|
66
|
-
public Drawable getReactBackgroundFromDrawable(Drawable drawable) {
|
|
67
|
-
if (drawable instanceof CSSBackgroundDrawable) {
|
|
68
|
-
return drawable;
|
|
69
|
-
} else if (drawable instanceof InsetDrawable) {
|
|
70
|
-
return getReactBackgroundFromDrawable(((InsetDrawable) drawable).getDrawable());
|
|
71
|
-
} else if (drawable instanceof LayerDrawable) {
|
|
72
|
-
return getDrawableFromLayerDrawable((LayerDrawable) drawable);
|
|
73
|
-
} else {
|
|
74
|
-
return null;
|
|
75
|
-
}
|
|
76
|
-
}
|
|
77
|
-
|
|
78
|
-
@UnstableReactNativeAPI
|
|
79
|
-
private Drawable getDrawableFromLayerDrawable(LayerDrawable layerDrawable) {
|
|
80
|
-
for (int layerNumber = 0; layerNumber < layerDrawable.getNumberOfLayers(); layerNumber++) {
|
|
81
|
-
Drawable layer = layerDrawable.getDrawable(layerNumber);
|
|
82
|
-
if (layer instanceof CSSBackgroundDrawable) {
|
|
83
|
-
return layer;
|
|
84
|
-
}
|
|
85
|
-
}
|
|
86
|
-
return null;
|
|
87
|
-
}
|
|
88
|
-
|
|
89
|
-
@UnstableReactNativeAPI
|
|
90
|
-
private float getBorderRadius(CSSBackgroundDrawable drawable) {
|
|
91
|
-
float width = (float) drawable.getIntrinsicWidth();
|
|
92
|
-
float height = (float) drawable.getIntrinsicHeight();
|
|
93
|
-
LengthPercentage uniform = getBorderRadiusUniform(drawable);
|
|
94
|
-
if (uniform != null) {
|
|
95
|
-
return LengthPercentageExt.getRadius(uniform, width, height);
|
|
96
|
-
} else {
|
|
97
|
-
return 0f;
|
|
98
|
-
}
|
|
99
|
-
}
|
|
100
|
-
|
|
101
|
-
@UnstableReactNativeAPI
|
|
102
|
-
private LengthPercentage getBorderRadiusUniform(CSSBackgroundDrawable drawable) {
|
|
103
|
-
Object value = reflectionUtils.getDeclaredField(
|
|
104
|
-
drawable.getBorderRadius(),
|
|
105
|
-
UNIFORM_FIELD_NAME
|
|
106
|
-
);
|
|
107
|
-
return value instanceof LengthPercentage ? (LengthPercentage) value : null;
|
|
108
|
-
}
|
|
109
|
-
|
|
110
|
-
@UnstableReactNativeAPI
|
|
111
|
-
private Integer getBackgroundColor(CSSBackgroundDrawable backgroundDrawable) {
|
|
112
|
-
Object value = reflectionUtils.getDeclaredField(
|
|
113
|
-
backgroundDrawable,
|
|
114
|
-
COLOR_FIELD_NAME
|
|
115
|
-
);
|
|
116
|
-
return value instanceof Integer ? (Integer) value : null;
|
|
117
|
-
}
|
|
118
|
-
|
|
119
|
-
@UnstableReactNativeAPI
|
|
120
|
-
private ShapeBorder resolveBorder(
|
|
121
|
-
CSSBackgroundDrawable backgroundDrawable,
|
|
122
|
-
float pixelDensity
|
|
123
|
-
) {
|
|
124
|
-
long borderWidth = (long) (backgroundDrawable.getFullBorderWidth() / pixelDensity);
|
|
125
|
-
String borderColor = ColorUtils.formatAsRgba(backgroundDrawable.getBorderColor(Spacing.ALL));
|
|
126
|
-
return new ShapeBorder(
|
|
127
|
-
borderColor,
|
|
128
|
-
borderWidth
|
|
129
|
-
);
|
|
130
|
-
}
|
|
131
|
-
|
|
132
|
-
}
|