1.修复了在编辑器界面替换文本时,程序崩溃的问题。2.优化部分弹出菜单样式。3.解决部分界面返回后无法获取上下文环境而引发崩溃的问题。

This commit is contained in:
Cold-Mint 2023-01-27 13:21:59 +08:00
parent 7dd6e16c49
commit 4731101039
13 changed files with 24 additions and 8 deletions

Binary file not shown.

View File

@ -31,8 +31,8 @@ android {
applicationId "com.coldmint.rust.pro" applicationId "com.coldmint.rust.pro"
minSdkVersion 21 minSdkVersion 21
targetSdkVersion 33 targetSdkVersion 33
versionCode 24 versionCode 25
versionName "2.1 Bata2(2023-1-14)" versionName "2.1 Bata3(2023-1-27)"
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner" testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
} }

View File

@ -1,5 +1,6 @@
package com.coldmint.rust.pro.adapters package com.coldmint.rust.pro.adapters
import android.os.Parcelable
import androidx.fragment.app.Fragment import androidx.fragment.app.Fragment
import androidx.viewpager2.adapter.FragmentStateAdapter import androidx.viewpager2.adapter.FragmentStateAdapter
import com.coldmint.rust.pro.fragments.* import com.coldmint.rust.pro.fragments.*
@ -8,6 +9,13 @@ class CommunityAdapter(fragment: Fragment) : FragmentStateAdapter(fragment) {
override fun getItemCount(): Int { override fun getItemCount(): Int {
return 4 return 4
} }
//
// // java.lang.IllegalStateException: Fragment no longer exists for key f0:
// override fun saveState(): Parcelable? {
// return null
// }
override fun createFragment(position: Int): Fragment { override fun createFragment(position: Int): Fragment {
return when (position) { return when (position) {

View File

@ -152,6 +152,7 @@ abstract class BaseAdapter<ViewBindingType : ViewBinding, DataType>(
* @param index Int * @param index Int
*/ */
fun removeItem(index: Int) { fun removeItem(index: Int) {
if (index < dataList.size) {
val data = dataList[index] val data = dataList[index]
dataList.removeAt(index) dataList.removeAt(index)
handler.post { handler.post {
@ -159,6 +160,7 @@ abstract class BaseAdapter<ViewBindingType : ViewBinding, DataType>(
itemChangeEvent?.onChanged(ChangeType.Remove, index, data, dataList.size) itemChangeEvent?.onChanged(ChangeType.Remove, index, data, dataList.size)
} }
} }
}
/** /**

View File

@ -2,6 +2,7 @@ package com.coldmint.rust.pro.fragments
import android.view.LayoutInflater import android.view.LayoutInflater
import android.os.Bundle import android.os.Bundle
import android.os.Parcelable
import android.view.View import android.view.View
import android.widget.Toast import android.widget.Toast
import androidx.core.view.isVisible import androidx.core.view.isVisible
@ -51,6 +52,9 @@ class CommunityFragment : BaseFragment<FragmentCommunityBinding>() {
} }
override fun getViewBindingObject(layoutInflater: LayoutInflater): FragmentCommunityBinding { override fun getViewBindingObject(layoutInflater: LayoutInflater): FragmentCommunityBinding {
return FragmentCommunityBinding.inflate(layoutInflater) return FragmentCommunityBinding.inflate(layoutInflater)
} }

View File

@ -39,7 +39,6 @@ class WebModDetailsFragment(val modId: String, val modNameLiveData: MutableLiveD
} }
//Kotlin次构造函数 //Kotlin次构造函数
constructor() : this("", MutableLiveData()) { constructor() : this("", MutableLiveData()) {
@ -130,6 +129,9 @@ class WebModDetailsFragment(val modId: String, val modNameLiveData: MutableLiveD
val token = AppSettings.getValue(AppSettings.Setting.Token, "") val token = AppSettings.getValue(AppSettings.Setting.Token, "")
WebMod.instance.getInfo(token, modId, object : ApiCallBack<WebModInfoData> { WebMod.instance.getInfo(token, modId, object : ApiCallBack<WebModInfoData> {
override fun onResponse(t: WebModInfoData) { override fun onResponse(t: WebModInfoData) {
if (!isAdded) {
return
}
if (t.code == ServerConfiguration.Success_Code) { if (t.code == ServerConfiguration.Success_Code) {
viewModel.developer = t.data.developer viewModel.developer = t.data.developer
modNameLiveData.value = t.data.name modNameLiveData.value = t.data.name