制作分享功能
This commit is contained in:
parent
b3385adf4a
commit
c044de7906
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
|
@ -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"
|
||||
}
|
||||
|
|
|
@ -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"
|
||||
}
|
||||
],
|
||||
|
|
|
@ -24,6 +24,9 @@
|
|||
android:supportsRtl="true"
|
||||
android:theme="@style/Theme.rust.Concept"
|
||||
android:usesCleartextTraffic="true">
|
||||
<activity
|
||||
android:name=".FeedbackActivity"
|
||||
android:exported="false" />
|
||||
<activity
|
||||
android:name=".ChangePasswordActivity"
|
||||
android:exported="false" />
|
||||
|
|
|
@ -29,7 +29,6 @@ import java.text.SimpleDateFormat
|
|||
import java.util.*
|
||||
|
||||
class ErrorActivity() : BaseActivity<ActivityErrorBinding>() {
|
||||
private lateinit var logFile: File
|
||||
private val errorInfo by lazy {
|
||||
ErrorInfo()
|
||||
}
|
||||
|
@ -109,14 +108,13 @@ class ErrorActivity() : BaseActivity<ActivityErrorBinding>() {
|
|||
* 创建错误日志
|
||||
*/
|
||||
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<ActivityErrorBinding>() {
|
|||
)
|
||||
.show()
|
||||
} else {
|
||||
FileOperator.shareFile(this@ErrorActivity, logFile)
|
||||
FileOperator.shareFile(this@ErrorActivity, errorInfo.getLogFile())
|
||||
}
|
||||
})
|
||||
|
||||
|
|
19
app/src/main/java/com/coldmint/rust/pro/FeedbackActivity.kt
Normal file
19
app/src/main/java/com/coldmint/rust/pro/FeedbackActivity.kt
Normal file
|
@ -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<ActivityFeedbackBinding>() {
|
||||
|
||||
override fun whenCreateActivity(savedInstanceState: Bundle?, canUseView: Boolean) {
|
||||
setReturnButton()
|
||||
title = getString(R.string.feedback)
|
||||
}
|
||||
|
||||
override fun getViewBindingObject(layoutInflater: LayoutInflater): ActivityFeedbackBinding {
|
||||
return ActivityFeedbackBinding.inflate(layoutInflater)
|
||||
}
|
||||
}
|
|
@ -701,7 +701,19 @@ class FileManagerActivity : BaseActivity<ActivityFileBinding>() {
|
|||
}.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)
|
||||
|
|
|
@ -18,19 +18,21 @@ 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
|
||||
) {
|
||||
|
||||
|
||||
/**
|
||||
* 保存ErrorInfo
|
||||
* @return Boolean
|
||||
* 获取Log文件
|
||||
* @return String
|
||||
*/
|
||||
fun save(): Boolean {
|
||||
fun getLogFile(): File {
|
||||
if (logFile == null)
|
||||
{
|
||||
val filePath = StringBuilder()
|
||||
filePath.append(AppSettings.dataRootDirectory)
|
||||
filePath.append("/carsh/")
|
||||
|
@ -46,8 +48,18 @@ data class ErrorInfo(
|
|||
val fileName = dateFormat.format(nowTime)
|
||||
filePath.append(fileName)
|
||||
filePath.append(".log")
|
||||
logFile = File(filePath.toString())
|
||||
}
|
||||
return logFile!!
|
||||
}
|
||||
|
||||
/**
|
||||
* 保存ErrorInfo
|
||||
* @return Boolean
|
||||
*/
|
||||
fun save(): Boolean {
|
||||
val gson = Gson()
|
||||
val logFile = File(filePath.toString())
|
||||
val logFile = getLogFile()
|
||||
return FileOperator.writeFile(logFile, gson.toJson(this))
|
||||
}
|
||||
|
||||
|
|
|
@ -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"
|
||||
|
|
|
@ -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<String>()
|
||||
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<String> {
|
||||
return listOf<String>(
|
||||
".ini", ".txt", ".template"
|
||||
)
|
||||
return dataList
|
||||
}
|
||||
|
||||
override fun getSymbol(): Char {
|
||||
|
|
|
@ -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")
|
||||
|
||||
}
|
||||
|
||||
|
|
9
app/src/main/res/layout/activity_feedback.xml
Normal file
9
app/src/main/res/layout/activity_feedback.xml
Normal file
|
@ -0,0 +1,9 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
tools:context=".FeedbackActivity">
|
||||
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
|
@ -933,5 +933,8 @@
|
|||
<string name="simple_display_of_auto_complete_menu">简版自动完成菜单</string>
|
||||
<string name="search_key">搜索关键字</string>
|
||||
<string name="share_mod_msg">我分享模组了 %1$s,下载链接:%2$s\n下载铁锈助手即可参与评论,给作品投币。App下载链接:%3$s</string>
|
||||
<string name="setting_source_file_type" translatable="false">sourceFileType</string>
|
||||
<string name="setting_source_file_type_title">源文件类型</string>
|
||||
<string name="setting_source_file_type_describe">配置源文件类型,符合配置格式的文件将以文本编辑形式打开。以逗号分割不同格式。</string>
|
||||
|
||||
</resources>
|
|
@ -53,6 +53,14 @@
|
|||
app:key="@string/setting_file_sort_type"
|
||||
app:title="@string/file_sort_type"
|
||||
app:useSimpleSummaryProvider="true" />
|
||||
|
||||
<EditTextPreference
|
||||
app:key="@string/setting_source_file_type"
|
||||
app:title="@string/setting_source_file_type_title"
|
||||
android:summary="@string/setting_source_file_type_describe"
|
||||
app:useSimpleSummaryProvider="true" />
|
||||
|
||||
|
||||
</PreferenceCategory>
|
||||
|
||||
<PreferenceCategory android:title="@string/data_transfer">
|
||||
|
|
|
@ -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)
|
||||
|
|
|
@ -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(
|
||||
|
|
Loading…
Reference in New Issue
Block a user