From 05331665f94989bdf95e844d57da733fa5c069ad Mon Sep 17 00:00:00 2001 From: muqing <1966944300@qq.com> Date: Sun, 21 Jul 2024 18:43:49 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E9=A2=9C=E8=89=B2=E8=A7=86?= =?UTF-8?q?=E8=A7=89=E9=9A=9C=E7=A2=8DBUG=E5=92=8C=E5=AF=BC=E8=88=AABUG?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/build.gradle | 2 +- .../main/java/com/coldmint/rust/pro/CodeTableActivity.kt | 9 +++++++-- .../com/coldmint/rust/pro/adapters/CodeTableAdapter.kt | 2 +- app/src/main/res/layout/item_codetable.xml | 1 - 4 files changed, 9 insertions(+), 5 deletions(-) diff --git a/app/build.gradle b/app/build.gradle index a082f6b..e4d2234 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -32,7 +32,7 @@ android { minSdkVersion 23 targetSdkVersion 33 versionCode 28 - versionName "2.1.1 Test1(2024-4-18)" + versionName "2.1.1 Test(2024-7-20)" testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner" } diff --git a/app/src/main/java/com/coldmint/rust/pro/CodeTableActivity.kt b/app/src/main/java/com/coldmint/rust/pro/CodeTableActivity.kt index a481b30..cf8dd26 100644 --- a/app/src/main/java/com/coldmint/rust/pro/CodeTableActivity.kt +++ b/app/src/main/java/com/coldmint/rust/pro/CodeTableActivity.kt @@ -37,15 +37,21 @@ class CodeTableActivity : BaseActivity() { loadData() //设置上下选择按钮 viewBinding.listTop.setOnClickListener { + if (CodeTableAdapter.picklist.isEmpty()) { + return@setOnClickListener + } + if (--CodeTableAdapter.pick < 0) { CodeTableAdapter.pick = 0 } val get = CodeTableAdapter.picklist[CodeTableAdapter.pick] (viewBinding.codeRecyclerB.layoutManager as LinearLayoutManager).scrollToPositionWithOffset(get, 0) - adapter.item?.notifyDataSetChanged() } viewBinding.listButtom.setOnClickListener { val size = CodeTableAdapter.picklist.size + if (CodeTableAdapter.picklist.isEmpty()) { + return@setOnClickListener + } if (++CodeTableAdapter.pick == size - 1) { CodeTableAdapter.pick = 0 @@ -53,7 +59,6 @@ class CodeTableActivity : BaseActivity() { val get = CodeTableAdapter.picklist[CodeTableAdapter.pick] (viewBinding.codeRecyclerB.layoutManager as LinearLayoutManager).scrollToPositionWithOffset(get, 0) - adapter.item?.notifyDataSetChanged() } viewBinding.edittext.addTextChangedListener(object : TextWatcher { override fun beforeTextChanged(a: CharSequence?, p1: Int, p2: Int, p3: Int) { 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 e78071b..65c9b7e 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 @@ -230,7 +230,7 @@ class CodeTableAdapter( holder.binging.root.setCardBackgroundColor(GlobalMethod.getThemeColor(context,R.attr.colorPrimaryContainer)) } else { //背景恢复 - holder.binging.root.setCardBackgroundColor(GlobalMethod.getThemeColor(context,R.attr.colorSecondaryContainer)) + holder.binging.root.setCardBackgroundColor(GlobalMethod.getThemeColor(context,R.attr.colorSurface)) } } diff --git a/app/src/main/res/layout/item_codetable.xml b/app/src/main/res/layout/item_codetable.xml index dc020fa..9020aa6 100644 --- a/app/src/main/res/layout/item_codetable.xml +++ b/app/src/main/res/layout/item_codetable.xml @@ -4,7 +4,6 @@ style="@style/Widget.Material3.CardView.Elevated" android:layout_width="match_parent" android:layout_height="wrap_content" - app:cardBackgroundColor="@null" app:cardUseCompatPadding="true">