修复一些崩溃问题,兼容免登录模式。
This commit is contained in:
parent
cfc3188373
commit
67d157a555
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.
|
@ -30,9 +30,9 @@ android {
|
||||||
defaultConfig {
|
defaultConfig {
|
||||||
applicationId "com.coldmint.rust.pro"
|
applicationId "com.coldmint.rust.pro"
|
||||||
minSdkVersion 21
|
minSdkVersion 21
|
||||||
targetSdkVersion 32
|
targetSdkVersion 33
|
||||||
versionCode 23
|
versionCode 24
|
||||||
versionName "2.1 Bata1_patch6(2022-10-1)"
|
versionName "2.1 Bata2(2023-1-14)"
|
||||||
|
|
||||||
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
|
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
|
||||||
}
|
}
|
||||||
|
|
|
@ -54,14 +54,13 @@ class AboutActivity : BaseActivity<ActivityAboutBinding>() {
|
||||||
|<p>《铁锈助手》2.0版本,用零零散散的时间开发了1年。开发语言以及开发环境都特别的正式了。</p>
|
|<p>《铁锈助手》2.0版本,用零零散散的时间开发了1年。开发语言以及开发环境都特别的正式了。</p>
|
||||||
|<p>环境移到了电脑上使用《Android Studio》开发,开发语言也从java迁移至了Kotlin。</p>
|
|<p>环境移到了电脑上使用《Android Studio》开发,开发语言也从java迁移至了Kotlin。</p>
|
||||||
|
|
|
|
||||||
|<p>为了安全使用了加固。</p>
|
|
||||||
|
|
|
|
||||||
|
|
|
|
||||||
""".trimMargin()
|
""".trimMargin()
|
||||||
viewBinding.aboutView.text = Html.fromHtml(aboutText)
|
viewBinding.aboutView.text = Html.fromHtml(aboutText)
|
||||||
val time = AppSettings.getValue(com.coldmint.rust.pro.tool.AppSettings.Setting.ExpirationTime, 0.toLong())
|
val time = AppSettings.getValue(com.coldmint.rust.pro.tool.AppSettings.Setting.ExpirationTime, 0.toLong())
|
||||||
if (time == 0.toLong()) {
|
if (time == 0.toLong()) {
|
||||||
viewBinding.expirationTimeView.text = getString(R.string.please_login_first)
|
viewBinding.expirationTimeView.text = getString(R.string.tourist_pattern)
|
||||||
} else {
|
} else {
|
||||||
val stringTime = ServerConfiguration.toStringTime(time)
|
val stringTime = ServerConfiguration.toStringTime(time)
|
||||||
viewBinding.expirationTimeView.text =
|
viewBinding.expirationTimeView.text =
|
||||||
|
|
|
@ -9,6 +9,7 @@ import androidx.activity.result.ActivityResultLauncher
|
||||||
import androidx.activity.result.contract.ActivityResultContracts
|
import androidx.activity.result.contract.ActivityResultContracts
|
||||||
import androidx.recyclerview.widget.LinearLayoutManager
|
import androidx.recyclerview.widget.LinearLayoutManager
|
||||||
import androidx.recyclerview.widget.RecyclerView
|
import androidx.recyclerview.widget.RecyclerView
|
||||||
|
import com.coldmint.rust.core.debug.LogCat
|
||||||
import com.coldmint.rust.pro.adapters.GuideAdapter
|
import com.coldmint.rust.pro.adapters.GuideAdapter
|
||||||
import com.coldmint.rust.pro.base.BaseActivity
|
import com.coldmint.rust.pro.base.BaseActivity
|
||||||
import com.coldmint.rust.pro.databean.GuideData
|
import com.coldmint.rust.pro.databean.GuideData
|
||||||
|
@ -27,9 +28,9 @@ class CreationWizardActivity : BaseActivity<ActivityCreationWizardBinding>() {
|
||||||
createMod = registerForActivityResult(ActivityResultContracts.StartActivityForResult()) {
|
createMod = registerForActivityResult(ActivityResultContracts.StartActivityForResult()) {
|
||||||
if (it.resultCode == RESULT_OK) {
|
if (it.resultCode == RESULT_OK) {
|
||||||
finish()
|
finish()
|
||||||
Log.d("创建单位", "收到了数据,关闭界面。")
|
LogCat.d("创建单位", "收到了数据,关闭界面。")
|
||||||
} else {
|
} else {
|
||||||
Log.d("创建单位", "没有收到数据。")
|
LogCat.d("创建单位", "没有收到数据。")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
val temType = intent.getStringExtra("type")
|
val temType = intent.getStringExtra("type")
|
||||||
|
|
|
@ -116,11 +116,11 @@ class EditModInfoActivity : BaseActivity<ActivityEditModInfoBinding>() {
|
||||||
if (description != null) {
|
if (description != null) {
|
||||||
viewBinding.modDescribeEdit.setText(description)
|
viewBinding.modDescribeEdit.setText(description)
|
||||||
}
|
}
|
||||||
val bitmap = mModClass.modIcon
|
val modIcon = mModClass.modIcon
|
||||||
if (bitmap == null) {
|
if (modIcon == null) {
|
||||||
loadDefaultImage()
|
loadDefaultImage()
|
||||||
} else {
|
} else {
|
||||||
Glide.with(this@EditModInfoActivity).load(bitmap)
|
Glide.with(this@EditModInfoActivity).load(modIcon)
|
||||||
.apply(GlobalMethod.getRequestOptions()).into(viewBinding.iconView)
|
.apply(GlobalMethod.getRequestOptions()).into(viewBinding.iconView)
|
||||||
mNeedIcon = true
|
mNeedIcon = true
|
||||||
}
|
}
|
||||||
|
|
|
@ -14,6 +14,7 @@ import android.view.MenuItem
|
||||||
import android.view.View
|
import android.view.View
|
||||||
import androidx.core.view.isVisible
|
import androidx.core.view.isVisible
|
||||||
import com.coldmint.rust.core.dataBean.ApiResponse
|
import com.coldmint.rust.core.dataBean.ApiResponse
|
||||||
|
import com.coldmint.rust.core.debug.LogCat
|
||||||
import com.coldmint.rust.core.interfaces.ApiCallBack
|
import com.coldmint.rust.core.interfaces.ApiCallBack
|
||||||
import com.coldmint.rust.core.tool.FileOperator
|
import com.coldmint.rust.core.tool.FileOperator
|
||||||
import com.coldmint.rust.core.web.ErrorReport
|
import com.coldmint.rust.core.web.ErrorReport
|
||||||
|
@ -51,7 +52,7 @@ class ErrorActivity() : BaseActivity<ActivityErrorBinding>() {
|
||||||
errorInfo.activityLog = CustomActivityOnCrash.getActivityLogFromIntent(intent)
|
errorInfo.activityLog = CustomActivityOnCrash.getActivityLogFromIntent(intent)
|
||||||
}
|
}
|
||||||
viewBinding.errorInfo.text = errorInfo.allErrorDetails
|
viewBinding.errorInfo.text = errorInfo.allErrorDetails
|
||||||
Log.e("错误日志", errorInfo.allErrorDetails)
|
LogCat.e("错误日志", errorInfo.allErrorDetails)
|
||||||
if (AppSettings.getValue(AppSettings.Setting.ExperiencePlan, true)) {
|
if (AppSettings.getValue(AppSettings.Setting.ExperiencePlan, true)) {
|
||||||
val info = packageManager.getPackageInfo(packageName, 0)
|
val info = packageManager.getPackageInfo(packageName, 0)
|
||||||
ErrorReport.instance.send(
|
ErrorReport.instance.send(
|
||||||
|
|
|
@ -697,13 +697,15 @@ class FileManagerActivity : BaseActivity<ActivityFileBinding>() {
|
||||||
}.setGestureInsetBottomIgnored(true).show()
|
}.setGestureInsetBottomIgnored(true).show()
|
||||||
} else if (viewModel.startTypeData == FileManagerViewModel.StartType.DEFAULT) {
|
} else if (viewModel.startTypeData == FileManagerViewModel.StartType.DEFAULT) {
|
||||||
val type = FileOperator.getFileType(file)
|
val type = FileOperator.getFileType(file)
|
||||||
val data = AppSettings.getValue(AppSettings.Setting.SourceFileType,"ini,template")
|
val data = AppSettings.getValue(
|
||||||
|
AppSettings.Setting.SourceFileType,
|
||||||
|
"ini,template"
|
||||||
|
)
|
||||||
val line = LineParser(data)
|
val line = LineParser(data)
|
||||||
var isSourceFile = false
|
var isSourceFile = false
|
||||||
line.symbol = ","
|
line.symbol = ","
|
||||||
line.analyse { lineNum, lineData, isEnd ->
|
line.analyse { lineNum, lineData, isEnd ->
|
||||||
if (type == lineData)
|
if (type == lineData) {
|
||||||
{
|
|
||||||
isSourceFile = true
|
isSourceFile = true
|
||||||
return@analyse false
|
return@analyse false
|
||||||
}
|
}
|
||||||
|
@ -852,7 +854,13 @@ class FileManagerActivity : BaseActivity<ActivityFileBinding>() {
|
||||||
return@observe
|
return@observe
|
||||||
}
|
}
|
||||||
val root = getString(R.string.root_path)
|
val root = getString(R.string.root_path)
|
||||||
val path = root + it.substring(viewModel.getRootPath().length)
|
val rootLength = viewModel.getRootPath().length
|
||||||
|
val nowLength = it.length
|
||||||
|
val path = if (rootLength < nowLength) {
|
||||||
|
root + it.substring(rootLength)
|
||||||
|
}else{
|
||||||
|
it
|
||||||
|
}
|
||||||
val lineParser = LineParser(path)
|
val lineParser = LineParser(path)
|
||||||
lineParser.symbol = "/"
|
lineParser.symbol = "/"
|
||||||
lineParser.parserSymbol = true
|
lineParser.parserSymbol = true
|
||||||
|
|
|
@ -21,6 +21,7 @@ import com.coldmint.dialog.InputDialog
|
||||||
import com.coldmint.rust.core.dataBean.ApiResponse
|
import com.coldmint.rust.core.dataBean.ApiResponse
|
||||||
import com.coldmint.rust.core.dataBean.LoginRequestData
|
import com.coldmint.rust.core.dataBean.LoginRequestData
|
||||||
import com.coldmint.rust.core.dataBean.user.UserData
|
import com.coldmint.rust.core.dataBean.user.UserData
|
||||||
|
import com.coldmint.rust.core.debug.LogCat
|
||||||
import com.coldmint.rust.core.interfaces.ApiCallBack
|
import com.coldmint.rust.core.interfaces.ApiCallBack
|
||||||
import com.coldmint.rust.core.web.ServerConfiguration
|
import com.coldmint.rust.core.web.ServerConfiguration
|
||||||
import com.coldmint.rust.core.web.User
|
import com.coldmint.rust.core.web.User
|
||||||
|
@ -41,7 +42,7 @@ class LoginActivity : BaseActivity<ActivityLoginBinding>() {
|
||||||
// transparentStatusBar().statusBarDarkFont(true)
|
// transparentStatusBar().statusBarDarkFont(true)
|
||||||
// .transparentNavigationBar().navigationBarDarkIcon(true)
|
// .transparentNavigationBar().navigationBarDarkIcon(true)
|
||||||
// }
|
// }
|
||||||
Log.d("应用识别码", AppSettings.getValue(AppSettings.Setting.AppID, "无"))
|
LogCat.d("应用识别码", AppSettings.getValue(AppSettings.Setting.AppID, "无"))
|
||||||
viewBinding.changeServerView.isVisible = BuildConfig.DEBUG
|
viewBinding.changeServerView.isVisible = BuildConfig.DEBUG
|
||||||
viewBinding.changePasswordView.setOnClickListener {
|
viewBinding.changePasswordView.setOnClickListener {
|
||||||
val intent = Intent(this, ChangePasswordActivity::class.java)
|
val intent = Intent(this, ChangePasswordActivity::class.java)
|
||||||
|
|
|
@ -30,6 +30,7 @@ import com.coldmint.rust.core.CompressionManager
|
||||||
import com.coldmint.rust.core.LocalTemplatePackage
|
import com.coldmint.rust.core.LocalTemplatePackage
|
||||||
import com.coldmint.rust.core.dataBean.AppUpdateData
|
import com.coldmint.rust.core.dataBean.AppUpdateData
|
||||||
import com.coldmint.rust.core.dataBean.template.TemplateInfo
|
import com.coldmint.rust.core.dataBean.template.TemplateInfo
|
||||||
|
import com.coldmint.rust.core.debug.LogCat
|
||||||
import com.coldmint.rust.core.interfaces.ApiCallBack
|
import com.coldmint.rust.core.interfaces.ApiCallBack
|
||||||
import com.coldmint.rust.core.interfaces.UnzipListener
|
import com.coldmint.rust.core.interfaces.UnzipListener
|
||||||
import com.coldmint.rust.core.tool.*
|
import com.coldmint.rust.core.tool.*
|
||||||
|
@ -150,7 +151,7 @@ class MainActivity : BaseActivity<ActivityMainBinding>() {
|
||||||
fun ifNeedShowUpdate(data: AppUpdateData.Data) {
|
fun ifNeedShowUpdate(data: AppUpdateData.Data) {
|
||||||
val key = "应用更新"
|
val key = "应用更新"
|
||||||
if (ServerConfiguration.isTestServer()) {
|
if (ServerConfiguration.isTestServer()) {
|
||||||
Log.w(key, "当前为本地测试服务器,已禁用更新检查。")
|
LogCat.w(key, "当前为本地测试服务器,已禁用更新检查。")
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
val executorService = Executors.newSingleThreadExecutor()
|
val executorService = Executors.newSingleThreadExecutor()
|
||||||
|
@ -160,34 +161,15 @@ class MainActivity : BaseActivity<ActivityMainBinding>() {
|
||||||
val checkBetaUpdate =
|
val checkBetaUpdate =
|
||||||
AppSettings.getValue(AppSettings.Setting.CheckBetaUpdate, false)
|
AppSettings.getValue(AppSettings.Setting.CheckBetaUpdate, false)
|
||||||
var needShowDialog = false
|
var needShowDialog = false
|
||||||
//如果自身是Beta版,则强制更新Beta版本
|
if (data.versionNumber > packageInfo.versionCode) {
|
||||||
if (BuildConfig.DEBUG && packageInfo.versionName.contains("Beta")) {
|
if (data.isBeta) {
|
||||||
data.forced = true
|
if (checkBetaUpdate) {
|
||||||
//版本名不一致,是Beta模式
|
|
||||||
if (packageInfo.versionName != data.versionName) {
|
|
||||||
needShowDialog = true
|
needShowDialog = true
|
||||||
Log.d(key, "是测试模式,版本名称不一致")
|
|
||||||
} else {
|
|
||||||
Log.d(key, "是测试模式,并且是Beta版本")
|
|
||||||
}
|
}
|
||||||
} else if (checkBetaUpdate) {
|
} else {
|
||||||
//版本名不一致
|
|
||||||
if (packageInfo.versionName != data.versionName) {
|
|
||||||
needShowDialog = true
|
needShowDialog = true
|
||||||
Log.d(key, "开启了检查Beta版本,版本名称不一致")
|
|
||||||
} else {
|
|
||||||
Log.d(key, "开启了检查Beta版本,无需更新")
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
//版本号不一致
|
|
||||||
if (packageInfo.versionCode != data.versionNumber) {
|
|
||||||
needShowDialog = true
|
|
||||||
Log.d(key, "正式打包模式,版本号不一致")
|
|
||||||
} else {
|
|
||||||
Log.d(key, "正式打包模式,版本号一致无需更新")
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!needShowDialog) {
|
if (!needShowDialog) {
|
||||||
return@submit
|
return@submit
|
||||||
}
|
}
|
||||||
|
@ -392,22 +374,33 @@ class MainActivity : BaseActivity<ActivityMainBinding>() {
|
||||||
AppSettings.Setting.ExpirationTime,
|
AppSettings.Setting.ExpirationTime,
|
||||||
0.toLong()
|
0.toLong()
|
||||||
)
|
)
|
||||||
|
val loginStatus = AppSettings.getValue(
|
||||||
|
AppSettings.Setting.LoginStatus,
|
||||||
|
false
|
||||||
|
)
|
||||||
|
val activationItem = menu.findItem(R.id.activation_item)
|
||||||
|
if (loginStatus) {
|
||||||
val time = ServerConfiguration.toStringTime(
|
val time = ServerConfiguration.toStringTime(
|
||||||
longTime
|
longTime
|
||||||
)
|
)
|
||||||
val activationItem = menu.findItem(R.id.activation_item)
|
|
||||||
if (time == ServerConfiguration.ForeverTime) {
|
if (time == ServerConfiguration.ForeverTime) {
|
||||||
activationItem.isVisible = false
|
activationItem.isVisible = false
|
||||||
} else {
|
} else {
|
||||||
activationItem.isVisible = true
|
activationItem.isVisible = true
|
||||||
if (isActive) {
|
if (isActive) {
|
||||||
activationItem.title = getText(R.string.renewal)
|
activationItem.title = getText(R.string.renewal)
|
||||||
|
} else {
|
||||||
|
activationItem.title = getText(R.string.activate)
|
||||||
}
|
}
|
||||||
activationItem.setOnMenuItemClickListener {
|
activationItem.setOnMenuItemClickListener {
|
||||||
startActivity(Intent(this, ActivateActivity::class.java))
|
startActivity(Intent(this, ActivateActivity::class.java))
|
||||||
false
|
false
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
} else {
|
||||||
|
activationItem.isVisible = false
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun onActivityResult(requestCode: Int, resultCode: Int, data: Intent?) {
|
override fun onActivityResult(requestCode: Int, resultCode: Int, data: Intent?) {
|
||||||
|
@ -653,9 +646,7 @@ class MainActivity : BaseActivity<ActivityMainBinding>() {
|
||||||
|
|
||||||
startViewModel.needLoginLiveData.observe(this) {
|
startViewModel.needLoginLiveData.observe(this) {
|
||||||
if (it) {
|
if (it) {
|
||||||
Glide.with(this).load(R.drawable.head_icon)
|
headLayout.imageView.setImageResource(R.drawable.head_icon)
|
||||||
.apply(GlobalMethod.getRequestOptions(true, grayscale = false))
|
|
||||||
.into(headLayout.imageView)
|
|
||||||
headLayout.nameView.text = getString(R.string.click_profile_picture_login)
|
headLayout.nameView.text = getString(R.string.click_profile_picture_login)
|
||||||
headLayout.emailView.text = ""
|
headLayout.emailView.text = ""
|
||||||
headLayout.imageView.setOnClickListener {
|
headLayout.imageView.setOnClickListener {
|
||||||
|
|
|
@ -25,6 +25,7 @@ import android.view.MenuItem
|
||||||
import androidx.core.view.isVisible
|
import androidx.core.view.isVisible
|
||||||
import com.coldmint.dialog.CoreDialog
|
import com.coldmint.dialog.CoreDialog
|
||||||
import com.coldmint.rust.core.dataBean.OrderDataBean
|
import com.coldmint.rust.core.dataBean.OrderDataBean
|
||||||
|
import com.coldmint.rust.core.debug.LogCat
|
||||||
import com.coldmint.rust.core.interfaces.ApiCallBack
|
import com.coldmint.rust.core.interfaces.ApiCallBack
|
||||||
import com.coldmint.rust.core.tool.AppOperator
|
import com.coldmint.rust.core.tool.AppOperator
|
||||||
import com.coldmint.rust.core.tool.FileOperator
|
import com.coldmint.rust.core.tool.FileOperator
|
||||||
|
@ -241,7 +242,7 @@ class PayActivity : BaseActivity<ActivityPayBinding>() {
|
||||||
timeBuilder.append("秒")
|
timeBuilder.append("秒")
|
||||||
}
|
}
|
||||||
setMoney(timeBuilder.toString(), t.data.price)
|
setMoney(timeBuilder.toString(), t.data.price)
|
||||||
Log.d("秒", timeBuilder.toString())
|
LogCat.d("秒", timeBuilder.toString())
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun onFinish() {
|
override fun onFinish() {
|
||||||
|
|
|
@ -5,13 +5,18 @@ import android.content.Context
|
||||||
import android.os.Environment
|
import android.os.Environment
|
||||||
import android.util.Log
|
import android.util.Log
|
||||||
import cat.ereza.customactivityoncrash.config.CaocConfig
|
import cat.ereza.customactivityoncrash.config.CaocConfig
|
||||||
|
import com.coldmint.rust.core.debug.LogCat
|
||||||
|
import com.coldmint.rust.core.debug.LogCatObserver
|
||||||
import com.coldmint.rust.core.web.ServerConfiguration
|
import com.coldmint.rust.core.web.ServerConfiguration
|
||||||
import com.coldmint.rust.pro.tool.AppSettings
|
import com.coldmint.rust.pro.tool.AppSettings
|
||||||
import com.coldmint.rust.pro.tool.CompletionItemConverter
|
import com.coldmint.rust.pro.tool.CompletionItemConverter
|
||||||
import com.coldmint.rust.pro.tool.GlobalMethod
|
import com.coldmint.rust.pro.tool.GlobalMethod
|
||||||
import com.google.android.material.color.DynamicColors
|
import com.google.android.material.color.DynamicColors
|
||||||
import com.google.android.material.color.DynamicColorsOptions
|
import com.google.android.material.color.DynamicColorsOptions
|
||||||
|
import com.google.firebase.crashlytics.ktx.crashlytics
|
||||||
|
import com.google.firebase.ktx.Firebase
|
||||||
import com.hjq.language.MultiLanguages
|
import com.hjq.language.MultiLanguages
|
||||||
|
import com.youth.banner.BuildConfig
|
||||||
import java.util.*
|
import java.util.*
|
||||||
|
|
||||||
class RustApplication : Application() {
|
class RustApplication : Application() {
|
||||||
|
@ -30,6 +35,12 @@ class RustApplication : Application() {
|
||||||
)
|
)
|
||||||
}.build()
|
}.build()
|
||||||
DynamicColors.applyToActivitiesIfAvailable(this, options)
|
DynamicColors.applyToActivitiesIfAvailable(this, options)
|
||||||
|
LogCat.attachObserver(object : LogCatObserver{
|
||||||
|
override fun onReceiveLog(msg: String) {
|
||||||
|
Firebase.crashlytics.log(msg)
|
||||||
|
}
|
||||||
|
})
|
||||||
|
LogCat.setEnable(!BuildConfig.DEBUG)
|
||||||
//程序崩溃
|
//程序崩溃
|
||||||
CaocConfig.Builder.create()
|
CaocConfig.Builder.create()
|
||||||
.backgroundMode(CaocConfig.BACKGROUND_MODE_SILENT) //default: CaocConfig.BACKGROUND_MODE_SHOW_CUSTOM
|
.backgroundMode(CaocConfig.BACKGROUND_MODE_SILENT) //default: CaocConfig.BACKGROUND_MODE_SHOW_CUSTOM
|
||||||
|
@ -52,4 +63,6 @@ class RustApplication : Application() {
|
||||||
override fun attachBaseContext(base: Context?) {
|
override fun attachBaseContext(base: Context?) {
|
||||||
super.attachBaseContext(MultiLanguages.attach(base))
|
super.attachBaseContext(MultiLanguages.attach(base))
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
|
@ -30,6 +30,7 @@ import com.coldmint.rust.core.dataBean.ListParserDataBean
|
||||||
import com.coldmint.rust.core.dataBean.template.LocalTemplateFile
|
import com.coldmint.rust.core.dataBean.template.LocalTemplateFile
|
||||||
import com.coldmint.rust.core.dataBean.template.TemplatePackage
|
import com.coldmint.rust.core.dataBean.template.TemplatePackage
|
||||||
import com.coldmint.rust.core.dataBean.template.WebTemplateData
|
import com.coldmint.rust.core.dataBean.template.WebTemplateData
|
||||||
|
import com.coldmint.rust.core.debug.LogCat
|
||||||
import com.coldmint.rust.core.interfaces.ApiCallBack
|
import com.coldmint.rust.core.interfaces.ApiCallBack
|
||||||
import com.coldmint.rust.core.interfaces.TemplateParser
|
import com.coldmint.rust.core.interfaces.TemplateParser
|
||||||
import com.coldmint.rust.core.templateParser.InputParser
|
import com.coldmint.rust.core.templateParser.InputParser
|
||||||
|
@ -140,7 +141,7 @@ class TemplateParserActivity : BaseActivity<ActivityTemplateParserBinding>() {
|
||||||
}
|
}
|
||||||
val isLocal = intent.getBooleanExtra("isLocal", false)
|
val isLocal = intent.getBooleanExtra("isLocal", false)
|
||||||
if (isLocal) {
|
if (isLocal) {
|
||||||
Log.d("模板解析器", "读取本地模板$link")
|
LogCat.d("模板解析器", "读取本地模板$link")
|
||||||
viewModel.setTemplate(LocalTemplateFile(File(link)))
|
viewModel.setTemplate(LocalTemplateFile(File(link)))
|
||||||
val templateParserList = viewModel.getTemplateParserList(this)
|
val templateParserList = viewModel.getTemplateParserList(this)
|
||||||
templateParserList.forEach {
|
templateParserList.forEach {
|
||||||
|
@ -150,7 +151,7 @@ class TemplateParserActivity : BaseActivity<ActivityTemplateParserBinding>() {
|
||||||
viewBinding.nestedScrollView.isVisible = true
|
viewBinding.nestedScrollView.isVisible = true
|
||||||
title = viewModel.getTemplateName(language)
|
title = viewModel.getTemplateName(language)
|
||||||
} else {
|
} else {
|
||||||
Log.d("模板解析器", "加载网络模板$link")
|
LogCat.d("模板解析器", "加载网络模板$link")
|
||||||
TemplatePhp.instance.getTemplate(link, object : ApiCallBack<WebTemplateData> {
|
TemplatePhp.instance.getTemplate(link, object : ApiCallBack<WebTemplateData> {
|
||||||
override fun onResponse(t: WebTemplateData) {
|
override fun onResponse(t: WebTemplateData) {
|
||||||
if (t.code == ServerConfiguration.Success_Code) {
|
if (t.code == ServerConfiguration.Success_Code) {
|
||||||
|
|
|
@ -39,7 +39,7 @@ import com.gyf.immersionbar.ktx.immersionBar
|
||||||
class UserHomePageActivity : BaseActivity<ActivityUserHomePageBinding>() {
|
class UserHomePageActivity : BaseActivity<ActivityUserHomePageBinding>() {
|
||||||
|
|
||||||
lateinit var userId: String
|
lateinit var userId: String
|
||||||
lateinit var account: String
|
var account: String? = null
|
||||||
var userName: String? = null
|
var userName: String? = null
|
||||||
var fans: Int = 0
|
var fans: Int = 0
|
||||||
val userHomeStateAdapter by lazy {
|
val userHomeStateAdapter by lazy {
|
||||||
|
@ -83,10 +83,7 @@ class UserHomePageActivity : BaseActivity<ActivityUserHomePageBinding>() {
|
||||||
}
|
}
|
||||||
|
|
||||||
val temAccount = AppSettings.getValue(AppSettings.Setting.Account, "")
|
val temAccount = AppSettings.getValue(AppSettings.Setting.Account, "")
|
||||||
if (temAccount.isBlank()) {
|
if (temAccount.isNotBlank()) {
|
||||||
showError("请先登录")
|
|
||||||
return
|
|
||||||
} else {
|
|
||||||
account = temAccount
|
account = temAccount
|
||||||
}
|
}
|
||||||
viewBinding.toolbar.title = ""
|
viewBinding.toolbar.title = ""
|
||||||
|
@ -120,10 +117,14 @@ class UserHomePageActivity : BaseActivity<ActivityUserHomePageBinding>() {
|
||||||
* 初始化按钮
|
* 初始化按钮
|
||||||
*/
|
*/
|
||||||
private fun initButton() {
|
private fun initButton() {
|
||||||
|
if (account == null) {
|
||||||
|
viewBinding.button.text = getString(R.string.please_login_first)
|
||||||
|
viewBinding.button.isEnabled = false
|
||||||
|
}else{
|
||||||
if (account == userId) {
|
if (account == userId) {
|
||||||
viewBinding.button.text = getString(R.string.editData)
|
viewBinding.button.text = getString(R.string.editData)
|
||||||
} else {
|
} else {
|
||||||
Community.getFollowState(account, userId, object : ApiCallBack<ApiResponse> {
|
Community.getFollowState(account!!, userId, object : ApiCallBack<ApiResponse> {
|
||||||
override fun onResponse(t: ApiResponse) {
|
override fun onResponse(t: ApiResponse) {
|
||||||
if (t.code == ServerConfiguration.Success_Code) {
|
if (t.code == ServerConfiguration.Success_Code) {
|
||||||
val data = t.data
|
val data = t.data
|
||||||
|
@ -155,7 +156,7 @@ class UserHomePageActivity : BaseActivity<ActivityUserHomePageBinding>() {
|
||||||
|
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -394,7 +395,7 @@ class UserHomePageActivity : BaseActivity<ActivityUserHomePageBinding>() {
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
viewBinding.button.setText(R.string.request_data)
|
viewBinding.button.setText(R.string.request_data)
|
||||||
Community.follow(account, userId, object : ApiCallBack<ApiResponse> {
|
Community.follow(account!!, userId, object : ApiCallBack<ApiResponse> {
|
||||||
override fun onResponse(t: ApiResponse) {
|
override fun onResponse(t: ApiResponse) {
|
||||||
viewBinding.button.setBackgroundColor(
|
viewBinding.button.setBackgroundColor(
|
||||||
GlobalMethod.getColorPrimary(
|
GlobalMethod.getColorPrimary(
|
||||||
|
@ -442,7 +443,7 @@ class UserHomePageActivity : BaseActivity<ActivityUserHomePageBinding>() {
|
||||||
)
|
)
|
||||||
viewBinding.button.setText(R.string.request_data)
|
viewBinding.button.setText(R.string.request_data)
|
||||||
Community.deFollow(
|
Community.deFollow(
|
||||||
account,
|
account!!,
|
||||||
userId,
|
userId,
|
||||||
object : ApiCallBack<ApiResponse> {
|
object : ApiCallBack<ApiResponse> {
|
||||||
override fun onResponse(t: ApiResponse) {
|
override fun onResponse(t: ApiResponse) {
|
||||||
|
|
|
@ -183,6 +183,14 @@ class WebModInfoActivity : BaseActivity<ActivityWebModInfoBinding>() {
|
||||||
override fun onOptionsItemSelected(item: MenuItem): Boolean {
|
override fun onOptionsItemSelected(item: MenuItem): Boolean {
|
||||||
when (item.itemId) {
|
when (item.itemId) {
|
||||||
R.id.report_item -> {
|
R.id.report_item -> {
|
||||||
|
if (token.isBlank()) {
|
||||||
|
Snackbar.make(
|
||||||
|
viewBinding.button,
|
||||||
|
R.string.please_login_first,
|
||||||
|
Snackbar.LENGTH_SHORT
|
||||||
|
).show()
|
||||||
|
return true
|
||||||
|
}
|
||||||
if (adapter.isOpen()) {
|
if (adapter.isOpen()) {
|
||||||
val thisIntent = Intent(this, ReportActivity::class.java)
|
val thisIntent = Intent(this, ReportActivity::class.java)
|
||||||
val bundle = Bundle()
|
val bundle = Bundle()
|
||||||
|
|
|
@ -204,6 +204,9 @@ class FileAdapter( context: Context, dataList: MutableList<File?>) :
|
||||||
|
|
||||||
|
|
||||||
override fun getPopupText(position: Int): String {
|
override fun getPopupText(position: Int): String {
|
||||||
|
if (position >= dataList.size) {
|
||||||
|
return "#"
|
||||||
|
}
|
||||||
val file = dataList[position]
|
val file = dataList[position]
|
||||||
val data = when (sortType) {
|
val data = when (sortType) {
|
||||||
FileManagerViewModel.SortType.BY_NAME -> {
|
FileManagerViewModel.SortType.BY_NAME -> {
|
||||||
|
|
|
@ -6,6 +6,7 @@ import android.text.Editable
|
||||||
import android.text.TextWatcher
|
import android.text.TextWatcher
|
||||||
import android.util.Log
|
import android.util.Log
|
||||||
import android.widget.ArrayAdapter
|
import android.widget.ArrayAdapter
|
||||||
|
import com.coldmint.rust.core.debug.LogCat
|
||||||
import com.coldmint.rust.pro.interfaces.AutoCompleteHelper
|
import com.coldmint.rust.pro.interfaces.AutoCompleteHelper
|
||||||
import com.google.android.material.textfield.MaterialAutoCompleteTextView
|
import com.google.android.material.textfield.MaterialAutoCompleteTextView
|
||||||
|
|
||||||
|
@ -61,7 +62,7 @@ abstract class BaseAppendAutoCompleteHelper(context: Context) : AutoCompleteHelp
|
||||||
if (index > -1) {
|
if (index > -1) {
|
||||||
val end = string.substring(index)
|
val end = string.substring(index)
|
||||||
var num = 0
|
var num = 0
|
||||||
Log.d("附加提示列表", "截取 " + end)
|
LogCat.d("附加提示列表", "截取 " + end)
|
||||||
for (data in mDataList) {
|
for (data in mDataList) {
|
||||||
if (data.startsWith(end)) {
|
if (data.startsWith(end)) {
|
||||||
num++
|
num++
|
||||||
|
@ -70,7 +71,7 @@ abstract class BaseAppendAutoCompleteHelper(context: Context) : AutoCompleteHelp
|
||||||
1
|
1
|
||||||
)
|
)
|
||||||
val value = h1 + h2
|
val value = h1 + h2
|
||||||
Log.d("附加提示列表", "提示 " + h1 + " | " + h2)
|
LogCat.d("附加提示列表", "提示 " + h1 + " | " + h2)
|
||||||
adapter.add(value)
|
adapter.add(value)
|
||||||
}
|
}
|
||||||
if (num == maxNum) {
|
if (num == maxNum) {
|
||||||
|
@ -79,7 +80,7 @@ abstract class BaseAppendAutoCompleteHelper(context: Context) : AutoCompleteHelp
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
var num = 0
|
var num = 0
|
||||||
Log.d("附加提示列表", "没有符号 " + string)
|
LogCat.d("附加提示列表", "没有符号 " + string)
|
||||||
for (email in mDataList) {
|
for (email in mDataList) {
|
||||||
num++
|
num++
|
||||||
adapter.add(string + email)
|
adapter.add(string + email)
|
||||||
|
|
|
@ -194,7 +194,7 @@ class RustAutoComplete(val context: Context) : EnglishMode {
|
||||||
//
|
//
|
||||||
//// val value =
|
//// val value =
|
||||||
//// lineData.subSequence(keyIndex + key.length, lineData.length).toString().trim()
|
//// lineData.subSequence(keyIndex + key.length, lineData.length).toString().trim()
|
||||||
//// Log.d("值", value)
|
//// LogCat.d("值", value)
|
||||||
// //搜索值
|
// //搜索值
|
||||||
// // frontIndex 前面冒号的位置
|
// // frontIndex 前面冒号的位置
|
||||||
// val frontIndex = lineData.lastIndexOf(key, keyIndex - key.length)
|
// val frontIndex = lineData.lastIndexOf(key, keyIndex - key.length)
|
||||||
|
|
|
@ -177,7 +177,7 @@ class CodeAutoCompleteJob : AutoCompleteJob {
|
||||||
|
|
||||||
// val value =
|
// val value =
|
||||||
// lineData.subSequence(keyIndex + key.length, lineData.length).toString().trim()
|
// lineData.subSequence(keyIndex + key.length, lineData.length).toString().trim()
|
||||||
// Log.d("值", value)
|
// LogCat.d("值", value)
|
||||||
//搜索值
|
//搜索值
|
||||||
// frontIndex 前面冒号的位置
|
// frontIndex 前面冒号的位置
|
||||||
val frontIndex = lineData.lastIndexOf(key, keyIndex - key.length)
|
val frontIndex = lineData.lastIndexOf(key, keyIndex - key.length)
|
||||||
|
|
|
@ -36,12 +36,11 @@ class FollowFragment : BaseFragment<FragmentFollowBinding>() {
|
||||||
* 加载视图如果需要更新的话
|
* 加载视图如果需要更新的话
|
||||||
*/
|
*/
|
||||||
fun loadViewIfNeed() {
|
fun loadViewIfNeed() {
|
||||||
val selfAccount = AppSettings.getValue(AppSettings.Setting.Account, "")
|
val loginStatus = AppSettings.getValue(AppSettings.Setting.LoginStatus, false)
|
||||||
if (selfAccount.isBlank()) {
|
if (loginStatus) {
|
||||||
showTip(R.string.please_login_first)
|
val account = AppSettings.getValue(AppSettings.Setting.Account, "")
|
||||||
} else {
|
|
||||||
Community.getUserList(
|
Community.getUserList(
|
||||||
selfAccount,
|
account,
|
||||||
limit = -1,
|
limit = -1,
|
||||||
apiCallBack = object : ApiCallBack<FollowUserListData> {
|
apiCallBack = object : ApiCallBack<FollowUserListData> {
|
||||||
override fun onResponse(t: FollowUserListData) {
|
override fun onResponse(t: FollowUserListData) {
|
||||||
|
@ -110,6 +109,8 @@ class FollowFragment : BaseFragment<FragmentFollowBinding>() {
|
||||||
}
|
}
|
||||||
|
|
||||||
})
|
})
|
||||||
|
} else {
|
||||||
|
showTip(R.string.follow_introduction)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -129,6 +130,9 @@ class FollowFragment : BaseFragment<FragmentFollowBinding>() {
|
||||||
* @param t DynamicItemDataBean
|
* @param t DynamicItemDataBean
|
||||||
*/
|
*/
|
||||||
fun getDynamicSuccess(t: DynamicItemDataBean) {
|
fun getDynamicSuccess(t: DynamicItemDataBean) {
|
||||||
|
if (!isAdded) {
|
||||||
|
return
|
||||||
|
}
|
||||||
val data = t.data?.toMutableList()
|
val data = t.data?.toMutableList()
|
||||||
if (t.code == ServerConfiguration.Success_Code && data != null) {
|
if (t.code == ServerConfiguration.Success_Code && data != null) {
|
||||||
val adapter = DynamicAdapter(requireContext(), data)
|
val adapter = DynamicAdapter(requireContext(), data)
|
||||||
|
|
|
@ -129,6 +129,11 @@ class InsertCoinsFragment(val modId: String) : BaseFragment<FragmentInsertCoinsB
|
||||||
}
|
}
|
||||||
|
|
||||||
fun loadButton() {
|
fun loadButton() {
|
||||||
|
if (token.isBlank()) {
|
||||||
|
viewBinding.tipView.text = getString(R.string.please_login_first)
|
||||||
|
viewBinding.button.isEnabled = false
|
||||||
|
return
|
||||||
|
}
|
||||||
WebMod.instance.getCoinStatus(token, modId, object : ApiCallBack<CoinStatusData> {
|
WebMod.instance.getCoinStatus(token, modId, object : ApiCallBack<CoinStatusData> {
|
||||||
override fun onResponse(t: CoinStatusData) {
|
override fun onResponse(t: CoinStatusData) {
|
||||||
viewBinding.button.isEnabled = !t.data
|
viewBinding.button.isEnabled = !t.data
|
||||||
|
|
|
@ -21,6 +21,7 @@ import com.coldmint.rust.core.LocalTemplatePackage
|
||||||
import com.coldmint.rust.core.dataBean.template.LocalTemplateFile
|
import com.coldmint.rust.core.dataBean.template.LocalTemplateFile
|
||||||
import com.coldmint.rust.core.dataBean.template.Template
|
import com.coldmint.rust.core.dataBean.template.Template
|
||||||
import com.coldmint.rust.core.dataBean.template.TemplatePackage
|
import com.coldmint.rust.core.dataBean.template.TemplatePackage
|
||||||
|
import com.coldmint.rust.core.debug.LogCat
|
||||||
import com.coldmint.rust.core.tool.FileOperator
|
import com.coldmint.rust.core.tool.FileOperator
|
||||||
import com.coldmint.rust.pro.FileManagerActivity
|
import com.coldmint.rust.pro.FileManagerActivity
|
||||||
import com.coldmint.rust.pro.R
|
import com.coldmint.rust.pro.R
|
||||||
|
@ -133,11 +134,11 @@ class InstalledTemplateFragment : BaseFragment<FragmentInstalledTemplateBinding>
|
||||||
startTemplateParserActivity =
|
startTemplateParserActivity =
|
||||||
registerForActivityResult(ActivityResultContracts.StartActivityForResult()) {
|
registerForActivityResult(ActivityResultContracts.StartActivityForResult()) {
|
||||||
if (it.resultCode == Activity.RESULT_OK) {
|
if (it.resultCode == Activity.RESULT_OK) {
|
||||||
Log.d("启动模板解析器", "收到成功回调,关闭界面。")
|
LogCat.d("启动模板解析器", "收到成功回调,关闭界面。")
|
||||||
requireActivity().setResult(AppCompatActivity.RESULT_OK, it.data)
|
requireActivity().setResult(AppCompatActivity.RESULT_OK, it.data)
|
||||||
requireActivity().finish()
|
requireActivity().finish()
|
||||||
} else {
|
} else {
|
||||||
Log.w("启动模板解析器", "未收到有效回调。")
|
LogCat.w("启动模板解析器", "未收到有效回调。")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
viewModel.createPathLiveData.observe(this) {
|
viewModel.createPathLiveData.observe(this) {
|
||||||
|
@ -157,9 +158,9 @@ class InstalledTemplateFragment : BaseFragment<FragmentInstalledTemplateBinding>
|
||||||
)
|
)
|
||||||
if (this::mTemplateAdapter.isInitialized) {
|
if (this::mTemplateAdapter.isInitialized) {
|
||||||
mTemplateAdapter.setCreatePath(it)
|
mTemplateAdapter.setCreatePath(it)
|
||||||
Log.d("创建目录观察者", "模板适配器设置目录为${it}。")
|
LogCat.d("创建目录观察者", "模板适配器设置目录为${it}。")
|
||||||
} else {
|
} else {
|
||||||
Log.e("创建目录观察者", "模板适配器没有设置目录。")
|
LogCat.e("创建目录观察者", "模板适配器没有设置目录。")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
viewModel.setLoadCallBack {
|
viewModel.setLoadCallBack {
|
||||||
|
@ -172,7 +173,7 @@ class InstalledTemplateFragment : BaseFragment<FragmentInstalledTemplateBinding>
|
||||||
viewBinding.expandableList.setAdapter(mTemplateAdapter)
|
viewBinding.expandableList.setAdapter(mTemplateAdapter)
|
||||||
val path = viewModel.createPathLiveData.value.toString()
|
val path = viewModel.createPathLiveData.value.toString()
|
||||||
mTemplateAdapter.setCreatePath(path)
|
mTemplateAdapter.setCreatePath(path)
|
||||||
Log.d("创建目录观察者", "模板适配器设置目录为${path}。")
|
LogCat.d("创建目录观察者", "模板适配器设置目录为${path}。")
|
||||||
}
|
}
|
||||||
viewModel.loadTemplate(requireContext())
|
viewModel.loadTemplate(requireContext())
|
||||||
}
|
}
|
||||||
|
|
|
@ -28,7 +28,7 @@ import com.google.android.material.divider.MaterialDividerItemDecoration
|
||||||
import com.google.android.material.snackbar.Snackbar
|
import com.google.android.material.snackbar.Snackbar
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 模组评论适配器
|
* 模组评论
|
||||||
*/
|
*/
|
||||||
class ModCommentsFragment(val modId: String) : BaseFragment<FragmentModCommentsBinding>() {
|
class ModCommentsFragment(val modId: String) : BaseFragment<FragmentModCommentsBinding>() {
|
||||||
override fun whenViewCreated(inflater: LayoutInflater, savedInstanceState: Bundle?) {
|
override fun whenViewCreated(inflater: LayoutInflater, savedInstanceState: Bundle?) {
|
||||||
|
@ -46,10 +46,13 @@ class ModCommentsFragment(val modId: String) : BaseFragment<FragmentModCommentsB
|
||||||
viewBinding.swipeRefreshLayout.isRefreshing = false
|
viewBinding.swipeRefreshLayout.isRefreshing = false
|
||||||
}
|
}
|
||||||
viewBinding.sendDiscussion.setOnClickListener {
|
viewBinding.sendDiscussion.setOnClickListener {
|
||||||
val account = AppSettings.getValue(AppSettings.Setting.Account, "")
|
val token = AppSettings.getValue(AppSettings.Setting.Token, "")
|
||||||
if (account.isBlank()) {
|
if (token.isBlank()) {
|
||||||
Toast.makeText(requireContext(), R.string.please_login_first, Toast.LENGTH_SHORT)
|
Snackbar.make(
|
||||||
.show()
|
viewBinding.sendDiscussion,
|
||||||
|
R.string.please_login_first,
|
||||||
|
Snackbar.LENGTH_SHORT
|
||||||
|
).show()
|
||||||
return@setOnClickListener
|
return@setOnClickListener
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -58,7 +61,7 @@ class ModCommentsFragment(val modId: String) : BaseFragment<FragmentModCommentsB
|
||||||
.setSubmitFun { button, textInputLayout, s, alertDialog ->
|
.setSubmitFun { button, textInputLayout, s, alertDialog ->
|
||||||
button.isEnabled = false
|
button.isEnabled = false
|
||||||
WebMod.instance.sendComment(
|
WebMod.instance.sendComment(
|
||||||
AppSettings.getValue(AppSettings.Setting.Token, ""),
|
token,
|
||||||
modId,
|
modId,
|
||||||
s,
|
s,
|
||||||
object : ApiCallBack<ApiResponse> {
|
object : ApiCallBack<ApiResponse> {
|
||||||
|
|
|
@ -7,6 +7,7 @@ import android.view.LayoutInflater
|
||||||
import androidx.core.view.isVisible
|
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.bumptech.glide.Glide
|
||||||
import com.coldmint.rust.core.ModClass
|
import com.coldmint.rust.core.ModClass
|
||||||
import com.coldmint.rust.core.dataBean.ModConfigurationData
|
import com.coldmint.rust.core.dataBean.ModConfigurationData
|
||||||
import com.coldmint.rust.core.tool.DebugHelper
|
import com.coldmint.rust.core.tool.DebugHelper
|
||||||
|
@ -303,7 +304,7 @@ class ModFragment : BaseFragment<FragmentModBinding>() {
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
} else {
|
} else {
|
||||||
modDialogBinding.modIcon.setImageBitmap(modClass.modIcon)
|
Glide.with(requireContext()).load(modClass.modIcon).into(modDialogBinding.modIcon)
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
val drawable = context.getDrawable(R.drawable.file)
|
val drawable = context.getDrawable(R.drawable.file)
|
||||||
|
|
|
@ -81,12 +81,11 @@ class RankingFragment : BaseFragment<FragmentRankingBinding>() {
|
||||||
viewBinding.downloadChip.isChecked = true
|
viewBinding.downloadChip.isChecked = true
|
||||||
}
|
}
|
||||||
|
|
||||||
// override fun onResume() {
|
|
||||||
// loadMods()
|
|
||||||
// super.onResume()
|
|
||||||
// }
|
|
||||||
|
|
||||||
fun loadMods() {
|
fun loadMods() {
|
||||||
|
viewBinding.progressBar.isVisible = true
|
||||||
|
viewBinding.textview.isVisible = false
|
||||||
|
viewBinding.swipeRefreshLayout.isVisible = false
|
||||||
WebMod.instance.list(object : ApiCallBack<WebModListData> {
|
WebMod.instance.list(object : ApiCallBack<WebModListData> {
|
||||||
override fun onResponse(t: WebModListData) {
|
override fun onResponse(t: WebModListData) {
|
||||||
if (t.code == ServerConfiguration.Success_Code) {
|
if (t.code == ServerConfiguration.Success_Code) {
|
||||||
|
@ -95,7 +94,6 @@ class RankingFragment : BaseFragment<FragmentRankingBinding>() {
|
||||||
viewBinding.progressBar.isVisible = false
|
viewBinding.progressBar.isVisible = false
|
||||||
viewBinding.textview.isVisible = false
|
viewBinding.textview.isVisible = false
|
||||||
viewBinding.swipeRefreshLayout.isVisible = true
|
viewBinding.swipeRefreshLayout.isVisible = true
|
||||||
// Toast.makeText(requireContext(),"加载"+list.size,Toast.LENGTH_SHORT).show()
|
|
||||||
val adapter = createAdapter(list)
|
val adapter = createAdapter(list)
|
||||||
viewBinding.recyclerView.adapter = adapter
|
viewBinding.recyclerView.adapter = adapter
|
||||||
linearLayoutManager.scrollToPositionWithOffset(
|
linearLayoutManager.scrollToPositionWithOffset(
|
||||||
|
|
|
@ -12,6 +12,7 @@ import com.coldmint.rust.core.LocalTemplatePackage
|
||||||
import com.coldmint.rust.core.dataBean.ApiResponse
|
import com.coldmint.rust.core.dataBean.ApiResponse
|
||||||
import com.coldmint.rust.core.dataBean.WebTemplatePackageListData
|
import com.coldmint.rust.core.dataBean.WebTemplatePackageListData
|
||||||
import com.coldmint.rust.core.dataBean.template.TemplatePackage
|
import com.coldmint.rust.core.dataBean.template.TemplatePackage
|
||||||
|
import com.coldmint.rust.core.debug.LogCat
|
||||||
import com.coldmint.rust.core.interfaces.ApiCallBack
|
import com.coldmint.rust.core.interfaces.ApiCallBack
|
||||||
import com.coldmint.rust.core.tool.FileOperator
|
import com.coldmint.rust.core.tool.FileOperator
|
||||||
import com.coldmint.rust.core.web.TemplatePhp
|
import com.coldmint.rust.core.web.TemplatePhp
|
||||||
|
@ -152,7 +153,7 @@ class SaveTemplateFragment(val name: String, val json: JSONObject) : BottomSheet
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
if (templateDirectory.exists() && templateDirectory.isDirectory) {
|
if (templateDirectory.exists() && templateDirectory.isDirectory) {
|
||||||
Log.d("加载本地模板", "正在读取" + templateDirectory.absolutePath)
|
LogCat.d("加载本地模板", "正在读取" + templateDirectory.absolutePath)
|
||||||
val files = templateDirectory.listFiles()
|
val files = templateDirectory.listFiles()
|
||||||
if (files.isNotEmpty()) {
|
if (files.isNotEmpty()) {
|
||||||
files.forEach {
|
files.forEach {
|
||||||
|
@ -162,19 +163,19 @@ class SaveTemplateFragment(val name: String, val json: JSONObject) : BottomSheet
|
||||||
LocalTemplatePackage(it)
|
LocalTemplatePackage(it)
|
||||||
if (templatePackage.isTemplate) {
|
if (templatePackage.isTemplate) {
|
||||||
list.add(templatePackage)
|
list.add(templatePackage)
|
||||||
Log.w("加载本地模板", "已添加,文件" + it.absolutePath)
|
LogCat.w("加载本地模板", "已添加,文件" + it.absolutePath)
|
||||||
} else {
|
} else {
|
||||||
Log.w("加载本地模板", "文件" + it.absolutePath + "不是模板包")
|
LogCat.w("加载本地模板", "文件" + it.absolutePath + "不是模板包")
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
Log.w("加载本地模板", "文件" + it.absolutePath + "不是文件夹")
|
LogCat.w("加载本地模板", "文件" + it.absolutePath + "不是文件夹")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
Log.w("加载本地模板", "目录" + templateDirectory.absolutePath + "内,没有文件,无法加载。")
|
LogCat.w("加载本地模板", "目录" + templateDirectory.absolutePath + "内,没有文件,无法加载。")
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
Log.e("加载本地模板", "模板目录不存在或不是文件夹" + templateDirectory.absolutePath)
|
LogCat.e("加载本地模板", "模板目录不存在或不是文件夹" + templateDirectory.absolutePath)
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -4,6 +4,7 @@ import android.content.Intent
|
||||||
import android.os.Bundle
|
import android.os.Bundle
|
||||||
import android.view.LayoutInflater
|
import android.view.LayoutInflater
|
||||||
import android.widget.Toast
|
import android.widget.Toast
|
||||||
|
import androidx.core.view.isVisible
|
||||||
import androidx.recyclerview.widget.GridLayoutManager
|
import androidx.recyclerview.widget.GridLayoutManager
|
||||||
import com.bumptech.glide.Glide
|
import com.bumptech.glide.Glide
|
||||||
import com.bumptech.glide.request.RequestOptions
|
import com.bumptech.glide.request.RequestOptions
|
||||||
|
@ -102,8 +103,27 @@ class UserInfoFragment : BaseFragment<FragmentUserInfoBinding>() {
|
||||||
|
|
||||||
override fun onResume() {
|
override fun onResume() {
|
||||||
super.onResume()
|
super.onResume()
|
||||||
|
viewBinding.progressBar.isVisible = true
|
||||||
|
viewBinding.loginLayout.root.isVisible = false
|
||||||
|
viewBinding.contentLayout.isVisible = false
|
||||||
|
val loginStatus = AppSettings.getValue(AppSettings.Setting.LoginStatus, false)
|
||||||
|
if (loginStatus) {
|
||||||
|
viewBinding.progressBar.isVisible = false
|
||||||
|
viewBinding.loginLayout.root.isVisible = false
|
||||||
|
viewBinding.contentLayout.isVisible = true
|
||||||
|
viewBinding.root.isFillViewport = false
|
||||||
|
account = AppSettings.getValue(AppSettings.Setting.Account, "")
|
||||||
|
viewBinding.myHomeView.setOnClickListener {
|
||||||
|
val intent = Intent(
|
||||||
|
requireActivity(),
|
||||||
|
UserHomePageActivity::class.java
|
||||||
|
)
|
||||||
|
intent.putExtra("userId", account)
|
||||||
|
startActivity(
|
||||||
|
intent
|
||||||
|
)
|
||||||
|
}
|
||||||
val token = AppSettings.getValue(AppSettings.Setting.Token, "")
|
val token = AppSettings.getValue(AppSettings.Setting.Token, "")
|
||||||
if (token.isNotBlank()) {
|
|
||||||
User.getUserActivationInfo(token, object : ApiCallBack<ActivationInfo> {
|
User.getUserActivationInfo(token, object : ApiCallBack<ActivationInfo> {
|
||||||
|
|
||||||
override fun onFailure(e: Exception) {
|
override fun onFailure(e: Exception) {
|
||||||
|
@ -126,9 +146,8 @@ class UserInfoFragment : BaseFragment<FragmentUserInfoBinding>() {
|
||||||
}
|
}
|
||||||
viewBinding.coinView.text = String.format(
|
viewBinding.coinView.text = String.format(
|
||||||
getString(
|
getString(
|
||||||
R.string.coin_number,
|
R.string.coin_number
|
||||||
t.data.coinNumber
|
), t.data.coinNumber
|
||||||
)
|
|
||||||
)
|
)
|
||||||
loadRecyclerView(t.data.permission)
|
loadRecyclerView(t.data.permission)
|
||||||
} else {
|
} else {
|
||||||
|
@ -139,24 +158,26 @@ class UserInfoFragment : BaseFragment<FragmentUserInfoBinding>() {
|
||||||
}
|
}
|
||||||
|
|
||||||
})
|
})
|
||||||
|
} else {
|
||||||
|
viewBinding.progressBar.isVisible = false
|
||||||
|
viewBinding.loginLayout.root.isVisible = true
|
||||||
|
viewBinding.contentLayout.isVisible = false
|
||||||
|
viewBinding.root.isFillViewport = true
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun whenViewCreated(inflater: LayoutInflater, savedInstanceState: Bundle?) {
|
override fun whenViewCreated(inflater: LayoutInflater, savedInstanceState: Bundle?) {
|
||||||
account = AppSettings.getValue(AppSettings.Setting.Account, "")
|
|
||||||
viewBinding.myHomeView.setOnClickListener {
|
|
||||||
val intent = Intent(
|
|
||||||
requireActivity(),
|
|
||||||
UserHomePageActivity::class.java
|
|
||||||
)
|
|
||||||
intent.putExtra("userId", account)
|
|
||||||
startActivity(
|
|
||||||
intent
|
|
||||||
)
|
|
||||||
}
|
|
||||||
|
|
||||||
viewBinding.logOutButton.setOnClickListener {
|
viewBinding.logOutButton.setOnClickListener {
|
||||||
AppSettings.setValue(AppSettings.Setting.LoginStatus, false)
|
AppSettings.setValue(AppSettings.Setting.LoginStatus, false)
|
||||||
|
// GlobalMethod.isActive = false
|
||||||
|
AppSettings.setValue(
|
||||||
|
AppSettings.Setting.ExpirationTime,
|
||||||
|
0.toLong()
|
||||||
|
)
|
||||||
|
(requireActivity() as MainActivity).startViewModel.isActivationLiveData.value = false
|
||||||
|
startActivity(Intent(requireContext(), LoginActivity::class.java))
|
||||||
|
}
|
||||||
|
viewBinding.loginLayout.logView.setOnClickListener {
|
||||||
startActivity(Intent(requireContext(), LoginActivity::class.java))
|
startActivity(Intent(requireContext(), LoginActivity::class.java))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -5,6 +5,7 @@ import android.os.Bundle
|
||||||
import android.view.LayoutInflater
|
import android.view.LayoutInflater
|
||||||
import androidx.core.view.isVisible
|
import androidx.core.view.isVisible
|
||||||
import androidx.lifecycle.MutableLiveData
|
import androidx.lifecycle.MutableLiveData
|
||||||
|
import androidx.lifecycle.ViewModelProvider
|
||||||
import com.bumptech.glide.Glide
|
import com.bumptech.glide.Glide
|
||||||
import com.coldmint.rust.core.dataBean.mod.WebModInfoData
|
import com.coldmint.rust.core.dataBean.mod.WebModInfoData
|
||||||
import com.coldmint.rust.core.dataBean.user.SpaceInfoData
|
import com.coldmint.rust.core.dataBean.user.SpaceInfoData
|
||||||
|
@ -21,6 +22,8 @@ import com.coldmint.rust.pro.databinding.FragmentWebModDetailsBinding
|
||||||
import com.coldmint.rust.pro.tool.AppSettings
|
import com.coldmint.rust.pro.tool.AppSettings
|
||||||
import com.coldmint.rust.pro.tool.GlobalMethod
|
import com.coldmint.rust.pro.tool.GlobalMethod
|
||||||
import com.coldmint.rust.pro.tool.TextStyleMaker
|
import com.coldmint.rust.pro.tool.TextStyleMaker
|
||||||
|
import com.coldmint.rust.pro.viewmodel.StartViewModel
|
||||||
|
import com.coldmint.rust.pro.viewmodel.WebModDetailsViewModel
|
||||||
import com.google.android.material.chip.Chip
|
import com.google.android.material.chip.Chip
|
||||||
import com.youth.banner.adapter.BannerImageAdapter
|
import com.youth.banner.adapter.BannerImageAdapter
|
||||||
import com.youth.banner.holder.BannerImageHolder
|
import com.youth.banner.holder.BannerImageHolder
|
||||||
|
@ -29,17 +32,22 @@ import com.youth.banner.indicator.CircleIndicator
|
||||||
/**
|
/**
|
||||||
* 模组详情碎片
|
* 模组详情碎片
|
||||||
*/
|
*/
|
||||||
class WebModDetailsFragment(val modId: String,val modNameLiveData: MutableLiveData<String>) : BaseFragment<FragmentWebModDetailsBinding>() {
|
class WebModDetailsFragment(val modId: String, val modNameLiveData: MutableLiveData<String>) :
|
||||||
private var developer: String? = null
|
BaseFragment<FragmentWebModDetailsBinding>() {
|
||||||
|
private val viewModel: WebModDetailsViewModel by lazy {
|
||||||
|
ViewModelProvider(requireActivity())[WebModDetailsViewModel::class.java]
|
||||||
|
}
|
||||||
|
|
||||||
//此模组是否对外开放
|
|
||||||
private var isOpen = false
|
|
||||||
|
|
||||||
private var link: String? = null
|
|
||||||
|
//Kotlin次构造函数
|
||||||
|
constructor() : this("", MutableLiveData()) {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
fun getLink(): String? {
|
fun getLink(): String? {
|
||||||
return link
|
return viewModel.link
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -47,10 +55,12 @@ class WebModDetailsFragment(val modId: String,val modNameLiveData: MutableLiveDa
|
||||||
* @return Boolean
|
* @return Boolean
|
||||||
*/
|
*/
|
||||||
fun isOpen(): Boolean {
|
fun isOpen(): Boolean {
|
||||||
return isOpen
|
return viewModel.isOpen
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun whenViewCreated(inflater: LayoutInflater, savedInstanceState: Bundle?) {
|
override fun whenViewCreated(inflater: LayoutInflater, savedInstanceState: Bundle?) {
|
||||||
|
viewModel.modId = modId
|
||||||
|
viewModel.modNameLiveData = modNameLiveData
|
||||||
loadInfo()
|
loadInfo()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -62,7 +72,7 @@ class WebModDetailsFragment(val modId: String,val modNameLiveData: MutableLiveDa
|
||||||
fun loadDeveloperInfo(userId: String) {
|
fun loadDeveloperInfo(userId: String) {
|
||||||
User.getSpaceInfo(userId, object : ApiCallBack<SpaceInfoData> {
|
User.getSpaceInfo(userId, object : ApiCallBack<SpaceInfoData> {
|
||||||
override fun onResponse(t: SpaceInfoData) {
|
override fun onResponse(t: SpaceInfoData) {
|
||||||
if (t.code == ServerConfiguration.Success_Code) {
|
if (t.code == ServerConfiguration.Success_Code && isAdded) {
|
||||||
val icon = t.data.headIcon
|
val icon = t.data.headIcon
|
||||||
if (icon != null) {
|
if (icon != null) {
|
||||||
Glide.with(requireContext())
|
Glide.with(requireContext())
|
||||||
|
@ -78,7 +88,6 @@ class WebModDetailsFragment(val modId: String,val modNameLiveData: MutableLiveDa
|
||||||
ServerConfiguration.numberToString(t.data.praise)
|
ServerConfiguration.numberToString(t.data.praise)
|
||||||
)
|
)
|
||||||
viewBinding.userInfoView.text = info
|
viewBinding.userInfoView.text = info
|
||||||
|
|
||||||
viewBinding.cardView.postDelayed({
|
viewBinding.cardView.postDelayed({
|
||||||
viewBinding.cardView.isVisible = true
|
viewBinding.cardView.isVisible = true
|
||||||
viewBinding.openUserSpace.setOnClickListener {
|
viewBinding.openUserSpace.setOnClickListener {
|
||||||
|
@ -122,10 +131,10 @@ class WebModDetailsFragment(val modId: String,val modNameLiveData: MutableLiveDa
|
||||||
WebMod.instance.getInfo(token, modId, object : ApiCallBack<WebModInfoData> {
|
WebMod.instance.getInfo(token, modId, object : ApiCallBack<WebModInfoData> {
|
||||||
override fun onResponse(t: WebModInfoData) {
|
override fun onResponse(t: WebModInfoData) {
|
||||||
if (t.code == ServerConfiguration.Success_Code) {
|
if (t.code == ServerConfiguration.Success_Code) {
|
||||||
developer = t.data.developer
|
viewModel.developer = t.data.developer
|
||||||
modNameLiveData.value = t.data.name
|
modNameLiveData.value = t.data.name
|
||||||
isOpen = t.data.hidden == 0
|
viewModel.isOpen = t.data.hidden == 0
|
||||||
link = t.data.link
|
viewModel.link = t.data.link
|
||||||
viewBinding.loadLayout.isVisible = false
|
viewBinding.loadLayout.isVisible = false
|
||||||
viewBinding.contentLayout.isVisible = true
|
viewBinding.contentLayout.isVisible = true
|
||||||
val icon = t.data.icon
|
val icon = t.data.icon
|
||||||
|
|
|
@ -8,6 +8,7 @@ import com.coldmint.rust.core.dataBean.SubscriptionData
|
||||||
import com.coldmint.rust.core.dataBean.template.LocalTemplateFile
|
import com.coldmint.rust.core.dataBean.template.LocalTemplateFile
|
||||||
import com.coldmint.rust.core.dataBean.template.Template
|
import com.coldmint.rust.core.dataBean.template.Template
|
||||||
import com.coldmint.rust.core.dataBean.template.TemplatePackage
|
import com.coldmint.rust.core.dataBean.template.TemplatePackage
|
||||||
|
import com.coldmint.rust.core.debug.LogCat
|
||||||
import com.coldmint.rust.core.interfaces.ApiCallBack
|
import com.coldmint.rust.core.interfaces.ApiCallBack
|
||||||
import com.coldmint.rust.core.interfaces.FileFinderListener
|
import com.coldmint.rust.core.interfaces.FileFinderListener
|
||||||
import com.coldmint.rust.core.tool.FileFinder2
|
import com.coldmint.rust.core.tool.FileFinder2
|
||||||
|
@ -88,7 +89,7 @@ class InstalledTemplateViewModel : BaseViewModel() {
|
||||||
TemplatePhp.instance.getSubscriptionDataList(token,object :ApiCallBack<SubscriptionData>{
|
TemplatePhp.instance.getSubscriptionDataList(token,object :ApiCallBack<SubscriptionData>{
|
||||||
override fun onResponse(t: SubscriptionData) {
|
override fun onResponse(t: SubscriptionData) {
|
||||||
if (t.code == ServerConfiguration.Success_Code){
|
if (t.code == ServerConfiguration.Success_Code){
|
||||||
Log.d("加载网络订阅模板", "正在处理。")
|
LogCat.d("加载网络订阅模板", "正在处理。")
|
||||||
t.data.forEach {
|
t.data.forEach {
|
||||||
groupList.add(it)
|
groupList.add(it)
|
||||||
val temList = ArrayList<Template>()
|
val temList = ArrayList<Template>()
|
||||||
|
@ -100,7 +101,7 @@ class InstalledTemplateViewModel : BaseViewModel() {
|
||||||
loadLocalTemplate(context)
|
loadLocalTemplate(context)
|
||||||
loadCallBack?.invoke()
|
loadCallBack?.invoke()
|
||||||
}else{
|
}else{
|
||||||
Log.w("加载网络订阅模板", t.message)
|
LogCat.w("加载网络订阅模板", t.message)
|
||||||
loadLocalTemplate(context)
|
loadLocalTemplate(context)
|
||||||
loadCallBack?.invoke()
|
loadCallBack?.invoke()
|
||||||
}
|
}
|
||||||
|
@ -108,7 +109,7 @@ class InstalledTemplateViewModel : BaseViewModel() {
|
||||||
|
|
||||||
override fun onFailure(e: Exception) {
|
override fun onFailure(e: Exception) {
|
||||||
e.printStackTrace()
|
e.printStackTrace()
|
||||||
Log.e("加载网络订阅模板", e.toString())
|
LogCat.e("加载网络订阅模板", e.toString())
|
||||||
loadLocalTemplate(context)
|
loadLocalTemplate(context)
|
||||||
loadCallBack?.invoke()
|
loadCallBack?.invoke()
|
||||||
}
|
}
|
||||||
|
@ -128,7 +129,7 @@ class InstalledTemplateViewModel : BaseViewModel() {
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
if (templateDirectory.exists() && templateDirectory.isDirectory) {
|
if (templateDirectory.exists() && templateDirectory.isDirectory) {
|
||||||
Log.d("加载本地模板", "正在读取" + templateDirectory.absolutePath)
|
LogCat.d("加载本地模板", "正在读取" + templateDirectory.absolutePath)
|
||||||
val files = templateDirectory.listFiles()
|
val files = templateDirectory.listFiles()
|
||||||
if (files.isNotEmpty()) {
|
if (files.isNotEmpty()) {
|
||||||
files.forEach {
|
files.forEach {
|
||||||
|
@ -138,7 +139,7 @@ class InstalledTemplateViewModel : BaseViewModel() {
|
||||||
LocalTemplatePackage(it)
|
LocalTemplatePackage(it)
|
||||||
if (templatePackage.isTemplate) {
|
if (templatePackage.isTemplate) {
|
||||||
groupList.add(templatePackage)
|
groupList.add(templatePackage)
|
||||||
Log.d("加载本地模板", "已创建" + templatePackage.getName() + "组")
|
LogCat.d("加载本地模板", "已创建" + templatePackage.getName() + "组")
|
||||||
val temList = ArrayList<Template>()
|
val temList = ArrayList<Template>()
|
||||||
itemList.add(temList)
|
itemList.add(temList)
|
||||||
val fileFinder2 = FileFinder2(it)
|
val fileFinder2 = FileFinder2(it)
|
||||||
|
@ -154,19 +155,19 @@ class InstalledTemplateViewModel : BaseViewModel() {
|
||||||
val s = jsonObject.getString("language")
|
val s = jsonObject.getString("language")
|
||||||
if (s == "ALL" || s == environmentLanguage) {
|
if (s == "ALL" || s == environmentLanguage) {
|
||||||
temList.add(templateFile)
|
temList.add(templateFile)
|
||||||
Log.d("加载本地模板", "已成功分配" + file.absolutePath)
|
LogCat.d("加载本地模板", "已成功分配" + file.absolutePath)
|
||||||
} else {
|
} else {
|
||||||
Log.w("加载本地模板", "不符合语言的项目" + file.absolutePath)
|
LogCat.w("加载本地模板", "不符合语言的项目" + file.absolutePath)
|
||||||
}
|
}
|
||||||
} catch (exception: JSONException) {
|
} catch (exception: JSONException) {
|
||||||
exception.printStackTrace()
|
exception.printStackTrace()
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
temList.add(templateFile)
|
temList.add(templateFile)
|
||||||
Log.d("加载本地模板", "已成功分配" + file.absolutePath)
|
LogCat.d("加载本地模板", "已成功分配" + file.absolutePath)
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
Log.w("加载本地模板", "无法分配" + file.absolutePath)
|
LogCat.w("加载本地模板", "无法分配" + file.absolutePath)
|
||||||
}
|
}
|
||||||
return true
|
return true
|
||||||
}
|
}
|
||||||
|
@ -177,17 +178,17 @@ class InstalledTemplateViewModel : BaseViewModel() {
|
||||||
})
|
})
|
||||||
fileFinder2.onStart()
|
fileFinder2.onStart()
|
||||||
} else {
|
} else {
|
||||||
Log.w("加载本地模板", "文件" + it.absolutePath + "不是模板包")
|
LogCat.w("加载本地模板", "文件" + it.absolutePath + "不是模板包")
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
Log.w("加载本地模板", "文件" + it.absolutePath + "不是文件夹")
|
LogCat.w("加载本地模板", "文件" + it.absolutePath + "不是文件夹")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
Log.w("加载本地模板", "目录" + templateDirectory.absolutePath + "内,没有文件,无法加载。")
|
LogCat.w("加载本地模板", "目录" + templateDirectory.absolutePath + "内,没有文件,无法加载。")
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
Log.e("加载本地模板", "模板目录不存在或不是文件夹" + templateDirectory.absolutePath)
|
LogCat.e("加载本地模板", "模板目录不存在或不是文件夹" + templateDirectory.absolutePath)
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -3,6 +3,7 @@ package com.coldmint.rust.pro.viewmodel
|
||||||
import android.os.Environment
|
import android.os.Environment
|
||||||
import android.util.Log
|
import android.util.Log
|
||||||
import com.coldmint.rust.core.ModClass
|
import com.coldmint.rust.core.ModClass
|
||||||
|
import com.coldmint.rust.core.debug.LogCat
|
||||||
import com.coldmint.rust.pro.base.BaseViewModel
|
import com.coldmint.rust.pro.base.BaseViewModel
|
||||||
import com.coldmint.rust.pro.tool.AppSettings
|
import com.coldmint.rust.pro.tool.AppSettings
|
||||||
import java.io.File
|
import java.io.File
|
||||||
|
@ -25,12 +26,12 @@ class ModViewModel : BaseViewModel() {
|
||||||
)
|
)
|
||||||
if (modFolder.exists()) {
|
if (modFolder.exists()) {
|
||||||
if (!modFolder.isDirectory) {
|
if (!modFolder.isDirectory) {
|
||||||
Log.e(key, "模组文件夹${modFolder},不是文件夹。")
|
LogCat.e(key, "模组文件夹${modFolder},不是文件夹。")
|
||||||
return null
|
return null
|
||||||
}
|
}
|
||||||
val fileList = modFolder.listFiles()
|
val fileList = modFolder.listFiles()
|
||||||
if (fileList.isNullOrEmpty()) {
|
if (fileList.isNullOrEmpty()) {
|
||||||
Log.e(key, "模组文件夹${modFolder},为空。")
|
LogCat.e(key, "模组文件夹${modFolder},为空。")
|
||||||
return null
|
return null
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -39,9 +40,9 @@ class ModViewModel : BaseViewModel() {
|
||||||
val isMod = ModClass.isMod(it)
|
val isMod = ModClass.isMod(it)
|
||||||
if (isMod) {
|
if (isMod) {
|
||||||
arrayList.add(ModClass(it))
|
arrayList.add(ModClass(it))
|
||||||
Log.d(key, "已添加${it.absolutePath}。")
|
LogCat.d(key, "已添加${it.absolutePath}。")
|
||||||
} else {
|
} else {
|
||||||
Log.e(key, "${it.absolutePath} 不是模组。")
|
LogCat.e(key, "${it.absolutePath} 不是模组。")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return if (arrayList.isEmpty()){
|
return if (arrayList.isEmpty()){
|
||||||
|
@ -50,7 +51,7 @@ class ModViewModel : BaseViewModel() {
|
||||||
arrayList
|
arrayList
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
Log.e(key, "模组文件夹${modFolder}不存在。")
|
LogCat.e(key, "模组文件夹${modFolder}不存在。")
|
||||||
return null
|
return null
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -24,6 +24,7 @@ import com.coldmint.rust.core.dataBean.user.ActivationInfo
|
||||||
import com.coldmint.rust.core.dataBean.user.SocialInfoData
|
import com.coldmint.rust.core.dataBean.user.SocialInfoData
|
||||||
import com.coldmint.rust.core.dataBean.user.UserData
|
import com.coldmint.rust.core.dataBean.user.UserData
|
||||||
import com.coldmint.rust.core.database.code.CodeDataBase
|
import com.coldmint.rust.core.database.code.CodeDataBase
|
||||||
|
import com.coldmint.rust.core.debug.LogCat
|
||||||
import com.coldmint.rust.core.interfaces.ApiCallBack
|
import com.coldmint.rust.core.interfaces.ApiCallBack
|
||||||
import com.coldmint.rust.core.interfaces.UnzipListener
|
import com.coldmint.rust.core.interfaces.UnzipListener
|
||||||
import com.coldmint.rust.core.tool.AppOperator
|
import com.coldmint.rust.core.tool.AppOperator
|
||||||
|
@ -168,7 +169,7 @@ class StartViewModel(application: Application) : BaseAndroidViewModel(applicatio
|
||||||
} else {
|
} else {
|
||||||
// 用户登录失败
|
// 用户登录失败
|
||||||
verifyErrorMsgLiveData.value = activationInfo.message
|
verifyErrorMsgLiveData.value = activationInfo.message
|
||||||
Log.d("验证失败", activationInfo.message)
|
LogCat.d("验证失败", activationInfo.message)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
@ -427,18 +428,18 @@ class StartViewModel(application: Application) : BaseAndroidViewModel(applicatio
|
||||||
if (BuildConfig.DEBUG) {
|
if (BuildConfig.DEBUG) {
|
||||||
//是测试模式
|
//是测试模式
|
||||||
if (GlobalMethod.DEBUG_SIGN != sign) {
|
if (GlobalMethod.DEBUG_SIGN != sign) {
|
||||||
Log.e(key, "测试打包,签名检查错误" + sign + "不是合法的签名。")
|
LogCat.e(key, "测试打包,签名检查错误" + sign + "不是合法的签名。")
|
||||||
signatureErrorLiveData.value = true
|
signatureErrorLiveData.value = true
|
||||||
} else {
|
} else {
|
||||||
Log.d(key, "测试打包,签名合法。")
|
LogCat.d(key, "测试打包,签名合法。")
|
||||||
signatureErrorLiveData.value = false
|
signatureErrorLiveData.value = false
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
if (GlobalMethod.RELEASE_SIGN != sign) {
|
if (GlobalMethod.RELEASE_SIGN != sign) {
|
||||||
signatureErrorLiveData.value = true
|
signatureErrorLiveData.value = true
|
||||||
Log.e(key, "正式打包,签名检查错误" + sign + "不是合法的签名。")
|
LogCat.e(key, "正式打包,签名检查错误" + sign + "不是合法的签名。")
|
||||||
} else {
|
} else {
|
||||||
Log.d(key, "正式打包,签名合法。")
|
LogCat.d(key, "正式打包,签名合法。")
|
||||||
signatureErrorLiveData.value = false
|
signatureErrorLiveData.value = false
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -2,6 +2,7 @@ package com.coldmint.rust.pro.viewmodel
|
||||||
|
|
||||||
import android.util.Log
|
import android.util.Log
|
||||||
import com.coldmint.rust.core.dataBean.template.WebTemplateData
|
import com.coldmint.rust.core.dataBean.template.WebTemplateData
|
||||||
|
import com.coldmint.rust.core.debug.LogCat
|
||||||
import com.coldmint.rust.core.interfaces.ApiCallBack
|
import com.coldmint.rust.core.interfaces.ApiCallBack
|
||||||
import com.coldmint.rust.core.tool.FileOperator
|
import com.coldmint.rust.core.tool.FileOperator
|
||||||
import com.coldmint.rust.core.tool.LineParser
|
import com.coldmint.rust.core.tool.LineParser
|
||||||
|
@ -87,7 +88,7 @@ class TemplateMakerViewModel : BaseViewModel() {
|
||||||
if (file.exists()) {
|
if (file.exists()) {
|
||||||
val data = FileOperator.readFile(file)
|
val data = FileOperator.readFile(file)
|
||||||
if (data == null) {
|
if (data == null) {
|
||||||
Log.e(key, "无法读取文件 ${file.absolutePath}。")
|
LogCat.e(key, "无法读取文件 ${file.absolutePath}。")
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
val type = FileOperator.getFileType(file)
|
val type = FileOperator.getFileType(file)
|
||||||
|
@ -96,7 +97,7 @@ class TemplateMakerViewModel : BaseViewModel() {
|
||||||
val code = json!!.getString("data")
|
val code = json!!.getString("data")
|
||||||
val jsonArray = json!!.getJSONArray("action")
|
val jsonArray = json!!.getJSONArray("action")
|
||||||
parsingSourceCode(code, jsonArray, func)
|
parsingSourceCode(code, jsonArray, func)
|
||||||
Log.d(key, "已读取 ${file.absolutePath} 为本地模板文件。")
|
LogCat.d(key, "已读取 ${file.absolutePath} 为本地模板文件。")
|
||||||
} else {
|
} else {
|
||||||
json = JSONObject()
|
json = JSONObject()
|
||||||
json!!.put("data", data)
|
json!!.put("data", data)
|
||||||
|
@ -106,10 +107,10 @@ class TemplateMakerViewModel : BaseViewModel() {
|
||||||
)
|
)
|
||||||
|
|
||||||
parsingSourceCode(data, null, func)
|
parsingSourceCode(data, null, func)
|
||||||
Log.d(key, "已读取 ${file.absolutePath} 为源文件。")
|
LogCat.d(key, "已读取 ${file.absolutePath} 为源文件。")
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
Log.e(key, "目标文件不存在 ${file.absolutePath}")
|
LogCat.e(key, "目标文件不存在 ${file.absolutePath}")
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
TemplatePhp.instance.getTemplate(path ?: "", object : ApiCallBack<WebTemplateData> {
|
TemplatePhp.instance.getTemplate(path ?: "", object : ApiCallBack<WebTemplateData> {
|
||||||
|
@ -119,14 +120,14 @@ class TemplateMakerViewModel : BaseViewModel() {
|
||||||
val code = json!!.getString("data")
|
val code = json!!.getString("data")
|
||||||
val jsonArray = json!!.getJSONArray("action")
|
val jsonArray = json!!.getJSONArray("action")
|
||||||
parsingSourceCode(code, jsonArray, func)
|
parsingSourceCode(code, jsonArray, func)
|
||||||
Log.d(key, "已加载远程模板 ${path} 。")
|
LogCat.d(key, "已加载远程模板 ${path} 。")
|
||||||
} else {
|
} else {
|
||||||
Log.e(key, "远程模板响应: ${t.message}")
|
LogCat.e(key, "远程模板响应: ${t.message}")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun onFailure(e: Exception) {
|
override fun onFailure(e: Exception) {
|
||||||
Log.e(key, "远程模板不存在 ${path}")
|
LogCat.e(key, "远程模板不存在 ${path}")
|
||||||
}
|
}
|
||||||
|
|
||||||
})
|
})
|
||||||
|
|
|
@ -8,6 +8,7 @@ import com.coldmint.rust.core.dataBean.InputParserDataBean
|
||||||
import com.coldmint.rust.core.dataBean.IntroducingDataBean
|
import com.coldmint.rust.core.dataBean.IntroducingDataBean
|
||||||
import com.coldmint.rust.core.dataBean.ListParserDataBean
|
import com.coldmint.rust.core.dataBean.ListParserDataBean
|
||||||
import com.coldmint.rust.core.dataBean.template.Template
|
import com.coldmint.rust.core.dataBean.template.Template
|
||||||
|
import com.coldmint.rust.core.debug.LogCat
|
||||||
import com.coldmint.rust.core.interfaces.TemplateParser
|
import com.coldmint.rust.core.interfaces.TemplateParser
|
||||||
import com.coldmint.rust.core.templateParser.InputParser
|
import com.coldmint.rust.core.templateParser.InputParser
|
||||||
import com.coldmint.rust.core.templateParser.IntroducingParser
|
import com.coldmint.rust.core.templateParser.IntroducingParser
|
||||||
|
@ -79,7 +80,7 @@ class TemplateParserViewModel : BaseViewModel() {
|
||||||
*/
|
*/
|
||||||
fun buildFile(context: Context, fileName: String): Boolean {
|
fun buildFile(context: Context, fileName: String): Boolean {
|
||||||
if (createDirectory == null) {
|
if (createDirectory == null) {
|
||||||
Log.e("构建文件", "没有设置创建目录。")
|
LogCat.e("构建文件", "没有设置创建目录。")
|
||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
val index = fileName.lastIndexOf('.')
|
val index = fileName.lastIndexOf('.')
|
||||||
|
@ -95,11 +96,11 @@ class TemplateParserViewModel : BaseViewModel() {
|
||||||
} else {
|
} else {
|
||||||
createDirectory
|
createDirectory
|
||||||
}
|
}
|
||||||
Log.d("构建文件", "是否需要独立创建文件夹${independentFolder} 文件夹目录${createPath}")
|
LogCat.d("构建文件", "是否需要独立创建文件夹${independentFolder} 文件夹目录${createPath}")
|
||||||
if (independentFolder){
|
if (independentFolder){
|
||||||
val folder = File(createPath)
|
val folder = File(createPath)
|
||||||
if (folder.exists()) {
|
if (folder.exists()) {
|
||||||
Log.e("构建文件", "创建目录${createPath}已存在。")
|
LogCat.e("构建文件", "创建目录${createPath}已存在。")
|
||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
folder.mkdirs()
|
folder.mkdirs()
|
||||||
|
@ -112,7 +113,7 @@ class TemplateParserViewModel : BaseViewModel() {
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
if (path.exists()) {
|
if (path.exists()) {
|
||||||
Log.e("构建文件", "目标文件${path}已存在。")
|
LogCat.e("构建文件", "目标文件${path}已存在。")
|
||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
outPutPath = path.absolutePath
|
outPutPath = path.absolutePath
|
||||||
|
@ -135,23 +136,23 @@ class TemplateParserViewModel : BaseViewModel() {
|
||||||
val staticCode = getCode()
|
val staticCode = getCode()
|
||||||
//如果为空,那么返回空
|
//如果为空,那么返回空
|
||||||
if (staticCode.isBlank()) {
|
if (staticCode.isBlank()) {
|
||||||
Log.e("获取模板解析器", "静态代码为空。")
|
LogCat.e("获取模板解析器", "静态代码为空。")
|
||||||
return staticCode
|
return staticCode
|
||||||
}
|
}
|
||||||
|
|
||||||
val sourceFile = SourceFile(staticCode)
|
val sourceFile = SourceFile(staticCode)
|
||||||
val parserList = getTemplateParserList(context)
|
val parserList = getTemplateParserList(context)
|
||||||
if (parserList.isEmpty()) {
|
if (parserList.isEmpty()) {
|
||||||
Log.w("生成代码", "此模板没有解析器,返回静态代码。")
|
LogCat.w("生成代码", "此模板没有解析器,返回静态代码。")
|
||||||
return staticCode
|
return staticCode
|
||||||
} else {
|
} else {
|
||||||
parserList.forEach {
|
parserList.forEach {
|
||||||
if (it.needParse) {
|
if (it.needParse) {
|
||||||
val input = it.getInput()
|
val input = it.getInput()
|
||||||
if (input.isBlank()) {
|
if (input.isBlank()) {
|
||||||
Log.w("生成代码", "模板${it.code}输入为空,跳过处理。")
|
LogCat.w("生成代码", "模板${it.code}输入为空,跳过处理。")
|
||||||
} else {
|
} else {
|
||||||
Log.d("生成代码", "已将${it.code}的值设置为${input}。")
|
LogCat.d("生成代码", "已将${it.code}的值设置为${input}。")
|
||||||
val section = it.section
|
val section = it.section
|
||||||
if (section == null) {
|
if (section == null) {
|
||||||
sourceFile.writeValue(it.code, input)
|
sourceFile.writeValue(it.code, input)
|
||||||
|
@ -160,7 +161,7 @@ class TemplateParserViewModel : BaseViewModel() {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
Log.d("生成代码", "模板${it.code}无需处理。")
|
LogCat.d("生成代码", "模板${it.code}无需处理。")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return sourceFile.text
|
return sourceFile.text
|
||||||
|
@ -176,14 +177,14 @@ class TemplateParserViewModel : BaseViewModel() {
|
||||||
fun getTemplateParserList(context: Context): ArrayList<TemplateParser> {
|
fun getTemplateParserList(context: Context): ArrayList<TemplateParser> {
|
||||||
if (this::arrayList.isInitialized)
|
if (this::arrayList.isInitialized)
|
||||||
{
|
{
|
||||||
Log.d("获取模板解析器","已经被调用了一次,返回成员变量")
|
LogCat.d("获取模板解析器","已经被调用了一次,返回成员变量")
|
||||||
return arrayList
|
return arrayList
|
||||||
}
|
}
|
||||||
arrayList = ArrayList()
|
arrayList = ArrayList()
|
||||||
val gson = Gson()
|
val gson = Gson()
|
||||||
val jsonArray = jsonData?.getJSONArray("action")
|
val jsonArray = jsonData?.getJSONArray("action")
|
||||||
if (jsonArray == null) {
|
if (jsonArray == null) {
|
||||||
Log.e("获取模板解析器", "此模板没有action,无法读取。")
|
LogCat.e("获取模板解析器", "此模板没有action,无法读取。")
|
||||||
return arrayList
|
return arrayList
|
||||||
} else {
|
} else {
|
||||||
val len = jsonArray.length()
|
val len = jsonArray.length()
|
||||||
|
|
|
@ -0,0 +1,18 @@
|
||||||
|
package com.coldmint.rust.pro.viewmodel
|
||||||
|
|
||||||
|
import androidx.lifecycle.MutableLiveData
|
||||||
|
import com.coldmint.rust.pro.base.BaseViewModel
|
||||||
|
|
||||||
|
class WebModDetailsViewModel : BaseViewModel() {
|
||||||
|
|
||||||
|
var modNameLiveData: MutableLiveData<String>? = null
|
||||||
|
var modId: String? = null
|
||||||
|
var developer: String? = null
|
||||||
|
|
||||||
|
//此模组是否对外开放
|
||||||
|
var isOpen: Boolean = false
|
||||||
|
|
||||||
|
var link: String? = null
|
||||||
|
|
||||||
|
|
||||||
|
}
|
|
@ -3,9 +3,18 @@
|
||||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||||
xmlns:card_view="http://schemas.android.com/apk/res-auto"
|
xmlns:card_view="http://schemas.android.com/apk/res-auto"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="match_parent">
|
android:layout_height="match_parent"
|
||||||
|
android:fillViewport="true">
|
||||||
|
|
||||||
<LinearLayout
|
<LinearLayout
|
||||||
|
android:gravity="center"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="match_parent"
|
||||||
|
android:orientation="vertical">
|
||||||
|
|
||||||
|
<LinearLayout
|
||||||
|
android:visibility="gone"
|
||||||
|
android:id="@+id/contentLayout"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="match_parent"
|
android:layout_height="match_parent"
|
||||||
android:orientation="vertical">
|
android:orientation="vertical">
|
||||||
|
@ -74,7 +83,6 @@
|
||||||
|
|
||||||
|
|
||||||
<LinearLayout
|
<LinearLayout
|
||||||
|
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="match_parent"
|
android:layout_height="match_parent"
|
||||||
android:layout_margin="16dp"
|
android:layout_margin="16dp"
|
||||||
|
@ -106,4 +114,18 @@
|
||||||
|
|
||||||
</LinearLayout>
|
</LinearLayout>
|
||||||
|
|
||||||
|
<ProgressBar
|
||||||
|
android:id="@+id/progressBar"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"/>
|
||||||
|
|
||||||
|
<include
|
||||||
|
android:visibility="gone"
|
||||||
|
android:id="@+id/loginLayout"
|
||||||
|
layout="@layout/layout_log_in_first"/>
|
||||||
|
|
||||||
|
|
||||||
|
</LinearLayout>
|
||||||
|
|
||||||
|
|
||||||
</androidx.core.widget.NestedScrollView>
|
</androidx.core.widget.NestedScrollView>
|
||||||
|
|
22
app/src/main/res/layout/layout_log_in_first.xml
Normal file
22
app/src/main/res/layout/layout_log_in_first.xml
Normal file
|
@ -0,0 +1,22 @@
|
||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="match_parent"
|
||||||
|
android:gravity="center"
|
||||||
|
android:orientation="vertical">
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
style="@style/MaterialAlertDialog.Material3.Body.Text"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:text="@string/log_in_discover_more" />
|
||||||
|
|
||||||
|
<Button
|
||||||
|
android:id="@+id/logView"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_marginTop="8dp"
|
||||||
|
android:text="@string/login" />
|
||||||
|
|
||||||
|
|
||||||
|
</LinearLayout>
|
|
@ -415,7 +415,7 @@
|
||||||
<string name="additional_selection">Additional items</string>
|
<string name="additional_selection">Additional items</string>
|
||||||
<string name="delete_source_file">Delete the source file after the package is complete</string>
|
<string name="delete_source_file">Delete the source file after the package is complete</string>
|
||||||
<string name="packmod">packaging</string>
|
<string name="packmod">packaging</string>
|
||||||
<string name="open_tip">Open immediately with %1$.2F yuan</string>
|
<string name="open_tip">Open immediately with %1$.2f yuan</string>
|
||||||
<string name="packing">In the packaging...</string>
|
<string name="packing">In the packaging...</string>
|
||||||
<string name="share_mod">share</string>
|
<string name="share_mod">share</string>
|
||||||
<string name="clear_code_cache">Clean up the code cache</string>
|
<string name="clear_code_cache">Clean up the code cache</string>
|
||||||
|
|
|
@ -478,7 +478,8 @@
|
||||||
<string name="insert_coins_ok">已收到您的支持了。</string>
|
<string name="insert_coins_ok">已收到您的支持了。</string>
|
||||||
<string name="register_successed">注册成功</string>
|
<string name="register_successed">注册成功</string>
|
||||||
<string name="registration_success_message">账号激活码已发送至您的邮箱。若没有收到,则邮箱可能被视为垃圾邮件了。请检查您的垃圾箱。</string>
|
<string name="registration_success_message">账号激活码已发送至您的邮箱。若没有收到,则邮箱可能被视为垃圾邮件了。请检查您的垃圾箱。</string>
|
||||||
<string name="please_login_first">请先登录。</string>
|
<string name="please_login_first">请先登录</string>
|
||||||
|
<string name="tourist_pattern">游客模式</string>
|
||||||
<string name="network_error">网络错误。</string>
|
<string name="network_error">网络错误。</string>
|
||||||
<string name="check_update_failure">检查更新失败。</string>
|
<string name="check_update_failure">检查更新失败。</string>
|
||||||
<string name="setting_check_beta_update" translatable="false">CheckBetaUpdate</string>
|
<string name="setting_check_beta_update" translatable="false">CheckBetaUpdate</string>
|
||||||
|
@ -941,5 +942,7 @@
|
||||||
<string name="unit_number">单位数</string>
|
<string name="unit_number">单位数</string>
|
||||||
<string name="update_number">更新次数</string>
|
<string name="update_number">更新次数</string>
|
||||||
<string name="click_profile_picture_login">点击头像登录</string>
|
<string name="click_profile_picture_login">点击头像登录</string>
|
||||||
|
<string name="log_in_discover_more">登录发现更多内容!</string>
|
||||||
|
<string name="follow_introduction">登录后即可解锁关注系统</string>
|
||||||
|
|
||||||
</resources>
|
</resources>
|
|
@ -2,6 +2,7 @@ package com.coldmint.rust.core
|
||||||
|
|
||||||
import android.util.Log
|
import android.util.Log
|
||||||
import com.coldmint.rust.core.dataBean.dataset.DataBaseManifest
|
import com.coldmint.rust.core.dataBean.dataset.DataBaseManifest
|
||||||
|
import com.coldmint.rust.core.debug.LogCat
|
||||||
import com.coldmint.rust.core.tool.FileOperator
|
import com.coldmint.rust.core.tool.FileOperator
|
||||||
import com.google.gson.Gson
|
import com.google.gson.Gson
|
||||||
import java.io.File
|
import java.io.File
|
||||||
|
@ -59,7 +60,7 @@ class DataSet(val folder: File) {
|
||||||
val newDataSetManifest = dataSet.getDataBaseManifest()
|
val newDataSetManifest = dataSet.getDataBaseManifest()
|
||||||
val thisManifest = getDataBaseManifest()
|
val thisManifest = getDataBaseManifest()
|
||||||
if (newDataSetManifest == null) {
|
if (newDataSetManifest == null) {
|
||||||
Log.w(
|
LogCat.w(
|
||||||
"数据集更新",
|
"数据集更新",
|
||||||
"新清单不存在,无法升级"
|
"新清单不存在,无法升级"
|
||||||
)
|
)
|
||||||
|
@ -67,7 +68,7 @@ class DataSet(val folder: File) {
|
||||||
}
|
}
|
||||||
if (thisManifest == null) {
|
if (thisManifest == null) {
|
||||||
//如果自身清单文件为空直接升级
|
//如果自身清单文件为空直接升级
|
||||||
Log.w(
|
LogCat.w(
|
||||||
"数据集更新",
|
"数据集更新",
|
||||||
"自身清单不存在,已执行升级"
|
"自身清单不存在,已执行升级"
|
||||||
)
|
)
|
||||||
|
@ -76,21 +77,21 @@ class DataSet(val folder: File) {
|
||||||
}
|
}
|
||||||
return if (newDataSetManifest.id == thisManifest.id) {
|
return if (newDataSetManifest.id == thisManifest.id) {
|
||||||
if (newDataSetManifest.versionNumber > thisManifest.versionNumber) {
|
if (newDataSetManifest.versionNumber > thisManifest.versionNumber) {
|
||||||
Log.d(
|
LogCat.d(
|
||||||
"数据集更新",
|
"数据集更新",
|
||||||
"版本号不一致,执行更新(新版本" + newDataSetManifest.versionNumber + "旧版本:" + thisManifest.versionNumber + ")"
|
"版本号不一致,执行更新(新版本" + newDataSetManifest.versionNumber + "旧版本:" + thisManifest.versionNumber + ")"
|
||||||
)
|
)
|
||||||
FileOperator.delete_files(folder)
|
FileOperator.delete_files(folder)
|
||||||
FileOperator.copyFile(dataSet.folder, folder)
|
FileOperator.copyFile(dataSet.folder, folder)
|
||||||
} else {
|
} else {
|
||||||
Log.d(
|
LogCat.d(
|
||||||
"数据集更新",
|
"数据集更新",
|
||||||
"新的版本号小于或等于当前版本无需更新(新版本:" + newDataSetManifest.versionNumber + "旧版本:" + thisManifest.versionNumber + ")"
|
"新的版本号小于或等于当前版本无需更新(新版本:" + newDataSetManifest.versionNumber + "旧版本:" + thisManifest.versionNumber + ")"
|
||||||
)
|
)
|
||||||
false
|
false
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
Log.w(
|
LogCat.w(
|
||||||
"数据集更新",
|
"数据集更新",
|
||||||
"id不一致"
|
"id不一致"
|
||||||
)
|
)
|
||||||
|
|
|
@ -158,14 +158,10 @@ class ModClass(file: File) {
|
||||||
*
|
*
|
||||||
* @return 位图对象
|
* @return 位图对象
|
||||||
*/
|
*/
|
||||||
val modIcon: Bitmap?
|
val modIcon: String?
|
||||||
get() {
|
get() {
|
||||||
val icon_file = readResourceFromInfo("thumbnail")
|
val iconFile = readResourceFromInfo("thumbnail")
|
||||||
return if (icon_file != null && icon_file.exists()) {
|
return iconFile?.absolutePath
|
||||||
BitmapFactory.decodeFile(readResourceFromInfo("thumbnail")!!.absolutePath)
|
|
||||||
} else {
|
|
||||||
null
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -4,6 +4,7 @@ package com.coldmint.rust.core.dataBean
|
||||||
import android.util.Log
|
import android.util.Log
|
||||||
import com.coldmint.rust.core.dataBean.template.Template
|
import com.coldmint.rust.core.dataBean.template.Template
|
||||||
import com.coldmint.rust.core.dataBean.template.TemplatePackage
|
import com.coldmint.rust.core.dataBean.template.TemplatePackage
|
||||||
|
import com.coldmint.rust.core.debug.LogCat
|
||||||
import com.coldmint.rust.core.interfaces.ApiCallBack
|
import com.coldmint.rust.core.interfaces.ApiCallBack
|
||||||
import com.coldmint.rust.core.web.ServerConfiguration
|
import com.coldmint.rust.core.web.ServerConfiguration
|
||||||
import com.coldmint.rust.core.web.TemplatePhp
|
import com.coldmint.rust.core.web.TemplatePhp
|
||||||
|
@ -116,17 +117,17 @@ data class SubscriptionData(
|
||||||
TemplatePhp.instance.deleteSubscription(token, id, object : ApiCallBack<ApiResponse> {
|
TemplatePhp.instance.deleteSubscription(token, id, object : ApiCallBack<ApiResponse> {
|
||||||
override fun onResponse(t: ApiResponse) {
|
override fun onResponse(t: ApiResponse) {
|
||||||
if (t.code == ServerConfiguration.Success_Code) {
|
if (t.code == ServerConfiguration.Success_Code) {
|
||||||
Log.d("取消订阅", "成功。")
|
LogCat.d("取消订阅", "成功。")
|
||||||
func.invoke(true)
|
func.invoke(true)
|
||||||
} else {
|
} else {
|
||||||
Log.e("取消订阅", t.message)
|
LogCat.e("取消订阅", t.message)
|
||||||
func.invoke(false)
|
func.invoke(false)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun onFailure(e: Exception) {
|
override fun onFailure(e: Exception) {
|
||||||
e.printStackTrace()
|
e.printStackTrace()
|
||||||
Log.e("取消订阅", e.toString())
|
LogCat.e("取消订阅", e.toString())
|
||||||
func.invoke(false)
|
func.invoke(false)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -9,6 +9,7 @@ import androidx.room.RoomDatabase
|
||||||
import com.coldmint.rust.core.DataSet
|
import com.coldmint.rust.core.DataSet
|
||||||
import com.coldmint.rust.core.dataBean.dataset.*
|
import com.coldmint.rust.core.dataBean.dataset.*
|
||||||
import com.coldmint.rust.core.database.file.FileDataBase
|
import com.coldmint.rust.core.database.file.FileDataBase
|
||||||
|
import com.coldmint.rust.core.debug.LogCat
|
||||||
import com.coldmint.rust.core.tool.FileOperator
|
import com.coldmint.rust.core.tool.FileOperator
|
||||||
import com.google.gson.Gson
|
import com.google.gson.Gson
|
||||||
import java.util.concurrent.Executors
|
import java.util.concurrent.Executors
|
||||||
|
@ -67,19 +68,19 @@ abstract class CodeDataBase : RoomDatabase() {
|
||||||
*/
|
*/
|
||||||
fun loadDataSet(dataSet: DataSet, readMode: ReadMode): Boolean {
|
fun loadDataSet(dataSet: DataSet, readMode: ReadMode): Boolean {
|
||||||
val datasetTag = "数据集加载"
|
val datasetTag = "数据集加载"
|
||||||
Log.d(datasetTag, "读取位于(" + dataSet.folder.absolutePath + ")数据集,方法" + readMode.name)
|
LogCat.d(datasetTag, "读取位于(" + dataSet.folder.absolutePath + ")数据集,方法" + readMode.name)
|
||||||
val executorService = Executors.newSingleThreadExecutor()
|
val executorService = Executors.newSingleThreadExecutor()
|
||||||
var result = false
|
var result = false
|
||||||
val future = executorService.submit {
|
val future = executorService.submit {
|
||||||
val gson = Gson()
|
val gson = Gson()
|
||||||
val manifest = dataSet.getDataBaseManifest()
|
val manifest = dataSet.getDataBaseManifest()
|
||||||
if (manifest == null) {
|
if (manifest == null) {
|
||||||
Log.e(datasetTag, "读取数据集错误,清单文件不存在。")
|
LogCat.e(datasetTag, "读取数据集错误,清单文件不存在。")
|
||||||
return@submit
|
return@submit
|
||||||
}
|
}
|
||||||
|
|
||||||
//加载代码表数据
|
//加载代码表数据
|
||||||
Log.d(datasetTag, "加载代码表...")
|
LogCat.d(datasetTag, "加载代码表...")
|
||||||
try {
|
try {
|
||||||
val codeData = FileOperator.readFile(dataSet.getAbsolutePath(manifest.tables.code))
|
val codeData = FileOperator.readFile(dataSet.getAbsolutePath(manifest.tables.code))
|
||||||
if (codeData != null) {
|
if (codeData != null) {
|
||||||
|
@ -148,20 +149,20 @@ abstract class CodeDataBase : RoomDatabase() {
|
||||||
hashSet.add(it.code)
|
hashSet.add(it.code)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Log.e(datasetTag, "读取代码表错误(主键约束),因为" + num + "个元素重复。列表:" + s.toString())
|
LogCat.e(datasetTag, "读取代码表错误(主键约束),因为" + num + "个元素重复。列表:" + s.toString())
|
||||||
} else {
|
} else {
|
||||||
e.printStackTrace()
|
e.printStackTrace()
|
||||||
Log.e(datasetTag, "读取代码表错误(主键约束)。" + e.toString())
|
LogCat.e(datasetTag, "读取代码表错误(主键约束)。" + e.toString())
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
e.printStackTrace()
|
e.printStackTrace()
|
||||||
Log.e(datasetTag, "读取代码表错误。" + e.toString())
|
LogCat.e(datasetTag, "读取代码表错误。" + e.toString())
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//加载节表数据
|
//加载节表数据
|
||||||
try {
|
try {
|
||||||
Log.d(datasetTag, "加载节表...")
|
LogCat.d(datasetTag, "加载节表...")
|
||||||
val sectionData =
|
val sectionData =
|
||||||
FileOperator.readFile(dataSet.getAbsolutePath(manifest.tables.section))
|
FileOperator.readFile(dataSet.getAbsolutePath(manifest.tables.section))
|
||||||
if (sectionData != null) {
|
if (sectionData != null) {
|
||||||
|
@ -215,12 +216,12 @@ abstract class CodeDataBase : RoomDatabase() {
|
||||||
}
|
}
|
||||||
} catch (e: Exception) {
|
} catch (e: Exception) {
|
||||||
e.printStackTrace()
|
e.printStackTrace()
|
||||||
Log.e(datasetTag, "读取节表错误。" + e.toString())
|
LogCat.e(datasetTag, "读取节表错误。" + e.toString())
|
||||||
}
|
}
|
||||||
|
|
||||||
//值类型数据
|
//值类型数据
|
||||||
try {
|
try {
|
||||||
Log.d("数据集加载", "加载值表...")
|
LogCat.d("数据集加载", "加载值表...")
|
||||||
val valueTypeData =
|
val valueTypeData =
|
||||||
FileOperator.readFile(dataSet.getAbsolutePath(manifest.tables.valueType))
|
FileOperator.readFile(dataSet.getAbsolutePath(manifest.tables.valueType))
|
||||||
if (valueTypeData != null) {
|
if (valueTypeData != null) {
|
||||||
|
@ -274,13 +275,13 @@ abstract class CodeDataBase : RoomDatabase() {
|
||||||
}
|
}
|
||||||
} catch (e: Exception) {
|
} catch (e: Exception) {
|
||||||
e.printStackTrace()
|
e.printStackTrace()
|
||||||
Log.e(datasetTag, "读取值表错误。" + e.toString())
|
LogCat.e(datasetTag, "读取值表错误。" + e.toString())
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
//插入链式检查数据
|
//插入链式检查数据
|
||||||
try {
|
try {
|
||||||
Log.d(datasetTag, "加载链式检查表...")
|
LogCat.d(datasetTag, "加载链式检查表...")
|
||||||
val chainInspectionData =
|
val chainInspectionData =
|
||||||
FileOperator.readFile(dataSet.getAbsolutePath(manifest.tables.chainInspection))
|
FileOperator.readFile(dataSet.getAbsolutePath(manifest.tables.chainInspection))
|
||||||
if (chainInspectionData != null) {
|
if (chainInspectionData != null) {
|
||||||
|
@ -333,13 +334,13 @@ abstract class CodeDataBase : RoomDatabase() {
|
||||||
}
|
}
|
||||||
} catch (e: Exception) {
|
} catch (e: Exception) {
|
||||||
e.printStackTrace()
|
e.printStackTrace()
|
||||||
Log.e(datasetTag, "读取链式检查表错误。" + e.toString())
|
LogCat.e(datasetTag, "读取链式检查表错误。" + e.toString())
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
//游戏版本数据
|
//游戏版本数据
|
||||||
try {
|
try {
|
||||||
Log.d("数据集加载", "加载版本表...")
|
LogCat.d("数据集加载", "加载版本表...")
|
||||||
val versionData =
|
val versionData =
|
||||||
FileOperator.readFile(dataSet.getAbsolutePath(manifest.tables.gameVersion))
|
FileOperator.readFile(dataSet.getAbsolutePath(manifest.tables.gameVersion))
|
||||||
if (versionData != null) {
|
if (versionData != null) {
|
||||||
|
@ -393,9 +394,9 @@ abstract class CodeDataBase : RoomDatabase() {
|
||||||
}
|
}
|
||||||
} catch (e: Exception) {
|
} catch (e: Exception) {
|
||||||
e.printStackTrace()
|
e.printStackTrace()
|
||||||
Log.e(datasetTag, "读取版本表错误。" + e.toString())
|
LogCat.e(datasetTag, "读取版本表错误。" + e.toString())
|
||||||
}
|
}
|
||||||
Log.d("数据集加载", "加载完成。")
|
LogCat.d("数据集加载", "加载完成。")
|
||||||
result = true
|
result = true
|
||||||
}
|
}
|
||||||
return if (future.get() == null) {
|
return if (future.get() == null) {
|
||||||
|
|
|
@ -0,0 +1,80 @@
|
||||||
|
package com.coldmint.rust.core.debug
|
||||||
|
|
||||||
|
import android.util.Log
|
||||||
|
|
||||||
|
object LogCat {
|
||||||
|
|
||||||
|
private var logCatObservers: ArrayList<LogCatObserver>? = null
|
||||||
|
var label = "LogCat"
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 附加观察者
|
||||||
|
*/
|
||||||
|
fun attachObserver(logCatObserver: LogCatObserver) {
|
||||||
|
if (logCatObservers == null) {
|
||||||
|
logCatObservers = ArrayList()
|
||||||
|
}
|
||||||
|
logCatObservers!!.add(logCatObserver)
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 卸载观察者
|
||||||
|
*/
|
||||||
|
fun unattachObserver(logCatObserver: LogCatObserver) {
|
||||||
|
if (logCatObservers == null) {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
logCatObservers!!.remove(logCatObserver)
|
||||||
|
}
|
||||||
|
|
||||||
|
private var enable = true
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 是否处于启用状态
|
||||||
|
*/
|
||||||
|
fun isEnable(): Boolean {
|
||||||
|
return enable
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 设置是否启用
|
||||||
|
*/
|
||||||
|
fun setEnable(enable: Boolean) {
|
||||||
|
this.enable = enable
|
||||||
|
Log.d(label, "设置启用状态$enable")
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 发送消息给所有观察者
|
||||||
|
*/
|
||||||
|
private fun sendMessage(msg: String) {
|
||||||
|
logCatObservers?.forEach {
|
||||||
|
it.onReceiveLog(msg)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
fun e(tag: String, msg: String) {
|
||||||
|
if (!enable) {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
Log.e(label, "错误:${tag}-${msg}")
|
||||||
|
sendMessage("错误:${tag}-${msg}")
|
||||||
|
}
|
||||||
|
|
||||||
|
fun d(tag: String, msg: String) {
|
||||||
|
if (!enable) {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
Log.d(label, "调试:${tag}-${msg}")
|
||||||
|
sendMessage("调试:${tag}-${msg}")
|
||||||
|
}
|
||||||
|
|
||||||
|
fun w(tag: String, msg: String) {
|
||||||
|
if (!enable) {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
Log.w(label, "警告:${tag}-${msg}")
|
||||||
|
sendMessage("警告:${tag}-${msg}")
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,10 @@
|
||||||
|
package com.coldmint.rust.core.debug
|
||||||
|
|
||||||
|
interface LogCatObserver {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 当收到日志时
|
||||||
|
*/
|
||||||
|
fun onReceiveLog(msg: String)
|
||||||
|
|
||||||
|
}
|
|
@ -1,6 +1,7 @@
|
||||||
package com.coldmint.rust.core.tool
|
package com.coldmint.rust.core.tool
|
||||||
|
|
||||||
import android.util.Log
|
import android.util.Log
|
||||||
|
import com.coldmint.rust.core.debug.LogCat
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 调试帮助器
|
* 调试帮助器
|
||||||
|
@ -21,9 +22,9 @@ object DebugHelper {
|
||||||
"$keyValue-$module"
|
"$keyValue-$module"
|
||||||
}
|
}
|
||||||
if (isError) {
|
if (isError) {
|
||||||
Log.e(key, message)
|
LogCat.e(key, message)
|
||||||
} else {
|
} else {
|
||||||
Log.d(key, message)
|
LogCat.d(key, message)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -3,6 +3,7 @@ package com.coldmint.rust.core.turret
|
||||||
import android.util.Log
|
import android.util.Log
|
||||||
import android.view.ViewGroup
|
import android.view.ViewGroup
|
||||||
import com.coldmint.rust.core.SourceFile
|
import com.coldmint.rust.core.SourceFile
|
||||||
|
import com.coldmint.rust.core.debug.LogCat
|
||||||
import java.io.File
|
import java.io.File
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -54,7 +55,7 @@ class TurretManager(val sourceFile: SourceFile) {
|
||||||
var defaultImageFile: File? = null
|
var defaultImageFile: File? = null
|
||||||
if (!defaultImageList.isNullOrEmpty()) {
|
if (!defaultImageList.isNullOrEmpty()) {
|
||||||
defaultImageFile = defaultImageList.get(0)
|
defaultImageFile = defaultImageList.get(0)
|
||||||
Log.d("炮塔管理器-默认图像", defaultImageFile.absolutePath)
|
LogCat.d("炮塔管理器-默认图像", defaultImageFile.absolutePath)
|
||||||
}
|
}
|
||||||
allSection.forEach {
|
allSection.forEach {
|
||||||
//遍历每一个炮塔
|
//遍历每一个炮塔
|
||||||
|
@ -76,10 +77,10 @@ class TurretManager(val sourceFile: SourceFile) {
|
||||||
if (!fileList.isNullOrEmpty()) {
|
if (!fileList.isNullOrEmpty()) {
|
||||||
val file = fileList.get(0)
|
val file = fileList.get(0)
|
||||||
turretData.imageFile = file
|
turretData.imageFile = file
|
||||||
Log.d("炮塔管理器-$name", "设置炮塔图像" + file.absolutePath)
|
LogCat.d("炮塔管理器-$name", "设置炮塔图像" + file.absolutePath)
|
||||||
} else {
|
} else {
|
||||||
turretData.imageFile = defaultImageFile
|
turretData.imageFile = defaultImageFile
|
||||||
Log.d("炮塔管理器-$name", "加载默认图像" + defaultImageFile?.absolutePath)
|
LogCat.d("炮塔管理器-$name", "加载默认图像" + defaultImageFile?.absolutePath)
|
||||||
}
|
}
|
||||||
turretList.add(turretData)
|
turretList.add(turretData)
|
||||||
}
|
}
|
||||||
|
@ -139,11 +140,11 @@ class TurretManager(val sourceFile: SourceFile) {
|
||||||
val use = it.name == turretName
|
val use = it.name == turretName
|
||||||
val view = viewMap[it.name]
|
val view = viewMap[it.name]
|
||||||
if (view == null) {
|
if (view == null) {
|
||||||
Log.e("炮塔管理器", "无法找到 ${it.name} 炮塔。")
|
LogCat.e("炮塔管理器", "无法找到 ${it.name} 炮塔。")
|
||||||
} else {
|
} else {
|
||||||
view.setCanDrag(use)
|
view.setCanDrag(use)
|
||||||
}
|
}
|
||||||
Log.d("炮塔管理器", "${it.name} 可用${use}")
|
LogCat.d("炮塔管理器", "${it.name} 可用${use}")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -9,6 +9,7 @@ import android.view.ViewGroup
|
||||||
import android.widget.FrameLayout
|
import android.widget.FrameLayout
|
||||||
import android.widget.RelativeLayout
|
import android.widget.RelativeLayout
|
||||||
import com.coldmint.rust.core.R
|
import com.coldmint.rust.core.R
|
||||||
|
import com.coldmint.rust.core.debug.LogCat
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 炮塔画板
|
* 炮塔画板
|
||||||
|
@ -120,7 +121,7 @@ class TurretSketchpadView(context: Context, attributeSet: AttributeSet? = null)
|
||||||
val x = (androidCoordinateData.x - centreX) / cellSize
|
val x = (androidCoordinateData.x - centreX) / cellSize
|
||||||
val y = (androidCoordinateData.y - centreY) / cellSize
|
val y = (androidCoordinateData.y - centreY) / cellSize
|
||||||
val game = CoordinateData(x, y)
|
val game = CoordinateData(x, y)
|
||||||
Log.d(
|
LogCat.d(
|
||||||
debug,
|
debug,
|
||||||
"转换游戏坐标,安卓坐标${androidCoordinateData} 游戏坐标${game}"
|
"转换游戏坐标,安卓坐标${androidCoordinateData} 游戏坐标${game}"
|
||||||
)
|
)
|
||||||
|
@ -136,7 +137,7 @@ class TurretSketchpadView(context: Context, attributeSet: AttributeSet? = null)
|
||||||
val x = (gameCoordinateData.x * cellSize) + centreX
|
val x = (gameCoordinateData.x * cellSize) + centreX
|
||||||
val y = (gameCoordinateData.y * cellSize) + centreY
|
val y = (gameCoordinateData.y * cellSize) + centreY
|
||||||
val androidCoordinateData = CoordinateData(x, y)
|
val androidCoordinateData = CoordinateData(x, y)
|
||||||
Log.d(
|
LogCat.d(
|
||||||
debug,
|
debug,
|
||||||
"转换安卓坐标,中心点${centreX} ${centreY}安卓坐标${androidCoordinateData} 游戏坐标${gameCoordinateData}"
|
"转换安卓坐标,中心点${centreX} ${centreY}安卓坐标${androidCoordinateData} 游戏坐标${gameCoordinateData}"
|
||||||
)
|
)
|
||||||
|
@ -150,10 +151,10 @@ class TurretSketchpadView(context: Context, attributeSet: AttributeSet? = null)
|
||||||
fun setKeyCoordinate(coordinateData: CoordinateData) {
|
fun setKeyCoordinate(coordinateData: CoordinateData) {
|
||||||
if (centreX != -1 && centreY != -1) {
|
if (centreX != -1 && centreY != -1) {
|
||||||
keyCoordinate = coordinateData
|
keyCoordinate = coordinateData
|
||||||
Log.d(debug, "已设置关键坐标${coordinateData}。")
|
LogCat.d(debug, "已设置关键坐标${coordinateData}。")
|
||||||
invalidate()
|
invalidate()
|
||||||
} else {
|
} else {
|
||||||
Log.e(debug, "设置关键坐标失败。")
|
LogCat.e(debug, "设置关键坐标失败。")
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -205,7 +206,7 @@ class TurretSketchpadView(context: Context, attributeSet: AttributeSet? = null)
|
||||||
} else {
|
} else {
|
||||||
cellY
|
cellY
|
||||||
}
|
}
|
||||||
Log.d(
|
LogCat.d(
|
||||||
debug,
|
debug,
|
||||||
"计算尺寸\n单元格宽:${cellX} 使用视图宽度${width}除以图像宽度${imageWidth}\n单元格高:${cellY} 使用视图宽度${height}除以图像宽度${imageHeight}\n采用${cellSize}作为视图单元格尺寸"
|
"计算尺寸\n单元格宽:${cellX} 使用视图宽度${width}除以图像宽度${imageWidth}\n单元格高:${cellY} 使用视图宽度${height}除以图像宽度${imageHeight}\n采用${cellSize}作为视图单元格尺寸"
|
||||||
)
|
)
|
||||||
|
@ -226,7 +227,7 @@ class TurretSketchpadView(context: Context, attributeSet: AttributeSet? = null)
|
||||||
* @param imageWidth Int
|
* @param imageWidth Int
|
||||||
*/
|
*/
|
||||||
private fun drawCoordinate(canvas: Canvas) {
|
private fun drawCoordinate(canvas: Canvas) {
|
||||||
if (drawCoordinate) {
|
if (drawCoordinate && cellSize > 0) {
|
||||||
//如果需要绘制
|
//如果需要绘制
|
||||||
val paint = Paint()
|
val paint = Paint()
|
||||||
paint.color = coordinateColor
|
paint.color = coordinateColor
|
||||||
|
|
|
@ -13,6 +13,7 @@ import android.view.MotionEvent
|
||||||
import android.view.View
|
import android.view.View
|
||||||
import android.widget.Toast
|
import android.widget.Toast
|
||||||
import com.coldmint.rust.core.R
|
import com.coldmint.rust.core.R
|
||||||
|
import com.coldmint.rust.core.debug.LogCat
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 炮塔视图
|
* 炮塔视图
|
||||||
|
@ -44,14 +45,14 @@ class TurretView(context: Context, attributeSet: AttributeSet? = null) :
|
||||||
* @param canDrag Boolean
|
* @param canDrag Boolean
|
||||||
*/
|
*/
|
||||||
fun setCanDrag(canDrag: Boolean) {
|
fun setCanDrag(canDrag: Boolean) {
|
||||||
Log.d(debugKey, "${turretData.name} 可拖动状态${canDrag}")
|
LogCat.d(debugKey, "${turretData.name} 可拖动状态${canDrag}")
|
||||||
this.canDrag = canDrag
|
this.canDrag = canDrag
|
||||||
if (canDrag) {
|
if (canDrag) {
|
||||||
val and = turretSketchpadView?.toAndroidCoordinate(turretData.gameCoordinateData)
|
val and = turretSketchpadView?.toAndroidCoordinate(turretData.gameCoordinateData)
|
||||||
if (and != null) {
|
if (and != null) {
|
||||||
turretSketchpadView?.setKeyCoordinate(and)
|
turretSketchpadView?.setKeyCoordinate(and)
|
||||||
} else {
|
} else {
|
||||||
Log.e(debugKey, "可拖动状态,辅助线定位失败。")
|
LogCat.e(debugKey, "可拖动状态,辅助线定位失败。")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -123,7 +124,7 @@ class TurretView(context: Context, attributeSet: AttributeSet? = null) :
|
||||||
return canDrag
|
return canDrag
|
||||||
}
|
}
|
||||||
MotionEvent.ACTION_MOVE -> {
|
MotionEvent.ACTION_MOVE -> {
|
||||||
Log.d(debugKey, "收到移动${turretData.name} 可拖动状态${canDrag}")
|
LogCat.d(debugKey, "收到移动${turretData.name} 可拖动状态${canDrag}")
|
||||||
if (canDrag) {
|
if (canDrag) {
|
||||||
val and = CoordinateData(event.x.toInt(), event.y.toInt())
|
val and = CoordinateData(event.x.toInt(), event.y.toInt())
|
||||||
val gameCoordinateData = turretSketchpadView!!.toGameCoordinate(and)
|
val gameCoordinateData = turretSketchpadView!!.toGameCoordinate(and)
|
||||||
|
@ -145,7 +146,7 @@ class TurretView(context: Context, attributeSet: AttributeSet? = null) :
|
||||||
super.onDraw(canvas)
|
super.onDraw(canvas)
|
||||||
if (this::turretData.isInitialized) {
|
if (this::turretData.isInitialized) {
|
||||||
if (turretSketchpadView == null) {
|
if (turretSketchpadView == null) {
|
||||||
Log.e(debugKey, "未绑定画板,停止绘制。")
|
LogCat.e(debugKey, "未绑定画板,停止绘制。")
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
val paint = Paint()
|
val paint = Paint()
|
||||||
|
@ -155,7 +156,7 @@ class TurretView(context: Context, attributeSet: AttributeSet? = null) :
|
||||||
null
|
null
|
||||||
}
|
}
|
||||||
if (bitmap == null) {
|
if (bitmap == null) {
|
||||||
Log.e(debugKey, "无法加载炮塔图像。")
|
LogCat.e(debugKey, "无法加载炮塔图像。")
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
if (turretData.scaleValue != 1f) {
|
if (turretData.scaleValue != 1f) {
|
||||||
|
@ -177,7 +178,7 @@ class TurretView(context: Context, attributeSet: AttributeSet? = null) :
|
||||||
bitmap.recycle()
|
bitmap.recycle()
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
Log.e(debugKey, "未设置炮塔数据,停止绘制。")
|
LogCat.e(debugKey, "未设置炮塔数据,停止绘制。")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -7,6 +7,7 @@ import com.coldmint.rust.core.dataBean.ApiResponse
|
||||||
import com.coldmint.rust.core.dataBean.OrderDataBean
|
import com.coldmint.rust.core.dataBean.OrderDataBean
|
||||||
import com.coldmint.rust.core.dataBean.OrderListDataBean
|
import com.coldmint.rust.core.dataBean.OrderListDataBean
|
||||||
import com.coldmint.rust.core.dataBean.PlanDataBean
|
import com.coldmint.rust.core.dataBean.PlanDataBean
|
||||||
|
import com.coldmint.rust.core.debug.LogCat
|
||||||
import com.coldmint.rust.core.interfaces.ApiCallBack
|
import com.coldmint.rust.core.interfaces.ApiCallBack
|
||||||
import com.google.gson.Gson
|
import com.google.gson.Gson
|
||||||
import okhttp3.*
|
import okhttp3.*
|
||||||
|
@ -60,7 +61,7 @@ class ActivationApp private constructor() {
|
||||||
override fun onResponse(call: Call, response: Response) {
|
override fun onResponse(call: Call, response: Response) {
|
||||||
try {
|
try {
|
||||||
val data = response.body!!.string()
|
val data = response.body!!.string()
|
||||||
Log.d("确认订单", data)
|
LogCat.d("确认订单", data)
|
||||||
val finalApiResponse =
|
val finalApiResponse =
|
||||||
gson.fromJson(data, ApiResponse::class.java)
|
gson.fromJson(data, ApiResponse::class.java)
|
||||||
handler.post {
|
handler.post {
|
||||||
|
|
|
@ -5,6 +5,7 @@ import android.os.Looper
|
||||||
import android.util.Log
|
import android.util.Log
|
||||||
import com.coldmint.rust.core.dataBean.ApiResponse
|
import com.coldmint.rust.core.dataBean.ApiResponse
|
||||||
import com.coldmint.rust.core.dataBean.CouponListDataBean
|
import com.coldmint.rust.core.dataBean.CouponListDataBean
|
||||||
|
import com.coldmint.rust.core.debug.LogCat
|
||||||
import com.coldmint.rust.core.interfaces.ApiCallBack
|
import com.coldmint.rust.core.interfaces.ApiCallBack
|
||||||
import com.google.gson.Gson
|
import com.google.gson.Gson
|
||||||
import okhttp3.*
|
import okhttp3.*
|
||||||
|
@ -58,7 +59,7 @@ class ErrorReport {
|
||||||
override fun onResponse(call: Call, response: Response) {
|
override fun onResponse(call: Call, response: Response) {
|
||||||
try {
|
try {
|
||||||
val data = response.body!!.string()
|
val data = response.body!!.string()
|
||||||
Log.d("错误反馈数据", data)
|
LogCat.d("错误反馈数据", data)
|
||||||
val finalApiResponse =
|
val finalApiResponse =
|
||||||
gson.fromJson(data, ApiResponse::class.java)
|
gson.fromJson(data, ApiResponse::class.java)
|
||||||
handler.post {
|
handler.post {
|
||||||
|
|
|
@ -6,6 +6,7 @@ import android.util.Log
|
||||||
import com.coldmint.rust.core.dataBean.HotSearchData
|
import com.coldmint.rust.core.dataBean.HotSearchData
|
||||||
import com.coldmint.rust.core.dataBean.SearchSuggestionsData
|
import com.coldmint.rust.core.dataBean.SearchSuggestionsData
|
||||||
import com.coldmint.rust.core.dataBean.user.SearchResultDataBean
|
import com.coldmint.rust.core.dataBean.user.SearchResultDataBean
|
||||||
|
import com.coldmint.rust.core.debug.LogCat
|
||||||
import com.coldmint.rust.core.interfaces.ApiCallBack
|
import com.coldmint.rust.core.interfaces.ApiCallBack
|
||||||
import com.google.gson.Gson
|
import com.google.gson.Gson
|
||||||
import okhttp3.*
|
import okhttp3.*
|
||||||
|
@ -87,7 +88,7 @@ class Search private constructor() {
|
||||||
override fun onResponse(call: Call, response: Response) {
|
override fun onResponse(call: Call, response: Response) {
|
||||||
try {
|
try {
|
||||||
val data = response.body!!.string()
|
val data = response.body!!.string()
|
||||||
Log.d("搜索结果",data)
|
LogCat.d("搜索结果",data)
|
||||||
val finalSearchSuggestionsData =
|
val finalSearchSuggestionsData =
|
||||||
gson.fromJson(data, SearchSuggestionsData::class.java)
|
gson.fromJson(data, SearchSuggestionsData::class.java)
|
||||||
handler.post {
|
handler.post {
|
||||||
|
|
|
@ -2,6 +2,7 @@ package com.coldmint.rust.core.web
|
||||||
|
|
||||||
import android.os.Environment
|
import android.os.Environment
|
||||||
import android.util.Log
|
import android.util.Log
|
||||||
|
import com.coldmint.rust.core.debug.LogCat
|
||||||
import com.coldmint.rust.core.tool.FileOperator
|
import com.coldmint.rust.core.tool.FileOperator
|
||||||
import okhttp3.*
|
import okhttp3.*
|
||||||
import java.io.File
|
import java.io.File
|
||||||
|
@ -160,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://")) {
|
||||||
//如果说直链
|
//如果说直链
|
||||||
Log.d("真实路径组合", "直链" + string)
|
LogCat.d("真实路径组合", "直链" + string)
|
||||||
string
|
string
|
||||||
} else if (string.startsWith(Environment.getExternalStorageDirectory().absolutePath) || string.startsWith(
|
} else if (string.startsWith(Environment.getExternalStorageDirectory().absolutePath) || string.startsWith(
|
||||||
"/data/"
|
"/data/"
|
||||||
)
|
)
|
||||||
) {
|
) {
|
||||||
//如果是文件路径
|
//如果是文件路径
|
||||||
Log.d("真实路径组合", "是文件路径" + string)
|
LogCat.d("真实路径组合", "是文件路径" + string)
|
||||||
string
|
string
|
||||||
} else {
|
} else {
|
||||||
//如果开头包含../上级目录
|
//如果开头包含../上级目录
|
||||||
|
@ -184,7 +185,7 @@ object ServerConfiguration {
|
||||||
"${website}/${string}"
|
"${website}/${string}"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Log.d("真实路径组合", result)
|
LogCat.d("真实路径组合", result)
|
||||||
result
|
result
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -8,6 +8,7 @@ import com.coldmint.rust.core.dataBean.SubscriptionData
|
||||||
import com.coldmint.rust.core.dataBean.WebTemplatePackageDetailsData
|
import com.coldmint.rust.core.dataBean.WebTemplatePackageDetailsData
|
||||||
import com.coldmint.rust.core.dataBean.WebTemplatePackageListData
|
import com.coldmint.rust.core.dataBean.WebTemplatePackageListData
|
||||||
import com.coldmint.rust.core.dataBean.template.WebTemplateData
|
import com.coldmint.rust.core.dataBean.template.WebTemplateData
|
||||||
|
import com.coldmint.rust.core.debug.LogCat
|
||||||
import com.coldmint.rust.core.interfaces.ApiCallBack
|
import com.coldmint.rust.core.interfaces.ApiCallBack
|
||||||
import com.google.gson.Gson
|
import com.google.gson.Gson
|
||||||
import okhttp3.*
|
import okhttp3.*
|
||||||
|
@ -53,7 +54,7 @@ class TemplatePhp {
|
||||||
override fun onResponse(call: Call, response: Response) {
|
override fun onResponse(call: Call, response: Response) {
|
||||||
try {
|
try {
|
||||||
val data = response.body!!.string()
|
val data = response.body!!.string()
|
||||||
Log.d("网络模板包数据", data)
|
LogCat.d("网络模板包数据", data)
|
||||||
val finalWebTemplatePackageListData =
|
val finalWebTemplatePackageListData =
|
||||||
gson.fromJson(data, WebTemplatePackageListData::class.java)
|
gson.fromJson(data, WebTemplatePackageListData::class.java)
|
||||||
handler.post {
|
handler.post {
|
||||||
|
@ -101,7 +102,7 @@ class TemplatePhp {
|
||||||
override fun onResponse(call: Call, response: Response) {
|
override fun onResponse(call: Call, response: Response) {
|
||||||
try {
|
try {
|
||||||
val data = response.body!!.string()
|
val data = response.body!!.string()
|
||||||
Log.d("获取网络模板详情", data)
|
LogCat.d("获取网络模板详情", data)
|
||||||
val finalWebTemplatePackageListData =
|
val finalWebTemplatePackageListData =
|
||||||
gson.fromJson(data, WebTemplateData::class.java)
|
gson.fromJson(data, WebTemplateData::class.java)
|
||||||
handler.post {
|
handler.post {
|
||||||
|
@ -146,7 +147,7 @@ class TemplatePhp {
|
||||||
override fun onResponse(call: Call, response: Response) {
|
override fun onResponse(call: Call, response: Response) {
|
||||||
try {
|
try {
|
||||||
val data = response.body!!.string()
|
val data = response.body!!.string()
|
||||||
Log.d("获取网络模板详情", data)
|
LogCat.d("获取网络模板详情", data)
|
||||||
val finalWebTemplatePackageListData =
|
val finalWebTemplatePackageListData =
|
||||||
gson.fromJson(data, WebTemplatePackageDetailsData::class.java)
|
gson.fromJson(data, WebTemplatePackageDetailsData::class.java)
|
||||||
handler.post {
|
handler.post {
|
||||||
|
@ -191,7 +192,7 @@ class TemplatePhp {
|
||||||
override fun onResponse(call: Call, response: Response) {
|
override fun onResponse(call: Call, response: Response) {
|
||||||
try {
|
try {
|
||||||
val data = response.body!!.string()
|
val data = response.body!!.string()
|
||||||
Log.d("获取网络订阅", data)
|
LogCat.d("获取网络订阅", data)
|
||||||
val finalSubscriptionData =
|
val finalSubscriptionData =
|
||||||
gson.fromJson(data, SubscriptionData::class.java)
|
gson.fromJson(data, SubscriptionData::class.java)
|
||||||
handler.post {
|
handler.post {
|
||||||
|
@ -237,7 +238,7 @@ class TemplatePhp {
|
||||||
override fun onResponse(call: Call, response: Response) {
|
override fun onResponse(call: Call, response: Response) {
|
||||||
try {
|
try {
|
||||||
val data = response.body!!.string()
|
val data = response.body!!.string()
|
||||||
Log.d("订阅模板", data)
|
LogCat.d("订阅模板", data)
|
||||||
val finalApiResponse =
|
val finalApiResponse =
|
||||||
gson.fromJson(data, ApiResponse::class.java)
|
gson.fromJson(data, ApiResponse::class.java)
|
||||||
handler.post {
|
handler.post {
|
||||||
|
@ -283,7 +284,7 @@ class TemplatePhp {
|
||||||
override fun onResponse(call: Call, response: Response) {
|
override fun onResponse(call: Call, response: Response) {
|
||||||
try {
|
try {
|
||||||
val data = response.body!!.string()
|
val data = response.body!!.string()
|
||||||
Log.d("退订模板", data)
|
LogCat.d("退订模板", data)
|
||||||
val finalApiResponse =
|
val finalApiResponse =
|
||||||
gson.fromJson(data, ApiResponse::class.java)
|
gson.fromJson(data, ApiResponse::class.java)
|
||||||
handler.post {
|
handler.post {
|
||||||
|
@ -328,7 +329,7 @@ class TemplatePhp {
|
||||||
override fun onResponse(call: Call, response: Response) {
|
override fun onResponse(call: Call, response: Response) {
|
||||||
try {
|
try {
|
||||||
val data = response.body!!.string()
|
val data = response.body!!.string()
|
||||||
Log.d("获取用户创建的模板包列表", data)
|
LogCat.d("获取用户创建的模板包列表", data)
|
||||||
val finalApiResponse =
|
val finalApiResponse =
|
||||||
gson.fromJson(data, WebTemplatePackageListData::class.java)
|
gson.fromJson(data, WebTemplatePackageListData::class.java)
|
||||||
handler.post {
|
handler.post {
|
||||||
|
@ -380,7 +381,7 @@ class TemplatePhp {
|
||||||
override fun onResponse(call: Call, response: Response) {
|
override fun onResponse(call: Call, response: Response) {
|
||||||
try {
|
try {
|
||||||
val data = response.body!!.string()
|
val data = response.body!!.string()
|
||||||
Log.d("添加模板", data)
|
LogCat.d("添加模板", data)
|
||||||
val finalApiResponse =
|
val finalApiResponse =
|
||||||
gson.fromJson(data, ApiResponse::class.java)
|
gson.fromJson(data, ApiResponse::class.java)
|
||||||
handler.post {
|
handler.post {
|
||||||
|
@ -444,7 +445,7 @@ class TemplatePhp {
|
||||||
override fun onResponse(call: Call, response: Response) {
|
override fun onResponse(call: Call, response: Response) {
|
||||||
try {
|
try {
|
||||||
val data = response.body!!.string()
|
val data = response.body!!.string()
|
||||||
Log.d("创建模板包", data)
|
LogCat.d("创建模板包", data)
|
||||||
val finalWebTemplatePackageListData =
|
val finalWebTemplatePackageListData =
|
||||||
gson.fromJson(data, ApiResponse::class.java)
|
gson.fromJson(data, ApiResponse::class.java)
|
||||||
handler.post {
|
handler.post {
|
||||||
|
|
|
@ -5,6 +5,7 @@ import android.os.Looper
|
||||||
import android.util.Log
|
import android.util.Log
|
||||||
import com.coldmint.rust.core.dataBean.ApiResponse
|
import com.coldmint.rust.core.dataBean.ApiResponse
|
||||||
import com.coldmint.rust.core.dataBean.mod.*
|
import com.coldmint.rust.core.dataBean.mod.*
|
||||||
|
import com.coldmint.rust.core.debug.LogCat
|
||||||
import com.coldmint.rust.core.interfaces.ApiCallBack
|
import com.coldmint.rust.core.interfaces.ApiCallBack
|
||||||
import com.coldmint.rust.core.interfaces.ProgressListener
|
import com.coldmint.rust.core.interfaces.ProgressListener
|
||||||
import com.coldmint.rust.core.tool.ProgressMultipartBody
|
import com.coldmint.rust.core.tool.ProgressMultipartBody
|
||||||
|
@ -745,7 +746,7 @@ class WebMod private constructor() {
|
||||||
override fun onResponse(call: Call, response: Response) {
|
override fun onResponse(call: Call, response: Response) {
|
||||||
try {
|
try {
|
||||||
val data = response.body!!.string()
|
val data = response.body!!.string()
|
||||||
Log.d("模组信息", data)
|
LogCat.d("模组信息", data)
|
||||||
val finalWebModInfoData =
|
val finalWebModInfoData =
|
||||||
gson.fromJson(data, WebModInfoData::class.java)
|
gson.fromJson(data, WebModInfoData::class.java)
|
||||||
handler.post {
|
handler.post {
|
||||||
|
@ -1117,7 +1118,7 @@ class WebMod private constructor() {
|
||||||
val body = response.body
|
val body = response.body
|
||||||
if (body != null) {
|
if (body != null) {
|
||||||
val data = body.string()
|
val data = body.string()
|
||||||
Log.d("发布模组响应", data)
|
LogCat.d("发布模组响应", data)
|
||||||
val finalApiResponse = gson.fromJson(data, ApiResponse::class.java)
|
val finalApiResponse = gson.fromJson(data, ApiResponse::class.java)
|
||||||
handler.post {
|
handler.post {
|
||||||
apiCallBack.onResponse(finalApiResponse)
|
apiCallBack.onResponse(finalApiResponse)
|
||||||
|
|
Loading…
Reference in New Issue
Block a user