导入数据集和代码模板。
This commit is contained in:
parent
01ec14d156
commit
a1a8341d93
|
@ -31,8 +31,8 @@ android {
|
||||||
applicationId "com.coldmint.rust.pro"
|
applicationId "com.coldmint.rust.pro"
|
||||||
minSdkVersion 21
|
minSdkVersion 21
|
||||||
targetSdkVersion 33
|
targetSdkVersion 33
|
||||||
versionCode 26
|
versionCode 27
|
||||||
versionName "2.1 Bata4(2023-1-28)"
|
versionName "2.1 Bata5(2023-4-21)"
|
||||||
|
|
||||||
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
|
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
|
||||||
}
|
}
|
||||||
|
|
Binary file not shown.
BIN
app/src/main/assets/baseTemplate_v2.0.rp
Normal file
BIN
app/src/main/assets/baseTemplate_v2.0.rp
Normal file
Binary file not shown.
Binary file not shown.
Binary file not shown.
BIN
app/src/main/assets/dataBase_v2.2.0.rdb
Normal file
BIN
app/src/main/assets/dataBase_v2.2.0.rdb
Normal file
Binary file not shown.
|
@ -19,6 +19,8 @@ import android.view.KeyEvent
|
||||||
import android.view.LayoutInflater
|
import android.view.LayoutInflater
|
||||||
import android.view.MenuItem
|
import android.view.MenuItem
|
||||||
import android.view.View
|
import android.view.View
|
||||||
|
import android.view.animation.Animation
|
||||||
|
import android.view.animation.RotateAnimation
|
||||||
import android.widget.*
|
import android.widget.*
|
||||||
import androidx.core.view.isVisible
|
import androidx.core.view.isVisible
|
||||||
import androidx.core.widget.addTextChangedListener
|
import androidx.core.widget.addTextChangedListener
|
||||||
|
@ -253,6 +255,39 @@ class EditModInfoActivity : BaseActivity<ActivityEditModInfoBinding>() {
|
||||||
return FileOperator.writeFile(mModClass.infoFile, resultBuilder.toString())
|
return FileOperator.writeFile(mModClass.infoFile, resultBuilder.toString())
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 执行旋转动画
|
||||||
|
*/
|
||||||
|
private fun doRotateAnimation(
|
||||||
|
view: View,
|
||||||
|
fromDegrees: Float,
|
||||||
|
toDegrees: Float, event: ((Boolean) -> Unit)? = null
|
||||||
|
) {
|
||||||
|
view.clearAnimation()
|
||||||
|
// 计算视图中心点的坐标
|
||||||
|
val centerX = view.width / 2
|
||||||
|
val centerY = view.height / 2
|
||||||
|
// 创建旋转动画,并设置中心点为视图中心
|
||||||
|
val rotateAnimation =
|
||||||
|
RotateAnimation(fromDegrees, toDegrees, centerX.toFloat(), centerY.toFloat())
|
||||||
|
rotateAnimation.duration = 150
|
||||||
|
rotateAnimation.fillAfter = true // 设置FillAfter属性为true,使动画结束后保持最后一帧的状态
|
||||||
|
rotateAnimation.setAnimationListener(object : Animation.AnimationListener {
|
||||||
|
override fun onAnimationStart(animation: Animation) {
|
||||||
|
event?.invoke(false)
|
||||||
|
}
|
||||||
|
|
||||||
|
override fun onAnimationEnd(animation: Animation) {
|
||||||
|
event?.invoke(true)
|
||||||
|
}
|
||||||
|
|
||||||
|
override fun onAnimationRepeat(animation: Animation) {
|
||||||
|
}
|
||||||
|
})
|
||||||
|
// 启动动画
|
||||||
|
view.startAnimation(rotateAnimation)
|
||||||
|
}
|
||||||
|
|
||||||
fun initAction() {
|
fun initAction() {
|
||||||
viewBinding.modNameEdit.addTextChangedListener {
|
viewBinding.modNameEdit.addTextChangedListener {
|
||||||
viewBinding.modNameInputLayout.isErrorEnabled = false
|
viewBinding.modNameInputLayout.isErrorEnabled = false
|
||||||
|
@ -408,13 +443,15 @@ class EditModInfoActivity : BaseActivity<ActivityEditModInfoBinding>() {
|
||||||
viewBinding.expandMusicList.isVisible = true
|
viewBinding.expandMusicList.isVisible = true
|
||||||
viewBinding.enabledMusic.text = getString(R.string.disabled)
|
viewBinding.enabledMusic.text = getString(R.string.disabled)
|
||||||
} else {
|
} else {
|
||||||
showMusicConfigurationView(true)
|
showMusicConfigurationView(true) {
|
||||||
viewBinding.musicListView.isVisible = false
|
viewBinding.musicListView.isVisible = false
|
||||||
viewBinding.addMusic.isVisible = false
|
viewBinding.addMusic.isVisible = false
|
||||||
viewBinding.expandMusicList.isVisible = false
|
viewBinding.expandMusicList.clearAnimation()
|
||||||
viewBinding.enabledMusic.text = getText(R.string.enabled)
|
viewBinding.expandMusicList.isVisible = false
|
||||||
viewBinding.musicPathView.text = getString(R.string.no_enabled)
|
viewBinding.enabledMusic.text = getText(R.string.enabled)
|
||||||
viewBinding.musicPathView.isVisible = true
|
viewBinding.musicPathView.text = getString(R.string.no_enabled)
|
||||||
|
viewBinding.musicPathView.isVisible = true
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -452,45 +489,47 @@ class EditModInfoActivity : BaseActivity<ActivityEditModInfoBinding>() {
|
||||||
* @param hide 隐藏视图
|
* @param hide 隐藏视图
|
||||||
*/
|
*/
|
||||||
@SuppressLint("StringFormatMatches")
|
@SuppressLint("StringFormatMatches")
|
||||||
fun showMusicConfigurationView(hide: Boolean) {
|
fun showMusicConfigurationView(hide: Boolean, func: (() -> Unit)? = null) {
|
||||||
if (hide) {
|
if (hide) {
|
||||||
viewBinding.expandMusicList.setImageResource(R.drawable.animator_expand_off)
|
doRotateAnimation(viewBinding.expandMusicList, 180f, 360f) {
|
||||||
mExpandMusicList = false
|
if (it) {
|
||||||
viewBinding.musicOperation.isVisible = false
|
mExpandMusicList = false
|
||||||
viewBinding.musicPathView.isVisible = false
|
viewBinding.musicOperation.isVisible = false
|
||||||
} else {
|
viewBinding.musicPathView.isVisible = false
|
||||||
viewBinding.expandMusicList.setImageResource(R.drawable.animator_expand_on)
|
func?.invoke()
|
||||||
mExpandMusicList = true
|
|
||||||
viewBinding.musicOperation.isVisible = true
|
|
||||||
val musicFolder = musicFolder
|
|
||||||
if (!musicFolder.exists()) {
|
|
||||||
musicFolder.mkdirs()
|
|
||||||
}
|
|
||||||
val files = ArrayList<File>()
|
|
||||||
val fileArray = musicFolder.listFiles()
|
|
||||||
if (fileArray.isNotEmpty()) {
|
|
||||||
for (f in fileArray) {
|
|
||||||
if (FileOperator.getFileType(f) == "ogg") {
|
|
||||||
files.add(f)
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
val mapAndMusicAdapter = MapAndMusicAdapter(this, files, true)
|
|
||||||
val layoutManager = StableLinearLayoutManager(this@EditModInfoActivity)
|
|
||||||
mapAndMusicAdapter.setItemChangeEvent { changeType, i, file, i2 ->
|
|
||||||
viewBinding.musicPathView.text =
|
|
||||||
String.format(getString(R.string.filenum), i2)
|
|
||||||
}
|
|
||||||
|
|
||||||
viewBinding.musicListView.layoutManager = layoutManager
|
|
||||||
viewBinding.musicListView.adapter = mapAndMusicAdapter
|
|
||||||
viewBinding.musicPathView.isVisible = true
|
|
||||||
viewBinding.musicPathView.text = String.format(getString(R.string.filenum), files.size)
|
|
||||||
}
|
|
||||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.N) {
|
|
||||||
(viewBinding.expandMusicList.drawable as AnimatedVectorDrawable).start()
|
|
||||||
} else {
|
} else {
|
||||||
(viewBinding.expandMusicList.drawable as AnimatedVectorDrawableCompat).start()
|
doRotateAnimation(viewBinding.expandMusicList, 0f, 180f) {
|
||||||
|
mExpandMusicList = true
|
||||||
|
viewBinding.musicOperation.isVisible = true
|
||||||
|
val musicFolder = musicFolder
|
||||||
|
if (!musicFolder.exists()) {
|
||||||
|
musicFolder.mkdirs()
|
||||||
|
}
|
||||||
|
val files = ArrayList<File>()
|
||||||
|
val fileArray = musicFolder.listFiles()
|
||||||
|
if (fileArray.isNotEmpty()) {
|
||||||
|
for (f in fileArray) {
|
||||||
|
if (FileOperator.getFileType(f) == "ogg") {
|
||||||
|
files.add(f)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
val mapAndMusicAdapter = MapAndMusicAdapter(this, files, true)
|
||||||
|
val layoutManager = StableLinearLayoutManager(this@EditModInfoActivity)
|
||||||
|
mapAndMusicAdapter.setItemChangeEvent { changeType, i, file, i2 ->
|
||||||
|
viewBinding.musicPathView.text =
|
||||||
|
String.format(getString(R.string.filenum), i2)
|
||||||
|
}
|
||||||
|
|
||||||
|
viewBinding.musicListView.layoutManager = layoutManager
|
||||||
|
viewBinding.musicListView.adapter = mapAndMusicAdapter
|
||||||
|
viewBinding.musicPathView.isVisible = true
|
||||||
|
viewBinding.musicPathView.text =
|
||||||
|
String.format(getString(R.string.filenum), files.size)
|
||||||
|
func?.invoke()
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -506,12 +545,14 @@ class EditModInfoActivity : BaseActivity<ActivityEditModInfoBinding>() {
|
||||||
viewBinding.mapPathView.isVisible = false
|
viewBinding.mapPathView.isVisible = false
|
||||||
viewBinding.enabledMap.text = getString(R.string.disabled)
|
viewBinding.enabledMap.text = getString(R.string.disabled)
|
||||||
} else {
|
} else {
|
||||||
showMapConfigurationView(true)
|
showMapConfigurationView(true) {
|
||||||
viewBinding.expandMapList.isVisible = false
|
viewBinding.expandMapList.clearAnimation()
|
||||||
viewBinding.addMap.isVisible = false
|
viewBinding.expandMapList.isVisible = false
|
||||||
viewBinding.enabledMap.text = getText(R.string.enabled)
|
viewBinding.addMap.isVisible = false
|
||||||
viewBinding.mapPathView.text = getString(R.string.no_enabled)
|
viewBinding.enabledMap.text = getText(R.string.enabled)
|
||||||
viewBinding.mapPathView.isVisible = true
|
viewBinding.mapPathView.text = getString(R.string.no_enabled)
|
||||||
|
viewBinding.mapPathView.isVisible = true
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -535,44 +576,48 @@ class EditModInfoActivity : BaseActivity<ActivityEditModInfoBinding>() {
|
||||||
* @param hide 隐藏视图
|
* @param hide 隐藏视图
|
||||||
*/
|
*/
|
||||||
@SuppressLint("StringFormatMatches")
|
@SuppressLint("StringFormatMatches")
|
||||||
fun showMapConfigurationView(hide: Boolean) {
|
fun showMapConfigurationView(hide: Boolean, func: (() -> Unit)? = null) {
|
||||||
if (hide) {
|
if (hide) {
|
||||||
viewBinding.expandMapList.setImageResource(R.drawable.animator_expand_off)
|
doRotateAnimation(viewBinding.expandMapList, 180f, 360f) {
|
||||||
mExpandMapList = false
|
if (it) {
|
||||||
viewBinding.mapOperation.isVisible = false
|
mExpandMapList = false
|
||||||
viewBinding.mapPathView.isVisible = false
|
viewBinding.mapOperation.isVisible = false
|
||||||
} else {
|
viewBinding.mapPathView.isVisible = false
|
||||||
viewBinding.expandMapList.setImageResource(R.drawable.animator_expand_on)
|
func?.invoke()
|
||||||
mExpandMapList = true
|
|
||||||
viewBinding.mapOperation.isVisible = true
|
|
||||||
val mapFolder = mapFolder
|
|
||||||
if (!mapFolder.exists()) {
|
|
||||||
mapFolder.mkdirs()
|
|
||||||
}
|
|
||||||
val files = ArrayList<File>()
|
|
||||||
val fileArray = mapFolder.listFiles()
|
|
||||||
if (fileArray.isNotEmpty()) {
|
|
||||||
for (f in fileArray) {
|
|
||||||
if (FileOperator.getFileType(f) == "tmx") {
|
|
||||||
files.add(f)
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
val mapAndMapAdapter = MapAndMusicAdapter(this, files, false)
|
|
||||||
val layoutManager = StableLinearLayoutManager(this@EditModInfoActivity)
|
|
||||||
mapAndMapAdapter.setItemChangeEvent { changeType, i, file, i2 ->
|
|
||||||
viewBinding.mapPathView.text =
|
|
||||||
String.format(getString(R.string.filenum), i2)
|
|
||||||
}
|
|
||||||
viewBinding.mapListView.layoutManager = layoutManager
|
|
||||||
viewBinding.mapListView.adapter = mapAndMapAdapter
|
|
||||||
viewBinding.mapPathView.isVisible = true
|
|
||||||
viewBinding.mapPathView.text = String.format(getString(R.string.filenum), files.size)
|
|
||||||
}
|
|
||||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.N) {
|
|
||||||
(viewBinding.expandMapList.drawable as AnimatedVectorDrawable).start()
|
|
||||||
} else {
|
} else {
|
||||||
(viewBinding.expandMapList.drawable as AnimatedVectorDrawableCompat).start()
|
doRotateAnimation(viewBinding.expandMapList, 0f, 180f) {
|
||||||
|
if (it) {
|
||||||
|
mExpandMapList = true
|
||||||
|
viewBinding.mapOperation.isVisible = true
|
||||||
|
val mapFolder = mapFolder
|
||||||
|
if (!mapFolder.exists()) {
|
||||||
|
mapFolder.mkdirs()
|
||||||
|
}
|
||||||
|
val files = ArrayList<File>()
|
||||||
|
val fileArray = mapFolder.listFiles()
|
||||||
|
if (fileArray.isNotEmpty()) {
|
||||||
|
for (f in fileArray) {
|
||||||
|
if (FileOperator.getFileType(f) == "tmx") {
|
||||||
|
files.add(f)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
val mapAndMapAdapter = MapAndMusicAdapter(this, files, false)
|
||||||
|
val layoutManager = StableLinearLayoutManager(this@EditModInfoActivity)
|
||||||
|
mapAndMapAdapter.setItemChangeEvent { changeType, i, file, i2 ->
|
||||||
|
viewBinding.mapPathView.text =
|
||||||
|
String.format(getString(R.string.filenum), i2)
|
||||||
|
}
|
||||||
|
viewBinding.mapListView.layoutManager = layoutManager
|
||||||
|
viewBinding.mapListView.adapter = mapAndMapAdapter
|
||||||
|
viewBinding.mapPathView.isVisible = true
|
||||||
|
viewBinding.mapPathView.text =
|
||||||
|
String.format(getString(R.string.filenum), files.size)
|
||||||
|
func?.invoke()
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -260,11 +260,16 @@ class MainActivity : BaseActivity<ActivityMainBinding>() {
|
||||||
val codeTable = menu.findItem(R.id.code_table)
|
val codeTable = menu.findItem(R.id.code_table)
|
||||||
val mod = menu.findItem(R.id.mod_item)
|
val mod = menu.findItem(R.id.mod_item)
|
||||||
val community = menu.findItem(R.id.community_item)
|
val community = menu.findItem(R.id.community_item)
|
||||||
val group = menu.findItem(R.id.user_group)
|
// val group = menu.findItem(R.id.user_group)
|
||||||
group.setOnMenuItemClickListener {
|
// group.setOnMenuItemClickListener {
|
||||||
viewBinding.drawerlayout.closeDrawer((GravityCompat.START))
|
// viewBinding.drawerlayout.closeDrawer((GravityCompat.START))
|
||||||
val userGroupFragment = UserGroupFragment()
|
// val userGroupFragment = UserGroupFragment()
|
||||||
userGroupFragment.show(supportFragmentManager, "userGroup")
|
// userGroupFragment.show(supportFragmentManager, "userGroup")
|
||||||
|
// false
|
||||||
|
// }
|
||||||
|
val gitHub = menu.findItem(R.id.github)
|
||||||
|
gitHub.setOnMenuItemClickListener {
|
||||||
|
AppOperator.useBrowserAccessWebPage(this,"https://github.com/Cold-Mint/RustAssistant")
|
||||||
false
|
false
|
||||||
}
|
}
|
||||||
// val help = menu.findItem(R.id.help)
|
// val help = menu.findItem(R.id.help)
|
||||||
|
|
|
@ -77,11 +77,11 @@ class SettingsActivity : BaseActivity<ActivitySettingsBinding>() {
|
||||||
true
|
true
|
||||||
}
|
}
|
||||||
|
|
||||||
val obtainSourceCode = manager.findPreference<PreferenceScreen>(requireContext().getString(R.string.setting_obtain_source_code))
|
// val obtainSourceCode = manager.findPreference<PreferenceScreen>(requireContext().getString(R.string.setting_obtain_source_code))
|
||||||
obtainSourceCode!!.onPreferenceClickListener = Preference.OnPreferenceClickListener {
|
// obtainSourceCode!!.onPreferenceClickListener = Preference.OnPreferenceClickListener {
|
||||||
AppOperator.useBrowserAccessWebPage(requireContext(),"https://github.com/Cold-Mint/RustAssistant")
|
// AppOperator.useBrowserAccessWebPage(requireContext(),"https://github.com/Cold-Mint/RustAssistant")
|
||||||
true
|
// true
|
||||||
}
|
// }
|
||||||
|
|
||||||
val game = manager.findPreference<PreferenceScreen>("set_game_pack")
|
val game = manager.findPreference<PreferenceScreen>("set_game_pack")
|
||||||
game!!.onPreferenceClickListener = Preference.OnPreferenceClickListener {
|
game!!.onPreferenceClickListener = Preference.OnPreferenceClickListener {
|
||||||
|
|
|
@ -56,6 +56,9 @@ class CommentAdapter(context: Context, dataList: MutableList<WebModCommentData.D
|
||||||
} else {
|
} else {
|
||||||
data.time + " " + data.location
|
data.time + " " + data.location
|
||||||
}
|
}
|
||||||
|
viewBinding.thumbUpImageView.setOnClickListener {
|
||||||
|
Snackbar.make(viewBinding.thumbUpImageView,R.string.temporarily_unavailable,Snackbar.LENGTH_SHORT).show()
|
||||||
|
}
|
||||||
viewBinding.shareImageView.setOnClickListener {
|
viewBinding.shareImageView.setOnClickListener {
|
||||||
AppOperator.shareText(context, context.getString(R.string.share_message), data.content);
|
AppOperator.shareText(context, context.getString(R.string.share_message), data.content);
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,9 +1,12 @@
|
||||||
package com.coldmint.rust.pro.adapters
|
package com.coldmint.rust.pro.adapters
|
||||||
|
|
||||||
import android.content.Context
|
import android.content.Context
|
||||||
|
import android.util.Log
|
||||||
import android.view.LayoutInflater
|
import android.view.LayoutInflater
|
||||||
import android.view.ViewGroup
|
import android.view.ViewGroup
|
||||||
import com.coldmint.rust.core.DataSet
|
import com.coldmint.rust.core.DataSet
|
||||||
|
import com.coldmint.rust.core.tool.AppOperator
|
||||||
|
import com.coldmint.rust.pro.R
|
||||||
import com.coldmint.rust.pro.base.BaseAdapter
|
import com.coldmint.rust.pro.base.BaseAdapter
|
||||||
import com.coldmint.rust.pro.databinding.DatabaseItemBinding
|
import com.coldmint.rust.pro.databinding.DatabaseItemBinding
|
||||||
|
|
||||||
|
@ -26,10 +29,27 @@ class DataSetAdapter(context: Context, dataList: MutableList<DataSet>) :
|
||||||
) {
|
) {
|
||||||
val dataBaseManifest = data.getDataBaseManifest()
|
val dataBaseManifest = data.getDataBaseManifest()
|
||||||
viewBinding.databaseNameView.text = data.getDataSetName()
|
viewBinding.databaseNameView.text = data.getDataSetName()
|
||||||
if (dataBaseManifest != null) {
|
val appVersion = AppOperator.getAppVersionNum(context)
|
||||||
viewBinding.databaseIntroduce.text = dataBaseManifest.describe
|
if (dataBaseManifest == null) {
|
||||||
viewBinding.databaseOther.text =
|
viewBinding.databaseIntroduce.text = context.getString(R.string.dataset_not_exist)
|
||||||
dataBaseManifest.author + "|" + dataBaseManifest.versionName
|
viewBinding.databaseOther.text = ""
|
||||||
|
viewBinding.databaseUse.isEnabled = false
|
||||||
|
} else {
|
||||||
|
Log.d(
|
||||||
|
"DataSetAdapter",
|
||||||
|
"appVersion: ${appVersion} name: ${data.getDataSetName()} minVersion: ${dataBaseManifest.minAppVersion}"
|
||||||
|
)
|
||||||
|
if (dataBaseManifest.minAppVersion <= appVersion) {
|
||||||
|
viewBinding.databaseIntroduce.text = dataBaseManifest.describe
|
||||||
|
viewBinding.databaseOther.text =
|
||||||
|
dataBaseManifest.author + "|" + dataBaseManifest.versionName
|
||||||
|
viewBinding.databaseUse.isEnabled = true
|
||||||
|
} else {
|
||||||
|
viewBinding.databaseUse.isEnabled = false
|
||||||
|
viewBinding.databaseIntroduce.text =
|
||||||
|
context.getString(R.string.dataset_minversion_low)
|
||||||
|
viewBinding.databaseOther.text = ""
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -66,6 +66,9 @@ class DynamicAdapter(context: Context, dataList: MutableList<DynamicItemDataBean
|
||||||
viewBinding.shareImageView.setOnClickListener {
|
viewBinding.shareImageView.setOnClickListener {
|
||||||
AppOperator.shareText(context, context.getString(R.string.share_message), data.content);
|
AppOperator.shareText(context, context.getString(R.string.share_message), data.content);
|
||||||
}
|
}
|
||||||
|
viewBinding.thumbUpImageView.setOnClickListener {
|
||||||
|
Snackbar.make(viewBinding.thumbUpImageView,R.string.temporarily_unavailable,Snackbar.LENGTH_SHORT).show()
|
||||||
|
}
|
||||||
viewBinding.moreImageView.setOnClickListener { view ->
|
viewBinding.moreImageView.setOnClickListener { view ->
|
||||||
val menu = GlobalMethod.createPopMenu(view)
|
val menu = GlobalMethod.createPopMenu(view)
|
||||||
menu.menu.add(R.string.copy)
|
menu.menu.add(R.string.copy)
|
||||||
|
|
|
@ -109,6 +109,21 @@ class ModCommentsFragment(val modId: String) : BaseFragment<FragmentModCommentsB
|
||||||
loadCommentList(modId)
|
loadCommentList(modId)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
fun commentSizeChange(size: Int){
|
||||||
|
if (size == 0){
|
||||||
|
viewBinding.titleView.text = getString(R.string.discussion)
|
||||||
|
viewBinding.recyclerView.isVisible = false
|
||||||
|
viewBinding.noContentLayout.isVisible = true
|
||||||
|
}else{
|
||||||
|
viewBinding.titleView.text =
|
||||||
|
getString(R.string.discussion) + "(" + size + ")"
|
||||||
|
|
||||||
|
viewBinding.recyclerView.isVisible = true
|
||||||
|
viewBinding.noContentLayout.isVisible = false
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 加载评论列表
|
* 加载评论列表
|
||||||
* @param modId String
|
* @param modId String
|
||||||
|
@ -116,7 +131,7 @@ class ModCommentsFragment(val modId: String) : BaseFragment<FragmentModCommentsB
|
||||||
fun loadCommentList(modId: String, useLinearProgressIndicator: Boolean = true) {
|
fun loadCommentList(modId: String, useLinearProgressIndicator: Boolean = true) {
|
||||||
val key = "加载评论列表"
|
val key = "加载评论列表"
|
||||||
if (useLinearProgressIndicator) {
|
if (useLinearProgressIndicator) {
|
||||||
viewBinding.linearProgressIndicator.isVisible = true
|
viewBinding.linearProgressIndicator.visibility = View.VISIBLE
|
||||||
}
|
}
|
||||||
WebMod.instance.getCommentsList(modId, object : ApiCallBack<WebModCommentData> {
|
WebMod.instance.getCommentsList(modId, object : ApiCallBack<WebModCommentData> {
|
||||||
override fun onResponse(t: WebModCommentData) {
|
override fun onResponse(t: WebModCommentData) {
|
||||||
|
@ -124,34 +139,34 @@ class ModCommentsFragment(val modId: String) : BaseFragment<FragmentModCommentsB
|
||||||
if (list.isNullOrEmpty()) {
|
if (list.isNullOrEmpty()) {
|
||||||
DebugHelper.printLog(key, "为空", isError = true)
|
DebugHelper.printLog(key, "为空", isError = true)
|
||||||
if (useLinearProgressIndicator) {
|
if (useLinearProgressIndicator) {
|
||||||
viewBinding.linearProgressIndicator.isVisible = false
|
viewBinding.linearProgressIndicator.visibility = View.INVISIBLE
|
||||||
}
|
}
|
||||||
viewBinding.titleView.text = getString(R.string.discussion)
|
commentSizeChange(0)
|
||||||
viewBinding.recyclerView.isVisible = false
|
|
||||||
viewBinding.noContentLayout.isVisible = true
|
|
||||||
} else {
|
} else {
|
||||||
DebugHelper.printLog(key, "共${list.size}条数据")
|
DebugHelper.printLog(key, "共${list.size}条数据")
|
||||||
viewBinding.titleView.text =
|
commentSizeChange(list.size)
|
||||||
getString(R.string.discussion) + "(" + list.size + ")"
|
|
||||||
if (useLinearProgressIndicator) {
|
if (useLinearProgressIndicator) {
|
||||||
viewBinding.linearProgressIndicator.isVisible = false
|
viewBinding.linearProgressIndicator.visibility = View.INVISIBLE
|
||||||
}
|
}
|
||||||
viewBinding.recyclerView.isVisible = true
|
|
||||||
viewBinding.noContentLayout.isVisible = false
|
|
||||||
val adapter = CommentAdapter(requireContext(), list)
|
val adapter = CommentAdapter(requireContext(), list)
|
||||||
adapter.setItemEvent { i, itemCommentBinding, viewHolder, data ->
|
adapter.setItemEvent { i, itemCommentBinding, viewHolder, data ->
|
||||||
itemCommentBinding.iconView.setOnClickListener {
|
itemCommentBinding.iconView.setOnClickListener {
|
||||||
gotoUserPage(data.account)
|
gotoUserPage(data.account)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
viewBinding.recyclerView.adapter = adapter
|
adapter.setItemChangeEvent { changeType, i, data, i2 ->
|
||||||
|
viewBinding.titleView.text =
|
||||||
|
getString(R.string.discussion) + "(" + i2 + ")"
|
||||||
|
commentSizeChange(i2)
|
||||||
|
}
|
||||||
|
viewBinding.recyclerView.adapter = adapter
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun onFailure(e: Exception) {
|
override fun onFailure(e: Exception) {
|
||||||
DebugHelper.printLog(key, "加载失败", isError = true)
|
DebugHelper.printLog(key, "加载失败", isError = true)
|
||||||
if (useLinearProgressIndicator) {
|
if (useLinearProgressIndicator) {
|
||||||
viewBinding.linearProgressIndicator.isVisible = false
|
viewBinding.linearProgressIndicator.visibility = View.INVISIBLE
|
||||||
}
|
}
|
||||||
viewBinding.titleView.text = getString(R.string.discussion)
|
viewBinding.titleView.text = getString(R.string.discussion)
|
||||||
viewBinding.recyclerView.isVisible = false
|
viewBinding.recyclerView.isVisible = false
|
||||||
|
|
|
@ -347,15 +347,9 @@ class StartViewModel(application: Application) : BaseAndroidViewModel(applicatio
|
||||||
*/
|
*/
|
||||||
private fun initRes() {
|
private fun initRes() {
|
||||||
try {
|
try {
|
||||||
val language = Locale.getDefault().language
|
// val language = Locale.getDefault().language
|
||||||
DebugHelper.printLog("初始化资源", "语言" + language)
|
// DebugHelper.printLog("初始化资源", "语言" + language)
|
||||||
if (language == "zh") {
|
unzipDataSet("dataBase_v2.2.0.rdb", true)
|
||||||
unzipDataSet("dataBase.rdb", true)
|
|
||||||
unzipDataSet("dataBase_en.rdb")
|
|
||||||
} else {
|
|
||||||
unzipDataSet("dataBase.rdb")
|
|
||||||
unzipDataSet("dataBase_en.rdb", true)
|
|
||||||
}
|
|
||||||
|
|
||||||
val defaultValues = File(context.filesDir.absolutePath + "/values.json")
|
val defaultValues = File(context.filesDir.absolutePath + "/values.json")
|
||||||
if (!defaultValues.exists()) {
|
if (!defaultValues.exists()) {
|
||||||
|
@ -368,7 +362,7 @@ class StartViewModel(application: Application) : BaseAndroidViewModel(applicatio
|
||||||
} catch (e: Exception) {
|
} catch (e: Exception) {
|
||||||
e.printStackTrace()
|
e.printStackTrace()
|
||||||
}
|
}
|
||||||
importingTemplatePackage("baseTemplate.rp")
|
importingTemplatePackage("baseTemplate_v2.0.rp")
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -51,9 +51,9 @@
|
||||||
|
|
||||||
<!--模组图标-->
|
<!--模组图标-->
|
||||||
<LinearLayout
|
<LinearLayout
|
||||||
android:layout_marginTop="8dp"
|
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="match_parent"
|
android:layout_height="match_parent"
|
||||||
|
android:layout_marginTop="8dp"
|
||||||
android:gravity="center_vertical">
|
android:gravity="center_vertical">
|
||||||
|
|
||||||
<TextView
|
<TextView
|
||||||
|
@ -65,20 +65,19 @@
|
||||||
<com.google.android.material.card.MaterialCardView
|
<com.google.android.material.card.MaterialCardView
|
||||||
style="@style/Widget.Material3.CardView.Filled"
|
style="@style/Widget.Material3.CardView.Filled"
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
android:layout_marginLeft="8dp"
|
android:layout_height="wrap_content"
|
||||||
android:layout_height="wrap_content">
|
android:layout_marginLeft="8dp">
|
||||||
|
|
||||||
<ImageView
|
<ImageView
|
||||||
android:scaleType="centerCrop"
|
|
||||||
android:id="@+id/iconView"
|
android:id="@+id/iconView"
|
||||||
android:layout_width="72dp"
|
android:layout_width="72dp"
|
||||||
android:layout_height="72dp"
|
android:layout_height="72dp"
|
||||||
|
android:scaleType="centerCrop"
|
||||||
android:src="@drawable/image" />
|
android:src="@drawable/image" />
|
||||||
|
|
||||||
</com.google.android.material.card.MaterialCardView>
|
</com.google.android.material.card.MaterialCardView>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
</LinearLayout>
|
</LinearLayout>
|
||||||
|
|
||||||
<com.google.android.material.textfield.TextInputLayout
|
<com.google.android.material.textfield.TextInputLayout
|
||||||
|
@ -174,12 +173,14 @@
|
||||||
android:text="@string/add" />
|
android:text="@string/add" />
|
||||||
|
|
||||||
<ImageView
|
<ImageView
|
||||||
|
android:visibility="gone"
|
||||||
android:id="@+id/expandMusicList"
|
android:id="@+id/expandMusicList"
|
||||||
android:layout_width="32dp"
|
android:layout_width="24dp"
|
||||||
android:layout_height="32dp"
|
android:layout_height="24dp"
|
||||||
android:layout_below="@id/musicPathView"
|
android:layout_alignTop="@id/addMusic"
|
||||||
android:layout_alignBottom="@id/enabledMusic"
|
android:layout_alignBottom="@id/enabledMusic"
|
||||||
android:layout_alignParentEnd="true"
|
android:layout_alignParentEnd="true"
|
||||||
|
android:padding="2dp"
|
||||||
android:src="@drawable/expand_icon"
|
android:src="@drawable/expand_icon"
|
||||||
app:tint="?android:colorControlNormal" />
|
app:tint="?android:colorControlNormal" />
|
||||||
|
|
||||||
|
@ -260,12 +261,14 @@
|
||||||
android:text="@string/add" />
|
android:text="@string/add" />
|
||||||
|
|
||||||
<ImageView
|
<ImageView
|
||||||
|
android:visibility="gone"
|
||||||
android:id="@+id/expandMapList"
|
android:id="@+id/expandMapList"
|
||||||
android:layout_width="32dp"
|
android:layout_width="24dp"
|
||||||
android:layout_height="32dp"
|
android:layout_height="24dp"
|
||||||
android:layout_below="@id/mapPathView"
|
android:layout_alignTop="@id/addMap"
|
||||||
android:layout_alignBottom="@id/enabledMap"
|
android:layout_alignBottom="@id/enabledMap"
|
||||||
android:layout_alignParentEnd="true"
|
android:layout_alignParentEnd="true"
|
||||||
|
android:padding="2dp"
|
||||||
android:src="@drawable/expand_icon"
|
android:src="@drawable/expand_icon"
|
||||||
app:tint="?android:colorControlNormal" />
|
app:tint="?android:colorControlNormal" />
|
||||||
|
|
||||||
|
|
|
@ -33,12 +33,12 @@
|
||||||
style="@style/TextAppearance.Material3.BodySmall"/>
|
style="@style/TextAppearance.Material3.BodySmall"/>
|
||||||
|
|
||||||
<Button
|
<Button
|
||||||
style="@style/Widget.Material3.Button.OutlinedButton"
|
|
||||||
android:id="@+id/database_use"
|
android:id="@+id/database_use"
|
||||||
android:layout_alignParentEnd="true"
|
style="@style/Widget.Material3.Button.OutlinedButton"
|
||||||
android:layout_centerInParent="true"
|
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:text="使用"/>
|
android:layout_alignParentEnd="true"
|
||||||
|
android:layout_centerInParent="true"
|
||||||
|
android:text="使用" />
|
||||||
|
|
||||||
</RelativeLayout>
|
</RelativeLayout>
|
|
@ -41,7 +41,7 @@
|
||||||
android:id="@+id/linearProgressIndicator"
|
android:id="@+id/linearProgressIndicator"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_marginTop="8dp"
|
android:layout_marginTop="8dp"
|
||||||
android:visibility="gone"
|
android:visibility="invisible"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:indeterminate="true" />
|
android:indeterminate="true" />
|
||||||
|
|
||||||
|
|
|
@ -55,10 +55,15 @@
|
||||||
android:title="@string/set_up" />
|
android:title="@string/set_up" />
|
||||||
|
|
||||||
|
|
||||||
|
<!-- <item-->
|
||||||
|
<!-- android:id="@+id/user_group"-->
|
||||||
|
<!-- android:icon="@drawable/ic_outline_free_breakfast_24"-->
|
||||||
|
<!-- android:title="@string/user_group" />-->
|
||||||
<item
|
<item
|
||||||
android:id="@+id/user_group"
|
android:id="@+id/github"
|
||||||
android:icon="@drawable/ic_outline_free_breakfast_24"
|
android:icon="@drawable/github"
|
||||||
android:title="@string/user_group" />
|
android:title="@string/github" />
|
||||||
|
|
||||||
<item
|
<item
|
||||||
android:id="@+id/rust_api"
|
android:id="@+id/rust_api"
|
||||||
android:icon="@drawable/outline_book_24"
|
android:icon="@drawable/outline_book_24"
|
||||||
|
|
|
@ -420,6 +420,7 @@
|
||||||
<string name="unable_cut">无法剪切此文件夹,该文件夹内有文件正在使用。</string>
|
<string name="unable_cut">无法剪切此文件夹,该文件夹内有文件正在使用。</string>
|
||||||
<string name="unable_del">无法删除此文件夹,该文件夹内有文件正在使用。</string>
|
<string name="unable_del">无法删除此文件夹,该文件夹内有文件正在使用。</string>
|
||||||
<string name="recovery_prompt">已将\"%1$s\"移动至回收站。</string>
|
<string name="recovery_prompt">已将\"%1$s\"移动至回收站。</string>
|
||||||
|
<string name="temporarily_unavailable">暂不可用,请等待下个版本!</string>
|
||||||
<string name="recoverying_prompt">正在移动\"%1$s\"...</string>
|
<string name="recoverying_prompt">正在移动\"%1$s\"...</string>
|
||||||
<string name="open_directory_of_file">打开文件所在目录</string>
|
<string name="open_directory_of_file">打开文件所在目录</string>
|
||||||
<string name="unable_to_detect">您的模组可能无法被游戏检查。</string>
|
<string name="unable_to_detect">您的模组可能无法被游戏检查。</string>
|
||||||
|
@ -962,4 +963,7 @@
|
||||||
<string name="private_mod">私有</string>
|
<string name="private_mod">私有</string>
|
||||||
<string name="minVersion">最低游戏版本</string>
|
<string name="minVersion">最低游戏版本</string>
|
||||||
<string name="thumbs_up">点赞</string>
|
<string name="thumbs_up">点赞</string>
|
||||||
|
<string name="github">GitHub</string>
|
||||||
|
<string name="dataset_not_exist">DataBaseManifest.json不存在,无法加载信息。</string>
|
||||||
|
<string name="dataset_minversion_low">此数据集仅适用于旧版本助手。</string>
|
||||||
</resources>
|
</resources>
|
|
@ -266,10 +266,10 @@
|
||||||
app:key="developerModeGroup"
|
app:key="developerModeGroup"
|
||||||
app:title="@string/sync_header">
|
app:title="@string/sync_header">
|
||||||
|
|
||||||
<PreferenceScreen
|
<!-- <PreferenceScreen-->
|
||||||
app:key="@string/setting_obtain_source_code"
|
<!-- app:key="@string/setting_obtain_source_code"-->
|
||||||
android:summary="@string/obtain_source_code_msg"
|
<!-- android:summary="@string/obtain_source_code_msg"-->
|
||||||
app:title="@string/obtain_source_code"/>
|
<!-- app:title="@string/obtain_source_code"/>-->
|
||||||
|
|
||||||
<PreferenceScreen
|
<PreferenceScreen
|
||||||
app:key="@string/setting_see_error_info"
|
app:key="@string/setting_see_error_info"
|
||||||
|
|
|
@ -18,7 +18,9 @@ data class DataBaseManifest(
|
||||||
@SerializedName("versionName")
|
@SerializedName("versionName")
|
||||||
val versionName: String,
|
val versionName: String,
|
||||||
@SerializedName("versionNumber")
|
@SerializedName("versionNumber")
|
||||||
val versionNumber: Int
|
val versionNumber: Int,
|
||||||
|
@SerializedName("minAppVersion")
|
||||||
|
val minAppVersion:Int = Int.MAX_VALUE
|
||||||
) {
|
) {
|
||||||
data class Tables(
|
data class Tables(
|
||||||
@SerializedName("chain_inspection")
|
@SerializedName("chain_inspection")
|
||||||
|
|
Loading…
Reference in New Issue
Block a user