craft-native 0.0.395 → 0.0.408
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 +7 -0
- package/dist/android/templates/CraftBridge.kt.template +2 -0
- package/dist/android/templates/CraftNative.kt.template +7 -0
- package/dist/android/templates/CraftNativeFlatList.kt.template +7 -0
- package/dist/android/templates/CraftNativeMapGoogle.kt.template +3 -0
- package/dist/android/templates/CraftNativeMapLibre.kt.template +3 -0
- package/dist/android/templates/CraftNativeRefreshableFlatList.kt.template +9 -0
- package/dist/android/templates/CraftNativeServices.kt.template +2 -1
- package/dist/android/templates/CraftNativeShell.kt.template +12 -2
- package/dist/android/templates/LocationRecordingService.kt.template +125 -6
- package/dist/android/templates/MainActivityNative.kt.template +338 -21
- package/dist/api/mobile.d.ts +59 -2
- package/dist/cli.js +1 -1
- package/dist/components/index.d.ts +16 -0
- package/dist/index.cjs +54 -7
- package/dist/index.d.cts +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +54 -7
- package/dist/ios/src/index.d.ts +7 -0
- package/dist/ios/templates/CraftApp.swift +268 -12
- package/dist/ios/templates/CraftHybrid.swift +1 -0
- package/dist/ios/templates/CraftNativeActions.swift +3 -1
- package/dist/ios/templates/CraftNativeFlatList.swift +4 -0
- package/dist/ios/templates/CraftNativeMutation.swift +27 -2
- package/dist/ios/templates/CraftNativeScreen.swift +293 -44
- package/dist/ios/templates/CraftNativeUI.swift +89 -0
- package/dist/ios/templates/testing/DriverTests.swift.template +17 -1
- package/dist/macos/src/index.d.ts +14 -3
- package/dist/macos/src/index.js +124 -27
- package/dist/macos/src/toolchain.d.ts +56 -0
- package/dist/macos/templates/CraftMacApplication.swift +54 -9
- package/dist/macos/templates/CraftMacRenderer.swift +376 -18
- package/dist/macos/templates/CraftMacRuntime.swift +114 -1
- package/dist/macos/templates/CraftMacWebView.swift +416 -0
- package/dist/macos/templates/CraftNativeMutation.swift +27 -2
- package/dist/mobile.js +53 -6
- package/package.json +1 -1
|
@@ -366,6 +366,9 @@ private object CraftNativeSkewTransforms {
|
|
|
366
366
|
|
|
367
367
|
/** A DOM-free SVG surface for the geometry emitted by the shared STX native protocol. */
|
|
368
368
|
private class CraftNativeSvgView(context: Context) : View(context) {
|
|
369
|
+
override fun dispatchTouchEvent(event: MotionEvent): Boolean =
|
|
370
|
+
CraftNativePointers.dispatch(this, event) { super.dispatchTouchEvent(it) }
|
|
371
|
+
|
|
369
372
|
var drawing: JSONObject = JSONObject()
|
|
370
373
|
set(value) {
|
|
371
374
|
field = value
|
|
@@ -972,8 +975,184 @@ internal class CraftNativeCelebration(private val view: View) {
|
|
|
972
975
|
}
|
|
973
976
|
}
|
|
974
977
|
|
|
978
|
+
/** Authored nodes are boundaries; native control implementation views are not. */
|
|
979
|
+
internal object CraftNativePointers {
|
|
980
|
+
private data class State(var mode: String? = null, var container: Boolean = false,
|
|
981
|
+
var active: Boolean = false, var cancelled: Boolean = false, var route: List<String> = emptyList())
|
|
982
|
+
private val states = java.util.WeakHashMap<View, State>()
|
|
983
|
+
|
|
984
|
+
fun configure(view: View, props: JSONObject, style: JSONObject, container: Boolean) {
|
|
985
|
+
val raw = if (props.has("pointerEvents") && !props.isNull("pointerEvents")) props.opt("pointerEvents") else style.opt("pointerEvents")
|
|
986
|
+
val state = states.getOrPut(view) { State() }
|
|
987
|
+
state.mode = (raw as? String)?.takeIf { it in setOf("auto", "none", "box-none", "box-only") } ?: "auto"
|
|
988
|
+
state.container = container
|
|
989
|
+
}
|
|
990
|
+
|
|
991
|
+
private fun route(view: View): List<String> {
|
|
992
|
+
val result = mutableListOf<String>()
|
|
993
|
+
var candidate: View? = view
|
|
994
|
+
while (candidate != null) {
|
|
995
|
+
states[candidate]?.mode?.let { result.add(it) }
|
|
996
|
+
candidate = candidate.parent as? View
|
|
997
|
+
}
|
|
998
|
+
return result
|
|
999
|
+
}
|
|
1000
|
+
|
|
1001
|
+
fun ownsTouch(view: View): Boolean = route(view).firstOrNull() !in setOf("none", "box-none")
|
|
1002
|
+
|
|
1003
|
+
fun dispatch(view: View, event: MotionEvent, native: (MotionEvent) -> Boolean): Boolean {
|
|
1004
|
+
val state = states.getOrPut(view) { State() }
|
|
1005
|
+
val route = route(view)
|
|
1006
|
+
if (event.actionMasked == MotionEvent.ACTION_CANCEL) {
|
|
1007
|
+
state.active = false
|
|
1008
|
+
return native(event)
|
|
1009
|
+
}
|
|
1010
|
+
if (event.actionMasked == MotionEvent.ACTION_DOWN) {
|
|
1011
|
+
state.active = false
|
|
1012
|
+
state.cancelled = false
|
|
1013
|
+
state.route = route
|
|
1014
|
+
} else if (state.active && state.route != route) {
|
|
1015
|
+
val cancel = MotionEvent.obtain(event)
|
|
1016
|
+
cancel.action = MotionEvent.ACTION_CANCEL
|
|
1017
|
+
try { native(cancel) } finally { cancel.recycle() }
|
|
1018
|
+
state.active = false
|
|
1019
|
+
state.cancelled = true
|
|
1020
|
+
}
|
|
1021
|
+
if (state.cancelled) return false
|
|
1022
|
+
if (state.mode == "box-only" && event.actionMasked == MotionEvent.ACTION_DOWN &&
|
|
1023
|
+
(event.x < 0 || event.x >= view.width || event.y < 0 || event.y >= view.height)) return false
|
|
1024
|
+
val ancestors = route.drop(1)
|
|
1025
|
+
if ("none" in route || "box-only" in ancestors || (state.mode == "box-none" && !state.container)) return false
|
|
1026
|
+
val handled = native(event) || (state.mode == "box-only" && state.container && view.isEnabled)
|
|
1027
|
+
if (event.actionMasked == MotionEvent.ACTION_DOWN) state.active = handled
|
|
1028
|
+
if (event.actionMasked == MotionEvent.ACTION_UP) state.active = false
|
|
1029
|
+
return handled
|
|
1030
|
+
}
|
|
1031
|
+
}
|
|
1032
|
+
|
|
1033
|
+
internal class CraftNativePointerTextView(context: Context) : TextView(context) {
|
|
1034
|
+
override fun dispatchTouchEvent(event: MotionEvent): Boolean =
|
|
1035
|
+
CraftNativePointers.dispatch(this, event) { super.dispatchTouchEvent(it) }
|
|
1036
|
+
|
|
1037
|
+
}
|
|
1038
|
+
|
|
1039
|
+
internal class CraftNativePointerButton(context: Context) : Button(context) {
|
|
1040
|
+
override fun dispatchTouchEvent(event: MotionEvent): Boolean =
|
|
1041
|
+
CraftNativePointers.dispatch(this, event) { super.dispatchTouchEvent(it) }
|
|
1042
|
+
|
|
1043
|
+
}
|
|
1044
|
+
|
|
1045
|
+
internal class CraftNativePointerCheckBox(context: Context) : CheckBox(context) {
|
|
1046
|
+
override fun dispatchTouchEvent(event: MotionEvent): Boolean =
|
|
1047
|
+
CraftNativePointers.dispatch(this, event) { super.dispatchTouchEvent(it) }
|
|
1048
|
+
|
|
1049
|
+
}
|
|
1050
|
+
|
|
1051
|
+
internal class CraftNativePointerRadioGroup(context: Context) : android.widget.RadioGroup(context) {
|
|
1052
|
+
override fun dispatchTouchEvent(event: MotionEvent): Boolean =
|
|
1053
|
+
CraftNativePointers.dispatch(this, event) { super.dispatchTouchEvent(it) }
|
|
1054
|
+
}
|
|
1055
|
+
|
|
1056
|
+
internal class CraftNativePointerSpinner(context: Context) : Spinner(context) {
|
|
1057
|
+
override fun dispatchTouchEvent(event: MotionEvent): Boolean =
|
|
1058
|
+
CraftNativePointers.dispatch(this, event) { super.dispatchTouchEvent(it) }
|
|
1059
|
+
|
|
1060
|
+
}
|
|
1061
|
+
|
|
1062
|
+
internal class CraftNativePointerSwitch(context: Context) : Switch(context) {
|
|
1063
|
+
override fun dispatchTouchEvent(event: MotionEvent): Boolean =
|
|
1064
|
+
CraftNativePointers.dispatch(this, event) { super.dispatchTouchEvent(it) }
|
|
1065
|
+
|
|
1066
|
+
}
|
|
1067
|
+
|
|
1068
|
+
internal class CraftNativePointerSeekBar(context: Context) : SeekBar(context) {
|
|
1069
|
+
override fun dispatchTouchEvent(event: MotionEvent): Boolean =
|
|
1070
|
+
CraftNativePointers.dispatch(this, event) { super.dispatchTouchEvent(it) }
|
|
1071
|
+
|
|
1072
|
+
}
|
|
1073
|
+
|
|
1074
|
+
internal class CraftNativePointerImageView(context: Context) : ImageView(context) {
|
|
1075
|
+
private var objectFit: String? = null
|
|
1076
|
+
private var objectX = 0.5f
|
|
1077
|
+
private var objectY = 0.5f
|
|
1078
|
+
|
|
1079
|
+
fun configureObjectGeometry(props: JSONObject, style: JSONObject) {
|
|
1080
|
+
fun value(name: String): Any? = props.opt(name)?.takeUnless { it == JSONObject.NULL }
|
|
1081
|
+
?: style.opt(name)?.takeUnless { it == JSONObject.NULL }
|
|
1082
|
+
val fit = value("objectFit")
|
|
1083
|
+
val position = value("objectPosition")
|
|
1084
|
+
objectFit = if (fit != null || position != null) (fit as? String)
|
|
1085
|
+
?.takeIf { it in setOf("fill", "contain", "cover", "none", "scale-down") } ?: "fill" else null
|
|
1086
|
+
val point = parsePosition(position)
|
|
1087
|
+
objectX = point.first; objectY = point.second
|
|
1088
|
+
cropToPadding = objectFit != null
|
|
1089
|
+
updateObjectGeometry()
|
|
1090
|
+
}
|
|
1091
|
+
|
|
1092
|
+
private fun parsePosition(raw: Any?): Pair<Float, Float> {
|
|
1093
|
+
val center = 0.5f to 0.5f
|
|
1094
|
+
val text = (raw as? String)?.trim()?.lowercase() ?: return center
|
|
1095
|
+
var parts = text.split(Regex("\\s+"))
|
|
1096
|
+
if (parts.size !in 1..2) return center
|
|
1097
|
+
if (parts.size == 1) parts = if (parts[0] in setOf("top", "bottom")) listOf("center", parts[0]) else listOf(parts[0], "center")
|
|
1098
|
+
else if (parts[0] in setOf("top", "bottom") || parts[1] in setOf("left", "right")) parts = parts.reversed()
|
|
1099
|
+
fun fraction(part: String, low: String, high: String): Float? = when (part) {
|
|
1100
|
+
low -> 0f; high -> 1f; "center" -> 0.5f
|
|
1101
|
+
else -> if (part.endsWith("%")) part.dropLast(1).toFloatOrNull()?.takeIf { it.isFinite() }?.div(100f) else null
|
|
1102
|
+
}
|
|
1103
|
+
return (fraction(parts[0], "left", "right") ?: return center) to (fraction(parts[1], "top", "bottom") ?: return center)
|
|
1104
|
+
}
|
|
1105
|
+
|
|
1106
|
+
override fun setImageDrawable(drawable: android.graphics.drawable.Drawable?) {
|
|
1107
|
+
super.setImageDrawable(drawable)
|
|
1108
|
+
updateObjectGeometry()
|
|
1109
|
+
}
|
|
1110
|
+
|
|
1111
|
+
override fun onSizeChanged(w: Int, h: Int, oldw: Int, oldh: Int) {
|
|
1112
|
+
super.onSizeChanged(w, h, oldw, oldh)
|
|
1113
|
+
updateObjectGeometry()
|
|
1114
|
+
}
|
|
1115
|
+
|
|
1116
|
+
override fun onLayout(changed: Boolean, left: Int, top: Int, right: Int, bottom: Int) {
|
|
1117
|
+
super.onLayout(changed, left, top, right, bottom)
|
|
1118
|
+
updateObjectGeometry()
|
|
1119
|
+
}
|
|
1120
|
+
|
|
1121
|
+
private fun updateObjectGeometry() {
|
|
1122
|
+
val fit = objectFit ?: return
|
|
1123
|
+
val source = drawable ?: return
|
|
1124
|
+
val sw = source.intrinsicWidth.toFloat(); val sh = source.intrinsicHeight.toFloat()
|
|
1125
|
+
if (sw <= 0 || sh <= 0) return
|
|
1126
|
+
val w = (width - paddingLeft - paddingRight).coerceAtLeast(0).toFloat()
|
|
1127
|
+
val h = (height - paddingTop - paddingBottom).coerceAtLeast(0).toFloat()
|
|
1128
|
+
val contain = minOf(w / sw, h / sh)
|
|
1129
|
+
val scale = when (fit) {
|
|
1130
|
+
"cover" -> maxOf(w / sw, h / sh)
|
|
1131
|
+
"none" -> 1f
|
|
1132
|
+
"scale-down" -> minOf(1f, contain)
|
|
1133
|
+
else -> contain
|
|
1134
|
+
}
|
|
1135
|
+
val sx = if (fit == "fill") w / sw else scale
|
|
1136
|
+
val sy = if (fit == "fill") h / sh else scale
|
|
1137
|
+
scaleType = ScaleType.MATRIX
|
|
1138
|
+
imageMatrix = Matrix().apply {
|
|
1139
|
+
setScale(sx, sy)
|
|
1140
|
+
postTranslate((w - sw * sx) * objectX, (h - sh * sy) * objectY)
|
|
1141
|
+
}
|
|
1142
|
+
}
|
|
1143
|
+
|
|
1144
|
+
override fun dispatchTouchEvent(event: MotionEvent): Boolean =
|
|
1145
|
+
CraftNativePointers.dispatch(this, event) { super.dispatchTouchEvent(it) }
|
|
1146
|
+
|
|
1147
|
+
}
|
|
1148
|
+
|
|
975
1149
|
/** A deterministic flex-shaped container shared by normal views and scroll content. */
|
|
976
1150
|
internal class CraftNativeFlexLayout(context: Context) : LinearLayout(context) {
|
|
1151
|
+
override fun onInterceptTouchEvent(event: MotionEvent): Boolean =
|
|
1152
|
+
CraftNativePointers.ownsTouch(this) && super.onInterceptTouchEvent(event)
|
|
1153
|
+
override fun onTouchEvent(event: MotionEvent): Boolean =
|
|
1154
|
+
(event.actionMasked == MotionEvent.ACTION_CANCEL || CraftNativePointers.ownsTouch(this)) && super.onTouchEvent(event)
|
|
1155
|
+
|
|
977
1156
|
private var celebration: CraftNativeCelebration? = null
|
|
978
1157
|
fun configureCelebration(raw: JSONObject?, radius: Float) {
|
|
979
1158
|
if (raw != null && celebration == null) celebration = CraftNativeCelebration(this)
|
|
@@ -1012,10 +1191,76 @@ internal class CraftNativeFlexLayout(context: Context) : LinearLayout(context) {
|
|
|
1012
1191
|
private var safeAreaPadding = intArrayOf(0, 0, 0, 0)
|
|
1013
1192
|
private var applyingPadding = false
|
|
1014
1193
|
private var safeAreaEdges = setOf("top", "right", "bottom", "left")
|
|
1194
|
+
private var overflowTouchTarget: View? = null
|
|
1195
|
+
|
|
1196
|
+
private fun childEvent(child: View, event: MotionEvent): MotionEvent = MotionEvent.obtain(event).also {
|
|
1197
|
+
it.offsetLocation((scrollX - child.left).toFloat(), (scrollY - child.top).toFloat())
|
|
1198
|
+
if (!child.matrix.isIdentity) {
|
|
1199
|
+
val inverse = android.graphics.Matrix()
|
|
1200
|
+
if (child.matrix.invert(inverse)) it.transform(inverse)
|
|
1201
|
+
}
|
|
1202
|
+
}
|
|
1203
|
+
|
|
1204
|
+
private fun overflowContains(group: ViewGroup, x: Float, y: Float): Boolean {
|
|
1205
|
+
if (group.clipChildren) return false
|
|
1206
|
+
for (index in group.childCount - 1 downTo 0) {
|
|
1207
|
+
val child = group.getChildAt(index)
|
|
1208
|
+
if (child.visibility != View.VISIBLE || child.alpha <= 0.01f) continue
|
|
1209
|
+
val point = floatArrayOf(x + group.scrollX - child.left, y + group.scrollY - child.top)
|
|
1210
|
+
val inverse = android.graphics.Matrix()
|
|
1211
|
+
if (!child.matrix.isIdentity && child.matrix.invert(inverse)) inverse.mapPoints(point)
|
|
1212
|
+
if (point[0] >= 0 && point[0] < child.width && point[1] >= 0 && point[1] < child.height) return true
|
|
1213
|
+
if (child is ViewGroup && overflowContains(child, point[0], point[1])) return true
|
|
1214
|
+
}
|
|
1215
|
+
return false
|
|
1216
|
+
}
|
|
1217
|
+
|
|
1218
|
+
// Android normally rejects a zero-height child's entire subtree before
|
|
1219
|
+
// dispatch, even when it draws outside that box. Only that overflow path
|
|
1220
|
+
// needs routing here; ordinary gestures stay in ViewGroup's dispatcher.
|
|
1221
|
+
private fun dispatchOverflow(event: MotionEvent): Boolean? {
|
|
1222
|
+
if (event.actionMasked == MotionEvent.ACTION_DOWN) {
|
|
1223
|
+
overflowTouchTarget = null
|
|
1224
|
+
val children = (0 until childCount).map { getChildAt(it) }
|
|
1225
|
+
.filter { it.visibility == View.VISIBLE && it.alpha > 0.01f }
|
|
1226
|
+
.sortedBy { it.z }.reversed()
|
|
1227
|
+
val reachesOverflow = children.any { child ->
|
|
1228
|
+
val local = childEvent(child, event)
|
|
1229
|
+
try {
|
|
1230
|
+
child is ViewGroup && (local.x < 0 || local.x >= child.width || local.y < 0 || local.y >= child.height) &&
|
|
1231
|
+
overflowContains(child, local.x, local.y)
|
|
1232
|
+
} finally { local.recycle() }
|
|
1233
|
+
}
|
|
1234
|
+
if (!reachesOverflow) return null
|
|
1235
|
+
for (child in children) {
|
|
1236
|
+
val local = childEvent(child, event)
|
|
1237
|
+
try {
|
|
1238
|
+
val inside = local.x >= 0 && local.x < child.width && local.y >= 0 && local.y < child.height
|
|
1239
|
+
if ((inside || (child is ViewGroup && overflowContains(child, local.x, local.y))) && child.dispatchTouchEvent(local)) {
|
|
1240
|
+
overflowTouchTarget = child
|
|
1241
|
+
return true
|
|
1242
|
+
}
|
|
1243
|
+
} finally { local.recycle() }
|
|
1244
|
+
}
|
|
1245
|
+
return null
|
|
1246
|
+
}
|
|
1247
|
+
val target = overflowTouchTarget ?: return null
|
|
1248
|
+
val local = childEvent(target, event)
|
|
1249
|
+
try {
|
|
1250
|
+
if (target.parent !== this) local.action = MotionEvent.ACTION_CANCEL
|
|
1251
|
+
target.dispatchTouchEvent(local)
|
|
1252
|
+
if (local.actionMasked == MotionEvent.ACTION_UP || local.actionMasked == MotionEvent.ACTION_CANCEL) overflowTouchTarget = null
|
|
1253
|
+
return true
|
|
1254
|
+
} finally { local.recycle() }
|
|
1255
|
+
}
|
|
1256
|
+
|
|
1015
1257
|
private var shieldedModalTouch = false
|
|
1016
1258
|
private var dismissibleModalTouch: CraftNativeModalView? = null
|
|
1017
1259
|
|
|
1018
|
-
override fun dispatchTouchEvent(event: MotionEvent): Boolean
|
|
1260
|
+
override fun dispatchTouchEvent(event: MotionEvent): Boolean =
|
|
1261
|
+
CraftNativePointers.dispatch(this, event) { dispatchNativeTouchEvent(it) }
|
|
1262
|
+
|
|
1263
|
+
private fun dispatchNativeTouchEvent(event: MotionEvent): Boolean {
|
|
1019
1264
|
if (event.actionMasked == MotionEvent.ACTION_DOWN) {
|
|
1020
1265
|
val x = event.x.roundToInt()
|
|
1021
1266
|
val y = event.y.roundToInt()
|
|
@@ -1023,12 +1268,12 @@ internal class CraftNativeFlexLayout(context: Context) : LinearLayout(context) {
|
|
|
1023
1268
|
.map { getChildAt(it) }
|
|
1024
1269
|
.filterIsInstance<CraftNativeModalView>()
|
|
1025
1270
|
.firstOrNull { child ->
|
|
1026
|
-
child.dismissOnOutsideTap && child.visibility == View.VISIBLE && child.alpha > 0.01f
|
|
1271
|
+
CraftNativePointers.ownsTouch(child) && child.dismissOnOutsideTap && child.visibility == View.VISIBLE && child.alpha > 0.01f
|
|
1027
1272
|
&& (x < child.left || x >= child.right || y < child.top || y >= child.bottom)
|
|
1028
1273
|
}
|
|
1029
1274
|
shieldedModalTouch = (childCount - 1 downTo 0).any { index ->
|
|
1030
1275
|
val child = getChildAt(index)
|
|
1031
|
-
child is CraftNativeModalView && !child.blocksBackground && child.visibility == View.VISIBLE
|
|
1276
|
+
child is CraftNativeModalView && CraftNativePointers.ownsTouch(child) && !child.blocksBackground && child.visibility == View.VISIBLE
|
|
1032
1277
|
&& (x < child.left || x >= child.right || y < child.top || y >= child.bottom)
|
|
1033
1278
|
&& child.hasBlockingModalBelow()
|
|
1034
1279
|
}
|
|
@@ -1046,6 +1291,7 @@ internal class CraftNativeFlexLayout(context: Context) : LinearLayout(context) {
|
|
|
1046
1291
|
if (event.actionMasked == MotionEvent.ACTION_UP || event.actionMasked == MotionEvent.ACTION_CANCEL) shieldedModalTouch = false
|
|
1047
1292
|
return true
|
|
1048
1293
|
}
|
|
1294
|
+
dispatchOverflow(event)?.let { return it }
|
|
1049
1295
|
return super.dispatchTouchEvent(event)
|
|
1050
1296
|
}
|
|
1051
1297
|
|
|
@@ -2328,7 +2574,15 @@ internal class CraftNativeFlexLayout(context: Context) : LinearLayout(context) {
|
|
|
2328
2574
|
|
|
2329
2575
|
/** An image-backed flex container with ordinary native children over the image. */
|
|
2330
2576
|
private class CraftNativeImageBackgroundView(context: Context) : FrameLayout(context) {
|
|
2331
|
-
|
|
2577
|
+
override fun onInterceptTouchEvent(event: MotionEvent): Boolean =
|
|
2578
|
+
CraftNativePointers.ownsTouch(this) && super.onInterceptTouchEvent(event)
|
|
2579
|
+
override fun onTouchEvent(event: MotionEvent): Boolean =
|
|
2580
|
+
(event.actionMasked == MotionEvent.ACTION_CANCEL || CraftNativePointers.ownsTouch(this)) && super.onTouchEvent(event)
|
|
2581
|
+
|
|
2582
|
+
override fun dispatchTouchEvent(event: MotionEvent): Boolean =
|
|
2583
|
+
CraftNativePointers.dispatch(this, event) { super.dispatchTouchEvent(it) }
|
|
2584
|
+
|
|
2585
|
+
val image = CraftNativePointerImageView(context)
|
|
2332
2586
|
val content = CraftNativeFlexLayout(context)
|
|
2333
2587
|
|
|
2334
2588
|
init {
|
|
@@ -2342,6 +2596,14 @@ private class CraftNativeImageBackgroundView(context: Context) : FrameLayout(con
|
|
|
2342
2596
|
|
|
2343
2597
|
/** A flex container that responds to the activity's IME inset. */
|
|
2344
2598
|
private class CraftNativeKeyboardAvoidingView(context: Context) : FrameLayout(context) {
|
|
2599
|
+
override fun onInterceptTouchEvent(event: MotionEvent): Boolean =
|
|
2600
|
+
CraftNativePointers.ownsTouch(this) && super.onInterceptTouchEvent(event)
|
|
2601
|
+
override fun onTouchEvent(event: MotionEvent): Boolean =
|
|
2602
|
+
(event.actionMasked == MotionEvent.ACTION_CANCEL || CraftNativePointers.ownsTouch(this)) && super.onTouchEvent(event)
|
|
2603
|
+
|
|
2604
|
+
override fun dispatchTouchEvent(event: MotionEvent): Boolean =
|
|
2605
|
+
CraftNativePointers.dispatch(this, event) { super.dispatchTouchEvent(it) }
|
|
2606
|
+
|
|
2345
2607
|
val content = CraftNativeFlexLayout(context)
|
|
2346
2608
|
private var behavior = "padding"
|
|
2347
2609
|
private var keyboardVerticalOffset = 0
|
|
@@ -2415,6 +2677,24 @@ internal fun craftNativeInheritFontFamily(style: JSONObject, inherited: String?)
|
|
|
2415
2677
|
}
|
|
2416
2678
|
|
|
2417
2679
|
/** CSS family fallback order, using bundled app fonts before platform families. */
|
|
2680
|
+
/**
|
|
2681
|
+
* The face a CSS stack gives the app's own chrome (title, tab and button
|
|
2682
|
+
* labels): the first family packaged with the app, or null for the system
|
|
2683
|
+
* face when a generic family (`system-ui`, `sans-serif`) comes first or none is
|
|
2684
|
+
* packaged. Screens resolve the same stacks with `craftNativeFontFamily`.
|
|
2685
|
+
*/
|
|
2686
|
+
internal fun craftNativeChromeTypeface(stack: String?, bundledFonts: Map<String, Typeface>): Typeface? {
|
|
2687
|
+
for (part in stack.orEmpty().split(',')) {
|
|
2688
|
+
val name = part.trim().trim('"', '\'')
|
|
2689
|
+
when (name.lowercase()) {
|
|
2690
|
+
"" -> continue
|
|
2691
|
+
"sans-serif", "ui-sans-serif", "system-ui", "-apple-system", "serif", "ui-serif", "monospace", "ui-monospace" -> return null
|
|
2692
|
+
else -> bundledFonts[name]?.let { return it }
|
|
2693
|
+
}
|
|
2694
|
+
}
|
|
2695
|
+
return null
|
|
2696
|
+
}
|
|
2697
|
+
|
|
2418
2698
|
internal fun craftNativeFontFamily(family: String?, bundledFonts: Map<String, Typeface> = emptyMap()): Typeface =
|
|
2419
2699
|
family?.split(',')?.asSequence()?.map { it.trim().trim('"', '\'') }?.mapNotNull { name ->
|
|
2420
2700
|
bundledFonts[name] ?: when (name.lowercase()) {
|
|
@@ -2426,17 +2706,23 @@ internal fun craftNativeFontFamily(family: String?, bundledFonts: Map<String, Ty
|
|
|
2426
2706
|
}?.firstOrNull() ?: Typeface.DEFAULT
|
|
2427
2707
|
|
|
2428
2708
|
internal class CraftNativeScrollView(context: Context) : SwipeRefreshLayout(context) {
|
|
2709
|
+
override fun dispatchTouchEvent(event: MotionEvent): Boolean =
|
|
2710
|
+
CraftNativePointers.dispatch(this, event) { super.dispatchTouchEvent(it) }
|
|
2711
|
+
|
|
2712
|
+
override fun onTouchEvent(event: MotionEvent): Boolean =
|
|
2713
|
+
(event.actionMasked == MotionEvent.ACTION_CANCEL || CraftNativePointers.ownsTouch(this)) && super.onTouchEvent(event)
|
|
2714
|
+
|
|
2429
2715
|
val content = CraftNativeFlexLayout(context)
|
|
2430
2716
|
// Keep one refresh target across axis changes. Replacing all children of
|
|
2431
2717
|
// SwipeRefreshLayout would also detach its own animated indicator.
|
|
2432
2718
|
private val scrollContainer = FrameLayout(context)
|
|
2433
2719
|
private val vertical = object : ScrollView(context) {
|
|
2434
|
-
override fun onInterceptTouchEvent(event: MotionEvent): Boolean = isEnabled && super.onInterceptTouchEvent(event)
|
|
2435
|
-
override fun onTouchEvent(event: MotionEvent): Boolean = isEnabled && super.onTouchEvent(event)
|
|
2720
|
+
override fun onInterceptTouchEvent(event: MotionEvent): Boolean = isEnabled && CraftNativePointers.ownsTouch(this) && super.onInterceptTouchEvent(event)
|
|
2721
|
+
override fun onTouchEvent(event: MotionEvent): Boolean = isEnabled && (event.actionMasked == MotionEvent.ACTION_CANCEL || CraftNativePointers.ownsTouch(this)) && super.onTouchEvent(event)
|
|
2436
2722
|
}
|
|
2437
2723
|
private val horizontal = object : HorizontalScrollView(context) {
|
|
2438
|
-
override fun onInterceptTouchEvent(event: MotionEvent): Boolean = isEnabled && super.onInterceptTouchEvent(event)
|
|
2439
|
-
override fun onTouchEvent(event: MotionEvent): Boolean = isEnabled && super.onTouchEvent(event)
|
|
2724
|
+
override fun onInterceptTouchEvent(event: MotionEvent): Boolean = isEnabled && CraftNativePointers.ownsTouch(this) && super.onInterceptTouchEvent(event)
|
|
2725
|
+
override fun onTouchEvent(event: MotionEvent): Boolean = isEnabled && (event.actionMasked == MotionEvent.ACTION_CANCEL || CraftNativePointers.ownsTouch(this)) && super.onTouchEvent(event)
|
|
2440
2726
|
}
|
|
2441
2727
|
private var horizontalMode: Boolean? = null
|
|
2442
2728
|
private var pagingEnabled = false
|
|
@@ -2534,7 +2820,7 @@ internal class CraftNativeScrollView(context: Context) : SwipeRefreshLayout(cont
|
|
|
2534
2820
|
}
|
|
2535
2821
|
|
|
2536
2822
|
override fun onInterceptTouchEvent(event: MotionEvent): Boolean {
|
|
2537
|
-
if (refreshHandler == null) return false
|
|
2823
|
+
if (refreshHandler == null || !CraftNativePointers.ownsTouch(this)) return false
|
|
2538
2824
|
return super.onInterceptTouchEvent(event)
|
|
2539
2825
|
}
|
|
2540
2826
|
|
|
@@ -2914,6 +3200,7 @@ internal class CraftNativeScrollView(context: Context) : SwipeRefreshLayout(cont
|
|
|
2914
3200
|
onScroll?.invoke(x, y)
|
|
2915
3201
|
}
|
|
2916
3202
|
scroller.setOnTouchListener { _, event ->
|
|
3203
|
+
if (!CraftNativePointers.ownsTouch(scroller) && event.actionMasked != MotionEvent.ACTION_CANCEL) return@setOnTouchListener false
|
|
2917
3204
|
when (event.actionMasked) {
|
|
2918
3205
|
android.view.MotionEvent.ACTION_DOWN -> {
|
|
2919
3206
|
pageDragging = true
|
|
@@ -2984,6 +3271,9 @@ private class CraftNativeFlexSpacer(context: Context) : View(context)
|
|
|
2984
3271
|
* the other native leaf controls without adding an icon-font dependency.
|
|
2985
3272
|
*/
|
|
2986
3273
|
private class CraftNativeIconView(context: Context) : TextView(context) {
|
|
3274
|
+
override fun dispatchTouchEvent(event: MotionEvent): Boolean =
|
|
3275
|
+
CraftNativePointers.dispatch(this, event) { super.dispatchTouchEvent(it) }
|
|
3276
|
+
|
|
2987
3277
|
/** The app's vector for the icon (CraftNativeIcons), drawn in place of the glyph. */
|
|
2988
3278
|
var vector: Drawable? = null
|
|
2989
3279
|
set(value) {
|
|
@@ -3010,6 +3300,9 @@ private class CraftNativeIconView(context: Context) : TextView(context) {
|
|
|
3010
3300
|
|
|
3011
3301
|
/** A platform EditText with the native end clear affordance and TalkBack action. */
|
|
3012
3302
|
private class CraftNativeTextField(context: Context) : EditText(context) {
|
|
3303
|
+
override fun dispatchTouchEvent(event: MotionEvent): Boolean =
|
|
3304
|
+
CraftNativePointers.dispatch(this, event) { super.dispatchTouchEvent(it) }
|
|
3305
|
+
|
|
3013
3306
|
companion object { val CLEAR_ACTION_ID = View.generateViewId() }
|
|
3014
3307
|
var clearButtonMode = "never"
|
|
3015
3308
|
var onClearRequest: (() -> Unit)? = null
|
|
@@ -3054,8 +3347,14 @@ private class CraftNativeTextField(context: Context) : EditText(context) {
|
|
|
3054
3347
|
}
|
|
3055
3348
|
|
|
3056
3349
|
private class CraftNativeModalView(context: Context) : FrameLayout(context) {
|
|
3350
|
+
override fun dispatchTouchEvent(event: MotionEvent): Boolean =
|
|
3351
|
+
CraftNativePointers.dispatch(this, event) { super.dispatchTouchEvent(it) }
|
|
3352
|
+
|
|
3057
3353
|
val content = CraftNativeFlexLayout(context)
|
|
3058
|
-
private val blocker = View(context)
|
|
3354
|
+
private val blocker = object : View(context) {
|
|
3355
|
+
override fun onTouchEvent(event: MotionEvent): Boolean =
|
|
3356
|
+
(event.actionMasked == MotionEvent.ACTION_CANCEL || CraftNativePointers.ownsTouch(this)) && super.onTouchEvent(event)
|
|
3357
|
+
}
|
|
3059
3358
|
private var renderedVisible = false
|
|
3060
3359
|
private var animationGeneration = 0
|
|
3061
3360
|
var focusToRestore: View? = null
|
|
@@ -3095,6 +3394,7 @@ private class CraftNativeModalView(context: Context) : FrameLayout(context) {
|
|
|
3095
3394
|
isClickable = true
|
|
3096
3395
|
blocker.isClickable = true
|
|
3097
3396
|
blocker.setOnTouchListener { _, event ->
|
|
3397
|
+
if (!CraftNativePointers.ownsTouch(this)) return@setOnTouchListener false
|
|
3098
3398
|
if (event.action == MotionEvent.ACTION_UP) requestClose(reason = "backdrop")
|
|
3099
3399
|
true
|
|
3100
3400
|
}
|
|
@@ -3175,6 +3475,7 @@ private class CraftNativeModalView(context: Context) : FrameLayout(context) {
|
|
|
3175
3475
|
}
|
|
3176
3476
|
|
|
3177
3477
|
override fun onTouchEvent(event: MotionEvent): Boolean {
|
|
3478
|
+
if (event.actionMasked != MotionEvent.ACTION_CANCEL && !CraftNativePointers.ownsTouch(this)) return false
|
|
3178
3479
|
if (!blocksBackground) {
|
|
3179
3480
|
if (dismissOnOutsideTap && event.action == MotionEvent.ACTION_UP) {
|
|
3180
3481
|
requestClose(reason = "backdrop")
|
|
@@ -3192,7 +3493,7 @@ private class CraftNativeModalView(context: Context) : FrameLayout(context) {
|
|
|
3192
3493
|
val index = group.indexOfChild(this)
|
|
3193
3494
|
return index > 0 && (0 until index).any { siblingIndex ->
|
|
3194
3495
|
val sibling = group.getChildAt(siblingIndex)
|
|
3195
|
-
sibling is CraftNativeModalView && sibling.blocksBackground && sibling.visibility == View.VISIBLE && sibling.alpha > 0.01f
|
|
3496
|
+
sibling is CraftNativeModalView && CraftNativePointers.ownsTouch(sibling) && sibling.blocksBackground && sibling.visibility == View.VISIBLE && sibling.alpha > 0.01f
|
|
3196
3497
|
}
|
|
3197
3498
|
}
|
|
3198
3499
|
}
|
|
@@ -3213,6 +3514,9 @@ private data class LayoutBounds(
|
|
|
3213
3514
|
*/
|
|
3214
3515
|
private class CraftNativeActivityIndicator(context: Context) :
|
|
3215
3516
|
android.widget.ProgressBar(context, null, android.R.attr.progressBarStyleHorizontal) {
|
|
3517
|
+
override fun dispatchTouchEvent(event: MotionEvent): Boolean =
|
|
3518
|
+
CraftNativePointers.dispatch(this, event) { super.dispatchTouchEvent(it) }
|
|
3519
|
+
|
|
3216
3520
|
var indicatorScale = 1f
|
|
3217
3521
|
|
|
3218
3522
|
init {
|
|
@@ -3224,6 +3528,9 @@ private class CraftNativeActivityIndicator(context: Context) :
|
|
|
3224
3528
|
|
|
3225
3529
|
/** Android counterpart to iOS's UIDatePicker-backed native DatePicker. */
|
|
3226
3530
|
private class CraftNativeDatePickerView(context: Context) : FrameLayout(context) {
|
|
3531
|
+
override fun dispatchTouchEvent(event: MotionEvent): Boolean =
|
|
3532
|
+
CraftNativePointers.dispatch(this, event) { super.dispatchTouchEvent(it) }
|
|
3533
|
+
|
|
3227
3534
|
private enum class PickerMode { DATE, TIME, DATE_TIME, COUNTDOWN }
|
|
3228
3535
|
private val maxCountdownSeconds = 23 * 3600 + 59 * 60 + 59
|
|
3229
3536
|
|
|
@@ -3470,6 +3777,9 @@ internal class CraftNativeInputEcho {
|
|
|
3470
3777
|
* while this view keeps its place.
|
|
3471
3778
|
*/
|
|
3472
3779
|
private class CraftNativeVideoView(context: Context) : VideoView(context) {
|
|
3780
|
+
override fun dispatchTouchEvent(event: MotionEvent): Boolean =
|
|
3781
|
+
CraftNativePointers.dispatch(this, event) { super.dispatchTouchEvent(it) }
|
|
3782
|
+
|
|
3473
3783
|
private var sourceUri = ""
|
|
3474
3784
|
private var shouldLoop = false
|
|
3475
3785
|
private var shouldPlay = false
|
|
@@ -4549,7 +4859,9 @@ class MainActivity : AppCompatActivity() {
|
|
|
4549
4859
|
}
|
|
4550
4860
|
|
|
4551
4861
|
private fun installChrome() {
|
|
4552
|
-
val
|
|
4862
|
+
val bodyFont = craftNativeChromeTypeface(routes.fontFamily, bundledFonts)
|
|
4863
|
+
val bars = CraftNativeChrome(this, routes.tabs, routes.tabBarAppearance,
|
|
4864
|
+
CraftNativeChromeFonts(bodyFont, craftNativeChromeTypeface(routes.headingFontFamily, bundledFonts) ?: bodyFont))
|
|
4553
4865
|
bars.layoutParams = FrameLayout.LayoutParams(-1, -1)
|
|
4554
4866
|
bars.onBack = { onBackPressedDispatcherCompat() }
|
|
4555
4867
|
bars.onAccessory = { path -> navigateOpen(path) }
|
|
@@ -5748,7 +6060,7 @@ class MainActivity : AppCompatActivity() {
|
|
|
5748
6060
|
val previous = protocolId?.let { previousControls["id:$it"] } ?: keyedPrevious
|
|
5749
6061
|
val reusableInput = previous as? CraftNativeTextField
|
|
5750
6062
|
val control = when (type) {
|
|
5751
|
-
"Text" -> ((previous as? TextView)?.takeUnless { it is Button || it is EditText } ?:
|
|
6063
|
+
"Text" -> ((previous as? TextView)?.takeUnless { it is Button || it is EditText } ?: CraftNativePointerTextView(this)).apply {
|
|
5752
6064
|
includeFontPadding = false
|
|
5753
6065
|
maxLines = craftNativeInt(props.opt("numberOfLines"), 0).takeIf { it > 0 } ?: Int.MAX_VALUE
|
|
5754
6066
|
ellipsize = when (craftNativeOptionalString(props.opt("ellipsizeMode"))) {
|
|
@@ -5771,7 +6083,7 @@ class MainActivity : AppCompatActivity() {
|
|
|
5771
6083
|
"RefreshControl" -> (previous as? CraftNativeFlexLayout ?: CraftNativeFlexLayout(this)).apply {
|
|
5772
6084
|
visibility = View.GONE
|
|
5773
6085
|
}
|
|
5774
|
-
"Link" -> ((previous as? TextView)?.takeUnless { it is Button } ?:
|
|
6086
|
+
"Link" -> ((previous as? TextView)?.takeUnless { it is Button } ?: CraftNativePointerTextView(this)).apply {
|
|
5775
6087
|
includeFontPadding = false
|
|
5776
6088
|
configureText(this, (props.opt("title") as? String) ?: childText(children), style)
|
|
5777
6089
|
val linkColor = craftNativeOptionalString(props.opt("color")) ?: craftNativeOptionalString(style.opt("color"))
|
|
@@ -5794,7 +6106,7 @@ class MainActivity : AppCompatActivity() {
|
|
|
5794
6106
|
send(screen, "EVENT", JSONObject().put("handlerName", current).put("nativeEvent", JSONObject()))
|
|
5795
6107
|
}
|
|
5796
6108
|
}
|
|
5797
|
-
"Button" -> (previous as? Button ?:
|
|
6109
|
+
"Button" -> (previous as? Button ?: CraftNativePointerButton(this).apply {
|
|
5798
6110
|
// A plain button, as on iOS (UIButton) and the web: its
|
|
5799
6111
|
// style draws any fill, not Material's grey raised box.
|
|
5800
6112
|
background = null
|
|
@@ -5819,7 +6131,7 @@ class MainActivity : AppCompatActivity() {
|
|
|
5819
6131
|
send(screen, "EVENT", JSONObject().put("handlerName", current).put("nativeEvent", JSONObject()))
|
|
5820
6132
|
}
|
|
5821
6133
|
}
|
|
5822
|
-
"Checkbox" -> (previous as? CheckBox ?:
|
|
6134
|
+
"Checkbox" -> (previous as? CheckBox ?: CraftNativePointerCheckBox(this)).apply {
|
|
5823
6135
|
text = (props.opt("label") as? String) ?: childText(children)
|
|
5824
6136
|
configureText(this, text.toString(), style)
|
|
5825
6137
|
val checkboxChecked = props.opt("checked")
|
|
@@ -6004,7 +6316,7 @@ class MainActivity : AppCompatActivity() {
|
|
|
6004
6316
|
addTextChangedListener(watcher)
|
|
6005
6317
|
}
|
|
6006
6318
|
}
|
|
6007
|
-
"SegmentedControl" -> (previous as? android.widget.RadioGroup ?:
|
|
6319
|
+
"SegmentedControl" -> (previous as? android.widget.RadioGroup ?: CraftNativePointerRadioGroup(this)).apply {
|
|
6008
6320
|
orientation = android.widget.LinearLayout.HORIZONTAL
|
|
6009
6321
|
// Reconciliation is silent. Only the platform's user selection
|
|
6010
6322
|
// listener below emits a value, with the stable option value.
|
|
@@ -6055,7 +6367,7 @@ class MainActivity : AppCompatActivity() {
|
|
|
6055
6367
|
send(screen, "EVENT", JSONObject().put("handlerName", current).put("nativeEvent", JSONObject().put("value", value).put("index", index)))
|
|
6056
6368
|
}
|
|
6057
6369
|
}
|
|
6058
|
-
"Picker" -> (previous as? Spinner ?:
|
|
6370
|
+
"Picker" -> (previous as? Spinner ?: CraftNativePointerSpinner(this)).apply {
|
|
6059
6371
|
val itemOptions = props.optJSONArray("items")?.let { items ->
|
|
6060
6372
|
(0 until items.length()).mapNotNull { index ->
|
|
6061
6373
|
val item = items.optJSONObject(index) ?: return@mapNotNull null
|
|
@@ -6199,7 +6511,7 @@ class MainActivity : AppCompatActivity() {
|
|
|
6199
6511
|
screen.pressBaseBackgrounds[this] = this.background
|
|
6200
6512
|
reconcileChildren(screen, this, children, identity, next, style, previousControls)
|
|
6201
6513
|
}
|
|
6202
|
-
"Switch" -> (previous as? Switch ?:
|
|
6514
|
+
"Switch" -> (previous as? Switch ?: CraftNativePointerSwitch(this)).apply {
|
|
6203
6515
|
setOnCheckedChangeListener(null)
|
|
6204
6516
|
val requestedValue = props.opt("value")
|
|
6205
6517
|
val requestedChecked = props.opt("checked")
|
|
@@ -6238,7 +6550,7 @@ class MainActivity : AppCompatActivity() {
|
|
|
6238
6550
|
send(screen, "EVENT", JSONObject().put("handlerName", current).put("nativeEvent", JSONObject().put("value", checked)))
|
|
6239
6551
|
}
|
|
6240
6552
|
}
|
|
6241
|
-
"Slider" -> (previous as? SeekBar ?:
|
|
6553
|
+
"Slider" -> (previous as? SeekBar ?: CraftNativePointerSeekBar(this)).apply {
|
|
6242
6554
|
val minimum = craftNativeFiniteNumber(props, "minimumValue", 0.0)
|
|
6243
6555
|
val maximumCandidate = craftNativeFiniteNumber(props, "maximumValue", 1.0)
|
|
6244
6556
|
val maximum = if (maximumCandidate > minimum) maximumCandidate else minimum + Double.MIN_VALUE
|
|
@@ -6319,13 +6631,14 @@ class MainActivity : AppCompatActivity() {
|
|
|
6319
6631
|
"Icon" -> (previous as? CraftNativeIconView ?: CraftNativeIconView(this)).apply {
|
|
6320
6632
|
configureIcon(this, props, style)
|
|
6321
6633
|
}
|
|
6322
|
-
"Image" -> (previous as?
|
|
6634
|
+
"Image" -> (previous as? CraftNativePointerImageView ?: CraftNativePointerImageView(this)).apply {
|
|
6323
6635
|
scaleType = when (craftNativeResizeMode(style, props)) {
|
|
6324
6636
|
"cover" -> ImageView.ScaleType.CENTER_CROP
|
|
6325
6637
|
"stretch" -> ImageView.ScaleType.FIT_XY
|
|
6326
6638
|
"center" -> ImageView.ScaleType.CENTER
|
|
6327
6639
|
else -> ImageView.ScaleType.CENTER_INSIDE
|
|
6328
6640
|
}
|
|
6641
|
+
configureObjectGeometry(props, style)
|
|
6329
6642
|
adjustViewBounds = false
|
|
6330
6643
|
val onLoadStart = craftNativeEventName(events, "onLoadStart")
|
|
6331
6644
|
if (onLoadStart.isNotBlank()) screen.imageLoadStartHandlers[this] = onLoadStart else screen.imageLoadStartHandlers.remove(this)
|
|
@@ -6344,6 +6657,7 @@ class MainActivity : AppCompatActivity() {
|
|
|
6344
6657
|
"center" -> ImageView.ScaleType.CENTER
|
|
6345
6658
|
else -> ImageView.ScaleType.CENTER_INSIDE
|
|
6346
6659
|
}
|
|
6660
|
+
image.configureObjectGeometry(props, style)
|
|
6347
6661
|
val tint = craftNativeOptionalString(style.opt("tintColor"))
|
|
6348
6662
|
?.let { runCatching { craftNativeColor(it) }.getOrNull() }
|
|
6349
6663
|
if (tint == null) image.clearColorFilter() else image.setColorFilter(tint)
|
|
@@ -6568,6 +6882,7 @@ class MainActivity : AppCompatActivity() {
|
|
|
6568
6882
|
send(screen, "EVENT", JSONObject().put("handlerName", current).put("nativeEvent", JSONObject()))
|
|
6569
6883
|
}
|
|
6570
6884
|
control.setOnTouchListener { view, event ->
|
|
6885
|
+
if (!CraftNativePointers.ownsTouch(view) && event.actionMasked != MotionEvent.ACTION_CANCEL) return@setOnTouchListener false
|
|
6571
6886
|
when (event.actionMasked) {
|
|
6572
6887
|
android.view.MotionEvent.ACTION_DOWN -> {
|
|
6573
6888
|
val active = screen.pressActiveOpacities[view] ?: 0.5f
|
|
@@ -6636,6 +6951,8 @@ class MainActivity : AppCompatActivity() {
|
|
|
6636
6951
|
control.setOnLongClickListener(null)
|
|
6637
6952
|
control.isLongClickable = false
|
|
6638
6953
|
}
|
|
6954
|
+
CraftNativePointers.configure(control, props, style, control is CraftNativeFlexLayout || control is CraftNativeImageBackgroundView ||
|
|
6955
|
+
control is CraftNativeKeyboardAvoidingView || control is CraftNativeScrollView || control is CraftNativeRefreshableFlatList || control is CraftNativeModalView)
|
|
6639
6956
|
applyAccessibility(control, props, type, explicitKey ?: protocolId ?: path)
|
|
6640
6957
|
// One element across an animated change (craft.animation.next).
|
|
6641
6958
|
control.transitionName = craftNativeOptionalString(props.opt("transitionID"))?.takeIf { it.isNotBlank() }
|