@onekeyfe/react-native-native-list 3.0.179-alpha.2026101503 → 3.0.179-alpha.302
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/LICENSE +36 -0
- package/README.md +32 -3
- package/android/build.gradle +0 -1
- package/android/src/main/java/com/onekey/nativelist/HybridNativeList.kt +22 -3
- 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 +6 -1
- 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 +5 -4
- 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 +8 -7
- package/android/src/main/java/com/onekey/nativelist/NativeListMetricCardRenderer.kt +14 -14
- package/android/src/main/java/com/onekey/nativelist/NativeListPrimitives.kt +28 -15
- 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 +3 -2
- package/android/src/main/java/com/onekey/nativelist/NativeListResolvedText.kt +5 -4
- 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 +104 -18
- package/android/src/main/java/com/onekey/nativelist/NativeListWalletGroupRenderer.kt +6 -5
- package/docs/SPEC.md +69 -19
- package/docs/STYLE_SPEC.md +12 -2
- package/ios/HybridNativeList.swift +15 -21
- package/ios/NativeListAccessoryStack.swift +14 -10
- package/ios/NativeListActionRenderer.swift +7 -4
- package/ios/NativeListActivityDetailsView.swift +63 -24
- package/ios/NativeListActivityRenderer.swift +19 -10
- package/ios/NativeListDataRowRenderer.swift +23 -19
- package/ios/NativeListDesignAssets.swift +43 -34
- package/ios/NativeListIdentityRenderer.swift +23 -19
- package/ios/NativeListLeadingVisual.swift +9 -4
- package/ios/NativeListMarketRenderer.swift +19 -11
- package/ios/NativeListMediaTileRenderer.swift +11 -7
- package/ios/NativeListMessageRenderer.swift +20 -10
- package/ios/NativeListMetricCardRenderer.swift +16 -12
- package/ios/NativeListRailRenderer.swift +9 -7
- package/ios/NativeListRendererCell.swift +6 -4
- package/ios/NativeListRendererRegistry.swift +8 -3
- package/ios/NativeListResolvedText.swift +3 -3
- package/ios/NativeListRowHost.swift +7 -2
- package/ios/NativeListSectionHeaderRenderer.swift +22 -19
- package/ios/NativeListSystemRenderer.swift +18 -16
- package/ios/NativeListTextStyles.swift +18 -12
- package/ios/NativeListWalletGroupRenderer.swift +6 -4
- package/ios/RNCNativeListView.swift +38 -92
- package/ios/tests/NativeListActivityPresentationTests.swift +5 -3
- package/ios/tests/NativeListLifecycleTests.swift +77 -2
- package/lib/module/NativeList.js +8 -24
- package/lib/module/NativeList.web.js +8 -3
- package/lib/module/fonts.js +44 -0
- package/lib/module/index.js +1 -0
- package/lib/module/web/NativeListWebEngine.js +48 -24
- package/lib/module/web/templates/ActionRowRenderer.js +2 -1
- package/lib/module/web/templates/IdentityRowRenderer.js +4 -3
- package/lib/module/web/templates/MarketRowRenderer.js +2 -1
- package/lib/module/web/templates/RowText.js +13 -3
- package/lib/module/web/templates/SectionHeaderRowRenderer.js +3 -2
- package/lib/nitrogen/generated/android/c++/JHybridNativeListSpec.cpp +9 -18
- package/lib/nitrogen/generated/android/c++/JHybridNativeListSpec.hpp +2 -4
- package/lib/nitrogen/generated/android/c++/views/JHybridNativeListStateUpdater.cpp +5 -10
- package/lib/nitrogen/generated/android/kotlin/com/margelo/nitro/nativelist/HybridNativeListSpec.kt +2 -8
- package/lib/nitrogen/generated/ios/c++/HybridNativeListSpecSwift.hpp +7 -12
- package/lib/nitrogen/generated/ios/c++/views/HybridNativeListComponent.mm +6 -12
- package/lib/nitrogen/generated/ios/swift/HybridNativeListSpec.swift +1 -2
- package/lib/nitrogen/generated/ios/swift/HybridNativeListSpec_cxx.swift +6 -17
- package/lib/nitrogen/generated/shared/c++/HybridNativeListSpec.cpp +2 -4
- package/lib/nitrogen/generated/shared/c++/HybridNativeListSpec.hpp +2 -4
- package/lib/nitrogen/generated/shared/c++/views/HybridNativeListComponent.cpp +2 -4
- package/lib/nitrogen/generated/shared/c++/views/HybridNativeListComponent.hpp +3 -6
- package/lib/nitrogen/generated/shared/json/NativeListConfig.json +1 -2
- package/lib/typescript/src/NativeList.nitro.d.ts +1 -2
- package/lib/typescript/src/NativeList.types.d.ts +0 -4
- package/lib/typescript/src/fonts.d.ts +10 -0
- package/lib/typescript/src/index.d.ts +2 -0
- package/lib/typescript/src/web/NativeListWebEngine.d.ts +4 -1
- package/lib/typescript/src/web/templates/RowText.d.ts +1 -0
- package/nitrogen/generated/android/c++/JHybridNativeListSpec.cpp +9 -18
- package/nitrogen/generated/android/c++/JHybridNativeListSpec.hpp +2 -4
- package/nitrogen/generated/android/c++/views/JHybridNativeListStateUpdater.cpp +5 -10
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/nativelist/HybridNativeListSpec.kt +2 -8
- package/nitrogen/generated/ios/c++/HybridNativeListSpecSwift.hpp +7 -12
- package/nitrogen/generated/ios/c++/views/HybridNativeListComponent.mm +6 -12
- package/nitrogen/generated/ios/swift/HybridNativeListSpec.swift +1 -2
- package/nitrogen/generated/ios/swift/HybridNativeListSpec_cxx.swift +6 -17
- package/nitrogen/generated/shared/c++/HybridNativeListSpec.cpp +2 -4
- package/nitrogen/generated/shared/c++/HybridNativeListSpec.hpp +2 -4
- package/nitrogen/generated/shared/c++/views/HybridNativeListComponent.cpp +2 -4
- package/nitrogen/generated/shared/c++/views/HybridNativeListComponent.hpp +3 -6
- package/nitrogen/generated/shared/json/NativeListConfig.json +1 -2
- package/package.json +4 -5
- package/react-native-native-list.podspec +0 -1
- package/src/NativeList.nitro.ts +1 -2
- package/src/NativeList.tsx +4 -25
- package/src/NativeList.types.ts +0 -4
- package/src/NativeList.web.tsx +10 -3
- package/src/fonts.ts +64 -0
- package/src/index.ts +3 -0
- package/src/web/NativeListWebEngine.ts +53 -24
- package/src/web/templates/ActionRowRenderer.ts +2 -1
- package/src/web/templates/IdentityRowRenderer.ts +4 -3
- package/src/web/templates/MarketRowRenderer.ts +4 -2
- package/src/web/templates/RowText.ts +15 -3
- package/src/web/templates/SectionHeaderRowRenderer.ts +6 -3
- 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/LICENSE
ADDED
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
License scope
|
|
2
|
+
|
|
3
|
+
The MIT grant below applies to OneKey-owned source code. The adapted avatar
|
|
4
|
+
algorithms retain the upstream attribution below. No font files are distributed
|
|
5
|
+
by this package.
|
|
6
|
+
|
|
7
|
+
MIT License
|
|
8
|
+
|
|
9
|
+
Copyright (c) 2024 OneKey
|
|
10
|
+
|
|
11
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
12
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
13
|
+
in the Software without restriction, including without limitation the rights
|
|
14
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
15
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
16
|
+
furnished to do so, subject to the following conditions:
|
|
17
|
+
|
|
18
|
+
The above copyright notice and this permission notice shall be included in all
|
|
19
|
+
copies or substantial portions of the Software.
|
|
20
|
+
|
|
21
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
22
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
23
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
24
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
25
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
26
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
27
|
+
SOFTWARE.
|
|
28
|
+
|
|
29
|
+
---
|
|
30
|
+
|
|
31
|
+
Avatar PRNG/HSL algorithms in src/web/NativeListAvatarWorker.js are adapted from
|
|
32
|
+
MyCrypto ethereum-blockies-base64 1.0.2 (MIT), commit
|
|
33
|
+
1290187d9c099335a06a2f867d5240a6034a6631. The upstream package declares MyCrypto
|
|
34
|
+
as its author and MIT as its license, but contains no separate LICENSE file.
|
|
35
|
+
The inline MIT grant remains in the worker. The upstream pnglib implementation
|
|
36
|
+
is not included; PNG encoding uses OffscreenCanvas.
|
package/README.md
CHANGED
|
@@ -161,9 +161,38 @@ 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
|
|
165
|
-
|
|
166
|
-
|
|
164
|
+
The templates distribute and register no font files. Call
|
|
165
|
+
`configureNativeListFonts` once during UI-runtime startup, after the host loads
|
|
166
|
+
its fonts and before mounting lists. The four optional faces replace the whole
|
|
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
|
|
167
196
|
library, rendered by Core Graphics/UIKit on iOS and Canvas on Android.
|
|
168
197
|
|
|
169
198
|
### Market rows
|
package/android/build.gradle
CHANGED
|
@@ -31,15 +31,34 @@ class HybridNativeList(context: ThemedReactContext) : HybridNativeListSpec() {
|
|
|
31
31
|
dispatchToUi { hostView.setContainerSlotHeightsJson(value) }
|
|
32
32
|
}
|
|
33
33
|
|
|
34
|
-
|
|
35
|
-
|
|
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
|
+
}
|
|
36
55
|
|
|
37
56
|
override var snapshotJson: String = ""
|
|
38
57
|
get() = field
|
|
39
58
|
set(value) {
|
|
40
59
|
if (field == value) return
|
|
41
60
|
field = value
|
|
42
|
-
|
|
61
|
+
snapshotChanged = true
|
|
43
62
|
}
|
|
44
63
|
|
|
45
64
|
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) : LinearLayout(context) {
|
|
30
|
+
internal class NativeListAccessoryStack(context: android.content.Context, val fonts: NativeListFonts) : 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) : Line
|
|
|
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) fonts.medium(context) else fonts.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) : Line
|
|
|
467
467
|
view.maxLines = 2
|
|
468
468
|
view.gravity = Gravity.END
|
|
469
469
|
view.includeFontPadding = false
|
|
470
|
-
view.typeface =
|
|
470
|
+
view.typeface = fonts.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) : Line
|
|
|
599
599
|
}
|
|
600
600
|
view.textSize = sp(fontSize.toFloat())
|
|
601
601
|
view.typeface =
|
|
602
|
-
if (medium)
|
|
602
|
+
if (medium) fonts.medium(context) else fonts.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) : Line
|
|
|
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" -> fonts.regular(context)
|
|
684
|
+
"semibold" -> fonts.semibold(context)
|
|
685
|
+
"bold" -> fonts.bold(context)
|
|
686
|
+
else -> fonts.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, fonts: NativeListFonts) :
|
|
9
|
+
NativeListRendererRowView(context, fonts) {
|
|
10
|
+
private val visual = NativeListLeadingVisual(context, fonts)
|
|
11
11
|
private val title = NativeListTextView(context)
|
|
12
|
-
private val accessories = NativeListAccessoryStack(context)
|
|
12
|
+
private val accessories = NativeListAccessoryStack(context, fonts)
|
|
13
13
|
override val assetFields = listOf("icon")
|
|
14
14
|
|
|
15
15
|
init {
|
|
@@ -77,7 +77,7 @@ internal class NativeListActionRowView(context: ThemedReactContext) :
|
|
|
77
77
|
if (token == "negative") "#C40006D3"
|
|
78
78
|
else if (selector || token == "secondaryText") "#0000009B" else "#000000DF"
|
|
79
79
|
NativeListResolvedText.resolve(
|
|
80
|
-
context,
|
|
80
|
+
context, fonts,
|
|
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) : LinearLayout(reactContext) {
|
|
15
|
+
internal class NativeListActivityDetailsView(private val reactContext: ThemedReactContext, private val fonts: NativeListFonts) : 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, fonts)
|
|
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, value, style, size, weight, ink, line, lines, sourceScale).bind(label)
|
|
65
|
+
NativeListResolvedText.resolve(context, fonts, 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, fonts)
|
|
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, fonts: NativeListFonts) :
|
|
11
|
+
NativeListRendererRowView(context, fonts) {
|
|
12
|
+
private val details = NativeListActivityDetailsView(context, fonts)
|
|
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, fonts)
|
|
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) :
|
|
|
104
104
|
if (!has("alignment")) put("alignment", align)
|
|
105
105
|
}
|
|
106
106
|
NativeListResolvedText.resolve(
|
|
107
|
-
context,
|
|
107
|
+
context, fonts,
|
|
108
108
|
value,
|
|
109
109
|
textStyle,
|
|
110
110
|
size,
|
|
@@ -222,7 +222,7 @@ internal class NativeListActivityRowView(context: ThemedReactContext) :
|
|
|
222
222
|
if (index >= count) continue
|
|
223
223
|
val action = descriptors!!.getJSONObject(index)
|
|
224
224
|
NativeListResolvedText.resolve(
|
|
225
|
-
context,
|
|
225
|
+
context, fonts,
|
|
226
226
|
action.optString("label"),
|
|
227
227
|
null,
|
|
228
228
|
// Legacy footer action: 14sp semibold on a 20dp line.
|
|
@@ -18,6 +18,7 @@ internal class NativeListViewHolder(val rowView: NativeListRowHost) :
|
|
|
18
18
|
|
|
19
19
|
internal class NativeListAdapter(
|
|
20
20
|
private val context: ThemedReactContext,
|
|
21
|
+
private val fonts: NativeListFonts,
|
|
21
22
|
) : RecyclerView.Adapter<NativeListViewHolder>() {
|
|
22
23
|
private var suppressDifferUpdates = false
|
|
23
24
|
private var needsThemeRebind = false
|
|
@@ -76,7 +77,7 @@ internal class NativeListAdapter(
|
|
|
76
77
|
requireNotNull(itemAt(position)).rendererKey.ordinal
|
|
77
78
|
|
|
78
79
|
override fun onCreateViewHolder(parent: ViewGroup, viewType: Int): NativeListViewHolder {
|
|
79
|
-
val view = NativeListRendererRegistry.create(context, viewType)
|
|
80
|
+
val view = NativeListRendererRegistry.create(context, viewType, fonts)
|
|
80
81
|
view.layoutParams = ViewGroup.LayoutParams(
|
|
81
82
|
ViewGroup.LayoutParams.MATCH_PARENT,
|
|
82
83
|
ViewGroup.LayoutParams.WRAP_CONTENT,
|
|
@@ -137,6 +138,10 @@ internal class NativeListAdapter(
|
|
|
137
138
|
super.onViewRecycled(holder)
|
|
138
139
|
}
|
|
139
140
|
|
|
141
|
+
fun rebindFonts() {
|
|
142
|
+
notifyItemRangeChanged(0, itemCount)
|
|
143
|
+
}
|
|
144
|
+
|
|
140
145
|
fun itemAt(position: Int): NativeListItem? =
|
|
141
146
|
reorderItems?.getOrNull(position) ?: differ.currentList.getOrNull(position)
|
|
142
147
|
|
|
@@ -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, fonts: NativeListFonts) :
|
|
15
|
+
NativeListRendererRowView(context, fonts) {
|
|
16
|
+
private val visual = NativeListLeadingVisual(context, fonts)
|
|
17
17
|
private val favorite = OneKeyIconView(context)
|
|
18
|
-
private val accessories = NativeListAccessoryStack(context)
|
|
18
|
+
private val accessories = NativeListAccessoryStack(context, fonts)
|
|
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, fonts) }
|
|
25
25
|
|
|
26
26
|
override fun unselectedBackground(
|
|
27
27
|
item: NativeListItem,
|
|
@@ -212,7 +212,7 @@ internal class NativeListDataRowView(context: ThemedReactContext) :
|
|
|
212
212
|
}
|
|
213
213
|
}
|
|
214
214
|
|
|
215
|
-
private class NativeListTableColumnView(context: android.content.Context) : LinearLayout(context) {
|
|
215
|
+
private class NativeListTableColumnView(context: android.content.Context, private val fonts: NativeListFonts) : 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) : Line
|
|
|
231
231
|
primary.maxLines = 1
|
|
232
232
|
primary.ellipsize = TextUtils.TruncateAt.END
|
|
233
233
|
primary.textSize = sp(14f)
|
|
234
|
-
primary.typeface =
|
|
234
|
+
primary.typeface = fonts.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) : Line
|
|
|
241
241
|
label.maxLines = 1
|
|
242
242
|
label.ellipsize = TextUtils.TruncateAt.END
|
|
243
243
|
label.textSize = sp(12f)
|
|
244
|
-
label.typeface =
|
|
244
|
+
label.typeface = fonts.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) : Line
|
|
|
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, value, resolved, size, weight, color, line, 1, false)
|
|
325
|
+
NativeListResolvedText.resolve(context, fonts, 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) : Line
|
|
|
355
355
|
gravity = Gravity.CENTER
|
|
356
356
|
text = rowBadges.getJSONObject(index).optString("text")
|
|
357
357
|
textSize = sp(10f)
|
|
358
|
-
typeface =
|
|
358
|
+
typeface = fonts.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) : Line
|
|
|
444
444
|
primary.includeFontPadding = true
|
|
445
445
|
primary.fontFeatureSettings = "tnum"
|
|
446
446
|
primary.textSize = sp(16f)
|
|
447
|
-
primary.typeface =
|
|
447
|
+
primary.typeface = fonts.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, fonts: NativeListFonts) :
|
|
22
|
+
NativeListRendererRowView(context, fonts) {
|
|
23
|
+
private val leadingFrame = NativeListLeadingVisual(context, fonts)
|
|
24
24
|
private val leadingFallback
|
|
25
25
|
get() = leadingFrame.fallbackTextView
|
|
26
26
|
|
|
@@ -31,7 +31,7 @@ internal class NativeListIdentityRowView(context: ThemedReactContext) :
|
|
|
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, fonts)
|
|
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) :
|
|
|
176
176
|
}
|
|
177
177
|
title.typeface =
|
|
178
178
|
if (item.json.optString("presentation") in setOf("accountSelector", "walletSidebar"))
|
|
179
|
-
|
|
180
|
-
else
|
|
179
|
+
fonts.regular(context)
|
|
180
|
+
else fonts.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 = fonts.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 = fonts.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 = fonts.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) :
|
|
|
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 = fonts.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) :
|
|
|
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 = fonts.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) :
|
|
|
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 = fonts.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) :
|
|
|
574
574
|
!leading?.optString("fallbackText").isNullOrEmpty()
|
|
575
575
|
) {
|
|
576
576
|
leadingFallback.textSize = sp(19f)
|
|
577
|
-
leadingFallback.typeface =
|
|
577
|
+
leadingFallback.typeface = fonts.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) :
|
|
|
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 = fonts.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) :
|
|
|
615
615
|
val label =
|
|
616
616
|
NativeListTextView(context).apply {
|
|
617
617
|
text = segment.optString("text")
|
|
618
|
-
typeface =
|
|
618
|
+
typeface = fonts.regular(context)
|
|
619
619
|
textSize = sp(14f)
|
|
620
620
|
includeFontPadding = false
|
|
621
621
|
maxLines = 1
|
|
@@ -736,7 +736,7 @@ internal class NativeListIdentityRowView(context: ThemedReactContext) :
|
|
|
736
736
|
}
|
|
737
737
|
view.textSize = sp(fontSize.toFloat())
|
|
738
738
|
view.typeface =
|
|
739
|
-
if (medium)
|
|
739
|
+
if (medium) fonts.medium(context) else fonts.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) :
|
|
|
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" -> fonts.medium(context)
|
|
758
|
+
"semibold" -> fonts.semibold(context)
|
|
759
|
+
"bold" -> fonts.bold(context)
|
|
760
|
+
else -> fonts.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, val fonts: NativeListFonts) :
|
|
17
17
|
FrameLayout(reactContext) {
|
|
18
18
|
private val fallback =
|
|
19
19
|
TextView(context).apply {
|
|
20
20
|
gravity = Gravity.CENTER
|
|
21
|
-
typeface =
|
|
21
|
+
typeface = fonts.bold(context)
|
|
22
22
|
}
|
|
23
23
|
private val icon = OneKeyIconView(context)
|
|
24
24
|
private val unread = View(context)
|
|
@@ -94,6 +94,7 @@ internal class NativeListLeadingVisual(private val reactContext: ThemedReactCont
|
|
|
94
94
|
sourceScale: Boolean,
|
|
95
95
|
secondaryVisual: JSONObject? = null,
|
|
96
96
|
) {
|
|
97
|
+
fallback.typeface = fonts.bold(context)
|
|
97
98
|
this.visual = visual
|
|
98
99
|
this.style = style
|
|
99
100
|
this.sourceScale = sourceScale
|
|
@@ -289,8 +290,8 @@ internal class NativeListLeadingVisual(private val reactContext: ThemedReactCont
|
|
|
289
290
|
if (walletText) androidx.core.widget.TextViewCompat.setLineHeight(this, dp(16))
|
|
290
291
|
else setLineSpacing(0f, 1f)
|
|
291
292
|
typeface =
|
|
292
|
-
if (isWalletText(data))
|
|
293
|
-
else
|
|
293
|
+
if (isWalletText(data)) fonts.regular(context)
|
|
294
|
+
else fonts.medium(context)
|
|
294
295
|
setTextColor(color(data.optString("tintColor", "#0000009B")))
|
|
295
296
|
}
|
|
296
297
|
} 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, fonts: NativeListFonts) :
|
|
30
|
+
NativeListRendererRowView(context, fonts) {
|
|
31
|
+
private val leadingFrame = NativeListLeadingVisual(context, fonts)
|
|
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) :
|
|
|
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" -> fonts.regular(context)
|
|
319
|
+
"semibold" -> fonts.semibold(context)
|
|
320
|
+
"bold" -> fonts.bold(context)
|
|
321
|
+
else -> fonts.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, fonts: NativeListFonts) :
|
|
15
|
+
NativeListRendererRowView(context, fonts) {
|
|
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) :
|
|
|
82
82
|
else -> Gravity.TOP
|
|
83
83
|
}
|
|
84
84
|
NativeListResolvedText.resolve(
|
|
85
|
-
reactContext,
|
|
85
|
+
reactContext, fonts,
|
|
86
86
|
item.json.optString("title"),
|
|
87
87
|
style.optJSONObject("title"),
|
|
88
88
|
16f,
|
|
@@ -94,7 +94,7 @@ internal class NativeListMediaTileRowView(context: ThemedReactContext) :
|
|
|
94
94
|
)
|
|
95
95
|
.bind(title)
|
|
96
96
|
NativeListResolvedText.resolve(
|
|
97
|
-
reactContext,
|
|
97
|
+
reactContext, fonts,
|
|
98
98
|
item.json.optString("subtitle"),
|
|
99
99
|
style.optJSONObject("subtitle"),
|
|
100
100
|
12f,
|
|
@@ -106,7 +106,7 @@ internal class NativeListMediaTileRowView(context: ThemedReactContext) :
|
|
|
106
106
|
)
|
|
107
107
|
.bind(subtitle)
|
|
108
108
|
NativeListResolvedText.resolve(
|
|
109
|
-
reactContext,
|
|
109
|
+
reactContext, fonts,
|
|
110
110
|
item.json.optJSONObject("badge")?.optString("text") ?: "",
|
|
111
111
|
style.optJSONObject("badge"),
|
|
112
112
|
14f,
|
|
@@ -32,6 +32,7 @@ internal object NativeListMessageRenderer {
|
|
|
32
32
|
|
|
33
33
|
fun resolve(
|
|
34
34
|
context: ThemedReactContext,
|
|
35
|
+
fonts: NativeListFonts,
|
|
35
36
|
item: NativeListItem,
|
|
36
37
|
theme: JSONObject?,
|
|
37
38
|
sourceScale: Boolean,
|
|
@@ -47,7 +48,7 @@ internal object NativeListMessageRenderer {
|
|
|
47
48
|
parseNativeListColor(theme?.optString(name, fallback) ?: fallback)
|
|
48
49
|
fun text(name: String, size: Float, weight: String, color: Int, height: Int, lines: Int) =
|
|
49
50
|
NativeListResolvedText.resolve(
|
|
50
|
-
context,
|
|
51
|
+
context, fonts,
|
|
51
52
|
item.json.optString(name),
|
|
52
53
|
style.optJSONObject(name),
|
|
53
54
|
size,
|
|
@@ -88,7 +89,7 @@ internal object NativeListMessageRenderer {
|
|
|
88
89
|
)
|
|
89
90
|
}
|
|
90
91
|
|
|
91
|
-
class Views(private val context: ThemedReactContext) {
|
|
92
|
+
class Views(private val context: ThemedReactContext, private val fonts: NativeListFonts) {
|
|
92
93
|
val column = LinearLayout(context).apply { orientation = LinearLayout.VERTICAL }
|
|
93
94
|
val title = NativeListTextView(context)
|
|
94
95
|
val body = NativeListTextView(context)
|
|
@@ -128,7 +129,7 @@ internal object NativeListMessageRenderer {
|
|
|
128
129
|
resolved.verticalPadding,
|
|
129
130
|
)
|
|
130
131
|
resolved.leading?.let { visual ->
|
|
131
|
-
val host = leading ?: NativeListLeadingVisual(context).also { leading = it }
|
|
132
|
+
val host = leading ?: NativeListLeadingVisual(context, fonts).also { leading = it }
|
|
132
133
|
host.bind(visual, resolved.imageStyle, item.key, theme, resolved.unread, sourceScale)
|
|
133
134
|
val params =
|
|
134
135
|
LinearLayout.LayoutParams(resolved.imageWidth, resolved.imageHeight).apply {
|
|
@@ -206,10 +207,10 @@ internal object NativeListMessageRenderer {
|
|
|
206
207
|
}
|
|
207
208
|
}
|
|
208
209
|
|
|
209
|
-
internal class NativeListMessageRowView(context: ThemedReactContext) :
|
|
210
|
-
NativeListRendererRowView(context) {
|
|
210
|
+
internal class NativeListMessageRowView(context: ThemedReactContext, fonts: NativeListFonts) :
|
|
211
|
+
NativeListRendererRowView(context, fonts) {
|
|
211
212
|
override val assetFields = listOf("leading", "thumbnail")
|
|
212
|
-
private val views = NativeListMessageRenderer.Views(context)
|
|
213
|
+
private val views = NativeListMessageRenderer.Views(context, fonts)
|
|
213
214
|
|
|
214
215
|
override fun bindContent(
|
|
215
216
|
item: NativeListItem,
|
|
@@ -219,7 +220,7 @@ internal class NativeListMessageRowView(context: ThemedReactContext) :
|
|
|
219
220
|
) {
|
|
220
221
|
views.bind(
|
|
221
222
|
this,
|
|
222
|
-
NativeListMessageRenderer.resolve(reactContext, item, theme, sourceScale),
|
|
223
|
+
NativeListMessageRenderer.resolve(reactContext, fonts, item, theme, sourceScale),
|
|
223
224
|
item,
|
|
224
225
|
theme,
|
|
225
226
|
sourceScale,
|