Compare commits
No commits in common. "master" and "2.1.1-Bata6(2024-2-17)" have entirely different histories.
master
...
2.1.1-Bata
1
.gitignore
vendored
1
.gitignore
vendored
|
@ -61,4 +61,3 @@ release/
|
|||
|
||||
# Local configuration file (sdk path, etc)
|
||||
local.properties
|
||||
app/debug/
|
|
@ -32,7 +32,8 @@ android {
|
|||
minSdkVersion 23
|
||||
targetSdkVersion 33
|
||||
versionCode 28
|
||||
versionName "2.1.1 Test(2024-7-20)"
|
||||
versionName "2.1.1 Bata6(2023-7-20)"
|
||||
|
||||
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
|
||||
}
|
||||
|
||||
|
@ -95,8 +96,7 @@ dependencies {
|
|||
implementation 'androidx.appcompat:appcompat:1.6.1'
|
||||
implementation 'com.google.android.material:material:1.9.0'
|
||||
|
||||
//引发BUG的组件
|
||||
implementation platform('com.google.firebase:firebase-bom:31.3.0')
|
||||
implementation platform('com.google.firebase:firebase-bom:31.1.1')
|
||||
implementation 'com.google.firebase:firebase-analytics-ktx'
|
||||
implementation 'com.google.firebase:firebase-crashlytics-ktx'
|
||||
implementation 'com.google.firebase:firebase-perf-ktx'
|
||||
|
@ -124,8 +124,11 @@ dependencies {
|
|||
annotationProcessor "androidx.room:room-compiler:2.4.0"
|
||||
kapt "androidx.room:room-compiler:2.4.0"
|
||||
|
||||
// 这个依赖项提供了简单菜单样式的偏好设置项,
|
||||
// 让你可以轻松地创建包含多个选项的设置菜单。使用该库可以帮助你快速构建应用的设置界面,并处理用户的设置选择。
|
||||
implementation "dev.rikka.rikkax.preference:simplemenu-preference:1.0.3"
|
||||
// 这个依赖项提供了 Material Design 风格的偏好设置项,使你的设置界面更符合现代设计标准。
|
||||
// 该库基于 Material Components 库,
|
||||
// 提供了一些常见的控件和样式,如开关按钮、颜色选择器等,有助于提升用户体验。
|
||||
implementation "dev.rikka.rikkax.material:material-preference:2.0.0"
|
||||
|
||||
|
@ -179,9 +182,4 @@ 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' //经典加载
|
||||
|
||||
}
|
20
app/release/output-metadata.json
Normal file
20
app/release/output-metadata.json
Normal file
|
@ -0,0 +1,20 @@
|
|||
{
|
||||
"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"
|
||||
}
|
|
@ -25,14 +25,17 @@
|
|||
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"
|
||||
|
@ -40,8 +43,6 @@
|
|||
<activity
|
||||
android:name=".CustomizeEditTextActivity"
|
||||
android:exported="false"/>
|
||||
<!-- 模组界面-->
|
||||
<activity android:name=".fragments.WarehouseFragment" />
|
||||
<activity
|
||||
android:name=".SearchActivity"
|
||||
android:exported="false"/>
|
||||
|
@ -138,9 +139,6 @@
|
|||
|
||||
<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"
|
||||
|
@ -283,12 +281,7 @@
|
|||
android:name=".CreateTemplateActivity"/>
|
||||
<activity
|
||||
android:name=".CodeTableActivity"
|
||||
android:launchMode="singleTask"
|
||||
android:icon="@drawable/table"
|
||||
android:taskAffinity="@string/code_table"
|
||||
android:documentLaunchMode="intoExisting"
|
||||
android:exported="false">
|
||||
</activity>
|
||||
android:exported="false"/>
|
||||
<activity
|
||||
android:name=".LoginActivity"
|
||||
android:exported="false"/>
|
||||
|
|
Binary file not shown.
|
@ -1,6 +1,5 @@
|
|||
package com.coldmint.rust.pro
|
||||
|
||||
import android.annotation.SuppressLint
|
||||
import android.graphics.Color
|
||||
import android.os.Bundle
|
||||
import android.text.Editable
|
||||
|
@ -11,17 +10,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>() {
|
||||
|
@ -30,51 +29,18 @@ 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()) {
|
||||
loadData()
|
||||
return
|
||||
}
|
||||
loadData(a.toString())*/
|
||||
if (a.isNullOrEmpty()) {
|
||||
viewBinding.searchPick.isVisible = false
|
||||
loadData()
|
||||
return
|
||||
}
|
||||
loadData(a.toString())
|
||||
}
|
||||
|
||||
override fun afterTextChanged(a: Editable?) {
|
||||
}
|
||||
})
|
||||
|
@ -82,20 +48,12 @@ class CodeTableActivity : BaseActivity<ActivityCodeTableBinding>() {
|
|||
if (p1 == EditorInfo.IME_ACTION_SEARCH) {
|
||||
if (v?.text.isNullOrEmpty()) {
|
||||
loadData()
|
||||
} else {
|
||||
var toString = v?.text.toString()
|
||||
if (toString.startsWith("/")) {
|
||||
toString = toString.substring(1)
|
||||
loadData(toString)
|
||||
} else {
|
||||
viewBinding.searchPick.isVisible = true
|
||||
adapter.item?.search(toString)
|
||||
}
|
||||
}
|
||||
}else
|
||||
loadData(v?.text.toString())
|
||||
}
|
||||
false
|
||||
}
|
||||
viewBinding.back.setOnClickListener { moveTaskToBack(true) }
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -111,13 +69,20 @@ 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>()
|
||||
|
@ -156,7 +121,7 @@ class CodeTableActivity : BaseActivity<ActivityCodeTableBinding>() {
|
|||
codeDataBase.getCodeDao().findCodeBySection(section.code)
|
||||
} else {
|
||||
codeDataBase.getCodeDao()
|
||||
.findCodeByCodeOrTranslateFromSection(key, section.code)
|
||||
.findCodeByCodeOrTranslateFromSection(key, section.code)
|
||||
}
|
||||
if (list.isNullOrEmpty()) {
|
||||
group.remove(section)
|
||||
|
@ -166,33 +131,22 @@ class CodeTableActivity : BaseActivity<ActivityCodeTableBinding>() {
|
|||
}
|
||||
|
||||
if (group.isNotEmpty()) {
|
||||
adapter = CodeTableAdapter(this, group, item, viewBinding)
|
||||
val adapter = CodeTableAdapter(this, group, item)
|
||||
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 {
|
||||
viewBinding.codeRecyclerB.adapter = adapter.item
|
||||
/* adapter.labelFunction = { _, _, string ->
|
||||
// section = string
|
||||
if (string.isEmpty()) {
|
||||
loadData()
|
||||
}
|
||||
loadData(string)
|
||||
}*/
|
||||
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.layoutManager = LinearLayoutManager(this)
|
||||
viewBinding.expandableListView.adapter = adapter
|
||||
// viewBinding.expandableListView.swapAdapter(adapter, true)
|
||||
viewBinding.expandableListView.setAdapter(adapter)
|
||||
}
|
||||
} else {
|
||||
notFindKey(key)
|
||||
|
@ -200,13 +154,10 @@ 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)
|
||||
|
@ -215,11 +166,12 @@ class CodeTableActivity : BaseActivity<ActivityCodeTableBinding>() {
|
|||
val spannableString = SpannableString(tip)
|
||||
if (start > -1) {
|
||||
spannableString.setSpan(
|
||||
object : ClickableSpan() {
|
||||
override fun onClick(p0: View) {
|
||||
loadData()
|
||||
}
|
||||
}, start, start + action.length, Spannable.SPAN_EXCLUSIVE_EXCLUSIVE
|
||||
object : ClickableSpan() {
|
||||
override fun onClick(p0: View) {
|
||||
editisVisible(false)
|
||||
loadData()
|
||||
}
|
||||
}, start, start + action.length, Spannable.SPAN_EXCLUSIVE_EXCLUSIVE
|
||||
)
|
||||
}
|
||||
viewBinding.displayView.movementMethod = LinkMovementMethod.getInstance()
|
||||
|
@ -231,19 +183,69 @@ 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
|
||||
}
|
||||
|
||||
@Deprecated("Deprecated in Java", ReplaceWith("moveTaskToBack(true)"))
|
||||
override fun onBackPressed() {
|
||||
//显示桌面
|
||||
moveTaskToBack(true)
|
||||
// ifNeedFinish()
|
||||
|
||||
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")
|
||||
override fun onBackPressed() {
|
||||
if (viewBinding.edittext.isVisible) {
|
||||
editisVisible(false)
|
||||
return
|
||||
}
|
||||
ifNeedFinish()
|
||||
}
|
||||
override fun getViewBindingObject(layoutInflater: LayoutInflater): ActivityCodeTableBinding {
|
||||
return ActivityCodeTableBinding.inflate(layoutInflater)
|
||||
}
|
||||
|
|
|
@ -12,7 +12,6 @@ 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
|
||||
|
@ -33,22 +32,22 @@ class CreateModActivity : BaseActivity<ActivityCreateModBinding>() {
|
|||
val name = it.toString()
|
||||
if (name.isBlank()) {
|
||||
setErrorAndInput(
|
||||
viewBinding.modNameEdit,
|
||||
String.format(
|
||||
getString(R.string.please_input_value),
|
||||
viewBinding.modDescribeInputLayout.hint.toString()
|
||||
),
|
||||
viewBinding.modNameInputLayout, false
|
||||
viewBinding.modNameEdit,
|
||||
String.format(
|
||||
getString(R.string.please_input_value),
|
||||
viewBinding.modDescribeInputLayout.hint.toString()
|
||||
),
|
||||
viewBinding.modNameInputLayout, false
|
||||
)
|
||||
return@addTextChangedListener
|
||||
}
|
||||
val mod_directory =
|
||||
File(Environment.getExternalStorageDirectory().absolutePath + "/rustedWarfare/units/" + name)
|
||||
File(Environment.getExternalStorageDirectory().absolutePath + "/rustedWarfare/units/" + name)
|
||||
if (mod_directory.exists()) {
|
||||
setErrorAndInput(
|
||||
viewBinding.modNameEdit,
|
||||
getString(R.string.directory_error),
|
||||
viewBinding.modNameInputLayout, false
|
||||
viewBinding.modNameEdit,
|
||||
getString(R.string.directory_error),
|
||||
viewBinding.modNameInputLayout, false
|
||||
)
|
||||
} else {
|
||||
viewBinding.modNameInputLayout.isErrorEnabled = false
|
||||
|
@ -68,9 +67,9 @@ class CreateModActivity : BaseActivity<ActivityCreateModBinding>() {
|
|||
override fun afterTextChanged(s: Editable) {
|
||||
if (s.toString().contains("\n")) {
|
||||
setErrorAndInput(
|
||||
viewBinding.modDescribeEdit,
|
||||
getString(R.string.describe_error2),
|
||||
viewBinding.modDescribeInputLayout
|
||||
viewBinding.modDescribeEdit,
|
||||
getString(R.string.describe_error2),
|
||||
viewBinding.modDescribeInputLayout
|
||||
)
|
||||
}
|
||||
}
|
||||
|
@ -79,28 +78,28 @@ class CreateModActivity : BaseActivity<ActivityCreateModBinding>() {
|
|||
val name: String = viewBinding.modNameEdit.text.toString()
|
||||
if (name.isBlank()) {
|
||||
setErrorAndInput(
|
||||
viewBinding.modNameEdit,
|
||||
String.format(
|
||||
getString(R.string.please_input_value),
|
||||
viewBinding.modNameInputLayout.hint.toString()
|
||||
),
|
||||
viewBinding.modNameInputLayout
|
||||
viewBinding.modNameEdit,
|
||||
String.format(
|
||||
getString(R.string.please_input_value),
|
||||
viewBinding.modNameInputLayout.hint.toString()
|
||||
),
|
||||
viewBinding.modNameInputLayout
|
||||
)
|
||||
return@OnClickListener
|
||||
}
|
||||
val describe: String = viewBinding.modDescribeEdit.text.toString()
|
||||
if (describe.isEmpty()) {
|
||||
setErrorAndInput(
|
||||
viewBinding.modDescribeEdit,
|
||||
getString(R.string.describe_error),
|
||||
viewBinding.modDescribeInputLayout
|
||||
viewBinding.modDescribeEdit,
|
||||
getString(R.string.describe_error),
|
||||
viewBinding.modDescribeInputLayout
|
||||
)
|
||||
return@OnClickListener
|
||||
} else if (describe.contains("\n")) {
|
||||
setErrorAndInput(
|
||||
viewBinding.modDescribeEdit,
|
||||
getString(R.string.describe_error2),
|
||||
viewBinding.modDescribeInputLayout
|
||||
viewBinding.modDescribeEdit,
|
||||
getString(R.string.describe_error2),
|
||||
viewBinding.modDescribeInputLayout
|
||||
)
|
||||
return@OnClickListener
|
||||
}
|
||||
|
@ -109,34 +108,34 @@ 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()) {
|
||||
setErrorAndInput(
|
||||
viewBinding.modNameEdit,
|
||||
getString(R.string.directory_error),
|
||||
viewBinding.modNameInputLayout
|
||||
)
|
||||
} else {
|
||||
if (mod_directory.mkdirs()) {
|
||||
val mod_directory =
|
||||
File(Environment.getExternalStorageDirectory().absolutePath + "/rustedWarfare/units/" + name)
|
||||
if (mod_directory.exists()) {
|
||||
setErrorAndInput(
|
||||
viewBinding.modNameEdit,
|
||||
getString(R.string.directory_error),
|
||||
viewBinding.modNameInputLayout
|
||||
)
|
||||
} 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()
|
||||
}
|
||||
}
|
||||
|
||||
})
|
||||
}
|
||||
|
||||
|
|
|
@ -66,8 +66,10 @@ class EditActivity : BaseActivity<ActivityEditBinding>() {
|
|||
private lateinit var turretCoordinateResults: ActivityResultLauncher<Intent>
|
||||
private lateinit var rustLanguage: RustLanguage
|
||||
private var fileAdapter: FileAdapter? = null
|
||||
|
||||
//是第一次启动嘛
|
||||
private var isFirst = true
|
||||
|
||||
/**
|
||||
* 编辑器左侧视图
|
||||
*/
|
||||
|
|
|
@ -24,22 +24,22 @@ class GameCheckActivity : BaseActivity<ActivityGameCheckBinding>() {
|
|||
if (canUseView) {
|
||||
setReturnButton()
|
||||
setTitle(R.string.game_configured)
|
||||
viewBinding.startButton.setOnClickListener {
|
||||
viewBinding.startButton.setOnClickListener(View.OnClickListener {
|
||||
if (AppOperator.isAppInstalled(
|
||||
this@GameCheckActivity,
|
||||
GlobalMethod.DEFAULT_GAME_PACKAGE
|
||||
)
|
||||
this@GameCheckActivity,
|
||||
GlobalMethod.DEFAULT_GAME_PACKAGE
|
||||
)
|
||||
) {
|
||||
AppOperator.openApp(this@GameCheckActivity, GlobalMethod.DEFAULT_GAME_PACKAGE)
|
||||
} else {
|
||||
Snackbar.make(
|
||||
viewBinding.startButton,
|
||||
R.string.no_game_installed,
|
||||
Snackbar.LENGTH_SHORT
|
||||
viewBinding.startButton,
|
||||
R.string.no_game_installed,
|
||||
Snackbar.LENGTH_SHORT
|
||||
)
|
||||
.show()
|
||||
.show()
|
||||
}
|
||||
}
|
||||
})
|
||||
viewBinding.completionButton.setOnClickListener(View.OnClickListener {
|
||||
AppSettings.setValue(AppSettings.Setting.SetGameStorage, true)
|
||||
finish()
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
package com.coldmint.rust.pro
|
||||
|
||||
|
||||
import android.content.Intent
|
||||
import android.content.pm.PackageInfo
|
||||
import android.content.pm.PackageManager
|
||||
|
@ -26,6 +27,7 @@ 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
|
||||
|
@ -40,12 +42,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
|
||||
|
@ -61,8 +63,14 @@ class MainActivity : BaseActivity<ActivityMainBinding>() {
|
|||
|
||||
companion object {
|
||||
//仓库和社区碎片链接TabLayout间隔
|
||||
const val linkInterval: Long = 195
|
||||
const val hideViewDelay: Long = 150
|
||||
// private var time:Long=0;
|
||||
}
|
||||
|
||||
/**
|
||||
* 将Toolbar设置为ActionBar
|
||||
*/
|
||||
private fun useToolbarSetSupportActionBar() {
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -252,7 +260,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 {
|
||||
|
@ -272,93 +280,69 @@ class MainActivity : BaseActivity<ActivityMainBinding>() {
|
|||
template.isVisible = isActive
|
||||
// help.isVisible = isActive
|
||||
codeTable.isVisible = isActive
|
||||
if (mod.isChecked) {
|
||||
// viewBinding.mainButton.isVisible = isActive
|
||||
}
|
||||
if (isActive) {
|
||||
//数据库
|
||||
/* dataBase.setOnMenuItemClickListener {
|
||||
viewBinding.mainButton.postOnAnimationDelayed({
|
||||
// viewBinding.tabLayout.isVisible = false
|
||||
viewBinding.mainButton.hide()
|
||||
}, hideViewDelay)
|
||||
false
|
||||
}*/
|
||||
/* dataBase.setOnMenuItemClickListener {
|
||||
viewBinding.mainButton.postOnAnimationDelayed({
|
||||
// viewBinding.tabLayout.isVisible = false
|
||||
viewBinding.mainButton.hide()
|
||||
}, hideViewDelay)
|
||||
false
|
||||
}*/
|
||||
|
||||
/* template.setOnMenuItemClickListener {
|
||||
viewBinding.mainButton.postOnAnimationDelayed({
|
||||
// viewBinding.tabLayout.isVisible = true
|
||||
viewBinding.mainButton.show()
|
||||
}, hideViewDelay)
|
||||
false
|
||||
}*/
|
||||
/* template.setOnMenuItemClickListener {
|
||||
viewBinding.mainButton.postOnAnimationDelayed({
|
||||
// viewBinding.tabLayout.isVisible = true
|
||||
viewBinding.mainButton.show()
|
||||
}, hideViewDelay)
|
||||
false
|
||||
}*/
|
||||
|
||||
codeTable.setOnMenuItemClickListener {
|
||||
/* // 获取上下文,通常是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)
|
||||
startActivity(Intent(this@MainActivity, CodeTableActivity::class.java))
|
||||
false
|
||||
}
|
||||
/*重要部分
|
||||
viewBinding.mainButton.setOnClickListener {
|
||||
val item = viewBinding.navaiagtion.checkedItem.toString()
|
||||
val warehouseItem = getString(R.string.warehouse)
|
||||
//final String database_item = getString(R.string.menu_title3);
|
||||
val templateItem = getString(R.string.template_title)
|
||||
when (item) {
|
||||
warehouseItem -> {
|
||||
val intent = Intent(this, CreationWizardActivity::class.java)
|
||||
intent.putExtra("type", "mod")
|
||||
startActivity(intent)
|
||||
}
|
||||
/*重要部分
|
||||
viewBinding.mainButton.setOnClickListener {
|
||||
val item = viewBinding.navaiagtion.checkedItem.toString()
|
||||
val warehouseItem = getString(R.string.warehouse)
|
||||
//final String database_item = getString(R.string.menu_title3);
|
||||
val templateItem = getString(R.string.template_title)
|
||||
when (item) {
|
||||
warehouseItem -> {
|
||||
val intent = Intent(this, CreationWizardActivity::class.java)
|
||||
intent.putExtra("type", "mod")
|
||||
startActivity(intent)
|
||||
}
|
||||
|
||||
templateItem -> {
|
||||
val intent = Intent(this, CreationWizardActivity::class.java)
|
||||
intent.putExtra("type", "template")
|
||||
startActivity(intent)
|
||||
}
|
||||
templateItem -> {
|
||||
val intent = Intent(this, CreationWizardActivity::class.java)
|
||||
intent.putExtra("type", "template")
|
||||
startActivity(intent)
|
||||
}
|
||||
|
||||
else -> {
|
||||
}
|
||||
}
|
||||
}*/
|
||||
else -> {
|
||||
}
|
||||
}
|
||||
}*/
|
||||
}
|
||||
|
||||
/* mod.setOnMenuItemClickListener {
|
||||
GlobalMethod.requestStoragePermissions(this) {
|
||||
if (it) {
|
||||
viewBinding.mainButton.postOnAnimationDelayed({
|
||||
// viewBinding.tabLayout.isVisible = true
|
||||
if (isActive) {
|
||||
viewBinding.mainButton.show()
|
||||
}
|
||||
}, hideViewDelay)
|
||||
/* mod.setOnMenuItemClickListener {
|
||||
GlobalMethod.requestStoragePermissions(this) {
|
||||
if (it) {
|
||||
viewBinding.mainButton.postOnAnimationDelayed({
|
||||
// viewBinding.tabLayout.isVisible = true
|
||||
if (isActive) {
|
||||
viewBinding.mainButton.show()
|
||||
}
|
||||
}
|
||||
false
|
||||
}*/
|
||||
}, hideViewDelay)
|
||||
}
|
||||
}
|
||||
false
|
||||
}*/
|
||||
community.setOnMenuItemClickListener {
|
||||
false
|
||||
}
|
||||
|
@ -380,13 +364,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))
|
||||
|
@ -434,10 +418,7 @@ class MainActivity : BaseActivity<ActivityMainBinding>() {
|
|||
override fun onActivityResult(requestCode: Int, resultCode: Int, data: Intent?) {
|
||||
super.onActivityResult(requestCode, resultCode, data)
|
||||
if (resultCode == RESULT_OK) {
|
||||
if (data == null) {
|
||||
return
|
||||
}
|
||||
val from = File(data.getStringExtra("File").toString())
|
||||
val from = File(data!!.getStringExtra("File"))
|
||||
val type = FileOperator.getFileType(from)
|
||||
if (requestCode == 1) {
|
||||
if ("rwmod" == type || "zip" == type) {
|
||||
|
@ -446,13 +427,13 @@ class MainActivity : BaseActivity<ActivityMainBinding>() {
|
|||
if (FileOperator.copyFile(from, to)) {
|
||||
Snackbar.make(
|
||||
viewBinding.root,
|
||||
String.format(Locale.getDefault(),getString(R.string.import_complete), from.name),
|
||||
String.format(getString(R.string.import_complete), from.name),
|
||||
Snackbar.LENGTH_SHORT
|
||||
).show()
|
||||
} else {
|
||||
Snackbar.make(
|
||||
viewBinding.root,
|
||||
String.format(Locale.getDefault(),getString(R.string.import_failed), from.name),
|
||||
String.format(getString(R.string.import_failed), from.name),
|
||||
Snackbar.LENGTH_SHORT
|
||||
).show()
|
||||
}
|
||||
|
@ -491,8 +472,6 @@ 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()) {
|
||||
|
@ -528,7 +507,7 @@ class MainActivity : BaseActivity<ActivityMainBinding>() {
|
|||
handler.post {
|
||||
Snackbar.make(
|
||||
viewBinding.root,
|
||||
String.format(Locale.getDefault(),
|
||||
String.format(
|
||||
getString(R.string.app_version_error),
|
||||
formFile.name
|
||||
), Snackbar.LENGTH_LONG
|
||||
|
@ -539,7 +518,7 @@ class MainActivity : BaseActivity<ActivityMainBinding>() {
|
|||
if (newInfo.versionNum < oldInfo.versionNum) {
|
||||
handler.post {
|
||||
MaterialAlertDialogBuilder(this).setTitle(oldInfo.name).setMessage(
|
||||
String.format(Locale.getDefault(),
|
||||
String.format(
|
||||
getString(R.string.covers_the_import),
|
||||
newInfo.versionName, oldInfo.versionName
|
||||
)
|
||||
|
@ -575,7 +554,7 @@ class MainActivity : BaseActivity<ActivityMainBinding>() {
|
|||
handler.post {
|
||||
Snackbar.make(
|
||||
viewBinding.root,
|
||||
String.format(Locale.getDefault(),
|
||||
String.format(
|
||||
getString(R.string.app_version_error),
|
||||
formFile.name
|
||||
), Snackbar.LENGTH_LONG
|
||||
|
@ -603,7 +582,7 @@ class MainActivity : BaseActivity<ActivityMainBinding>() {
|
|||
handler.post {
|
||||
Snackbar.make(
|
||||
viewBinding.root,
|
||||
String.format(Locale.getDefault(),
|
||||
String.format(
|
||||
getString(R.string.import_complete),
|
||||
formFile.name
|
||||
), Snackbar.LENGTH_LONG
|
||||
|
@ -614,30 +593,25 @@ 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(Locale.getDefault(),
|
||||
String.format(
|
||||
getString(R.string.exit_tip),
|
||||
getString(R.string.app_name)
|
||||
)
|
||||
).setPositiveButton(R.string.dialog_ok) { _, _ ->
|
||||
finish()
|
||||
super.onBackPressed()
|
||||
}.setNegativeButton(R.string.dialog_cancel) { _, _ ->
|
||||
}.show()
|
||||
} else {
|
||||
finish()
|
||||
super.onBackPressed()
|
||||
}
|
||||
}
|
||||
/*
|
||||
|
@ -654,13 +628,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 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) {
|
||||
|
@ -765,20 +739,22 @@ class MainActivity : BaseActivity<ActivityMainBinding>() {
|
|||
initNav()
|
||||
observeStartViewModel()
|
||||
//偏移fab
|
||||
/* if (ImmersionBar.hasNavigationBar(this)) {
|
||||
val layoutParams =
|
||||
viewBinding.mainButton.layoutParams as CoordinatorLayout.LayoutParams
|
||||
layoutParams.setMargins(
|
||||
GlobalMethod.dp2px(16),
|
||||
GlobalMethod.dp2px(16),
|
||||
GlobalMethod.dp2px(16),
|
||||
ImmersionBar.getNavigationBarHeight(this) + GlobalMethod.dp2px(16)
|
||||
)
|
||||
DebugHelper.printLog("导航适配", "已调整fab按钮的位置。")
|
||||
}*/
|
||||
// checkAppUpdate() 禁用检查更新
|
||||
/* if (ImmersionBar.hasNavigationBar(this)) {
|
||||
val layoutParams =
|
||||
viewBinding.mainButton.layoutParams as CoordinatorLayout.LayoutParams
|
||||
layoutParams.setMargins(
|
||||
GlobalMethod.dp2px(16),
|
||||
GlobalMethod.dp2px(16),
|
||||
GlobalMethod.dp2px(16),
|
||||
ImmersionBar.getNavigationBarHeight(this) + GlobalMethod.dp2px(16)
|
||||
)
|
||||
DebugHelper.printLog("导航适配", "已调整fab按钮的位置。")
|
||||
}*/
|
||||
checkAppUpdate()
|
||||
} else {
|
||||
startViewModel.initAllData()
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
|
@ -9,6 +9,7 @@ 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
|
||||
|
@ -33,6 +34,7 @@ class RustApplication : Application() {
|
|||
|
||||
override fun onCreate() {
|
||||
super.onCreate()
|
||||
wj(this)
|
||||
|
||||
|
||||
instanceObject = this
|
||||
|
@ -74,9 +76,6 @@ class RustApplication : Application() {
|
|||
activity: Activity,
|
||||
savedInstanceState: Bundle?
|
||||
) {
|
||||
if (activity is CodeTableActivity){
|
||||
return
|
||||
}
|
||||
// android:screenOrientation="portrait"
|
||||
//全局强制横屏
|
||||
activity.requestedOrientation = ActivityInfo.SCREEN_ORIENTATION_PORTRAIT
|
||||
|
|
|
@ -30,7 +30,6 @@ 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) {
|
||||
|
@ -40,27 +39,32 @@ class SearchActivity : BaseActivity<ActivitySearchBinding>() {
|
|||
viewBinding.hotSearchView.layoutManager = StableLinearLayoutManager(this)
|
||||
loadSearchView()
|
||||
loadHotSearch()
|
||||
list = getSharedPreferences(sharedPreferencesKey, Context.MODE_PRIVATE)
|
||||
list = getSharedPreferences("lishi", Context.MODE_PRIVATE)
|
||||
.getStringSet("data", mutableSetOf())
|
||||
?.toMutableList() ?: mutableListOf()
|
||||
viewBinding.hotSearchView2.layoutManager = FlexboxLayoutManager(this)
|
||||
viewBinding.hotSearchView2.adapter = adapter
|
||||
viewBinding.deleat.setOnClickListener {
|
||||
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(sharedPreferencesKey,
|
||||
Context.MODE_PRIVATE).edit().putStringSet(
|
||||
"data", list.toSet()).apply()
|
||||
}
|
||||
dialog.setNegativeButton(R.string.dialog_cancel, null)
|
||||
dialog.show()
|
||||
MaterialAlertDialogBuilder(this@SearchActivity)
|
||||
.setTitle("清空所有历史记录")
|
||||
.setPositiveButton("确定") { _, _ ->
|
||||
while (list.isNotEmpty()) {
|
||||
val index = 0
|
||||
list.removeAt(index)
|
||||
adapter.notifyItemRemoved(index)
|
||||
}
|
||||
getSharedPreferences("lishi",
|
||||
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()
|
||||
}
|
||||
viewBinding.searchView.onActionViewExpanded()
|
||||
}
|
||||
|
@ -84,12 +88,9 @@ class SearchActivity : BaseActivity<ActivitySearchBinding>() {
|
|||
if (list.size > 10) {
|
||||
list.removeAt(list.lastIndex)
|
||||
}
|
||||
val editor = getSharedPreferences(sharedPreferencesKey, Context.MODE_PRIVATE).edit()
|
||||
val editor = getSharedPreferences("lishi", Context.MODE_PRIVATE).edit()
|
||||
editor.putStringSet("data", list.toSet())
|
||||
editor.apply()
|
||||
if (!viewBinding.searchView.isVisible) {
|
||||
viewBinding.searchLayout.isVisible = true
|
||||
}
|
||||
}
|
||||
|
||||
fun search(string: String) {
|
||||
|
@ -100,7 +101,6 @@ 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,10 +128,9 @@ class SearchActivity : BaseActivity<ActivitySearchBinding>() {
|
|||
false
|
||||
}
|
||||
}
|
||||
|
||||
override fun getItemCount(): Int {
|
||||
val empty = list.isEmpty()
|
||||
viewBinding.searchLayout.isVisible = !empty
|
||||
viewBinding.textview1Text1.isVisible =empty
|
||||
viewBinding.deleat.isVisible = !empty
|
||||
return list.size
|
||||
}
|
||||
|
|
|
@ -2,22 +2,19 @@ package com.coldmint.rust.pro
|
|||
|
||||
import android.annotation.SuppressLint
|
||||
import android.os.Bundle
|
||||
import android.view.KeyEvent
|
||||
import android.view.LayoutInflater
|
||||
import android.view.Menu
|
||||
import android.view.MenuItem
|
||||
import android.text.Editable
|
||||
import android.text.TextWatcher
|
||||
import android.view.*
|
||||
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
|
||||
|
||||
/**
|
||||
|
@ -27,30 +24,34 @@ class TurretDesignActivity : BaseActivity<ActivityTurretDesignBinding>() {
|
|||
|
||||
private lateinit var turretManager: TurretManager
|
||||
|
||||
@SuppressLint("RestrictedApi", "SetTextI18n")
|
||||
@SuppressLint("RestrictedApi")
|
||||
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
|
||||
}
|
||||
|
@ -58,64 +59,59 @@ class TurretDesignActivity : BaseActivity<ActivityTurretDesignBinding>() {
|
|||
viewBinding.turretSketchpadView.setImage(file.absolutePath)
|
||||
turretManager = sourceFile.getTurretManager()
|
||||
turretManager.installerAllTurret(
|
||||
viewBinding.frameLayout,
|
||||
viewBinding.turretSketchpadView
|
||||
viewBinding.frameLayout,
|
||||
viewBinding.turretSketchpadView
|
||||
)
|
||||
turretManager
|
||||
.setCoordinateChangeListener { gameCoordinateData, _ ->
|
||||
viewBinding.infoView.text =
|
||||
"x:${gameCoordinateData.x} y:${gameCoordinateData.y}"
|
||||
}
|
||||
.setCoordinateChangeListener { gameCoordinateData, turretData ->
|
||||
viewBinding.infoView.text =
|
||||
"x:${gameCoordinateData.x} y:${gameCoordinateData.y}"
|
||||
}
|
||||
//设置自动完成
|
||||
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
|
||||
}
|
||||
}
|
||||
viewBinding.autoCompleteText.addTextChangedListener(object : TextWatcher {
|
||||
override fun beforeTextChanged(
|
||||
s: CharSequence?,
|
||||
start: Int,
|
||||
count: Int,
|
||||
after: Int
|
||||
) {
|
||||
}
|
||||
|
||||
override fun onclickImage() {
|
||||
turretManager.turretList.forEach{
|
||||
val turretView = turretManager.getTurretView(it.name)
|
||||
turretView?.invalidate()
|
||||
}
|
||||
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
|
||||
turretManager.turretList.forEach {
|
||||
if (isFirst) {
|
||||
designAdapter.string = it
|
||||
turretManager.useTurret(it.name)
|
||||
viewBinding.infoView.text =
|
||||
"x:${it.gameCoordinateData.x} y:${it.gameCoordinateData.y}"
|
||||
viewBinding.autoCompleteText.setText(it.name)
|
||||
isFirst = false
|
||||
}
|
||||
nameList.add(it.name)
|
||||
}
|
||||
// viewBinding.autoCompleteText.setSimpleItems(nameList.toTypedArray())
|
||||
viewBinding.recyclerView.layoutManager = LinearLayoutManager(this, LinearLayoutManager.HORIZONTAL, false)
|
||||
viewBinding.recyclerView.isNestedScrollingEnabled = false
|
||||
designAdapter.list = turretManager.turretList
|
||||
viewBinding.autoCompleteText.setSimpleItems(nameList.toTypedArray())
|
||||
|
||||
viewBinding.recyclerView.adapter = designAdapter
|
||||
viewBinding.button.setOnClickListener {
|
||||
val data = turretManager.getTurretView(designAdapter.string.name)
|
||||
if (data != null) {
|
||||
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()
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
viewBinding.button.setOnClickListener {
|
||||
val data = turretManager.getTurretView(viewBinding.autoCompleteText.text.toString())
|
||||
if (data != null) {
|
||||
val editTurretInfoFragment = EditTurretInfoFragment(data)
|
||||
editTurretInfoFragment.show(supportFragmentManager, "Edit")
|
||||
} else {
|
||||
Toast.makeText(this, R.string.not_find_turret, Toast.LENGTH_SHORT).show()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -135,10 +131,10 @@ class TurretDesignActivity : BaseActivity<ActivityTurretDesignBinding>() {
|
|||
//如果不建议显示,且正在显示那么提示用户
|
||||
if (viewBinding.turretSketchpadView.drawCoordinate) {
|
||||
CoreDialog(this).setTitle(R.string.turret_design)
|
||||
.setMessage(R.string.automatically_disable_coordinate_system)
|
||||
.setPositiveButton(R.string.dialog_ok) {
|
||||
.setMessage(R.string.automatically_disable_coordinate_system)
|
||||
.setPositiveButton(R.string.dialog_ok) {
|
||||
|
||||
}.show()
|
||||
}.show()
|
||||
viewBinding.turretSketchpadView.drawCoordinate = false
|
||||
}
|
||||
item.isEnabled = false
|
||||
|
@ -159,7 +155,7 @@ class TurretDesignActivity : BaseActivity<ActivityTurretDesignBinding>() {
|
|||
/**
|
||||
* 保存数据
|
||||
*/
|
||||
private fun saveData() {
|
||||
fun saveData() {
|
||||
turretManager.saveChange()
|
||||
finish()
|
||||
}
|
||||
|
@ -168,16 +164,14 @@ class TurretDesignActivity : BaseActivity<ActivityTurretDesignBinding>() {
|
|||
when (item.itemId) {
|
||||
R.id.display_coordinate_system -> {
|
||||
viewBinding.turretSketchpadView.drawCoordinate =
|
||||
!viewBinding.turretSketchpadView.drawCoordinate
|
||||
!viewBinding.turretSketchpadView.drawCoordinate
|
||||
item.isChecked = viewBinding.turretSketchpadView.drawCoordinate
|
||||
}
|
||||
|
||||
R.id.show_guides -> {
|
||||
viewBinding.turretSketchpadView.drawAuxiliaryLine =
|
||||
!viewBinding.turretSketchpadView.drawAuxiliaryLine
|
||||
!viewBinding.turretSketchpadView.drawAuxiliaryLine
|
||||
item.isChecked = viewBinding.turretSketchpadView.drawAuxiliaryLine
|
||||
}
|
||||
|
||||
android.R.id.home -> {
|
||||
saveData()
|
||||
}
|
||||
|
|
|
@ -1,41 +1,56 @@
|
|||
package com.coldmint.rust.pro.adapters
|
||||
|
||||
import android.annotation.SuppressLint
|
||||
import android.content.Context
|
||||
import android.widget.BaseExpandableListAdapter
|
||||
import android.view.LayoutInflater
|
||||
import android.view.ViewGroup
|
||||
import androidx.recyclerview.widget.RecyclerView
|
||||
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 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.R
|
||||
import com.coldmint.rust.pro.databinding.ActivityCodeTableBinding
|
||||
import com.coldmint.rust.pro.databinding.ItemCodetableBinding
|
||||
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.tool.GlobalMethod
|
||||
import com.google.android.gms.common.internal.Objects
|
||||
import com.muqing.VH
|
||||
import com.google.android.material.chip.Chip
|
||||
import com.google.android.material.dialog.MaterialAlertDialogBuilder
|
||||
import java.util.concurrent.Executors
|
||||
|
||||
class CodeTableAdapter(
|
||||
val context: Context,
|
||||
private val group: List<SectionInfo>,
|
||||
private val itemList: List<List<CodeInfo>>,
|
||||
private val binding: ActivityCodeTableBinding
|
||||
) : RecyclerView.Adapter<VH<ItemCodetableBinding>>() {
|
||||
val context: Context,
|
||||
private val group: List<SectionInfo>,
|
||||
private val itemList: List<List<CodeInfo>>
|
||||
) : BaseExpandableListAdapter() {
|
||||
|
||||
private val layoutInflater = LayoutInflater.from(context)
|
||||
|
||||
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 {
|
||||
Executors.newSingleThreadExecutor()
|
||||
}*/
|
||||
private val executorService by lazy {
|
||||
Executors.newSingleThreadExecutor()
|
||||
}
|
||||
private val lineParser = LineParser()
|
||||
|
||||
//Label点击事件
|
||||
// var labelFunction: ((Int, View, String) -> Unit)? = null
|
||||
/* private val developerMode by lazy {
|
||||
AppSettings
|
||||
.getValue(AppSettings.Setting.DeveloperMode, false)
|
||||
}*/
|
||||
var labelFunction: ((Int, View, String) -> Unit)? = null
|
||||
private val developerMode by lazy {
|
||||
AppSettings
|
||||
.getValue(AppSettings.Setting.DeveloperMode, false)
|
||||
}
|
||||
|
||||
init {
|
||||
lineParser.symbol = ","
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 节名映射
|
||||
|
@ -45,6 +60,7 @@ class CodeTableAdapter(
|
|||
this.sectionMap = sectionMap
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 设置类型名称映射
|
||||
* @param typeNameMap HashMap<String, String>?
|
||||
|
@ -61,175 +77,174 @@ class CodeTableAdapter(
|
|||
this.versionMap = versionMap
|
||||
}
|
||||
|
||||
/* fun getChildView(
|
||||
groupPosition: Int,
|
||||
childPosition: Int,
|
||||
isLastChild: Boolean,
|
||||
convertView: View?,
|
||||
parent: ViewGroup
|
||||
): View {
|
||||
val resultView: CodeTableItemBinding =
|
||||
CodeTableItemBinding.inflate(layoutInflater, parent, false)
|
||||
val codeInfo = itemList[groupPosition][childPosition]
|
||||
override fun getGroupCount(): Int {
|
||||
return group.size
|
||||
}
|
||||
|
||||
// resultView.belongStackLabelView.onLabelClickListener = OnLabelClickListener { index, v, s ->
|
||||
// }
|
||||
resultView.descriptionView.text = codeInfo.description
|
||||
resultView.descriptionView.setOnClickListener {
|
||||
GlobalMethod.copyText(context, codeInfo.description, it)
|
||||
}
|
||||
resultView.titleView.text = codeInfo.translate
|
||||
resultView.titleView.setOnClickListener {
|
||||
GlobalMethod.copyText(context, codeInfo.translate, it)
|
||||
}
|
||||
override fun getChildrenCount(groupPosition: Int): Int {
|
||||
return itemList[groupPosition].size
|
||||
}
|
||||
|
||||
val demo = codeInfo.demo
|
||||
resultView.imageView.isVisible = demo.isNotBlank()
|
||||
resultView.imageView.setOnClickListener {
|
||||
val dialog = MaterialAlertDialogBuilder(context);
|
||||
dialog.setTitle(R.string.code_demo)
|
||||
dialog.setMessage(demo)
|
||||
dialog.setPositiveButton(R.string.dialog_ok){
|
||||
v,a->
|
||||
}
|
||||
dialog.show()
|
||||
}
|
||||
override fun getGroup(groupPosition: Int): Any {
|
||||
return group[groupPosition]
|
||||
}
|
||||
|
||||
resultView.subTitleView.text = codeInfo.code
|
||||
resultView.subTitleView.setOnClickListener {
|
||||
GlobalMethod.copyText(context, codeInfo.code, it)
|
||||
}
|
||||
resultView.valueTypeView.text = typeNameMap?.get(codeInfo.type) ?: codeInfo.type
|
||||
lineParser.text = codeInfo.section
|
||||
resultView.chipGroup.removeAllViews()
|
||||
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
|
||||
}
|
||||
override fun getChild(groupPosition: Int, childPosition: Int): Any {
|
||||
return itemList[groupPosition][childPosition]
|
||||
}
|
||||
|
||||
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) {
|
||||
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(
|
||||
groupPosition: Int,
|
||||
childPosition: Int,
|
||||
isLastChild: Boolean,
|
||||
convertView: View?,
|
||||
parent: ViewGroup
|
||||
): View {
|
||||
val resultView: CodeTableItemBinding =
|
||||
CodeTableItemBinding.inflate(layoutInflater, parent, false)
|
||||
val codeInfo = itemList[groupPosition][childPosition]
|
||||
|
||||
// resultView.belongStackLabelView.onLabelClickListener = OnLabelClickListener { index, v, s ->
|
||||
// }
|
||||
resultView.descriptionView.text = codeInfo.description
|
||||
resultView.descriptionView.setOnClickListener {
|
||||
GlobalMethod.copyText(context, codeInfo.description, it)
|
||||
}
|
||||
resultView.titleView.text = codeInfo.translate
|
||||
resultView.titleView.setOnClickListener {
|
||||
GlobalMethod.copyText(context, codeInfo.translate, it)
|
||||
}
|
||||
|
||||
val demo = codeInfo.demo
|
||||
resultView.imageView.isVisible = demo.isNotBlank()
|
||||
resultView.imageView.setOnClickListener {
|
||||
val dialog = MaterialAlertDialogBuilder(context);
|
||||
dialog.setTitle(R.string.code_demo)
|
||||
dialog.setMessage(demo)
|
||||
dialog.setPositiveButton(R.string.dialog_ok){
|
||||
v,a->
|
||||
}
|
||||
dialog.show()
|
||||
}
|
||||
|
||||
resultView.subTitleView.text = codeInfo.code
|
||||
resultView.subTitleView.setOnClickListener {
|
||||
GlobalMethod.copyText(context, codeInfo.code, it)
|
||||
}
|
||||
resultView.valueTypeView.text = typeNameMap?.get(codeInfo.type) ?: codeInfo.type
|
||||
lineParser.text = codeInfo.section
|
||||
resultView.chipGroup.removeAllViews()
|
||||
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 {
|
||||
handler.post {
|
||||
MaterialDialog(context).show {
|
||||
title(text = codeInfo.type).message(
|
||||
text = String.format(
|
||||
context.getString(
|
||||
R.string.unknown_type
|
||||
), codeInfo.type
|
||||
)
|
||||
MaterialDialog(context).show {
|
||||
title(text = codeInfo.type).message(
|
||||
text = String.format(
|
||||
context.getString(
|
||||
R.string.unknown_type
|
||||
), codeInfo.type
|
||||
)
|
||||
.positiveButton(R.string.dialog_ok)
|
||||
}
|
||||
)
|
||||
.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 (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)
|
||||
if (typeInfo.describe == "@search(code)") {
|
||||
handler.post {
|
||||
MaterialDialog(context).show {
|
||||
title(text = typeInfo.name + "(开发者模式)").message(text = stringBuilder.toString())
|
||||
title(text = typeInfo.name).message(text = codeInfo.description)
|
||||
.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)
|
||||
}
|
||||
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()
|
||||
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))
|
||||
}
|
||||
resultView.versionView.text =
|
||||
versionMap?.get(codeInfo.addVersion) ?: codeInfo.addVersion.toString()
|
||||
return resultView.root
|
||||
}
|
||||
|
||||
override fun isChildSelectable(groupPosition: Int, childPosition: Int): Boolean {
|
||||
return true
|
||||
}
|
||||
}
|
|
@ -1,225 +0,0 @@
|
|||
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()
|
||||
|
||||
|
||||
}
|
||||
}
|
|
@ -1,13 +1,9 @@
|
|||
package com.coldmint.rust.pro.adapters
|
||||
|
||||
import androidx.appcompat.app.AppCompatActivity
|
||||
import android.os.Parcelable
|
||||
import androidx.fragment.app.Fragment
|
||||
import androidx.viewpager2.adapter.FragmentStateAdapter
|
||||
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
|
||||
import com.coldmint.rust.pro.fragments.*
|
||||
|
||||
class CommunityAdapter(fragment: Fragment) : FragmentStateAdapter(fragment) {
|
||||
override fun getItemCount(): Int {
|
||||
|
|
|
@ -32,10 +32,8 @@ class CommunityServiceAdapter(
|
|||
viewHolder: BaseAdapter.ViewHolder<ItemServiceBinding>,
|
||||
position: Int
|
||||
) {
|
||||
viewBinding.iconView.setImageResource(data.iconRes)
|
||||
//
|
||||
// Glide.with(context).load(data.iconRes).apply(GlobalMethod.getRequestOptions())
|
||||
// .into(viewBinding.iconView)
|
||||
Glide.with(context).load(data.iconRes).apply(GlobalMethod.getRequestOptions())
|
||||
.into(viewBinding.iconView)
|
||||
viewBinding.titleView.setText(data.titleRes)
|
||||
// holder.itemView.setOnClickListener {
|
||||
// val listener = itemListener
|
||||
|
|
|
@ -1,70 +0,0 @@
|
|||
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()
|
||||
}
|
||||
|
||||
}
|
|
@ -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))
|
||||
Glide.with(context).load(ServerConfiguration.getRealLink(headIcon)).apply(GlobalMethod.getRequestOptions(true))
|
||||
.into(viewBinding.headIconView)
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,6 +1,5 @@
|
|||
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.*
|
||||
|
|
|
@ -56,6 +56,7 @@ abstract class BaseActivity<ViewBingType : ViewBinding> :
|
|||
finish()
|
||||
}
|
||||
dialog.show()
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -7,6 +7,7 @@ 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
|
||||
|
@ -54,11 +55,7 @@ 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()
|
||||
}
|
||||
firebaseAnalytics = Firebase.analytics
|
||||
whenViewCreated(layoutInflater, savedInstanceState)
|
||||
}
|
||||
}
|
|
@ -1,9 +0,0 @@
|
|||
package com.coldmint.rust.pro.databean
|
||||
data class LocaTion(var i: Int, var p: Int,
|
||||
var text: List<String>){
|
||||
lateinit var listInt : List<Int>
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
|
@ -4,13 +4,20 @@ 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
|
||||
|
||||
|
||||
|
@ -61,7 +68,7 @@ class CommentDialog(context: Context) : BaseAppDialog<CommentDialog>(context) {
|
|||
//已闭合{}。
|
||||
}else{
|
||||
//正在输入内容
|
||||
adapter.add("$text}")
|
||||
adapter.add(text + '}')
|
||||
}
|
||||
} else {
|
||||
//没有指定{开始位置
|
||||
|
|
|
@ -1,29 +0,0 @@
|
|||
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
|
||||
}
|
||||
}
|
|
@ -58,8 +58,7 @@ class RustLanguage() : Language, EnglishMode {
|
|||
arrayOf(object : NewlineHandler {
|
||||
override fun matchesRequirement(text: Content, position: CharPosition, style: Styles?): Boolean {
|
||||
// 判断是否需要进行换行操作
|
||||
return false
|
||||
|
||||
return true
|
||||
}
|
||||
|
||||
override fun handleNewline(text: Content, position: CharPosition, style: Styles?, tabSize: Int): NewlineHandleResult {
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
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
|
||||
|
|
|
@ -2,7 +2,6 @@ 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
|
||||
|
@ -14,6 +13,26 @@ 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)
|
||||
}*/
|
||||
|
@ -27,43 +46,6 @@ 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()
|
||||
}
|
||||
}
|
|
@ -7,24 +7,27 @@ 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(private val turretView: TurretView, private val buttonclick: ButtonClick) : BottomSheetDialogFragment() {
|
||||
class EditTurretInfoFragment(val turretView: TurretView) : BottomSheetDialogFragment() {
|
||||
private lateinit var fragmentEditTurretInfoBinding: FragmentEditTurretInfoBinding
|
||||
override fun onCreateView(
|
||||
inflater: LayoutInflater,
|
||||
container: ViewGroup?,
|
||||
savedInstanceState: Bundle?
|
||||
): View {
|
||||
inflater: LayoutInflater,
|
||||
container: ViewGroup?,
|
||||
savedInstanceState: Bundle?
|
||||
): View? {
|
||||
fragmentEditTurretInfoBinding =
|
||||
FragmentEditTurretInfoBinding.inflate(layoutInflater, container, false)
|
||||
FragmentEditTurretInfoBinding.inflate(layoutInflater, container, false)
|
||||
return fragmentEditTurretInfoBinding.root
|
||||
}
|
||||
|
||||
|
@ -50,7 +53,7 @@ class EditTurretInfoFragment(private val turretView: TurretView, private val but
|
|||
val text = s.toString()
|
||||
if (text.isBlank()) {
|
||||
fragmentEditTurretInfoBinding.xInputEditLayout.error =
|
||||
getString(R.string.please_enter_the_x_coordinate)
|
||||
getString(R.string.please_enter_the_x_coordinate)
|
||||
} else {
|
||||
fragmentEditTurretInfoBinding.xInputEditLayout.isErrorEnabled = false
|
||||
}
|
||||
|
@ -70,7 +73,7 @@ class EditTurretInfoFragment(private val turretView: TurretView, private val but
|
|||
val text = s.toString()
|
||||
if (text.isBlank()) {
|
||||
fragmentEditTurretInfoBinding.yInputEditLayout.error =
|
||||
getString(R.string.please_enter_the_y_coordinate)
|
||||
getString(R.string.please_enter_the_y_coordinate)
|
||||
} else {
|
||||
fragmentEditTurretInfoBinding.yInputEditLayout.isErrorEnabled = false
|
||||
}
|
||||
|
@ -81,12 +84,8 @@ class EditTurretInfoFragment(private val turretView: TurretView, private val but
|
|||
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)
|
||||
}
|
||||
}
|
|
@ -3,6 +3,8 @@ 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
|
||||
|
@ -222,9 +224,9 @@ class FollowFragment : BaseFragment<FragmentFollowBinding>() {
|
|||
override fun whenViewCreated(inflater: LayoutInflater, savedInstanceState: Bundle?) {
|
||||
viewBinding.rootLayout.layoutTransition.setAnimateParentHierarchy(false)
|
||||
viewBinding.linearLayout2.layoutTransition.setAnimateParentHierarchy(false)
|
||||
val linearLayoutManager = LinearLayoutManager(requireContext(), RecyclerView.HORIZONTAL, false)
|
||||
val linearLayoutManager = StableLinearLayoutManager(requireContext())
|
||||
linearLayoutManager.orientation = RecyclerView.HORIZONTAL
|
||||
viewBinding.headRecyclerView.layoutManager = linearLayoutManager
|
||||
viewBinding.headRecyclerView.isNestedScrollingEnabled = false
|
||||
val linearLayoutManager2 = StableLinearLayoutManager(requireContext())
|
||||
viewBinding.recyclerView.layoutManager = linearLayoutManager2
|
||||
loadViewIfNeed()
|
||||
|
|
|
@ -1,9 +1,14 @@
|
|||
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
|
||||
|
@ -15,14 +20,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>() {
|
||||
private var webModAdapter: WebModAdapter? = null
|
||||
var webModAdapter: WebModAdapter? = null
|
||||
var lastOffset = 0
|
||||
var lastPosition = 0
|
||||
var linearLayoutManager: StableLinearLayoutManager? = null
|
||||
|
@ -31,10 +36,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)
|
||||
val layoutManager = viewBinding.recyclerView.layoutManager
|
||||
var layoutManager = viewBinding.recyclerView.layoutManager
|
||||
if (layoutManager != null) {
|
||||
//获取第一个可视视图
|
||||
val topView = layoutManager.getChildAt(0)
|
||||
|
@ -44,37 +49,30 @@ class RankingFragment : BaseFragment<FragmentRankingBinding>() {
|
|||
}
|
||||
}
|
||||
}
|
||||
})*/
|
||||
viewBinding.refreshLayout.setOnRefreshListener {
|
||||
it.finishRefresh(true)//传入false表示刷新失败
|
||||
loadMods()
|
||||
}
|
||||
viewBinding.refreshLayout.setOnLoadMoreListener {
|
||||
it.finishLoadMore(false) //传入false表示加载失败
|
||||
}
|
||||
/* viewBinding.swipeRefreshLayout.setOnRefreshListener {
|
||||
})
|
||||
viewBinding.swipeRefreshLayout.setOnRefreshListener {
|
||||
loadMods()
|
||||
viewBinding.swipeRefreshLayout.isRefreshing = false
|
||||
}*/
|
||||
viewBinding.downloadChip.setOnCheckedChangeListener { _, isChecked ->
|
||||
}
|
||||
viewBinding.downloadChip.setOnCheckedChangeListener { buttonView, isChecked ->
|
||||
if (isChecked) {
|
||||
sortMode = WebMod.SortMode.Download_Number
|
||||
loadMods()
|
||||
}
|
||||
}
|
||||
viewBinding.unitChip.setOnCheckedChangeListener { _, isChecked ->
|
||||
viewBinding.unitChip.setOnCheckedChangeListener { buttonView, isChecked ->
|
||||
if (isChecked) {
|
||||
sortMode = WebMod.SortMode.Unit_Number
|
||||
loadMods()
|
||||
}
|
||||
}
|
||||
viewBinding.coinChip.setOnCheckedChangeListener { _, isChecked ->
|
||||
viewBinding.coinChip.setOnCheckedChangeListener { buttonView, isChecked ->
|
||||
if (isChecked) {
|
||||
sortMode = WebMod.SortMode.Coin_Number
|
||||
loadMods()
|
||||
}
|
||||
}
|
||||
viewBinding.updateChip.setOnCheckedChangeListener { _, isChecked ->
|
||||
viewBinding.updateChip.setOnCheckedChangeListener { buttonView, isChecked ->
|
||||
if (isChecked) {
|
||||
sortMode = WebMod.SortMode.Update_Number
|
||||
loadMods()
|
||||
|
@ -84,10 +82,10 @@ class RankingFragment : BaseFragment<FragmentRankingBinding>() {
|
|||
}
|
||||
|
||||
|
||||
private fun loadMods() {
|
||||
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) {
|
||||
|
@ -95,18 +93,18 @@ class RankingFragment : BaseFragment<FragmentRankingBinding>() {
|
|||
}
|
||||
if (t.code == ServerConfiguration.Success_Code) {
|
||||
val list = t.data
|
||||
if (!list.isNullOrEmpty()) {
|
||||
if (list != null && list.isNotEmpty()) {
|
||||
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
|
||||
lastPosition,
|
||||
lastOffset
|
||||
)
|
||||
/* FastScrollerBuilder(viewBinding.recyclerView).useMd2Style()
|
||||
.setPopupTextProvider(adapter).build()*/
|
||||
FastScrollerBuilder(viewBinding.recyclerView).useMd2Style()
|
||||
.setPopupTextProvider(adapter).build()
|
||||
} else {
|
||||
showInfoToView(R.string.network_error)
|
||||
}
|
||||
|
@ -119,7 +117,7 @@ class RankingFragment : BaseFragment<FragmentRankingBinding>() {
|
|||
showInfoToView(R.string.network_error)
|
||||
}
|
||||
|
||||
}, sortMode = sortMode, limit = "10", sum = "0")
|
||||
}, sortMode = sortMode, limit = "100")
|
||||
}
|
||||
|
||||
|
||||
|
@ -136,7 +134,7 @@ class RankingFragment : BaseFragment<FragmentRankingBinding>() {
|
|||
webModAdapter!!.setNewDataList(dataList)
|
||||
webModAdapter!!
|
||||
}
|
||||
adapter.setItemEvent { _, webModItemBinding, _, data ->
|
||||
adapter.setItemEvent { i, webModItemBinding, viewHolder, data ->
|
||||
webModItemBinding.root.setOnClickListener {
|
||||
val bundle = Bundle()
|
||||
bundle.putString("modId", data.id)
|
||||
|
@ -156,10 +154,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.text = textRes
|
||||
viewBinding.textview.setText(textRes)
|
||||
} else {
|
||||
viewBinding.textview.text = text ?: ""
|
||||
}
|
||||
|
|
|
@ -32,7 +32,6 @@ 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))
|
||||
|
@ -114,7 +113,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(
|
||||
|
@ -165,7 +164,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
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -12,6 +12,8 @@ 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
|
||||
|
||||
|
||||
/**
|
||||
|
@ -19,8 +21,22 @@ import com.permissionx.guolindev.PermissionX
|
|||
* @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)
|
||||
|
@ -29,11 +45,13 @@ 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 -> {
|
||||
|
|
|
@ -60,7 +60,6 @@ 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()
|
||||
}
|
||||
|
@ -91,7 +90,7 @@ class WebModDetailsFragment(val modId: String, val modNameLiveData: MutableLiveD
|
|||
viewBinding.userInfoView.text = info
|
||||
viewBinding.cardView.postDelayed({
|
||||
viewBinding.cardView.isVisible = true
|
||||
viewBinding.cardView.setOnClickListener {
|
||||
viewBinding.openUserSpace.setOnClickListener {
|
||||
gotoUserPage(t.data.account)
|
||||
}
|
||||
}, 300)
|
||||
|
|
|
@ -37,7 +37,7 @@ class EditViewModel(application: Application) : BaseAndroidViewModel(application
|
|||
*/
|
||||
var targetFile: File? = null
|
||||
|
||||
private val codeTranslate by lazy {
|
||||
val codeTranslate by lazy {
|
||||
val c = CodeTranslate(getApplication())
|
||||
c.setCompileErrorRecordFun {
|
||||
//将信息上传至FireBase
|
||||
|
@ -70,7 +70,6 @@ class EditViewModel(application: Application) : BaseAndroidViewModel(application
|
|||
/**
|
||||
* 获取当前使用的apk包存放目录
|
||||
*/
|
||||
@Suppress("unused")
|
||||
val apkFolder by lazy {
|
||||
GameSynchronizer.getPackAgeFolder(
|
||||
getApplication(), AppSettings.getValue(
|
||||
|
@ -98,13 +97,12 @@ 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 ?: ""
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
@ -405,7 +403,7 @@ class EditViewModel(application: Application) : BaseAndroidViewModel(application
|
|||
Locale.getDefault().language
|
||||
)
|
||||
) + " (" + file.file.name + ")"
|
||||
val formatter = SimpleDateFormat("yyyy-MM-dd HH:mm:ss", Locale.getDefault())
|
||||
val formatter = SimpleDateFormat("yyyy-MM-dd HH:mm:ss")
|
||||
val historyDao = fileDataBase.getHistoryDao()
|
||||
val newHistoryRecord = HistoryRecord(
|
||||
path,
|
||||
|
|
|
@ -1,12 +0,0 @@
|
|||
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;
|
||||
}
|
||||
}
|
|
@ -20,7 +20,7 @@ import java.util.Collections;
|
|||
/** @noinspection unused*/
|
||||
public class gj {
|
||||
|
||||
public final static String log_TAB = "输出";
|
||||
public static String log_TAB = "打印";
|
||||
|
||||
public static void ts(Context a, Object b) {
|
||||
Toast.makeText(a, b.toString(), Toast.LENGTH_SHORT).show();
|
||||
|
|
142
app/src/main/java/com/muqing/wj.java
Normal file
142
app/src/main/java/com/muqing/wj.java
Normal file
|
@ -0,0 +1,142 @@
|
|||
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();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
|
@ -4,3 +4,4 @@
|
|||
android:propertyName="rotation"
|
||||
android:valueFrom="180"
|
||||
android:valueTo="360" />
|
||||
|
||||
|
|
|
@ -1,10 +1,7 @@
|
|||
<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>
|
||||
<?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>
|
|
@ -1,10 +1,7 @@
|
|||
<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>
|
||||
<?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>
|
|
@ -1,5 +0,0 @@
|
|||
<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>
|
|
@ -1,10 +0,0 @@
|
|||
<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>
|
|
@ -1,10 +0,0 @@
|
|||
<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>
|
|
@ -1,10 +0,0 @@
|
|||
<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>
|
|
@ -1,11 +0,0 @@
|
|||
<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>
|
|
@ -1,10 +0,0 @@
|
|||
<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>
|
|
@ -1,10 +0,0 @@
|
|||
<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>
|
|
@ -1,10 +0,0 @@
|
|||
<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>
|
81
app/src/main/res/layout-sw600dp/activity_main.xml
Normal file
81
app/src/main/res/layout-sw600dp/activity_main.xml
Normal file
|
@ -0,0 +1,81 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<androidx.drawerlayout.widget.DrawerLayout 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:id="@+id/drawerlayout"
|
||||
android:layout_width="match_parent"
|
||||
android:fitsSystemWindows="false"
|
||||
android:layout_height="match_parent">
|
||||
|
||||
<androidx.coordinatorlayout.widget.CoordinatorLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:fitsSystemWindows="true">
|
||||
|
||||
<com.google.android.material.appbar.AppBarLayout
|
||||
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" />
|
||||
|
||||
<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:visibility="gone">
|
||||
|
||||
<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>
|
||||
|
||||
|
||||
<fragment
|
||||
android:id="@+id/baseFragment"
|
||||
android:name="androidx.navigation.fragment.NavHostFragment"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
app:defaultNavHost="true"
|
||||
app:layout_behavior="com.google.android.material.appbar.AppBarLayout$ScrollingViewBehavior" />
|
||||
|
||||
|
||||
<com.google.android.material.floatingactionbutton.FloatingActionButton
|
||||
android:id="@+id/mainButton"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="bottom|end"
|
||||
android:layout_margin="16dp"
|
||||
android:layout_marginEnd="24dp"
|
||||
android:layout_marginBottom="24dp"
|
||||
android:fitsSystemWindows="true"
|
||||
android:src="@drawable/add" />
|
||||
|
||||
|
||||
</androidx.coordinatorlayout.widget.CoordinatorLayout>
|
||||
|
||||
<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"
|
||||
app:elevation="2dp"
|
||||
app:menu="@menu/menu_drawer_left"
|
||||
tools:ignore="VisualLintBounds" />
|
||||
|
||||
|
||||
</androidx.drawerlayout.widget.DrawerLayout>
|
|
@ -11,89 +11,30 @@
|
|||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:fitsSystemWindows="true">
|
||||
|
||||
<com.google.android.material.card.MaterialCardView
|
||||
android:id="@+id/materialCardView"
|
||||
style="@style/Widget.Material3.CardView.Elevated"
|
||||
<com.google.android.material.appbar.MaterialToolbar
|
||||
android:id="@+id/toolbar"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_margin="12dp">
|
||||
|
||||
<LinearLayout
|
||||
android:layout_height="?attr/actionBarSize">
|
||||
<EditText
|
||||
android:id="@+id/edittext"
|
||||
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>
|
||||
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>
|
||||
|
||||
<androidx.constraintlayout.widget.ConstraintLayout
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_marginHorizontal="6dp"
|
||||
android:layout_marginTop="3dp"
|
||||
android:layout_marginLeft="16dp"
|
||||
android:layout_marginTop="8dp"
|
||||
android:layout_marginRight="16dp"
|
||||
android:animateLayoutChanges="true"
|
||||
android:gravity="center"
|
||||
app:layout_behavior="com.google.android.material.appbar.AppBarLayout$ScrollingViewBehavior">
|
||||
|
||||
|
@ -101,52 +42,20 @@
|
|||
<ProgressBar
|
||||
android:id="@+id/progressBar"
|
||||
android:layout_width="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" />
|
||||
android:layout_height="wrap_content" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/displayView"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="@string/unable_open_database"
|
||||
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" />
|
||||
android:visibility="gone" />
|
||||
|
||||
<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="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>
|
||||
<ExpandableListView
|
||||
android:id="@+id/expandableListView"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="top"
|
||||
android:visibility="gone" />
|
||||
</LinearLayout>
|
||||
</androidx.coordinatorlayout.widget.CoordinatorLayout>
|
|
@ -6,39 +6,44 @@
|
|||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:fitsSystemWindows="true"
|
||||
tools:context=".GameCheckActivity">
|
||||
tools:context=".ActivateActivity">
|
||||
|
||||
<com.google.android.material.appbar.AppBarLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content">
|
||||
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" />
|
||||
|
||||
</com.google.android.material.appbar.AppBarLayout>
|
||||
|
||||
<androidx.core.widget.NestedScrollView
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:fillViewport="true"
|
||||
app:layout_behavior="com.google.android.material.appbar.AppBarLayout$ScrollingViewBehavior">
|
||||
android:layout_height="match_parent">
|
||||
|
||||
<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"
|
||||
|
@ -47,6 +52,7 @@
|
|||
android:layout_marginEnd="2dp"
|
||||
android:layout_weight="1"
|
||||
android:text="@string/start_game" />
|
||||
|
||||
<Button
|
||||
android:id="@+id/completionButton"
|
||||
android:layout_width="match_parent"
|
||||
|
@ -54,7 +60,11 @@
|
|||
android:layout_marginStart="2dp"
|
||||
android:layout_weight="1"
|
||||
android:text="@string/complete_settings" />
|
||||
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
|
||||
</LinearLayout>
|
||||
</androidx.core.widget.NestedScrollView>
|
||||
|
||||
|
|
|
@ -1,7 +1,6 @@
|
|||
<?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"
|
||||
|
@ -78,8 +77,8 @@
|
|||
android:text="@string/agreement_agreed" />
|
||||
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
<RelativeLayout
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_below="@id/checkbox"
|
||||
android:layout_marginTop="8dp">
|
||||
|
@ -94,20 +93,20 @@
|
|||
<Button
|
||||
android:id="@+id/changeServerView"
|
||||
style="@style/Widget.Material3.Button.TextButton"
|
||||
android:layout_width="0dp"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_weight="1"
|
||||
android:layout_marginHorizontal="6dp"
|
||||
android:layout_marginStart="8dp"
|
||||
android:layout_toEndOf="@id/changePasswordView"
|
||||
android:text="@string/changing_the_server"
|
||||
android:visibility="gone"
|
||||
tools:visibility="visible" />
|
||||
android:visibility="gone" />
|
||||
|
||||
<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" />
|
||||
</LinearLayout>
|
||||
</RelativeLayout>
|
||||
|
||||
</RelativeLayout>
|
|
@ -4,8 +4,8 @@
|
|||
xmlns:tools="http://schemas.android.com/tools"
|
||||
android:id="@+id/drawerlayout"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:fitsSystemWindows="false">
|
||||
android:fitsSystemWindows="false"
|
||||
android:layout_height="match_parent">
|
||||
|
||||
<androidx.coordinatorlayout.widget.CoordinatorLayout
|
||||
android:layout_width="match_parent"
|
||||
|
@ -32,6 +32,7 @@
|
|||
|
||||
<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"
|
||||
|
|
|
@ -40,21 +40,19 @@
|
|||
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"
|
||||
android:layout_marginBottom="9dp">
|
||||
card_view:ignore="UseCompoundDrawables">
|
||||
|
||||
<TextView
|
||||
android:id="@+id/textview1"
|
||||
|
@ -62,7 +60,7 @@
|
|||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_weight="1"
|
||||
android:text="@string/search_history"
|
||||
android:text="历史记录"
|
||||
card_view:ignore="HardcodedText" />
|
||||
|
||||
<ImageView
|
||||
|
@ -70,10 +68,19 @@
|
|||
android:layout_width="36dp"
|
||||
android:layout_height="36dp"
|
||||
android:layout_marginEnd="6dp"
|
||||
android:src="@drawable/baseline_delete_24"
|
||||
android:src="@drawable/auto_delete"
|
||||
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"
|
||||
|
@ -102,8 +109,8 @@
|
|||
android:id="@+id/recyclerView"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:background="?android:colorBackground"
|
||||
android:paddingHorizontal="6dp"
|
||||
android:background="?android:colorBackground"
|
||||
android:paddingTop="6dp"
|
||||
android:visibility="gone"
|
||||
app:layout_behavior="com.google.android.material.appbar.AppBarLayout$ScrollingViewBehavior" />
|
||||
|
|
|
@ -5,7 +5,7 @@
|
|||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:fitsSystemWindows="true"
|
||||
tools:context=".">
|
||||
tools:context=".MainActivity">
|
||||
|
||||
<com.google.android.material.appbar.AppBarLayout
|
||||
android:layout_width="match_parent"
|
||||
|
|
|
@ -6,7 +6,7 @@
|
|||
android:layout_height="match_parent"
|
||||
android:animateLayoutChanges="true"
|
||||
android:fitsSystemWindows="true"
|
||||
tools:context=".TurretDesignActivity">
|
||||
tools:context=".MainActivity">
|
||||
|
||||
<com.google.android.material.appbar.AppBarLayout
|
||||
android:layout_width="match_parent"
|
||||
|
@ -18,31 +18,30 @@
|
|||
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>
|
||||
|
||||
<androidx.constraintlayout.widget.ConstraintLayout
|
||||
<RelativeLayout
|
||||
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="0dp"
|
||||
app:layout_constraintBottom_toTopOf="@+id/cardView"
|
||||
app:layout_constraintTop_toTopOf="parent">
|
||||
android:layout_height="match_parent"
|
||||
android:layout_above="@id/cardView"
|
||||
android:layout_alignParentTop="true"
|
||||
android:layout_gravity="center">
|
||||
|
||||
<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
|
||||
|
@ -51,8 +50,9 @@
|
|||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_alignParentBottom="true"
|
||||
app:cardUseCompatPadding="true"
|
||||
app:layout_constraintBottom_toBottomOf="parent">
|
||||
android:layout_marginHorizontal="16dp"
|
||||
android:layout_marginTop="8dp"
|
||||
android:layout_marginBottom="8dp">
|
||||
|
||||
|
||||
<LinearLayout
|
||||
|
@ -68,6 +68,21 @@
|
|||
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"
|
||||
|
@ -88,15 +103,25 @@
|
|||
android:layout_height="wrap_content"
|
||||
android:layout_alignParentEnd="true"
|
||||
android:text="@string/edit" />
|
||||
|
||||
</RelativeLayout>
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
|
||||
</com.google.android.material.card.MaterialCardView>
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||
|
||||
|
||||
</RelativeLayout>
|
||||
|
||||
|
||||
<!-- <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>
|
||||
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
<?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"
|
||||
|
@ -9,32 +10,38 @@
|
|||
|
||||
<com.google.android.material.appbar.AppBarLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content">
|
||||
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"
|
||||
app:layout_collapseMode="pin" />
|
||||
android:layout_height="?attr/actionBarSize" />
|
||||
|
||||
<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"
|
||||
app:layout_collapseMode="pin">
|
||||
android:background="@android:color/transparent">
|
||||
|
||||
<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
|
||||
|
@ -43,6 +50,7 @@
|
|||
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"
|
||||
|
@ -51,4 +59,6 @@
|
|||
android:layout_margin="16dp"
|
||||
android:text="@string/installation"
|
||||
app:icon="@drawable/cloud_download" />
|
||||
|
||||
|
||||
</androidx.coordinatorlayout.widget.CoordinatorLayout>
|
|
@ -43,6 +43,27 @@
|
|||
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"
|
||||
|
@ -61,7 +82,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"
|
||||
|
@ -69,7 +90,8 @@
|
|||
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>
|
|
@ -1,44 +0,0 @@
|
|||
<?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>
|
|
@ -1,18 +1,15 @@
|
|||
<?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="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" />
|
||||
android:layout_height="match_parent" />
|
||||
</LinearLayout>
|
||||
|
|
|
@ -1,6 +1,5 @@
|
|||
<?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"
|
||||
|
@ -29,8 +28,7 @@
|
|||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:orientation="vertical"
|
||||
android:visibility="gone"
|
||||
tools:visibility="visible">
|
||||
android:visibility="gone">
|
||||
|
||||
|
||||
<LinearLayout
|
||||
|
@ -51,7 +49,6 @@
|
|||
android:id="@+id/headRecyclerView"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
tools:itemCount="1"
|
||||
android:layout_marginTop="8dp" />
|
||||
|
||||
</LinearLayout>
|
||||
|
|
|
@ -74,24 +74,16 @@
|
|||
|
||||
</com.google.android.material.chip.ChipGroup>
|
||||
</HorizontalScrollView>
|
||||
<com.scwang.smart.refresh.layout.SmartRefreshLayout
|
||||
android:id="@+id/refreshLayout"
|
||||
<androidx.swiperefreshlayout.widget.SwipeRefreshLayout
|
||||
android:id="@+id/swipeRefreshLayout"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
app:srlEnablePreviewInEditMode="false">
|
||||
<!--srlEnablePreviewInEditMode 可以开启和关闭预览功能-->
|
||||
<com.scwang.smart.refresh.header.ClassicsHeader
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"/>
|
||||
android:visibility="gone">
|
||||
<androidx.recyclerview.widget.RecyclerView
|
||||
android:id="@+id/recyclerView"
|
||||
android:layout_width="match_parent"
|
||||
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>
|
||||
android:layout_height="match_parent" />
|
||||
</androidx.swiperefreshlayout.widget.SwipeRefreshLayout>
|
||||
</LinearLayout>
|
||||
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
|
@ -53,16 +53,16 @@
|
|||
android:orientation="vertical"
|
||||
android:padding="8dp">
|
||||
|
||||
<LinearLayout
|
||||
<RelativeLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:gravity="center_vertical">
|
||||
android:layout_height="wrap_content">
|
||||
|
||||
<TextView
|
||||
style="@style/TextAppearance.Material3.HeadlineSmall"
|
||||
android:layout_width="0dp"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_weight="1"
|
||||
android:layout_alignParentStart="true"
|
||||
android:layout_centerVertical="true"
|
||||
android:text="@string/random_recommended" />
|
||||
|
||||
<Button
|
||||
|
@ -70,9 +70,11 @@
|
|||
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" />
|
||||
</LinearLayout>
|
||||
</RelativeLayout>
|
||||
|
||||
|
||||
<com.google.android.material.progressindicator.LinearProgressIndicator
|
||||
|
|
|
@ -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:tools="http://schemas.android.com/tools"
|
||||
xmlns:card_view="http://schemas.android.com/apk/res-auto"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:fillViewport="true">
|
||||
|
@ -12,26 +12,23 @@
|
|||
android:layout_height="match_parent"
|
||||
android:orientation="vertical">
|
||||
|
||||
<androidx.constraintlayout.widget.ConstraintLayout
|
||||
<LinearLayout
|
||||
android:visibility="gone"
|
||||
android:id="@+id/contentLayout"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:orientation="vertical"
|
||||
android:visibility="gone"
|
||||
tools:visibility="visible">
|
||||
android:orientation="vertical">
|
||||
|
||||
<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"
|
||||
app:cardUseCompatPadding="true"
|
||||
app:layout_constraintTop_toTopOf="parent">
|
||||
android:layout_margin="8dp">
|
||||
|
||||
<RelativeLayout
|
||||
android:id="@+id/myHomeView"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_margin="16dp"
|
||||
android:animateLayoutChanges="true"
|
||||
android:orientation="horizontal">
|
||||
|
@ -45,7 +42,7 @@
|
|||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_centerVertical="true"
|
||||
android:layout_marginStart="8dp"
|
||||
android:layout_toStartOf="@id/right_icon"
|
||||
|
@ -84,58 +81,51 @@
|
|||
</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
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_margin="16dp"
|
||||
android:orientation="vertical">
|
||||
|
||||
<TextView
|
||||
style="@style/TextAppearance.Material3.HeadlineSmall"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="@string/community_service" />
|
||||
|
||||
<androidx.recyclerview.widget.RecyclerView
|
||||
android:id="@+id/recyclerView"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_margin="8dp"
|
||||
android:orientation="vertical">
|
||||
android:layout_marginTop="8dp" />
|
||||
</LinearLayout>
|
||||
|
||||
<TextView
|
||||
style="@style/TextAppearance.Material3.HeadlineSmall"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="@string/community_service" />
|
||||
|
||||
<androidx.recyclerview.widget.RecyclerView
|
||||
android:id="@+id/recyclerView"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="8dp"
|
||||
tools:itemCount="2" />
|
||||
</LinearLayout>
|
||||
|
||||
</com.google.android.material.card.MaterialCardView>
|
||||
|
||||
<Button
|
||||
android:id="@+id/logOutButton"
|
||||
style="@style/Widget.Material3.Button.ElevatedButton"
|
||||
style="@style/Widget.Material3.Button.OutlinedButton"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
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>
|
||||
android:layout_marginHorizontal="16dp"
|
||||
android:layout_marginTop="16dp"
|
||||
android:text="@string/log_out" />
|
||||
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
<ProgressBar
|
||||
android:id="@+id/progressBar"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
tools:visibility="gone"/>
|
||||
android:layout_height="wrap_content"/>
|
||||
|
||||
<include
|
||||
android:visibility="gone"
|
||||
android:id="@+id/loginLayout"
|
||||
layout="@layout/layout_log_in_first"
|
||||
android:visibility="gone" />
|
||||
layout="@layout/layout_log_in_first"/>
|
||||
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
|
||||
</androidx.core.widget.NestedScrollView>
|
||||
|
|
|
@ -4,9 +4,11 @@
|
|||
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"
|
||||
|
|
|
@ -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:visibility="gone">
|
||||
android:orientation="vertical">
|
||||
|
||||
|
||||
<ProgressBar
|
||||
|
@ -24,7 +24,7 @@
|
|||
android:id="@+id/tipView"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:visibility="visible" />
|
||||
android:visibility="gone" />
|
||||
|
||||
|
||||
</LinearLayout>
|
||||
|
@ -34,7 +34,7 @@
|
|||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:orientation="vertical"
|
||||
android:visibility="visible">
|
||||
android:visibility="gone">
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
|
@ -52,18 +52,16 @@
|
|||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="16dp"
|
||||
android:text="@string/audit"
|
||||
android:visibility="gone" />
|
||||
android:visibility="visible" />
|
||||
|
||||
|
||||
<com.google.android.material.card.MaterialCardView
|
||||
android:id="@+id/cardView"
|
||||
style="@style/Widget.Material3.CardView.Filled"
|
||||
style="@style/Widget.Material3.CardView.Elevated"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="16dp"
|
||||
android:clickable="true"
|
||||
android:focusable="true"
|
||||
android:visibility="visible">
|
||||
android:visibility="gone">
|
||||
|
||||
<RelativeLayout
|
||||
android:id="@+id/openUserSpace"
|
||||
|
|
|
@ -1,33 +0,0 @@
|
|||
<?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>
|
|
@ -1,6 +0,0 @@
|
|||
<?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>
|
|
@ -9,10 +9,9 @@
|
|||
|
||||
<ImageView
|
||||
android:id="@+id/iconView"
|
||||
android:layout_width="46dp"
|
||||
android:layout_height="46dp"
|
||||
android:layout_width="48dp"
|
||||
android:layout_height="48dp"
|
||||
android:src="@drawable/image"
|
||||
android:scaleType="fitXY"
|
||||
app:tint="?attr/colorControlNormal" />
|
||||
|
||||
<TextView
|
||||
|
|
|
@ -1,18 +1,17 @@
|
|||
<?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">
|
||||
|
||||
android:layout_height="wrap_content"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto">
|
||||
<Button
|
||||
android:id="@+id/button"
|
||||
style="?android:attr/buttonBarButtonStyle"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="@string/action"
|
||||
app:strokeWidth="1dp"
|
||||
app:strokeColor="?attr/colorOnSurface"
|
||||
app:shapeAppearance="?attr/shapeAppearanceSmallComponent"
|
||||
android:textColor="?attr/colorOnSurface"
|
||||
app:rippleColor="?colorBackgroundFloating"
|
||||
app:shapeAppearance="?attr/shapeAppearanceSmallComponent"
|
||||
app:strokeColor="?attr/colorOnSurface"
|
||||
app:strokeWidth="1dp" />
|
||||
android:text="@string/action" />
|
||||
</RelativeLayout>
|
|
@ -1,33 +0,0 @@
|
|||
<?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>
|
|
@ -2,16 +2,14 @@
|
|||
<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">
|
||||
|
||||
<androidx.constraintlayout.utils.widget.ImageFilterView
|
||||
<ImageView
|
||||
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
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -1,20 +0,0 @@
|
|||
<?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>
|
|
@ -1,32 +0,0 @@
|
|||
<?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>
|
|
@ -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">%1$sitems</string>
|
||||
<string name="filenum">Total %1$s items</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>
|
||||
|
|
|
@ -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,6 +971,4 @@
|
|||
<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>
|
|
@ -1,16 +0,0 @@
|
|||
<?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>
|
|
@ -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
|
||||
// ) 可惜你没有 getName() 方法
|
||||
@Deprecated(
|
||||
"不要直接读取模板名称,请使用getName方法",
|
||||
ReplaceWith("getName()", "com.coldmint.rust.core"), DeprecationLevel.WARNING
|
||||
)
|
||||
val name: String,
|
||||
val update: String,
|
||||
val versionName: String,
|
||||
|
|
|
@ -12,12 +12,11 @@ import com.google.gson.annotations.SerializedName
|
|||
*/
|
||||
@Entity(tableName = "section")
|
||||
data class SectionInfo(
|
||||
@PrimaryKey val code: String = "",
|
||||
@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,
|
||||
// var isShow: Boolean = false
|
||||
@PrimaryKey val code: String = "",
|
||||
@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
|
||||
) {
|
||||
@Ignore
|
||||
constructor() : this("")
|
||||
|
|
|
@ -8,9 +8,8 @@ import java.io.File
|
|||
* @constructor
|
||||
*/
|
||||
data class TurretData(
|
||||
val name: String,
|
||||
var gameCoordinateData: CoordinateData,
|
||||
var scaleValue: Float = 1f,
|
||||
var imageFile: File? = null,
|
||||
var isImage: Boolean = true
|
||||
val name: String,
|
||||
var gameCoordinateData: CoordinateData,
|
||||
var scaleValue: Float = 1f,
|
||||
var imageFile: File? = null
|
||||
)
|
|
@ -1,5 +1,6 @@
|
|||
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
|
||||
|
@ -11,7 +12,7 @@ import java.io.File
|
|||
* 此类用于管理源文件内的炮塔数据
|
||||
* @constructor
|
||||
*/
|
||||
class TurretManager(private val sourceFile: SourceFile) {
|
||||
class TurretManager(val sourceFile: SourceFile) {
|
||||
|
||||
|
||||
/**
|
||||
|
@ -46,7 +47,6 @@ class TurretManager(private val sourceFile: SourceFile) {
|
|||
}
|
||||
|
||||
init {
|
||||
turretList.clear()
|
||||
val allSection = sourceFile.allSection
|
||||
val size = allSection.size
|
||||
if (size > 0) {
|
||||
|
@ -54,7 +54,7 @@ class TurretManager(private val sourceFile: SourceFile) {
|
|||
sourceFile.findResourceFilesFromSection("image_turret", "graphics", false)
|
||||
var defaultImageFile: File? = null
|
||||
if (!defaultImageList.isNullOrEmpty()) {
|
||||
defaultImageFile = defaultImageList[0]
|
||||
defaultImageFile = defaultImageList.get(0)
|
||||
LogCat.d("炮塔管理器-默认图像", defaultImageFile.absolutePath)
|
||||
}
|
||||
allSection.forEach {
|
||||
|
@ -65,17 +65,17 @@ class TurretManager(private val sourceFile: SourceFile) {
|
|||
var x = 0
|
||||
var y = 0
|
||||
val xData = sourceFile.readValueFromSection("x", it)
|
||||
if (!xData.isNullOrBlank()) {
|
||||
if (xData != null && xData.isNotBlank()) {
|
||||
x = xData.toFloat().toInt()
|
||||
}
|
||||
val yData = sourceFile.readValueFromSection("y", it)
|
||||
if (!yData.isNullOrBlank()) {
|
||||
if (yData != null&& yData.isNotBlank()) {
|
||||
y = yData.toFloat().toInt()
|
||||
}
|
||||
val turretData = TurretData(name, CoordinateData(x, y))
|
||||
val fileList = sourceFile.findResourceFilesFromSection("image", it, false)
|
||||
if (!fileList.isNullOrEmpty()) {
|
||||
val file = fileList[0]
|
||||
val file = fileList.get(0)
|
||||
turretData.imageFile = file
|
||||
LogCat.d("炮塔管理器-$name", "设置炮塔图像" + file.absolutePath)
|
||||
} else {
|
||||
|
@ -153,7 +153,7 @@ class TurretManager(private val sourceFile: SourceFile) {
|
|||
* @param frameLayout FrameLayout
|
||||
* @param sourceFile SourceFile
|
||||
*/
|
||||
private fun installerTurret(
|
||||
fun installerTurret(
|
||||
viewGroup: ViewGroup,
|
||||
turretData: TurretData,
|
||||
turretSketchpadView: TurretSketchpadView
|
||||
|
|
|
@ -1,10 +1,13 @@
|
|||
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
|
||||
|
||||
|
@ -12,9 +15,10 @@ import com.coldmint.rust.core.debug.LogCat
|
|||
* 炮塔画板
|
||||
* @constructor
|
||||
*/
|
||||
@SuppressLint("CustomViewStyleable")
|
||||
class TurretSketchpadView(context: Context, attributeSet: AttributeSet? = null) :
|
||||
View(context, attributeSet) {
|
||||
|
||||
|
||||
companion object {
|
||||
/**
|
||||
* 缩放图像
|
||||
|
@ -33,8 +37,8 @@ class TurretSketchpadView(context: Context, attributeSet: AttributeSet? = null)
|
|||
bitmap,
|
||||
0,
|
||||
0,
|
||||
bitmap.width,
|
||||
bitmap.height,
|
||||
bitmap.getWidth(),
|
||||
bitmap.getHeight(),
|
||||
matrix,
|
||||
true
|
||||
)
|
||||
|
@ -264,17 +268,6 @@ 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?) {
|
||||
|
|
|
@ -3,12 +3,16 @@ 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
|
||||
|
||||
/**
|
||||
|
@ -16,7 +20,7 @@ import com.coldmint.rust.core.debug.LogCat
|
|||
* @constructor
|
||||
*/
|
||||
class TurretView(context: Context, attributeSet: AttributeSet? = null) :
|
||||
View(context, attributeSet) {
|
||||
View(context, attributeSet) {
|
||||
|
||||
private var debugKey = "炮塔视图"
|
||||
private lateinit var turretData: TurretData
|
||||
|
@ -100,7 +104,7 @@ class TurretView(context: Context, attributeSet: AttributeSet? = null) :
|
|||
* 设置炮塔坐标数据
|
||||
* @param coordinateData
|
||||
*/
|
||||
private fun setTurretGameCoordinateData(coordinateData: CoordinateData) {
|
||||
fun setTurretGameCoordinateData(coordinateData: CoordinateData) {
|
||||
if (this::turretData.isInitialized) {
|
||||
turretData.gameCoordinateData = coordinateData
|
||||
}
|
||||
|
@ -112,7 +116,6 @@ 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
|
||||
|
@ -120,7 +123,6 @@ class TurretView(context: Context, attributeSet: AttributeSet? = null) :
|
|||
MotionEvent.ACTION_DOWN -> {
|
||||
return canDrag
|
||||
}
|
||||
|
||||
MotionEvent.ACTION_MOVE -> {
|
||||
LogCat.d(debugKey, "收到移动${turretData.name} 可拖动状态${canDrag}")
|
||||
if (canDrag) {
|
||||
|
@ -142,10 +144,6 @@ 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, "未绑定画板,停止绘制。")
|
||||
|
@ -161,23 +159,20 @@ class TurretView(context: Context, attributeSet: AttributeSet? = null) :
|
|||
LogCat.e(debugKey, "无法加载炮塔图像。")
|
||||
return
|
||||
} else {
|
||||
/* if (turretData.scaleValue != 1f) {
|
||||
bitmap = TurretSketchpadView.scaleBitmap(
|
||||
bitmap, turretData.scaleValue
|
||||
)
|
||||
}*/
|
||||
bitmap = TurretSketchpadView.scaleBitmap(
|
||||
bitmap, 10F
|
||||
)
|
||||
if (turretData.scaleValue != 1f) {
|
||||
bitmap = TurretSketchpadView.scaleBitmap(
|
||||
bitmap, turretData.scaleValue
|
||||
)
|
||||
}
|
||||
val androidCoordinate =
|
||||
turretSketchpadView!!.toAndroidCoordinate(turretData.gameCoordinateData)
|
||||
turretSketchpadView!!.toAndroidCoordinate(turretData.gameCoordinateData)
|
||||
bitmapW = bitmap!!.width
|
||||
bitmapH = bitmap.height
|
||||
bitmapH = bitmap!!.height
|
||||
canvas?.drawBitmap(
|
||||
bitmap,
|
||||
(androidCoordinate.x - bitmapW / 2).toFloat(),
|
||||
(androidCoordinate.y - bitmapH / 2).toFloat(),
|
||||
paint
|
||||
bitmap,
|
||||
(androidCoordinate.x - bitmapW / 2).toFloat(),
|
||||
(androidCoordinate.y - bitmapH / 2).toFloat(),
|
||||
paint
|
||||
)
|
||||
if (!bitmap.isRecycled) {
|
||||
bitmap.recycle()
|
||||
|
|
|
@ -92,7 +92,7 @@ class Report private constructor() {
|
|||
val requestBody = requestBodyBuilder.build()
|
||||
val request =
|
||||
Request.Builder()
|
||||
.url(ServerConfiguration.website + "php/report.php?action=reportRecordList")
|
||||
.url(ServerConfiguration.website + "php/report.php?action=list")
|
||||
.post(requestBody).build()
|
||||
val call = okHttpClient.newCall(request)
|
||||
val handler = Handler(Looper.getMainLooper())
|
||||
|
|
|
@ -831,8 +831,7 @@ class WebMod private constructor() {
|
|||
apiCallBack: ApiCallBack<WebModListData>,
|
||||
tag: String? = null,
|
||||
sortMode: SortMode? = null,
|
||||
limit: String? = null,
|
||||
sum : String?=null
|
||||
limit: String? = null
|
||||
) {
|
||||
val okHttpClient = ServerConfiguration.initOkHttpClient()
|
||||
val requestBodyBuilder: FormBody.Builder =
|
||||
|
|
|
@ -1,4 +1,7 @@
|
|||
package com.coldmint.dialog
|
||||
|
||||
import android.app.Dialog
|
||||
import android.content.Context
|
||||
import android.view.View
|
||||
|
||||
/**
|
||||
|
|
|
@ -1,8 +1,12 @@
|
|||
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
|
||||
|
||||
|
@ -18,6 +22,7 @@ abstract class BaseBottomDialog<ViewBindingType : ViewBinding>(val context: Cont
|
|||
|
||||
protected val bottomSheetDialog: BottomSheetDialog by lazy {
|
||||
BottomSheetDialog(context)
|
||||
|
||||
}
|
||||
|
||||
protected val layoutInflater by lazy {
|
||||
|
|
|
@ -5012,4 +5012,5 @@ public class CodeEditor extends View implements ContentListener, Formatter.Forma
|
|||
public void onRemove(@NonNull Content content, @NonNull ContentLine line) {
|
||||
layout.onRemove(content, line);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -27,7 +27,6 @@ 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;
|
||||
|
||||
|
@ -96,8 +95,6 @@ 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;
|
||||
}
|
||||
|
||||
|
|
|
@ -23,7 +23,6 @@
|
|||
*/
|
||||
package io.github.rosemoe.sora.widget.base;
|
||||
|
||||
import android.util.Log;
|
||||
import android.view.Gravity;
|
||||
import android.view.View;
|
||||
import android.widget.PopupWindow;
|
||||
|
@ -272,7 +271,6 @@ public class EditorPopupWindow {
|
|||
if (isShowing()) {
|
||||
return;
|
||||
}
|
||||
Log.i("EditorPopupWindow", "Created a new window for editor");
|
||||
applyWindowAttributes(true);
|
||||
}
|
||||
|
||||
|
|
|
@ -23,7 +23,6 @@
|
|||
*/
|
||||
package io.github.rosemoe.sora.widget.component;
|
||||
|
||||
import android.graphics.Color;
|
||||
import android.util.TypedValue;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
|
@ -31,8 +30,6 @@ 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;
|
||||
|
||||
|
@ -56,18 +53,13 @@ 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(ContextCompat.getColor(getContext(),R.color.defaultSymbolInputTextColor));
|
||||
|
||||
tv.setTextColor(getThemeColor(EditorColorScheme.COMPLETION_WND_TEXT_PRIMARY));
|
||||
|
||||
tv = view.findViewById(R.id.result_item_desc);
|
||||
tv.setText(item.desc);
|
||||
// tv.setTextColor(getThemeColor(EditorColorScheme.COMPLETION_WND_TEXT_SECONDARY));
|
||||
tv.setTextColor(ContextCompat.getColor(getContext(),R.color.defaultSymbolInputTextColor));
|
||||
tv.setTextColor(getThemeColor(EditorColorScheme.COMPLETION_WND_TEXT_SECONDARY));
|
||||
|
||||
view.setTag(pos);
|
||||
if (isCurrentCursorPosition) {
|
||||
|
|
|
@ -25,7 +25,6 @@
|
|||
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
|
||||
|
|
|
@ -52,8 +52,9 @@
|
|||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="Medium Text"
|
||||
style="@style/TextAppearance.Material3.TitleSmall"
|
||||
android:id="@+id/result_item_label" />
|
||||
android:textColor="#FF000000"
|
||||
android:id="@+id/result_item_label"
|
||||
android:textSize="15sp"/>
|
||||
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
|
|
Loading…
Reference in New Issue
Block a user