@onekeyfe/react-native-native-list 6.7.0-20 → 6.7.0-22
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/android/src/main/java/com/onekey/nativelist/NativeListAccessoryStack.kt +5 -0
- package/android/src/main/java/com/onekey/nativelist/NativeListActivityDetailsView.kt +29 -4
- package/android/src/main/java/com/onekey/nativelist/NativeListActivityRenderer.kt +6 -10
- package/android/src/main/java/com/onekey/nativelist/NativeListAdapter.kt +17 -1
- package/android/src/main/java/com/onekey/nativelist/NativeListDataRowRenderer.kt +15 -0
- package/android/src/main/java/com/onekey/nativelist/NativeListGeneratedIcons.kt +47 -0
- package/android/src/main/java/com/onekey/nativelist/NativeListIdentityRenderer.kt +33 -2
- package/android/src/main/java/com/onekey/nativelist/NativeListLeadingVisual.kt +5 -0
- package/android/src/main/java/com/onekey/nativelist/NativeListMarketRenderer.kt +92 -28
- package/android/src/main/java/com/onekey/nativelist/NativeListModels.kt +13 -10
- package/android/src/main/java/com/onekey/nativelist/NativeListPrimitives.kt +120 -338
- package/android/src/main/java/com/onekey/nativelist/NativeListRendererRowView.kt +5 -0
- package/android/src/main/java/com/onekey/nativelist/NativeListView.kt +33 -8
- package/android/src/test/java/com/margelo/nitro/nativelist/NativeListActivityHostClipPolicyTest.kt +11 -5
- package/docs/ROW_TEMPLATES.md +10 -2
- package/docs/SPEC.md +432 -50
- package/ios/NativeListAccessoryStack.swift +6 -16
- package/ios/NativeListActivityDetailsView.swift +13 -4
- package/ios/NativeListDataRowRenderer.swift +15 -6
- package/ios/NativeListDesignAssets.swift +13 -84
- package/ios/NativeListGeneratedIcons.swift +55 -0
- package/ios/NativeListIconBinding.swift +171 -0
- package/ios/NativeListIdentityRenderer.swift +69 -13
- package/ios/NativeListLeadingVisual.swift +11 -9
- package/ios/NativeListMarketRenderer.swift +120 -31
- package/ios/NativeListMediaTileRenderer.swift +6 -2
- package/ios/NativeListMetricCardRenderer.swift +4 -2
- package/ios/NativeListSectionHeaderRenderer.swift +12 -4
- package/ios/RNCNativeListView.swift +21 -3
- package/ios/tests/NativeListAccessoryStackTests.swift +12 -0
- package/ios/tests/NativeListAccountSelectorLayoutTests.swift +96 -0
- package/ios/tests/NativeListActivityPresentationTests.swift +97 -0
- package/ios/tests/NativeListLifecycleTests.swift +73 -4
- package/ios/tests/NativeListMarketMetricsTests.swift +117 -0
- package/ios/tests/NativeListSharedIconTests.swift +236 -0
- package/lib/module/NativeList.js +25 -6
- package/lib/module/NativeList.web.js +9 -12
- package/lib/module/models.js +2 -0
- package/lib/module/validation.js +695 -114
- package/lib/module/web/NativeListGeneratedIcons.js +31 -0
- package/lib/module/web/NativeListWebEngine.js +24 -332
- package/lib/module/web/templates/ActivityRowRenderer.js +4 -24
- package/lib/module/web/templates/IdentityRowRenderer.js +66 -4
- package/lib/module/web/templates/MarketTableRowRenderer.js +36 -19
- package/lib/module/web/templates/MediaTileRowRenderer.js +2 -12
- package/lib/typescript/src/NativeList.types.d.ts +2 -2
- package/lib/typescript/src/models.d.ts +27 -14
- package/lib/typescript/src/validation.d.ts +7 -2
- package/lib/typescript/src/web/NativeListGeneratedIcons.d.ts +2 -0
- package/lib/typescript/src/web/NativeListWebEngine.d.ts +0 -1
- package/package.json +16 -10
- package/react-native-native-list.podspec +0 -5
- package/scripts/generate-icons.mjs +150 -0
- package/scripts/generate-icons.test.mjs +288 -0
- package/scripts/native-list-icons.json +260 -0
- package/src/NativeList.tsx +30 -10
- package/src/NativeList.types.ts +2 -2
- package/src/NativeList.web.tsx +10 -14
- package/src/models.ts +158 -153
- package/src/validation.ts +1757 -167
- package/src/web/NativeListGeneratedIcons.ts +28 -0
- package/src/web/NativeListWebEngine.ts +31 -415
- package/src/web/templates/ActivityRowRenderer.ts +15 -53
- package/src/web/templates/IdentityRowRenderer.ts +78 -4
- package/src/web/templates/MarketTableRowRenderer.ts +53 -33
- package/src/web/templates/MediaTileRowRenderer.ts +2 -15
- package/ios/Resources/NativeListIcons.xcassets/Contents.json +0 -1
- package/ios/Resources/NativeListIcons.xcassets/onekey_arrow_bottom.imageset/Contents.json +0 -1
- package/ios/Resources/NativeListIcons.xcassets/onekey_arrow_bottom.imageset/icon.svg +0 -1
- package/ios/Resources/NativeListIcons.xcassets/onekey_arrow_top.imageset/Contents.json +0 -1
- package/ios/Resources/NativeListIcons.xcassets/onekey_arrow_top.imageset/icon.svg +0 -1
- package/ios/Resources/NativeListIcons.xcassets/onekey_badge_verified_solid.imageset/Contents.json +0 -1
- package/ios/Resources/NativeListIcons.xcassets/onekey_badge_verified_solid.imageset/icon.svg +0 -1
- package/ios/Resources/NativeListIcons.xcassets/onekey_chart_trending_up.imageset/Contents.json +0 -1
- package/ios/Resources/NativeListIcons.xcassets/onekey_chart_trending_up.imageset/icon.svg +0 -1
- package/ios/Resources/NativeListIcons.xcassets/onekey_checkbox_checked.imageset/Contents.json +0 -1
- package/ios/Resources/NativeListIcons.xcassets/onekey_checkbox_checked.imageset/icon.svg +0 -1
- package/ios/Resources/NativeListIcons.xcassets/onekey_checkbox_indeterminate.imageset/Contents.json +0 -1
- package/ios/Resources/NativeListIcons.xcassets/onekey_checkbox_indeterminate.imageset/icon.svg +0 -1
- package/ios/Resources/NativeListIcons.xcassets/onekey_chevron_bottom.imageset/Contents.json +0 -1
- package/ios/Resources/NativeListIcons.xcassets/onekey_chevron_bottom.imageset/icon.svg +0 -1
- package/ios/Resources/NativeListIcons.xcassets/onekey_chevron_grabber_ver.imageset/Contents.json +0 -1
- package/ios/Resources/NativeListIcons.xcassets/onekey_chevron_grabber_ver.imageset/icon.svg +0 -1
- package/ios/Resources/NativeListIcons.xcassets/onekey_chevron_right_small.imageset/Contents.json +0 -1
- package/ios/Resources/NativeListIcons.xcassets/onekey_chevron_right_small.imageset/icon.svg +0 -1
- package/ios/Resources/NativeListIcons.xcassets/onekey_chevron_top.imageset/Contents.json +0 -1
- package/ios/Resources/NativeListIcons.xcassets/onekey_chevron_top.imageset/icon.svg +0 -1
- package/ios/Resources/NativeListIcons.xcassets/onekey_crypto_coin_outline.imageset/Contents.json +0 -15
- package/ios/Resources/NativeListIcons.xcassets/onekey_crypto_coin_outline.imageset/icon.svg +0 -4
- package/ios/Resources/NativeListIcons.xcassets/onekey_document2.imageset/Contents.json +0 -1
- package/ios/Resources/NativeListIcons.xcassets/onekey_document2.imageset/icon.svg +0 -1
- package/ios/Resources/NativeListIcons.xcassets/onekey_dot_hor.imageset/Contents.json +0 -1
- package/ios/Resources/NativeListIcons.xcassets/onekey_dot_hor.imageset/icon.svg +0 -1
- package/ios/Resources/NativeListIcons.xcassets/onekey_dot_ver_solid.imageset/Contents.json +0 -1
- package/ios/Resources/NativeListIcons.xcassets/onekey_dot_ver_solid.imageset/icon.svg +0 -1
- package/ios/Resources/NativeListIcons.xcassets/onekey_drag.imageset/Contents.json +0 -1
- package/ios/Resources/NativeListIcons.xcassets/onekey_drag.imageset/icon.svg +0 -1
- package/ios/Resources/NativeListIcons.xcassets/onekey_error_solid.imageset/Contents.json +0 -1
- package/ios/Resources/NativeListIcons.xcassets/onekey_error_solid.imageset/icon.svg +0 -1
- package/ios/Resources/NativeListIcons.xcassets/onekey_gas_solid.imageset/Contents.json +0 -15
- package/ios/Resources/NativeListIcons.xcassets/onekey_gas_solid.imageset/icon.svg +0 -3
- package/ios/Resources/NativeListIcons.xcassets/onekey_image_square_waves.imageset/Contents.json +0 -1
- package/ios/Resources/NativeListIcons.xcassets/onekey_image_square_waves.imageset/icon.svg +0 -1
- package/ios/Resources/NativeListIcons.xcassets/onekey_info_circle.imageset/Contents.json +0 -1
- package/ios/Resources/NativeListIcons.xcassets/onekey_info_circle.imageset/icon.svg +0 -1
- package/ios/Resources/NativeListIcons.xcassets/onekey_minus_circle.imageset/Contents.json +0 -1
- package/ios/Resources/NativeListIcons.xcassets/onekey_minus_circle.imageset/icon.svg +0 -1
- package/ios/Resources/NativeListIcons.xcassets/onekey_minus_circle_solid.imageset/Contents.json +0 -1
- package/ios/Resources/NativeListIcons.xcassets/onekey_minus_circle_solid.imageset/icon.svg +0 -1
- package/ios/Resources/NativeListIcons.xcassets/onekey_pencil.imageset/Contents.json +0 -1
- package/ios/Resources/NativeListIcons.xcassets/onekey_pencil.imageset/icon.svg +0 -1
- package/ios/Resources/NativeListIcons.xcassets/onekey_plus_circle.imageset/Contents.json +0 -1
- package/ios/Resources/NativeListIcons.xcassets/onekey_plus_circle.imageset/icon.svg +0 -1
- package/ios/Resources/NativeListIcons.xcassets/onekey_plus_large.imageset/Contents.json +0 -1
- package/ios/Resources/NativeListIcons.xcassets/onekey_plus_large.imageset/icon.svg +0 -1
- package/ios/Resources/NativeListIcons.xcassets/onekey_plus_small.imageset/Contents.json +0 -1
- package/ios/Resources/NativeListIcons.xcassets/onekey_plus_small.imageset/icon.svg +0 -1
- package/ios/Resources/NativeListIcons.xcassets/onekey_questionmark_solid.imageset/Contents.json +0 -1
- package/ios/Resources/NativeListIcons.xcassets/onekey_questionmark_solid.imageset/icon.svg +0 -1
- package/ios/Resources/NativeListIcons.xcassets/onekey_refresh_ccw_outline.imageset/Contents.json +0 -15
- package/ios/Resources/NativeListIcons.xcassets/onekey_refresh_ccw_outline.imageset/icon.svg +0 -3
- package/ios/Resources/NativeListIcons.xcassets/onekey_selector_account_error_custom.imageset/Contents.json +0 -15
- package/ios/Resources/NativeListIcons.xcassets/onekey_selector_account_error_custom.imageset/icon.svg +0 -14
- package/ios/Resources/NativeListIcons.xcassets/onekey_selector_all_networks_solid.imageset/Contents.json +0 -15
- package/ios/Resources/NativeListIcons.xcassets/onekey_selector_all_networks_solid.imageset/icon.svg +0 -12
- package/ios/Resources/NativeListIcons.xcassets/onekey_selector_apple_brand.imageset/Contents.json +0 -15
- package/ios/Resources/NativeListIcons.xcassets/onekey_selector_apple_brand.imageset/icon.svg +0 -6
- package/ios/Resources/NativeListIcons.xcassets/onekey_selector_bot_illus.imageset/Contents.json +0 -15
- package/ios/Resources/NativeListIcons.xcassets/onekey_selector_bot_illus.imageset/icon.svg +0 -15
- package/ios/Resources/NativeListIcons.xcassets/onekey_selector_crossed_small_solid.imageset/Contents.json +0 -15
- package/ios/Resources/NativeListIcons.xcassets/onekey_selector_crossed_small_solid.imageset/icon.svg +0 -3
- package/ios/Resources/NativeListIcons.xcassets/onekey_selector_globus_outline.imageset/Contents.json +0 -15
- package/ios/Resources/NativeListIcons.xcassets/onekey_selector_globus_outline.imageset/icon.svg +0 -7
- package/ios/Resources/NativeListIcons.xcassets/onekey_selector_google_illus.imageset/Contents.json +0 -15
- package/ios/Resources/NativeListIcons.xcassets/onekey_selector_google_illus.imageset/icon.svg +0 -18
- package/ios/Resources/NativeListIcons.xcassets/onekey_selector_lock_solid.imageset/Contents.json +0 -15
- package/ios/Resources/NativeListIcons.xcassets/onekey_selector_lock_solid.imageset/icon.svg +0 -7
- package/ios/Resources/NativeListIcons.xcassets/onekey_shield_exclamation.imageset/Contents.json +0 -1
- package/ios/Resources/NativeListIcons.xcassets/onekey_shield_exclamation.imageset/icon.svg +0 -1
- package/ios/Resources/NativeListIcons.xcassets/onekey_speaker_promote.imageset/Contents.json +0 -1
- package/ios/Resources/NativeListIcons.xcassets/onekey_speaker_promote.imageset/icon.svg +0 -1
- package/ios/Resources/NativeListIcons.xcassets/onekey_star.imageset/Contents.json +0 -1
- package/ios/Resources/NativeListIcons.xcassets/onekey_star.imageset/icon.svg +0 -1
- package/ios/Resources/NativeListIcons.xcassets/onekey_star_solid.imageset/Contents.json +0 -1
- package/ios/Resources/NativeListIcons.xcassets/onekey_star_solid.imageset/icon.svg +0 -1
- package/ios/Resources/NativeListIcons.xcassets/onekey_swap_hor.imageset/Contents.json +0 -1
- package/ios/Resources/NativeListIcons.xcassets/onekey_swap_hor.imageset/icon.svg +0 -1
- package/ios/Resources/NativeListIcons.xcassets/onekey_ticket.imageset/Contents.json +0 -1
- package/ios/Resources/NativeListIcons.xcassets/onekey_ticket.imageset/icon.svg +0 -1
- package/ios/Resources/NativeListIcons.xcassets/onekey_wallet.imageset/Contents.json +0 -1
- package/ios/Resources/NativeListIcons.xcassets/onekey_wallet.imageset/icon.svg +0 -1
|
@@ -3,12 +3,10 @@ package com.margelo.nitro.nativelist
|
|
|
3
3
|
import android.graphics.Canvas
|
|
4
4
|
import android.graphics.Color
|
|
5
5
|
import android.graphics.Paint
|
|
6
|
-
import android.graphics.Path
|
|
7
6
|
import android.graphics.Typeface
|
|
8
7
|
import android.view.View
|
|
9
8
|
import android.widget.LinearLayout
|
|
10
9
|
import android.widget.TextView
|
|
11
|
-
import androidx.core.graphics.PathParser
|
|
12
10
|
import com.facebook.react.common.assets.ReactFontManager
|
|
13
11
|
import kotlin.math.roundToInt
|
|
14
12
|
|
|
@@ -183,357 +181,141 @@ internal class SelectorSubtitleLayout(context: android.content.Context) : Linear
|
|
|
183
181
|
}
|
|
184
182
|
}
|
|
185
183
|
|
|
186
|
-
internal class OneKeyIconView(context: android.content.Context) : View(context) {
|
|
184
|
+
internal open class OneKeyIconView(context: android.content.Context) : View(context) {
|
|
187
185
|
var useSourceScale = false
|
|
186
|
+
set(value) { if (field == value) return; field = value; refresh() }
|
|
188
187
|
var iconName: String = ""
|
|
189
|
-
set(value) {
|
|
190
|
-
field = value
|
|
191
|
-
invalidate()
|
|
192
|
-
}
|
|
193
|
-
|
|
188
|
+
set(value) { if (field == value) return; field = value; refresh() }
|
|
194
189
|
var tintColor: Int = Color.rgb(100, 100, 100)
|
|
195
|
-
set(value) {
|
|
196
|
-
field = value
|
|
197
|
-
invalidate()
|
|
198
|
-
}
|
|
199
|
-
|
|
190
|
+
set(value) { if (field == value) return; field = value; refresh() }
|
|
200
191
|
var glyphSizeDp: Int? = null
|
|
201
|
-
set(value) {
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
192
|
+
set(value) { if (field == value) return; field = value; refresh() }
|
|
193
|
+
private val owner = Any()
|
|
194
|
+
private var generation = 0L
|
|
195
|
+
private var identity: String? = null
|
|
196
|
+
private var bitmap: android.graphics.Bitmap? = null
|
|
197
|
+
private var displayed: com.margelo.nitro.onekeyimage.OneKeyNamedSVG.RenderResult? = null
|
|
198
|
+
private var displayedGeometry: String? = null
|
|
199
|
+
private val fill = Paint(Paint.ANTI_ALIAS_FLAG or Paint.FILTER_BITMAP_FLAG)
|
|
200
|
+
private var updateDepth = 0
|
|
201
|
+
private var initialized = true
|
|
202
|
+
private var attached = false
|
|
205
203
|
|
|
206
|
-
|
|
204
|
+
internal fun beginIconUpdate() { updateDepth++ }
|
|
205
|
+
internal fun endIconUpdate() { updateDepth--; if (updateDepth == 0) refresh() }
|
|
207
206
|
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
val
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
val
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
207
|
+
protected open fun metadata(): NativeListIconMetadata? {
|
|
208
|
+
nativeListGeneratedIcons[iconName]?.let { return it }
|
|
209
|
+
if (iconName.isEmpty()) return null
|
|
210
|
+
val meta = com.margelo.nitro.onekeyimage.OneKeyNamedSVG.iconMetadata(context.applicationContext.assets, iconName) ?: return null
|
|
211
|
+
return NativeListIconMetadata(iconName, meta.width, meta.height)
|
|
212
|
+
}
|
|
213
|
+
protected open fun glyphRect(icon: NativeListIconMetadata): android.graphics.RectF {
|
|
214
|
+
val limit = glyphSizeDp?.let {
|
|
215
|
+
if (useSourceScale) (it * resources.displayMetrics.density).roundToInt().toFloat()
|
|
216
|
+
else NativeListScale.dp(resources,it).toFloat()
|
|
217
|
+
} ?: Float.MAX_VALUE
|
|
218
|
+
val scale = minOf(minOf(width.toFloat(), limit) / icon.width, minOf(height.toFloat(), limit) / icon.height)
|
|
219
|
+
val drawWidth = icon.width * scale
|
|
220
|
+
val drawHeight = icon.height * scale
|
|
221
|
+
val left = (width - drawWidth) / 2f
|
|
222
|
+
val top = (height - drawHeight) / 2f
|
|
223
|
+
return android.graphics.RectF(left, top, left + drawWidth, top + drawHeight)
|
|
224
|
+
}
|
|
225
|
+
|
|
226
|
+
protected fun refresh(force: Boolean = false) {
|
|
227
|
+
if (updateDepth > 0) return
|
|
228
|
+
val icon = metadata()
|
|
229
|
+
val rect = icon?.let { glyphRect(it) }
|
|
230
|
+
val next = "$iconName|$tintColor|$rect|${resources.displayMetrics.density}|$attached|$isShown"
|
|
231
|
+
if (!force && next == identity) return
|
|
232
|
+
identity = next; generation++
|
|
233
|
+
val revision = generation
|
|
234
|
+
com.margelo.nitro.onekeyimage.OneKeyNamedSVG.cancel(owner)
|
|
235
|
+
fun clear() { bitmap = null; displayed = null; displayedGeometry = null; fill.colorFilter = null; invalidate() }
|
|
236
|
+
if (!attached || !isShown || icon == null || rect == null || rect.isEmpty || icon.name == "Circle") { clear(); return }
|
|
237
|
+
val w = kotlin.math.ceil(rect.width()).toInt()
|
|
238
|
+
val h = kotlin.math.ceil(rect.height()).toInt()
|
|
239
|
+
if (w !in 1..4096 || h !in 1..4096 || w.toLong() * h > 4194304) { clear(); return }
|
|
240
|
+
val color = "rgba(${Color.red(tintColor)},${Color.green(tintColor)},${Color.blue(tintColor)},${Color.alpha(tintColor)/255.0})"
|
|
241
|
+
val geometry = "${icon.name}|$rect|${resources.displayMetrics.density}"
|
|
242
|
+
val ready = displayed
|
|
243
|
+
if (displayedGeometry == geometry && ready != null && bitmap != null) {
|
|
244
|
+
if (ready.canTint(color)) {
|
|
245
|
+
fill.colorFilter = ready.tintColor(color)?.let { android.graphics.PorterDuffColorFilter(it, android.graphics.PorterDuff.Mode.SRC_IN) }
|
|
246
|
+
invalidate(); return
|
|
247
|
+
}
|
|
248
|
+
} else clear()
|
|
249
|
+
val weakView = java.lang.ref.WeakReference(this)
|
|
250
|
+
com.margelo.nitro.onekeyimage.OneKeyNamedSVG.requestRender(owner, context.applicationContext.assets,
|
|
251
|
+
icon.name,color,w,h,resources.displayMetrics.density) { result ->
|
|
252
|
+
val view = weakView.get()
|
|
253
|
+
if (view != null && view.generation == revision && view.attached && view.isShown) {
|
|
254
|
+
view.displayed = result
|
|
255
|
+
view.displayedGeometry = if (result != null) geometry else null
|
|
256
|
+
view.bitmap = result?.bitmap
|
|
257
|
+
view.fill.colorFilter = result?.tintColor(color)?.let { android.graphics.PorterDuffColorFilter(it, android.graphics.PorterDuff.Mode.SRC_IN) }
|
|
258
|
+
view.invalidate()
|
|
233
259
|
}
|
|
234
260
|
}
|
|
235
|
-
canvas.restore()
|
|
236
261
|
}
|
|
237
262
|
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
"CryptoCoinOutline" to listOf(null, null),
|
|
246
|
-
"LockSolid" to listOf(null),
|
|
247
|
-
"GoogleIllus" to
|
|
248
|
-
listOf(
|
|
249
|
-
parseNativeListColor("#4285F4"),
|
|
250
|
-
parseNativeListColor("#34A853"),
|
|
251
|
-
parseNativeListColor("#FBBC05"),
|
|
252
|
-
parseNativeListColor("#EA4335"),
|
|
253
|
-
),
|
|
254
|
-
"AppleBrand" to listOf(null),
|
|
255
|
-
"BotIllus" to
|
|
256
|
-
listOf(
|
|
257
|
-
parseNativeListColor("#8897A5"),
|
|
258
|
-
parseNativeListColor("#3FA9F5"),
|
|
259
|
-
parseNativeListColor("#8897A5"),
|
|
260
|
-
parseNativeListColor("#8897A5"),
|
|
261
|
-
parseNativeListColor("#10243E"),
|
|
262
|
-
parseNativeListColor("#10243E"),
|
|
263
|
-
parseNativeListColor("#10243E"),
|
|
264
|
-
),
|
|
265
|
-
"AllNetworksSolid" to listOf(null, null),
|
|
266
|
-
"CrossedSmallSolid" to listOf(null),
|
|
267
|
-
"AccountErrorCustom" to listOf(Color.argb(0x72, 0, 0, 0), Color.argb(0x72, 0, 0, 0)),
|
|
268
|
-
"Circle" to listOf(null),
|
|
269
|
-
)
|
|
270
|
-
private val selectorIconViewBoxes =
|
|
271
|
-
mapOf(
|
|
272
|
-
"GlobusOutline" to 24f,
|
|
273
|
-
"GasSolid" to 24f,
|
|
274
|
-
"RefreshCcwOutline" to 24f,
|
|
275
|
-
"CryptoCoinOutline" to 24f,
|
|
276
|
-
"LockSolid" to 24f,
|
|
277
|
-
"GoogleIllus" to 24f,
|
|
278
|
-
"AppleBrand" to 16f,
|
|
279
|
-
"BotIllus" to 24f,
|
|
280
|
-
"AllNetworksSolid" to 24f,
|
|
281
|
-
"CrossedSmallSolid" to 24f,
|
|
282
|
-
"AccountErrorCustom" to 18f,
|
|
283
|
-
"Circle" to 24f,
|
|
284
|
-
)
|
|
285
|
-
// Keep the SVG fill-rule used by each Action-row source path. React Native
|
|
286
|
-
// SVG defaults to nonzero (WINDING); only paths declaring fillRule="evenodd"
|
|
287
|
-
// use EVEN_ODD. Other existing icons retain their prior rendering behavior.
|
|
288
|
-
private val actionIconFillTypes =
|
|
289
|
-
mapOf(
|
|
290
|
-
// Asset-list icons the app passes by name (OK-66072 audit): absent entries drew nothing.
|
|
291
|
-
"DotVerSolid" to listOf(Path.FillType.WINDING),
|
|
292
|
-
"Document2Outline" to listOf(Path.FillType.WINDING, Path.FillType.EVEN_ODD),
|
|
293
|
-
"WalletOutline" to listOf(Path.FillType.WINDING, Path.FillType.EVEN_ODD),
|
|
294
|
-
"PlusLargeOutline" to listOf(Path.FillType.WINDING),
|
|
295
|
-
"TicketOutline" to listOf(Path.FillType.WINDING, Path.FillType.EVEN_ODD),
|
|
296
|
-
"GlobusOutline" to listOf(Path.FillType.EVEN_ODD),
|
|
297
|
-
"GasSolid" to listOf(Path.FillType.EVEN_ODD),
|
|
298
|
-
"RefreshCcwOutline" to listOf(Path.FillType.WINDING),
|
|
299
|
-
"CryptoCoinOutline" to listOf(Path.FillType.WINDING, Path.FillType.EVEN_ODD),
|
|
300
|
-
"LockSolid" to listOf(Path.FillType.EVEN_ODD),
|
|
301
|
-
"GoogleIllus" to
|
|
302
|
-
listOf(
|
|
303
|
-
Path.FillType.WINDING,
|
|
304
|
-
Path.FillType.WINDING,
|
|
305
|
-
Path.FillType.WINDING,
|
|
306
|
-
Path.FillType.WINDING,
|
|
307
|
-
),
|
|
308
|
-
"AppleBrand" to listOf(Path.FillType.WINDING),
|
|
309
|
-
"BotIllus" to
|
|
310
|
-
listOf(
|
|
311
|
-
Path.FillType.WINDING,
|
|
312
|
-
Path.FillType.WINDING,
|
|
313
|
-
Path.FillType.WINDING,
|
|
314
|
-
Path.FillType.WINDING,
|
|
315
|
-
Path.FillType.WINDING,
|
|
316
|
-
Path.FillType.WINDING,
|
|
317
|
-
Path.FillType.WINDING,
|
|
318
|
-
),
|
|
319
|
-
"AllNetworksSolid" to listOf(Path.FillType.WINDING, Path.FillType.EVEN_ODD),
|
|
320
|
-
"CrossedSmallSolid" to listOf(Path.FillType.WINDING),
|
|
321
|
-
"AccountErrorCustom" to listOf(Path.FillType.WINDING, Path.FillType.EVEN_ODD),
|
|
322
|
-
"Circle" to listOf(Path.FillType.WINDING),
|
|
323
|
-
"BadgeVerifiedSolid" to listOf(Path.FillType.EVEN_ODD),
|
|
324
|
-
"ChevronRightSmallOutline" to listOf(Path.FillType.WINDING),
|
|
325
|
-
"MinusCircleOutline" to listOf(Path.FillType.WINDING, Path.FillType.EVEN_ODD),
|
|
326
|
-
"PlusCircleOutline" to listOf(Path.FillType.WINDING, Path.FillType.EVEN_ODD),
|
|
327
|
-
"PlusSmallOutline" to listOf(Path.FillType.WINDING),
|
|
328
|
-
"DotHorOutline" to listOf(Path.FillType.WINDING),
|
|
329
|
-
"MinusCircleSolid" to listOf(Path.FillType.EVEN_ODD),
|
|
330
|
-
"PencilOutline" to listOf(Path.FillType.EVEN_ODD),
|
|
331
|
-
"DragOutline" to listOf(Path.FillType.WINDING),
|
|
332
|
-
"StarSolid" to listOf(Path.FillType.WINDING),
|
|
333
|
-
"ChevronGrabberVerOutline" to listOf(Path.FillType.WINDING),
|
|
334
|
-
"ChevronBottomOutline" to listOf(Path.FillType.WINDING),
|
|
335
|
-
"ChevronTopOutline" to listOf(Path.FillType.WINDING),
|
|
336
|
-
"ImageSquareWavesOutline" to listOf(Path.FillType.WINDING, Path.FillType.EVEN_ODD),
|
|
337
|
-
)
|
|
338
|
-
|
|
339
|
-
// Exact 24x24 paths from app-monorepo packages/components Icon sources.
|
|
340
|
-
private val iconPaths =
|
|
341
|
-
mapOf(
|
|
342
|
-
"DotVerSolid" to
|
|
343
|
-
listOf(
|
|
344
|
-
"M14 18v4h-4v-4zm0-4h-4v-4h4zm0-8h-4V2h4z"
|
|
345
|
-
),
|
|
346
|
-
"Document2Outline" to
|
|
347
|
-
listOf(
|
|
348
|
-
"M12 16H8v-2h4zm4-4H8v-2h8zm0-4H8V6h8z",
|
|
349
|
-
"M20 22H4V2h16zM6 20h12V4H6z"
|
|
350
|
-
),
|
|
351
|
-
"WalletOutline" to
|
|
352
|
-
listOf(
|
|
353
|
-
"M15.5 13.25a1.25 1.25 0 1 1 0 2.5 1.25 1.25 0 0 1 0-2.5",
|
|
354
|
-
"M17 8h4v13H7a4 4 0 0 1-4-4V6.5A3.5 3.5 0 0 1 6.5 3H17zM5 17a2 2 0 0 0 2 2h12v-9H6.5c-.537 0-1.045-.12-1.5-.337zM6.5 5a1.5 1.5 0 1 0 0 3H15V5z"
|
|
355
|
-
),
|
|
356
|
-
"PlusLargeOutline" to
|
|
357
|
-
listOf(
|
|
358
|
-
"M13 11h8v2h-8v8h-2v-8H3v-2h8V3h2z"
|
|
359
|
-
),
|
|
360
|
-
"TicketOutline" to
|
|
361
|
-
listOf(
|
|
362
|
-
"M16 17.01h-2V15h2zm0-4h-2V11h2zm0-4h-2V7h2z",
|
|
363
|
-
"m22 9.927-.629.252c-1.661.665-1.661 2.977 0 3.642l.629.252V20H2v-5.927l.629-.252c1.661-.665 1.661-2.977 0-3.642L2 9.927V4h20zM4 8.636c2.5 1.52 2.499 5.207 0 6.727V18h16v-2.637c-2.499-1.52-2.5-5.208 0-6.727V6H4z"
|
|
364
|
-
),
|
|
365
|
-
"RefreshCcwOutline" to
|
|
366
|
-
listOf(
|
|
367
|
-
"M5 12a7 7 0 0 0 7 7 7.15 7.15 0 0 0 4.955-2h-2.943v-2h6v6h-2v-2.257A9.148 9.148 0 0 1 12 21a9 9 0 0 1-9-9v-1h2v1Zm1-6.754A9.148 9.148 0 0 1 12 3a9 9 0 0 1 9 9v1h-2v-1a7 7 0 0 0-7-7 7.15 7.15 0 0 0-4.955 2H10v2H4V3h2v2.246Z"
|
|
368
|
-
),
|
|
369
|
-
"GasSolid" to
|
|
370
|
-
listOf(
|
|
371
|
-
"M15 9h4v7h1V8.414L17.586 6 19 4.586l3 3V18h-5v-7h-2v8h1v2H2v-2h1V3h12zM6 9v2h6V9z"
|
|
372
|
-
),
|
|
373
|
-
"CryptoCoinOutline" to
|
|
374
|
-
listOf(
|
|
375
|
-
"M11 16.387a4.5 4.5 0 0 1 0-8.775V6h2v1.613a4.5 4.5 0 0 1 2.856 2.067l-1.712 1.032a2.5 2.5 0 1 0 0 2.576l1.712 1.032A4.5 4.5 0 0 1 13 16.386V18h-2z",
|
|
376
|
-
"M22 12c0 5.523-4.477 10-10 10S2 17.523 2 12 6.477 2 12 2s10 4.477 10 10m-2 0a8 8 0 1 0-16 0 8 8 0 0 0 16 0",
|
|
377
|
-
),
|
|
378
|
-
// OneKey patch: official selector SVG path geometry.
|
|
379
|
-
"GlobusOutline" to
|
|
380
|
-
listOf(
|
|
381
|
-
"M12 2c5.185 0 9.448 3.947 9.95 9H22v2h-.05c-.502 5.053-4.765 9-9.95 9s-9.448-3.947-9.95-9H2v-2h.05C2.552 5.947 6.815 2 12 2M9.523 13c.09 1.982.438 3.726.934 5.002.29.746.612 1.282.917 1.614.304.331.517.384.626.384s.322-.053.626-.384c.305-.332.627-.868.917-1.614.496-1.276.845-3.02.934-5.002zm-5.459 0a8 8 0 0 0 4.8 6.36 10 10 0 0 1-.271-.633C7.994 17.187 7.61 15.189 7.52 13zm12.416 0c-.09 2.189-.474 4.187-1.073 5.727a10 10 0 0 1-.271.633 8 8 0 0 0 4.8-6.36zM8.863 4.639A8 8 0 0 0 4.064 11h3.457c.09-2.189.473-4.187 1.072-5.727q.127-.327.27-.634M12 4c-.109 0-.322.053-.626.384-.305.332-.627.868-.917 1.614-.496 1.276-.844 3.02-.934 5.002h4.954c-.09-1.982-.438-3.726-.934-5.002-.29-.746-.612-1.282-.917-1.614C12.322 4.053 12.109 4 12 4m3.136.639q.144.307.271.634c.599 1.54.982 3.538 1.073 5.727h3.456a8 8 0 0 0-4.8-6.361"
|
|
382
|
-
),
|
|
383
|
-
"LockSolid" to
|
|
384
|
-
listOf(
|
|
385
|
-
"M12 2a5 5 0 0 1 5 5v2h3v13H4V9h3V7a5 5 0 0 1 5-5m-1 11v5h2v-5zm1-9a3 3 0 0 0-3 3v2h6V7a3 3 0 0 0-3-3"
|
|
386
|
-
),
|
|
387
|
-
"GoogleIllus" to
|
|
388
|
-
listOf(
|
|
389
|
-
"M22.56 12.25c0-.78-.07-1.53-.2-2.25H12v4.26h5.92c-.26 1.37-1.04 2.53-2.21 3.31v2.77h3.57c2.08-1.92 3.28-4.74 3.28-8.09",
|
|
390
|
-
"M12 23c2.97 0 5.46-.98 7.28-2.66l-3.57-2.77c-.98.66-2.23 1.06-3.71 1.06-2.86 0-5.29-1.93-6.16-4.53H2.18v2.84C3.99 20.53 7.7 23 12 23",
|
|
391
|
-
"M5.84 14.09c-.22-.66-.35-1.36-.35-2.09s.13-1.43.35-2.09V7.07H2.18C1.43 8.55 1 10.22 1 12s.43 3.45 1.18 4.93l2.85-2.22z",
|
|
392
|
-
"M12 5.38c1.62 0 3.06.56 4.21 1.64l3.15-3.15C17.45 2.09 14.97 1 12 1 7.7 1 3.99 3.47 2.18 7.07l3.66 2.84c.87-2.6 3.3-4.53 6.16-4.53",
|
|
393
|
-
),
|
|
394
|
-
"AppleBrand" to
|
|
395
|
-
listOf(
|
|
396
|
-
"M11.67.834c.117 1.074-.315 2.153-.955 2.928-.64.773-1.692 1.378-2.718 1.298-.14-1.054.38-2.151.971-2.836C9.63 1.45 10.746.872 11.67.834M14.994 7.093c-.176.108-1.992 1.224-1.972 3.482.025 2.769 2.428 3.693 2.46 3.705l-.004.015a10.1 10.1 0 0 1-1.264 2.593c-.764 1.116-1.556 2.229-2.806 2.254-.598.011-1-.162-1.416-.343-.437-.19-.891-.386-1.609-.386-.751 0-1.226.203-1.683.398-.397.169-.78.333-1.32.354-1.208.047-2.124-1.207-2.895-2.32C.909 14.57-.294 10.414 1.322 7.612c.803-1.395 2.237-2.275 3.794-2.298.671-.014 1.32.244 1.89.47.434.172.821.326 1.135.326.282 0 .659-.149 1.099-.323.692-.273 1.539-.607 2.41-.518.599.026 2.276.24 3.354 1.818z"
|
|
397
|
-
),
|
|
398
|
-
"BotIllus" to
|
|
399
|
-
listOf(
|
|
400
|
-
"M11 2a1 1 0 1 1 2 0v1.8l1.6 1.6a1 1 0 1 1-1.4 1.4L12 5.6l-1.2 1.2a1 1 0 0 1-1.4-1.4L11 3.8z",
|
|
401
|
-
"M8.0 6.0h8.0a5.0 5.0 0 0 1 5.0 5.0v4.0a5.0 5.0 0 0 1 -5.0 5.0h-8.0a5.0 5.0 0 0 1 -5.0 -5.0v-4.0a5.0 5.0 0 0 1 5.0 -5.0z",
|
|
402
|
-
"M3.0 10.0h0.0a1.5 1.5 0 0 1 1.5 1.5v3.0a1.5 1.5 0 0 1 -1.5 1.5h0.0a1.5 1.5 0 0 1 -1.5 -1.5v-3.0a1.5 1.5 0 0 1 1.5 -1.5z",
|
|
403
|
-
"M21.0 10.0h0.0a1.5 1.5 0 0 1 1.5 1.5v3.0a1.5 1.5 0 0 1 -1.5 1.5h0.0a1.5 1.5 0 0 1 -1.5 -1.5v-3.0a1.5 1.5 0 0 1 1.5 -1.5z",
|
|
404
|
-
"M7.5 12.0a1.5 1.5 0 1 0 3.0 0a1.5 1.5 0 1 0 -3.0 0",
|
|
405
|
-
"M13.5 12.0a1.5 1.5 0 1 0 3.0 0a1.5 1.5 0 1 0 -3.0 0",
|
|
406
|
-
"M8.5 15.4c.9.8 2.08 1.2 3.5 1.2s2.6-.4 3.5-1.2c.24-.2.6-.18.8.06.2.23.17.6-.06.8-1.14.98-2.58 1.46-4.24 1.46s-3.1-.48-4.24-1.46a.58.58 0 0 1-.06-.8c.2-.24.56-.26.8-.06",
|
|
407
|
-
),
|
|
408
|
-
"AllNetworksSolid" to
|
|
409
|
-
listOf(
|
|
410
|
-
"M15.333 13.998a1.335 1.335 0 1 1 0 2.67 1.335 1.335 0 0 1 0-2.67",
|
|
411
|
-
"M12 0c6.627 0 12 5.373 12 12s-5.373 12-12 12S0 18.627 0 12 5.373 0 12 0M8 12.668A2 2 0 0 0 6 14.666V16c0 1.103.895 1.997 1.998 1.998h1.334A2 2 0 0 0 11.33 16v-1.334a2 2 0 0 0-1.998-1.998zm7.333 0a2.665 2.665 0 1 0 0 5.33 2.665 2.665 0 0 0 0-5.33M7.999 6.001A2 2 0 0 0 6.001 8v1.334c0 1.103.895 1.998 1.998 1.998h1.334a2 2 0 0 0 1.998-1.998V7.999a2 2 0 0 0-1.998-1.998zm6.667 0A2 2 0 0 0 12.668 8v1.334c0 1.103.895 1.998 1.998 1.998H16a2 2 0 0 0 1.998-1.998V7.999A2 2 0 0 0 16 6.001z",
|
|
412
|
-
),
|
|
413
|
-
"CrossedSmallSolid" to
|
|
414
|
-
listOf(
|
|
415
|
-
"M17.87 8.25 14.12 12l3.75 3.75-2.12 2.121-3.75-3.75-3.75 3.75-2.121-2.121L9.879 12l-3.75-3.75 2.12-2.121L12 9.879l3.75-3.75 2.122 2.121Z"
|
|
416
|
-
),
|
|
417
|
-
"AccountErrorCustom" to
|
|
418
|
-
listOf(
|
|
419
|
-
"M12.5 12.75a1.25 1.25 0 1 0 0-2.5 1.25 1.25 0 0 0 0 2.5",
|
|
420
|
-
"M0 3.5A3.5 3.5 0 0 1 3.5 0h8.088A2.41 2.41 0 0 1 14 2.412V5h1a3 3 0 0 1 3 3v7a3 3 0 0 1-3 3H4a4 4 0 0 1-4-4zm2 3.163V14a2 2 0 0 0 2 2h11a1 1 0 0 0 1-1V8a1 1 0 0 0-1-1H3.5c-.537 0-1.045-.12-1.5-.337M2 3.5A1.5 1.5 0 0 0 3.5 5H12V2.412A.41.41 0 0 0 11.588 2H3.5A1.5 1.5 0 0 0 2 3.5",
|
|
421
|
-
),
|
|
422
|
-
"Circle" to listOf("M0 12a12 12 0 1 0 24 0a12 12 0 1 0 -24 0"),
|
|
423
|
-
"BadgeVerifiedSolid" to
|
|
424
|
-
listOf(
|
|
425
|
-
"M9.483 11.458v3.5h-1v-3.5z M10.467 2.698a2.03 2.03 0 0 1 3.065 0l1.358 1.564a.03.03 0 0 0 .028.01l2.046-.325a2.03 2.03 0 0 1 2.347 1.971l.037 2.07q0 .016.014.026l1.776 1.066a2.03 2.03 0 0 1 .532 3.019l-1.304 1.609a.03.03 0 0 0-.005.03l.675 1.956a2.03 2.03 0 0 1-1.533 2.656l-2.033.394a.03.03 0 0 0-.023.019l-.741 1.933a2.03 2.03 0 0 1-2.88 1.05l-1.811-1.006a.03.03 0 0 0-.03 0l-1.811 1.005a2.03 2.03 0 0 1-2.88-1.049l-.742-1.933a.03.03 0 0 0-.023-.019l-2.033-.394a2.03 2.03 0 0 1-1.532-2.656l.675-1.957a.03.03 0 0 0-.005-.029l-1.304-1.61a2.03 2.03 0 0 1 .532-3.018l1.776-1.066a.03.03 0 0 0 .014-.026l.035-2.07a2.03 2.03 0 0 1 2.349-1.97l2.045.324a.03.03 0 0 0 .028-.01zm1.516 3.76a.5.5 0 0 0-.447.276l-1.861 3.724H8.483a1 1 0 0 0-1 1v3.5a1 1 0 0 0 1 1h6.692a2 2 0 0 0 1.981-1.73l.341-2.5a2 2 0 0 0-1.982-2.27h-1.939l.197-1.269a1.5 1.5 0 0 0-1.481-1.731z"
|
|
426
|
-
),
|
|
427
|
-
"ArrowBottomOutline" to
|
|
428
|
-
listOf("m13 17.586 5-5L19.414 14 12 21.414 4.586 14 6 12.586l5 5V3h2z"),
|
|
429
|
-
"ArrowTopOutline" to
|
|
430
|
-
listOf("M19.414 10 18 11.414l-5-5V21h-2V6.414l-5 5L4.586 10 12 2.586z"),
|
|
431
|
-
"ChartTrendingUpOutline" to
|
|
432
|
-
listOf("M22 13h-2V9.414l-7 7-4-4-6 6L1.586 17 9 9.586l4 4L18.586 8H15V6h7z"),
|
|
433
|
-
"SwapHorOutline" to
|
|
434
|
-
listOf(
|
|
435
|
-
"M21 16H6.914l2.293 2.293-1.414 1.414L2.086 14H21zm.914-6H3V8h14.086l-2.293-2.293 1.414-1.414z"
|
|
436
|
-
),
|
|
437
|
-
"ShieldExclamationOutline" to
|
|
438
|
-
listOf(
|
|
439
|
-
"M12 12.25a1.25 1.25 0 1 1 0 2.5 1.25 1.25 0 0 1 0-2.5m0-4.75a1 1 0 0 1 1 1v2a1 1 0 0 1-2 0v-2a1 1 0 0 1 1-1",
|
|
440
|
-
"M11.352 2.223c.42-.145.876-.145 1.296 0l6.98 2.4a1.995 1.995 0 0 1 1.347 1.886v5.432c0 2.799-1.146 4.817-2.805 6.387-1.61 1.525-3.735 2.652-5.696 3.71a1 1 0 0 1-.947 0c-1.961-1.058-4.086-2.185-5.697-3.71-1.659-1.57-2.805-3.588-2.805-6.386V6.508c0-.852.542-1.61 1.347-1.887l6.98-2.4ZM5.02 6.509v5.432c0 2.16.848 3.676 2.18 4.938 1.272 1.204 2.957 2.149 4.799 3.145 1.842-.996 3.527-1.94 4.799-3.145 1.332-1.262 2.181-2.778 2.181-4.938V6.51L12 4.109z",
|
|
441
|
-
),
|
|
442
|
-
"InfoCircleOutline" to
|
|
443
|
-
listOf(
|
|
444
|
-
"M13 17h-2v-5h-1v-2h3zm0-8h-2V7h2z",
|
|
445
|
-
"M12 2c5.523 0 10 4.477 10 10s-4.477 10-10 10S2 17.523 2 12 6.477 2 12 2m0 2a8 8 0 1 0 0 16 8 8 0 0 0 0-16",
|
|
446
|
-
),
|
|
447
|
-
"SpeakerPromoteOutline" to
|
|
448
|
-
listOf(
|
|
449
|
-
"M21.996 11a4 4 0 0 1-3 3.874v5.495l-5.361-1.711A3.998 3.998 0 0 1 5.996 17v-.779l-4-1.276v-7.89l17-5.424v5.495c1.725.444 3 2.01 3 3.874m-2 0c0-.74-.402-1.385-1-1.731v3.46c.597-.345 1-.989 1-1.729M7.998 7.24v7.521l8.998 2.871V4.368l-8.998 2.87ZM3.996 8.516v4.967l2.002.638V7.877zm4 8.484a2 2 0 0 0 3.706 1.041L7.996 16.86z"
|
|
450
|
-
),
|
|
451
|
-
"PlusCircleOutline" to
|
|
452
|
-
listOf(
|
|
453
|
-
"M13 11h4v2h-4v4h-2v-4l-4 .001v-2L11 11V7h2z",
|
|
454
|
-
"M12 2c5.523 0 10 4.477 10 10s-4.477 10-10 10S2 17.523 2 12 6.477 2 12 2m0 2a8 8 0 1 0 0 16 8 8 0 0 0 0-16",
|
|
455
|
-
),
|
|
456
|
-
"PlusSmallOutline" to listOf("M13 11h5v2h-5v5h-2v-5H6v-2h5V6h2z"),
|
|
457
|
-
"DotHorOutline" to listOf("M6 14H2v-4h4zm8 0h-4v-4h4zm8 0h-4v-4h4z"),
|
|
458
|
-
"MinusCircleOutline" to
|
|
459
|
-
listOf(
|
|
460
|
-
"M17 13H7v-2h10z",
|
|
461
|
-
"M12 2c5.523 0 10 4.477 10 10s-4.477 10-10 10S2 17.523 2 12 6.477 2 12 2m0 2a8 8 0 1 0 0 16 8 8 0 0 0 0-16",
|
|
462
|
-
),
|
|
463
|
-
"MinusCircleSolid" to
|
|
464
|
-
listOf(
|
|
465
|
-
"M12 2c5.523 0 10 4.477 10 10s-4.477 10-10 10S2 17.523 2 12 6.477 2 12 2M7 13h10v-2H7z"
|
|
466
|
-
),
|
|
467
|
-
"ErrorSolid" to listOf("M23.256 20H.742L12 1.041zM11 15v2h2v-2zm0-6v5h2V9z"),
|
|
468
|
-
"QuestionmarkSolid" to
|
|
469
|
-
listOf(
|
|
470
|
-
"M12 2c5.523 0 10 4.477 10 10s-4.477 10-10 10S2 17.523 2 12 6.477 2 12 2m-1 15h2v-2h-2zM9 7v3h2V9h2v1l-2 1.5V14h2v-1.5l2-1.5V7z"
|
|
471
|
-
),
|
|
472
|
-
"PencilOutline" to
|
|
473
|
-
listOf(
|
|
474
|
-
"M22.414 7.5 7.914 22H2v-5.914l14.5-14.5zM4 16.914V20h3.086l9.5-9.5L13.5 7.414zM14.914 6 18 9.086 19.586 7.5 16.5 4.414z"
|
|
475
|
-
),
|
|
476
|
-
"ChevronRightSmallOutline" to listOf("M15.414 12 10 17.414 8.586 16l4-4-4-4L10 6.586z"),
|
|
477
|
-
"DragOutline" to
|
|
478
|
-
listOf("M11 21H7v-4h4zm6 0h-4v-4h4zm-6-7H7v-4h4zm6 0h-4v-4h4zm-6-7H7V3h4zm6 0h-4V3h4z"),
|
|
479
|
-
"StarOutline" to
|
|
480
|
-
listOf(
|
|
481
|
-
"m15.455 7.243 7.729 1.123-5.592 5.45 1.32 7.698L12 17.879l-6.911 3.635 1.32-7.698-5.592-5.45 7.728-1.123L12 .24zM9.872 9.071l-4.759.69 3.444 3.358-.814 4.738L12 15.62l.465.245 3.791 1.993-.813-4.739 3.443-3.357-4.758-.69L12 4.758z"
|
|
482
|
-
),
|
|
483
|
-
"StarSolid" to
|
|
484
|
-
listOf(
|
|
485
|
-
"m15.405 7.313 7.84 1.034-5.735 5.443 1.44 7.774L12 17.793l-6.948 3.771 1.44-7.774L.756 8.347l7.839-1.034L12 .178z"
|
|
486
|
-
),
|
|
487
|
-
"ChevronGrabberVerOutline" to
|
|
488
|
-
listOf(
|
|
489
|
-
"M17.414 15 12 20.414 6.586 15 8 13.586l4 4 4-4zm0-6L16 10.414l-4-4-4 4L6.586 9 12 3.586z"
|
|
490
|
-
),
|
|
491
|
-
"ChevronBottomOutline" to
|
|
492
|
-
listOf("M20.707 9.707 12 18.414 3.293 9.707l1.414-1.414L12 15.586l7.293-7.293z"),
|
|
493
|
-
"ChevronTopOutline" to
|
|
494
|
-
listOf("m20.707 14.293-1.414 1.414L12 8.414l-7.293 7.293-1.414-1.414L12 5.586z"),
|
|
495
|
-
"ImageSquareWavesOutline" to
|
|
496
|
-
listOf(
|
|
497
|
-
"M14.25 7a2 2 0 1 1 0 4 2 2 0 0 1 0-4",
|
|
498
|
-
"M21 21H3V3h18zM5 16.414V19h12.586L14 15.414l-2 2-4-4zm0-2.828 3-3 4 4 2-2 5 5V5H5z",
|
|
499
|
-
),
|
|
500
|
-
)
|
|
263
|
+
override fun onDraw(canvas: Canvas) {
|
|
264
|
+
super.onDraw(canvas)
|
|
265
|
+
val icon = metadata() ?: return
|
|
266
|
+
val rect = glyphRect(icon)
|
|
267
|
+
if (icon.name == "Circle") { fill.colorFilter = null; fill.color = tintColor; canvas.drawOval(rect,fill); return }
|
|
268
|
+
fill.alpha = 255
|
|
269
|
+
bitmap?.let { canvas.drawBitmap(it,null,rect,fill) }
|
|
501
270
|
}
|
|
271
|
+
override fun onAttachedToWindow() { super.onAttachedToWindow(); attached = true; refresh() }
|
|
272
|
+
override fun onDetachedFromWindow() {
|
|
273
|
+
attached = false
|
|
274
|
+
super.onDetachedFromWindow()
|
|
275
|
+
refresh()
|
|
276
|
+
}
|
|
277
|
+
override fun onVisibilityChanged(changedView: View, visibility: Int) {
|
|
278
|
+
super.onVisibilityChanged(changedView, visibility)
|
|
279
|
+
if (initialized) refresh()
|
|
280
|
+
}
|
|
281
|
+
override fun onSizeChanged(w: Int,h: Int,oldw: Int,oldh: Int) { super.onSizeChanged(w,h,oldw,oldh); refresh() }
|
|
282
|
+
override fun onConfigurationChanged(config: android.content.res.Configuration) { super.onConfigurationChanged(config); refresh(true) }
|
|
502
283
|
}
|
|
503
284
|
|
|
504
|
-
internal class OneKeyCheckboxView(context: android.content.Context) :
|
|
285
|
+
internal class OneKeyCheckboxView(context: android.content.Context) : OneKeyIconView(context) {
|
|
505
286
|
var usesSelectorGeometry = false
|
|
506
|
-
|
|
507
|
-
|
|
508
|
-
|
|
509
|
-
|
|
510
|
-
|
|
511
|
-
|
|
512
|
-
|
|
287
|
+
set(value) { if (field == value) return; field = value; refresh() }
|
|
288
|
+
fun setState(value: String,color: Int) {
|
|
289
|
+
tintColor = color
|
|
290
|
+
iconName = when(value) {
|
|
291
|
+
"checked" -> "CheckboxCheckedCustom"
|
|
292
|
+
"indeterminate" -> "CheckboxIndeterminateCustom"
|
|
293
|
+
else -> ""
|
|
294
|
+
}
|
|
513
295
|
}
|
|
296
|
+
override fun metadata(): NativeListIconMetadata? = when(iconName) {
|
|
297
|
+
"CheckboxCheckedCustom", "CheckboxIndeterminateCustom" -> NativeListIconMetadata(iconName,16f,16f)
|
|
298
|
+
else -> null
|
|
299
|
+
}
|
|
300
|
+
override fun glyphRect(icon: NativeListIconMetadata): android.graphics.RectF {
|
|
301
|
+
val size = if (usesSelectorGeometry) (16 * resources.displayMetrics.density).roundToInt().toFloat() else minOf(width,height)*0.8f
|
|
302
|
+
val border = (2 * resources.displayMetrics.density).roundToInt().toFloat()
|
|
303
|
+
val left = if(usesSelectorGeometry) border else (width-size)/2f
|
|
304
|
+
val top = if(usesSelectorGeometry) border else (height-size)/2f
|
|
305
|
+
return android.graphics.RectF(left,top,left+size,top+size)
|
|
306
|
+
}
|
|
307
|
+
}
|
|
514
308
|
|
|
515
|
-
|
|
516
|
-
|
|
517
|
-
|
|
518
|
-
|
|
519
|
-
|
|
520
|
-
|
|
521
|
-
|
|
522
|
-
|
|
523
|
-
|
|
524
|
-
|
|
525
|
-
// frame.
|
|
526
|
-
val drawSize =
|
|
527
|
-
if (usesSelectorGeometry) (16 * resources.displayMetrics.density).roundToInt().toFloat()
|
|
528
|
-
else minOf(width, height) * 0.8f
|
|
529
|
-
val borderOffset = (2 * resources.displayMetrics.density).roundToInt().toFloat()
|
|
530
|
-
canvas.save()
|
|
531
|
-
canvas.translate(
|
|
532
|
-
if (usesSelectorGeometry) borderOffset else (width - drawSize) / 2f,
|
|
533
|
-
if (usesSelectorGeometry) borderOffset else (height - drawSize) / 2f,
|
|
534
|
-
)
|
|
535
|
-
canvas.scale(drawSize / 16f, drawSize / 16f)
|
|
536
|
-
PathParser.createPathFromPathData(pathData)?.let { canvas.drawPath(it, glyphPaint) }
|
|
537
|
-
canvas.restore()
|
|
309
|
+
/** Captures existing glyph slots only; nested synchronous binds share their final identity. */
|
|
310
|
+
internal class NativeListIconUpdate(root: View) {
|
|
311
|
+
private val icons = mutableListOf<OneKeyIconView>()
|
|
312
|
+
init {
|
|
313
|
+
fun collect(view: View) {
|
|
314
|
+
if (view is OneKeyIconView) icons.add(view)
|
|
315
|
+
if (view is android.view.ViewGroup) for (index in 0 until view.childCount) collect(view.getChildAt(index))
|
|
316
|
+
}
|
|
317
|
+
collect(root)
|
|
318
|
+
icons.forEach { it.beginIconUpdate() }
|
|
538
319
|
}
|
|
320
|
+
fun finish() { icons.forEach { it.endIconUpdate() } }
|
|
539
321
|
}
|
|
@@ -186,6 +186,9 @@ internal abstract class NativeListRendererRowView(protected val reactContext: Th
|
|
|
186
186
|
checkboxState: (NativeListItem, NativeSelectionTarget?, String) -> String,
|
|
187
187
|
useSourceScale: Boolean,
|
|
188
188
|
) {
|
|
189
|
+
val iconUpdate = NativeListIconUpdate(this)
|
|
190
|
+
try {
|
|
191
|
+
|
|
189
192
|
val update = update(current, item)
|
|
190
193
|
val signature =
|
|
191
194
|
nativeListCanonical(
|
|
@@ -246,6 +249,8 @@ internal abstract class NativeListRendererRowView(protected val reactContext: Th
|
|
|
246
249
|
bindSelectionContent(item, checkboxState)
|
|
247
250
|
appearance()
|
|
248
251
|
requestLayout()
|
|
252
|
+
|
|
253
|
+
} finally { iconUpdate.finish() }
|
|
249
254
|
}
|
|
250
255
|
|
|
251
256
|
override fun bindSelection(
|
|
@@ -46,6 +46,7 @@ import androidx.swiperefreshlayout.widget.SwipeRefreshLayout
|
|
|
46
46
|
import com.facebook.react.uimanager.ThemedReactContext
|
|
47
47
|
import com.facebook.react.uimanager.PointerEvents
|
|
48
48
|
import com.facebook.react.uimanager.ReactPointerEventsView
|
|
49
|
+
import com.facebook.react.uimanager.events.NativeGestureUtil
|
|
49
50
|
import com.margelo.nitro.nativelogger.OneKeyLog
|
|
50
51
|
import org.json.JSONArray
|
|
51
52
|
import org.json.JSONObject
|
|
@@ -221,6 +222,14 @@ class NativeListView(
|
|
|
221
222
|
if (isLayoutSuppressed) return
|
|
222
223
|
super.onLayout(changed, left, top, right, bottom)
|
|
223
224
|
}
|
|
225
|
+
|
|
226
|
+
override fun dispatchTouchEvent(event: MotionEvent): Boolean {
|
|
227
|
+
val handled = super.dispatchTouchEvent(event)
|
|
228
|
+
if (event.actionMasked == MotionEvent.ACTION_UP || event.actionMasked == MotionEvent.ACTION_CANCEL) {
|
|
229
|
+
finishPagerNativeGesture(event)
|
|
230
|
+
}
|
|
231
|
+
return handled
|
|
232
|
+
}
|
|
224
233
|
}
|
|
225
234
|
private var configuredTopPaddingPx = 0
|
|
226
235
|
private var slotInsetPx = 0
|
|
@@ -1843,6 +1852,7 @@ class NativeListView(
|
|
|
1843
1852
|
// OneKey patch: vertical lists retain vertical drags and leave horizontal drags to a parent pager.
|
|
1844
1853
|
private val pagerGestureTouchSlop = ViewConfiguration.get(context).scaledTouchSlop
|
|
1845
1854
|
private var pagerGestureIsVertical = false
|
|
1855
|
+
private var pagerNativeGestureStarted = false
|
|
1846
1856
|
private val pagerGestureTouchListener = object : RecyclerView.SimpleOnItemTouchListener() {
|
|
1847
1857
|
private var downX = 0f
|
|
1848
1858
|
private var downY = 0f
|
|
@@ -1856,30 +1866,43 @@ class NativeListView(
|
|
|
1856
1866
|
downY = event.y
|
|
1857
1867
|
directionResolved = false
|
|
1858
1868
|
pagerGestureIsVertical = false
|
|
1869
|
+
pagerNativeGestureStarted = false
|
|
1859
1870
|
}
|
|
1860
|
-
MotionEvent.ACTION_MOVE ->
|
|
1871
|
+
MotionEvent.ACTION_MOVE -> {
|
|
1861
1872
|
val deltaX = abs(event.x - downX)
|
|
1862
1873
|
val deltaY = abs(event.y - downY)
|
|
1863
|
-
if (max(deltaX, deltaY) > pagerGestureTouchSlop) {
|
|
1874
|
+
if (!directionResolved && max(deltaX, deltaY) > pagerGestureTouchSlop) {
|
|
1864
1875
|
directionResolved = true
|
|
1865
1876
|
pagerGestureIsVertical = deltaY >= deltaX
|
|
1866
1877
|
recyclerView.parent?.requestDisallowInterceptTouchEvent(pagerGestureIsVertical)
|
|
1867
|
-
|
|
1868
|
-
|
|
1869
|
-
|
|
1870
|
-
|
|
1878
|
+
} else if (!pagerGestureIsVertical && deltaY > pagerGestureTouchSlop && deltaY >= deltaX) {
|
|
1879
|
+
pagerGestureIsVertical = true
|
|
1880
|
+
recyclerView.parent?.requestDisallowInterceptTouchEvent(true)
|
|
1881
|
+
}
|
|
1882
|
+
if (pagerGestureIsVertical && !pagerNativeGestureStarted) {
|
|
1883
|
+
NativeGestureUtil.notifyNativeGestureStarted(this@NativeListView, event)
|
|
1884
|
+
pagerNativeGestureStarted = true
|
|
1885
|
+
if (keyboardDismissMode == NativeListKeyboardDismissMode.ON_DRAG) {
|
|
1871
1886
|
dismissKeyboard()
|
|
1872
1887
|
}
|
|
1873
1888
|
}
|
|
1874
1889
|
}
|
|
1875
1890
|
MotionEvent.ACTION_UP, MotionEvent.ACTION_CANCEL -> {
|
|
1876
|
-
|
|
1877
|
-
pagerGestureIsVertical = false
|
|
1891
|
+
finishPagerNativeGesture(event)
|
|
1878
1892
|
}
|
|
1879
1893
|
}
|
|
1880
1894
|
return false
|
|
1881
1895
|
}
|
|
1882
1896
|
}
|
|
1897
|
+
|
|
1898
|
+
private fun finishPagerNativeGesture(event: MotionEvent) {
|
|
1899
|
+
if (pagerNativeGestureStarted) {
|
|
1900
|
+
NativeGestureUtil.notifyNativeGestureEnded(this, event)
|
|
1901
|
+
pagerNativeGestureStarted = false
|
|
1902
|
+
}
|
|
1903
|
+
recyclerView.parent?.requestDisallowInterceptTouchEvent(false)
|
|
1904
|
+
pagerGestureIsVertical = false
|
|
1905
|
+
}
|
|
1883
1906
|
// Intercept only a completed tap so RecyclerView keeps drag and reorder ownership.
|
|
1884
1907
|
private val keyboardTapTouchListener = object : RecyclerView.SimpleOnItemTouchListener() {
|
|
1885
1908
|
private var downX = 0f
|
|
@@ -2920,6 +2943,7 @@ class NativeListView(
|
|
|
2920
2943
|
previous.type == "market" &&
|
|
2921
2944
|
changes.keys().asSequence().all(MARKET_QUOTE_FIELDS::contains)
|
|
2922
2945
|
val merged = NativeListItem.parse(mergeRow(previous.json, changes))
|
|
2946
|
+
marketQuoteOnly = marketQuoteOnly && hasSameMarketMetricStructure(previous, merged)
|
|
2923
2947
|
nextItems[index] = merged
|
|
2924
2948
|
if (changes.has("selected")) {
|
|
2925
2949
|
if (changes.optBoolean("selected")) selected.add(merged.key) else selected.remove(merged.key)
|
|
@@ -4815,6 +4839,7 @@ class NativeListView(
|
|
|
4815
4839
|
"priceSegments",
|
|
4816
4840
|
"change",
|
|
4817
4841
|
"accessibilityLabel",
|
|
4842
|
+
"metrics",
|
|
4818
4843
|
)
|
|
4819
4844
|
private const val SECTION_INDEX_CONTENT_INSET_DP = 16
|
|
4820
4845
|
private const val SECTION_INDEX_RAIL_WIDTH_DP = 32
|
package/android/src/test/java/com/margelo/nitro/nativelist/NativeListActivityHostClipPolicyTest.kt
CHANGED
|
@@ -5,10 +5,12 @@ import org.junit.Test
|
|
|
5
5
|
|
|
6
6
|
class NativeListActivityHostClipPolicyTest {
|
|
7
7
|
// One Activity row view serves legacy and rich rows and is reused across
|
|
8
|
-
// binds. A
|
|
9
|
-
// clipping off
|
|
10
|
-
//
|
|
11
|
-
// a
|
|
8
|
+
// binds. A row with an overhanging network badge switches the host's
|
|
9
|
+
// clipping off, whether the badge sits on the host's visual (legacy row,
|
|
10
|
+
// OK-66071) or on the details view's visual (rich row, OK-66275); the next
|
|
11
|
+
// bind must derive clipping afresh, so a row without a badge reusing that
|
|
12
|
+
// view clips again instead of drawing over a neighbouring row (PR #185
|
|
13
|
+
// review).
|
|
12
14
|
@Test
|
|
13
15
|
fun rebindSequenceDerivesClippingFromEachBoundItem() {
|
|
14
16
|
data class Bind(val name: String, val rich: Boolean, val leadingOverhangs: Boolean, val clips: Boolean)
|
|
@@ -17,13 +19,17 @@ class NativeListActivityHostClipPolicyTest {
|
|
|
17
19
|
Bind("legacy row, plain token", rich = false, leadingOverhangs = false, clips = true),
|
|
18
20
|
Bind("legacy row, network badge", rich = false, leadingOverhangs = true, clips = false),
|
|
19
21
|
Bind("rich row reusing the badge row's view", rich = true, leadingOverhangs = false, clips = true),
|
|
22
|
+
// The app's history rows carry `amounts`, so their badge lives on the
|
|
23
|
+
// details view's leading visual: a rich row with such a badge must stop
|
|
24
|
+
// clipping too (OK-66275).
|
|
25
|
+
Bind("rich row, network badge in details", rich = true, leadingOverhangs = true, clips = false),
|
|
20
26
|
Bind("legacy row, badge again", rich = false, leadingOverhangs = true, clips = false),
|
|
21
27
|
Bind("legacy row, hidden leading", rich = false, leadingOverhangs = false, clips = true),
|
|
22
28
|
)
|
|
23
29
|
|
|
24
30
|
assertEquals(
|
|
25
31
|
binds.map(Bind::clips),
|
|
26
|
-
binds.map { nativeListActivityHostClips(
|
|
32
|
+
binds.map { nativeListActivityHostClips(leadingOverhangs = it.leadingOverhangs) },
|
|
27
33
|
)
|
|
28
34
|
}
|
|
29
35
|
}
|