diff --git a/.gradle/7.3.3/executionHistory/executionHistory.bin b/.gradle/7.3.3/executionHistory/executionHistory.bin index 258834f..9b8e972 100644 Binary files a/.gradle/7.3.3/executionHistory/executionHistory.bin and b/.gradle/7.3.3/executionHistory/executionHistory.bin differ diff --git a/.gradle/7.3.3/executionHistory/executionHistory.lock b/.gradle/7.3.3/executionHistory/executionHistory.lock index 897500b..dc7e70c 100644 Binary files a/.gradle/7.3.3/executionHistory/executionHistory.lock and b/.gradle/7.3.3/executionHistory/executionHistory.lock differ diff --git a/.gradle/7.3.3/fileHashes/fileHashes.bin b/.gradle/7.3.3/fileHashes/fileHashes.bin index 0626b4a..4d0ed3f 100644 Binary files a/.gradle/7.3.3/fileHashes/fileHashes.bin and b/.gradle/7.3.3/fileHashes/fileHashes.bin differ diff --git a/.gradle/7.3.3/fileHashes/fileHashes.lock b/.gradle/7.3.3/fileHashes/fileHashes.lock index 6dfdabb..d8ad461 100644 Binary files a/.gradle/7.3.3/fileHashes/fileHashes.lock and b/.gradle/7.3.3/fileHashes/fileHashes.lock differ diff --git a/.gradle/7.3.3/fileHashes/resourceHashesCache.bin b/.gradle/7.3.3/fileHashes/resourceHashesCache.bin index ecb36c5..fe4e3aa 100644 Binary files a/.gradle/7.3.3/fileHashes/resourceHashesCache.bin and b/.gradle/7.3.3/fileHashes/resourceHashesCache.bin differ diff --git a/.gradle/buildOutputCleanup/buildOutputCleanup.lock b/.gradle/buildOutputCleanup/buildOutputCleanup.lock index 0e0468e..d812557 100644 Binary files a/.gradle/buildOutputCleanup/buildOutputCleanup.lock and b/.gradle/buildOutputCleanup/buildOutputCleanup.lock differ diff --git a/.gradle/buildOutputCleanup/outputFiles.bin b/.gradle/buildOutputCleanup/outputFiles.bin index d1a4028..da5e14f 100644 Binary files a/.gradle/buildOutputCleanup/outputFiles.bin and b/.gradle/buildOutputCleanup/outputFiles.bin differ diff --git a/.gradle/file-system.probe b/.gradle/file-system.probe index 6c42e23..39eb301 100644 Binary files a/.gradle/file-system.probe and b/.gradle/file-system.probe differ diff --git a/app/build.gradle b/app/build.gradle index 4a6d65c..c04fd81 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -27,8 +27,8 @@ android { applicationId "com.coldmint.rust.pro" minSdkVersion 21 targetSdkVersion 32 - versionCode 22 - versionName "2.1 Bata1_patch5(2022-9-4)" + versionCode 23 + versionName "2.1 Bata1_patch6(2022-10-1)" testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner" } diff --git a/app/release/output-metadata.json b/app/release/output-metadata.json index bf12ac4..80eaefa 100644 --- a/app/release/output-metadata.json +++ b/app/release/output-metadata.json @@ -11,8 +11,8 @@ "type": "SINGLE", "filters": [], "attributes": [], - "versionCode": 22, - "versionName": "2.1 Bata1_patch5(2022-9-4)", + "versionCode": 23, + "versionName": "2.1 Bata1_patch6(2022-10-1)", "outputFile": "app-release.apk" } ], diff --git a/app/src/main/AndroidManifest.xml b/app/src/main/AndroidManifest.xml index ff82312..abffbe1 100644 --- a/app/src/main/AndroidManifest.xml +++ b/app/src/main/AndroidManifest.xml @@ -24,6 +24,9 @@ android:supportsRtl="true" android:theme="@style/Theme.rust.Concept" android:usesCleartextTraffic="true"> + diff --git a/app/src/main/java/com/coldmint/rust/pro/ErrorActivity.kt b/app/src/main/java/com/coldmint/rust/pro/ErrorActivity.kt index a07870a..22ee38b 100644 --- a/app/src/main/java/com/coldmint/rust/pro/ErrorActivity.kt +++ b/app/src/main/java/com/coldmint/rust/pro/ErrorActivity.kt @@ -29,7 +29,6 @@ import java.text.SimpleDateFormat import java.util.* class ErrorActivity() : BaseActivity() { - private lateinit var logFile: File private val errorInfo by lazy { ErrorInfo() } @@ -109,14 +108,13 @@ class ErrorActivity() : BaseActivity() { * 创建错误日志 */ fun saveLog(): Boolean { -// errorInfo.describe = viewBinding.inputEditView.text.toString() return errorInfo.save() } private fun initAction() { viewBinding.shareLogButton.setOnClickListener(View.OnClickListener { saveLog() - if (!logFile.exists()) { + if (!errorInfo.getLogFile().exists()) { Snackbar.make( viewBinding.shareLogButton, R.string.file_not_exist, @@ -124,7 +122,7 @@ class ErrorActivity() : BaseActivity() { ) .show() } else { - FileOperator.shareFile(this@ErrorActivity, logFile) + FileOperator.shareFile(this@ErrorActivity, errorInfo.getLogFile()) } }) diff --git a/app/src/main/java/com/coldmint/rust/pro/FeedbackActivity.kt b/app/src/main/java/com/coldmint/rust/pro/FeedbackActivity.kt new file mode 100644 index 0000000..70e691a --- /dev/null +++ b/app/src/main/java/com/coldmint/rust/pro/FeedbackActivity.kt @@ -0,0 +1,19 @@ +package com.coldmint.rust.pro + +import androidx.appcompat.app.AppCompatActivity +import android.os.Bundle +import android.view.LayoutInflater +import com.coldmint.rust.pro.base.BaseActivity +import com.coldmint.rust.pro.databinding.ActivityFeedbackBinding + +class FeedbackActivity : BaseActivity() { + + override fun whenCreateActivity(savedInstanceState: Bundle?, canUseView: Boolean) { + setReturnButton() + title = getString(R.string.feedback) + } + + override fun getViewBindingObject(layoutInflater: LayoutInflater): ActivityFeedbackBinding { + return ActivityFeedbackBinding.inflate(layoutInflater) + } +} \ No newline at end of file diff --git a/app/src/main/java/com/coldmint/rust/pro/FileManagerActivity.kt b/app/src/main/java/com/coldmint/rust/pro/FileManagerActivity.kt index 22d256e..23f5588 100644 --- a/app/src/main/java/com/coldmint/rust/pro/FileManagerActivity.kt +++ b/app/src/main/java/com/coldmint/rust/pro/FileManagerActivity.kt @@ -701,7 +701,19 @@ class FileManagerActivity : BaseActivity() { }.setGestureInsetBottomIgnored(true).show() } else if (viewModel.startTypeData == FileManagerViewModel.StartType.DEFAULT) { val type = FileOperator.getFileType(file) - if (type == "ini" || type == "txt") { + val data = AppSettings.getValue(AppSettings.Setting.SourceFileType,"ini,template") + val line = LineParser(data) + var isSourceFile = false + line.symbol = "," + line.analyse { lineNum, lineData, isEnd -> + if (type == lineData) + { + isSourceFile = true + return@analyse false + } + true + } + if (isSourceFile) { val intent = Intent(this, EditActivity::class.java) val bundle = Bundle() bundle.putString("path", file.absolutePath) diff --git a/app/src/main/java/com/coldmint/rust/pro/databean/ErrorInfo.kt b/app/src/main/java/com/coldmint/rust/pro/databean/ErrorInfo.kt index d66eb6d..8a221e5 100644 --- a/app/src/main/java/com/coldmint/rust/pro/databean/ErrorInfo.kt +++ b/app/src/main/java/com/coldmint/rust/pro/databean/ErrorInfo.kt @@ -18,36 +18,48 @@ import java.util.* */ data class ErrorInfo( private val nowTime: Long = System.currentTimeMillis(), + private var logFile: File? = null, val time: String = ServerConfiguration.toStringTime(nowTime), val id: String = UUID.randomUUID().toString(), var allErrorDetails: String = "", var activityLog: String? = null, - var autoSave: Boolean = true, + var autoSave: Boolean = true ) { + /** + * 获取Log文件 + * @return String + */ + fun getLogFile(): File { + if (logFile == null) + { + val filePath = StringBuilder() + filePath.append(AppSettings.dataRootDirectory) + filePath.append("/carsh/") + val folderFormatter = SimpleDateFormat("yyyy-MM-dd") + val folderName = folderFormatter.format(nowTime) + filePath.append(folderName) + val folder = File(filePath.toString()) + if (!folder.exists()) { + folder.mkdirs() + } + filePath.append("/") + val dateFormat = SimpleDateFormat("HH-mm-ss") + val fileName = dateFormat.format(nowTime) + filePath.append(fileName) + filePath.append(".log") + logFile = File(filePath.toString()) + } + return logFile!! + } /** * 保存ErrorInfo * @return Boolean */ fun save(): Boolean { - val filePath = StringBuilder() - filePath.append(AppSettings.dataRootDirectory) - filePath.append("/carsh/") - val folderFormatter = SimpleDateFormat("yyyy-MM-dd") - val folderName = folderFormatter.format(nowTime) - filePath.append(folderName) - val folder = File(filePath.toString()) - if (!folder.exists()) { - folder.mkdirs() - } - filePath.append("/") - val dateFormat = SimpleDateFormat("HH-mm-ss") - val fileName = dateFormat.format(nowTime) - filePath.append(fileName) - filePath.append(".log") val gson = Gson() - val logFile = File(filePath.toString()) + val logFile = getLogFile() return FileOperator.writeFile(logFile, gson.toJson(this)) } diff --git a/app/src/main/java/com/coldmint/rust/pro/tool/AppSettings.kt b/app/src/main/java/com/coldmint/rust/pro/tool/AppSettings.kt index efeda3c..fa1023d 100644 --- a/app/src/main/java/com/coldmint/rust/pro/tool/AppSettings.kt +++ b/app/src/main/java/com/coldmint/rust/pro/tool/AppSettings.kt @@ -38,7 +38,8 @@ object AppSettings { } enum class Setting { - DatabaseDirectory, DatabasePath, TemplateDirectory, AppLanguage, DeveloperMode, CustomSymbol, AutoCreateNomedia, OnlyLoadConantLanguageTemple, NightMode, GamePackage, KeywordColor, KeywordColorDark, AnnotationColor, AnnotationColorDark, TextColor, TextColorDark, SectionColor, SectionColorDark, KeepRwmodFile, EnableRecoveryStation, RecoveryStationFileSaveDays, RecoveryStationFolder, IndependentFolder, SetGameStorage, PackDirectory, IdentifiersPromptNumber, UserName, UseJetBrainsMonoFont, AppID, Account, PassWord, ExpirationTime, CheckBetaUpdate, UpdateData, ShareTip, AgreePolicy, EnglishEditingMode, NightModeFollowSystem, UseMobileNetwork, MapFolder, ModFolder, UseTheCommunityAsTheLaunchPage, AutoSave, ServerAddress, Token, LoginStatus, DynamicColor, ExperiencePlan, FileSortType, CodeEditBackGroundEnable, BlurTransformationValue, CodeEditBackGroundPath, SimpleDisplayOfAutoCompleteMenu + DatabaseDirectory, DatabasePath, TemplateDirectory, AppLanguage, DeveloperMode, CustomSymbol, AutoCreateNomedia, OnlyLoadConantLanguageTemple, NightMode, GamePackage, KeywordColor, KeywordColorDark, AnnotationColor, AnnotationColorDark, TextColor, TextColorDark, SectionColor, SectionColorDark, KeepRwmodFile, EnableRecoveryStation, RecoveryStationFileSaveDays, RecoveryStationFolder, IndependentFolder, SetGameStorage, PackDirectory, IdentifiersPromptNumber, UserName, UseJetBrainsMonoFont, AppID, Account, PassWord, ExpirationTime, CheckBetaUpdate, UpdateData, ShareTip, AgreePolicy, EnglishEditingMode, NightModeFollowSystem, UseMobileNetwork, MapFolder, ModFolder, UseTheCommunityAsTheLaunchPage, AutoSave, ServerAddress, Token, LoginStatus, DynamicColor, ExperiencePlan, FileSortType, CodeEditBackGroundEnable, BlurTransformationValue, CodeEditBackGroundPath, SimpleDisplayOfAutoCompleteMenu, SourceFileType + } @@ -132,6 +133,8 @@ object AppSettings { map[Setting.FileSortType] = mApplication.getString(R.string.setting_file_sort_type) map[Setting.SimpleDisplayOfAutoCompleteMenu] = mApplication.getString(R.string.setting_simple_display_of_auto_complete_menu) + //setting_source_file_type + map[Setting.SourceFileType] = mApplication.getString(R.string.setting_source_file_type) //仅保存不可显示 map[Setting.SetGameStorage] = "SetGameStorage" map[Setting.AppID] = "AppId" diff --git a/app/src/main/java/com/coldmint/rust/pro/tool/UnitAutoCompleteHelper.kt b/app/src/main/java/com/coldmint/rust/pro/tool/UnitAutoCompleteHelper.kt index 43e6f27..b0cccdd 100644 --- a/app/src/main/java/com/coldmint/rust/pro/tool/UnitAutoCompleteHelper.kt +++ b/app/src/main/java/com/coldmint/rust/pro/tool/UnitAutoCompleteHelper.kt @@ -6,6 +6,7 @@ import android.text.Editable import android.text.TextWatcher import android.util.Log import android.widget.ArrayAdapter +import com.coldmint.rust.core.tool.LineParser import com.coldmint.rust.pro.base.BaseAppendAutoCompleteHelper import com.coldmint.rust.pro.interfaces.AutoCompleteHelper import com.google.android.material.textfield.MaterialAutoCompleteTextView @@ -15,11 +16,20 @@ import com.google.android.material.textfield.MaterialAutoCompleteTextView */ class UnitAutoCompleteHelper(context: Context) : BaseAppendAutoCompleteHelper(context) { + val dataList by lazy { + val arrayList = ArrayList() + val data = AppSettings.getValue(AppSettings.Setting.SourceFileType,"ini,template") + val line = LineParser(data) + line.symbol = "," + line.analyse { lineNum, lineData, isEnd -> + arrayList.add(".${lineData}") + true + } + arrayList + } override fun getDataList(): List { - return listOf( - ".ini", ".txt", ".template" - ) + return dataList } override fun getSymbol(): Char { diff --git a/app/src/main/java/com/coldmint/rust/pro/viewmodel/StartViewModel.kt b/app/src/main/java/com/coldmint/rust/pro/viewmodel/StartViewModel.kt index c6e6354..6252cc9 100644 --- a/app/src/main/java/com/coldmint/rust/pro/viewmodel/StartViewModel.kt +++ b/app/src/main/java/com/coldmint/rust/pro/viewmodel/StartViewModel.kt @@ -263,6 +263,7 @@ class StartViewModel(application: Application) : BaseAndroidViewModel(applicatio AppSettings.initSetting(AppSettings.Setting.CodeEditBackGroundEnable, false) AppSettings.initSetting(AppSettings.Setting.BlurTransformationValue, 1) AppSettings.initSetting(AppSettings.Setting.CodeEditBackGroundPath, "") + AppSettings.initSetting(AppSettings.Setting.SourceFileType, "ini,template,txt") } @@ -340,7 +341,7 @@ class StartViewModel(application: Application) : BaseAndroidViewModel(applicatio private fun initRes() { try { val language = Locale.getDefault().language - DebugHelper.printLog("初始化资源","语言"+language) + DebugHelper.printLog("初始化资源", "语言" + language) if (language == "zh") { unzipDataSet("dataBase.rdb", true) unzipDataSet("dataBase_en.rdb") diff --git a/app/src/main/res/layout/activity_feedback.xml b/app/src/main/res/layout/activity_feedback.xml new file mode 100644 index 0000000..8ec242d --- /dev/null +++ b/app/src/main/res/layout/activity_feedback.xml @@ -0,0 +1,9 @@ + + + + \ No newline at end of file diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml index a4a2d04..d9eb2fb 100644 --- a/app/src/main/res/values/strings.xml +++ b/app/src/main/res/values/strings.xml @@ -933,5 +933,8 @@ 简版自动完成菜单 搜索关键字 我分享模组了 %1$s,下载链接:%2$s\n下载铁锈助手即可参与评论,给作品投币。App下载链接:%3$s + sourceFileType + 源文件类型 + 配置源文件类型,符合配置格式的文件将以文本编辑形式打开。以逗号分割不同格式。 \ No newline at end of file diff --git a/app/src/main/res/xml/root_preferences.xml b/app/src/main/res/xml/root_preferences.xml index 356e132..e21bc97 100644 --- a/app/src/main/res/xml/root_preferences.xml +++ b/app/src/main/res/xml/root_preferences.xml @@ -53,6 +53,14 @@ app:key="@string/setting_file_sort_type" app:title="@string/file_sort_type" app:useSimpleSummaryProvider="true" /> + + + + diff --git a/assistantCoreLibrary/src/main/java/com/coldmint/rust/core/turret/TurretManager.kt b/assistantCoreLibrary/src/main/java/com/coldmint/rust/core/turret/TurretManager.kt index 9e3bdb7..9ad9650 100644 --- a/assistantCoreLibrary/src/main/java/com/coldmint/rust/core/turret/TurretManager.kt +++ b/assistantCoreLibrary/src/main/java/com/coldmint/rust/core/turret/TurretManager.kt @@ -65,11 +65,11 @@ class TurretManager(val sourceFile: SourceFile) { var y = 0 val xData = sourceFile.readValueFromSection("x", it) if (xData != null) { - x = xData.toInt() + x = xData.toFloat().toInt() } val yData = sourceFile.readValueFromSection("y", it) if (yData != null) { - y = yData.toInt() + y = yData.toFloat().toInt() } val turretData = TurretData(name, CoordinateData(x, y)) val fileList = sourceFile.findResourceFilesFromSection("image", it, false) diff --git a/assistantCoreLibrary/src/main/java/com/coldmint/rust/core/turret/TurretView.kt b/assistantCoreLibrary/src/main/java/com/coldmint/rust/core/turret/TurretView.kt index 552d47d..eb72852 100644 --- a/assistantCoreLibrary/src/main/java/com/coldmint/rust/core/turret/TurretView.kt +++ b/assistantCoreLibrary/src/main/java/com/coldmint/rust/core/turret/TurretView.kt @@ -50,7 +50,7 @@ class TurretView(context: Context, attributeSet: AttributeSet? = null) : val and = turretSketchpadView?.toAndroidCoordinate(turretData.gameCoordinateData) if (and != null) { turretSketchpadView?.setKeyCoordinate(and) - }else{ + } else { Log.e(debugKey, "可拖动状态,辅助线定位失败。") } } @@ -149,10 +149,14 @@ class TurretView(context: Context, attributeSet: AttributeSet? = null) : return } val paint = Paint() - var bitmap = if (turretData.imageFile == null) { - BitmapFactory.decodeResource(this.resources, R.drawable.image) - } else { + var bitmap: Bitmap? = if (turretData.imageFile != null) { BitmapFactory.decodeFile(turretData.imageFile!!.absolutePath) + } else { + null + } + if (bitmap == null) { + Log.e(debugKey, "无法加载炮塔图像。") + return } if (turretData.scaleValue != 1f) { bitmap = TurretSketchpadView.scaleBitmap(