修复崩溃问题,在代码表内添加demo字段。

This commit is contained in:
Cold-Mint 2023-01-31 11:20:07 +08:00
parent b5ce0d7dc2
commit 660122ad0a
6 changed files with 106 additions and 74 deletions

View File

@ -36,6 +36,10 @@ class ImporterActivity : BaseActivity<ActivityImporterBinding>() {
private fun initView() {
setTitle(R.string.file_importer)
val account = AppSettings.getValue(AppSettings.Setting.Account, "")
if (account.isNotBlank()) {
firebaseAnalytics.setUserId(account)
}
startViewModel.initAllData()
GlobalMethod.requestStoragePermissions(this) {
if (it) {
@ -385,6 +389,7 @@ class ImporterActivity : BaseActivity<ActivityImporterBinding>() {
}
return@Runnable
}
try {
val parcelFileDescriptor = contentResolver.openFileDescriptor(uri!!, "r")
if (parcelFileDescriptor != null) {
val fileDescriptor = parcelFileDescriptor.fileDescriptor
@ -460,6 +465,13 @@ class ImporterActivity : BaseActivity<ActivityImporterBinding>() {
.show()
}
}
}catch (e:Exception){
e.printStackTrace()
Snackbar.make(
viewBinding.okButton,
e.toString(), Snackbar.LENGTH_LONG
).show()
}
}).start()
}

View File

@ -21,9 +21,20 @@ import java.util.*
class RustApplication : Application() {
companion object {
private lateinit var instanceObject: RustApplication
/**
* 获取实例对象
*/
fun getInstance(): RustApplication {
return instanceObject
}
}
override fun onCreate() {
super.onCreate()
instanceObject = this
AppSettings.initAppSettings(this)
//动态颜色
val options = DynamicColorsOptions.Builder()

View File

@ -28,7 +28,8 @@ class UserInfoFragment : BaseFragment<FragmentUserInfoBinding>() {
* 加载列表
*/
fun loadRecyclerView(permission: Int) {
val layoutManager = GridLayoutManager(requireContext(), 4)
val layoutManager = GridLayoutManager(RustApplication.getInstance(), 4)
viewBinding.recyclerView.layoutManager = layoutManager
val dataList = ArrayList<CommunityServiceInfo>()
dataList.add(CommunityServiceInfo(R.string.work_management, R.drawable.work_management))
@ -45,7 +46,7 @@ class UserInfoFragment : BaseFragment<FragmentUserInfoBinding>() {
dataList.add(CommunityServiceInfo(R.string.order_manager, R.drawable.order_manager))
}
}
val adapter = CommunityServiceAdapter(requireContext(), dataList)
val adapter = CommunityServiceAdapter(RustApplication.getInstance(), dataList)
adapter.setItemEvent { i, itemServiceBinding, viewHolder, communityServiceInfo ->
itemServiceBinding.root.setOnClickListener {
when (communityServiceInfo.titleRes) {

View File

@ -47,6 +47,9 @@ object GlobalMethod {
const val DEFAULT_GAME_PACKAGE = "com.corrodinggames.rts"
const val DEBUG_SIGN = "963dfd616924b27f9247a35e45bc130a"
const val RELEASE_SIGN = "5320b24894fe7ed449842a81a2dfceda"
const val Event_LOGOUT = "logOut"
const val Event_LOGIN = "logIn"
/**
* 转dp

View File

@ -13,6 +13,7 @@ data class CodeInfo(
@PrimaryKey val code: String,
@ColumnInfo(name = "translate") val translate: String,
@ColumnInfo(name = "description") val description: String,
@ColumnInfo(name = "demo") val demo: String = "",
@ColumnInfo(name = "type") val type: String,
@ColumnInfo(name = "add_version") val addVersion: Int,
@ColumnInfo(name = "remove_version") val removeVersion: Int = 1,

View File

@ -145,6 +145,7 @@ object AppOperator {
*/
@SuppressLint("QueryPermissionsNeeded")
fun openApp(context: Context, packageName: String) {
try {
var mainAct: String? = null
val pkgMag = context.packageManager
val intent = Intent(Intent.ACTION_MAIN)
@ -164,6 +165,9 @@ object AppOperator {
}
intent.component = ComponentName(packageName, mainAct)
context.startActivity(intent)
}catch (e:Exception){
e.printStackTrace()
}
}
/**