diff --git a/.gradle/7.3.3/executionHistory/executionHistory.bin b/.gradle/7.3.3/executionHistory/executionHistory.bin index 6747845..448fe25 100644 Binary files a/.gradle/7.3.3/executionHistory/executionHistory.bin and b/.gradle/7.3.3/executionHistory/executionHistory.bin differ diff --git a/.gradle/7.3.3/executionHistory/executionHistory.lock b/.gradle/7.3.3/executionHistory/executionHistory.lock index 1cb3e56..f090386 100644 Binary files a/.gradle/7.3.3/executionHistory/executionHistory.lock and b/.gradle/7.3.3/executionHistory/executionHistory.lock differ diff --git a/.gradle/7.3.3/fileHashes/fileHashes.bin b/.gradle/7.3.3/fileHashes/fileHashes.bin index f12f6aa..ce77db5 100644 Binary files a/.gradle/7.3.3/fileHashes/fileHashes.bin and b/.gradle/7.3.3/fileHashes/fileHashes.bin differ diff --git a/.gradle/7.3.3/fileHashes/fileHashes.lock b/.gradle/7.3.3/fileHashes/fileHashes.lock index 2e013d7..2861543 100644 Binary files a/.gradle/7.3.3/fileHashes/fileHashes.lock and b/.gradle/7.3.3/fileHashes/fileHashes.lock differ diff --git a/.gradle/7.3.3/fileHashes/resourceHashesCache.bin b/.gradle/7.3.3/fileHashes/resourceHashesCache.bin index 7e8042a..a8e79d4 100644 Binary files a/.gradle/7.3.3/fileHashes/resourceHashesCache.bin and b/.gradle/7.3.3/fileHashes/resourceHashesCache.bin differ diff --git a/.gradle/buildOutputCleanup/buildOutputCleanup.lock b/.gradle/buildOutputCleanup/buildOutputCleanup.lock index 5461586..99b4613 100644 Binary files a/.gradle/buildOutputCleanup/buildOutputCleanup.lock and b/.gradle/buildOutputCleanup/buildOutputCleanup.lock differ diff --git a/.gradle/buildOutputCleanup/outputFiles.bin b/.gradle/buildOutputCleanup/outputFiles.bin index 2ae40f9..5674d5f 100644 Binary files a/.gradle/buildOutputCleanup/outputFiles.bin and b/.gradle/buildOutputCleanup/outputFiles.bin differ diff --git a/.gradle/file-system.probe b/.gradle/file-system.probe index 6b58ff1..632e9b3 100644 Binary files a/.gradle/file-system.probe and b/.gradle/file-system.probe differ diff --git a/app/build.gradle b/app/build.gradle index 472ca82..5a0b6ed 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -31,8 +31,8 @@ android { applicationId "com.coldmint.rust.pro" minSdkVersion 21 targetSdkVersion 33 - versionCode 24 - versionName "2.1 Bata2(2023-1-14)" + versionCode 25 + versionName "2.1 Bata3(2023-1-27)" testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner" } diff --git a/app/src/main/java/com/coldmint/rust/pro/adapters/CommunityAdapter.kt b/app/src/main/java/com/coldmint/rust/pro/adapters/CommunityAdapter.kt index 4fa1833..c84aa0f 100644 --- a/app/src/main/java/com/coldmint/rust/pro/adapters/CommunityAdapter.kt +++ b/app/src/main/java/com/coldmint/rust/pro/adapters/CommunityAdapter.kt @@ -1,5 +1,6 @@ package com.coldmint.rust.pro.adapters +import android.os.Parcelable import androidx.fragment.app.Fragment import androidx.viewpager2.adapter.FragmentStateAdapter import com.coldmint.rust.pro.fragments.* @@ -8,6 +9,13 @@ class CommunityAdapter(fragment: Fragment) : FragmentStateAdapter(fragment) { override fun getItemCount(): Int { return 4 } +// +// // java.lang.IllegalStateException: Fragment no longer exists for key f0: +// override fun saveState(): Parcelable? { +// return null +// } + + override fun createFragment(position: Int): Fragment { return when (position) { diff --git a/app/src/main/java/com/coldmint/rust/pro/base/BaseAdapter.kt b/app/src/main/java/com/coldmint/rust/pro/base/BaseAdapter.kt index 18ad473..380d747 100644 --- a/app/src/main/java/com/coldmint/rust/pro/base/BaseAdapter.kt +++ b/app/src/main/java/com/coldmint/rust/pro/base/BaseAdapter.kt @@ -152,11 +152,13 @@ abstract class BaseAdapter( * @param index Int */ fun removeItem(index: Int) { - val data = dataList[index] - dataList.removeAt(index) - handler.post { - notifyItemRemoved(index) - itemChangeEvent?.onChanged(ChangeType.Remove, index, data, dataList.size) + if (index < dataList.size) { + val data = dataList[index] + dataList.removeAt(index) + handler.post { + notifyItemRemoved(index) + itemChangeEvent?.onChanged(ChangeType.Remove, index, data, dataList.size) + } } } diff --git a/app/src/main/java/com/coldmint/rust/pro/fragments/CommunityFragment.kt b/app/src/main/java/com/coldmint/rust/pro/fragments/CommunityFragment.kt index b473c61..3a3bc3b 100644 --- a/app/src/main/java/com/coldmint/rust/pro/fragments/CommunityFragment.kt +++ b/app/src/main/java/com/coldmint/rust/pro/fragments/CommunityFragment.kt @@ -2,6 +2,7 @@ package com.coldmint.rust.pro.fragments import android.view.LayoutInflater import android.os.Bundle +import android.os.Parcelable import android.view.View import android.widget.Toast import androidx.core.view.isVisible @@ -51,6 +52,9 @@ class CommunityFragment : BaseFragment() { } + + + override fun getViewBindingObject(layoutInflater: LayoutInflater): FragmentCommunityBinding { return FragmentCommunityBinding.inflate(layoutInflater) } diff --git a/app/src/main/java/com/coldmint/rust/pro/fragments/WebModDetailsFragment.kt b/app/src/main/java/com/coldmint/rust/pro/fragments/WebModDetailsFragment.kt index 545b544..e68f33a 100644 --- a/app/src/main/java/com/coldmint/rust/pro/fragments/WebModDetailsFragment.kt +++ b/app/src/main/java/com/coldmint/rust/pro/fragments/WebModDetailsFragment.kt @@ -39,7 +39,6 @@ class WebModDetailsFragment(val modId: String, val modNameLiveData: MutableLiveD } - //Kotlin次构造函数 constructor() : this("", MutableLiveData()) { @@ -130,6 +129,9 @@ class WebModDetailsFragment(val modId: String, val modNameLiveData: MutableLiveD val token = AppSettings.getValue(AppSettings.Setting.Token, "") WebMod.instance.getInfo(token, modId, object : ApiCallBack { override fun onResponse(t: WebModInfoData) { + if (!isAdded) { + return + } if (t.code == ServerConfiguration.Success_Code) { viewModel.developer = t.data.developer modNameLiveData.value = t.data.name