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">