@onekeyfe/react-native-native-list 3.0.179-alpha.304 → 3.0.179
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 +3 -32
- package/android/build.gradle +1 -0
- package/android/src/main/java/com/onekey/nativelist/HybridNativeList.kt +1 -22
- package/android/src/main/java/com/onekey/nativelist/NativeListAccessoryStack.kt +8 -8
- package/android/src/main/java/com/onekey/nativelist/NativeListActionRenderer.kt +5 -5
- package/android/src/main/java/com/onekey/nativelist/NativeListActivityDetailsView.kt +4 -4
- package/android/src/main/java/com/onekey/nativelist/NativeListActivityRenderer.kt +6 -6
- package/android/src/main/java/com/onekey/nativelist/NativeListAdapter.kt +1 -6
- package/android/src/main/java/com/onekey/nativelist/NativeListDataRowRenderer.kt +11 -11
- package/android/src/main/java/com/onekey/nativelist/NativeListIdentityRenderer.kt +20 -20
- package/android/src/main/java/com/onekey/nativelist/NativeListLeadingVisual.kt +4 -5
- package/android/src/main/java/com/onekey/nativelist/NativeListMarketRenderer.kt +7 -7
- package/android/src/main/java/com/onekey/nativelist/NativeListMediaTileRenderer.kt +5 -5
- package/android/src/main/java/com/onekey/nativelist/NativeListMessageRenderer.kt +7 -8
- package/android/src/main/java/com/onekey/nativelist/NativeListMetricCardRenderer.kt +14 -14
- package/android/src/main/java/com/onekey/nativelist/NativeListPrimitives.kt +15 -28
- package/android/src/main/java/com/onekey/nativelist/NativeListRailRenderer.kt +4 -4
- package/android/src/main/java/com/onekey/nativelist/NativeListRendererRegistry.kt +3 -3
- package/android/src/main/java/com/onekey/nativelist/NativeListRendererRowView.kt +2 -3
- package/android/src/main/java/com/onekey/nativelist/NativeListResolvedText.kt +4 -5
- package/android/src/main/java/com/onekey/nativelist/NativeListRowHost.kt +1 -1
- package/android/src/main/java/com/onekey/nativelist/NativeListSectionHeaderRenderer.kt +20 -20
- package/android/src/main/java/com/onekey/nativelist/NativeListSystemRenderer.kt +3 -3
- package/android/src/main/java/com/onekey/nativelist/NativeListView.kt +18 -104
- package/android/src/main/java/com/onekey/nativelist/NativeListWalletGroupRenderer.kt +5 -6
- package/common/fonts/Roobert-Bold.ttf +0 -0
- package/common/fonts/Roobert-Medium.ttf +0 -0
- package/common/fonts/Roobert-Regular.ttf +0 -0
- package/common/fonts/Roobert-SemiBold.ttf +0 -0
- package/docs/SPEC.md +0 -69
- package/docs/STYLE_SPEC.md +2 -12
- package/ios/HybridNativeList.swift +6 -18
- package/ios/NativeListAccessoryStack.swift +10 -14
- package/ios/NativeListActionRenderer.swift +4 -7
- package/ios/NativeListActivityDetailsView.swift +24 -63
- package/ios/NativeListActivityRenderer.swift +10 -19
- package/ios/NativeListDataRowRenderer.swift +19 -23
- package/ios/NativeListDesignAssets.swift +34 -43
- package/ios/NativeListIdentityRenderer.swift +19 -23
- package/ios/NativeListLeadingVisual.swift +4 -9
- package/ios/NativeListMarketRenderer.swift +11 -19
- package/ios/NativeListMediaTileRenderer.swift +7 -11
- package/ios/NativeListMessageRenderer.swift +10 -20
- package/ios/NativeListMetricCardRenderer.swift +12 -16
- package/ios/NativeListRailRenderer.swift +7 -9
- package/ios/NativeListRendererCell.swift +4 -6
- package/ios/NativeListRendererRegistry.swift +3 -8
- package/ios/NativeListResolvedText.swift +3 -3
- package/ios/NativeListRowHost.swift +2 -7
- package/ios/NativeListSectionHeaderRenderer.swift +19 -22
- package/ios/NativeListSystemRenderer.swift +16 -18
- package/ios/NativeListTextStyles.swift +12 -18
- package/ios/NativeListWalletGroupRenderer.swift +4 -6
- package/ios/RNCNativeListView.swift +5 -38
- package/ios/tests/NativeListActivityPresentationTests.swift +3 -5
- package/ios/tests/NativeListLifecycleTests.swift +2 -77
- package/lib/module/NativeList.js +0 -3
- package/lib/module/NativeList.web.js +1 -8
- package/lib/module/index.js +0 -1
- package/lib/module/web/NativeListWebEngine.js +24 -48
- package/lib/module/web/templates/ActionRowRenderer.js +1 -2
- package/lib/module/web/templates/IdentityRowRenderer.js +3 -4
- package/lib/module/web/templates/MarketRowRenderer.js +1 -2
- package/lib/module/web/templates/RowText.js +3 -13
- package/lib/module/web/templates/SectionHeaderRowRenderer.js +2 -3
- package/lib/nitrogen/generated/android/c++/JHybridNativeListSpec.cpp +0 -9
- package/lib/nitrogen/generated/android/c++/JHybridNativeListSpec.hpp +0 -2
- package/lib/nitrogen/generated/android/c++/views/JHybridNativeListStateUpdater.cpp +0 -5
- package/lib/nitrogen/generated/android/kotlin/com/margelo/nitro/nativelist/HybridNativeListSpec.kt +0 -6
- package/lib/nitrogen/generated/ios/c++/HybridNativeListSpecSwift.hpp +0 -7
- package/lib/nitrogen/generated/ios/c++/views/HybridNativeListComponent.mm +0 -6
- package/lib/nitrogen/generated/ios/swift/HybridNativeListSpec.swift +0 -1
- package/lib/nitrogen/generated/ios/swift/HybridNativeListSpec_cxx.swift +0 -11
- package/lib/nitrogen/generated/shared/c++/HybridNativeListSpec.cpp +0 -2
- package/lib/nitrogen/generated/shared/c++/HybridNativeListSpec.hpp +0 -2
- package/lib/nitrogen/generated/shared/c++/views/HybridNativeListComponent.cpp +0 -2
- package/lib/nitrogen/generated/shared/c++/views/HybridNativeListComponent.hpp +0 -3
- package/lib/nitrogen/generated/shared/json/NativeListConfig.json +0 -1
- package/lib/typescript/src/NativeList.nitro.d.ts +0 -1
- package/lib/typescript/src/index.d.ts +0 -2
- package/lib/typescript/src/web/NativeListWebEngine.d.ts +1 -4
- package/lib/typescript/src/web/templates/RowText.d.ts +0 -1
- package/nitrogen/generated/android/c++/JHybridNativeListSpec.cpp +0 -9
- package/nitrogen/generated/android/c++/JHybridNativeListSpec.hpp +0 -2
- package/nitrogen/generated/android/c++/views/JHybridNativeListStateUpdater.cpp +0 -5
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/nativelist/HybridNativeListSpec.kt +0 -6
- package/nitrogen/generated/ios/c++/HybridNativeListSpecSwift.hpp +0 -7
- package/nitrogen/generated/ios/c++/views/HybridNativeListComponent.mm +0 -6
- package/nitrogen/generated/ios/swift/HybridNativeListSpec.swift +0 -1
- package/nitrogen/generated/ios/swift/HybridNativeListSpec_cxx.swift +0 -11
- package/nitrogen/generated/shared/c++/HybridNativeListSpec.cpp +0 -2
- package/nitrogen/generated/shared/c++/HybridNativeListSpec.hpp +0 -2
- package/nitrogen/generated/shared/c++/views/HybridNativeListComponent.cpp +0 -2
- package/nitrogen/generated/shared/c++/views/HybridNativeListComponent.hpp +0 -3
- package/nitrogen/generated/shared/json/NativeListConfig.json +0 -1
- package/package.json +5 -4
- package/react-native-native-list.podspec +1 -0
- package/src/NativeList.nitro.ts +0 -1
- package/src/NativeList.tsx +0 -3
- package/src/NativeList.web.tsx +1 -10
- package/src/index.ts +0 -3
- package/src/web/NativeListWebEngine.ts +24 -53
- package/src/web/templates/ActionRowRenderer.ts +1 -2
- package/src/web/templates/IdentityRowRenderer.ts +3 -4
- package/src/web/templates/MarketRowRenderer.ts +2 -4
- package/src/web/templates/RowText.ts +3 -15
- package/src/web/templates/SectionHeaderRowRenderer.ts +3 -6
- package/LICENSE +0 -36
- package/lib/module/fonts.js +0 -44
- package/lib/typescript/src/fonts.d.ts +0 -10
- package/src/fonts.ts +0 -64
package/README.md
CHANGED
|
@@ -161,38 +161,9 @@ full window and center it on the window's geometric midpoint.
|
|
|
161
161
|
The web implementation renders the same explicit index entries as a DOM
|
|
162
162
|
overlay, with click and pointer-drag navigation.
|
|
163
163
|
|
|
164
|
-
The templates
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
mapping; omitted faces and `{}` use system fonts. Mounted lists subscribe to
|
|
168
|
-
this runtime's mapping, with an independent native resolver per list. There is
|
|
169
|
-
no public per-list override and no cross-runtime native-global mapping.
|
|
170
|
-
|
|
171
|
-
```tsx
|
|
172
|
-
import { configureNativeListFonts } from '@onekeyfe/react-native-native-list';
|
|
173
|
-
|
|
174
|
-
// After the host provisions/registers these faces, before mounting lists:
|
|
175
|
-
configureNativeListFonts({
|
|
176
|
-
regular: 'Roobert-Regular',
|
|
177
|
-
medium: 'Roobert-Medium',
|
|
178
|
-
semibold: 'Roobert-SemiBold',
|
|
179
|
-
bold: 'Roobert-Bold',
|
|
180
|
-
});
|
|
181
|
-
```
|
|
182
|
-
|
|
183
|
-
On iOS these are registered PostScript names; on Android they are React Native
|
|
184
|
-
family keys or matching `fonts/<family>.ttf` host assets. For Web, map each face
|
|
185
|
-
to the host's CSS family (for example, `Roobert` for all four weights) and wait
|
|
186
|
-
for the four weight-specific font loads before rendering. The host remains
|
|
187
|
-
responsible for licensing and provisioning. Changed mappings rebind text and
|
|
188
|
-
invalidate list geometry without replacing snapshots or selection; identical
|
|
189
|
-
normalized mappings do nothing. Active reorders are cancelled. Missing configured
|
|
190
|
-
names use the platform fallback, which on Android may lose the requested weight.
|
|
191
|
-
Names must be nonempty trimmed strings, at most 128 UTF-16 units without control
|
|
192
|
-
characters; invalid keys/values throw before changing any configuration. See
|
|
193
|
-
[SPEC.md](docs/SPEC.md) and [STYLE_SPEC.md](docs/STYLE_SPEC.md) for lifecycle,
|
|
194
|
-
system fallback and text-metric acceptance requirements. Their semantic icons and checkbox marks are
|
|
195
|
-
the same vector paths as the OneKey component
|
|
164
|
+
The native templates bundle OneKey's Roobert Regular, Medium, SemiBold, and
|
|
165
|
+
Bold faces and use them before the platform-font fallback. Their semantic
|
|
166
|
+
icons and checkbox marks are the same vector paths as the OneKey component
|
|
196
167
|
library, rendered by Core Graphics/UIKit on iOS and Canvas on Android.
|
|
197
168
|
|
|
198
169
|
### Market rows
|
package/android/build.gradle
CHANGED
|
@@ -31,27 +31,6 @@ class HybridNativeList(context: ThemedReactContext) : HybridNativeListSpec() {
|
|
|
31
31
|
dispatchToUi { hostView.setContainerSlotHeightsJson(value) }
|
|
32
32
|
}
|
|
33
33
|
|
|
34
|
-
private var fontsChanged = false
|
|
35
|
-
private var snapshotChanged = false
|
|
36
|
-
|
|
37
|
-
override var fontFamiliesJson: String = "{}"
|
|
38
|
-
set(value) {
|
|
39
|
-
if (field == value) return
|
|
40
|
-
field = value
|
|
41
|
-
fontsChanged = true
|
|
42
|
-
}
|
|
43
|
-
|
|
44
|
-
override fun afterUpdate() {
|
|
45
|
-
super.afterUpdate()
|
|
46
|
-
val fonts = if (fontsChanged) fontFamiliesJson else null
|
|
47
|
-
val snapshot = if (snapshotChanged) snapshotJson else null
|
|
48
|
-
fontsChanged = false
|
|
49
|
-
snapshotChanged = false
|
|
50
|
-
dispatchToUi {
|
|
51
|
-
fonts?.let { hostView.setFontFamiliesJson(it) }
|
|
52
|
-
snapshot?.let { hostView.applySnapshot(it) }
|
|
53
|
-
}
|
|
54
|
-
}
|
|
55
34
|
override var topScrollEdgeHard: Boolean = false
|
|
56
35
|
override var topOverlayHeight: Double = 0.0
|
|
57
36
|
|
|
@@ -60,7 +39,7 @@ class HybridNativeList(context: ThemedReactContext) : HybridNativeListSpec() {
|
|
|
60
39
|
set(value) {
|
|
61
40
|
if (field == value) return
|
|
62
41
|
field = value
|
|
63
|
-
|
|
42
|
+
dispatchToUi { hostView.applySnapshot(value) }
|
|
64
43
|
}
|
|
65
44
|
|
|
66
45
|
override var keyboardDismissMode: NativeListKeyboardDismissMode = NativeListKeyboardDismissMode.NONE
|
|
@@ -27,7 +27,7 @@ import org.json.JSONArray
|
|
|
27
27
|
import org.json.JSONObject
|
|
28
28
|
|
|
29
29
|
// Bounded controls only. Event ownership and epochs stay with the row host.
|
|
30
|
-
internal class NativeListAccessoryStack(context: android.content.Context
|
|
30
|
+
internal class NativeListAccessoryStack(context: android.content.Context) : LinearLayout(context) {
|
|
31
31
|
private val trailingViews = List(2) { NativeListTextView(context) }
|
|
32
32
|
private val trailingIcons = List(2) { OneKeyIconView(context) }
|
|
33
33
|
private val checkbox = OneKeyCheckboxView(context)
|
|
@@ -404,7 +404,7 @@ internal class NativeListAccessoryStack(context: android.content.Context, val fo
|
|
|
404
404
|
view.text = value
|
|
405
405
|
view.textSize = sp(if (primary) 16f else 14f)
|
|
406
406
|
view.typeface =
|
|
407
|
-
if (primary)
|
|
407
|
+
if (primary) NativeListFonts.medium(context) else NativeListFonts.regular(context)
|
|
408
408
|
view.includeFontPadding = false
|
|
409
409
|
view.fontFeatureSettings = "tnum"
|
|
410
410
|
TextViewCompat.setLineHeight(view, dp(if (primary) 24 else 20))
|
|
@@ -467,7 +467,7 @@ internal class NativeListAccessoryStack(context: android.content.Context, val fo
|
|
|
467
467
|
view.maxLines = 2
|
|
468
468
|
view.gravity = Gravity.END
|
|
469
469
|
view.includeFontPadding = false
|
|
470
|
-
view.typeface =
|
|
470
|
+
view.typeface = NativeListFonts.regular(context)
|
|
471
471
|
view.fontFeatureSettings = "tnum"
|
|
472
472
|
TextViewCompat.setLineHeight(view, dp(20))
|
|
473
473
|
view.visibility = VISIBLE
|
|
@@ -599,7 +599,7 @@ internal class NativeListAccessoryStack(context: android.content.Context, val fo
|
|
|
599
599
|
}
|
|
600
600
|
view.textSize = sp(fontSize.toFloat())
|
|
601
601
|
view.typeface =
|
|
602
|
-
if (medium)
|
|
602
|
+
if (medium) NativeListFonts.medium(context) else NativeListFonts.regular(context)
|
|
603
603
|
TextViewCompat.setLineHeight(view, dp(lineHeight))
|
|
604
604
|
view.text = value
|
|
605
605
|
}
|
|
@@ -680,10 +680,10 @@ internal class NativeListAccessoryStack(context: android.content.Context, val fo
|
|
|
680
680
|
|
|
681
681
|
private fun marketTypeface(weight: String, fallback: String): Typeface =
|
|
682
682
|
when (weight.ifEmpty { fallback }) {
|
|
683
|
-
"regular" ->
|
|
684
|
-
"semibold" ->
|
|
685
|
-
"bold" ->
|
|
686
|
-
else ->
|
|
683
|
+
"regular" -> NativeListFonts.regular(context)
|
|
684
|
+
"semibold" -> NativeListFonts.semibold(context)
|
|
685
|
+
"bold" -> NativeListFonts.bold(context)
|
|
686
|
+
else -> NativeListFonts.medium(context)
|
|
687
687
|
}
|
|
688
688
|
|
|
689
689
|
private fun safeColor(value: String?, fallback: Int): Int =
|
|
@@ -5,11 +5,11 @@ import com.facebook.react.uimanager.ThemedReactContext
|
|
|
5
5
|
import org.json.JSONArray
|
|
6
6
|
import org.json.JSONObject
|
|
7
7
|
|
|
8
|
-
internal class NativeListActionRowView(context: ThemedReactContext
|
|
9
|
-
NativeListRendererRowView(context
|
|
10
|
-
private val visual = NativeListLeadingVisual(context
|
|
8
|
+
internal class NativeListActionRowView(context: ThemedReactContext) :
|
|
9
|
+
NativeListRendererRowView(context) {
|
|
10
|
+
private val visual = NativeListLeadingVisual(context)
|
|
11
11
|
private val title = NativeListTextView(context)
|
|
12
|
-
private val accessories = NativeListAccessoryStack(context
|
|
12
|
+
private val accessories = NativeListAccessoryStack(context)
|
|
13
13
|
override val assetFields = listOf("icon")
|
|
14
14
|
|
|
15
15
|
init {
|
|
@@ -77,7 +77,7 @@ internal class NativeListActionRowView(context: ThemedReactContext, fonts: Nativ
|
|
|
77
77
|
if (token == "negative") "#C40006D3"
|
|
78
78
|
else if (selector || token == "secondaryText") "#0000009B" else "#000000DF"
|
|
79
79
|
NativeListResolvedText.resolve(
|
|
80
|
-
context,
|
|
80
|
+
context,
|
|
81
81
|
item.json.optString("title"),
|
|
82
82
|
style.optJSONObject("title"),
|
|
83
83
|
16f,
|
|
@@ -12,11 +12,11 @@ import kotlin.math.roundToInt
|
|
|
12
12
|
import org.json.JSONObject
|
|
13
13
|
|
|
14
14
|
/** Bounded rich activity fields; no wallet or transaction semantics live here. */
|
|
15
|
-
internal class NativeListActivityDetailsView(private val reactContext: ThemedReactContext
|
|
15
|
+
internal class NativeListActivityDetailsView(private val reactContext: ThemedReactContext) : LinearLayout(reactContext) {
|
|
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 visual = NativeListLeadingVisual(reactContext
|
|
19
|
+
private val visual = NativeListLeadingVisual(reactContext)
|
|
20
20
|
private val identity = LinearLayout(context).apply { orientation = VERTICAL }
|
|
21
21
|
private val titleLine = LinearLayout(context).apply { orientation = HORIZONTAL; gravity = Gravity.CENTER_VERTICAL }
|
|
22
22
|
private val title = NativeListTextView(context)
|
|
@@ -62,7 +62,7 @@ internal class NativeListActivityDetailsView(private val reactContext: ThemedRea
|
|
|
62
62
|
}
|
|
63
63
|
private fun text(label: NativeListTextView, value: String, style: JSONObject?, size: Float,
|
|
64
64
|
ink: Int, line: Int, weight: String = "regular", lines: Int = 1) {
|
|
65
|
-
NativeListResolvedText.resolve(context,
|
|
65
|
+
NativeListResolvedText.resolve(context, value, style, size, weight, ink, line, lines, sourceScale).bind(label)
|
|
66
66
|
}
|
|
67
67
|
fun bind(item: NativeListItem, theme: JSONObject?, sourceScale: Boolean) {
|
|
68
68
|
this.sourceScale = sourceScale
|
|
@@ -150,7 +150,7 @@ internal class NativeListActivityDetailsView(private val reactContext: ThemedRea
|
|
|
150
150
|
fun dispose() { recycle(); visual.dispose(); amountViews.forEach { it.dispose() } }
|
|
151
151
|
|
|
152
152
|
private inner class AmountView : LinearLayout(context) {
|
|
153
|
-
private val leading = NativeListLeadingVisual(reactContext
|
|
153
|
+
private val leading = NativeListLeadingVisual(reactContext)
|
|
154
154
|
private val labels = LinearLayout(context).apply { orientation = VERTICAL }
|
|
155
155
|
private val primary = NativeListTextView(context)
|
|
156
156
|
private val secondary = NativeListTextView(context)
|
|
@@ -7,15 +7,15 @@ import android.widget.LinearLayout
|
|
|
7
7
|
import com.facebook.react.uimanager.ThemedReactContext
|
|
8
8
|
import org.json.JSONObject
|
|
9
9
|
|
|
10
|
-
internal class NativeListActivityRowView(context: ThemedReactContext
|
|
11
|
-
NativeListRendererRowView(context
|
|
12
|
-
private val details = NativeListActivityDetailsView(context
|
|
10
|
+
internal class NativeListActivityRowView(context: ThemedReactContext) :
|
|
11
|
+
NativeListRendererRowView(context) {
|
|
12
|
+
private val details = NativeListActivityDetailsView(context)
|
|
13
13
|
private val content =
|
|
14
14
|
LinearLayout(context).apply {
|
|
15
15
|
orientation = HORIZONTAL
|
|
16
16
|
gravity = Gravity.CENTER_VERTICAL
|
|
17
17
|
}
|
|
18
|
-
private val visual = NativeListLeadingVisual(context
|
|
18
|
+
private val visual = NativeListLeadingVisual(context)
|
|
19
19
|
private val column = LinearLayout(context).apply { orientation = VERTICAL }
|
|
20
20
|
private val titleLine =
|
|
21
21
|
LinearLayout(context).apply {
|
|
@@ -104,7 +104,7 @@ internal class NativeListActivityRowView(context: ThemedReactContext, fonts: Nat
|
|
|
104
104
|
if (!has("alignment")) put("alignment", align)
|
|
105
105
|
}
|
|
106
106
|
NativeListResolvedText.resolve(
|
|
107
|
-
context,
|
|
107
|
+
context,
|
|
108
108
|
value,
|
|
109
109
|
textStyle,
|
|
110
110
|
size,
|
|
@@ -222,7 +222,7 @@ internal class NativeListActivityRowView(context: ThemedReactContext, fonts: Nat
|
|
|
222
222
|
if (index >= count) continue
|
|
223
223
|
val action = descriptors!!.getJSONObject(index)
|
|
224
224
|
NativeListResolvedText.resolve(
|
|
225
|
-
context,
|
|
225
|
+
context,
|
|
226
226
|
action.optString("label"),
|
|
227
227
|
null,
|
|
228
228
|
// Legacy footer action: 14sp semibold on a 20dp line.
|
|
@@ -18,7 +18,6 @@ internal class NativeListViewHolder(val rowView: NativeListRowHost) :
|
|
|
18
18
|
|
|
19
19
|
internal class NativeListAdapter(
|
|
20
20
|
private val context: ThemedReactContext,
|
|
21
|
-
private val fonts: NativeListFonts,
|
|
22
21
|
) : RecyclerView.Adapter<NativeListViewHolder>() {
|
|
23
22
|
private var suppressDifferUpdates = false
|
|
24
23
|
private var needsThemeRebind = false
|
|
@@ -77,7 +76,7 @@ internal class NativeListAdapter(
|
|
|
77
76
|
requireNotNull(itemAt(position)).rendererKey.ordinal
|
|
78
77
|
|
|
79
78
|
override fun onCreateViewHolder(parent: ViewGroup, viewType: Int): NativeListViewHolder {
|
|
80
|
-
val view = NativeListRendererRegistry.create(context, viewType
|
|
79
|
+
val view = NativeListRendererRegistry.create(context, viewType)
|
|
81
80
|
view.layoutParams = ViewGroup.LayoutParams(
|
|
82
81
|
ViewGroup.LayoutParams.MATCH_PARENT,
|
|
83
82
|
ViewGroup.LayoutParams.WRAP_CONTENT,
|
|
@@ -138,10 +137,6 @@ internal class NativeListAdapter(
|
|
|
138
137
|
super.onViewRecycled(holder)
|
|
139
138
|
}
|
|
140
139
|
|
|
141
|
-
fun rebindFonts() {
|
|
142
|
-
notifyItemRangeChanged(0, itemCount)
|
|
143
|
-
}
|
|
144
|
-
|
|
145
140
|
fun itemAt(position: Int): NativeListItem? =
|
|
146
141
|
reorderItems?.getOrNull(position) ?: differ.currentList.getOrNull(position)
|
|
147
142
|
|
|
@@ -11,17 +11,17 @@ import kotlin.math.roundToInt
|
|
|
11
11
|
import org.json.JSONArray
|
|
12
12
|
import org.json.JSONObject
|
|
13
13
|
|
|
14
|
-
internal class NativeListDataRowView(context: ThemedReactContext
|
|
15
|
-
NativeListRendererRowView(context
|
|
16
|
-
private val visual = NativeListLeadingVisual(context
|
|
14
|
+
internal class NativeListDataRowView(context: ThemedReactContext) :
|
|
15
|
+
NativeListRendererRowView(context) {
|
|
16
|
+
private val visual = NativeListLeadingVisual(context)
|
|
17
17
|
private val favorite = OneKeyIconView(context)
|
|
18
|
-
private val accessories = NativeListAccessoryStack(context
|
|
18
|
+
private val accessories = NativeListAccessoryStack(context)
|
|
19
19
|
private val columns =
|
|
20
20
|
LinearLayout(context).apply {
|
|
21
21
|
orientation = HORIZONTAL
|
|
22
22
|
gravity = Gravity.CENTER_VERTICAL
|
|
23
23
|
}
|
|
24
|
-
private val cells = List(4) { NativeListTableColumnView(context
|
|
24
|
+
private val cells = List(4) { NativeListTableColumnView(context) }
|
|
25
25
|
|
|
26
26
|
override fun unselectedBackground(
|
|
27
27
|
item: NativeListItem,
|
|
@@ -212,7 +212,7 @@ internal class NativeListDataRowView(context: ThemedReactContext, fonts: NativeL
|
|
|
212
212
|
}
|
|
213
213
|
}
|
|
214
214
|
|
|
215
|
-
private class NativeListTableColumnView(context: android.content.Context
|
|
215
|
+
private class NativeListTableColumnView(context: android.content.Context) : LinearLayout(context) {
|
|
216
216
|
private val primaryLine = LinearLayout(context)
|
|
217
217
|
private val primary = NativeListTextView(context)
|
|
218
218
|
private val badges = LinearLayout(context)
|
|
@@ -231,7 +231,7 @@ private class NativeListTableColumnView(context: android.content.Context, privat
|
|
|
231
231
|
primary.maxLines = 1
|
|
232
232
|
primary.ellipsize = TextUtils.TruncateAt.END
|
|
233
233
|
primary.textSize = sp(14f)
|
|
234
|
-
primary.typeface =
|
|
234
|
+
primary.typeface = NativeListFonts.medium(context)
|
|
235
235
|
TextViewCompat.setLineHeight(primary, dp(20))
|
|
236
236
|
secondaryLine.orientation = HORIZONTAL
|
|
237
237
|
secondaryLine.gravity = Gravity.CENTER_VERTICAL
|
|
@@ -241,7 +241,7 @@ private class NativeListTableColumnView(context: android.content.Context, privat
|
|
|
241
241
|
label.maxLines = 1
|
|
242
242
|
label.ellipsize = TextUtils.TruncateAt.END
|
|
243
243
|
label.textSize = sp(12f)
|
|
244
|
-
label.typeface =
|
|
244
|
+
label.typeface = NativeListFonts.regular(context)
|
|
245
245
|
TextViewCompat.setLineHeight(label, dp(16))
|
|
246
246
|
}
|
|
247
247
|
secondaryLeading.maxWidth = dp(120)
|
|
@@ -322,7 +322,7 @@ private class NativeListTableColumnView(context: android.content.Context, privat
|
|
|
322
322
|
JSONObject(style.optJSONObject(slot)?.toString() ?: "{}").apply {
|
|
323
323
|
if (!has("alignment")) put("alignment", column.optString("alignment", "start"))
|
|
324
324
|
}
|
|
325
|
-
NativeListResolvedText.resolve(context,
|
|
325
|
+
NativeListResolvedText.resolve(context, value, resolved, size, weight, color, line, 1, false)
|
|
326
326
|
.bind(view)
|
|
327
327
|
if (resolved.optString("truncate") != "clip") view.ellipsize = TextUtils.TruncateAt.END
|
|
328
328
|
}
|
|
@@ -355,7 +355,7 @@ private class NativeListTableColumnView(context: android.content.Context, privat
|
|
|
355
355
|
gravity = Gravity.CENTER
|
|
356
356
|
text = rowBadges.getJSONObject(index).optString("text")
|
|
357
357
|
textSize = sp(10f)
|
|
358
|
-
typeface =
|
|
358
|
+
typeface = NativeListFonts.regular(context)
|
|
359
359
|
setTextColor(infoColor)
|
|
360
360
|
setPadding(dp(6), 0, dp(6), 0)
|
|
361
361
|
background =
|
|
@@ -444,7 +444,7 @@ private class NativeListTableColumnView(context: android.content.Context, privat
|
|
|
444
444
|
primary.includeFontPadding = true
|
|
445
445
|
primary.fontFeatureSettings = "tnum"
|
|
446
446
|
primary.textSize = sp(16f)
|
|
447
|
-
primary.typeface =
|
|
447
|
+
primary.typeface = NativeListFonts.medium(context)
|
|
448
448
|
primary.setLineSpacing(0f, 1f)
|
|
449
449
|
primary.letterSpacing = 0f
|
|
450
450
|
primary.opticalOffsetY = 0f
|
|
@@ -18,9 +18,9 @@ import kotlin.math.roundToInt
|
|
|
18
18
|
import org.json.JSONArray
|
|
19
19
|
import org.json.JSONObject
|
|
20
20
|
|
|
21
|
-
internal class NativeListIdentityRowView(context: ThemedReactContext
|
|
22
|
-
NativeListRendererRowView(context
|
|
23
|
-
private val leadingFrame = NativeListLeadingVisual(context
|
|
21
|
+
internal class NativeListIdentityRowView(context: ThemedReactContext) :
|
|
22
|
+
NativeListRendererRowView(context) {
|
|
23
|
+
private val leadingFrame = NativeListLeadingVisual(context)
|
|
24
24
|
private val leadingFallback
|
|
25
25
|
get() = leadingFrame.fallbackTextView
|
|
26
26
|
|
|
@@ -31,7 +31,7 @@ internal class NativeListIdentityRowView(context: ThemedReactContext, fonts: Nat
|
|
|
31
31
|
private val subtitle = NativeListTextView(context)
|
|
32
32
|
private val tertiary = NativeListTextView(context)
|
|
33
33
|
private val badgeLine = NativeListTextView(context)
|
|
34
|
-
private val trailingColumn = NativeListAccessoryStack(context
|
|
34
|
+
private val trailingColumn = NativeListAccessoryStack(context)
|
|
35
35
|
private val semanticBadgeLabels = mutableListOf<TextView>()
|
|
36
36
|
private val semanticSubtitleLabels = mutableListOf<TextView>()
|
|
37
37
|
private var walletBadgeLine: View? = null
|
|
@@ -176,18 +176,18 @@ internal class NativeListIdentityRowView(context: ThemedReactContext, fonts: Nat
|
|
|
176
176
|
}
|
|
177
177
|
title.typeface =
|
|
178
178
|
if (item.json.optString("presentation") in setOf("accountSelector", "walletSidebar"))
|
|
179
|
-
|
|
180
|
-
else
|
|
179
|
+
NativeListFonts.regular(context)
|
|
180
|
+
else NativeListFonts.medium(context)
|
|
181
181
|
title.textSize = sp(if (item.json.optString("presentation") == "walletSidebar") 12f else 16f)
|
|
182
182
|
title.setTextColor(color(theme, "primaryText", "#000000DF"))
|
|
183
|
-
subtitle.typeface =
|
|
183
|
+
subtitle.typeface = NativeListFonts.regular(context)
|
|
184
184
|
subtitle.textSize = sp(14f)
|
|
185
185
|
subtitle.setTextColor(color(theme, "secondaryText", "#0000009B"))
|
|
186
186
|
subtitle.layoutParams = LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.WRAP_CONTENT)
|
|
187
|
-
tertiary.typeface =
|
|
187
|
+
tertiary.typeface = NativeListFonts.regular(context)
|
|
188
188
|
tertiary.textSize = sp(14f)
|
|
189
189
|
tertiary.layoutParams = LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.WRAP_CONTENT)
|
|
190
|
-
badgeLine.typeface =
|
|
190
|
+
badgeLine.typeface = NativeListFonts.medium(context)
|
|
191
191
|
badgeLine.textSize = sp(12f)
|
|
192
192
|
// Legacy: tertiary always ellipsizes at the end.
|
|
193
193
|
tertiary.ellipsize = TextUtils.TruncateAt.END
|
|
@@ -310,7 +310,7 @@ internal class NativeListIdentityRowView(context: ThemedReactContext, fonts: Nat
|
|
|
310
310
|
if (item.json.optString("presentation") == "accountSelector" && item.hasExplicitHeight) 8
|
|
311
311
|
else 10
|
|
312
312
|
leadingFrame.bind(descriptor, style, item.key, currentTheme, false, sourceScale)
|
|
313
|
-
leadingFallback.typeface =
|
|
313
|
+
leadingFallback.typeface = NativeListFonts.bold(context)
|
|
314
314
|
leadingFallback.textSize = sp(13f)
|
|
315
315
|
leadingFallback.setLineSpacing(0f, 1f)
|
|
316
316
|
addView(
|
|
@@ -436,7 +436,7 @@ internal class NativeListIdentityRowView(context: ThemedReactContext, fonts: Nat
|
|
|
436
436
|
setPadding(dp(4), dp(4), dp(4), dp(4))
|
|
437
437
|
addLeading(item.json.optJSONObject("leading"), 40, spacingDp = 0)
|
|
438
438
|
leadingFallback.textSize = sp(28f)
|
|
439
|
-
leadingFallback.typeface =
|
|
439
|
+
leadingFallback.typeface = NativeListFonts.regular(context)
|
|
440
440
|
mainColumn.gravity = Gravity.CENTER
|
|
441
441
|
titleLine.gravity = Gravity.CENTER
|
|
442
442
|
titleLine.packsChildrenAtStart = false
|
|
@@ -479,7 +479,7 @@ internal class NativeListIdentityRowView(context: ThemedReactContext, fonts: Nat
|
|
|
479
479
|
NativeListTextView(context).apply {
|
|
480
480
|
text = badges.getJSONObject(index).optString("text")
|
|
481
481
|
textSize = sp(if (isSelector) 11f else 12f)
|
|
482
|
-
typeface =
|
|
482
|
+
typeface = NativeListFonts.regular(context)
|
|
483
483
|
includeFontPadding = false
|
|
484
484
|
maxLines = 1
|
|
485
485
|
ellipsize = TextUtils.TruncateAt.END
|
|
@@ -574,7 +574,7 @@ internal class NativeListIdentityRowView(context: ThemedReactContext, fonts: Nat
|
|
|
574
574
|
!leading?.optString("fallbackText").isNullOrEmpty()
|
|
575
575
|
) {
|
|
576
576
|
leadingFallback.textSize = sp(19f)
|
|
577
|
-
leadingFallback.typeface =
|
|
577
|
+
leadingFallback.typeface = NativeListFonts.semibold(context)
|
|
578
578
|
leadingFallback.setTextColor(color(theme, "inverseText", "#FCFCFC"))
|
|
579
579
|
TextViewCompat.setLineHeight(leadingFallback, dp(27))
|
|
580
580
|
}
|
|
@@ -583,7 +583,7 @@ internal class NativeListIdentityRowView(context: ThemedReactContext, fonts: Nat
|
|
|
583
583
|
title.ellipsize = TextUtils.TruncateAt.END
|
|
584
584
|
showText(title, item.json.optString("title"), item.json.optInt("titleLines", 1))
|
|
585
585
|
if (item.json.optString("presentation") == "accountSelector") {
|
|
586
|
-
title.typeface =
|
|
586
|
+
title.typeface = NativeListFonts.regular(context)
|
|
587
587
|
}
|
|
588
588
|
showText(subtitle, item.json.optString("subtitle"), item.json.optInt("subtitleLines", 2))
|
|
589
589
|
// OneKey patch: use separate labels for independently truncated balance/address.
|
|
@@ -615,7 +615,7 @@ internal class NativeListIdentityRowView(context: ThemedReactContext, fonts: Nat
|
|
|
615
615
|
val label =
|
|
616
616
|
NativeListTextView(context).apply {
|
|
617
617
|
text = segment.optString("text")
|
|
618
|
-
typeface =
|
|
618
|
+
typeface = NativeListFonts.regular(context)
|
|
619
619
|
textSize = sp(14f)
|
|
620
620
|
includeFontPadding = false
|
|
621
621
|
maxLines = 1
|
|
@@ -736,7 +736,7 @@ internal class NativeListIdentityRowView(context: ThemedReactContext, fonts: Nat
|
|
|
736
736
|
}
|
|
737
737
|
view.textSize = sp(fontSize.toFloat())
|
|
738
738
|
view.typeface =
|
|
739
|
-
if (medium)
|
|
739
|
+
if (medium) NativeListFonts.medium(context) else NativeListFonts.regular(context)
|
|
740
740
|
TextViewCompat.setLineHeight(view, dp(lineHeight))
|
|
741
741
|
view.text = value
|
|
742
742
|
}
|
|
@@ -754,10 +754,10 @@ internal class NativeListIdentityRowView(context: ThemedReactContext, fonts: Nat
|
|
|
754
754
|
style.optString("fontWeight").takeIf(String::isNotEmpty)?.let {
|
|
755
755
|
view.typeface =
|
|
756
756
|
when (it) {
|
|
757
|
-
"medium" ->
|
|
758
|
-
"semibold" ->
|
|
759
|
-
"bold" ->
|
|
760
|
-
else ->
|
|
757
|
+
"medium" -> NativeListFonts.medium(context)
|
|
758
|
+
"semibold" -> NativeListFonts.semibold(context)
|
|
759
|
+
"bold" -> NativeListFonts.bold(context)
|
|
760
|
+
else -> NativeListFonts.regular(context)
|
|
761
761
|
}
|
|
762
762
|
}
|
|
763
763
|
style.optString("color").takeIf(String::isNotEmpty)?.let {
|
|
@@ -13,12 +13,12 @@ import kotlin.math.roundToInt
|
|
|
13
13
|
import org.json.JSONObject
|
|
14
14
|
|
|
15
15
|
/** Fixed visual slots; no row-template or business-key branching. */
|
|
16
|
-
internal class NativeListLeadingVisual(private val reactContext: ThemedReactContext
|
|
16
|
+
internal class NativeListLeadingVisual(private val reactContext: ThemedReactContext) :
|
|
17
17
|
FrameLayout(reactContext) {
|
|
18
18
|
private val fallback =
|
|
19
19
|
TextView(context).apply {
|
|
20
20
|
gravity = Gravity.CENTER
|
|
21
|
-
typeface =
|
|
21
|
+
typeface = NativeListFonts.bold(context)
|
|
22
22
|
}
|
|
23
23
|
private val icon = OneKeyIconView(context)
|
|
24
24
|
private val unread = View(context)
|
|
@@ -94,7 +94,6 @@ internal class NativeListLeadingVisual(private val reactContext: ThemedReactCont
|
|
|
94
94
|
sourceScale: Boolean,
|
|
95
95
|
secondaryVisual: JSONObject? = null,
|
|
96
96
|
) {
|
|
97
|
-
fallback.typeface = fonts.bold(context)
|
|
98
97
|
this.visual = visual
|
|
99
98
|
this.style = style
|
|
100
99
|
this.sourceScale = sourceScale
|
|
@@ -290,8 +289,8 @@ internal class NativeListLeadingVisual(private val reactContext: ThemedReactCont
|
|
|
290
289
|
if (walletText) androidx.core.widget.TextViewCompat.setLineHeight(this, dp(16))
|
|
291
290
|
else setLineSpacing(0f, 1f)
|
|
292
291
|
typeface =
|
|
293
|
-
if (isWalletText(data))
|
|
294
|
-
else
|
|
292
|
+
if (isWalletText(data)) NativeListFonts.regular(context)
|
|
293
|
+
else NativeListFonts.medium(context)
|
|
295
294
|
setTextColor(color(data.optString("tintColor", "#0000009B")))
|
|
296
295
|
}
|
|
297
296
|
} else {
|
|
@@ -26,9 +26,9 @@ import kotlin.math.roundToInt
|
|
|
26
26
|
import org.json.JSONArray
|
|
27
27
|
import org.json.JSONObject
|
|
28
28
|
|
|
29
|
-
internal class NativeListMarketRowView(context: ThemedReactContext
|
|
30
|
-
NativeListRendererRowView(context
|
|
31
|
-
private val leadingFrame = NativeListLeadingVisual(context
|
|
29
|
+
internal class NativeListMarketRowView(context: ThemedReactContext) :
|
|
30
|
+
NativeListRendererRowView(context) {
|
|
31
|
+
private val leadingFrame = NativeListLeadingVisual(context)
|
|
32
32
|
private val leadingActionIcon = OneKeyIconView(context)
|
|
33
33
|
private val mainColumn = LinearLayout(context)
|
|
34
34
|
private val titleLine = PackedTitleLineLayout(context)
|
|
@@ -315,10 +315,10 @@ internal class NativeListMarketRowView(context: ThemedReactContext, fonts: Nativ
|
|
|
315
315
|
|
|
316
316
|
private fun marketTypeface(weight: String, fallback: String): Typeface =
|
|
317
317
|
when (weight.ifEmpty { fallback }) {
|
|
318
|
-
"regular" ->
|
|
319
|
-
"semibold" ->
|
|
320
|
-
"bold" ->
|
|
321
|
-
else ->
|
|
318
|
+
"regular" -> NativeListFonts.regular(context)
|
|
319
|
+
"semibold" -> NativeListFonts.semibold(context)
|
|
320
|
+
"bold" -> NativeListFonts.bold(context)
|
|
321
|
+
else -> NativeListFonts.medium(context)
|
|
322
322
|
}
|
|
323
323
|
|
|
324
324
|
private fun applyMarketTextStyle(
|
|
@@ -11,8 +11,8 @@ import android.widget.LinearLayout
|
|
|
11
11
|
import com.facebook.react.uimanager.ThemedReactContext
|
|
12
12
|
import org.json.JSONObject
|
|
13
13
|
|
|
14
|
-
internal class NativeListMediaTileRowView(context: ThemedReactContext
|
|
15
|
-
NativeListRendererRowView(context
|
|
14
|
+
internal class NativeListMediaTileRowView(context: ThemedReactContext) :
|
|
15
|
+
NativeListRendererRowView(context) {
|
|
16
16
|
private val picture = FrameLayout(context)
|
|
17
17
|
private val image = NativeListMediaPreviewSlot(context)
|
|
18
18
|
private val network = NativeListImageSlot(context)
|
|
@@ -82,7 +82,7 @@ internal class NativeListMediaTileRowView(context: ThemedReactContext, fonts: Na
|
|
|
82
82
|
else -> Gravity.TOP
|
|
83
83
|
}
|
|
84
84
|
NativeListResolvedText.resolve(
|
|
85
|
-
reactContext,
|
|
85
|
+
reactContext,
|
|
86
86
|
item.json.optString("title"),
|
|
87
87
|
style.optJSONObject("title"),
|
|
88
88
|
16f,
|
|
@@ -94,7 +94,7 @@ internal class NativeListMediaTileRowView(context: ThemedReactContext, fonts: Na
|
|
|
94
94
|
)
|
|
95
95
|
.bind(title)
|
|
96
96
|
NativeListResolvedText.resolve(
|
|
97
|
-
reactContext,
|
|
97
|
+
reactContext,
|
|
98
98
|
item.json.optString("subtitle"),
|
|
99
99
|
style.optJSONObject("subtitle"),
|
|
100
100
|
12f,
|
|
@@ -106,7 +106,7 @@ internal class NativeListMediaTileRowView(context: ThemedReactContext, fonts: Na
|
|
|
106
106
|
)
|
|
107
107
|
.bind(subtitle)
|
|
108
108
|
NativeListResolvedText.resolve(
|
|
109
|
-
reactContext,
|
|
109
|
+
reactContext,
|
|
110
110
|
item.json.optJSONObject("badge")?.optString("text") ?: "",
|
|
111
111
|
style.optJSONObject("badge"),
|
|
112
112
|
14f,
|
|
@@ -32,7 +32,6 @@ internal object NativeListMessageRenderer {
|
|
|
32
32
|
|
|
33
33
|
fun resolve(
|
|
34
34
|
context: ThemedReactContext,
|
|
35
|
-
fonts: NativeListFonts,
|
|
36
35
|
item: NativeListItem,
|
|
37
36
|
theme: JSONObject?,
|
|
38
37
|
sourceScale: Boolean,
|
|
@@ -48,7 +47,7 @@ internal object NativeListMessageRenderer {
|
|
|
48
47
|
parseNativeListColor(theme?.optString(name, fallback) ?: fallback)
|
|
49
48
|
fun text(name: String, size: Float, weight: String, color: Int, height: Int, lines: Int) =
|
|
50
49
|
NativeListResolvedText.resolve(
|
|
51
|
-
context,
|
|
50
|
+
context,
|
|
52
51
|
item.json.optString(name),
|
|
53
52
|
style.optJSONObject(name),
|
|
54
53
|
size,
|
|
@@ -89,7 +88,7 @@ internal object NativeListMessageRenderer {
|
|
|
89
88
|
)
|
|
90
89
|
}
|
|
91
90
|
|
|
92
|
-
class Views(private val context: ThemedReactContext
|
|
91
|
+
class Views(private val context: ThemedReactContext) {
|
|
93
92
|
val column = LinearLayout(context).apply { orientation = LinearLayout.VERTICAL }
|
|
94
93
|
val title = NativeListTextView(context)
|
|
95
94
|
val body = NativeListTextView(context)
|
|
@@ -129,7 +128,7 @@ internal object NativeListMessageRenderer {
|
|
|
129
128
|
resolved.verticalPadding,
|
|
130
129
|
)
|
|
131
130
|
resolved.leading?.let { visual ->
|
|
132
|
-
val host = leading ?: NativeListLeadingVisual(context
|
|
131
|
+
val host = leading ?: NativeListLeadingVisual(context).also { leading = it }
|
|
133
132
|
host.bind(visual, resolved.imageStyle, item.key, theme, resolved.unread, sourceScale)
|
|
134
133
|
val params =
|
|
135
134
|
LinearLayout.LayoutParams(resolved.imageWidth, resolved.imageHeight).apply {
|
|
@@ -207,10 +206,10 @@ internal object NativeListMessageRenderer {
|
|
|
207
206
|
}
|
|
208
207
|
}
|
|
209
208
|
|
|
210
|
-
internal class NativeListMessageRowView(context: ThemedReactContext
|
|
211
|
-
NativeListRendererRowView(context
|
|
209
|
+
internal class NativeListMessageRowView(context: ThemedReactContext) :
|
|
210
|
+
NativeListRendererRowView(context) {
|
|
212
211
|
override val assetFields = listOf("leading", "thumbnail")
|
|
213
|
-
private val views = NativeListMessageRenderer.Views(context
|
|
212
|
+
private val views = NativeListMessageRenderer.Views(context)
|
|
214
213
|
|
|
215
214
|
override fun bindContent(
|
|
216
215
|
item: NativeListItem,
|
|
@@ -220,7 +219,7 @@ internal class NativeListMessageRowView(context: ThemedReactContext, fonts: Nati
|
|
|
220
219
|
) {
|
|
221
220
|
views.bind(
|
|
222
221
|
this,
|
|
223
|
-
NativeListMessageRenderer.resolve(reactContext,
|
|
222
|
+
NativeListMessageRenderer.resolve(reactContext, item, theme, sourceScale),
|
|
224
223
|
item,
|
|
225
224
|
theme,
|
|
226
225
|
sourceScale,
|