diff --git a/.gradle/7.2/executionHistory/executionHistory.bin b/.gradle/7.2/executionHistory/executionHistory.bin index 2482d4e..7a1a746 100644 Binary files a/.gradle/7.2/executionHistory/executionHistory.bin and b/.gradle/7.2/executionHistory/executionHistory.bin differ diff --git a/.gradle/7.2/executionHistory/executionHistory.lock b/.gradle/7.2/executionHistory/executionHistory.lock index 509cc02..a141ba7 100644 Binary files a/.gradle/7.2/executionHistory/executionHistory.lock and b/.gradle/7.2/executionHistory/executionHistory.lock differ diff --git a/.gradle/7.2/fileHashes/fileHashes.bin b/.gradle/7.2/fileHashes/fileHashes.bin index cbb28e5..7007988 100644 Binary files a/.gradle/7.2/fileHashes/fileHashes.bin and b/.gradle/7.2/fileHashes/fileHashes.bin differ diff --git a/.gradle/7.2/fileHashes/fileHashes.lock b/.gradle/7.2/fileHashes/fileHashes.lock index 0d89fa4..b0f08ce 100644 Binary files a/.gradle/7.2/fileHashes/fileHashes.lock and b/.gradle/7.2/fileHashes/fileHashes.lock differ diff --git a/.gradle/7.2/fileHashes/resourceHashesCache.bin b/.gradle/7.2/fileHashes/resourceHashesCache.bin index 954ebe2..26f048a 100644 Binary files a/.gradle/7.2/fileHashes/resourceHashesCache.bin and b/.gradle/7.2/fileHashes/resourceHashesCache.bin differ diff --git a/.gradle/buildOutputCleanup/buildOutputCleanup.lock b/.gradle/buildOutputCleanup/buildOutputCleanup.lock index 2f78249..181920b 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 15b06f5..1cf41a2 100644 Binary files a/.gradle/buildOutputCleanup/outputFiles.bin and b/.gradle/buildOutputCleanup/outputFiles.bin differ diff --git a/app/src/main/java/com/coldmint/rust/pro/WebModInfoActivity.kt b/app/src/main/java/com/coldmint/rust/pro/WebModInfoActivity.kt index cd53149..c8760f7 100644 --- a/app/src/main/java/com/coldmint/rust/pro/WebModInfoActivity.kt +++ b/app/src/main/java/com/coldmint/rust/pro/WebModInfoActivity.kt @@ -125,7 +125,8 @@ class WebModInfoActivity : BaseActivity() { val icon = t.data.icon if (icon != null && icon.isNotBlank()) { Glide.with(this@WebModInfoActivity) - .load(ServerConfiguration.getRealLink(icon)).apply(GlobalMethod.getRequestOptions()) + .load(ServerConfiguration.getRealLink(icon)) + .apply(GlobalMethod.getRequestOptions()) .into(viewBinding.iconView) } title = t.data.name @@ -148,7 +149,8 @@ class WebModInfoActivity : BaseActivity() { ) { if (data != null && holder != null) { Glide.with(this@WebModInfoActivity) - .load(ServerConfiguration.getRealLink(data)).apply(GlobalMethod.getRequestOptions()) + .load(ServerConfiguration.getRealLink(data)) + .apply(GlobalMethod.getRequestOptions()) .into(holder.imageView) } } @@ -331,51 +333,55 @@ class WebModInfoActivity : BaseActivity() { * @param fileLink String */ fun downloadWork(fileLink: String) { - viewBinding.button.setText(R.string.installation_ing) - val loadFileLayoutBinding = LoadFileLayoutBinding.inflate(layoutInflater) - loadFileLayoutBinding.LinearProgressIndicator.max = 100 - var progress = 0 - val materialDialog = MaterialDialog(this).show { - title(R.string.downlod).customView(view = loadFileLayoutBinding.root).cancelable(false) - .positiveButton(R.string.dialog_close) - } + GlobalMethod.requestStoragePermissions(this) { + if (it) { + viewBinding.button.setText(R.string.installation_ing) + val loadFileLayoutBinding = LoadFileLayoutBinding.inflate(layoutInflater) + loadFileLayoutBinding.LinearProgressIndicator.max = 100 + var progress = 0 + val materialDialog = MaterialDialog(this).show { + title(R.string.downlod).customView(view = loadFileLayoutBinding.root) + .cancelable(false) + .positiveButton(R.string.dialog_close) + } - val fileLoader = FileLoader.getInstantiate(fileLink, targetFile.absolutePath) - fileLoader.download(object : ProgressResponseBody.ResponseProgressListener { - override fun update(bytesRead: Long, contentLength: Long, done: Boolean) { - //计算百分比并更新ProgressBar - val numberFormat = NumberFormat.getNumberInstance() - numberFormat.maximumFractionDigits = 2 - val trueProgress = - numberFormat.format(bytesRead.toDouble() / contentLength.toDouble() * 100) - progress = trueProgress.toFloat().toInt() - runOnUiThread { - val progressTip = String.format(tip, progress) - if (materialDialog.isShowing) { - loadFileLayoutBinding.LinearProgressIndicator.progress = progress - loadFileLayoutBinding.tipView.text = progressTip + val fileLoader = FileLoader.getInstantiate(fileLink, targetFile.absolutePath) + fileLoader.download(object : ProgressResponseBody.ResponseProgressListener { + override fun update(bytesRead: Long, contentLength: Long, done: Boolean) { + //计算百分比并更新ProgressBar + val numberFormat = NumberFormat.getNumberInstance() + numberFormat.maximumFractionDigits = 2 + val trueProgress = + numberFormat.format(bytesRead.toDouble() / contentLength.toDouble() * 100) + progress = trueProgress.toFloat().toInt() + runOnUiThread { + val progressTip = String.format(tip, progress) + if (materialDialog.isShowing) { + loadFileLayoutBinding.LinearProgressIndicator.progress = progress + loadFileLayoutBinding.tipView.text = progressTip + } + viewBinding.button.text = progressTip + } } - viewBinding.button.text = progressTip - } + + override fun downloadFail(exception: Exception?) { + if (materialDialog.isShowing) { + materialDialog.dismiss() + } + viewBinding.button.setText(R.string.installation) + } + + override fun downloadSuccess() { + if (materialDialog.isShowing) { + materialDialog.dismiss() + } + viewBinding.button.setText(R.string.installated) + WebMod.instance.addDownloadNum(modId) + } + + }) } - - override fun downloadFail(exception: Exception?) { - if (materialDialog.isShowing) { - materialDialog.dismiss() - } - viewBinding.button.setText(R.string.installation) - } - - override fun downloadSuccess() { - if (materialDialog.isShowing) { - materialDialog.dismiss() - } - viewBinding.button.setText(R.string.installated) - WebMod.instance.addDownloadNum(modId) - } - - }) - + } } /** @@ -419,7 +425,8 @@ class WebModInfoActivity : BaseActivity() { val icon = t.data.headIcon if (icon != null) { Glide.with(this@WebModInfoActivity) - .load(ServerConfiguration.getRealLink(icon)).apply(GlobalMethod.getRequestOptions(true)) + .load(ServerConfiguration.getRealLink(icon)) + .apply(GlobalMethod.getRequestOptions(true)) .into(viewBinding.headIconView) } viewBinding.userNameView.text = t.data.userName diff --git a/app/src/main/java/com/coldmint/rust/pro/adapters/CompileLogAdapter.kt b/app/src/main/java/com/coldmint/rust/pro/adapters/CompileLogAdapter.kt index 9e6bb70..63d9b78 100644 --- a/app/src/main/java/com/coldmint/rust/pro/adapters/CompileLogAdapter.kt +++ b/app/src/main/java/com/coldmint/rust/pro/adapters/CompileLogAdapter.kt @@ -35,7 +35,7 @@ class CompileLogAdapter(val context: Context, analysisResults: MutableList() { ) { executorService.submit { val targetFile = modClass.modFile + val errorFolder = + File(AppSettings.dataRootDirectory + "/modErrorReport/" + modClass.modName) + if (errorFolder.exists()) { + FileOperator.delete_files(errorFolder) + } val dataBasePath = if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.N) { requireActivity().applicationContext.dataDir.absolutePath + "/databases/" } else { diff --git a/assistantCoreLibrary/src/main/java/com/coldmint/rust/core/AnalysisResult.kt b/assistantCoreLibrary/src/main/java/com/coldmint/rust/core/AnalysisResult.kt index c95fdb0..8af0bac 100644 --- a/assistantCoreLibrary/src/main/java/com/coldmint/rust/core/AnalysisResult.kt +++ b/assistantCoreLibrary/src/main/java/com/coldmint/rust/core/AnalysisResult.kt @@ -13,7 +13,8 @@ import com.coldmint.rust.core.dataBean.CompileConfiguration * @constructor */ data class AnalysisResult( - val text: String, + val lineData: String, + val errorInfo: String, var icon: Drawable? = null, var function: ((View) -> Unit)? = null, val errorType: CompileConfiguration.ErrorType diff --git a/assistantCoreLibrary/src/main/java/com/coldmint/rust/core/dataBean/CompileConfiguration.kt b/assistantCoreLibrary/src/main/java/com/coldmint/rust/core/dataBean/CompileConfiguration.kt index c90f1c2..d770a44 100644 --- a/assistantCoreLibrary/src/main/java/com/coldmint/rust/core/dataBean/CompileConfiguration.kt +++ b/assistantCoreLibrary/src/main/java/com/coldmint/rust/core/dataBean/CompileConfiguration.kt @@ -33,8 +33,10 @@ data class CompileConfiguration( private val arrayList: ArrayList = ArrayList(), private val errorIcon: Drawable? = context.getDrawable(R.drawable.error), private val warningIcon: Drawable? = context.getDrawable(R.drawable.warning), + private val lineData: StringBuilder = StringBuilder(), //错误记录映射记录表() - private var errorRecordMap: HashMap? = null + private + var errorRecordMap: HashMap? = null ) { @@ -54,9 +56,12 @@ data class CompileConfiguration( when (codeBlockType) { CodeBlockType.Key -> { keyBuilder.append(string) + lineData.append(string) + lineData.append(':') } CodeBlockType.Value -> { valueBuilder.append(string) + lineData.append(string) } } } @@ -74,6 +79,14 @@ data class CompileConfiguration( } } + /** + * 获取行内容 + * @return String + */ + fun getLineData(): String { + return lineData.toString() + } + /** * 获取Value @@ -123,7 +136,7 @@ data class CompileConfiguration( val info: String, var function: ((View) -> Unit)? = null, val errorType: ErrorType = ErrorType.Warning, - var verifyFunction: ((CompileConfiguration) -> Boolean)? = null + var verifyFunction: ((CompileConfiguration) -> Boolean)? = null, ) @@ -180,6 +193,7 @@ data class CompileConfiguration( if (!canAddError) { arrayList.add( AnalysisResult( + getLineData(), "程序错误:未经许可的方法被调用。$errorRecord", errorIcon, errorType = ErrorType.General ) @@ -192,7 +206,11 @@ data class CompileConfiguration( line + 1 ) val analysisResult = - AnalysisResult(location + errorRecord.info, errorType = errorRecord.errorType) + AnalysisResult( + getLineData(), + location + errorRecord.info, + errorType = errorRecord.errorType + ) analysisResult.function = errorRecord.function when (errorRecord.errorType) { ErrorType.Error -> { @@ -218,7 +236,7 @@ data class CompileConfiguration( * @param string String */ fun addInfo(string: String) { - val analysisResult = AnalysisResult(string, errorType = ErrorType.General) + val analysisResult = AnalysisResult(getLineData(), string, errorType = ErrorType.General) arrayList.add(analysisResult) } @@ -247,6 +265,7 @@ data class CompileConfiguration( codeBlockType = CodeBlockType.Key keyBuilder.clear() valueBuilder.clear() + lineData.clear() } /** diff --git a/assistantCoreLibrary/src/main/java/com/coldmint/rust/core/web/ActivationApp.kt b/assistantCoreLibrary/src/main/java/com/coldmint/rust/core/web/ActivationApp.kt index 3733993..ef76a34 100644 --- a/assistantCoreLibrary/src/main/java/com/coldmint/rust/core/web/ActivationApp.kt +++ b/assistantCoreLibrary/src/main/java/com/coldmint/rust/core/web/ActivationApp.kt @@ -2,6 +2,7 @@ package com.coldmint.rust.core.web import android.os.Handler import android.os.Looper +import android.util.Log import com.coldmint.rust.core.dataBean.ApiResponse import com.coldmint.rust.core.dataBean.OrderDataBean import com.coldmint.rust.core.dataBean.OrderListDataBean @@ -59,6 +60,7 @@ class ActivationApp private constructor() { override fun onResponse(call: Call, response: Response) { try { val data = response.body!!.string() + Log.d("确认订单", data) val finalApiResponse = gson.fromJson(data, ApiResponse::class.java) handler.post {