@onekeyfe/react-native-native-list 6.7.0-2 → 6.7.0-21

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.
Files changed (148) hide show
  1. package/android/src/main/java/com/onekey/nativelist/HybridNativeList.kt +14 -1
  2. package/android/src/main/java/com/onekey/nativelist/NativeListAccessoryStack.kt +245 -9
  3. package/android/src/main/java/com/onekey/nativelist/NativeListActivityDetailsView.kt +35 -7
  4. package/android/src/main/java/com/onekey/nativelist/NativeListActivityRenderer.kt +25 -3
  5. package/android/src/main/java/com/onekey/nativelist/NativeListAdapter.kt +17 -1
  6. package/android/src/main/java/com/onekey/nativelist/NativeListButtonGroupRenderer.kt +102 -0
  7. package/android/src/main/java/com/onekey/nativelist/NativeListContainerSlotAdapter.kt +12 -0
  8. package/android/src/main/java/com/onekey/nativelist/NativeListDataRowRenderer.kt +102 -7
  9. package/android/src/main/java/com/onekey/nativelist/NativeListIdentityRenderer.kt +225 -11
  10. package/android/src/main/java/com/onekey/nativelist/NativeListLeadingVisual.kt +147 -33
  11. package/android/src/main/java/com/onekey/nativelist/NativeListMarketRenderer.kt +92 -28
  12. package/android/src/main/java/com/onekey/nativelist/NativeListMessageRenderer.kt +25 -0
  13. package/android/src/main/java/com/onekey/nativelist/NativeListModels.kt +149 -3
  14. package/android/src/main/java/com/onekey/nativelist/NativeListPrimitives.kt +51 -0
  15. package/android/src/main/java/com/onekey/nativelist/NativeListRendererRegistry.kt +2 -0
  16. package/android/src/main/java/com/onekey/nativelist/NativeListRendererRowView.kt +2 -0
  17. package/android/src/main/java/com/onekey/nativelist/NativeListResolvedText.kt +3 -2
  18. package/android/src/main/java/com/onekey/nativelist/NativeListSectionHeaderRenderer.kt +69 -0
  19. package/android/src/main/java/com/onekey/nativelist/NativeListTextView.kt +55 -1
  20. package/android/src/main/java/com/onekey/nativelist/NativeListView.kt +1953 -117
  21. package/android/src/test/java/com/margelo/nitro/nativelist/NativeListActivityHostClipPolicyTest.kt +35 -0
  22. package/android/src/test/java/com/margelo/nitro/nativelist/NativeListIdentityTrailingAxisTest.kt +36 -0
  23. package/android/src/test/java/com/margelo/nitro/nativelist/NativeListLeadingSlotFrameTest.kt +68 -0
  24. package/android/src/test/java/com/margelo/nitro/nativelist/NativeListLeadingVisualClipPolicyTest.kt +44 -0
  25. package/android/src/test/java/com/margelo/nitro/nativelist/NativeListPressPolicyTest.kt +10 -0
  26. package/docs/ROW_TEMPLATES.md +70 -11
  27. package/docs/SPEC.md +1235 -20
  28. package/docs/STYLE_SPEC.md +6 -0
  29. package/ios/HybridNativeList.swift +21 -2
  30. package/ios/NativeListAccessoryStack.swift +235 -39
  31. package/ios/NativeListActivityDetailsView.swift +30 -11
  32. package/ios/NativeListActivityRenderer.swift +8 -2
  33. package/ios/NativeListButtonGroupRenderer.swift +89 -0
  34. package/ios/NativeListDataRowRenderer.swift +155 -27
  35. package/ios/NativeListDesignAssets.swift +9 -0
  36. package/ios/NativeListIdentityRenderer.swift +239 -31
  37. package/ios/NativeListLeadingVisual.swift +119 -22
  38. package/ios/NativeListMarketRenderer.swift +113 -18
  39. package/ios/NativeListMessageRenderer.swift +34 -1
  40. package/ios/NativeListModels.swift +42 -2
  41. package/ios/NativeListRendererRegistry.swift +1 -0
  42. package/ios/NativeListResolvedText.swift +2 -1
  43. package/ios/NativeListRowHost.swift +14 -0
  44. package/ios/NativeListSectionHeaderRenderer.swift +88 -0
  45. package/ios/RNCNativeListView.swift +1052 -58
  46. package/ios/Resources/NativeListIcons.xcassets/onekey_crypto_coin_outline.imageset/Contents.json +15 -0
  47. package/ios/Resources/NativeListIcons.xcassets/onekey_crypto_coin_outline.imageset/icon.svg +4 -0
  48. package/ios/Resources/NativeListIcons.xcassets/onekey_document2.imageset/Contents.json +1 -0
  49. package/ios/Resources/NativeListIcons.xcassets/onekey_document2.imageset/icon.svg +1 -0
  50. package/ios/Resources/NativeListIcons.xcassets/onekey_dot_ver_solid.imageset/Contents.json +1 -0
  51. package/ios/Resources/NativeListIcons.xcassets/onekey_dot_ver_solid.imageset/icon.svg +1 -0
  52. package/ios/Resources/NativeListIcons.xcassets/onekey_gas_solid.imageset/Contents.json +15 -0
  53. package/ios/Resources/NativeListIcons.xcassets/onekey_gas_solid.imageset/icon.svg +3 -0
  54. package/ios/Resources/NativeListIcons.xcassets/onekey_plus_large.imageset/Contents.json +1 -0
  55. package/ios/Resources/NativeListIcons.xcassets/onekey_plus_large.imageset/icon.svg +1 -0
  56. package/ios/Resources/NativeListIcons.xcassets/onekey_refresh_ccw_outline.imageset/Contents.json +15 -0
  57. package/ios/Resources/NativeListIcons.xcassets/onekey_refresh_ccw_outline.imageset/icon.svg +3 -0
  58. package/ios/Resources/NativeListIcons.xcassets/onekey_ticket.imageset/Contents.json +1 -0
  59. package/ios/Resources/NativeListIcons.xcassets/onekey_ticket.imageset/icon.svg +1 -0
  60. package/ios/Resources/NativeListIcons.xcassets/onekey_wallet.imageset/Contents.json +1 -0
  61. package/ios/Resources/NativeListIcons.xcassets/onekey_wallet.imageset/icon.svg +1 -0
  62. package/ios/tests/NativeListAccessoryStackTests.swift +89 -0
  63. package/ios/tests/NativeListActivityPresentationTests.swift +153 -0
  64. package/ios/tests/NativeListIdentityTitleIconLayoutTests.swift +81 -0
  65. package/ios/tests/NativeListLeadingVisualPairBackdropTests.swift +50 -0
  66. package/ios/tests/NativeListLifecycleTests.swift +2789 -3
  67. package/ios/tests/NativeListMarketMetricsTests.swift +117 -0
  68. package/lib/module/NativeList.js +223 -36
  69. package/lib/module/NativeList.web.js +260 -33
  70. package/lib/module/index.js +1 -1
  71. package/lib/module/models.js +3 -0
  72. package/lib/module/selection.js +1 -1
  73. package/lib/module/validation.js +1386 -81
  74. package/lib/module/web/NativeListWebEngine.js +914 -80
  75. package/lib/module/web/templates/ActivityRowRenderer.js +487 -7
  76. package/lib/module/web/templates/ButtonGroupRowRenderer.js +47 -0
  77. package/lib/module/web/templates/DataRowRenderer.js +40 -5
  78. package/lib/module/web/templates/IdentityRowRenderer.js +145 -5
  79. package/lib/module/web/templates/MarketRowRenderer.js +8 -3
  80. package/lib/module/web/templates/MarketTableRowRenderer.js +577 -0
  81. package/lib/module/web/templates/MediaTileRowRenderer.js +260 -5
  82. package/lib/module/web/templates/MessageRowRenderer.js +18 -2
  83. package/lib/module/web/templates/RowContainerStyle.js +1 -0
  84. package/lib/module/web/templates/RowRendererRegistry.js +8 -3
  85. package/lib/module/web/templates/SectionHeaderRowRenderer.js +70 -3
  86. package/lib/nitrogen/generated/android/c++/JHybridNativeListSpec.cpp +26 -0
  87. package/lib/nitrogen/generated/android/c++/JHybridNativeListSpec.hpp +4 -0
  88. package/lib/nitrogen/generated/android/c++/views/JHybridNativeListStateUpdater.cpp +10 -0
  89. package/lib/nitrogen/generated/android/kotlin/com/margelo/nitro/nativelist/HybridNativeListSpec.kt +20 -0
  90. package/lib/nitrogen/generated/ios/c++/HybridNativeListSpecSwift.hpp +14 -0
  91. package/lib/nitrogen/generated/ios/c++/views/HybridNativeListComponent.mm +12 -0
  92. package/lib/nitrogen/generated/ios/swift/HybridNativeListSpec.swift +2 -0
  93. package/lib/nitrogen/generated/ios/swift/HybridNativeListSpec_cxx.swift +43 -0
  94. package/lib/nitrogen/generated/shared/c++/HybridNativeListSpec.cpp +4 -0
  95. package/lib/nitrogen/generated/shared/c++/HybridNativeListSpec.hpp +4 -0
  96. package/lib/nitrogen/generated/shared/c++/views/HybridNativeListComponent.cpp +4 -0
  97. package/lib/nitrogen/generated/shared/c++/views/HybridNativeListComponent.hpp +6 -0
  98. package/lib/nitrogen/generated/shared/json/NativeListConfig.json +2 -0
  99. package/lib/typescript/src/NativeList.d.ts +3 -3
  100. package/lib/typescript/src/NativeList.nitro.d.ts +2 -0
  101. package/lib/typescript/src/NativeList.types.d.ts +29 -1
  102. package/lib/typescript/src/NativeList.web.d.ts +2 -2
  103. package/lib/typescript/src/index.d.ts +2 -2
  104. package/lib/typescript/src/models.d.ts +196 -17
  105. package/lib/typescript/src/validation.d.ts +20 -0
  106. package/lib/typescript/src/web/NativeListWebEngine.d.ts +58 -1
  107. package/lib/typescript/src/web/templates/ActivityRowRenderer.d.ts +3 -3
  108. package/lib/typescript/src/web/templates/ButtonGroupRowRenderer.d.ts +14 -0
  109. package/lib/typescript/src/web/templates/IdentityRowRenderer.d.ts +1 -1
  110. package/lib/typescript/src/web/templates/MarketTableRowRenderer.d.ts +17 -0
  111. package/lib/typescript/src/web/templates/MediaTileRowRenderer.d.ts +3 -3
  112. package/lib/typescript/src/web/templates/MessageRowRenderer.d.ts +10 -4
  113. package/lib/typescript/src/web/templates/RowRendererRegistry.d.ts +3 -1
  114. package/nitrogen/generated/android/c++/JHybridNativeListSpec.cpp +26 -0
  115. package/nitrogen/generated/android/c++/JHybridNativeListSpec.hpp +4 -0
  116. package/nitrogen/generated/android/c++/views/JHybridNativeListStateUpdater.cpp +10 -0
  117. package/nitrogen/generated/android/kotlin/com/margelo/nitro/nativelist/HybridNativeListSpec.kt +20 -0
  118. package/nitrogen/generated/ios/c++/HybridNativeListSpecSwift.hpp +14 -0
  119. package/nitrogen/generated/ios/c++/views/HybridNativeListComponent.mm +12 -0
  120. package/nitrogen/generated/ios/swift/HybridNativeListSpec.swift +2 -0
  121. package/nitrogen/generated/ios/swift/HybridNativeListSpec_cxx.swift +43 -0
  122. package/nitrogen/generated/shared/c++/HybridNativeListSpec.cpp +4 -0
  123. package/nitrogen/generated/shared/c++/HybridNativeListSpec.hpp +4 -0
  124. package/nitrogen/generated/shared/c++/views/HybridNativeListComponent.cpp +4 -0
  125. package/nitrogen/generated/shared/c++/views/HybridNativeListComponent.hpp +6 -0
  126. package/nitrogen/generated/shared/json/NativeListConfig.json +2 -0
  127. package/package.json +3 -3
  128. package/react-native-native-list.podspec +1 -0
  129. package/src/NativeList.nitro.ts +2 -0
  130. package/src/NativeList.tsx +418 -89
  131. package/src/NativeList.types.ts +34 -1
  132. package/src/NativeList.web.tsx +417 -66
  133. package/src/index.ts +2 -0
  134. package/src/models.ts +355 -143
  135. package/src/selection.ts +1 -0
  136. package/src/validation.ts +3315 -166
  137. package/src/web/NativeListWebEngine.ts +1473 -113
  138. package/src/web/templates/ActivityRowRenderer.ts +732 -8
  139. package/src/web/templates/ButtonGroupRowRenderer.ts +58 -0
  140. package/src/web/templates/DataRowRenderer.ts +93 -20
  141. package/src/web/templates/IdentityRowRenderer.ts +217 -6
  142. package/src/web/templates/MarketRowRenderer.ts +19 -3
  143. package/src/web/templates/MarketTableRowRenderer.ts +755 -0
  144. package/src/web/templates/MediaTileRowRenderer.ts +313 -5
  145. package/src/web/templates/MessageRowRenderer.ts +23 -7
  146. package/src/web/templates/RowContainerStyle.ts +2 -0
  147. package/src/web/templates/RowRendererRegistry.ts +21 -6
  148. package/src/web/templates/SectionHeaderRowRenderer.ts +89 -5
@@ -28,11 +28,19 @@ class HybridNativeList(context: ThemedReactContext) : HybridNativeListSpec() {
28
28
  set(value) {
29
29
  if (field == value) return
30
30
  field = value
31
- dispatchToUi { hostView.setContainerSlotHeightsJson(value) }
31
+ slotHeightsChanged = true
32
+ }
33
+
34
+ override var sidecarLayoutJson: String = ""
35
+ set(value) {
36
+ if (field == value) return
37
+ field = value
38
+ dispatchToUi { hostView.setSidecarLayoutJson(value) }
32
39
  }
33
40
 
34
41
  private var fontsChanged = false
35
42
  private var snapshotChanged = false
43
+ private var slotHeightsChanged = false
36
44
 
37
45
  override var fontFamiliesJson: String = "{}"
38
46
  set(value) {
@@ -44,11 +52,14 @@ class HybridNativeList(context: ThemedReactContext) : HybridNativeListSpec() {
44
52
  override fun afterUpdate() {
45
53
  super.afterUpdate()
46
54
  val fonts = if (fontsChanged) fontFamiliesJson else null
55
+ val slotHeights = if (slotHeightsChanged) containerSlotHeightsJson else null
47
56
  val snapshot = if (snapshotChanged) snapshotJson else null
48
57
  fontsChanged = false
58
+ slotHeightsChanged = false
49
59
  snapshotChanged = false
50
60
  dispatchToUi {
51
61
  fonts?.let { hostView.setFontFamiliesJson(it) }
62
+ slotHeights?.let { hostView.setContainerSlotHeightsJson(it, snapshot) }
52
63
  snapshot?.let { hostView.applySnapshot(it) }
53
64
  }
54
65
  }
@@ -90,6 +101,8 @@ class HybridNativeList(context: ThemedReactContext) : HybridNativeListSpec() {
90
101
  set(value) { field = value; hostView.onEndReached = value }
91
102
  override var onVisibleRangeChanged: ((payloadJson: String) -> Unit)? = null
92
103
  set(value) { field = value; hostView.onVisibleRangeChanged = value }
104
+ override var onStructuralTransitionSettled: ((payloadJson: String) -> Unit)? = null
105
+ set(value) { field = value; hostView.onStructuralTransitionSettled = value }
93
106
 
94
107
  override fun applySnapshot(snapshotJson: String) {
95
108
  dispatchToUi { hostView.applySnapshot(snapshotJson) }
@@ -8,11 +8,14 @@ import android.graphics.drawable.StateListDrawable
8
8
  import android.text.Spannable
9
9
  import android.text.SpannableStringBuilder
10
10
  import android.text.TextUtils
11
+ import android.text.TextPaint
11
12
  import android.text.style.AbsoluteSizeSpan
12
13
  import android.text.style.ForegroundColorSpan
14
+ import android.text.style.MetricAffectingSpan
13
15
  import android.util.TypedValue
14
16
  import android.view.Gravity
15
17
  import android.view.View
18
+ import android.view.MotionEvent
16
19
  import android.widget.LinearLayout
17
20
  import android.widget.ProgressBar
18
21
  import android.widget.TextView
@@ -29,11 +32,14 @@ import org.json.JSONObject
29
32
  // Bounded controls only. Event ownership and epochs stay with the row host.
30
33
  internal class NativeListAccessoryStack(context: android.content.Context, val fonts: NativeListFonts) : LinearLayout(context) {
31
34
  private val trailingViews = List(2) { NativeListTextView(context) }
35
+ private val buttonDownEpochs = IntArray(2) { -1 }
36
+ private var bindingEpoch = 0
32
37
  private val trailingIcons = List(2) { OneKeyIconView(context) }
33
38
  private val checkbox = OneKeyCheckboxView(context)
34
39
  private val spinner = ProgressBar(context)
35
40
  private var boundCheckboxData: JSONObject? = null
36
41
  private val semanticValueViews = mutableListOf<TextView>()
42
+ private val segmentedValuePairs = mutableMapOf<TextView, JSONObject>()
37
43
  private var selectorUsesSourceScale = false
38
44
  private var checkboxUsesSelectorStyle = false
39
45
  private var checkboxCheckedColor = Color.BLACK
@@ -66,6 +72,19 @@ internal class NativeListAccessoryStack(context: android.content.Context, val fo
66
72
  info.viewIdResourceName = host.getTag(com.facebook.react.R.id.react_test_id) as? String
67
73
  }
68
74
  }
75
+ private val buttonAccessibilityDelegate =
76
+ object : View.AccessibilityDelegate() {
77
+ override fun onInitializeAccessibilityNodeInfo(
78
+ host: View,
79
+ info: android.view.accessibility.AccessibilityNodeInfo,
80
+ ) {
81
+ super.onInitializeAccessibilityNodeInfo(host, info)
82
+ info.className = android.widget.Button::class.java.name
83
+ info.isEnabled = host.isEnabled
84
+ info.isClickable = host.isEnabled && host.isClickable
85
+ info.viewIdResourceName = host.getTag(com.facebook.react.R.id.react_test_id) as? String
86
+ }
87
+ }
69
88
 
70
89
  private val trailingPaintFlags = trailingViews.map { it.paintFlags }
71
90
 
@@ -130,7 +149,12 @@ internal class NativeListAccessoryStack(context: android.content.Context, val fo
130
149
  (checkbox.layoutParams as LayoutParams).marginStart = dp(12)
131
150
  for ((index, key) in listOf("value", "valueSecondary").withIndex()) {
132
151
  style.optJSONObject(key)?.let { value ->
133
- semanticValueViews.getOrNull(index)?.let { applyStyledText(it, value) }
152
+ semanticValueViews.getOrNull(index)?.let { view ->
153
+ applyStyledText(view, value)
154
+ if (value.has("fontSize")) segmentedValuePairs[view]?.let { accessory ->
155
+ restorePairSubscriptSizes(view, accessory, value.optDouble("fontSize").toFloat())
156
+ }
157
+ }
134
158
  }
135
159
  }
136
160
  if (style.has("trailingGap")) {
@@ -146,6 +170,13 @@ internal class NativeListAccessoryStack(context: android.content.Context, val fo
146
170
  }
147
171
  }
148
172
  }
173
+ val pairedChevron = horizontal && (kinds == listOf("valuePair", "chevron") ||
174
+ (kinds == listOf("icon", "chevron") &&
175
+ descriptors.getJSONObject(0).optString("name") == "RefreshCcwOutline" &&
176
+ descriptors.getJSONObject(0).optString("actionKey").isEmpty()))
177
+ if (pairedChevron) {
178
+ (trailingIcons[1].layoutParams as LayoutParams).marginEnd = 0
179
+ }
149
180
  visibility =
150
181
  if ((0 until childCount).any { getChildAt(it).visibility != GONE }) VISIBLE else GONE
151
182
  }
@@ -167,32 +198,53 @@ internal class NativeListAccessoryStack(context: android.content.Context, val fo
167
198
 
168
199
  fun anchorInset(view: View): Int =
169
200
  if (
170
- (tag as? NativeListItem)?.json?.optString("presentation") == "accountSelector" &&
171
- view in trailingIcons &&
172
- (view.layoutParams as MarginLayoutParams).marginStart < 0
201
+ view in trailingIcons &&
202
+ (view.layoutParams as MarginLayoutParams).marginStart < 0 &&
203
+ ((tag as? NativeListItem)?.json?.optString("presentation") == "accountSelector" ||
204
+ (tag as? NativeListItem)?.json?.optJSONArray("trailing")?.let { trailing ->
205
+ (0 until trailing.length()).any { index ->
206
+ trailing.optJSONObject(index)?.optString("buttonStyle") == "tertiary"
207
+ }
208
+ } == true)
173
209
  )
174
210
  dp(7)
175
211
  else 0
176
212
 
177
213
  fun reset() {
214
+ bindingEpoch += 1
178
215
  tag = null
179
216
  endInset = null
180
217
  requestsUnclippedHost = false
181
218
  clipChildren = true
182
219
  clipToPadding = true
183
220
  semanticValueViews.clear()
221
+ segmentedValuePairs.clear()
184
222
  boundCheckboxData = null
185
223
  trailingViews.forEachIndexed { index, v ->
224
+ buttonDownEpochs[index] = -1
186
225
  v.paintFlags = trailingPaintFlags[index]
187
226
  v.visibility = GONE
188
227
  v.text = ""
189
228
  v.layoutParams = LayoutParams(LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT)
190
229
  v.setOnClickListener(null)
230
+ // A clickable value consumes the row press; reset it until an action binds.
231
+ v.setOnTouchListener(null)
232
+ v.isPressed = false
233
+ v.isClickable = false
234
+ v.isEnabled = true
235
+ v.alpha = 1f
236
+ v.contentDescription = null
237
+ v.setTag(com.facebook.react.R.id.react_test_id, null)
238
+ v.accessibilityDelegate = null
191
239
  v.background = null
192
240
  v.setPadding(0, 0, 0, 0)
193
241
  // Legacy trailing text: END gravity, one line, no ellipsis.
194
242
  v.gravity = Gravity.END
195
243
  v.opticalOffsetY = 0f
244
+ v.helpBindingGeneration += 1
245
+ v.guardsHelpTouches = false
246
+ v.primaryHelpOnly = false
247
+ v.showsHelpUnderline = false
196
248
  v.maxLines = 1
197
249
  v.setHorizontallyScrolling(false)
198
250
  v.ellipsize = null
@@ -252,6 +304,83 @@ internal class NativeListAccessoryStack(context: android.content.Context, val fo
252
304
  for (index in 0 until minOf(2, accessories.length())) {
253
305
  val accessory = accessories.getJSONObject(index)
254
306
  when (accessory.optString("kind")) {
307
+ "button" -> {
308
+ if (textIndex !in trailingViews.indices) continue
309
+ val view = trailingViews[textIndex]
310
+ val buttonIndex = textIndex
311
+ val epoch = bindingEpoch
312
+ val disabled =
313
+ item.json.optBoolean("disabled", false) || accessory.optBoolean("disabled", false)
314
+ showTrailing(textIndex, accessory.optString("label"), false)
315
+ view.typeface = fonts.medium(context)
316
+ view.gravity = Gravity.CENTER
317
+ view.setTextColor(
318
+ safeColor(
319
+ accessory.optString("textColor").takeIf(String::isNotEmpty),
320
+ color(theme, "primaryText", "#000000DF"),
321
+ )
322
+ )
323
+ view.layoutParams = LayoutParams(LayoutParams.WRAP_CONTENT, dp(30))
324
+ view.setPadding(dp(11), dp(4), dp(11), dp(4))
325
+ view.background =
326
+ StateListDrawable().apply {
327
+ fun fill(value: Int) =
328
+ GradientDrawable().apply {
329
+ setColor(value)
330
+ cornerRadius = dp(15).toFloat()
331
+ setStroke(dp(1), Color.TRANSPARENT)
332
+ }
333
+ addState(
334
+ intArrayOf(android.R.attr.state_pressed),
335
+ fill(safeColor(accessory.optString("pressedBackgroundColor").takeIf(String::isNotEmpty),
336
+ color(theme, "rowPressedBackground", "#00000017"))),
337
+ )
338
+ addState(
339
+ intArrayOf(),
340
+ fill(safeColor(accessory.optString("backgroundColor").takeIf(String::isNotEmpty),
341
+ color(theme, "strongBackground", "#0000000F"))),
342
+ )
343
+ }
344
+ view.setTag(
345
+ com.facebook.react.R.id.react_test_id,
346
+ accessory.optString("testID").takeIf(String::isNotEmpty),
347
+ )
348
+ view.accessibilityDelegate = buttonAccessibilityDelegate
349
+ view.contentDescription =
350
+ accessory.optString("accessibilityLabel").ifEmpty { accessory.optString("label") }
351
+ view.isEnabled = !disabled
352
+ view.alpha = if (disabled) 0.4f else 1f
353
+ view.isClickable = true
354
+ view.setOnTouchListener { _, event ->
355
+ when (event.actionMasked) {
356
+ MotionEvent.ACTION_DOWN -> {
357
+ buttonDownEpochs[buttonIndex] = epoch
358
+ false
359
+ }
360
+ MotionEvent.ACTION_UP -> {
361
+ if (buttonDownEpochs[buttonIndex] != bindingEpoch) {
362
+ view.isPressed = false
363
+ true
364
+ } else false
365
+ }
366
+ MotionEvent.ACTION_CANCEL -> {
367
+ buttonDownEpochs[buttonIndex] = -1
368
+ false
369
+ }
370
+ else -> false
371
+ }
372
+ }
373
+ view.setOnClickListener {
374
+ if (epoch != bindingEpoch) return@setOnClickListener
375
+ (tag as? NativeListItem)?.takeUnless { it.json.optBoolean("disabled", false) }
376
+ ?.takeUnless { accessory.optBoolean("disabled", false) }
377
+ ?.let {
378
+ emitAction(it, accessory.optString("actionKey"), null, view,
379
+ "trailingAccessory", index)
380
+ }
381
+ }
382
+ textIndex++
383
+ }
255
384
  "value" -> {
256
385
  showTrailing(
257
386
  textIndex,
@@ -264,6 +393,21 @@ internal class NativeListAccessoryStack(context: android.content.Context, val fo
264
393
  }
265
394
  "valuePair" -> {
266
395
  showTrailingValuePair(textIndex, accessory, theme)
396
+ accessory.optJSONObject("primaryHelp")?.let { help ->
397
+ val view = trailingViews[textIndex]
398
+ val epoch = bindingEpoch
399
+ view.primaryHelpOnly = true
400
+ view.guardsHelpTouches = true
401
+ view.showsHelpUnderline = help.optString("underline") == "dashed"
402
+ if (help.optString("presentation") == "popover") {
403
+ view.setOnClickListener {
404
+ if (epoch == bindingEpoch && !item.json.optBoolean("disabled")) {
405
+ emitAction(item, help.optString("actionKey"), null, view, "trailingAccessory", index)
406
+ }
407
+ }
408
+ }
409
+ }
410
+ segmentedValuePairs[trailingViews[textIndex]] = accessory
267
411
  semanticValueViews.add(trailingViews[textIndex++])
268
412
  }
269
413
  "checkbox" -> bindCheckbox(item, accessory, checkboxState)
@@ -410,19 +554,23 @@ internal class NativeListAccessoryStack(context: android.content.Context, val fo
410
554
  TextViewCompat.setLineHeight(view, dp(if (primary) 24 else 20))
411
555
  textColor?.let(view::setTextColor)
412
556
  view.visibility = VISIBLE
413
- if (!actionKey.isNullOrEmpty()) {
557
+ val clickActionKey = actionKey?.takeIf(::isNativeListTrailingTextClickable)
558
+ view.isClickable = clickActionKey != null
559
+ if (clickActionKey != null) {
414
560
  view.setOnClickListener {
415
561
  (tag as? NativeListItem)
416
562
  ?.takeUnless { item -> item.json.optBoolean("disabled", false) }
417
- ?.let { item -> emitAction(item, actionKey, null, view, "trailingAccessory", index) }
563
+ ?.let { item -> emitAction(item, clickActionKey, null, view, "trailingAccessory", index) }
418
564
  }
419
565
  }
420
566
  }
421
567
 
422
568
  private fun showTrailingValuePair(index: Int, accessory: JSONObject, theme: JSONObject?) {
423
569
  if (index !in trailingViews.indices) return
424
- val primary = accessory.optString("primary")
425
- val secondary = accessory.optString("secondary")
570
+ val primarySegments = accessory.optJSONArray("primaryTextSegments")
571
+ val secondarySegments = accessory.optJSONArray("secondaryTextSegments")
572
+ val primary = segmentTextOrFallback(primarySegments, accessory.optString("primary"))
573
+ val secondary = segmentTextOrFallback(secondarySegments, accessory.optString("secondary"))
426
574
  if (primary.isEmpty() && secondary.isEmpty()) return
427
575
  val value = SpannableStringBuilder()
428
576
  val primaryStart = value.length
@@ -442,6 +590,15 @@ internal class NativeListAccessoryStack(context: android.content.Context, val fo
442
590
  value.length,
443
591
  Spannable.SPAN_EXCLUSIVE_EXCLUSIVE,
444
592
  )
593
+ if (primary.isNotEmpty() && accessory.optString("primaryFontWeight") == "medium") {
594
+ value.setSpan(
595
+ ValuePairTypefaceSpan(fonts.medium(context)),
596
+ primaryStart,
597
+ value.length,
598
+ Spannable.SPAN_EXCLUSIVE_EXCLUSIVE,
599
+ )
600
+ }
601
+ applyPairSubscriptSizes(value, primarySegments, primaryStart, 16f)
445
602
  if (primary.isNotEmpty() && secondary.isNotEmpty()) value.append('\n')
446
603
  val secondaryStart = value.length
447
604
  value.append(secondary)
@@ -462,6 +619,7 @@ internal class NativeListAccessoryStack(context: android.content.Context, val fo
462
619
  value.length,
463
620
  Spannable.SPAN_EXCLUSIVE_EXCLUSIVE,
464
621
  )
622
+ applyPairSubscriptSizes(value, secondarySegments, secondaryStart, 14f)
465
623
  val view = trailingViews[index]
466
624
  view.text = value
467
625
  view.maxLines = 2
@@ -473,6 +631,48 @@ internal class NativeListAccessoryStack(context: android.content.Context, val fo
473
631
  view.visibility = VISIBLE
474
632
  }
475
633
 
634
+ private fun segmentTextOrFallback(segments: JSONArray?, fallback: String): String {
635
+ if (segments == null || segments.length() == 0) return fallback
636
+ return buildString {
637
+ for (index in 0 until segments.length()) append(segments.getJSONObject(index).optString("text"))
638
+ }
639
+ }
640
+
641
+ private fun applyPairSubscriptSizes(
642
+ value: SpannableStringBuilder,
643
+ segments: JSONArray?,
644
+ start: Int,
645
+ baseSize: Float,
646
+ ) {
647
+ if (segments == null) return
648
+ var offset = start
649
+ for (index in 0 until segments.length()) {
650
+ val segment = segments.getJSONObject(index)
651
+ val end = offset + segment.optString("text").length
652
+ if (end > offset && segment.optString("style") == "subscript")
653
+ value.setSpan(
654
+ AbsoluteSizeSpan(sp(kotlin.math.ceil(baseSize * 0.6).toFloat()).roundToInt(), true),
655
+ offset,
656
+ end,
657
+ Spannable.SPAN_EXCLUSIVE_EXCLUSIVE,
658
+ )
659
+ offset = end
660
+ }
661
+ }
662
+
663
+ private fun restorePairSubscriptSizes(view: TextView, accessory: JSONObject, baseSize: Float) {
664
+ val primary = accessory.optJSONArray("primaryTextSegments")
665
+ val secondary = accessory.optJSONArray("secondaryTextSegments")
666
+ if ((primary?.length() ?: 0) == 0 && (secondary?.length() ?: 0) == 0) return
667
+ val value = SpannableStringBuilder(view.text)
668
+ applyPairSubscriptSizes(value, primary, 0, baseSize)
669
+ val primaryText = segmentTextOrFallback(primary, accessory.optString("primary"))
670
+ val secondaryStart = primaryText.length + if (primaryText.isNotEmpty() &&
671
+ segmentTextOrFallback(secondary, accessory.optString("secondary")).isNotEmpty()) 1 else 0
672
+ applyPairSubscriptSizes(value, secondary, secondaryStart, baseSize)
673
+ view.text = value
674
+ }
675
+
476
676
  private fun showTrailingMenu(index: Int, actionKey: String) {
477
677
  showTrailing(index, "⋮", true, actionKey)
478
678
  if (index !in trailingViews.indices) return
@@ -512,7 +712,26 @@ internal class NativeListAccessoryStack(context: android.content.Context, val fo
512
712
  )
513
713
  icon.accessibilityDelegate = selectorAccessibilityDelegate
514
714
  icon.contentDescription = data.optString("accessibilityLabel").takeIf { it.isNotEmpty() }
515
- if (item.json.optString("presentation") == "accountSelector") {
715
+ if (data.optString("buttonStyle") == "tertiary") {
716
+ icon.glyphSizeDp = 24
717
+ icon.layoutParams = LayoutParams(dp(38), dp(38)).apply {
718
+ gravity = Gravity.CENTER_VERTICAL
719
+ marginStart = -dp(7)
720
+ marginEnd = -dp(7)
721
+ }
722
+ icon.background = StateListDrawable().apply {
723
+ addState(intArrayOf(android.R.attr.state_pressed),
724
+ roundedFill(color(theme, "rowPressedBackground", "#00000017"), 19f).apply {
725
+ setStroke(dp(1), Color.TRANSPARENT)
726
+ })
727
+ addState(intArrayOf(), roundedFill(Color.TRANSPARENT, 19f).apply {
728
+ setStroke(dp(1), Color.TRANSPARENT)
729
+ })
730
+ }
731
+ clipChildren = false
732
+ clipToPadding = false
733
+ requestsUnclippedHost = true
734
+ } else if (item.json.optString("presentation") == "accountSelector") {
516
735
  icon.glyphSizeDp = 24
517
736
  val isSourceMenu = item.hasExplicitHeight && icon.iconName == "DotHorOutline"
518
737
  val size = if (item.hasExplicitHeight && icon.iconName == "PlusSmallOutline") 36 else 38
@@ -538,6 +757,13 @@ internal class NativeListAccessoryStack(context: android.content.Context, val fo
538
757
  addState(intArrayOf(), roundedFill(Color.TRANSPARENT, 19f))
539
758
  }
540
759
  }
760
+ } else if (icon.iconName == "RefreshCcwOutline" && data.optString("actionKey").isEmpty()) {
761
+ icon.glyphSizeDp = 16
762
+ icon.isClickable = false
763
+ icon.isFocusable = false
764
+ icon.layoutParams = LayoutParams(dp(16), dp(16)).apply {
765
+ gravity = Gravity.CENTER_VERTICAL
766
+ }
541
767
  } else if (icon.iconName == "ChevronRightSmallOutline") {
542
768
  icon.glyphSizeDp = null
543
769
  // ListItem.DrillIn is a 24dp icon with mx=-6, for a 12dp layout footprint.
@@ -709,3 +935,13 @@ internal class NativeListAccessoryStack(context: android.content.Context, val fo
709
935
  cornerRadius = scaledDp(radiusDp)
710
936
  }
711
937
  }
938
+
939
+ private class ValuePairTypefaceSpan(private val face: Typeface) : MetricAffectingSpan() {
940
+ override fun updateDrawState(paint: TextPaint) {
941
+ paint.typeface = face
942
+ }
943
+
944
+ override fun updateMeasureState(paint: TextPaint) {
945
+ paint.typeface = face
946
+ }
947
+ }
@@ -16,7 +16,11 @@ internal class NativeListActivityDetailsView(private val reactContext: ThemedRea
16
16
  var onAction: ((String, View, String, Int) -> Unit)? = null
17
17
  private var sourceScale = false
18
18
  private val main = LinearLayout(context).apply { orientation = HORIZONTAL; gravity = Gravity.CENTER_VERTICAL }
19
+ private val identityColumn = LinearLayout(context).apply { orientation = HORIZONTAL; gravity = Gravity.CENTER_VERTICAL }
19
20
  private val visual = NativeListLeadingVisual(reactContext, fonts)
21
+ /** Whether the bound leading visual lays a badge past its frame; see [setClipping]. */
22
+ var leadingOverhangs = false
23
+ private set
20
24
  private val identity = LinearLayout(context).apply { orientation = VERTICAL }
21
25
  private val titleLine = LinearLayout(context).apply { orientation = HORIZONTAL; gravity = Gravity.CENTER_VERTICAL }
22
26
  private val title = NativeListTextView(context)
@@ -40,13 +44,26 @@ internal class NativeListActivityDetailsView(private val reactContext: ThemedRea
40
44
  identity.addView(status)
41
45
  feeLine.addView(feePrimary); feeLine.addView(feeSecondary)
42
46
  fee.addView(feeLabel); fee.addView(feeLine)
43
- main.addView(visual)
44
- main.addView(identity, LayoutParams(0, -2, 1f))
47
+ identityColumn.addView(visual)
48
+ identityColumn.addView(identity, LayoutParams(0, -2, 1f))
49
+ main.addView(identityColumn, LayoutParams(0, -2, 1f))
45
50
  main.addView(amounts)
46
51
  main.addView(fee)
47
52
  addView(main, LayoutParams(-1, -2))
48
53
  addView(actions, LayoutParams(-1, -2))
49
54
  }
55
+ /**
56
+ * Android clips a child to its own bounds while its parent clips children, so
57
+ * every view between the leading visual and the row host stops clipping when
58
+ * the visual's network badge overhangs its box (SPEC "Leading badge overhang",
59
+ * OK-66275); the host row applies the same policy to itself.
60
+ */
61
+ private fun setClipping(clips: Boolean) {
62
+ for (group in listOf(identityColumn, main, this)) {
63
+ group.clipChildren = clips
64
+ group.clipToPadding = clips
65
+ }
66
+ }
50
67
  private fun dp(value: Int) = if (sourceScale) (value * resources.displayMetrics.density).roundToInt() else NativeListScale.dp(resources, value)
51
68
  private fun px(value: Double) = (value * resources.displayMetrics.density).roundToInt()
52
69
  private fun color(tone: String, theme: JSONObject?): Int {
@@ -70,10 +87,15 @@ internal class NativeListActivityDetailsView(private val reactContext: ThemedRea
70
87
  val style = data.optJSONObject("style") ?: JSONObject()
71
88
  val image = style.optJSONObject("image") ?: JSONObject()
72
89
  val table = data.optString("presentation") == "table"
90
+ val hideLeading = data.optBoolean("hideLeading")
73
91
  val gap = if (style.has("leadingGap")) px(style.optDouble("leadingGap")) else dp(12)
74
92
  val iw = if (image.has("width")) px(image.optDouble("width")) else dp(40)
75
- visual.layoutParams = LayoutParams(iw, if (image.has("height")) px(image.optDouble("height")) else dp(40)).apply { marginEnd = gap }
76
- visual.bind(data.optJSONObject("leading") ?: JSONObject(), image, item.key, theme, false, sourceScale, data.optJSONObject("secondaryLeading"))
93
+ visual.layoutParams = LayoutParams(iw, if (image.has("height")) px(image.optDouble("height")) else dp(40)).apply { marginEnd = if (hideLeading) 0 else gap }
94
+ visual.visibility = if (hideLeading) GONE else VISIBLE
95
+ if (hideLeading) visual.recycle()
96
+ else visual.bind(data.optJSONObject("leading") ?: JSONObject(), image, item.key, theme, false, sourceScale, data.optJSONObject("secondaryLeading"))
97
+ leadingOverhangs = !hideLeading && visual.requestsUnclippedHost
98
+ setClipping(nativeListActivityHostClips(leadingOverhangs))
77
99
  amounts.layoutParams = if (table) LayoutParams(0, -2, 1f).apply { marginStart = gap } else LayoutParams(-2, -2).apply { marginStart = gap }
78
100
  text(title, data.optString("title"), style.optJSONObject("title"), 16f, color("primary", theme), 24, "medium")
79
101
  text(description, data.optString("description"), style.optJSONObject("description"), 14f, color("secondary", theme), 20, lines = 2)
@@ -107,7 +129,9 @@ internal class NativeListActivityDetailsView(private val reactContext: ThemedRea
107
129
  val feeData = data.optJSONObject("fee")
108
130
  fee.visibility = if (feeData == null) GONE else VISIBLE
109
131
  fee.alpha = if (feeData?.optBoolean("hidden") == true) 0f else 1f
110
- fee.layoutParams = LayoutParams(-2, -2).apply { marginStart = gap }
132
+ fee.layoutParams = (if (table) LayoutParams(0, -2, 0.6f) else LayoutParams(-2, -2)).apply { marginStart = gap }
133
+ feeLabel.layoutParams.width = if (table) LayoutParams.WRAP_CONTENT else LayoutParams.MATCH_PARENT
134
+ feeLine.layoutParams.width = if (table) LayoutParams.WRAP_CONTENT else LayoutParams.MATCH_PARENT
111
135
  text(feeLabel, feeData?.optString("label") ?: "", style.optJSONObject("secondaryAmount"), 12f, color("secondary", theme), 16)
112
136
  text(feePrimary, feeData?.optString("primary") ?: "", style.optJSONObject("secondaryAmount"), 14f, color("primary", theme), 20)
113
137
  text(feeSecondary, feeData?.optString("secondary") ?: "", style.optJSONObject("secondaryAmount"), 12f, color("secondary", theme), 16)
@@ -117,7 +141,7 @@ internal class NativeListActivityDetailsView(private val reactContext: ThemedRea
117
141
  actions.removeAllViews()
118
142
  val actionData = data.optJSONArray("footerActions")
119
143
  actions.visibility = if ((actionData?.length() ?: 0) == 0) GONE else VISIBLE
120
- actions.layoutParams = LayoutParams(-1, -2).apply { marginStart = iw + gap; topMargin = dp(8) }
144
+ actions.layoutParams = LayoutParams(-1, -2).apply { marginStart = if (hideLeading) 0 else iw + gap; topMargin = dp(8) }
121
145
  for (index in 0 until (actionData?.length() ?: 0)) {
122
146
  val descriptor = actionData!!.getJSONObject(index)
123
147
  val button = NativeListTextView(context)
@@ -146,7 +170,11 @@ internal class NativeListActivityDetailsView(private val reactContext: ThemedRea
146
170
  }
147
171
  label.text = styled
148
172
  }
149
- fun recycle() { visual.recycle(); amountViews.forEach { it.recycle() }; description.setOnClickListener(null); actions.removeAllViews() }
173
+ fun recycle() {
174
+ visual.recycle(); visual.visibility = VISIBLE; amountViews.forEach { it.recycle() }; description.setOnClickListener(null); actions.removeAllViews()
175
+ leadingOverhangs = false
176
+ setClipping(true)
177
+ }
150
178
  fun dispose() { recycle(); visual.dispose(); amountViews.forEach { it.dispose() } }
151
179
 
152
180
  private inner class AmountView : LinearLayout(context) {
@@ -54,6 +54,13 @@ internal class NativeListActivityRowView(context: ThemedReactContext, fonts: Nat
54
54
  details.onAction = { key, view, source, slot -> emitAction(key, view, source, slot) }
55
55
  }
56
56
 
57
+ /** Host clipping for the current bind; see [nativeListActivityHostClips]. */
58
+ private fun setHostClipping(clips: Boolean) {
59
+ content.clipChildren = clips
60
+ clipChildren = clips
61
+ clipToPadding = clips
62
+ }
63
+
57
64
  override fun defaultHeight(item: NativeListItem, layout: String) =
58
65
  if (item.json.has("amounts")) 0 else if ((item.json.optJSONArray("footerActions")?.length() ?: 0) > 0) 104 else 60
59
66
 
@@ -76,11 +83,17 @@ internal class NativeListActivityRowView(context: ThemedReactContext, fonts: Nat
76
83
  setPadding(hp, vp, hp, vp)
77
84
  visual.recycle()
78
85
  details.bind(item, theme, sourceScale)
86
+ // The rich row's leading visual lives on the details view, where its
87
+ // network badge overhangs the box (OK-66275): this host must stop clipping
88
+ // as well, and a view reused from a badge row clips again when the bound
89
+ // row has no badge.
90
+ setHostClipping(nativeListActivityHostClips(details.leadingOverhangs))
79
91
  return
80
92
  }
81
93
  details.recycle()
82
94
  val style = data.optJSONObject("style") ?: JSONObject()
83
95
  val image = style.optJSONObject("image") ?: JSONObject()
96
+ val hideLeading = data.optBoolean("hideLeading")
84
97
  fun color(name: String, fallback: String) =
85
98
  parseNativeListColor(theme?.optString(name, fallback) ?: fallback)
86
99
  fun fill(value: Int, radius: Int) =
@@ -143,8 +156,10 @@ internal class NativeListActivityRowView(context: ThemedReactContext, fonts: Nat
143
156
  val iw = if (image.has("width")) stylePx(image.optDouble("width")) else dp(40)
144
157
  val ih = if (image.has("height")) stylePx(image.optDouble("height")) else dp(40)
145
158
  val gap = if (style.has("leadingGap")) stylePx(style.optDouble("leadingGap")) else dp(12)
146
- visual.layoutParams = LayoutParams(iw, ih).apply { marginEnd = gap }
147
- visual.bind(
159
+ visual.layoutParams = LayoutParams(iw, ih).apply { marginEnd = if (hideLeading) 0 else gap }
160
+ visual.visibility = if (hideLeading) GONE else VISIBLE
161
+ if (hideLeading) visual.recycle()
162
+ else visual.bind(
148
163
  // Legacy: a missing visual still reserves an empty, transparent slot.
149
164
  data.optJSONObject("leading") ?: JSONObject().put("backgroundColor", "#00000000"),
150
165
  image,
@@ -154,6 +169,13 @@ internal class NativeListActivityRowView(context: ThemedReactContext, fonts: Nat
154
169
  sourceScale,
155
170
  data.optJSONObject("secondaryLeading"),
156
171
  )
172
+ // The token network badge hangs 4dp past the 40dp visual and Android clips a
173
+ // child to its own bounds while its parent clips children, so with the
174
+ // default clipping the history rows showed the badge cut flat (OK-66071).
175
+ // Stop clipping the content row and this row's padding exactly when the
176
+ // bound visual reports such a badge (SPEC "Leading badge overhang"), as the
177
+ // Identity renderer does.
178
+ setHostClipping(nativeListActivityHostClips(!hideLeading && visual.requestsUnclippedHost))
157
179
  bind(
158
180
  title,
159
181
  data.optString("title"),
@@ -212,7 +234,7 @@ internal class NativeListActivityRowView(context: ThemedReactContext, fonts: Nat
212
234
  actions.visibility = if (count == 0) GONE else VISIBLE
213
235
  actions.layoutParams =
214
236
  LayoutParams(LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT).apply {
215
- marginStart = if (style.has("leadingGap") || image.has("width")) iw + gap else dp(52)
237
+ marginStart = if (hideLeading) 0 else if (style.has("leadingGap") || image.has("width")) iw + gap else dp(52)
216
238
  topMargin = if (style.has("lineGap")) stylePx(style.optDouble("lineGap")) else dp(8)
217
239
  bottomMargin = dp(4)
218
240
  }
@@ -240,9 +240,10 @@ internal class NativeListAdapter(
240
240
 
241
241
  private fun isMarketQuoteUpdate(oldItem: NativeListItem, newItem: NativeListItem): Boolean {
242
242
  if (oldItem.type != "market" || newItem.type != "market") return false
243
+ if (!hasSameMarketMetricStructure(oldItem, newItem)) return false
243
244
  fun stableContent(item: NativeListItem): String {
244
245
  val value = JSONObject(item.json.toString())
245
- listOf("revision", "price", "priceSegments", "change", "accessibilityLabel")
246
+ listOf("revision", "price", "priceSegments", "change", "accessibilityLabel", "metrics")
246
247
  .forEach(value::remove)
247
248
  return value.toString()
248
249
  }
@@ -256,3 +257,18 @@ internal const val SELECTION_PAYLOAD = "selection"
256
257
  // OneKey patch: internal payload, never exposed through the serialized row contract.
257
258
  internal const val SELECTION_ECHO_PAYLOAD = "selectionEcho"
258
259
  internal const val MARKET_QUOTE_PAYLOAD = "marketQuote"
260
+
261
+ internal fun hasSameMarketMetricStructure(before: NativeListItem, after: NativeListItem): Boolean {
262
+ val old = before.json.optJSONArray("metrics")
263
+ val next = after.json.optJSONArray("metrics")
264
+ val oldCount = old?.length() ?: 0
265
+ if (oldCount != (next?.length() ?: 0)) return false
266
+ for (index in 0 until oldCount) {
267
+ val previous = old?.optJSONObject(index) ?: return false
268
+ val current = next?.optJSONObject(index) ?: return false
269
+ if (previous.optString("key") != current.optString("key") ||
270
+ previous.optInt("weight", 1) != current.optInt("weight", 1) ||
271
+ previous.optString("alignment", "end") != current.optString("alignment", "end")) return false
272
+ }
273
+ return true
274
+ }