增加minVersion的上传与获取。
This commit is contained in:
parent
a1a8341d93
commit
dd8b2117f3
|
@ -108,6 +108,11 @@ class CreateModActivity : BaseActivity<ActivityCreateModBinding>() {
|
||||||
stringBuilder.append(name)
|
stringBuilder.append(name)
|
||||||
stringBuilder.append("\ndescription: ")
|
stringBuilder.append("\ndescription: ")
|
||||||
stringBuilder.append(describe)
|
stringBuilder.append(describe)
|
||||||
|
val minVersion:String = viewBinding.minVersionEdit.text.toString()
|
||||||
|
if (minVersion.isNotBlank()){
|
||||||
|
stringBuilder.append("\nminVersion: ")
|
||||||
|
stringBuilder.append(minVersion)
|
||||||
|
}
|
||||||
val mod_directory =
|
val mod_directory =
|
||||||
File(Environment.getExternalStorageDirectory().absolutePath + "/rustedWarfare/units/" + name)
|
File(Environment.getExternalStorageDirectory().absolutePath + "/rustedWarfare/units/" + name)
|
||||||
if (mod_directory.exists()) {
|
if (mod_directory.exists()) {
|
||||||
|
|
|
@ -119,6 +119,10 @@ class EditModInfoActivity : BaseActivity<ActivityEditModInfoBinding>() {
|
||||||
if (description != null) {
|
if (description != null) {
|
||||||
viewBinding.modDescribeEdit.setText(description)
|
viewBinding.modDescribeEdit.setText(description)
|
||||||
}
|
}
|
||||||
|
val minVersion = mModClass.readValueFromInfoSection("minVersion", "mod")
|
||||||
|
if (minVersion!= null) {
|
||||||
|
viewBinding.minVersionEdit.setText(minVersion)
|
||||||
|
}
|
||||||
val modIcon = mModClass.modIcon
|
val modIcon = mModClass.modIcon
|
||||||
if (modIcon == null) {
|
if (modIcon == null) {
|
||||||
loadDefaultImage()
|
loadDefaultImage()
|
||||||
|
@ -216,6 +220,11 @@ class EditModInfoActivity : BaseActivity<ActivityEditModInfoBinding>() {
|
||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
resultBuilder.append(description)
|
resultBuilder.append(description)
|
||||||
|
val minVersion = viewBinding.minVersionEdit.text.toString()
|
||||||
|
if (minVersion.isNotBlank()) {
|
||||||
|
resultBuilder.append("\nminVersion:")
|
||||||
|
resultBuilder.append(minVersion)
|
||||||
|
}
|
||||||
if (mNeedIcon) {
|
if (mNeedIcon) {
|
||||||
var iconName = mModClass.readValueFromInfoSection("thumbnail", "mod")
|
var iconName = mModClass.readValueFromInfoSection("thumbnail", "mod")
|
||||||
if (iconName == null) {
|
if (iconName == null) {
|
||||||
|
|
|
@ -220,6 +220,7 @@ class ReleaseModActivity : BaseActivity<ActivityReleaseModBinding>() {
|
||||||
viewBinding.modUpdateInputLayout.isVisible = true
|
viewBinding.modUpdateInputLayout.isVisible = true
|
||||||
viewBinding.versionNameEdit.setText(t.data.versionName)
|
viewBinding.versionNameEdit.setText(t.data.versionName)
|
||||||
viewBinding.modDescribeEdit.setText(t.data.describe)
|
viewBinding.modDescribeEdit.setText(t.data.describe)
|
||||||
|
viewBinding.minVersionEdit.setText(t.data.minVersion)
|
||||||
val outputTags: StringBuilder = StringBuilder()
|
val outputTags: StringBuilder = StringBuilder()
|
||||||
lineParser.text = t.data.tags
|
lineParser.text = t.data.tags
|
||||||
lineParser.parserSymbol = true
|
lineParser.parserSymbol = true
|
||||||
|
@ -724,6 +725,7 @@ class ReleaseModActivity : BaseActivity<ActivityReleaseModBinding>() {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
val minVersion: String = viewBinding.minVersionEdit.text.toString()
|
||||||
val tagsBuilder = StringBuilder()
|
val tagsBuilder = StringBuilder()
|
||||||
val lineParser = LineParser(tags)
|
val lineParser = LineParser(tags)
|
||||||
lineParser.symbol = ","
|
lineParser.symbol = ","
|
||||||
|
@ -783,7 +785,7 @@ class ReleaseModActivity : BaseActivity<ActivityReleaseModBinding>() {
|
||||||
} else {
|
} else {
|
||||||
releaseModWork(
|
releaseModWork(
|
||||||
modId, modName, modDescribe, versionName,
|
modId, modName, modDescribe, versionName,
|
||||||
tagsBuilder, file
|
minVersion, tagsBuilder, file
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
@ -804,7 +806,7 @@ class ReleaseModActivity : BaseActivity<ActivityReleaseModBinding>() {
|
||||||
} else {
|
} else {
|
||||||
releaseModWork(
|
releaseModWork(
|
||||||
modId, modName, modDescribe, versionName,
|
modId, modName, modDescribe, versionName,
|
||||||
tagsBuilder, file
|
minVersion, tagsBuilder, file
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
}.setNegativeButton(R.string.always_allow) {
|
}.setNegativeButton(R.string.always_allow) {
|
||||||
|
@ -823,7 +825,7 @@ class ReleaseModActivity : BaseActivity<ActivityReleaseModBinding>() {
|
||||||
} else {
|
} else {
|
||||||
releaseModWork(
|
releaseModWork(
|
||||||
modId, modName, modDescribe, versionName,
|
modId, modName, modDescribe, versionName,
|
||||||
tagsBuilder, file
|
minVersion, tagsBuilder, file
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
}.setNeutralButton(R.string.dialog_cancel) {
|
}.setNeutralButton(R.string.dialog_cancel) {
|
||||||
|
@ -846,7 +848,7 @@ class ReleaseModActivity : BaseActivity<ActivityReleaseModBinding>() {
|
||||||
} else {
|
} else {
|
||||||
releaseModWork(
|
releaseModWork(
|
||||||
modId, modName, modDescribe, versionName,
|
modId, modName, modDescribe, versionName,
|
||||||
tagsBuilder, file
|
minVersion, tagsBuilder, file
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -868,6 +870,7 @@ class ReleaseModActivity : BaseActivity<ActivityReleaseModBinding>() {
|
||||||
modName: String,
|
modName: String,
|
||||||
modDescribe: String,
|
modDescribe: String,
|
||||||
versionName: String,
|
versionName: String,
|
||||||
|
minVersion: String?,
|
||||||
tagsBuilder: StringBuilder, file: File
|
tagsBuilder: StringBuilder, file: File
|
||||||
) {
|
) {
|
||||||
val loadFileLayoutBinding = LoadFileLayoutBinding.inflate(layoutInflater)
|
val loadFileLayoutBinding = LoadFileLayoutBinding.inflate(layoutInflater)
|
||||||
|
@ -881,7 +884,7 @@ class ReleaseModActivity : BaseActivity<ActivityReleaseModBinding>() {
|
||||||
modName,
|
modName,
|
||||||
modDescribe,
|
modDescribe,
|
||||||
tagsBuilder.toString(),
|
tagsBuilder.toString(),
|
||||||
unitnum,
|
unitnum, minVersion = minVersion,
|
||||||
iconLink = iconLink, file = file, screenshotList = list, versionName = versionName,
|
iconLink = iconLink, file = file, screenshotList = list, versionName = versionName,
|
||||||
apiCallBack = object : ApiCallBack<ApiResponse> {
|
apiCallBack = object : ApiCallBack<ApiResponse> {
|
||||||
override fun onResponse(t: ApiResponse) {
|
override fun onResponse(t: ApiResponse) {
|
||||||
|
|
|
@ -1,6 +1,7 @@
|
||||||
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 androidx.recyclerview.widget.RecyclerView
|
import androidx.recyclerview.widget.RecyclerView
|
||||||
|
@ -45,7 +46,10 @@ class CommentAdapter(context: Context, dataList: MutableList<WebModCommentData.D
|
||||||
position: Int
|
position: Int
|
||||||
) {
|
) {
|
||||||
val icon = data.headIcon
|
val icon = data.headIcon
|
||||||
if (icon != null) {
|
Log.d("CommentAdapter", "图标路径" + icon)
|
||||||
|
if (icon == null || icon.isBlank()) {
|
||||||
|
viewBinding.iconView.setImageResource(R.drawable.head_icon)
|
||||||
|
} else {
|
||||||
Glide.with(context).load(ServerConfiguration.getRealLink(icon))
|
Glide.with(context).load(ServerConfiguration.getRealLink(icon))
|
||||||
.apply(GlobalMethod.getRequestOptions(true))
|
.apply(GlobalMethod.getRequestOptions(true))
|
||||||
.into(viewBinding.iconView)
|
.into(viewBinding.iconView)
|
||||||
|
@ -57,7 +61,11 @@ class CommentAdapter(context: Context, dataList: MutableList<WebModCommentData.D
|
||||||
data.time + " " + data.location
|
data.time + " " + data.location
|
||||||
}
|
}
|
||||||
viewBinding.thumbUpImageView.setOnClickListener {
|
viewBinding.thumbUpImageView.setOnClickListener {
|
||||||
Snackbar.make(viewBinding.thumbUpImageView,R.string.temporarily_unavailable,Snackbar.LENGTH_SHORT).show()
|
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);
|
||||||
|
@ -78,7 +86,7 @@ class CommentAdapter(context: Context, dataList: MutableList<WebModCommentData.D
|
||||||
context.getString(R.string.delete_comment_tip),
|
context.getString(R.string.delete_comment_tip),
|
||||||
data.userName
|
data.userName
|
||||||
)
|
)
|
||||||
).setPositiveButton(R.string.dialog_ok){
|
).setPositiveButton(R.string.dialog_ok) {
|
||||||
val token = AppSettings.getValue(AppSettings.Setting.Token, "")
|
val token = AppSettings.getValue(AppSettings.Setting.Token, "")
|
||||||
if (token.isNullOrBlank()) {
|
if (token.isNullOrBlank()) {
|
||||||
Snackbar.make(
|
Snackbar.make(
|
||||||
|
@ -117,7 +125,7 @@ class CommentAdapter(context: Context, dataList: MutableList<WebModCommentData.D
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
}.setNegativeButton(R.string.dialog_cancel){
|
}.setNegativeButton(R.string.dialog_cancel) {
|
||||||
|
|
||||||
}.show()
|
}.show()
|
||||||
}
|
}
|
||||||
|
|
|
@ -25,6 +25,7 @@ import android.view.View
|
||||||
import android.view.inputmethod.InputMethodManager
|
import android.view.inputmethod.InputMethodManager
|
||||||
import androidx.appcompat.app.AlertDialog
|
import androidx.appcompat.app.AlertDialog
|
||||||
import androidx.core.content.ContentProviderCompat.requireContext
|
import androidx.core.content.ContentProviderCompat.requireContext
|
||||||
|
import com.coldmint.dialog.CoreDialog
|
||||||
import com.coldmint.dialog.InputDialog
|
import com.coldmint.dialog.InputDialog
|
||||||
import com.coldmint.rust.core.*
|
import com.coldmint.rust.core.*
|
||||||
import com.google.android.material.snackbar.Snackbar
|
import com.google.android.material.snackbar.Snackbar
|
||||||
|
@ -323,23 +324,19 @@ class ModActionAdapter(
|
||||||
if (file.isDirectory) {
|
if (file.isDirectory) {
|
||||||
val needShowTip = AppSettings.getValue(AppSettings.Setting.ShareTip, true)
|
val needShowTip = AppSettings.getValue(AppSettings.Setting.ShareTip, true)
|
||||||
if (needShowTip) {
|
if (needShowTip) {
|
||||||
val materialDialog = MaterialDialog(mContext, MaterialDialog.DEFAULT_BEHAVIOR)
|
val materialDialog = CoreDialog(mContext)
|
||||||
materialDialog.title(R.string.packmod, null)
|
materialDialog.setTitle(R.string.packmod)
|
||||||
materialDialog.message(R.string.share_tip, null, null)
|
materialDialog.setMessage(R.string.share_tip)
|
||||||
materialDialog.positiveButton(
|
materialDialog.setPositiveButton(
|
||||||
R.string.dialog_ok,
|
R.string.dialog_ok
|
||||||
null
|
) {
|
||||||
) { materialDialog: MaterialDialog? ->
|
|
||||||
packShare(file)
|
packShare(file)
|
||||||
null
|
|
||||||
}
|
}
|
||||||
materialDialog.negativeButton(
|
materialDialog.setNegativeButton(
|
||||||
R.string.no_longer_prompt,
|
R.string.no_longer_prompt
|
||||||
null
|
) {
|
||||||
) { materialDialog: MaterialDialog? ->
|
|
||||||
AppSettings.setValue(AppSettings.Setting.ShareTip, false)
|
AppSettings.setValue(AppSettings.Setting.ShareTip, false)
|
||||||
packShare(file)
|
packShare(file)
|
||||||
null
|
|
||||||
}
|
}
|
||||||
materialDialog.show()
|
materialDialog.show()
|
||||||
} else {
|
} else {
|
||||||
|
@ -357,17 +354,16 @@ class ModActionAdapter(
|
||||||
*/
|
*/
|
||||||
private fun packShare(file: File) {
|
private fun packShare(file: File) {
|
||||||
val modClass = ModClass(file)
|
val modClass = ModClass(file)
|
||||||
val materialDialog = MaterialDialog(mContext)
|
val materialDialog = CoreDialog(mContext)
|
||||||
Thread(object : Runnable {
|
Thread(object : Runnable {
|
||||||
override fun run() {
|
override fun run() {
|
||||||
handler.post {
|
handler.post {
|
||||||
materialDialog.title(R.string.packmod).message(
|
materialDialog.setTitle(R.string.packmod).setMessage(
|
||||||
text =
|
|
||||||
String.format(
|
String.format(
|
||||||
mContext.getString(R.string.dialog_packing),
|
mContext.getString(R.string.dialog_packing),
|
||||||
modClass.modName
|
modClass.modName
|
||||||
)
|
)
|
||||||
).cancelable(false).positiveButton(R.string.dialog_close2) {
|
).setCancelable(false).setPositiveButton(R.string.dialog_close2) {
|
||||||
Snackbar.make(
|
Snackbar.make(
|
||||||
mModFragment.requireView(),
|
mModFragment.requireView(),
|
||||||
R.string.dialog_close_tip3,
|
R.string.dialog_close_tip3,
|
||||||
|
@ -385,8 +381,7 @@ class ModActionAdapter(
|
||||||
compressionManager.compression(file, toFile, object : CompressionListener {
|
compressionManager.compression(file, toFile, object : CompressionListener {
|
||||||
override fun whenCompressionFile(file: File): Boolean {
|
override fun whenCompressionFile(file: File): Boolean {
|
||||||
handler.post {
|
handler.post {
|
||||||
materialDialog.message(
|
materialDialog.setMessage(
|
||||||
text =
|
|
||||||
String.format(
|
String.format(
|
||||||
mContext.getString(R.string.dialog_packing),
|
mContext.getString(R.string.dialog_packing),
|
||||||
file.name
|
file.name
|
||||||
|
@ -398,8 +393,7 @@ class ModActionAdapter(
|
||||||
|
|
||||||
override fun whenCompressionFolder(folder: File): Boolean {
|
override fun whenCompressionFolder(folder: File): Boolean {
|
||||||
handler.post {
|
handler.post {
|
||||||
materialDialog.message(
|
materialDialog.setMessage(
|
||||||
text =
|
|
||||||
String.format(
|
String.format(
|
||||||
mContext.getString(R.string.dialog_packing),
|
mContext.getString(R.string.dialog_packing),
|
||||||
folder.name
|
folder.name
|
||||||
|
@ -412,19 +406,20 @@ class ModActionAdapter(
|
||||||
override fun whenCompressionComplete(result: Boolean) {
|
override fun whenCompressionComplete(result: Boolean) {
|
||||||
handler.post {
|
handler.post {
|
||||||
if (result) {
|
if (result) {
|
||||||
materialDialog.title(R.string.share_mod).message(
|
materialDialog.dismiss()
|
||||||
text =
|
CoreDialog(mContext)
|
||||||
String.format(
|
.setTitle(R.string.share_mod).setMessage(
|
||||||
mContext.getString(R.string.pack_success),
|
String.format(
|
||||||
modClass.modName
|
mContext.getString(R.string.pack_success),
|
||||||
)
|
modClass.modName
|
||||||
).clearPositiveListeners().positiveButton(R.string.share_mod) {
|
)
|
||||||
FileOperator.shareFile(
|
).setPositiveButton(R.string.share_mod) {
|
||||||
mContext, toFile
|
FileOperator.shareFile(
|
||||||
)
|
mContext, toFile
|
||||||
}.negativeButton(R.string.dialog_cancel) {
|
)
|
||||||
toFile.delete()
|
}.setNegativeButton(R.string.dialog_cancel) {
|
||||||
}.show()
|
toFile.delete()
|
||||||
|
}.show()
|
||||||
} else {
|
} else {
|
||||||
materialDialog.dismiss()
|
materialDialog.dismiss()
|
||||||
Snackbar.make(
|
Snackbar.make(
|
||||||
|
|
|
@ -13,6 +13,7 @@ import androidx.core.view.isVisible
|
||||||
import androidx.recyclerview.widget.DividerItemDecoration
|
import androidx.recyclerview.widget.DividerItemDecoration
|
||||||
import androidx.recyclerview.widget.LinearLayoutManager
|
import androidx.recyclerview.widget.LinearLayoutManager
|
||||||
import com.afollestad.materialdialogs.MaterialDialog
|
import com.afollestad.materialdialogs.MaterialDialog
|
||||||
|
import com.coldmint.dialog.CoreDialog
|
||||||
import com.coldmint.rust.core.CompressionManager
|
import com.coldmint.rust.core.CompressionManager
|
||||||
import com.coldmint.rust.core.LocalTemplatePackage
|
import com.coldmint.rust.core.LocalTemplatePackage
|
||||||
import com.coldmint.rust.core.interfaces.CompressionListener
|
import com.coldmint.rust.core.interfaces.CompressionListener
|
||||||
|
@ -61,7 +62,7 @@ class TemplateListAdapter(
|
||||||
* @param localTemplatePackage LocalTemplatePackage
|
* @param localTemplatePackage LocalTemplatePackage
|
||||||
*/
|
*/
|
||||||
private fun share(context: Context, localTemplatePackage: LocalTemplatePackage) {
|
private fun share(context: Context, localTemplatePackage: LocalTemplatePackage) {
|
||||||
val materialDialog = MaterialDialog(context)
|
val materialDialog = CoreDialog(context)
|
||||||
val handler = Handler(Looper.getMainLooper())
|
val handler = Handler(Looper.getMainLooper())
|
||||||
Thread {
|
Thread {
|
||||||
val cacheDirectory =
|
val cacheDirectory =
|
||||||
|
@ -77,8 +78,10 @@ class TemplateListAdapter(
|
||||||
toFile.delete()
|
toFile.delete()
|
||||||
}
|
}
|
||||||
handler.post {
|
handler.post {
|
||||||
materialDialog.title(R.string.packmod)
|
materialDialog.setTitle(R.string.packmod)
|
||||||
.positiveButton(R.string.dialog_close2)
|
.setPositiveButton(R.string.dialog_close2){
|
||||||
|
|
||||||
|
}
|
||||||
materialDialog.show()
|
materialDialog.show()
|
||||||
}
|
}
|
||||||
val compressionManager =
|
val compressionManager =
|
||||||
|
@ -94,7 +97,7 @@ class TemplateListAdapter(
|
||||||
file.name
|
file.name
|
||||||
)
|
)
|
||||||
handler.post {
|
handler.post {
|
||||||
materialDialog.message(text = msg)
|
materialDialog.setMessage(msg)
|
||||||
}
|
}
|
||||||
return true
|
return true
|
||||||
}
|
}
|
||||||
|
@ -105,7 +108,7 @@ class TemplateListAdapter(
|
||||||
folder.name
|
folder.name
|
||||||
)
|
)
|
||||||
handler.post {
|
handler.post {
|
||||||
materialDialog.message(text = msg)
|
materialDialog.setMessage(msg)
|
||||||
}
|
}
|
||||||
return true
|
return true
|
||||||
}
|
}
|
||||||
|
@ -114,23 +117,22 @@ class TemplateListAdapter(
|
||||||
handler.post {
|
handler.post {
|
||||||
materialDialog.dismiss()
|
materialDialog.dismiss()
|
||||||
if (result) {
|
if (result) {
|
||||||
MaterialDialog(context).show {
|
CoreDialog(context).setTitle(R.string.share_mod).setMessage(
|
||||||
title(R.string.share_mod).message(
|
String.format(
|
||||||
text = String.format(
|
context.getString(R.string.pack_success),
|
||||||
context.getString(R.string.pack_success),
|
localTemplatePackage.getName()
|
||||||
localTemplatePackage.getName()
|
)
|
||||||
)
|
).setPositiveButton(R.string.share) {
|
||||||
).positiveButton(R.string.share) {
|
FileOperator.shareFile(
|
||||||
FileOperator.shareFile(
|
context,
|
||||||
context,
|
toFile
|
||||||
toFile
|
)
|
||||||
)
|
}.setNegativeButton(R.string.dialog_cancel) {
|
||||||
}.negativeButton(R.string.dialog_cancel)
|
|
||||||
}
|
}.show()
|
||||||
} else {
|
} else {
|
||||||
MaterialDialog(context).show {
|
CoreDialog(context).setTitle(R.string.share_mod).setMessage(R.string.pack_failed).setPositiveButton(R.string.dialog_ok){
|
||||||
title(R.string.share_mod).message(R.string.pack_failed)
|
|
||||||
.positiveButton(R.string.dialog_ok)
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -43,6 +43,8 @@ class WebModAdapter( context: Context, dataList: MutableList<WebModListData.Dat
|
||||||
val path: String = ServerConfiguration.getRealLink(icon)
|
val path: String = ServerConfiguration.getRealLink(icon)
|
||||||
Glide.with(context).load(path).apply(GlobalMethod.getRequestOptions())
|
Glide.with(context).load(path).apply(GlobalMethod.getRequestOptions())
|
||||||
.into(viewBinding.modIcon)
|
.into(viewBinding.modIcon)
|
||||||
|
}else{
|
||||||
|
viewBinding.modIcon.setImageResource(R.drawable.image)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -33,6 +33,7 @@ import com.coldmint.rust.pro.databinding.FragmentAllUnitsBinding
|
||||||
import com.coldmint.rust.pro.tool.AppSettings
|
import com.coldmint.rust.pro.tool.AppSettings
|
||||||
import com.coldmint.rust.pro.ui.StableLinearLayoutManager
|
import com.coldmint.rust.pro.ui.StableLinearLayoutManager
|
||||||
import com.google.android.material.divider.MaterialDividerItemDecoration
|
import com.google.android.material.divider.MaterialDividerItemDecoration
|
||||||
|
import com.google.android.material.snackbar.Snackbar
|
||||||
import me.zhanghai.android.fastscroll.FastScrollerBuilder
|
import me.zhanghai.android.fastscroll.FastScrollerBuilder
|
||||||
import java.io.File
|
import java.io.File
|
||||||
import java.text.SimpleDateFormat
|
import java.text.SimpleDateFormat
|
||||||
|
@ -143,7 +144,11 @@ class AllUnitsFragment(
|
||||||
* 加载列表
|
* 加载列表
|
||||||
* @param file File
|
* @param file File
|
||||||
*/
|
*/
|
||||||
fun loadFiles(file: File = modClass!!.modFile) {
|
fun loadFiles(file: File? = modClass?.modFile) {
|
||||||
|
if (file == null) {
|
||||||
|
Snackbar.make(viewBinding.unitList,R.string.file_not_exist,Snackbar.LENGTH_SHORT).show()
|
||||||
|
return
|
||||||
|
}
|
||||||
val handler = Handler(Looper.getMainLooper())
|
val handler = Handler(Looper.getMainLooper())
|
||||||
executorService.submit {
|
executorService.submit {
|
||||||
handler.post {
|
handler.post {
|
||||||
|
|
|
@ -226,7 +226,11 @@ class WebModDetailsFragment(val modId: String, val modNameLiveData: MutableLiveD
|
||||||
t.data.versionName
|
t.data.versionName
|
||||||
)
|
)
|
||||||
viewBinding.updateTimeView.text =
|
viewBinding.updateTimeView.text =
|
||||||
String.format(getString(R.string.recent_update), t.data.updateTime)
|
String.format(
|
||||||
|
getString(R.string.recent_update),
|
||||||
|
t.data.minVersion,
|
||||||
|
t.data.updateTime
|
||||||
|
)
|
||||||
if (t.data.hidden == 0) {
|
if (t.data.hidden == 0) {
|
||||||
viewBinding.hideTextView.isVisible = false
|
viewBinding.hideTextView.isVisible = false
|
||||||
}
|
}
|
||||||
|
|
|
@ -83,6 +83,8 @@
|
||||||
<com.google.android.material.textfield.MaterialAutoCompleteTextView
|
<com.google.android.material.textfield.MaterialAutoCompleteTextView
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:hint="@string/minVersion"
|
android:hint="@string/minVersion"
|
||||||
|
android:id="@+id/minVersionEdit"
|
||||||
|
app:simpleItems="@array/game_versions"
|
||||||
android:layout_height="wrap_content" />
|
android:layout_height="wrap_content" />
|
||||||
</com.google.android.material.textfield.TextInputLayout>
|
</com.google.android.material.textfield.TextInputLayout>
|
||||||
|
|
||||||
|
|
|
@ -121,6 +121,22 @@
|
||||||
|
|
||||||
</com.google.android.material.textfield.TextInputLayout>
|
</com.google.android.material.textfield.TextInputLayout>
|
||||||
|
|
||||||
|
<com.google.android.material.textfield.TextInputLayout
|
||||||
|
android:id="@+id/minVersionInputLayout"
|
||||||
|
style="@style/Widget.Material3.TextInputLayout.OutlinedBox.ExposedDropdownMenu"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_marginTop="8dp"
|
||||||
|
app:counterEnabled="true"
|
||||||
|
app:counterMaxLength="20">
|
||||||
|
|
||||||
|
<com.google.android.material.textfield.MaterialAutoCompleteTextView
|
||||||
|
android:id="@+id/minVersionEdit"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:hint="@string/minVersion"
|
||||||
|
app:simpleItems="@array/game_versions" />
|
||||||
|
</com.google.android.material.textfield.TextInputLayout>
|
||||||
|
|
||||||
</LinearLayout>
|
</LinearLayout>
|
||||||
|
|
||||||
|
@ -173,7 +189,6 @@
|
||||||
android:text="@string/add" />
|
android:text="@string/add" />
|
||||||
|
|
||||||
<ImageView
|
<ImageView
|
||||||
android:visibility="gone"
|
|
||||||
android:id="@+id/expandMusicList"
|
android:id="@+id/expandMusicList"
|
||||||
android:layout_width="24dp"
|
android:layout_width="24dp"
|
||||||
android:layout_height="24dp"
|
android:layout_height="24dp"
|
||||||
|
@ -182,6 +197,7 @@
|
||||||
android:layout_alignParentEnd="true"
|
android:layout_alignParentEnd="true"
|
||||||
android:padding="2dp"
|
android:padding="2dp"
|
||||||
android:src="@drawable/expand_icon"
|
android:src="@drawable/expand_icon"
|
||||||
|
android:visibility="gone"
|
||||||
app:tint="?android:colorControlNormal" />
|
app:tint="?android:colorControlNormal" />
|
||||||
|
|
||||||
<LinearLayout
|
<LinearLayout
|
||||||
|
@ -261,7 +277,6 @@
|
||||||
android:text="@string/add" />
|
android:text="@string/add" />
|
||||||
|
|
||||||
<ImageView
|
<ImageView
|
||||||
android:visibility="gone"
|
|
||||||
android:id="@+id/expandMapList"
|
android:id="@+id/expandMapList"
|
||||||
android:layout_width="24dp"
|
android:layout_width="24dp"
|
||||||
android:layout_height="24dp"
|
android:layout_height="24dp"
|
||||||
|
@ -270,6 +285,7 @@
|
||||||
android:layout_alignParentEnd="true"
|
android:layout_alignParentEnd="true"
|
||||||
android:padding="2dp"
|
android:padding="2dp"
|
||||||
android:src="@drawable/expand_icon"
|
android:src="@drawable/expand_icon"
|
||||||
|
android:visibility="gone"
|
||||||
app:tint="?android:colorControlNormal" />
|
app:tint="?android:colorControlNormal" />
|
||||||
|
|
||||||
<LinearLayout
|
<LinearLayout
|
||||||
|
|
|
@ -136,6 +136,24 @@
|
||||||
|
|
||||||
</com.google.android.material.textfield.TextInputLayout>
|
</com.google.android.material.textfield.TextInputLayout>
|
||||||
|
|
||||||
|
<com.google.android.material.textfield.TextInputLayout
|
||||||
|
android:id="@+id/minVersionInputLayout"
|
||||||
|
style="@style/Widget.Material3.TextInputLayout.OutlinedBox.ExposedDropdownMenu"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_marginTop="8dp"
|
||||||
|
app:counterEnabled="true"
|
||||||
|
app:counterMaxLength="20"
|
||||||
|
app:helperText="@string/minVersion_tip">
|
||||||
|
|
||||||
|
<com.google.android.material.textfield.MaterialAutoCompleteTextView
|
||||||
|
android:id="@+id/minVersionEdit"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:hint="@string/minVersion"
|
||||||
|
app:simpleItems="@array/game_versions" />
|
||||||
|
</com.google.android.material.textfield.TextInputLayout>
|
||||||
|
|
||||||
|
|
||||||
<com.google.android.material.textfield.TextInputLayout
|
<com.google.android.material.textfield.TextInputLayout
|
||||||
android:id="@+id/modUpdateInputLayout"
|
android:id="@+id/modUpdateInputLayout"
|
||||||
|
|
|
@ -77,22 +77,24 @@
|
||||||
android:layout_alignBottom="@id/nameView"
|
android:layout_alignBottom="@id/nameView"
|
||||||
android:layout_marginLeft="8dp"
|
android:layout_marginLeft="8dp"
|
||||||
android:layout_toEndOf="@id/nameView"
|
android:layout_toEndOf="@id/nameView"
|
||||||
|
style="@style/Widget.Material3.CardView.Filled"
|
||||||
android:visibility="gone"
|
android:visibility="gone"
|
||||||
app:cardBackgroundColor="@color/blue_500"
|
app:cardCornerRadius="4dp"
|
||||||
app:cardCornerRadius="3dp">
|
app:cardBackgroundColor="@color/blue_500">
|
||||||
|
|
||||||
<LinearLayout
|
<LinearLayout
|
||||||
|
android:gravity="center"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="match_parent"
|
android:layout_height="match_parent"
|
||||||
android:padding="1dp">
|
android:padding="4dp">
|
||||||
|
|
||||||
<TextView
|
<TextView
|
||||||
android:id="@+id/positionView"
|
android:id="@+id/positionView"
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:text="@string/path"
|
android:text="@string/path"
|
||||||
android:textColor="@color/white"
|
android:textSize="10sp"
|
||||||
android:textSize="13dp" />
|
android:textColor="@color/white" />
|
||||||
</LinearLayout>
|
</LinearLayout>
|
||||||
|
|
||||||
|
|
||||||
|
@ -108,6 +110,15 @@
|
||||||
android:layout_toEndOf="@id/cardView"
|
android:layout_toEndOf="@id/cardView"
|
||||||
android:src="@drawable/boy" />
|
android:src="@drawable/boy" />
|
||||||
|
|
||||||
|
<ImageView
|
||||||
|
android:id="@+id/github"
|
||||||
|
android:layout_width="15dp"
|
||||||
|
android:layout_height="15dp"
|
||||||
|
android:layout_alignBottom="@id/genderView"
|
||||||
|
android:layout_marginStart="8dp"
|
||||||
|
android:layout_toEndOf="@id/genderView"
|
||||||
|
android:src="@drawable/github" />
|
||||||
|
|
||||||
|
|
||||||
<TextView
|
<TextView
|
||||||
android:id="@+id/describeView"
|
android:id="@+id/describeView"
|
||||||
|
|
|
@ -765,7 +765,6 @@
|
||||||
<string name="version_name_error2">A commit with version number %1$s already exists.</string>
|
<string name="version_name_error2">A commit with version number %1$s already exists.</string>
|
||||||
<string name="update_tip">Write your update log.</string>
|
<string name="update_tip">Write your update log.</string>
|
||||||
<string name="update_log">Update log</string>
|
<string name="update_log">Update log</string>
|
||||||
<string name="recent_update">Last updated :%1$s</string>
|
|
||||||
<string name="update_record">Update record</string>
|
<string name="update_record">Update record</string>
|
||||||
<string name="search_mod_key">Search results for "%1$s"</string>
|
<string name="search_mod_key">Search results for "%1$s"</string>
|
||||||
<string name="result">The results of</string>
|
<string name="result">The results of</string>
|
||||||
|
|
|
@ -765,7 +765,6 @@
|
||||||
<string name="version_name_error2">バージョン番号名が%1$sのコミットが存在する。</string>
|
<string name="version_name_error2">バージョン番号名が%1$sのコミットが存在する。</string>
|
||||||
<string name="update_tip">更新履歴を作成します。</string>
|
<string name="update_tip">更新履歴を作成します。</string>
|
||||||
<string name="update_log">日誌を更新する</string>
|
<string name="update_log">日誌を更新する</string>
|
||||||
<string name="recent_update">最近の更新:%1$s</string>
|
|
||||||
<string name="update_record">記録を更新する</string>
|
<string name="update_record">記録を更新する</string>
|
||||||
<string name="search_mod_key">\\"%1$s\\"に関する検索結果</string>
|
<string name="search_mod_key">\\"%1$s\\"に関する検索結果</string>
|
||||||
<string name="result">結果</string>
|
<string name="result">結果</string>
|
||||||
|
|
|
@ -764,7 +764,6 @@
|
||||||
<string name="version_name_error2">Существующая версия под названием % $.</string>
|
<string name="version_name_error2">Существующая версия под названием % $.</string>
|
||||||
<string name="update_tip">Напиши свой новый журнал.</string>
|
<string name="update_tip">Напиши свой новый журнал.</string>
|
||||||
<string name="update_log">Обновить журнал</string>
|
<string name="update_log">Обновить журнал</string>
|
||||||
<string name="recent_update">Последние новости :% $</string>
|
|
||||||
<string name="update_record">Обновить запись.</string>
|
<string name="update_record">Обновить запись.</string>
|
||||||
<string name="search_mod_key">Результаты поиска \"% \ $\ \\"</string>
|
<string name="search_mod_key">Результаты поиска \"% \ $\ \\"</string>
|
||||||
<string name="result">результат</string>
|
<string name="result">результат</string>
|
||||||
|
|
|
@ -81,6 +81,13 @@
|
||||||
</string-array>
|
</string-array>
|
||||||
|
|
||||||
|
|
||||||
|
<string-array name="game_versions">
|
||||||
|
<item>1.15</item>
|
||||||
|
<item>1.15p11</item>
|
||||||
|
<item>1.15p9</item>
|
||||||
|
</string-array>
|
||||||
|
|
||||||
|
|
||||||
<string-array name="dateset_read_tips">
|
<string-array name="dateset_read_tips">
|
||||||
<item>@string/read_mode_additional_tip</item>
|
<item>@string/read_mode_additional_tip</item>
|
||||||
<item>@string/read_mode_update_tip</item>
|
<item>@string/read_mode_update_tip</item>
|
||||||
|
|
|
@ -809,7 +809,7 @@
|
||||||
<string name="version_name_error2">已存在版本号名为%1$s的提交。</string>
|
<string name="version_name_error2">已存在版本号名为%1$s的提交。</string>
|
||||||
<string name="update_tip">编写您的更新日志。</string>
|
<string name="update_tip">编写您的更新日志。</string>
|
||||||
<string name="update_log">更新日志</string>
|
<string name="update_log">更新日志</string>
|
||||||
<string name="recent_update">最近更新:%1$s</string>
|
<string name="recent_update">最低版本:%1$s 最近更新:%2$s</string>
|
||||||
<string name="update_record">更新记录</string>
|
<string name="update_record">更新记录</string>
|
||||||
<string name="search_mod_key">关于\"%1$s\"的搜索结果</string>
|
<string name="search_mod_key">关于\"%1$s\"的搜索结果</string>
|
||||||
<string name="result">结果</string>
|
<string name="result">结果</string>
|
||||||
|
@ -962,6 +962,7 @@
|
||||||
<string name="public_mod">公开</string>
|
<string name="public_mod">公开</string>
|
||||||
<string name="private_mod">私有</string>
|
<string name="private_mod">私有</string>
|
||||||
<string name="minVersion">最低游戏版本</string>
|
<string name="minVersion">最低游戏版本</string>
|
||||||
|
<string name="minVersion_tip">选择游戏的最低版本,可留空。</string>
|
||||||
<string name="thumbs_up">点赞</string>
|
<string name="thumbs_up">点赞</string>
|
||||||
<string name="github">GitHub</string>
|
<string name="github">GitHub</string>
|
||||||
<string name="dataset_not_exist">DataBaseManifest.json不存在,无法加载信息。</string>
|
<string name="dataset_not_exist">DataBaseManifest.json不存在,无法加载信息。</string>
|
||||||
|
|
|
@ -27,6 +27,8 @@ data class WebModInfoData(
|
||||||
val screenshots: String? = null,
|
val screenshots: String? = null,
|
||||||
val tags: String,
|
val tags: String,
|
||||||
val unitNumber: Int,
|
val unitNumber: Int,
|
||||||
val updateTime: String
|
val updateTime: String,
|
||||||
|
val coinNumber: Int = 0,
|
||||||
|
val minVersion: String = "未知"
|
||||||
)
|
)
|
||||||
}
|
}
|
|
@ -161,14 +161,14 @@ object ServerConfiguration {
|
||||||
throw NullPointerException("String不能为空")
|
throw NullPointerException("String不能为空")
|
||||||
} else if (string.startsWith("http://") || string.startsWith("https://")) {
|
} else if (string.startsWith("http://") || string.startsWith("https://")) {
|
||||||
//如果说直链
|
//如果说直链
|
||||||
LogCat.d("真实路径组合", "直链" + string)
|
LogCat.d("getRealLink", "直链 " + string)
|
||||||
string
|
string
|
||||||
} else if (string.startsWith(Environment.getExternalStorageDirectory().absolutePath) || string.startsWith(
|
} else if (string.startsWith(Environment.getExternalStorageDirectory().absolutePath) || string.startsWith(
|
||||||
"/data/"
|
"/data/"
|
||||||
)
|
)
|
||||||
) {
|
) {
|
||||||
//如果是文件路径
|
//如果是文件路径
|
||||||
LogCat.d("真实路径组合", "是文件路径" + string)
|
LogCat.d("getRealLink", "是文件路径 " + string)
|
||||||
string
|
string
|
||||||
} else {
|
} else {
|
||||||
//如果开头包含../上级目录
|
//如果开头包含../上级目录
|
||||||
|
@ -185,7 +185,7 @@ object ServerConfiguration {
|
||||||
"${website}/${string}"
|
"${website}/${string}"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
LogCat.d("真实路径组合", result)
|
LogCat.d("getRealLink", result)
|
||||||
result
|
result
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1104,6 +1104,7 @@ class WebMod private constructor() {
|
||||||
unitNum: Int,
|
unitNum: Int,
|
||||||
versionName: String,
|
versionName: String,
|
||||||
iconLink: String?,
|
iconLink: String?,
|
||||||
|
minVersion: String?,
|
||||||
file: File,
|
file: File,
|
||||||
apiCallBack: ApiCallBack<ApiResponse>,
|
apiCallBack: ApiCallBack<ApiResponse>,
|
||||||
progressListener: ProgressListener? = null, screenshotList: ArrayList<String>? = null
|
progressListener: ProgressListener? = null, screenshotList: ArrayList<String>? = null
|
||||||
|
@ -1117,6 +1118,9 @@ class WebMod private constructor() {
|
||||||
.addFormDataPart("versionName", versionName)
|
.addFormDataPart("versionName", versionName)
|
||||||
.addFormDataPart("unitNumber", unitNum.toString())
|
.addFormDataPart("unitNumber", unitNum.toString())
|
||||||
.addFormDataPart("file", file.name, file.asRequestBody())
|
.addFormDataPart("file", file.name, file.asRequestBody())
|
||||||
|
if (minVersion!= null && minVersion.isNotEmpty()) {
|
||||||
|
builder.addFormDataPart("minVersion", minVersion)
|
||||||
|
}
|
||||||
if (iconLink != null) {
|
if (iconLink != null) {
|
||||||
if (ServerConfiguration.canConvertedToFile(iconLink)) {
|
if (ServerConfiguration.canConvertedToFile(iconLink)) {
|
||||||
val iconFile = File(iconLink)
|
val iconFile = File(iconLink)
|
||||||
|
|
Loading…
Reference in New Issue
Block a user