From 0fc4c852375353dc3f29a9c9b3de7c54a2984a8f Mon Sep 17 00:00:00 2001 From: Cold-Mint Date: Wed, 1 Feb 2023 14:57:07 +0800 Subject: [PATCH] =?UTF-8?q?=E5=9C=A8=E4=BB=A3=E7=A0=81=E8=A1=A8=E5=86=85?= =?UTF-8?q?=E6=B7=BB=E5=8A=A0=E4=BA=86demo=E5=AD=97=E6=AE=B5=E7=9A=84?= =?UTF-8?q?=E6=98=BE=E7=A4=BA=E8=A7=86=E5=9B=BE=EF=BC=8C=E4=BB=A3=E7=A0=81?= =?UTF-8?q?=E8=A1=A8=E6=A0=BC=E5=BC=8F=E6=94=AF=E6=8C=81demo=E5=AD=97?= =?UTF-8?q?=E6=AE=B5=E3=80=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../coldmint/rust/pro/adapters/CodeTableAdapter.kt | 7 ++++++- app/src/main/res/layout/code_table_item.xml | 13 ++++++++++++- .../rust/core/database/code/CodeDataBase.kt | 11 +++++++++-- .../coldmint/rust/core/database/code/CodeInfo.kt | 2 +- .../rust/core/database/file/FileDataBase.kt | 6 ++++-- 5 files changed, 32 insertions(+), 7 deletions(-) diff --git a/app/src/main/java/com/coldmint/rust/pro/adapters/CodeTableAdapter.kt b/app/src/main/java/com/coldmint/rust/pro/adapters/CodeTableAdapter.kt index cf7eec7..a4b6170 100644 --- a/app/src/main/java/com/coldmint/rust/pro/adapters/CodeTableAdapter.kt +++ b/app/src/main/java/com/coldmint/rust/pro/adapters/CodeTableAdapter.kt @@ -142,6 +142,11 @@ class CodeTableAdapter( resultView.titleView.setOnClickListener { GlobalMethod.copyText(context, codeInfo.translate, it) } + + val demo = codeInfo.demo + resultView.demoView.isVisible = demo.isNotBlank() + resultView.demoView.text = demo + resultView.subTitleView.text = codeInfo.code resultView.subTitleView.setOnClickListener { GlobalMethod.copyText(context, codeInfo.code, it) @@ -156,7 +161,7 @@ class CodeTableAdapter( val chip = Chip(context) chip.text = text chip.setOnClickListener { - labelFunction?.invoke(lineNum, it, text ) + labelFunction?.invoke(lineNum, it, text) } resultView.chipGroup.addView(chip) true diff --git a/app/src/main/res/layout/code_table_item.xml b/app/src/main/res/layout/code_table_item.xml index 9da7c9a..cc1ddfd 100644 --- a/app/src/main/res/layout/code_table_item.xml +++ b/app/src/main/res/layout/code_table_item.xml @@ -32,18 +32,29 @@ android:layout_marginTop="5dp" android:text="描述" /> + +