Compare commits

...

18 Commits

Author SHA1 Message Date
c3ac73c8f4 修复BUG 2024-08-19 07:48:53 +08:00
5b09dc0a84 修复编辑器弹窗颜色问题 2024-07-27 09:30:55 +08:00
3fc7bbc769 修复编辑器弹窗颜色问题 2024-07-27 09:28:37 +08:00
7c052f0f7a Merge remote-tracking branch 'origin/master' 2024-07-27 09:24:57 +08:00
fe90fb35ac 修复数据集的错误,忽略打包的apk文件。 2024-07-22 20:19:26 +08:00
91bd932a8c 修复数据集的错误 2024-07-22 20:02:55 +08:00
e2cef38c2e 修复代码表搜索的的错误 2024-07-22 19:22:11 +08:00
05331665f9 修复颜色视觉障碍BUG和导航BUG 2024-07-21 18:43:49 +08:00
6c2f5d8024 调整代码表色调。 2024-07-20 17:18:44 +08:00
bc1af034a9 更新到新的举报接口。 2024-07-20 16:30:54 +08:00
baf8b01582 修复BUG,添加代码表搜索功能 2024-07-20 11:19:57 +08:00
913cc1a4d7 优化代码表,文本可复制! 2024-07-15 16:02:03 +08:00
a2c71a5e15 更新了代码表 2024-07-10 12:33:26 +08:00
36643ae2d2 更新了代码表 2024-07-08 09:06:18 +08:00
a8822131b1 修复了仓库权限BUG 2024-04-18 14:26:30 +08:00
bef72863ae 修复了一些BUG优化了一下社区的UI 2024-04-18 14:11:54 +08:00
0f7c318850 调整历史记录的对话框样式。 2024-03-02 15:41:28 +08:00
ef95908cd4 修复第一次运行助手时,没有游戏目录,没权限无法创建模组的问题。 2024-03-02 15:25:40 +08:00
90 changed files with 1638 additions and 1089 deletions

1
.gitignore vendored
View File

@ -61,3 +61,4 @@ release/
# Local configuration file (sdk path, etc)
local.properties
app/debug/

View File

@ -32,7 +32,7 @@ android {
minSdkVersion 23
targetSdkVersion 33
versionCode 28
versionName "2.1.1 Bata6(2024-2-17)"
versionName "2.1.1 Test(2024-7-20)"
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
}
@ -95,7 +95,8 @@ dependencies {
implementation 'androidx.appcompat:appcompat:1.6.1'
implementation 'com.google.android.material:material:1.9.0'
implementation platform('com.google.firebase:firebase-bom:31.1.1')
//BUG的组件
implementation platform('com.google.firebase:firebase-bom:31.3.0')
implementation 'com.google.firebase:firebase-analytics-ktx'
implementation 'com.google.firebase:firebase-crashlytics-ktx'
implementation 'com.google.firebase:firebase-perf-ktx'
@ -178,4 +179,9 @@ dependencies {
CSS Flexbox */
implementation 'com.google.android.flexbox:flexbox:3.0.0'
// Android智能下拉刷新框架-SmartRefreshLayout
implementation 'io.github.scwang90:refresh-layout-kernel:2.1.0' //
implementation 'io.github.scwang90:refresh-header-classics:2.1.0' //
implementation 'io.github.scwang90:refresh-footer-classics:2.1.0' //
}

View File

@ -1,20 +0,0 @@
{
"version": 3,
"artifactType": {
"type": "APK",
"kind": "Directory"
},
"applicationId": "com.coldmint.rust.pro",
"variantName": "release",
"elements": [
{
"type": "SINGLE",
"filters": [],
"attributes": [],
"versionCode": 28,
"versionName": "2.1 Bata6(2023-7-20)",
"outputFile": "app-release.apk"
}
],
"elementType": "File"
}

View File

@ -25,17 +25,14 @@
android:supportsRtl="true"
android:theme="@style/Theme.rust.Concept"
android:usesCleartextTraffic="true"
android:screenOrientation="portrait"
tools:targetApi="tiramisu">
<activity
android:name=".FeedbackActivity"
android:exported="false"
android:screenOrientation="portrait"
tools:ignore="LockedOrientationActivity" />
<activity
android:name=".ChangePasswordActivity"
android:exported="false"
android:screenOrientation="portrait"
tools:ignore="LockedOrientationActivity" />
<activity
android:name=".NetworkTemplatePackageDetailsActivity"
@ -43,6 +40,8 @@
<activity
android:name=".CustomizeEditTextActivity"
android:exported="false"/>
<!-- 模组界面-->
<activity android:name=".fragments.WarehouseFragment" />
<activity
android:name=".SearchActivity"
android:exported="false"/>
@ -139,6 +138,9 @@
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
<meta-data
android:name="android.app.shortcuts"
android:resource="@xml/shortcuts" />
</activity>
<activity
android:name=".ImporterActivity"
@ -281,7 +283,12 @@
android:name=".CreateTemplateActivity"/>
<activity
android:name=".CodeTableActivity"
android:exported="false"/>
android:launchMode="singleTask"
android:icon="@drawable/table"
android:taskAffinity="@string/code_table"
android:documentLaunchMode="intoExisting"
android:exported="false">
</activity>
<activity
android:name=".LoginActivity"
android:exported="false"/>

View File

@ -1,5 +1,6 @@
package com.coldmint.rust.pro
import android.annotation.SuppressLint
import android.graphics.Color
import android.os.Bundle
import android.text.Editable
@ -10,17 +11,17 @@ import android.text.method.LinkMovementMethod
import android.text.style.ClickableSpan
import android.view.LayoutInflater
import android.view.Menu
import android.view.MenuItem
import android.view.View
import android.view.inputmethod.EditorInfo
import androidx.core.view.isVisible
import androidx.recyclerview.widget.LinearLayoutManager
import com.coldmint.rust.core.database.code.CodeDataBase
import com.coldmint.rust.core.database.code.CodeInfo
import com.coldmint.rust.core.database.code.SectionInfo
import com.coldmint.rust.pro.adapters.CodeTableAdapter
import com.coldmint.rust.pro.adapters.CodeTableItemAdapter
import com.coldmint.rust.pro.base.BaseActivity
import com.coldmint.rust.pro.databinding.ActivityCodeTableBinding
import com.muqing.gj
import java.util.concurrent.Executors
class CodeTableActivity : BaseActivity<ActivityCodeTableBinding>() {
@ -29,18 +30,51 @@ class CodeTableActivity : BaseActivity<ActivityCodeTableBinding>() {
override fun whenCreateActivity(savedInstanceState: Bundle?, canUseView: Boolean) {
if (canUseView) {
title = getString(R.string.code_table)
viewBinding.edittext.hint = title
setReturnButton()
loadData()
//设置上下选择按钮
viewBinding.listTop.setOnClickListener {
if (CodeTableAdapter.picklist.isEmpty()) {
return@setOnClickListener
}
if (--CodeTableAdapter.pick < 0) {
CodeTableAdapter.pick = 0
}
val get = CodeTableAdapter.picklist[CodeTableAdapter.pick]
(viewBinding.codeRecyclerB.layoutManager as LinearLayoutManager).scrollToPositionWithOffset(get, 0)
}
viewBinding.listButtom.setOnClickListener {
if (CodeTableAdapter.picklist.isEmpty()) {
return@setOnClickListener
}
val size = CodeTableAdapter.picklist.size
if (++CodeTableAdapter.pick == size - 1) {
CodeTableAdapter.pick = 0
}
val get = CodeTableAdapter.picklist[CodeTableAdapter.pick]
(viewBinding.codeRecyclerB.layoutManager as LinearLayoutManager).scrollToPositionWithOffset(get,
0)
}
viewBinding.edittext.addTextChangedListener(object : TextWatcher {
override fun beforeTextChanged(a: CharSequence?, p1: Int, p2: Int, p3: Int) {
}
override fun onTextChanged(a: CharSequence?, p1: Int, p2: Int, p3: Int) {
if (a.isNullOrEmpty()) {
/* if (a.isNullOrEmpty()) {
loadData()
return
}
loadData(a.toString())
loadData(a.toString())*/
if (a.isNullOrEmpty()) {
viewBinding.searchPick.isVisible = false
loadData()
}
}
override fun afterTextChanged(a: Editable?) {
}
})
@ -48,12 +82,20 @@ class CodeTableActivity : BaseActivity<ActivityCodeTableBinding>() {
if (p1 == EditorInfo.IME_ACTION_SEARCH) {
if (v?.text.isNullOrEmpty()) {
loadData()
}else
loadData(v?.text.toString())
} else {
var toString = v?.text.toString()
if (toString.startsWith("/")) {
toString = toString.substring(1)
loadData(toString)
} else {
viewBinding.searchPick.isVisible = true
adapter.item?.search(toString)
}
}
}
false
}
viewBinding.back.setOnClickListener { moveTaskToBack(true) }
}
}
@ -69,20 +111,13 @@ class CodeTableActivity : BaseActivity<ActivityCodeTableBinding>() {
*/
private fun ifNeedFinish() {
if (filterMode) {
loadData()
} else {
finish()
}
}
/**
* 加载数据
* @param key String?
* @param section String?
*/
fun loadData(key: String? = null, section: String? = null) {
//如果 key start 有 / 则取后的string
executorService.submit {
filterMode = key != null || section != null
val sectionMap = HashMap<String, String>()
@ -131,22 +166,33 @@ class CodeTableActivity : BaseActivity<ActivityCodeTableBinding>() {
}
if (group.isNotEmpty()) {
val adapter = CodeTableAdapter(this, group, item)
adapter = CodeTableAdapter(this, group, item, viewBinding)
adapter.setVersionMap(versionMap)
adapter.setTypeNameMap(typeNameMap)
adapter.setSectionMap(sectionMap)
if (adapter.item == null) {
adapter.item = CodeTableItemAdapter(viewBinding.codeRecyclerB, item[0])
adapter.item!!.versionMap = versionMap
adapter.item!!.typeNameMap = typeNameMap
adapter.item!!.sectionMap = sectionMap
CodeTableAdapter.i = group[0].translate
}
runOnUiThread {
adapter.labelFunction = { _, _, string ->
// section = string
viewBinding.codeRecyclerB.adapter = adapter.item
/* adapter.labelFunction = { _, _, string ->
// section = string
if (string.isEmpty()) {
loadData()
}
loadData(string)
}
}*/
viewBinding.displayView.isVisible = false
viewBinding.progressBar.isVisible = false
viewBinding.expandableListView.isVisible = true
viewBinding.expandableListView.setAdapter(adapter)
viewBinding.expandableListView.layoutManager = LinearLayoutManager(this)
viewBinding.expandableListView.adapter = adapter
// viewBinding.expandableListView.swapAdapter(adapter, true)
}
} else {
notFindKey(key)
@ -154,10 +200,13 @@ class CodeTableActivity : BaseActivity<ActivityCodeTableBinding>() {
}
}
lateinit var adapter: CodeTableAdapter
/**
* 没有找到节
* @param key String?
*/
@SuppressLint("StringFormatInvalid")
private fun notFindKey(key: String?) {
if (!key.isNullOrBlank()) {
val tip = String.format(getString(R.string.not_find_code_name), key)
@ -168,7 +217,6 @@ class CodeTableActivity : BaseActivity<ActivityCodeTableBinding>() {
spannableString.setSpan(
object : ClickableSpan() {
override fun onClick(p0: View) {
editisVisible(false)
loadData()
}
}, start, start + action.length, Spannable.SPAN_EXCLUSIVE_EXCLUSIVE
@ -183,69 +231,19 @@ class CodeTableActivity : BaseActivity<ActivityCodeTableBinding>() {
viewBinding.expandableListView.isVisible = false
viewBinding.progressBar.isVisible = false
}
override fun onCreateOptionsMenu(menu: Menu): Boolean {
menuInflater.inflate(R.menu.menu_code_table, menu)
return true
}
override fun onOptionsItemSelected(item: MenuItem): Boolean {
when (item.itemId) {
R.id.filter_units -> {
if (viewBinding.edittext.isVisible) {
if (viewBinding.edittext.text.isNullOrEmpty()) {
loadData()
} else {
loadData(viewBinding.edittext.text.toString())
}
} else {
editisVisible(true)
}
/*
InputDialog(this).setTitle(R.string.filter).setMessage(R.string.filter_tip)
.setInputCanBeEmpty(false).setMaxNumber(20)
.setPositiveButton(R.string.dialog_ok) { text ->
var key = text
if (key.length > 20) {
key = key.substring(0, 20)
}
loadData(key)
true
}.setNegativeButton(R.string.dialog_close) {
}.show()*/
}
android.R.id.home -> {
if (viewBinding.edittext.isVisible) {
editisVisible(false)
return true
}
ifNeedFinish()
return true
}
}
return super.onOptionsItemSelected(item)
}
private fun editisVisible(b: Boolean) {
viewBinding.edittext.isVisible = b
if (!b) {
viewBinding.edittext.setText("")
gj.ycjp(viewBinding.edittext)
} else {
gj.tcjp(viewBinding.edittext)
}
}
@Deprecated("Deprecated in Java")
@Deprecated("Deprecated in Java", ReplaceWith("moveTaskToBack(true)"))
override fun onBackPressed() {
if (viewBinding.edittext.isVisible) {
editisVisible(false)
return
}
ifNeedFinish()
//显示桌面
moveTaskToBack(true)
// ifNeedFinish()
}
override fun getViewBindingObject(layoutInflater: LayoutInflater): ActivityCodeTableBinding {
return ActivityCodeTableBinding.inflate(layoutInflater)
}

View File

@ -12,6 +12,7 @@ import android.view.inputmethod.InputMethodManager
import android.widget.Toast
import androidx.core.widget.addTextChangedListener
import com.coldmint.rust.pro.databinding.ActivityCreateModBinding
import com.coldmint.rust.pro.tool.GlobalMethod
import java.io.File
import java.io.FileWriter
import java.io.IOException
@ -108,11 +109,15 @@ class CreateModActivity : BaseActivity<ActivityCreateModBinding>() {
stringBuilder.append(name)
stringBuilder.append("\ndescription: ")
stringBuilder.append(describe)
val minVersion:String = viewBinding.minVersionEdit.text.toString()
if (minVersion.isNotBlank()){
val minVersion: String = viewBinding.minVersionEdit.text.toString()
if (minVersion.isNotBlank()) {
stringBuilder.append("\nminVersion: ")
stringBuilder.append(minVersion)
}
GlobalMethod.requestStoragePermissions(this@CreateModActivity) {
if (!it) {
return@requestStoragePermissions
}
val mod_directory =
File(Environment.getExternalStorageDirectory().absolutePath + "/rustedWarfare/units/" + name)
if (mod_directory.exists()) {
@ -123,19 +128,15 @@ class CreateModActivity : BaseActivity<ActivityCreateModBinding>() {
)
} else {
if (mod_directory.mkdirs()) {
try {
val fileWriter = FileWriter(mod_directory.absolutePath + "/mod-info.txt")
fileWriter.write(stringBuilder.toString())
fileWriter.close()
setResult(RESULT_OK)
finish()
} catch (e: IOException) {
e.printStackTrace()
}
} else {
Toast.makeText(this@CreateModActivity, "你的手机拒绝创建目录", Toast.LENGTH_SHORT).show()
}
}
}
})
}

View File

@ -24,7 +24,7 @@ class GameCheckActivity : BaseActivity<ActivityGameCheckBinding>() {
if (canUseView) {
setReturnButton()
setTitle(R.string.game_configured)
viewBinding.startButton.setOnClickListener(View.OnClickListener {
viewBinding.startButton.setOnClickListener {
if (AppOperator.isAppInstalled(
this@GameCheckActivity,
GlobalMethod.DEFAULT_GAME_PACKAGE
@ -39,7 +39,7 @@ class GameCheckActivity : BaseActivity<ActivityGameCheckBinding>() {
)
.show()
}
})
}
viewBinding.completionButton.setOnClickListener(View.OnClickListener {
AppSettings.setValue(AppSettings.Setting.SetGameStorage, true)
finish()

View File

@ -1,6 +1,5 @@
package com.coldmint.rust.pro
import android.content.Intent
import android.content.pm.PackageInfo
import android.content.pm.PackageManager
@ -27,7 +26,6 @@ import com.coldmint.rust.core.debug.LogCat
import com.coldmint.rust.core.interfaces.ApiCallBack
import com.coldmint.rust.core.interfaces.UnzipListener
import com.coldmint.rust.core.tool.AppOperator
import com.coldmint.rust.core.tool.DebugHelper
import com.coldmint.rust.core.tool.FileOperator
import com.coldmint.rust.core.web.AppUpdate
import com.coldmint.rust.core.web.ServerConfiguration
@ -42,12 +40,12 @@ import com.google.android.material.color.DynamicColors
import com.google.android.material.dialog.MaterialAlertDialogBuilder
import com.google.android.material.snackbar.Snackbar
import com.google.gson.Gson
//import com.gyf.immersionbar.ImmersionBar
import org.json.JSONObject
import java.io.File
import java.util.Locale
import java.util.concurrent.Executors
import java.util.zip.ZipEntry
@Suppress("ConstPropertyName")
class MainActivity : BaseActivity<ActivityMainBinding>() {
private lateinit var appBarConfiguration: AppBarConfiguration
@ -63,14 +61,8 @@ class MainActivity : BaseActivity<ActivityMainBinding>() {
companion object {
//仓库和社区碎片链接TabLayout间隔
const val linkInterval: Long = 195
const val hideViewDelay: Long = 150
}
/**
* 将Toolbar设置为ActionBar
*/
private fun useToolbarSetSupportActionBar() {
// private var time:Long=0;
}
/**
@ -260,7 +252,7 @@ class MainActivity : BaseActivity<ActivityMainBinding>() {
val dataBase = menu.findItem(R.id.database_item)
val template = menu.findItem(R.id.template_item)
val codeTable = menu.findItem(R.id.code_table)
val mod = menu.findItem(R.id.mod_item)
// val mod = menu.findItem(R.id.mod_item)
val community = menu.findItem(R.id.community_item)
// val group = menu.findItem(R.id.user_group)
// group.setOnMenuItemClickListener {
@ -280,32 +272,56 @@ class MainActivity : BaseActivity<ActivityMainBinding>() {
template.isVisible = isActive
// help.isVisible = isActive
codeTable.isVisible = isActive
if (mod.isChecked) {
// viewBinding.mainButton.isVisible = isActive
}
if (isActive) {
//数据库
/* dataBase.setOnMenuItemClickListener {
/* dataBase.setOnMenuItemClickListener {
viewBinding.mainButton.postOnAnimationDelayed({
// viewBinding.tabLayout.isVisible = false
// viewBinding.tabLayout.isVisible = false
viewBinding.mainButton.hide()
}, hideViewDelay)
false
}*/
/* template.setOnMenuItemClickListener {
/* template.setOnMenuItemClickListener {
viewBinding.mainButton.postOnAnimationDelayed({
// viewBinding.tabLayout.isVisible = true
// viewBinding.tabLayout.isVisible = true
viewBinding.mainButton.show()
}, hideViewDelay)
false
}*/
codeTable.setOnMenuItemClickListener {
startActivity(Intent(this@MainActivity, CodeTableActivity::class.java))
/* // 获取上下文通常是Activity的this或者Application的getApplicationContext()
val context: Context = this@MainActivity // 假设在Activity内部
// 创建Intent指定目标Activity
val shortcutIntent = Intent(context, CodeTableActivity::class.java)
shortcutIntent.setAction("com.coldmint.rust.pro.ACTION_CODE_TABLE") // 自定义Action可选
shortcutIntent.putExtra("extra", "value") // 可选的额外数据
// 添加标志,确保快捷方式启动新任务
shortcutIntent.addFlags(Intent.FLAG_ACTIVITY_NEW_DOCUMENT)
shortcutIntent.addFlags(Intent.FLAG_ACTIVITY_MULTIPLE_TASK)
// 构建ShortcutInfo
val info = if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.N_MR1) {
ShortcutInfo.Builder(context, "code_table_shortcut_id")
.setShortLabel(context.getString(com.coldmint.rust.pro.R.string.code_table))
.setLongLabel(context.getString(com.coldmint.rust.pro.R.string.code_table))
.setIcon(Icon.createWithResource(context, com.coldmint.rust.pro.R.drawable.table))
.setIntent(shortcutIntent)
.build()
} else {
TODO("VERSION.SDK_INT < N_MR1")
}
// 获取ShortcutManager
val shortcutManager: ShortcutManager = context.getSystemService(ShortcutManager::class.java)
// 添加动态快捷方式
shortcutManager.addDynamicShortcuts(listOf(info))*/
val intent = Intent(this@MainActivity, CodeTableActivity::class.java)
/* intent.addFlags(Intent.FLAG_ACTIVITY_MULTIPLE_TASK)
intent.addFlags(Intent.FLAG_ACTIVITY_NEW_DOCUMENT)*/
startActivity(intent)
false
}
/*重要部分
/*重要部分
viewBinding.mainButton.setOnClickListener {
val item = viewBinding.navaiagtion.checkedItem.toString()
val warehouseItem = getString(R.string.warehouse)
@ -330,11 +346,11 @@ class MainActivity : BaseActivity<ActivityMainBinding>() {
}*/
}
/* mod.setOnMenuItemClickListener {
/* mod.setOnMenuItemClickListener {
GlobalMethod.requestStoragePermissions(this) {
if (it) {
viewBinding.mainButton.postOnAnimationDelayed({
// viewBinding.tabLayout.isVisible = true
// viewBinding.tabLayout.isVisible = true
if (isActive) {
viewBinding.mainButton.show()
}
@ -364,13 +380,13 @@ class MainActivity : BaseActivity<ActivityMainBinding>() {
false
}
menu.findItem(R.id.rust_api).setOnMenuItemClickListener {
val thisIntent = Intent(this, BrowserActivity::class.java)
thisIntent.putExtra("link", "https://git.coldmint.top/")
thisIntent.putExtra("javaScriptEnabled", true)
startActivity(thisIntent)
false
}
// menu.findItem(R.id.rust_api).setOnMenuItemClickListener {
// val thisIntent = Intent(this, BrowserActivity::class.java)
// thisIntent.putExtra("link", "https://git.coldmint.top/")
// thisIntent.putExtra("javaScriptEnabled", true)
// startActivity(thisIntent)
// false
// }
menu.findItem(R.id.about).setOnMenuItemClickListener {
startActivity(Intent(this@MainActivity, AboutActivity::class.java))
@ -418,7 +434,10 @@ class MainActivity : BaseActivity<ActivityMainBinding>() {
override fun onActivityResult(requestCode: Int, resultCode: Int, data: Intent?) {
super.onActivityResult(requestCode, resultCode, data)
if (resultCode == RESULT_OK) {
val from = File(data!!.getStringExtra("File"))
if (data == null) {
return
}
val from = File(data.getStringExtra("File").toString())
val type = FileOperator.getFileType(from)
if (requestCode == 1) {
if ("rwmod" == type || "zip" == type) {
@ -427,13 +446,13 @@ class MainActivity : BaseActivity<ActivityMainBinding>() {
if (FileOperator.copyFile(from, to)) {
Snackbar.make(
viewBinding.root,
String.format(getString(R.string.import_complete), from.name),
String.format(Locale.getDefault(),getString(R.string.import_complete), from.name),
Snackbar.LENGTH_SHORT
).show()
} else {
Snackbar.make(
viewBinding.root,
String.format(getString(R.string.import_failed), from.name),
String.format(Locale.getDefault(),getString(R.string.import_failed), from.name),
Snackbar.LENGTH_SHORT
).show()
}
@ -472,6 +491,8 @@ class MainActivity : BaseActivity<ActivityMainBinding>() {
private fun importTemplate(formFile: File, templateDirectory: File) {
val handler = Handler(Looper.getMainLooper())
Thread(Runnable {
try {
//如果建立缓存完成,并且模板文件存在
val compressionManager = CompressionManager.instance
if (templateDirectory.exists()) {
@ -507,7 +528,7 @@ class MainActivity : BaseActivity<ActivityMainBinding>() {
handler.post {
Snackbar.make(
viewBinding.root,
String.format(
String.format(Locale.getDefault(),
getString(R.string.app_version_error),
formFile.name
), Snackbar.LENGTH_LONG
@ -518,7 +539,7 @@ class MainActivity : BaseActivity<ActivityMainBinding>() {
if (newInfo.versionNum < oldInfo.versionNum) {
handler.post {
MaterialAlertDialogBuilder(this).setTitle(oldInfo.name).setMessage(
String.format(
String.format(Locale.getDefault(),
getString(R.string.covers_the_import),
newInfo.versionName, oldInfo.versionName
)
@ -554,7 +575,7 @@ class MainActivity : BaseActivity<ActivityMainBinding>() {
handler.post {
Snackbar.make(
viewBinding.root,
String.format(
String.format(Locale.getDefault(),
getString(R.string.app_version_error),
formFile.name
), Snackbar.LENGTH_LONG
@ -582,7 +603,7 @@ class MainActivity : BaseActivity<ActivityMainBinding>() {
handler.post {
Snackbar.make(
viewBinding.root,
String.format(
String.format(Locale.getDefault(),
getString(R.string.import_complete),
formFile.name
), Snackbar.LENGTH_LONG
@ -593,25 +614,30 @@ class MainActivity : BaseActivity<ActivityMainBinding>() {
})
}catch (e: Exception){
error(e)
}
}).start()
}
@Deprecated("Deprecated in Java")
override fun onBackPressed() {
val navController = findNavController(R.id.baseFragment)
//判断是否在第一个导航 社区或者仓库
if (navController.currentDestination?.id == navController.graph.startDestinationId) {
MaterialAlertDialogBuilder(this).setTitle(R.string.dialog_close).setMessage(
String.format(
String.format(Locale.getDefault(),
getString(R.string.exit_tip),
getString(R.string.app_name)
)
).setPositiveButton(R.string.dialog_ok) { _, _ ->
super.onBackPressed()
finish()
}.setNegativeButton(R.string.dialog_cancel) { _, _ ->
}.show()
} else {
super.onBackPressed()
finish()
}
}
/*
@ -628,13 +654,13 @@ class MainActivity : BaseActivity<ActivityMainBinding>() {
return true
}
/*不知道干什么的代码
/*不知道干什么的代码
override fun onSupportNavigateUp(): Boolean {
val navController = findNavController(R.id.baseFragment)
return navController.navigateUp(appBarConfiguration)
|| super.onSupportNavigateUp()
}
*/
*/
override fun onOptionsItemSelected(item: MenuItem): Boolean {
if (item.itemId == R.id.search) {
@ -739,7 +765,7 @@ class MainActivity : BaseActivity<ActivityMainBinding>() {
initNav()
observeStartViewModel()
//偏移fab
/* if (ImmersionBar.hasNavigationBar(this)) {
/* if (ImmersionBar.hasNavigationBar(this)) {
val layoutParams =
viewBinding.mainButton.layoutParams as CoordinatorLayout.LayoutParams
layoutParams.setMargins(
@ -750,11 +776,9 @@ class MainActivity : BaseActivity<ActivityMainBinding>() {
)
DebugHelper.printLog("导航适配", "已调整fab按钮的位置。")
}*/
checkAppUpdate()
// checkAppUpdate() 禁用检查更新
} else {
startViewModel.initAllData()
}
}
}

View File

@ -9,7 +9,6 @@ import android.os.Bundle
import cat.ereza.customactivityoncrash.config.CaocConfig
import com.coldmint.rust.core.debug.LogCat
import com.coldmint.rust.core.debug.LogCatObserver
import com.muqing.wj
import com.coldmint.rust.pro.tool.AppSettings
import com.google.android.material.color.DynamicColors
import com.google.android.material.color.DynamicColorsOptions
@ -34,7 +33,6 @@ class RustApplication : Application() {
override fun onCreate() {
super.onCreate()
wj(this)
instanceObject = this
@ -76,6 +74,9 @@ class RustApplication : Application() {
activity: Activity,
savedInstanceState: Bundle?
) {
if (activity is CodeTableActivity){
return
}
// android:screenOrientation="portrait"
//全局强制横屏
activity.requestedOrientation = ActivityInfo.SCREEN_ORIENTATION_PORTRAIT

View File

@ -30,6 +30,7 @@ import com.google.android.material.dialog.MaterialAlertDialogBuilder
*/
class SearchActivity : BaseActivity<ActivitySearchBinding>() {
lateinit var list: MutableList<String>
val sharedPreferencesKey = "search_history"
@SuppressLint("CommitPrefEdits", "NotifyDataSetChanged")
override fun whenCreateActivity(savedInstanceState: Bundle?, canUseView: Boolean) {
@ -39,32 +40,27 @@ class SearchActivity : BaseActivity<ActivitySearchBinding>() {
viewBinding.hotSearchView.layoutManager = StableLinearLayoutManager(this)
loadSearchView()
loadHotSearch()
list = getSharedPreferences("lishi", Context.MODE_PRIVATE)
list = getSharedPreferences(sharedPreferencesKey, Context.MODE_PRIVATE)
.getStringSet("data", mutableSetOf())
?.toMutableList() ?: mutableListOf()
viewBinding.hotSearchView2.layoutManager = FlexboxLayoutManager(this)
viewBinding.hotSearchView2.adapter = adapter
viewBinding.deleat.setOnClickListener {
MaterialAlertDialogBuilder(this@SearchActivity)
.setTitle("清空所有历史记录")
.setPositiveButton("确定") { _, _ ->
val dialog = MaterialAlertDialogBuilder(this@SearchActivity)
dialog.setTitle(R.string.search_history)
dialog.setMessage(R.string.clear_all_history)
dialog.setPositiveButton(R.string.dialog_ok) { _, _ ->
while (list.isNotEmpty()) {
val index = 0
list.removeAt(index)
adapter.notifyItemRemoved(index)
}
getSharedPreferences("lishi",
getSharedPreferences(sharedPreferencesKey,
Context.MODE_PRIVATE).edit().putStringSet(
"data", list.toSet()).apply()
/* CoroutineScope(Dispatchers.Main).launch {
while (list.isNotEmpty()) {
list.removeAt(0) // 删除第一个数据
adapter.notifyItemRemoved(0) // 刷新 RecyclerView
delay(300) // 每隔一秒执行一次删除操作
}
}*/
}
.setNegativeButton("取消", null).show()
dialog.setNegativeButton(R.string.dialog_cancel, null)
dialog.show()
}
viewBinding.searchView.onActionViewExpanded()
}
@ -88,9 +84,12 @@ class SearchActivity : BaseActivity<ActivitySearchBinding>() {
if (list.size > 10) {
list.removeAt(list.lastIndex)
}
val editor = getSharedPreferences("lishi", Context.MODE_PRIVATE).edit()
val editor = getSharedPreferences(sharedPreferencesKey, Context.MODE_PRIVATE).edit()
editor.putStringSet("data", list.toSet())
editor.apply()
if (!viewBinding.searchView.isVisible) {
viewBinding.searchLayout.isVisible = true
}
}
fun search(string: String) {
@ -101,6 +100,7 @@ class SearchActivity : BaseActivity<ActivitySearchBinding>() {
}
//TODO:将适配器继承自BaseAdapter使其不再过度依赖SearchActivity。
val adapter: RecyclerView.Adapter<VH> = object : RecyclerView.Adapter<VH>() {
override fun onCreateViewHolder(parent: ViewGroup, viewType: Int): VH {
@ -128,9 +128,10 @@ class SearchActivity : BaseActivity<ActivitySearchBinding>() {
false
}
}
override fun getItemCount(): Int {
val empty = list.isEmpty()
viewBinding.textview1Text1.isVisible =empty
viewBinding.searchLayout.isVisible = !empty
viewBinding.deleat.isVisible = !empty
return list.size
}

View File

@ -2,19 +2,22 @@ package com.coldmint.rust.pro
import android.annotation.SuppressLint
import android.os.Bundle
import android.text.Editable
import android.text.TextWatcher
import android.view.*
import android.view.KeyEvent
import android.view.LayoutInflater
import android.view.Menu
import android.view.MenuItem
import android.widget.Toast
import androidx.recyclerview.widget.LinearLayoutManager
import com.coldmint.dialog.CoreDialog
import com.coldmint.rust.core.ModClass
import com.coldmint.rust.core.SourceFile
import com.coldmint.rust.core.turret.CoordinateData
import com.coldmint.rust.core.turret.TurretManager
import com.coldmint.rust.pro.adapters.DesignAdapter
import com.coldmint.rust.pro.base.BaseActivity
import com.coldmint.rust.pro.databinding.ActivityTurretDesignBinding
import com.coldmint.rust.pro.fragments.EditTurretInfoFragment
import com.coldmint.rust.pro.tool.GlobalMethod
import com.google.android.material.snackbar.Snackbar
import java.io.File
/**
@ -24,34 +27,30 @@ class TurretDesignActivity : BaseActivity<ActivityTurretDesignBinding>() {
private lateinit var turretManager: TurretManager
@SuppressLint("RestrictedApi")
@SuppressLint("RestrictedApi", "SetTextI18n")
override fun whenCreateActivity(savedInstanceState: Bundle?, canUseView: Boolean) {
if (canUseView) {
setReturnButton()
title = getString(R.string.turret_design)
val modPath = intent.getStringExtra("modPath")
val filePath = intent.getStringExtra("filePath")
if (modPath == null) {
showError("请设置模组路径")
return
}
if (filePath == null) {
showError("请设置文件路径")
return
}
val modClass = ModClass(File(modPath))
val sourceFile = SourceFile(File(filePath), modClass)
val mainImage = sourceFile.findResourceFilesFromSection("image", "graphics", false)
if (mainImage.isNullOrEmpty()) {
showError(getString(R.string.please_set_main_image))
return
} else {
val file = mainImage[0]
if (!file.exists()){
if (!file.exists()) {
showError(getString(R.string.file_not_exist))
return
}
@ -63,58 +62,63 @@ class TurretDesignActivity : BaseActivity<ActivityTurretDesignBinding>() {
viewBinding.turretSketchpadView
)
turretManager
.setCoordinateChangeListener { gameCoordinateData, turretData ->
.setCoordinateChangeListener { gameCoordinateData, _ ->
viewBinding.infoView.text =
"x:${gameCoordinateData.x} y:${gameCoordinateData.y}"
}
//设置自动完成
viewBinding.autoCompleteText.addTextChangedListener(object : TextWatcher {
override fun beforeTextChanged(
s: CharSequence?,
start: Int,
count: Int,
after: Int
) {
}
override fun onTextChanged(
s: CharSequence?,
start: Int,
before: Int,
count: Int
) {
}
override fun afterTextChanged(s: Editable?) {
turretManager.useTurret(s.toString())
}
})
val nameList = ArrayList<String>()
var isFirst = true
val designAdapter = DesignAdapter(object : DesignAdapter.Click {
override fun onclick(str: String) {
turretManager.useTurret(str)
turretManager.turretList.forEach lab@{
if (it.name == str) {
viewBinding.infoView.text =
"x:${it.gameCoordinateData.x} y:${it.gameCoordinateData.y}"
return@lab
}
}
}
override fun onclickImage() {
turretManager.turretList.forEach{
val turretView = turretManager.getTurretView(it.name)
turretView?.invalidate()
}
}
})
turretManager.turretList.forEach {
if (isFirst) {
viewBinding.autoCompleteText.setText(it.name)
designAdapter.string = it
turretManager.useTurret(it.name)
viewBinding.infoView.text =
"x:${it.gameCoordinateData.x} y:${it.gameCoordinateData.y}"
isFirst = false
}
nameList.add(it.name)
}
viewBinding.autoCompleteText.setSimpleItems(nameList.toTypedArray())
}
// viewBinding.autoCompleteText.setSimpleItems(nameList.toTypedArray())
viewBinding.recyclerView.layoutManager = LinearLayoutManager(this, LinearLayoutManager.HORIZONTAL, false)
viewBinding.recyclerView.isNestedScrollingEnabled = false
designAdapter.list = turretManager.turretList
viewBinding.recyclerView.adapter = designAdapter
viewBinding.button.setOnClickListener {
val data = turretManager.getTurretView(viewBinding.autoCompleteText.text.toString())
val data = turretManager.getTurretView(designAdapter.string.name)
if (data != null) {
val editTurretInfoFragment = EditTurretInfoFragment(data)
val editTurretInfoFragment = EditTurretInfoFragment(data,object :EditTurretInfoFragment.ButtonClick{
override fun onSaveButtonClick(x: Int, y: Int) {
viewBinding.infoView.text = "x:$x y:$y"
}
})
editTurretInfoFragment.show(supportFragmentManager, "Edit")
} else {
Toast.makeText(this, R.string.not_find_turret, Toast.LENGTH_SHORT).show()
}
}
}
}
}
@ -155,7 +159,7 @@ class TurretDesignActivity : BaseActivity<ActivityTurretDesignBinding>() {
/**
* 保存数据
*/
fun saveData() {
private fun saveData() {
turretManager.saveChange()
finish()
}
@ -167,11 +171,13 @@ class TurretDesignActivity : BaseActivity<ActivityTurretDesignBinding>() {
!viewBinding.turretSketchpadView.drawCoordinate
item.isChecked = viewBinding.turretSketchpadView.drawCoordinate
}
R.id.show_guides -> {
viewBinding.turretSketchpadView.drawAuxiliaryLine =
!viewBinding.turretSketchpadView.drawAuxiliaryLine
item.isChecked = viewBinding.turretSketchpadView.drawAuxiliaryLine
}
android.R.id.home -> {
saveData()
}

View File

@ -1,56 +1,41 @@
package com.coldmint.rust.pro.adapters
import android.widget.BaseExpandableListAdapter
import android.annotation.SuppressLint
import android.content.Context
import android.view.LayoutInflater
import android.view.ViewGroup
import com.coldmint.rust.pro.R
import android.content.Context
import android.os.Handler
import android.os.Looper
import android.view.View
import android.widget.Toast
import androidx.core.view.isVisible
import com.afollestad.materialdialogs.MaterialDialog
import com.coldmint.dialog.CoreDialog
import com.coldmint.rust.core.database.code.CodeDataBase
import androidx.recyclerview.widget.RecyclerView
import com.coldmint.rust.core.database.code.CodeInfo
import com.coldmint.rust.core.database.code.SectionInfo
import com.coldmint.rust.core.tool.LineParser
import com.coldmint.rust.pro.databinding.CodeTableGroupBinding
import com.coldmint.rust.pro.databinding.CodeTableItemBinding
import com.coldmint.rust.pro.tool.AppSettings
import com.coldmint.rust.pro.R
import com.coldmint.rust.pro.databinding.ActivityCodeTableBinding
import com.coldmint.rust.pro.databinding.ItemCodetableBinding
import com.coldmint.rust.pro.tool.GlobalMethod
import com.google.android.material.chip.Chip
import com.google.android.material.dialog.MaterialAlertDialogBuilder
import java.util.concurrent.Executors
import com.google.android.gms.common.internal.Objects
import com.muqing.VH
class CodeTableAdapter(
val context: Context,
private val group: List<SectionInfo>,
private val itemList: List<List<CodeInfo>>
) : BaseExpandableListAdapter() {
private val layoutInflater = LayoutInflater.from(context)
private val itemList: List<List<CodeInfo>>,
private val binding: ActivityCodeTableBinding
) : RecyclerView.Adapter<VH<ItemCodetableBinding>>() {
private var versionMap: HashMap<Int, String>? = null
private var typeNameMap: HashMap<String, String>? = null
private var sectionMap: HashMap<String, String>? = null
private val executorService by lazy {
/* private val executorService by lazy {
Executors.newSingleThreadExecutor()
}
}*/
private val lineParser = LineParser()
//Label点击事件
var labelFunction: ((Int, View, String) -> Unit)? = null
private val developerMode by lazy {
// var labelFunction: ((Int, View, String) -> Unit)? = null
/* private val developerMode by lazy {
AppSettings
.getValue(AppSettings.Setting.DeveloperMode, false)
}
init {
lineParser.symbol = ","
}
}*/
/**
* 节名映射
@ -60,7 +45,6 @@ class CodeTableAdapter(
this.sectionMap = sectionMap
}
/**
* 设置类型名称映射
* @param typeNameMap HashMap<String, String>?
@ -77,53 +61,7 @@ class CodeTableAdapter(
this.versionMap = versionMap
}
override fun getGroupCount(): Int {
return group.size
}
override fun getChildrenCount(groupPosition: Int): Int {
return itemList[groupPosition].size
}
override fun getGroup(groupPosition: Int): Any {
return group[groupPosition]
}
override fun getChild(groupPosition: Int, childPosition: Int): Any {
return itemList[groupPosition][childPosition]
}
override fun getGroupId(groupPosition: Int): Long {
return groupPosition.toLong()
}
override fun getChildId(groupPosition: Int, childPosition: Int): Long {
return childPosition.toLong()
}
override fun hasStableIds(): Boolean {
return false
}
override fun getGroupView(
groupPosition: Int,
isExpanded: Boolean,
convertView: View?,
parent: ViewGroup
): View {
val resultView: CodeTableGroupBinding =
CodeTableGroupBinding.inflate(layoutInflater, parent, false)
val info =
String.format(
context.getString(R.string.filenum),
itemList[groupPosition].size
)
resultView.nameView.text = group[groupPosition].translate
resultView.numView.text = info
return resultView.root
}
override fun getChildView(
/* fun getChildView(
groupPosition: Int,
childPosition: Int,
isLastChild: Boolean,
@ -134,8 +72,8 @@ class CodeTableAdapter(
CodeTableItemBinding.inflate(layoutInflater, parent, false)
val codeInfo = itemList[groupPosition][childPosition]
// resultView.belongStackLabelView.onLabelClickListener = OnLabelClickListener { index, v, s ->
// }
// resultView.belongStackLabelView.onLabelClickListener = OnLabelClickListener { index, v, s ->
// }
resultView.descriptionView.text = codeInfo.description
resultView.descriptionView.setOnClickListener {
GlobalMethod.copyText(context, codeInfo.description, it)
@ -242,9 +180,56 @@ class CodeTableAdapter(
resultView.versionView.text =
versionMap?.get(codeInfo.addVersion) ?: codeInfo.addVersion.toString()
return resultView.root
}*/
override fun onCreateViewHolder(parent: ViewGroup, viewType: Int): VH<ItemCodetableBinding> {
return VH(ItemCodetableBinding.inflate(LayoutInflater.from(parent.context), parent, false))
}
override fun getItemCount(): Int {
return group.size
}
companion object {
var i: String = null.toString()
var pick: Int = 0
var pickString: String = ""
var picklist: MutableList<Int> = mutableListOf()
}
var item: CodeTableItemAdapter? = null
init {
lineParser.symbol = ","
}
@SuppressLint("NotifyDataSetChanged", "StringFormatInvalid")
override fun onBindViewHolder(holder: VH<ItemCodetableBinding>, position: Int) {
holder.binging.title.text = group[position].translate
val format = String.format(
context.getString(R.string.filenum),
itemList[position].size
)
holder.binging.message.text = format
holder.itemView.setOnClickListener {
i = group[position].translate
pick = 0
pickString = ""
picklist.clear()
if (item != null) {
item!!.list = itemList[position]
binding.codeRecyclerB.adapter = item
notifyDataSetChanged()
}
// notifyItemChanged(p)
}
if (Objects.equal(group[position].translate, i)) {
//背景高亮
holder.binging.root.setCardBackgroundColor(GlobalMethod.getThemeColor(context, R.attr.colorPrimaryContainer))
} else {
//背景恢复
holder.binging.root.setCardBackgroundColor(GlobalMethod.getThemeColor(context, R.attr.colorSurface))
}
override fun isChildSelectable(groupPosition: Int, childPosition: Int): Boolean {
return true
}
}

View File

@ -0,0 +1,225 @@
package com.coldmint.rust.pro.adapters
import android.annotation.SuppressLint
import android.graphics.Color
import android.os.Handler
import android.os.Looper
import android.text.SpannableStringBuilder
import android.text.Spanned
import android.text.style.BackgroundColorSpan
import android.text.style.ForegroundColorSpan
import android.view.LayoutInflater
import android.view.View
import android.view.ViewGroup
import android.widget.TextView
import androidx.core.view.isVisible
import androidx.recyclerview.widget.LinearLayoutManager
import androidx.recyclerview.widget.RecyclerView
import com.afollestad.materialdialogs.MaterialDialog
import com.coldmint.rust.core.database.code.CodeDataBase
import com.coldmint.rust.core.database.code.CodeInfo
import com.coldmint.rust.core.tool.LineParser
import com.coldmint.rust.pro.R
import com.coldmint.rust.pro.databinding.CodeTableItemBinding
import com.coldmint.rust.pro.dialog.MaterialBottomDialog
import com.coldmint.rust.pro.tool.AppSettings
import com.coldmint.rust.pro.tool.GlobalMethod
import com.google.android.material.chip.Chip
import com.muqing.VH
import java.util.concurrent.Executors
class CodeTableItemAdapter(val recyclerView: RecyclerView,
var list: List<CodeInfo>) : RecyclerView.Adapter<VH<CodeTableItemBinding>>() {
private val lineParser = LineParser()
init {
lineParser.symbol = ","
}
var labelFunction: ((Int, View, String) -> Unit)? = null
var versionMap: HashMap<Int, String>? = null
var typeNameMap: HashMap<String, String>? = null
var sectionMap: HashMap<String, String>? = null
private val executorService by lazy {
Executors.newSingleThreadExecutor()
}
private val developerMode by lazy {
AppSettings
.getValue(AppSettings.Setting.DeveloperMode, false)
}
//在list查找是否有这个关键字
fun search(keyword: String) {
CodeTableAdapter.pickString = keyword
CodeTableAdapter.pick = 0
CodeTableAdapter.picklist.clear()
for (i in list.indices) {
if (list[i].translate.contains(keyword) || list[i].description.contains(keyword) || list[i].code.contains(keyword)) {
CodeTableAdapter.picklist.add(i)
}
}
(recyclerView.layoutManager as LinearLayoutManager).scrollToPositionWithOffset(CodeTableAdapter.pick, 0)
notifyDataSetChanged()
}
override fun onCreateViewHolder(parent: ViewGroup, viewType: Int): VH<CodeTableItemBinding> {
return VH(CodeTableItemBinding.inflate(LayoutInflater.from(parent.context), parent, false))
}
override fun getItemCount(): Int {
return list.size
}
private fun contains(string: String, textView: TextView) {
if (string.contains(CodeTableAdapter.pickString)) {
val spannableText = SpannableStringBuilder(string)
val highlightWord = CodeTableAdapter.pickString
val start = string.indexOf(highlightWord)
val end = start + highlightWord.length
if (start != -1) {
// 设置文字颜色
val colorSpan = ForegroundColorSpan(Color.RED)
spannableText.setSpan(colorSpan, start, end, Spanned.SPAN_EXCLUSIVE_EXCLUSIVE)
// 设置背景颜色
val backgroundSpan = BackgroundColorSpan(Color.YELLOW)
spannableText.setSpan(backgroundSpan, start, end, Spanned.SPAN_EXCLUSIVE_EXCLUSIVE)
}
textView.text = spannableText
} else {
textView.text = string
}
}
private fun containsB(string: String, textView: TextView) {
if (string.contains(CodeTableAdapter.pickString)) {
val spannableText = SpannableStringBuilder(string)
val highlightWord = CodeTableAdapter.pickString
val start = string.indexOf(highlightWord)
val end = start + highlightWord.length
if (start != -1) {
// 设置文字颜色
val colorSpan = ForegroundColorSpan(Color.RED)
spannableText.setSpan(colorSpan, start, end, Spanned.SPAN_EXCLUSIVE_EXCLUSIVE)
// 设置背景颜色
val backgroundSpan = BackgroundColorSpan(Color.BLUE)
spannableText.setSpan(backgroundSpan, start, end, Spanned.SPAN_EXCLUSIVE_EXCLUSIVE)
}
textView.text = spannableText
} else {
textView.text = string
}
}
@SuppressLint("StringFormatInvalid")
override fun onBindViewHolder(holder: VH<CodeTableItemBinding>, position: Int) {
val context = holder.itemView.context
val resultView: CodeTableItemBinding = holder.binging
val codeInfo = list[position]
contains(codeInfo.description, resultView.descriptionView)
resultView.descriptionView.setOnClickListener {
GlobalMethod.copyText(it.context, codeInfo.description, it)
}
contains(codeInfo.translate, resultView.titleView)
resultView.titleView.setOnClickListener {
GlobalMethod.copyText(it.context, codeInfo.translate, it)
}
val demo = codeInfo.demo
resultView.imageView.isVisible = demo.isNotBlank()
resultView.imageView.setOnClickListener {
val materialBottomDialog = MaterialBottomDialog(it.context)
materialBottomDialog.setTitle(R.string.code_demo)
materialBottomDialog.setMessage(demo)
materialBottomDialog.show()
}
contains(codeInfo.code, resultView.subTitleView)
resultView.subTitleView.setOnClickListener {
GlobalMethod.copyText(it.context, codeInfo.code, it)
}
resultView.valueTypeView.text = typeNameMap?.get(codeInfo.type) ?: codeInfo.type
lineParser.text = codeInfo.section
var isNotEmpty = false
lineParser.analyse { lineNum, lineData, isEnd ->
isNotEmpty = true
val text = sectionMap?.get(lineData) ?: lineData
val chip = Chip(context)
chip.text = text
chip.setOnClickListener {
labelFunction?.invoke(lineNum, it, text)
}
// resultView.chipGroup.addView(chip)
true
}
// resultView.chipGroup.isVisible = isNotEmpty
resultView.valueTypeView.setOnClickListener {
val handler = Handler(Looper.getMainLooper())
executorService.submit {
val codeDataBase = CodeDataBase.getInstance(context)
val typeInfo = codeDataBase.getValueTypeDao().findTypeByType(codeInfo.type)
if (typeInfo == null) {
handler.post {
handler.post {
MaterialDialog(context).show {
title(text = codeInfo.type).message(
text = String.format(
context.getString(
R.string.unknown_type
), codeInfo.type
)
)
.positiveButton(R.string.dialog_ok)
}
}
}
} else {
if (developerMode) {
val stringBuilder = StringBuilder()
stringBuilder.append("介绍:")
stringBuilder.append(typeInfo.describe)
stringBuilder.append("\n附加信息:")
stringBuilder.append(typeInfo.external)
stringBuilder.append("\n关联的自动提示:")
stringBuilder.append(typeInfo.list)
stringBuilder.append("\n光标偏差:")
stringBuilder.append(typeInfo.offset)
stringBuilder.append("\n标签:")
stringBuilder.append(typeInfo.tag)
stringBuilder.append("\n数据规则:")
stringBuilder.append(typeInfo.rule)
handler.post {
MaterialDialog(context).show {
title(text = typeInfo.name + "(开发者模式)").message(text = stringBuilder.toString())
.positiveButton(R.string.dialog_ok)
}
}
} else {
if (typeInfo.describe == "@search(code)") {
handler.post {
MaterialDialog(context).show {
title(text = typeInfo.name).message(text = codeInfo.description)
.positiveButton(R.string.dialog_ok)
}
}
} else {
handler.post {
MaterialDialog(context).show {
title(text = typeInfo.name).message(text = typeInfo.describe)
.positiveButton(R.string.dialog_ok)
}
}
}
}
}
}
}
resultView.versionView.text =
versionMap?.get(codeInfo.addVersion) ?: codeInfo.addVersion.toString()
}
}

View File

@ -1,9 +1,13 @@
package com.coldmint.rust.pro.adapters
import android.os.Parcelable
import androidx.appcompat.app.AppCompatActivity
import androidx.fragment.app.Fragment
import androidx.viewpager2.adapter.FragmentStateAdapter
import com.coldmint.rust.pro.fragments.*
import com.coldmint.rust.pro.fragments.FollowFragment
import com.coldmint.rust.pro.fragments.NullFragment
import com.coldmint.rust.pro.fragments.RankingFragment
import com.coldmint.rust.pro.fragments.RecommendedFragment
import com.coldmint.rust.pro.fragments.UserInfoFragment
class CommunityAdapter(fragment: Fragment) : FragmentStateAdapter(fragment) {
override fun getItemCount(): Int {

View File

@ -32,8 +32,10 @@ class CommunityServiceAdapter(
viewHolder: BaseAdapter.ViewHolder<ItemServiceBinding>,
position: Int
) {
Glide.with(context).load(data.iconRes).apply(GlobalMethod.getRequestOptions())
.into(viewBinding.iconView)
viewBinding.iconView.setImageResource(data.iconRes)
//
// Glide.with(context).load(data.iconRes).apply(GlobalMethod.getRequestOptions())
// .into(viewBinding.iconView)
viewBinding.titleView.setText(data.titleRes)
// holder.itemView.setOnClickListener {
// val listener = itemListener

View File

@ -0,0 +1,70 @@
package com.coldmint.rust.pro.adapters
import android.annotation.SuppressLint
import android.util.TypedValue
import android.view.LayoutInflater
import android.view.ViewGroup
import androidx.core.content.ContextCompat
import androidx.recyclerview.widget.RecyclerView
import com.coldmint.rust.core.turret.TurretData
import com.coldmint.rust.pro.R
import com.coldmint.rust.pro.databinding.ItemTabBinding
import com.muqing.VH
import com.muqing.gj
/**
* @author Cold Mint
* @date 2022/1/10 8:49
*/
class DesignAdapter(private val onclick: Click) : RecyclerView.Adapter<VH<ItemTabBinding>>() {
var list: ArrayList<TurretData> = arrayListOf()
override fun onCreateViewHolder(parent: ViewGroup, viewType: Int): VH<ItemTabBinding> {
return VH(ItemTabBinding.inflate(LayoutInflater.from(parent.context), parent, false))
}
override fun getItemCount(): Int {
return list.size
}
lateinit var string: TurretData
@SuppressLint("NotifyDataSetChanged")
override fun onBindViewHolder(holder: VH<ItemTabBinding>, position: Int) {
holder.binging.button.text = list[position].name
gj.sc(list[position].imageFile)
if (string == list[position]) {
holder.binging.root.isEnabled = false
val typedValue = TypedValue()
holder.itemView.context.theme.resolveAttribute(R.attr.colorPrimaryContainer, typedValue, true)
val colorPrimary = typedValue.data
holder.binging.root.setCardBackgroundColor(colorPrimary)
} else {
holder.binging.root.isEnabled = true
holder.binging.root.setCardBackgroundColor(ContextCompat.getColor(holder.itemView.context, R.color.material_grey_200))
}
holder.binging.root.setOnClickListener {
string = list[holder.absoluteAdapterPosition]
notifyDataSetChanged()
onclick.onclick(string.name)
//todo
}
if (list[holder.absoluteAdapterPosition].isImage) {
holder.binging.imageview.setImageResource(R.drawable.visibility)
}else{
holder.binging.imageview.setImageResource(R.drawable.visibility_off)
}
holder.binging.imageview.setOnClickListener{
list[holder.absoluteAdapterPosition].isImage = !list[holder.absoluteAdapterPosition].isImage
notifyItemChanged(holder.absoluteAdapterPosition)
onclick.onclickImage()
}
}
interface Click {
fun onclick(str: String)
fun onclickImage()
}
}

View File

@ -38,7 +38,7 @@ class UserHeadAdapter( context: Context, list: MutableList<FollowUserListData.Da
} else {
val headIcon = data.headIcon
if (headIcon != null) {
Glide.with(context).load(ServerConfiguration.getRealLink(headIcon)).apply(GlobalMethod.getRequestOptions(true))
Glide.with(context).load(ServerConfiguration.getRealLink(headIcon))
.into(viewBinding.headIconView)
}
}

View File

@ -1,5 +1,6 @@
package com.coldmint.rust.pro.adapters
import androidx.appcompat.app.AppCompatActivity
import androidx.fragment.app.Fragment
import androidx.viewpager2.adapter.FragmentStateAdapter
import com.coldmint.rust.pro.fragments.*

View File

@ -56,7 +56,6 @@ abstract class BaseActivity<ViewBingType : ViewBinding> :
finish()
}
dialog.show()
}
}

View File

@ -7,7 +7,6 @@ import android.view.ViewGroup
import android.widget.Toast
import androidx.fragment.app.Fragment
import androidx.viewbinding.ViewBinding
import com.coldmint.rust.pro.tool.AppSettings
import com.google.firebase.analytics.FirebaseAnalytics
import com.google.firebase.analytics.ktx.analytics
import com.google.firebase.ktx.Firebase
@ -55,7 +54,11 @@ abstract class BaseFragment<T : ViewBinding> : Fragment() {
override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
super.onViewCreated(view, savedInstanceState)
try {
firebaseAnalytics = Firebase.analytics
} catch (e: Exception) {
e.printStackTrace()
}
whenViewCreated(layoutInflater, savedInstanceState)
}
}

View File

@ -0,0 +1,9 @@
package com.coldmint.rust.pro.databean
data class LocaTion(var i: Int, var p: Int,
var text: List<String>){
lateinit var listInt : List<Int>
}

View File

@ -4,20 +4,13 @@ import android.R
import android.content.Context
import android.text.Editable
import android.text.TextWatcher
import android.util.Log
import android.view.*
import android.widget.ArrayAdapter
import android.widget.Button
import androidx.appcompat.app.AlertDialog
import androidx.core.view.isVisible
import com.coldmint.dialog.AppDialog
import com.coldmint.dialog.BaseAppDialog
import com.coldmint.dialog.BaseBottomDialog
import com.coldmint.dialog.InputDialog
import com.coldmint.rust.pro.databinding.DialogCommentBinding
import com.coldmint.rust.pro.tool.LinkAutoCompleteHelper
import com.coldmint.rust.pro.tool.TextStyleMaker
import com.google.android.material.bottomsheet.BottomSheetBehavior
import com.google.android.material.textfield.TextInputLayout
@ -68,7 +61,7 @@ class CommentDialog(context: Context) : BaseAppDialog<CommentDialog>(context) {
//已闭合{}。
}else{
//正在输入内容
adapter.add(text + '}')
adapter.add("$text}")
}
} else {
//没有指定{开始位置

View File

@ -0,0 +1,29 @@
package com.coldmint.rust.pro.dialog
import android.content.Context
import android.widget.TextView
import com.coldmint.rust.pro.R
import com.google.android.material.bottomsheet.BottomSheetDialog
class MaterialBottomDialog(context: Context) : BottomSheetDialog(context) {
init {
setContentView(R.layout.dialog_bottom)
}
fun setMessage(string: String) {
val findViewById = findViewById<TextView>(R.id.message)
findViewById?.text = string
}
fun setTitle(string: String) {
val findViewById = findViewById<TextView>(R.id.title)
findViewById?.text = string
}
override fun setTitle(titleId: Int) {
super.setTitle(titleId)
val string = context.getString(titleId)
delegate.setTitle(string)
val findViewById = findViewById<TextView>(R.id.title)
findViewById?.text = string
}
}

View File

@ -1,7 +1,6 @@
package com.coldmint.rust.pro.edit.autoComplete
import android.os.Bundle
import com.coldmint.rust.pro.edit.RustAutoComplete
import com.coldmint.rust.pro.edit.RustCompletionItem
import io.github.rosemoe.sora.lang.completion.CompletionPublisher
import io.github.rosemoe.sora.text.CharPosition

View File

@ -2,6 +2,7 @@ package com.coldmint.rust.pro.fragments
import android.os.Bundle
import android.view.LayoutInflater
import androidx.viewpager2.widget.ViewPager2
import com.coldmint.rust.pro.R
import com.coldmint.rust.pro.adapters.CommunityAdapter
import com.coldmint.rust.pro.base.BaseFragment
@ -13,26 +14,6 @@ class CommunityFragment : BaseFragment<FragmentCommunityBinding>() {
if (!isAdded) {
return
}
TabLayoutMediator(viewBinding.tabLayout, viewBinding.pager)
{ tab, position ->
when (position) {
0 -> {
tab.text = getText(R.string.recommended)
}
1 -> {
tab.text = getText(R.string.follow)
}
2 -> {
tab.text = getText(R.string.ranking)
}
3 -> {
tab.text = getText(R.string.my)
}
}
}.attach()
/* else {
viewBinding.pager.postDelayed({ loadTab() }, MainActivity.linkInterval)
}*/
@ -46,6 +27,43 @@ class CommunityFragment : BaseFragment<FragmentCommunityBinding>() {
override fun whenViewCreated(inflater: LayoutInflater, savedInstanceState: Bundle?) {
viewBinding.pager.adapter = CommunityAdapter(this)
viewBinding.pager.isSaveEnabled = false
viewBinding.pager.registerOnPageChangeCallback(object : ViewPager2.OnPageChangeCallback() {
override fun onPageSelected(position: Int) {
when (position) {
0 -> {
viewBinding.bottomnavigationView.selectedItemId = R.id.action_recommended
}
1 -> {
viewBinding.bottomnavigationView.selectedItemId = R.id.action_follow
}
2 -> {
viewBinding.bottomnavigationView.selectedItemId = R.id.action_ranking
}
3 -> {
viewBinding.bottomnavigationView.selectedItemId = R.id.action_my
}
}
}
})
viewBinding.bottomnavigationView.setOnItemSelectedListener {
when (it.itemId) {
R.id.action_recommended -> {
viewBinding.pager.currentItem = 0
}
R.id.action_follow -> {
viewBinding.pager.currentItem = 1
}
R.id.action_ranking -> {
viewBinding.pager.currentItem = 2
}
R.id.action_my -> {
viewBinding.pager.currentItem = 3
}
}
true
}
loadTab()
}
}

View File

@ -7,25 +7,22 @@ import android.view.LayoutInflater
import android.view.View
import android.view.ViewGroup
import com.coldmint.rust.core.turret.CoordinateData
import com.coldmint.rust.core.turret.TurretData
import com.coldmint.rust.core.turret.TurretView
import com.coldmint.rust.pro.R
import com.coldmint.rust.pro.base.BaseFragment
import com.coldmint.rust.pro.databinding.FragmentEditTurretInfoBinding
import com.google.android.material.bottomsheet.BottomSheetDialog
import com.google.android.material.bottomsheet.BottomSheetDialogFragment
/**
* 编辑炮塔信息碎片
* @property fragmentEditTurretInfoBinding FragmentEditTurretInfoBinding
*/
class EditTurretInfoFragment(val turretView: TurretView) : BottomSheetDialogFragment() {
class EditTurretInfoFragment(private val turretView: TurretView, private val buttonclick: ButtonClick) : BottomSheetDialogFragment() {
private lateinit var fragmentEditTurretInfoBinding: FragmentEditTurretInfoBinding
override fun onCreateView(
inflater: LayoutInflater,
container: ViewGroup?,
savedInstanceState: Bundle?
): View? {
): View {
fragmentEditTurretInfoBinding =
FragmentEditTurretInfoBinding.inflate(layoutInflater, container, false)
return fragmentEditTurretInfoBinding.root
@ -84,8 +81,12 @@ class EditTurretInfoFragment(val turretView: TurretView) : BottomSheetDialogFrag
val x = fragmentEditTurretInfoBinding.xInputEditText.text.toString().toInt()
val y = fragmentEditTurretInfoBinding.yInputEditText.text.toString().toInt()
turretView.setGameCoordinateData(CoordinateData(x, y))
buttonclick.onSaveButtonClick(x, y)
dialog?.dismiss()
}
}
interface ButtonClick {
fun onSaveButtonClick(x: Int, y: Int)
}
}

View File

@ -3,8 +3,6 @@ package com.coldmint.rust.pro.fragments
import android.content.Intent
import android.os.Bundle
import android.view.LayoutInflater
import android.view.View
import android.widget.Toast
import androidx.core.view.isVisible
import androidx.recyclerview.widget.LinearLayoutManager
import androidx.recyclerview.widget.RecyclerView
@ -224,9 +222,9 @@ class FollowFragment : BaseFragment<FragmentFollowBinding>() {
override fun whenViewCreated(inflater: LayoutInflater, savedInstanceState: Bundle?) {
viewBinding.rootLayout.layoutTransition.setAnimateParentHierarchy(false)
viewBinding.linearLayout2.layoutTransition.setAnimateParentHierarchy(false)
val linearLayoutManager = StableLinearLayoutManager(requireContext())
linearLayoutManager.orientation = RecyclerView.HORIZONTAL
val linearLayoutManager = LinearLayoutManager(requireContext(), RecyclerView.HORIZONTAL, false)
viewBinding.headRecyclerView.layoutManager = linearLayoutManager
viewBinding.headRecyclerView.isNestedScrollingEnabled = false
val linearLayoutManager2 = StableLinearLayoutManager(requireContext())
viewBinding.recyclerView.layoutManager = linearLayoutManager2
loadViewIfNeed()

View File

@ -1,14 +1,9 @@
package com.coldmint.rust.pro.fragments
import android.content.Intent
import android.os.Build
import android.os.Bundle
import android.view.Gravity
import android.view.LayoutInflater
import android.widget.PopupMenu
import android.widget.Toast
import androidx.core.view.isVisible
import androidx.recyclerview.widget.LinearLayoutManager
import androidx.recyclerview.widget.RecyclerView
import com.coldmint.rust.core.dataBean.mod.WebModListData
import com.coldmint.rust.core.interfaces.ApiCallBack
@ -20,14 +15,14 @@ import com.coldmint.rust.pro.adapters.WebModAdapter
import com.coldmint.rust.pro.base.BaseFragment
import com.coldmint.rust.pro.databinding.FragmentRankingBinding
import com.coldmint.rust.pro.ui.StableLinearLayoutManager
import com.google.android.material.chip.Chip
import me.zhanghai.android.fastscroll.FastScrollerBuilder
/**
* 排行榜
*/
class RankingFragment : BaseFragment<FragmentRankingBinding>() {
var webModAdapter: WebModAdapter? = null
private var webModAdapter: WebModAdapter? = null
var lastOffset = 0
var lastPosition = 0
var linearLayoutManager: StableLinearLayoutManager? = null
@ -36,10 +31,10 @@ class RankingFragment : BaseFragment<FragmentRankingBinding>() {
override fun whenViewCreated(inflater: LayoutInflater, savedInstanceState: Bundle?) {
linearLayoutManager = StableLinearLayoutManager(requireContext())
viewBinding.recyclerView.layoutManager = linearLayoutManager
viewBinding.recyclerView.addOnScrollListener(object : RecyclerView.OnScrollListener() {
/* viewBinding.recyclerView.addOnScrollListener(object : RecyclerView.OnScrollListener() {
override fun onScrollStateChanged(recyclerView: RecyclerView, newState: Int) {
super.onScrollStateChanged(recyclerView, newState)
var layoutManager = viewBinding.recyclerView.layoutManager
val layoutManager = viewBinding.recyclerView.layoutManager
if (layoutManager != null) {
//获取第一个可视视图
val topView = layoutManager.getChildAt(0)
@ -49,30 +44,37 @@ class RankingFragment : BaseFragment<FragmentRankingBinding>() {
}
}
}
})
viewBinding.swipeRefreshLayout.setOnRefreshListener {
})*/
viewBinding.refreshLayout.setOnRefreshListener {
it.finishRefresh(true)//传入false表示刷新失败
loadMods()
}
viewBinding.refreshLayout.setOnLoadMoreListener {
it.finishLoadMore(false) //传入false表示加载失败
}
/* viewBinding.swipeRefreshLayout.setOnRefreshListener {
loadMods()
viewBinding.swipeRefreshLayout.isRefreshing = false
}
viewBinding.downloadChip.setOnCheckedChangeListener { buttonView, isChecked ->
}*/
viewBinding.downloadChip.setOnCheckedChangeListener { _, isChecked ->
if (isChecked) {
sortMode = WebMod.SortMode.Download_Number
loadMods()
}
}
viewBinding.unitChip.setOnCheckedChangeListener { buttonView, isChecked ->
viewBinding.unitChip.setOnCheckedChangeListener { _, isChecked ->
if (isChecked) {
sortMode = WebMod.SortMode.Unit_Number
loadMods()
}
}
viewBinding.coinChip.setOnCheckedChangeListener { buttonView, isChecked ->
viewBinding.coinChip.setOnCheckedChangeListener { _, isChecked ->
if (isChecked) {
sortMode = WebMod.SortMode.Coin_Number
loadMods()
}
}
viewBinding.updateChip.setOnCheckedChangeListener { buttonView, isChecked ->
viewBinding.updateChip.setOnCheckedChangeListener { _, isChecked ->
if (isChecked) {
sortMode = WebMod.SortMode.Update_Number
loadMods()
@ -82,10 +84,10 @@ class RankingFragment : BaseFragment<FragmentRankingBinding>() {
}
fun loadMods() {
private fun loadMods() {
viewBinding.progressBar.isVisible = true
viewBinding.textview.isVisible = false
viewBinding.swipeRefreshLayout.isVisible = false
// viewBinding.swipeRefreshLayout.isVisible = false
WebMod.instance.list(object : ApiCallBack<WebModListData> {
override fun onResponse(t: WebModListData) {
if (!isAdded) {
@ -93,18 +95,18 @@ class RankingFragment : BaseFragment<FragmentRankingBinding>() {
}
if (t.code == ServerConfiguration.Success_Code) {
val list = t.data
if (list != null && list.isNotEmpty()) {
if (!list.isNullOrEmpty()) {
viewBinding.progressBar.isVisible = false
viewBinding.textview.isVisible = false
viewBinding.swipeRefreshLayout.isVisible = true
// viewBinding.swipeRefreshLayout.isVisible = true
val adapter = createAdapter(list)
viewBinding.recyclerView.adapter = adapter
linearLayoutManager?.scrollToPositionWithOffset(
lastPosition,
lastOffset
)
FastScrollerBuilder(viewBinding.recyclerView).useMd2Style()
.setPopupTextProvider(adapter).build()
/* FastScrollerBuilder(viewBinding.recyclerView).useMd2Style()
.setPopupTextProvider(adapter).build()*/
} else {
showInfoToView(R.string.network_error)
}
@ -117,7 +119,7 @@ class RankingFragment : BaseFragment<FragmentRankingBinding>() {
showInfoToView(R.string.network_error)
}
}, sortMode = sortMode, limit = "100")
}, sortMode = sortMode, limit = "10", sum = "0")
}
@ -134,7 +136,7 @@ class RankingFragment : BaseFragment<FragmentRankingBinding>() {
webModAdapter!!.setNewDataList(dataList)
webModAdapter!!
}
adapter.setItemEvent { i, webModItemBinding, viewHolder, data ->
adapter.setItemEvent { _, webModItemBinding, _, data ->
webModItemBinding.root.setOnClickListener {
val bundle = Bundle()
bundle.putString("modId", data.id)
@ -154,10 +156,10 @@ class RankingFragment : BaseFragment<FragmentRankingBinding>() {
*/
fun showInfoToView(textRes: Int? = null, text: String? = null) {
viewBinding.progressBar.isVisible = false
viewBinding.swipeRefreshLayout.isVisible = false
// viewBinding.swipeRefreshLayout.isVisible = false
viewBinding.textview.isVisible = true
if (textRes == null) {
viewBinding.textview.setText(textRes)
viewBinding.textview.text = textRes
} else {
viewBinding.textview.text = text ?: ""
}

View File

@ -32,6 +32,7 @@ class UserInfoFragment : BaseFragment<FragmentUserInfoBinding>() {
val layoutManager = GridLayoutManager(RustApplication.getInstance(), 4)
viewBinding.recyclerView.layoutManager = layoutManager
viewBinding.recyclerView.isNestedScrollingEnabled = false
val dataList = ArrayList<CommunityServiceInfo>()
dataList.add(CommunityServiceInfo(R.string.work_management, R.drawable.work_management))
// dataList.add(CommunityServiceInfo(R.string.little_black_house, R.drawable.ban))
@ -113,7 +114,7 @@ class UserInfoFragment : BaseFragment<FragmentUserInfoBinding>() {
viewBinding.progressBar.isVisible = false
viewBinding.loginLayout.root.isVisible = false
viewBinding.contentLayout.isVisible = true
viewBinding.root.isFillViewport = false
// viewBinding.root.isFillViewport = false
account = AppSettings.getValue(AppSettings.Setting.Account, "")
viewBinding.myHomeView.setOnClickListener {
val intent = Intent(
@ -164,7 +165,7 @@ class UserInfoFragment : BaseFragment<FragmentUserInfoBinding>() {
viewBinding.progressBar.isVisible = false
viewBinding.loginLayout.root.isVisible = true
viewBinding.contentLayout.isVisible = false
viewBinding.root.isFillViewport = true
// viewBinding.root.isFillViewport = true
}
}

View File

@ -12,8 +12,6 @@ import com.coldmint.rust.pro.base.BaseFragment
import com.coldmint.rust.pro.databinding.FragmentWarehouseBinding
import com.google.android.material.tabs.TabLayoutMediator
import com.permissionx.guolindev.PermissionX
import com.permissionx.guolindev.callback.RequestCallback
import javax.security.auth.callback.Callback
/**
@ -21,22 +19,8 @@ import javax.security.auth.callback.Callback
* @date 2022/1/5 10:18
*/
class WarehouseFragment : BaseFragment<FragmentWarehouseBinding>() {
private fun loadTab() {
// 在需要申请权限的地方调用如下方法
/*
PermissionX.init(this)
.permissions(Manifest.permission.READ_EXTERNAL_STORAGE,
Manifest.permission.WRITE_EXTERNAL_STORAGE)
.request { allGranted, _, _ ->
// 在这里处理权限请求结果
if (allGranted) {
// 所有权限都已授予,可以进行文件操作
} else {
// 至少有一个权限被拒绝
}
}
*/
PermissionX.init(this)
.permissions(Manifest.permission.READ_EXTERNAL_STORAGE,
Manifest.permission.WRITE_EXTERNAL_STORAGE)
@ -45,13 +29,11 @@ class WarehouseFragment : BaseFragment<FragmentWarehouseBinding>() {
}
.onForwardToSettings { scope, deniedList ->
scope.showForwardToSettingsDialog(deniedList, "您需要手动允许设置中的必要权限", "授权", "取消")
}.request { allGranted, _, _ ->
if (allGranted) {
}
}
if (isAdded) {
val mainActivity = activity as MainActivity
/* if (tableLayout == null) {
viewBinding.pager.postDelayed({ loadTab() }, MainActivity.linkInterval)
} else {*/
TabLayoutMediator(viewBinding.tabLayout, viewBinding.pager) { tab, position ->
when (position) {
0 -> {

View File

@ -60,6 +60,7 @@ class WebModDetailsFragment(val modId: String, val modNameLiveData: MutableLiveD
override fun whenViewCreated(inflater: LayoutInflater, savedInstanceState: Bundle?) {
viewModel.modId = modId
viewBinding.cardView.isVisible = false
viewModel.modNameLiveData = modNameLiveData
loadInfo()
}
@ -90,7 +91,7 @@ class WebModDetailsFragment(val modId: String, val modNameLiveData: MutableLiveD
viewBinding.userInfoView.text = info
viewBinding.cardView.postDelayed({
viewBinding.cardView.isVisible = true
viewBinding.openUserSpace.setOnClickListener {
viewBinding.cardView.setOnClickListener {
gotoUserPage(t.data.account)
}
}, 300)

View File

@ -37,7 +37,7 @@ class EditViewModel(application: Application) : BaseAndroidViewModel(application
*/
var targetFile: File? = null
val codeTranslate by lazy {
private val codeTranslate by lazy {
val c = CodeTranslate(getApplication())
c.setCompileErrorRecordFun {
//将信息上传至FireBase
@ -70,6 +70,7 @@ class EditViewModel(application: Application) : BaseAndroidViewModel(application
/**
* 获取当前使用的apk包存放目录
*/
@Suppress("unused")
val apkFolder by lazy {
GameSynchronizer.getPackAgeFolder(
getApplication(), AppSettings.getValue(
@ -97,12 +98,13 @@ class EditViewModel(application: Application) : BaseAndroidViewModel(application
* @return String?
*/
fun getNowOpenFilePath(): String {
val temPath = nowFilePath
/* val temPath = nowFilePath
return if (temPath == null) {
""
} else {
temPath
}
}*/
return nowFilePath ?: ""
}
@ -403,7 +405,7 @@ class EditViewModel(application: Application) : BaseAndroidViewModel(application
Locale.getDefault().language
)
) + " (" + file.file.name + ")"
val formatter = SimpleDateFormat("yyyy-MM-dd HH:mm:ss")
val formatter = SimpleDateFormat("yyyy-MM-dd HH:mm:ss", Locale.getDefault())
val historyDao = fileDataBase.getHistoryDao()
val newHistoryRecord = HistoryRecord(
path,

View File

@ -0,0 +1,12 @@
package com.muqing;
import androidx.annotation.NonNull;
import androidx.recyclerview.widget.RecyclerView;
import androidx.viewbinding.ViewBinding;
public class VH<Binging extends ViewBinding> extends RecyclerView.ViewHolder {
public Binging binging;
public VH(@NonNull Binging itemView) {
super(itemView.getRoot());
this.binging = itemView;
}
}

View File

@ -20,7 +20,7 @@ import java.util.Collections;
/** @noinspection unused*/
public class gj {
public static String log_TAB = "打印";
public final static String log_TAB = "输出";
public static void ts(Context a, Object b) {
Toast.makeText(a, b.toString(), Toast.LENGTH_SHORT).show();

View File

@ -1,142 +0,0 @@
package com.muqing;
import android.content.Context;
import android.os.Build;
import java.io.BufferedReader;
import java.io.File;
import java.io.FileInputStream;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.OutputStream;
import java.nio.file.Files;
import java.security.MessageDigest;
import java.security.NoSuchAlgorithmException;
import java.util.Objects;
/** @noinspection unused, ResultOfMethodCallIgnored, ResultOfMethodCallIgnored */
public class wj {
public static String filesdri;
public wj(Context context) {
wj.filesdri = Objects.requireNonNull(context.getExternalFilesDir("")).
getAbsolutePath() + "/";
// context.getFilesDir().toString() + "/";
}
/*
* 这里定义的是一个文件保存的方法写入到文件中所以是输出流
* */
public static boolean xrwb(String url, String text) {
if (text == null) {
text = "";
}
File file = new File(url);
//如果文件不存在创建文件
try {
File parentFile = file.getParentFile();
if (!Objects.requireNonNull(parentFile).isDirectory()) {
parentFile.mkdirs();
}
if (!file.exists())
file.createNewFile();
//创建FileOutputStream对象写入内容
FileOutputStream fos = new FileOutputStream(file);
//向文件中写入内容
fos.write(text.getBytes());
fos.close();
} catch (Exception e) {
e.printStackTrace();
}
return false;
}
public static String dqwb(String url) {
try {
File file = new File(url);
if (!file.exists()) {
return null;
}
FileInputStream fis = new FileInputStream(file);
BufferedReader br = new BufferedReader(new InputStreamReader(fis));
StringBuilder str = new StringBuilder();
String line;
while ((line = br.readLine()) != null) {
str.append(line);
}
br.close();
fis.close();
return str.toString();
} catch (Exception e) {
e.printStackTrace();
}
return null;
}
public static boolean cz(String url) {
return new File(url).exists();
}
public static boolean sc(String url) {
File file = new File(url);
return file.delete();
}
public static boolean sc(File file, boolean bool) {
if (!bool) {
return file.delete();
}
if (file.exists()) {
File[] files = file.listFiles();
if (files != null) {
for (File a : files) {
// 递归调用删除子文件夹及其内容
// 删除文件
sc(a, a.isDirectory());
}
}
return sc(file, false); // 删除当前文件夹
}
return false;
}
public String convertToMd5(String url) {
try {
MessageDigest md = MessageDigest.getInstance("MD5");
byte[] messageDigest = md.digest(url.getBytes());
StringBuilder hexString = new StringBuilder();
for (byte value : messageDigest) {
String hex = Integer.toHexString(0xFF & value);
if (hex.length() == 1) {
hexString.append('0');
}
hexString.append(hex);
}
return hexString.toString();
} catch (NoSuchAlgorithmException e) {
e.printStackTrace();
}
return null;
}
public static void fz(String sourceFilePath, String targetFilePath) {
File sourceFile = new File(sourceFilePath);
File targetFile = new File(targetFilePath);
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
try (InputStream in = Files.newInputStream(sourceFile.toPath());
OutputStream out = Files.newOutputStream(targetFile.toPath())) {
byte[] buf = new byte[1024];
int bytesRead;
while ((bytesRead = in.read(buf)) > 0) {
out.write(buf, 0, bytesRead);
}
// 文件复制完成
} catch (IOException e) {
e.printStackTrace();
}
}
}
}

View File

@ -4,4 +4,3 @@
android:propertyName="rotation"
android:valueFrom="180"
android:valueTo="360" />

View File

@ -1,7 +1,10 @@
<?xml version="1.0" encoding="utf-8"?>
<animated-vector xmlns:android="http://schemas.android.com/apk/res/android"
android:drawable="@drawable/expand_icon">
<target
android:name="expand"
android:animation="@animator/rotation_off" />
</animated-vector>
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="24dp"
android:height="24dp"
android:viewportWidth="960"
android:viewportHeight="960"
android:tint="?attr/colorControlNormal">
<path
android:fillColor="@android:color/white"
android:pathData="M480,599Q472,599 465,596.5Q458,594 452,588L268,404Q257,393 257,376Q257,359 268,348Q279,337 296,337Q313,337 324,348L480,504L636,348Q647,337 664,337Q681,337 692,348Q703,359 703,376Q703,393 692,404L508,588Q502,594 495,596.5Q488,599 480,599Z"/>
</vector>

View File

@ -1,7 +1,10 @@
<?xml version="1.0" encoding="utf-8"?>
<animated-vector xmlns:android="http://schemas.android.com/apk/res/android"
android:drawable="@drawable/expand_icon">
<target
android:name="expand"
android:animation="@animator/rotation_on" />
</animated-vector>
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="24dp"
android:height="24dp"
android:viewportWidth="960"
android:viewportHeight="960"
android:tint="?attr/colorControlNormal">
<path
android:fillColor="@android:color/white"
android:pathData="M480,432L324,588Q313,599 296,599Q279,599 268,588Q257,577 257,560Q257,543 268,532L452,348Q464,336 480,336Q496,336 508,348L692,532Q703,543 703,560Q703,577 692,588Q681,599 664,599Q647,599 636,588L480,432Z"/>
</vector>

View File

@ -0,0 +1,5 @@
<vector android:height="24dp" android:tint="#000000"
android:viewportHeight="24" android:viewportWidth="24"
android:width="24dp" xmlns:android="http://schemas.android.com/apk/res/android">
<path android:fillColor="@android:color/white" android:pathData="M6,19c0,1.1 0.9,2 2,2h8c1.1,0 2,-0.9 2,-2V7H6v12zM19,4h-3.5l-1,-1h-5l-1,1H5v2h14V4z"/>
</vector>

View File

@ -0,0 +1,10 @@
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="48dp"
android:height="48dp"
android:viewportWidth="960"
android:viewportHeight="960"
android:tint="?attr/colorControlNormal">
<path
android:fillColor="@android:color/white"
android:pathData="M38,706Q38,671 56,642.5Q74,614 106,600Q179,568 237.5,554Q296,540 358,540Q420,540 478,554Q536,568 609,600Q641,614 659.5,642.5Q678,671 678,706L678,740Q678,764.75 660.38,782.38Q642.75,800 618,800L98,800Q73.25,800 55.63,782.38Q38,764.75 38,740L38,706ZM862,800L724,800Q729,785 733.5,770.5Q738,756 738,740L738,706Q738,643 709,604.5Q680,566 622,540Q691,548 752,562Q813,576 851,596Q884,615 903,643Q922,671 922,706L922,740Q922,764.75 904.38,782.38Q886.75,800 862,800ZM358,479Q292,479 250,437Q208,395 208,329Q208,263 250,221Q292,179 358,179Q424,179 466,221Q508,263 508,329Q508,395 466,437Q424,479 358,479ZM718,329Q718,395 676,437Q634,479 568,479Q557,479 543.5,477.5Q530,476 519,472Q543,447 555.5,410.5Q568,374 568,329Q568,284 555.5,249.5Q543,215 519,186Q530,183 543.5,181Q557,179 568,179Q634,179 676,221Q718,263 718,329ZM98,740L618,740L618,706Q618,690 608.5,675Q599,660 585,654Q513,622 464,611Q415,600 358,600Q301,600 251.5,611Q202,622 130,654Q116,660 107,675Q98,690 98,706L98,740ZM358,419Q397,419 422.5,393.5Q448,368 448,329Q448,290 422.5,264.5Q397,239 358,239Q319,239 293.5,264.5Q268,290 268,329Q268,368 293.5,393.5Q319,419 358,419ZM358,740L358,740L358,740Q358,740 358,740Q358,740 358,740Q358,740 358,740Q358,740 358,740Q358,740 358,740Q358,740 358,740Q358,740 358,740Q358,740 358,740L358,740ZM358,329Q358,329 358,329Q358,329 358,329Q358,329 358,329Q358,329 358,329Q358,329 358,329Q358,329 358,329Q358,329 358,329Q358,329 358,329Z"/>
</vector>

View File

@ -0,0 +1,10 @@
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="48dp"
android:height="48dp"
android:viewportWidth="960"
android:viewportHeight="960"
android:tint="?attr/colorControlNormal">
<path
android:fillColor="@android:color/white"
android:pathData="M220,780L370,780L370,560Q370,547.25 378.63,538.63Q387.25,530 400,530L560,530Q572.75,530 581.38,538.63Q590,547.25 590,560L590,780L740,780L740,390Q740,390 740,390Q740,390 740,390L480,195Q480,195 480,195Q480,195 480,195L220,390Q220,390 220,390Q220,390 220,390L220,780ZM160,780L160,390Q160,375.75 166.38,363Q172.75,350.25 184,342L444,147Q459.68,135 479.84,135Q500,135 516,147L776,342Q787.25,350.25 793.63,363Q800,375.75 800,390L800,780Q800,804.75 782.38,822.38Q764.75,840 740,840L560,840Q547.25,840 538.63,831.38Q530,822.75 530,810L530,590Q530,590 530,590Q530,590 530,590L430,590Q430,590 430,590Q430,590 430,590L430,810Q430,822.75 421.38,831.38Q412.75,840 400,840L220,840Q195.25,840 177.63,822.38Q160,804.75 160,780ZM480,487L480,487L480,487Q480,487 480,487Q480,487 480,487L480,487L480,487L480,487L480,487Q480,487 480,487Q480,487 480,487L480,487Q480,487 480,487Q480,487 480,487L480,487L480,487Z"/>
</vector>

View File

@ -0,0 +1,10 @@
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="48dp"
android:height="48dp"
android:viewportWidth="960"
android:viewportHeight="960"
android:tint="?attr/colorControlNormal">
<path
android:fillColor="@android:color/white"
android:pathData="M140,780L327,780Q327,780 327,780Q327,780 327,780L327,420Q327,420 327,420Q327,420 327,420L140,420Q140,420 140,420Q140,420 140,420L140,780Q140,780 140,780Q140,780 140,780ZM387,780L573,780Q573,780 573,780Q573,780 573,780L573,180Q573,180 573,180Q573,180 573,180L387,180Q387,180 387,180Q387,180 387,180L387,780Q387,780 387,780Q387,780 387,780ZM633,780L820,780Q820,780 820,780Q820,780 820,780L820,500Q820,500 820,500Q820,500 820,500L633,500Q633,500 633,500Q633,500 633,500L633,780Q633,780 633,780Q633,780 633,780ZM80,780L80,420Q80,395.25 97.63,377.63Q115.25,360 140,360L327,360L327,180Q327,155.25 344.63,137.63Q362.25,120 387,120L573,120Q597.75,120 615.38,137.63Q633,155.25 633,180L633,440L820,440Q844.75,440 862.38,457.63Q880,475.25 880,500L880,780Q880,804.75 862.38,822.38Q844.75,840 820,840L140,840Q115.25,840 97.63,822.38Q80,804.75 80,780Z"/>
</vector>

View File

@ -0,0 +1,11 @@
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="24dp"
android:height="24dp"
android:viewportWidth="960"
android:viewportHeight="960"
android:tint="?attr/colorControlNormal"
android:autoMirrored="true">
<path
android:fillColor="@android:color/white"
android:pathData="M200,840Q167,840 143.5,816.5Q120,793 120,760L120,200Q120,167 143.5,143.5Q167,120 200,120L440,120Q457,120 468.5,131.5Q480,143 480,160Q480,177 468.5,188.5Q457,200 440,200L200,200Q200,200 200,200Q200,200 200,200L200,760Q200,760 200,760Q200,760 200,760L440,760Q457,760 468.5,771.5Q480,783 480,800Q480,817 468.5,828.5Q457,840 440,840L200,840ZM687,520L400,520Q383,520 371.5,508.5Q360,497 360,480Q360,463 371.5,451.5Q383,440 400,440L687,440L612,365Q601,354 601,338Q601,322 612,310Q623,298 640,297.5Q657,297 669,309L812,452Q824,464 824,480Q824,496 812,508L669,651Q657,663 640.5,662.5Q624,662 612,650Q601,638 601.5,621.5Q602,605 613,594L687,520Z"/>
</vector>

View File

@ -0,0 +1,10 @@
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="48dp"
android:height="48dp"
android:viewportWidth="960"
android:viewportHeight="960"
android:tint="?attr/colorControlNormal">
<path
android:fillColor="@android:color/white"
android:pathData="M360,694L590,694Q604,694 613.5,688Q623,682 630,670L708,488Q710,483 711.5,473Q713,463 713,458L713,434Q713,420 706.5,413.5Q700,407 686,407L472,407L501,269Q503,261 501,254Q499,247 494,242L473,220L312,394Q308,402 304,410Q300,418 300,427L300,634Q300,657 318,675.5Q336,694 360,694ZM480,880Q398,880 325,848.5Q252,817 197.5,762.5Q143,708 111.5,635Q80,562 80,480Q80,397 111.5,324Q143,251 197.5,197Q252,143 325,111.5Q398,80 480,80Q563,80 636,111.5Q709,143 763,197Q817,251 848.5,324Q880,397 880,480Q880,562 848.5,635Q817,708 763,762.5Q709,817 636,848.5Q563,880 480,880ZM480,820Q622,820 721,720.5Q820,621 820,480Q820,338 721,239Q622,140 480,140Q339,140 239.5,239Q140,338 140,480Q140,621 239.5,720.5Q339,820 480,820ZM480,480Q480,480 480,480Q480,480 480,480Q480,480 480,480Q480,480 480,480Q480,480 480,480Q480,480 480,480Q480,480 480,480Q480,480 480,480Z"/>
</vector>

View File

@ -0,0 +1,10 @@
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="48dp"
android:height="48dp"
android:viewportWidth="960"
android:viewportHeight="960"
android:tint="?attr/colorControlNormal">
<path
android:fillColor="@android:color/white"
android:pathData="M480.12,630Q551,630 600.5,580.38Q650,530.77 650,459.88Q650,389 600.38,339.5Q550.77,290 479.88,290Q409,290 359.5,339.62Q310,389.23 310,460.12Q310,531 359.62,580.5Q409.23,630 480.12,630ZM479.77,572Q433,572 400.5,539.27Q368,506.53 368,459.77Q368,413 400.73,380.5Q433.47,348 480.23,348Q527,348 559.5,380.73Q592,413.47 592,460.23Q592,507 559.27,539.5Q526.53,572 479.77,572ZM480,760Q345,760 234.5,684Q124,608 57,490Q53,482.88 51,475.35Q49,467.83 49,459.92Q49,452 51,444.54Q53,437.07 57,430Q124,312 234.5,236Q345,160 480,160Q615,160 725.5,236Q836,312 903,430Q907,437.13 909,444.65Q911,452.17 911,460.08Q911,468 909,475.46Q907,482.93 903,490Q836,608 725.5,684Q615,760 480,760ZM480,460Q480,460 480,460Q480,460 480,460Q480,460 480,460Q480,460 480,460Q480,460 480,460Q480,460 480,460Q480,460 480,460Q480,460 480,460ZM479.83,700Q601,700 702.5,634.5Q804,569 857,460Q804,351 702.67,285.5Q601.34,220 480.17,220Q359,220 257.5,285.5Q156,351 102,460Q156,569 257.33,634.5Q358.66,700 479.83,700Z"/>
</vector>

View File

@ -0,0 +1,10 @@
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="48dp"
android:height="48dp"
android:viewportWidth="960"
android:viewportHeight="960"
android:tint="?attr/colorControlNormal">
<path
android:fillColor="@android:color/white"
android:pathData="M600,340Q629,369 642.5,411.5Q656,454 647,496Q647,509 638.5,517.5Q630,526 617,526Q604,526 595.5,517.5Q587,509 587,496Q598,462 589.5,431.5Q581,401 559,380Q538,358 507,350Q476,342 443,353Q430,353 421.5,344.5Q413,336 413,323Q413,310 421.5,301.5Q430,293 443,293Q485,284 528,297.5Q571,311 600,340ZM490,220Q458,220 426,223Q394,226 363,236Q351,240 339,235Q327,230 322,219Q317,208 322,196.5Q327,185 338,181Q373,170 410,165Q447,160 485,160Q622,160 734.5,235.5Q847,311 907,434Q910,440 912,446.5Q914,453 914,460Q914,467 912.5,473.5Q911,480 908,486Q885,535 853,576.5Q821,618 779,653Q770,661 759,658.5Q748,656 741,647Q734,638 735.5,627Q737,616 746,608Q782,578 811,541.5Q840,505 857,460Q808,351 709,285.5Q610,220 490,220ZM480,760Q344,760 232.5,684Q121,608 55,488Q51,481 49.5,474.5Q48,468 48,460Q48,452 50,445.5Q52,439 55,432Q79,384 110.5,341.5Q142,299 182,264L77,159Q68,150 68.5,138Q69,126 77,117Q86,108 98.5,108Q111,108 120,117L836,833Q844,841 844,852.5Q844,864 836,873Q828,883 815.5,883Q803,883 794,874L648,731Q607,746 565,753Q523,760 480,760ZM223,306Q182,335 151,374Q120,413 102,460Q154,572 258.5,636Q363,700 488,700Q517,700 546,698.5Q575,697 601,684L537,620Q523,626 508.5,628Q494,630 480,630Q409,630 359.5,580.5Q310,531 310,460Q310,446 312.5,431.5Q315,417 320,403L223,306ZM528,448L528,448Q528,448 528,448Q528,448 528,448Q528,448 528,448Q528,448 528,448Q528,448 528,448Q528,448 528,448ZM412,506Q412,506 412,506Q412,506 412,506L412,506Q412,506 412,506Q412,506 412,506Q412,506 412,506Q412,506 412,506Z"/>
</vector>

View File

@ -11,30 +11,89 @@
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:fitsSystemWindows="true">
<com.google.android.material.appbar.MaterialToolbar
android:id="@+id/toolbar"
android:layout_width="match_parent"
android:layout_height="?attr/actionBarSize">
<EditText
android:id="@+id/edittext"
<com.google.android.material.card.MaterialCardView
android:id="@+id/materialCardView"
style="@style/Widget.Material3.CardView.Elevated"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:singleLine="true"
android:hint="@string/search"
android:visibility="gone"
android:imeOptions="actionSearch"
android:autofillHints="text"
android:inputType="text" />
</com.google.android.material.appbar.MaterialToolbar>
</com.google.android.material.appbar.AppBarLayout>
android:layout_margin="12dp">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginHorizontal="6dp"
android:gravity="center">
<ImageView
android:id="@+id/back"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:background="?android:selectableItemBackgroundBorderless"
android:focusable="true"
android:src="@drawable/md_nav_back"
android:tint="?android:attr/colorForeground"
tools:ignore="ContentDescription" />
<EditText
android:id="@+id/edittext"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:autofillHints="text"
android:background="@null"
android:drawableEnd="@drawable/ic_search_black_24dp"
android:hint="@string/search"
android:imeOptions="actionSearch"
android:inputType="text"
android:minHeight="48dp"
android:padding="10dp"
android:singleLine="true"
tools:ignore="TextContrastCheck,VisualLintTextFieldSize" />
</LinearLayout>
<LinearLayout
android:id="@+id/search_pick"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginHorizontal="6dp"
android:gravity="end"
android:orientation="horizontal"
android:visibility="gone"
tools:visibility="visible">
<ImageView
android:id="@+id/listTop"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginEnd="3dp"
android:padding="9dp"
android:background="?selectableItemBackground"
android:src="@drawable/animator_expand_on" />
<ImageView
android:id="@+id/listButtom"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:background="?selectableItemBackground"
android:padding="9dp"
android:src="@drawable/animator_expand_off" />
</LinearLayout>
</LinearLayout>
</com.google.android.material.card.MaterialCardView>
</com.google.android.material.appbar.AppBarLayout>
<androidx.constraintlayout.widget.ConstraintLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_marginLeft="16dp"
android:layout_marginTop="8dp"
android:layout_marginRight="16dp"
android:animateLayoutChanges="true"
android:layout_marginHorizontal="6dp"
android:layout_marginTop="3dp"
android:gravity="center"
app:layout_behavior="com.google.android.material.appbar.AppBarLayout$ScrollingViewBehavior">
@ -42,20 +101,52 @@
<ProgressBar
android:id="@+id/progressBar"
android:layout_width="wrap_content"
android:layout_height="wrap_content" />
android:layout_height="wrap_content"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" />
<TextView
android:id="@+id/displayView"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/unable_open_database"
android:visibility="gone" />
android:visibility="gone"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/progressBar"
tools:visibility="visible" />
<ExpandableListView
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="horizontal"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent">
<androidx.recyclerview.widget.RecyclerView
android:id="@+id/expandableListView"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="top"
android:visibility="gone" />
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="1" />
<com.google.android.material.divider.MaterialDivider
android:layout_width="1dp"
android:layout_height="match_parent"
android:layout_marginHorizontal="3dp"
android:layout_marginVertical="3dp" />
<androidx.recyclerview.widget.RecyclerView
android:id="@+id/code_recycler_b"
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="3"
app:layoutManager="androidx.recyclerview.widget.LinearLayoutManager" />
</LinearLayout>
</androidx.constraintlayout.widget.ConstraintLayout>
</androidx.coordinatorlayout.widget.CoordinatorLayout>

View File

@ -6,44 +6,39 @@
android:layout_width="match_parent"
android:layout_height="match_parent"
android:fitsSystemWindows="true"
tools:context=".ActivateActivity">
tools:context=".GameCheckActivity">
<com.google.android.material.appbar.AppBarLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:fitsSystemWindows="true">
android:layout_height="wrap_content">
<com.google.android.material.appbar.MaterialToolbar
android:id="@+id/toolbar"
android:layout_width="match_parent"
android:layout_height="?attr/actionBarSize" />
</com.google.android.material.appbar.AppBarLayout>
<androidx.core.widget.NestedScrollView
android:layout_width="match_parent"
android:layout_height="match_parent">
android:layout_height="match_parent"
android:fillViewport="true"
app:layout_behavior="com.google.android.material.appbar.AppBarLayout$ScrollingViewBehavior">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_margin="8dp"
android:orientation="vertical">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/failed_to_check_descripiton" />
<ImageView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:src="@drawable/game_configured" />
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content">
<Button
android:id="@+id/startButton"
style="@style/Widget.Material3.Button.OutlinedButton"
@ -52,7 +47,6 @@
android:layout_marginEnd="2dp"
android:layout_weight="1"
android:text="@string/start_game" />
<Button
android:id="@+id/completionButton"
android:layout_width="match_parent"
@ -60,11 +54,7 @@
android:layout_marginStart="2dp"
android:layout_weight="1"
android:text="@string/complete_settings" />
</LinearLayout>
</LinearLayout>
</androidx.core.widget.NestedScrollView>

View File

@ -1,6 +1,7 @@
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:gravity="center"
@ -77,8 +78,8 @@
android:text="@string/agreement_agreed" />
<RelativeLayout
android:layout_width="wrap_content"
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_below="@id/checkbox"
android:layout_marginTop="8dp">
@ -93,20 +94,20 @@
<Button
android:id="@+id/changeServerView"
style="@style/Widget.Material3.Button.TextButton"
android:layout_width="wrap_content"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginStart="8dp"
android:layout_toEndOf="@id/changePasswordView"
android:layout_weight="1"
android:layout_marginHorizontal="6dp"
android:text="@string/changing_the_server"
android:visibility="gone" />
android:visibility="gone"
tools:visibility="visible" />
<Button
android:id="@+id/registerView"
style="@style/Widget.Material3.Button.TextButton"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentEnd="true"
android:text="@string/register" />
</RelativeLayout>
</LinearLayout>
</RelativeLayout>

View File

@ -4,8 +4,8 @@
xmlns:tools="http://schemas.android.com/tools"
android:id="@+id/drawerlayout"
android:layout_width="match_parent"
android:fitsSystemWindows="false"
android:layout_height="match_parent">
android:layout_height="match_parent"
android:fitsSystemWindows="false">
<androidx.coordinatorlayout.widget.CoordinatorLayout
android:layout_width="match_parent"
@ -32,7 +32,6 @@
<com.google.android.material.navigation.NavigationView
android:id="@+id/navaiagtion"
android:fitsSystemWindows="true"
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:layout_gravity="start"

View File

@ -40,19 +40,21 @@
android:layout_width="match_parent"
android:layout_height="match_parent"
android:fillViewport="true"
android:layout_marginHorizontal="9dp"
app:layout_behavior="com.google.android.material.appbar.AppBarLayout$ScrollingViewBehavior">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_marginHorizontal="6dp"
android:layout_marginTop="16dp"
android:orientation="vertical">
<LinearLayout
android:id="@+id/searchLayout"
android:layout_width="match_parent"
android:layout_height="wrap_content"
card_view:ignore="UseCompoundDrawables">
card_view:ignore="UseCompoundDrawables"
android:layout_marginBottom="9dp">
<TextView
android:id="@+id/textview1"
@ -60,7 +62,7 @@
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:text="历史记录"
android:text="@string/search_history"
card_view:ignore="HardcodedText" />
<ImageView
@ -68,19 +70,10 @@
android:layout_width="36dp"
android:layout_height="36dp"
android:layout_marginEnd="6dp"
android:src="@drawable/auto_delete"
android:src="@drawable/baseline_delete_24"
card_view:ignore="ContentDescription" />
</LinearLayout>
<TextView
android:id="@+id/textview1_text1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_margin="16dp"
android:text="没有任何记录"
android:textSize="20sp"
card_view:ignore="HardcodedText" />
<androidx.recyclerview.widget.RecyclerView
android:id="@+id/hotSearchView2"
android:layout_width="match_parent"
@ -109,8 +102,8 @@
android:id="@+id/recyclerView"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:paddingHorizontal="6dp"
android:background="?android:colorBackground"
android:paddingHorizontal="6dp"
android:paddingTop="6dp"
android:visibility="gone"
app:layout_behavior="com.google.android.material.appbar.AppBarLayout$ScrollingViewBehavior" />

View File

@ -6,7 +6,7 @@
android:layout_height="match_parent"
android:animateLayoutChanges="true"
android:fitsSystemWindows="true"
tools:context=".MainActivity">
tools:context=".TurretDesignActivity">
<com.google.android.material.appbar.AppBarLayout
android:layout_width="match_parent"
@ -18,30 +18,31 @@
android:layout_width="match_parent"
android:layout_height="?attr/actionBarSize" />
<androidx.recyclerview.widget.RecyclerView
android:id="@+id/recyclerView"
tools:itemCount="1"
android:layout_width="match_parent"
app:layoutManager="androidx.recyclerview.widget.LinearLayoutManager"
android:layout_height="wrap_content" />
</com.google.android.material.appbar.AppBarLayout>
<RelativeLayout
<androidx.constraintlayout.widget.ConstraintLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:paddingLeft="16dp"
android:paddingTop="8dp"
android:paddingRight="16dp"
app:layout_behavior="com.google.android.material.appbar.AppBarLayout$ScrollingViewBehavior">
<FrameLayout
android:id="@+id/frameLayout"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_above="@id/cardView"
android:layout_alignParentTop="true"
android:layout_gravity="center">
android:layout_height="0dp"
app:layout_constraintBottom_toTopOf="@+id/cardView"
app:layout_constraintTop_toTopOf="parent">
<com.coldmint.rust.core.turret.TurretSketchpadView
android:id="@+id/turretSketchpadView"
android:layout_width="match_parent"
android:layout_height="match_parent" />
</FrameLayout>
<com.google.android.material.card.MaterialCardView
@ -50,9 +51,8 @@
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
android:layout_marginHorizontal="16dp"
android:layout_marginTop="8dp"
android:layout_marginBottom="8dp">
app:cardUseCompatPadding="true"
app:layout_constraintBottom_toBottomOf="parent">
<LinearLayout
@ -68,21 +68,6 @@
android:layout_height="wrap_content"
android:text="@string/control_panel" />
<com.google.android.material.textfield.TextInputLayout
style="@style/Widget.Material3.TextInputLayout.OutlinedBox.ExposedDropdownMenu"
android:layout_width="match_parent"
android:layout_marginTop="16dp"
android:hint="@string/turret"
android:layout_height="wrap_content">
<com.google.android.material.textfield.MaterialAutoCompleteTextView
android:layout_width="match_parent"
android:inputType="none"
android:id="@+id/autoCompleteText"
android:layout_height="wrap_content" />
</com.google.android.material.textfield.TextInputLayout>
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
@ -103,25 +88,15 @@
android:layout_height="wrap_content"
android:layout_alignParentEnd="true"
android:text="@string/edit" />
</RelativeLayout>
</LinearLayout>
</com.google.android.material.card.MaterialCardView>
</RelativeLayout>
</androidx.constraintlayout.widget.ConstraintLayout>
<!-- <com.google.android.material.floatingactionbutton.FloatingActionButton-->
<!-- android:layout_width="wrap_content"-->
<!-- android:layout_height="wrap_content"-->
<!-- android:layout_gravity="right|bottom"-->
<!-- android:layout_margin="16dp"-->
<!-- android:src="@drawable/add" />-->
</androidx.coordinatorlayout.widget.CoordinatorLayout>

View File

@ -1,7 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<androidx.coordinatorlayout.widget.CoordinatorLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:card_view="http://schemas.android.com/tools"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
@ -10,38 +9,32 @@
<com.google.android.material.appbar.AppBarLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:fitsSystemWindows="true">
android:layout_height="wrap_content">
<com.google.android.material.appbar.MaterialToolbar
android:id="@+id/toolbar"
android:layout_width="match_parent"
android:layout_height="?attr/actionBarSize" />
android:layout_height="?attr/actionBarSize"
app:layout_collapseMode="pin" />
<com.google.android.material.tabs.TabLayout
android:id="@+id/tabLayout"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="@android:color/transparent">
android:background="@android:color/transparent"
app:layout_collapseMode="pin">
<com.google.android.material.tabs.TabItem
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="详情" />
<com.google.android.material.tabs.TabItem
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="投币" />
<com.google.android.material.tabs.TabItem
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="评论" />
</com.google.android.material.tabs.TabLayout>
</com.google.android.material.appbar.AppBarLayout>
<androidx.viewpager2.widget.ViewPager2
@ -50,7 +43,6 @@
android:layout_height="match_parent"
app:layout_behavior="com.google.android.material.appbar.AppBarLayout$ScrollingViewBehavior" />
<com.google.android.material.floatingactionbutton.ExtendedFloatingActionButton
android:id="@+id/button"
android:layout_width="wrap_content"
@ -59,6 +51,4 @@
android:layout_margin="16dp"
android:text="@string/installation"
app:icon="@drawable/cloud_download" />
</androidx.coordinatorlayout.widget.CoordinatorLayout>

View File

@ -43,27 +43,6 @@
android:layout_width="16dp"
android:layout_height="16dp"
android:src="@drawable/baseline_help_outline_24" />
<!-- <TextView-->
<!-- android:layout_marginTop="8dp"-->
<!-- android:id="@+id/DemoTitleView"-->
<!-- style="@style/TextAppearance.Material3.BodySmall"-->
<!-- android:layout_width="wrap_content"-->
<!-- android:layout_height="wrap_content"-->
<!-- android:layout_below="@id/descriptionView"-->
<!-- android:text="示例代码:"-->
<!-- android:textColor="?attr/colorSecondary" />-->
<!-- <TextView-->
<!-- android:id="@+id/demoView"-->
<!-- style="@style/TextAppearance.Material3.BodySmall"-->
<!-- android:layout_width="wrap_content"-->
<!-- android:layout_height="wrap_content"-->
<!-- android:layout_below="@id/descriptionView"-->
<!-- android:layout_marginTop="5dp"-->
<!-- android:text="demo"-->
<!-- android:visibility="gone" />-->
<TextView
android:id="@+id/valueTypeView"
style="@style/TextAppearance.Material3.BodySmall"
@ -82,7 +61,7 @@
android:layout_marginLeft="8dp"
android:layout_toRightOf="@id/valueTypeView"
android:text="版本信息" />
<!--
<com.google.android.material.chip.ChipGroup
android:id="@+id/chipGroup"
android:layout_width="match_parent"
@ -90,8 +69,7 @@
android:layout_below="@id/valueTypeView"
android:layout_marginTop="8dp"
app:singleLine="false">
</com.google.android.material.chip.ChipGroup>
</com.google.android.material.chip.ChipGroup>-->
</RelativeLayout>

View File

@ -0,0 +1,44 @@
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
android:orientation="vertical"
android:layout_height="wrap_content">
<!-- Drag handle for accessibility -->
<com.google.android.material.bottomsheet.BottomSheetDragHandleView
android:id="@+id/drag_handle"
android:layout_width="match_parent"
android:layout_height="wrap_content"/>
<LinearLayout
android:id="@+id/linearLayout4"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginHorizontal="9dp"
android:layout_marginBottom="26dp"
android:orientation="vertical">
<TextView
android:id="@+id/title"
style="@style/TextAppearance.Material3.TitleLarge"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="Hello World!" />
<androidx.core.widget.NestedScrollView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:overScrollMode="never"
android:fadingEdge="vertical"
android:fadingEdgeLength="30dp"
android:layout_marginTop="6dp">
<TextView
android:id="@+id/message"
style="@style/TextAppearance.Material3.BodyLarge"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:textIsSelectable="true"
android:text="Hello World!" />
</androidx.core.widget.NestedScrollView>
</LinearLayout>
</LinearLayout>

View File

@ -1,15 +1,18 @@
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_width="match_parent"
android:orientation="vertical">
<com.google.android.material.tabs.TabLayout
android:id="@+id/tabLayout"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="@android:color/transparent"/>
<androidx.viewpager2.widget.ViewPager2
android:id="@+id/pager"
android:layout_width="match_parent"
android:layout_height="match_parent" />
android:layout_height="0dp"
android:layout_weight="1"/>
<com.google.android.material.bottomnavigation.BottomNavigationView
android:id="@+id/bottomnavigationView"
android:layout_width="match_parent"
android:layout_height="wrap_content"
app:menu="@menu/menu_main_bottom" />
</LinearLayout>

View File

@ -1,5 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:id="@+id/rootLayout"
android:layout_width="match_parent"
android:layout_height="match_parent"
@ -28,7 +29,8 @@
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical"
android:visibility="gone">
android:visibility="gone"
tools:visibility="visible">
<LinearLayout
@ -49,6 +51,7 @@
android:id="@+id/headRecyclerView"
android:layout_width="match_parent"
android:layout_height="wrap_content"
tools:itemCount="1"
android:layout_marginTop="8dp" />
</LinearLayout>

View File

@ -74,16 +74,24 @@
</com.google.android.material.chip.ChipGroup>
</HorizontalScrollView>
<androidx.swiperefreshlayout.widget.SwipeRefreshLayout
android:id="@+id/swipeRefreshLayout"
<com.scwang.smart.refresh.layout.SmartRefreshLayout
android:id="@+id/refreshLayout"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:visibility="gone">
app:srlEnablePreviewInEditMode="false">
<!--srlEnablePreviewInEditMode 可以开启和关闭预览功能-->
<com.scwang.smart.refresh.header.ClassicsHeader
android:layout_width="match_parent"
android:layout_height="wrap_content"/>
<androidx.recyclerview.widget.RecyclerView
android:id="@+id/recyclerView"
android:layout_width="match_parent"
android:layout_height="match_parent" />
</androidx.swiperefreshlayout.widget.SwipeRefreshLayout>
android:layout_height="match_parent"
android:overScrollMode="never"
android:background="#fff" />
<com.scwang.smart.refresh.footer.ClassicsFooter
android:layout_width="match_parent"
android:layout_height="wrap_content"/>
</com.scwang.smart.refresh.layout.SmartRefreshLayout>
</LinearLayout>
</androidx.constraintlayout.widget.ConstraintLayout>

View File

@ -53,16 +53,16 @@
android:orientation="vertical"
android:padding="8dp">
<RelativeLayout
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content">
android:layout_height="wrap_content"
android:gravity="center_vertical">
<TextView
style="@style/TextAppearance.Material3.HeadlineSmall"
android:layout_width="wrap_content"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_alignParentStart="true"
android:layout_centerVertical="true"
android:layout_weight="1"
android:text="@string/random_recommended" />
<Button
@ -70,11 +70,9 @@
style="@style/Widget.Material3.Button.TextButton"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentEnd="true"
android:layout_centerVertical="true"
android:text="@string/change_random_recommended"
card_view:ignore="RelativeOverlap" />
</RelativeLayout>
</LinearLayout>
<com.google.android.material.progressindicator.LinearProgressIndicator

View File

@ -1,7 +1,7 @@
<?xml version="1.0" encoding="utf-8"?>
<androidx.core.widget.NestedScrollView xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:card_view="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:fillViewport="true">
@ -12,23 +12,26 @@
android:layout_height="match_parent"
android:orientation="vertical">
<LinearLayout
android:visibility="gone"
<androidx.constraintlayout.widget.ConstraintLayout
android:id="@+id/contentLayout"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical">
android:orientation="vertical"
android:visibility="gone"
tools:visibility="visible">
<com.google.android.material.card.MaterialCardView
android:id="@+id/materialCardView"
style="@style/Widget.Material3.CardView.Elevated"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_margin="8dp">
app:cardUseCompatPadding="true"
app:layout_constraintTop_toTopOf="parent">
<RelativeLayout
android:id="@+id/myHomeView"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_height="wrap_content"
android:layout_margin="16dp"
android:animateLayoutChanges="true"
android:orientation="horizontal">
@ -42,7 +45,7 @@
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_height="wrap_content"
android:layout_centerVertical="true"
android:layout_marginStart="8dp"
android:layout_toStartOf="@id/right_icon"
@ -81,11 +84,18 @@
</RelativeLayout>
</com.google.android.material.card.MaterialCardView>
<com.google.android.material.card.MaterialCardView
android:id="@+id/materialCardView2"
style="@style/Widget.Material3.CardView.Elevated"
android:layout_width="match_parent"
android:layout_height="wrap_content"
app:cardUseCompatPadding="true"
app:layout_constraintTop_toBottomOf="@+id/materialCardView">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_margin="16dp"
android:layout_height="wrap_content"
android:layout_margin="8dp"
android:orientation="vertical">
<TextView
@ -98,34 +108,34 @@
android:id="@+id/recyclerView"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="8dp" />
android:layout_marginTop="8dp"
tools:itemCount="2" />
</LinearLayout>
</com.google.android.material.card.MaterialCardView>
<Button
android:id="@+id/logOutButton"
style="@style/Widget.Material3.Button.OutlinedButton"
style="@style/Widget.Material3.Button.ElevatedButton"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginHorizontal="16dp"
android:layout_marginTop="16dp"
android:text="@string/log_out" />
</LinearLayout>
android:layout_margin="8dp"
android:text="@string/log_out"
app:iconGravity="start"
app:icon="@drawable/logout"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/materialCardView2" />
</androidx.constraintlayout.widget.ConstraintLayout>
<ProgressBar
android:id="@+id/progressBar"
android:layout_width="wrap_content"
android:layout_height="wrap_content"/>
android:layout_height="wrap_content"
tools:visibility="gone"/>
<include
android:visibility="gone"
android:id="@+id/loginLayout"
layout="@layout/layout_log_in_first"/>
layout="@layout/layout_log_in_first"
android:visibility="gone" />
</LinearLayout>
</androidx.core.widget.NestedScrollView>

View File

@ -4,11 +4,9 @@
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical">
<com.google.android.material.appbar.AppBarLayout
android:layout_width="match_parent"
android:layout_height="wrap_content">
<com.google.android.material.tabs.TabLayout
android:id="@+id/tabLayout"
android:layout_width="match_parent"

View File

@ -6,13 +6,13 @@
android:layout_height="match_parent"
android:orientation="vertical">
<LinearLayout
android:id="@+id/loadLayout"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:gravity="center"
android:orientation="vertical">
android:orientation="vertical"
android:visibility="gone">
<ProgressBar
@ -24,7 +24,7 @@
android:id="@+id/tipView"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:visibility="gone" />
android:visibility="visible" />
</LinearLayout>
@ -34,7 +34,7 @@
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical"
android:visibility="gone">
android:visibility="visible">
<LinearLayout
android:layout_width="match_parent"
@ -52,16 +52,18 @@
android:layout_height="wrap_content"
android:layout_marginTop="16dp"
android:text="@string/audit"
android:visibility="visible" />
android:visibility="gone" />
<com.google.android.material.card.MaterialCardView
android:id="@+id/cardView"
style="@style/Widget.Material3.CardView.Elevated"
style="@style/Widget.Material3.CardView.Filled"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="16dp"
android:visibility="gone">
android:clickable="true"
android:focusable="true"
android:visibility="visible">
<RelativeLayout
android:id="@+id/openUserSpace"

View File

@ -0,0 +1,33 @@
<?xml version="1.0" encoding="utf-8"?>
<com.google.android.material.card.MaterialCardView xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
style="@style/Widget.Material3.CardView.Elevated"
android:layout_width="match_parent"
android:layout_height="wrap_content"
app:cardUseCompatPadding="true">
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_margin="9dp"
android:orientation="vertical">
<TextView
android:id="@+id/title"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/title"
android:textSize="20sp"
android:textStyle="bold" />
<TextView
android:id="@+id/message"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="3dp"
android:text="@string/filenum"
android:singleLine="true"
android:textSize="13sp" />
</LinearLayout>
</com.google.android.material.card.MaterialCardView>

View File

@ -0,0 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent">
</androidx.constraintlayout.widget.ConstraintLayout>

View File

@ -9,9 +9,10 @@
<ImageView
android:id="@+id/iconView"
android:layout_width="48dp"
android:layout_height="48dp"
android:layout_width="46dp"
android:layout_height="46dp"
android:src="@drawable/image"
android:scaleType="fitXY"
app:tint="?attr/colorControlNormal" />
<TextView

View File

@ -1,17 +1,18 @@
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
xmlns:app="http://schemas.android.com/apk/res-auto">
android:layout_height="wrap_content">
<Button
android:id="@+id/button"
style="?android:attr/buttonBarButtonStyle"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
app:strokeWidth="1dp"
app:strokeColor="?attr/colorOnSurface"
app:shapeAppearance="?attr/shapeAppearanceSmallComponent"
android:text="@string/action"
android:textColor="?attr/colorOnSurface"
app:rippleColor="?colorBackgroundFloating"
android:text="@string/action" />
app:shapeAppearance="?attr/shapeAppearanceSmallComponent"
app:strokeColor="?attr/colorOnSurface"
app:strokeWidth="1dp" />
</RelativeLayout>

View File

@ -0,0 +1,33 @@
<?xml version="1.0" encoding="utf-8"?>
<com.google.android.material.card.MaterialCardView xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
style="@style/Widget.Material3.CardView.Filled"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:clickable="true"
android:focusable="true"
app:cardBackgroundColor="?attr/colorPrimaryContainer"
app:cardUseCompatPadding="true">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:gravity="center_vertical"
android:layout_marginHorizontal="16dp"
android:layout_marginVertical="6dp"
android:orientation="horizontal"
tools:ignore="UseCompoundDrawables">
<TextView
android:id="@+id/button"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/search" />
<ImageView
android:id="@+id/imageview"
android:layout_width="24dp"
android:layout_height="24dp"
android:layout_marginStart="16dp"
android:src="@drawable/visibility" />
</LinearLayout>
</com.google.android.material.card.MaterialCardView>

View File

@ -2,14 +2,16 @@
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="90dp"
android:layout_height="100dp"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:gravity="center"
android:orientation="vertical">
<ImageView
<androidx.constraintlayout.utils.widget.ImageFilterView
android:background="?attr/selectableItemBackgroundBorderless"
android:id="@+id/headIconView"
android:layout_width="56dp"
android:layout_height="56dp"
app:round="36dp"
android:src="@drawable/head_icon" />
<TextView

View File

@ -64,10 +64,10 @@
android:icon="@drawable/github"
android:title="@string/github" />
<item
android:id="@+id/rust_api"
android:icon="@drawable/outline_book_24"
android:title="@string/rust_api" />
<!-- <item-->
<!-- android:id="@+id/rust_api"-->
<!-- android:icon="@drawable/outline_book_24"-->
<!-- android:title="@string/rust_api" />-->
<item

View File

@ -0,0 +1,20 @@
<?xml version="1.0" encoding="utf-8"?>
<menu xmlns:android="http://schemas.android.com/apk/res/android">
<item
android:id="@+id/action_recommended"
android:icon="@drawable/home"
android:title="@string/recommended" />
<item
android:id="@+id/action_follow"
android:icon="@drawable/group"
android:title="@string/follow" />
<item
android:id="@+id/action_ranking"
android:icon="@drawable/leaderboard"
android:title="@string/ranking" />
<item
android:id="@+id/action_my"
android:icon="@drawable/head_icon"
android:title="@string/my" />
</menu>

View File

@ -0,0 +1,32 @@
<?xml version="1.0" encoding="utf-8"?>
<navigation xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
app:startDestination="@id/mod_item">
<fragment
android:id="@+id/community_item"
android:name="com.coldmint.rust.pro.fragments.CommunityFragment"
android:label="@string/community"
tools:layout="@layout/fragment_community" />
<fragment
android:id="@+id/mod_item"
android:name="com.coldmint.rust.pro.fragments.WarehouseFragment"
android:label="@string/warehouse"
tools:layout="@layout/fragment_mod" />
<fragment
android:id="@+id/database_item"
android:name="com.coldmint.rust.pro.fragments.DatabaseFragment"
android:label="@string/menu_title3"
tools:layout="@layout/fragment_database" />
<fragment
android:id="@+id/template_item"
android:name="com.coldmint.rust.pro.fragments.TemplateFragment"
android:label="@string/template_title"
tools:layout="@layout/fragment_local_template" />
</navigation>

View File

@ -154,7 +154,7 @@
<string name="loading_bookmarks">Loading bookmarks…</string>
<string name="calculating">Calculating…</string>
<string name="no_bookmark">No bookmark</string>
<string name="filenum">Total %1$s items</string>
<string name="filenum">%1$sitems</string>
<string name="not_find_database">No data set was found</string>
<string name="use_database">use</string>
<string name="unuse_dataabse">Has been used</string>

View File

@ -154,7 +154,7 @@
<string name="loading_bookmarks">加载书签...</string>
<string name="calculating">正在计算...</string>
<string name="no_bookmark">没有书签</string>
<string name="filenum">%1$s 项目</string>
<string name="filenum">%1$s个</string>
<string name="not_find_database">没有找到数据集</string>
<string name="use_database">使用</string>
<string name="unuse_dataabse">已使用</string>
@ -971,4 +971,6 @@
<string name="code_demo">示例代码</string>
<string name="clipboard_cue">剪切板提示</string>
<string name="clipboard_cue_tip">在安卓13及以上系统应用将内容复制到剪贴板时弹出提示。</string>
<string name="clear_all_history">清空所有历史记录</string>
<string name="search_history">搜索历史</string>
</resources>

View File

@ -0,0 +1,16 @@
<?xml version="1.0" encoding="utf-8"?>
<shortcuts xmlns:android="http://schemas.android.com/apk/res/android">
<shortcut
android:enabled="true"
android:icon="@drawable/table"
android:shortcutDisabledMessage="@string/code_table"
android:shortcutId="id1"
android:shortcutLongLabel="@string/code_table"
android:shortcutShortLabel="@string/code_table">
<intent
android:action="android.intent.action.VIEW"
android:targetClass="com.coldmint.rust.pro.CodeTableActivity"
android:targetPackage="com.coldmint.rust.pro" />
<categories android:name="android.shortcut.conversation" />
</shortcut>
</shortcuts>

View File

@ -4,10 +4,10 @@ data class TemplateInfo(
val appVersionNum: Int,
val description: String,
val developer: String,
@Deprecated(
"不要直接读取模板名称请使用getName方法",
ReplaceWith("getName()", "com.coldmint.rust.core"), DeprecationLevel.WARNING
)
// @Deprecated(
// "不要直接读取模板名称请使用getName方法",
// ReplaceWith("getName()", "com.coldmint.rust.core"), DeprecationLevel.WARNING
// ) 可惜你没有 getName() 方法
val name: String,
val update: String,
val versionName: String,

View File

@ -16,7 +16,8 @@ data class SectionInfo(
@ColumnInfo(name = "translate") val translate: String = "",
@ColumnInfo(name = "need_name") val needName: Boolean = false,
@ColumnInfo(name = "is_visible") val isVisible: Boolean = true,
@ColumnInfo(name = "is_available") val isAvailable: Boolean = true
@ColumnInfo(name = "is_available") val isAvailable: Boolean = true,
// var isShow: Boolean = false
) {
@Ignore
constructor() : this("")

View File

@ -11,5 +11,6 @@ data class TurretData(
val name: String,
var gameCoordinateData: CoordinateData,
var scaleValue: Float = 1f,
var imageFile: File? = null
var imageFile: File? = null,
var isImage: Boolean = true
)

View File

@ -1,6 +1,5 @@
package com.coldmint.rust.core.turret
import android.util.Log
import android.view.ViewGroup
import com.coldmint.rust.core.SourceFile
import com.coldmint.rust.core.debug.LogCat
@ -12,7 +11,7 @@ import java.io.File
* 此类用于管理源文件内的炮塔数据
* @constructor
*/
class TurretManager(val sourceFile: SourceFile) {
class TurretManager(private val sourceFile: SourceFile) {
/**
@ -47,6 +46,7 @@ class TurretManager(val sourceFile: SourceFile) {
}
init {
turretList.clear()
val allSection = sourceFile.allSection
val size = allSection.size
if (size > 0) {
@ -54,7 +54,7 @@ class TurretManager(val sourceFile: SourceFile) {
sourceFile.findResourceFilesFromSection("image_turret", "graphics", false)
var defaultImageFile: File? = null
if (!defaultImageList.isNullOrEmpty()) {
defaultImageFile = defaultImageList.get(0)
defaultImageFile = defaultImageList[0]
LogCat.d("炮塔管理器-默认图像", defaultImageFile.absolutePath)
}
allSection.forEach {
@ -65,17 +65,17 @@ class TurretManager(val sourceFile: SourceFile) {
var x = 0
var y = 0
val xData = sourceFile.readValueFromSection("x", it)
if (xData != null && xData.isNotBlank()) {
if (!xData.isNullOrBlank()) {
x = xData.toFloat().toInt()
}
val yData = sourceFile.readValueFromSection("y", it)
if (yData != null&& yData.isNotBlank()) {
if (!yData.isNullOrBlank()) {
y = yData.toFloat().toInt()
}
val turretData = TurretData(name, CoordinateData(x, y))
val fileList = sourceFile.findResourceFilesFromSection("image", it, false)
if (!fileList.isNullOrEmpty()) {
val file = fileList.get(0)
val file = fileList[0]
turretData.imageFile = file
LogCat.d("炮塔管理器-$name", "设置炮塔图像" + file.absolutePath)
} else {
@ -153,7 +153,7 @@ class TurretManager(val sourceFile: SourceFile) {
* @param frameLayout FrameLayout
* @param sourceFile SourceFile
*/
fun installerTurret(
private fun installerTurret(
viewGroup: ViewGroup,
turretData: TurretData,
turretSketchpadView: TurretSketchpadView

View File

@ -1,13 +1,10 @@
package com.coldmint.rust.core.turret
import android.annotation.SuppressLint
import android.content.Context
import android.graphics.*
import android.util.AttributeSet
import android.util.Log
import android.view.View
import android.view.ViewGroup
import android.widget.FrameLayout
import android.widget.RelativeLayout
import com.coldmint.rust.core.R
import com.coldmint.rust.core.debug.LogCat
@ -15,10 +12,9 @@ import com.coldmint.rust.core.debug.LogCat
* 炮塔画板
* @constructor
*/
@SuppressLint("CustomViewStyleable")
class TurretSketchpadView(context: Context, attributeSet: AttributeSet? = null) :
View(context, attributeSet) {
companion object {
/**
* 缩放图像
@ -37,8 +33,8 @@ class TurretSketchpadView(context: Context, attributeSet: AttributeSet? = null)
bitmap,
0,
0,
bitmap.getWidth(),
bitmap.getHeight(),
bitmap.width,
bitmap.height,
matrix,
true
)
@ -268,6 +264,17 @@ class TurretSketchpadView(context: Context, attributeSet: AttributeSet? = null)
canvas.drawBitmap(temBitmap, startX.toFloat(), startY.toFloat(), paint)
temBitmap.recycle()
}
/* val canvasWidth = width.toFloat()
val canvasHeight = height.toFloat()
val bitmapW = bitmap.width
val bitmapH = bitmap.height
// 计算图像要在画布上居中的坐标
val centerX = (canvasWidth - bitmapW) / 2
val centerY = (canvasHeight - bitmapH) / 2
// 绘制居中位图
canvas.drawBitmap(bitmap, centerX, centerY, paint)
bitmap.recycle()*/
}
override fun onDraw(canvas: Canvas?) {

View File

@ -3,16 +3,12 @@ package com.coldmint.rust.core.turret
import android.annotation.SuppressLint
import android.content.Context
import android.graphics.Bitmap
import android.graphics.Bitmap.createBitmap
import android.graphics.BitmapFactory
import android.graphics.Canvas
import android.graphics.Paint
import android.util.AttributeSet
import android.util.Log
import android.view.MotionEvent
import android.view.View
import android.widget.Toast
import com.coldmint.rust.core.R
import com.coldmint.rust.core.debug.LogCat
/**
@ -104,7 +100,7 @@ class TurretView(context: Context, attributeSet: AttributeSet? = null) :
* 设置炮塔坐标数据
* @param coordinateData
*/
fun setTurretGameCoordinateData(coordinateData: CoordinateData) {
private fun setTurretGameCoordinateData(coordinateData: CoordinateData) {
if (this::turretData.isInitialized) {
turretData.gameCoordinateData = coordinateData
}
@ -116,6 +112,7 @@ class TurretView(context: Context, attributeSet: AttributeSet? = null) :
* @param event MotionEvent
* @return Boolean 返回true已被处理
*/
@SuppressLint("ClickableViewAccessibility")
override fun onTouchEvent(event: MotionEvent?): Boolean {
if (event != null) {
val action = event.action
@ -123,6 +120,7 @@ class TurretView(context: Context, attributeSet: AttributeSet? = null) :
MotionEvent.ACTION_DOWN -> {
return canDrag
}
MotionEvent.ACTION_MOVE -> {
LogCat.d(debugKey, "收到移动${turretData.name} 可拖动状态${canDrag}")
if (canDrag) {
@ -144,6 +142,10 @@ class TurretView(context: Context, attributeSet: AttributeSet? = null) :
@SuppressLint("DrawAllocation")
override fun onDraw(canvas: Canvas?) {
super.onDraw(canvas)
if (!turretData.isImage) {
//不可显示图像
return
}
if (this::turretData.isInitialized) {
if (turretSketchpadView == null) {
LogCat.e(debugKey, "未绑定画板,停止绘制。")
@ -159,15 +161,18 @@ class TurretView(context: Context, attributeSet: AttributeSet? = null) :
LogCat.e(debugKey, "无法加载炮塔图像。")
return
} else {
if (turretData.scaleValue != 1f) {
/* if (turretData.scaleValue != 1f) {
bitmap = TurretSketchpadView.scaleBitmap(
bitmap, turretData.scaleValue
)
}
}*/
bitmap = TurretSketchpadView.scaleBitmap(
bitmap, 10F
)
val androidCoordinate =
turretSketchpadView!!.toAndroidCoordinate(turretData.gameCoordinateData)
bitmapW = bitmap!!.width
bitmapH = bitmap!!.height
bitmapH = bitmap.height
canvas?.drawBitmap(
bitmap,
(androidCoordinate.x - bitmapW / 2).toFloat(),

View File

@ -92,7 +92,7 @@ class Report private constructor() {
val requestBody = requestBodyBuilder.build()
val request =
Request.Builder()
.url(ServerConfiguration.website + "php/report.php?action=list")
.url(ServerConfiguration.website + "php/report.php?action=reportRecordList")
.post(requestBody).build()
val call = okHttpClient.newCall(request)
val handler = Handler(Looper.getMainLooper())

View File

@ -831,7 +831,8 @@ class WebMod private constructor() {
apiCallBack: ApiCallBack<WebModListData>,
tag: String? = null,
sortMode: SortMode? = null,
limit: String? = null
limit: String? = null,
sum : String?=null
) {
val okHttpClient = ServerConfiguration.initOkHttpClient()
val requestBodyBuilder: FormBody.Builder =

View File

@ -1,7 +1,4 @@
package com.coldmint.dialog
import android.app.Dialog
import android.content.Context
import android.view.View
/**

View File

@ -1,12 +1,8 @@
package com.coldmint.dialog
import android.content.Context
import android.os.Bundle
import android.view.LayoutInflater
import android.view.View
import android.view.ViewGroup
import androidx.appcompat.app.AlertDialog
import androidx.fragment.app.DialogFragment
import androidx.viewbinding.ViewBinding
import com.google.android.material.bottomsheet.BottomSheetDialog
@ -22,7 +18,6 @@ abstract class BaseBottomDialog<ViewBindingType : ViewBinding>(val context: Cont
protected val bottomSheetDialog: BottomSheetDialog by lazy {
BottomSheetDialog(context)
}
protected val layoutInflater by lazy {

View File

@ -27,6 +27,7 @@ import android.content.Context;
import android.graphics.Color;
import android.graphics.drawable.ColorDrawable;
import android.util.AttributeSet;
import android.util.Log;
import android.widget.Button;
import android.widget.LinearLayout;
@ -95,6 +96,8 @@ public class SymbolInputView extends LinearLayout {
for (int i = 0; i < getChildCount(); i++) {
((Button) getChildAt(i)).setTextColor(color);
}
Log.i("SymbolInputView", "Set text color to " + color);
textColor = color;
}

View File

@ -23,6 +23,7 @@
*/
package io.github.rosemoe.sora.widget.base;
import android.util.Log;
import android.view.Gravity;
import android.view.View;
import android.widget.PopupWindow;
@ -271,6 +272,7 @@ public class EditorPopupWindow {
if (isShowing()) {
return;
}
Log.i("EditorPopupWindow", "Created a new window for editor");
applyWindowAttributes(true);
}

View File

@ -23,6 +23,7 @@
*/
package io.github.rosemoe.sora.widget.component;
import android.graphics.Color;
import android.util.TypedValue;
import android.view.LayoutInflater;
import android.view.View;
@ -30,6 +31,8 @@ import android.view.ViewGroup;
import android.widget.ImageView;
import android.widget.TextView;
import androidx.core.content.ContextCompat;
import io.github.rosemoe.sora.R;
import io.github.rosemoe.sora.widget.schemes.EditorColorScheme;
@ -53,13 +56,18 @@ public final class DefaultCompletionItemAdapter extends EditorCompletionAdapter
}
var item = getItem(pos);
//编辑器代码提示文本渲染
TextView tv = view.findViewById(R.id.result_item_label);
tv.setText(item.label);
tv.setTextColor(getThemeColor(EditorColorScheme.COMPLETION_WND_TEXT_PRIMARY));
// tv.setTextColor(getThemeColor(EditorColorScheme.COMPLETION_WND_TEXT_PRIMARY));
tv.setTextColor(ContextCompat.getColor(getContext(),R.color.defaultSymbolInputTextColor));
tv = view.findViewById(R.id.result_item_desc);
tv.setText(item.desc);
tv.setTextColor(getThemeColor(EditorColorScheme.COMPLETION_WND_TEXT_SECONDARY));
// tv.setTextColor(getThemeColor(EditorColorScheme.COMPLETION_WND_TEXT_SECONDARY));
tv.setTextColor(ContextCompat.getColor(getContext(),R.color.defaultSymbolInputTextColor));
view.setTag(pos);
if (isCurrentCursorPosition) {

View File

@ -25,6 +25,7 @@
package io.github.rosemoe.sora.widget.component
import android.graphics.drawable.GradientDrawable
import android.util.Log
import android.view.LayoutInflater
import android.view.MotionEvent
import android.view.View

View File

@ -52,9 +52,8 @@
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Medium Text"
android:textColor="#FF000000"
android:id="@+id/result_item_label"
android:textSize="15sp"/>
style="@style/TextAppearance.Material3.TitleSmall"
android:id="@+id/result_item_label" />
<TextView
android:layout_width="wrap_content"