From dd8b2117f3e8d87bc7ddbc513d6a9ab793ffe69b Mon Sep 17 00:00:00 2001 From: Cold-Mint Date: Tue, 9 May 2023 13:04:19 +0800 Subject: [PATCH] =?UTF-8?q?=E5=A2=9E=E5=8A=A0minVersion=E7=9A=84=E4=B8=8A?= =?UTF-8?q?=E4=BC=A0=E4=B8=8E=E8=8E=B7=E5=8F=96=E3=80=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../coldmint/rust/pro/CreateModActivity.kt | 5 ++ .../coldmint/rust/pro/EditModInfoActivity.kt | 9 +++ .../coldmint/rust/pro/ReleaseModActivity.kt | 13 ++-- .../rust/pro/adapters/CommentAdapter.kt | 16 +++-- .../rust/pro/adapters/ModActionAdapter.kt | 63 +++++++++---------- .../rust/pro/adapters/TemplateListAdapter.kt | 44 ++++++------- .../rust/pro/adapters/WebModAdapter.kt | 2 + .../rust/pro/fragments/AllUnitsFragment.kt | 7 ++- .../pro/fragments/WebModDetailsFragment.kt | 6 +- .../main/res/layout/activity_create_mod.xml | 2 + .../res/layout/activity_edit_mod_info.xml | 20 +++++- .../main/res/layout/activity_release_mod.xml | 18 ++++++ .../res/layout/activity_user_home_page.xml | 21 +++++-- app/src/main/res/values-en/strings.xml | 1 - app/src/main/res/values-ja/strings.xml | 1 - app/src/main/res/values-ru/strings.xml | 1 - app/src/main/res/values/arrays.xml | 7 +++ app/src/main/res/values/strings.xml | 3 +- .../rust/core/dataBean/mod/WebModInfoData.kt | 4 +- .../rust/core/web/ServerConfiguration.kt | 6 +- .../java/com/coldmint/rust/core/web/WebMod.kt | 4 ++ 21 files changed, 172 insertions(+), 81 deletions(-) diff --git a/app/src/main/java/com/coldmint/rust/pro/CreateModActivity.kt b/app/src/main/java/com/coldmint/rust/pro/CreateModActivity.kt index 0235899..1f959de 100644 --- a/app/src/main/java/com/coldmint/rust/pro/CreateModActivity.kt +++ b/app/src/main/java/com/coldmint/rust/pro/CreateModActivity.kt @@ -108,6 +108,11 @@ class CreateModActivity : BaseActivity() { stringBuilder.append(name) stringBuilder.append("\ndescription: ") stringBuilder.append(describe) + val minVersion:String = viewBinding.minVersionEdit.text.toString() + if (minVersion.isNotBlank()){ + stringBuilder.append("\nminVersion: ") + stringBuilder.append(minVersion) + } val mod_directory = File(Environment.getExternalStorageDirectory().absolutePath + "/rustedWarfare/units/" + name) if (mod_directory.exists()) { diff --git a/app/src/main/java/com/coldmint/rust/pro/EditModInfoActivity.kt b/app/src/main/java/com/coldmint/rust/pro/EditModInfoActivity.kt index 182d9b4..b0cd428 100644 --- a/app/src/main/java/com/coldmint/rust/pro/EditModInfoActivity.kt +++ b/app/src/main/java/com/coldmint/rust/pro/EditModInfoActivity.kt @@ -119,6 +119,10 @@ class EditModInfoActivity : BaseActivity() { if (description != null) { viewBinding.modDescribeEdit.setText(description) } + val minVersion = mModClass.readValueFromInfoSection("minVersion", "mod") + if (minVersion!= null) { + viewBinding.minVersionEdit.setText(minVersion) + } val modIcon = mModClass.modIcon if (modIcon == null) { loadDefaultImage() @@ -216,6 +220,11 @@ class EditModInfoActivity : BaseActivity() { return false } resultBuilder.append(description) + val minVersion = viewBinding.minVersionEdit.text.toString() + if (minVersion.isNotBlank()) { + resultBuilder.append("\nminVersion:") + resultBuilder.append(minVersion) + } if (mNeedIcon) { var iconName = mModClass.readValueFromInfoSection("thumbnail", "mod") if (iconName == null) { diff --git a/app/src/main/java/com/coldmint/rust/pro/ReleaseModActivity.kt b/app/src/main/java/com/coldmint/rust/pro/ReleaseModActivity.kt index 7f94a6d..78bed6c 100644 --- a/app/src/main/java/com/coldmint/rust/pro/ReleaseModActivity.kt +++ b/app/src/main/java/com/coldmint/rust/pro/ReleaseModActivity.kt @@ -220,6 +220,7 @@ class ReleaseModActivity : BaseActivity() { viewBinding.modUpdateInputLayout.isVisible = true viewBinding.versionNameEdit.setText(t.data.versionName) viewBinding.modDescribeEdit.setText(t.data.describe) + viewBinding.minVersionEdit.setText(t.data.minVersion) val outputTags: StringBuilder = StringBuilder() lineParser.text = t.data.tags lineParser.parserSymbol = true @@ -724,6 +725,7 @@ class ReleaseModActivity : BaseActivity() { return } } + val minVersion: String = viewBinding.minVersionEdit.text.toString() val tagsBuilder = StringBuilder() val lineParser = LineParser(tags) lineParser.symbol = "," @@ -783,7 +785,7 @@ class ReleaseModActivity : BaseActivity() { } else { releaseModWork( modId, modName, modDescribe, versionName, - tagsBuilder, file + minVersion, tagsBuilder, file ) } } else { @@ -804,7 +806,7 @@ class ReleaseModActivity : BaseActivity() { } else { releaseModWork( modId, modName, modDescribe, versionName, - tagsBuilder, file + minVersion, tagsBuilder, file ) } }.setNegativeButton(R.string.always_allow) { @@ -823,7 +825,7 @@ class ReleaseModActivity : BaseActivity() { } else { releaseModWork( modId, modName, modDescribe, versionName, - tagsBuilder, file + minVersion, tagsBuilder, file ) } }.setNeutralButton(R.string.dialog_cancel) { @@ -846,7 +848,7 @@ class ReleaseModActivity : BaseActivity() { } else { releaseModWork( modId, modName, modDescribe, versionName, - tagsBuilder, file + minVersion, tagsBuilder, file ) } } @@ -868,6 +870,7 @@ class ReleaseModActivity : BaseActivity() { modName: String, modDescribe: String, versionName: String, + minVersion: String?, tagsBuilder: StringBuilder, file: File ) { val loadFileLayoutBinding = LoadFileLayoutBinding.inflate(layoutInflater) @@ -881,7 +884,7 @@ class ReleaseModActivity : BaseActivity() { modName, modDescribe, tagsBuilder.toString(), - unitnum, + unitnum, minVersion = minVersion, iconLink = iconLink, file = file, screenshotList = list, versionName = versionName, apiCallBack = object : ApiCallBack { override fun onResponse(t: ApiResponse) { diff --git a/app/src/main/java/com/coldmint/rust/pro/adapters/CommentAdapter.kt b/app/src/main/java/com/coldmint/rust/pro/adapters/CommentAdapter.kt index f8456aa..25463b6 100644 --- a/app/src/main/java/com/coldmint/rust/pro/adapters/CommentAdapter.kt +++ b/app/src/main/java/com/coldmint/rust/pro/adapters/CommentAdapter.kt @@ -1,6 +1,7 @@ package com.coldmint.rust.pro.adapters import android.content.Context +import android.util.Log import android.view.LayoutInflater import android.view.ViewGroup import androidx.recyclerview.widget.RecyclerView @@ -45,7 +46,10 @@ class CommentAdapter(context: Context, dataList: MutableList + val materialDialog = CoreDialog(mContext) + materialDialog.setTitle(R.string.packmod) + materialDialog.setMessage(R.string.share_tip) + materialDialog.setPositiveButton( + R.string.dialog_ok + ) { packShare(file) - null } - materialDialog.negativeButton( - R.string.no_longer_prompt, - null - ) { materialDialog: MaterialDialog? -> + materialDialog.setNegativeButton( + R.string.no_longer_prompt + ) { AppSettings.setValue(AppSettings.Setting.ShareTip, false) packShare(file) - null } materialDialog.show() } else { @@ -357,17 +354,16 @@ class ModActionAdapter( */ private fun packShare(file: File) { val modClass = ModClass(file) - val materialDialog = MaterialDialog(mContext) + val materialDialog = CoreDialog(mContext) Thread(object : Runnable { override fun run() { handler.post { - materialDialog.title(R.string.packmod).message( - text = + materialDialog.setTitle(R.string.packmod).setMessage( String.format( mContext.getString(R.string.dialog_packing), modClass.modName ) - ).cancelable(false).positiveButton(R.string.dialog_close2) { + ).setCancelable(false).setPositiveButton(R.string.dialog_close2) { Snackbar.make( mModFragment.requireView(), R.string.dialog_close_tip3, @@ -385,8 +381,7 @@ class ModActionAdapter( compressionManager.compression(file, toFile, object : CompressionListener { override fun whenCompressionFile(file: File): Boolean { handler.post { - materialDialog.message( - text = + materialDialog.setMessage( String.format( mContext.getString(R.string.dialog_packing), file.name @@ -398,8 +393,7 @@ class ModActionAdapter( override fun whenCompressionFolder(folder: File): Boolean { handler.post { - materialDialog.message( - text = + materialDialog.setMessage( String.format( mContext.getString(R.string.dialog_packing), folder.name @@ -412,19 +406,20 @@ class ModActionAdapter( override fun whenCompressionComplete(result: Boolean) { handler.post { if (result) { - materialDialog.title(R.string.share_mod).message( - text = - String.format( - mContext.getString(R.string.pack_success), - modClass.modName - ) - ).clearPositiveListeners().positiveButton(R.string.share_mod) { - FileOperator.shareFile( - mContext, toFile - ) - }.negativeButton(R.string.dialog_cancel) { - toFile.delete() - }.show() + materialDialog.dismiss() + CoreDialog(mContext) + .setTitle(R.string.share_mod).setMessage( + String.format( + mContext.getString(R.string.pack_success), + modClass.modName + ) + ).setPositiveButton(R.string.share_mod) { + FileOperator.shareFile( + mContext, toFile + ) + }.setNegativeButton(R.string.dialog_cancel) { + toFile.delete() + }.show() } else { materialDialog.dismiss() Snackbar.make( diff --git a/app/src/main/java/com/coldmint/rust/pro/adapters/TemplateListAdapter.kt b/app/src/main/java/com/coldmint/rust/pro/adapters/TemplateListAdapter.kt index 8f85634..5efeb69 100644 --- a/app/src/main/java/com/coldmint/rust/pro/adapters/TemplateListAdapter.kt +++ b/app/src/main/java/com/coldmint/rust/pro/adapters/TemplateListAdapter.kt @@ -13,6 +13,7 @@ import androidx.core.view.isVisible import androidx.recyclerview.widget.DividerItemDecoration import androidx.recyclerview.widget.LinearLayoutManager import com.afollestad.materialdialogs.MaterialDialog +import com.coldmint.dialog.CoreDialog import com.coldmint.rust.core.CompressionManager import com.coldmint.rust.core.LocalTemplatePackage import com.coldmint.rust.core.interfaces.CompressionListener @@ -61,7 +62,7 @@ class TemplateListAdapter( * @param localTemplatePackage LocalTemplatePackage */ private fun share(context: Context, localTemplatePackage: LocalTemplatePackage) { - val materialDialog = MaterialDialog(context) + val materialDialog = CoreDialog(context) val handler = Handler(Looper.getMainLooper()) Thread { val cacheDirectory = @@ -77,8 +78,10 @@ class TemplateListAdapter( toFile.delete() } handler.post { - materialDialog.title(R.string.packmod) - .positiveButton(R.string.dialog_close2) + materialDialog.setTitle(R.string.packmod) + .setPositiveButton(R.string.dialog_close2){ + + } materialDialog.show() } val compressionManager = @@ -94,7 +97,7 @@ class TemplateListAdapter( file.name ) handler.post { - materialDialog.message(text = msg) + materialDialog.setMessage(msg) } return true } @@ -105,7 +108,7 @@ class TemplateListAdapter( folder.name ) handler.post { - materialDialog.message(text = msg) + materialDialog.setMessage(msg) } return true } @@ -114,23 +117,22 @@ class TemplateListAdapter( handler.post { materialDialog.dismiss() if (result) { - MaterialDialog(context).show { - title(R.string.share_mod).message( - text = String.format( - context.getString(R.string.pack_success), - localTemplatePackage.getName() - ) - ).positiveButton(R.string.share) { - FileOperator.shareFile( - context, - toFile - ) - }.negativeButton(R.string.dialog_cancel) - } + CoreDialog(context).setTitle(R.string.share_mod).setMessage( + String.format( + context.getString(R.string.pack_success), + localTemplatePackage.getName() + ) + ).setPositiveButton(R.string.share) { + FileOperator.shareFile( + context, + toFile + ) + }.setNegativeButton(R.string.dialog_cancel) { + + }.show() } else { - MaterialDialog(context).show { - title(R.string.share_mod).message(R.string.pack_failed) - .positiveButton(R.string.dialog_ok) + CoreDialog(context).setTitle(R.string.share_mod).setMessage(R.string.pack_failed).setPositiveButton(R.string.dialog_ok){ + } } } diff --git a/app/src/main/java/com/coldmint/rust/pro/adapters/WebModAdapter.kt b/app/src/main/java/com/coldmint/rust/pro/adapters/WebModAdapter.kt index dc26e8b..2529461 100644 --- a/app/src/main/java/com/coldmint/rust/pro/adapters/WebModAdapter.kt +++ b/app/src/main/java/com/coldmint/rust/pro/adapters/WebModAdapter.kt @@ -43,6 +43,8 @@ class WebModAdapter( context: Context, dataList: MutableList diff --git a/app/src/main/res/layout/activity_edit_mod_info.xml b/app/src/main/res/layout/activity_edit_mod_info.xml index bfe0fae..239176f 100644 --- a/app/src/main/res/layout/activity_edit_mod_info.xml +++ b/app/src/main/res/layout/activity_edit_mod_info.xml @@ -121,6 +121,22 @@ + + + + @@ -173,7 +189,6 @@ android:text="@string/add" /> + + + + + + app:cardCornerRadius="4dp" + app:cardBackgroundColor="@color/blue_500"> + android:padding="4dp"> + android:textSize="10sp" + android:textColor="@color/white" /> @@ -108,6 +110,15 @@ android:layout_toEndOf="@id/cardView" android:src="@drawable/boy" /> + + A commit with version number %1$s already exists. Write your update log. Update log - Last updated :%1$s Update record Search results for "%1$s" The results of diff --git a/app/src/main/res/values-ja/strings.xml b/app/src/main/res/values-ja/strings.xml index abe64ef..a14b0af 100644 --- a/app/src/main/res/values-ja/strings.xml +++ b/app/src/main/res/values-ja/strings.xml @@ -765,7 +765,6 @@ バージョン番号名が%1$sのコミットが存在する。 更新履歴を作成します。 日誌を更新する - 最近の更新:%1$s 記録を更新する \\"%1$s\\"に関する検索結果 結果 diff --git a/app/src/main/res/values-ru/strings.xml b/app/src/main/res/values-ru/strings.xml index 6a7d3a2..c2de1b2 100644 --- a/app/src/main/res/values-ru/strings.xml +++ b/app/src/main/res/values-ru/strings.xml @@ -764,7 +764,6 @@ Существующая версия под названием % $. Напиши свой новый журнал. Обновить журнал - Последние новости :% $ Обновить запись. Результаты поиска \"% \ $\ \\" результат diff --git a/app/src/main/res/values/arrays.xml b/app/src/main/res/values/arrays.xml index 8b3297d..6de3bd2 100644 --- a/app/src/main/res/values/arrays.xml +++ b/app/src/main/res/values/arrays.xml @@ -81,6 +81,13 @@ + + 1.15 + 1.15p11 + 1.15p9 + + + @string/read_mode_additional_tip @string/read_mode_update_tip diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml index 5b80b3f..e20215b 100644 --- a/app/src/main/res/values/strings.xml +++ b/app/src/main/res/values/strings.xml @@ -809,7 +809,7 @@ 已存在版本号名为%1$s的提交。 编写您的更新日志。 更新日志 - 最近更新:%1$s + 最低版本:%1$s 最近更新:%2$s 更新记录 关于\"%1$s\"的搜索结果 结果 @@ -962,6 +962,7 @@ 公开 私有 最低游戏版本 + 选择游戏的最低版本,可留空。 点赞 GitHub DataBaseManifest.json不存在,无法加载信息。 diff --git a/assistantCoreLibrary/src/main/java/com/coldmint/rust/core/dataBean/mod/WebModInfoData.kt b/assistantCoreLibrary/src/main/java/com/coldmint/rust/core/dataBean/mod/WebModInfoData.kt index 2203916..a191719 100644 --- a/assistantCoreLibrary/src/main/java/com/coldmint/rust/core/dataBean/mod/WebModInfoData.kt +++ b/assistantCoreLibrary/src/main/java/com/coldmint/rust/core/dataBean/mod/WebModInfoData.kt @@ -27,6 +27,8 @@ data class WebModInfoData( val screenshots: String? = null, val tags: String, val unitNumber: Int, - val updateTime: String + val updateTime: String, + val coinNumber: Int = 0, + val minVersion: String = "未知" ) } \ No newline at end of file diff --git a/assistantCoreLibrary/src/main/java/com/coldmint/rust/core/web/ServerConfiguration.kt b/assistantCoreLibrary/src/main/java/com/coldmint/rust/core/web/ServerConfiguration.kt index 9b03352..42c7bd0 100644 --- a/assistantCoreLibrary/src/main/java/com/coldmint/rust/core/web/ServerConfiguration.kt +++ b/assistantCoreLibrary/src/main/java/com/coldmint/rust/core/web/ServerConfiguration.kt @@ -161,14 +161,14 @@ object ServerConfiguration { throw NullPointerException("String不能为空") } else if (string.startsWith("http://") || string.startsWith("https://")) { //如果说直链 - LogCat.d("真实路径组合", "直链" + string) + LogCat.d("getRealLink", "直链 " + string) string } else if (string.startsWith(Environment.getExternalStorageDirectory().absolutePath) || string.startsWith( "/data/" ) ) { //如果是文件路径 - LogCat.d("真实路径组合", "是文件路径" + string) + LogCat.d("getRealLink", "是文件路径 " + string) string } else { //如果开头包含../上级目录 @@ -185,7 +185,7 @@ object ServerConfiguration { "${website}/${string}" } } - LogCat.d("真实路径组合", result) + LogCat.d("getRealLink", result) result } } diff --git a/assistantCoreLibrary/src/main/java/com/coldmint/rust/core/web/WebMod.kt b/assistantCoreLibrary/src/main/java/com/coldmint/rust/core/web/WebMod.kt index e6c2eb2..876bbad 100644 --- a/assistantCoreLibrary/src/main/java/com/coldmint/rust/core/web/WebMod.kt +++ b/assistantCoreLibrary/src/main/java/com/coldmint/rust/core/web/WebMod.kt @@ -1104,6 +1104,7 @@ class WebMod private constructor() { unitNum: Int, versionName: String, iconLink: String?, + minVersion: String?, file: File, apiCallBack: ApiCallBack, progressListener: ProgressListener? = null, screenshotList: ArrayList? = null @@ -1117,6 +1118,9 @@ class WebMod private constructor() { .addFormDataPart("versionName", versionName) .addFormDataPart("unitNumber", unitNum.toString()) .addFormDataPart("file", file.name, file.asRequestBody()) + if (minVersion!= null && minVersion.isNotEmpty()) { + builder.addFormDataPart("minVersion", minVersion) + } if (iconLink != null) { if (ServerConfiguration.canConvertedToFile(iconLink)) { val iconFile = File(iconLink)