Compare commits
10 Commits
2.1.1_Test
...
master
Author | SHA1 | Date | |
---|---|---|---|
c3ac73c8f4 | |||
5b09dc0a84 | |||
3fc7bbc769 | |||
7c052f0f7a | |||
fe90fb35ac | |||
91bd932a8c | |||
e2cef38c2e | |||
05331665f9 | |||
6c2f5d8024 | |||
bc1af034a9 |
3
.gitignore
vendored
3
.gitignore
vendored
|
@ -60,4 +60,5 @@ build/
|
||||||
release/
|
release/
|
||||||
|
|
||||||
# Local configuration file (sdk path, etc)
|
# Local configuration file (sdk path, etc)
|
||||||
local.properties
|
local.properties
|
||||||
|
app/debug/
|
|
@ -32,7 +32,7 @@ android {
|
||||||
minSdkVersion 23
|
minSdkVersion 23
|
||||||
targetSdkVersion 33
|
targetSdkVersion 33
|
||||||
versionCode 28
|
versionCode 28
|
||||||
versionName "2.1.1 Test1(2024-4-18)"
|
versionName "2.1.1 Test(2024-7-20)"
|
||||||
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
|
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -95,7 +95,8 @@ dependencies {
|
||||||
implementation 'androidx.appcompat:appcompat:1.6.1'
|
implementation 'androidx.appcompat:appcompat:1.6.1'
|
||||||
implementation 'com.google.android.material:material:1.9.0'
|
implementation 'com.google.android.material:material:1.9.0'
|
||||||
|
|
||||||
implementation platform('com.google.firebase:firebase-bom:31.1.1')
|
//引发BUG的组件
|
||||||
|
implementation platform('com.google.firebase:firebase-bom:31.3.0')
|
||||||
implementation 'com.google.firebase:firebase-analytics-ktx'
|
implementation 'com.google.firebase:firebase-analytics-ktx'
|
||||||
implementation 'com.google.firebase:firebase-crashlytics-ktx'
|
implementation 'com.google.firebase:firebase-crashlytics-ktx'
|
||||||
implementation 'com.google.firebase:firebase-perf-ktx'
|
implementation 'com.google.firebase:firebase-perf-ktx'
|
||||||
|
|
|
@ -1,20 +0,0 @@
|
||||||
{
|
|
||||||
"version": 3,
|
|
||||||
"artifactType": {
|
|
||||||
"type": "APK",
|
|
||||||
"kind": "Directory"
|
|
||||||
},
|
|
||||||
"applicationId": "com.coldmint.rust.pro",
|
|
||||||
"variantName": "release",
|
|
||||||
"elements": [
|
|
||||||
{
|
|
||||||
"type": "SINGLE",
|
|
||||||
"filters": [],
|
|
||||||
"attributes": [],
|
|
||||||
"versionCode": 28,
|
|
||||||
"versionName": "2.1 Bata6(2023-7-20)",
|
|
||||||
"outputFile": "app-release.apk"
|
|
||||||
}
|
|
||||||
],
|
|
||||||
"elementType": "File"
|
|
||||||
}
|
|
Binary file not shown.
|
@ -1,5 +1,6 @@
|
||||||
package com.coldmint.rust.pro
|
package com.coldmint.rust.pro
|
||||||
|
|
||||||
|
import android.annotation.SuppressLint
|
||||||
import android.graphics.Color
|
import android.graphics.Color
|
||||||
import android.os.Bundle
|
import android.os.Bundle
|
||||||
import android.text.Editable
|
import android.text.Editable
|
||||||
|
@ -21,8 +22,6 @@ import com.coldmint.rust.pro.adapters.CodeTableAdapter
|
||||||
import com.coldmint.rust.pro.adapters.CodeTableItemAdapter
|
import com.coldmint.rust.pro.adapters.CodeTableItemAdapter
|
||||||
import com.coldmint.rust.pro.base.BaseActivity
|
import com.coldmint.rust.pro.base.BaseActivity
|
||||||
import com.coldmint.rust.pro.databinding.ActivityCodeTableBinding
|
import com.coldmint.rust.pro.databinding.ActivityCodeTableBinding
|
||||||
import com.google.rpc.Code
|
|
||||||
import com.muqing.gj
|
|
||||||
import java.util.concurrent.Executors
|
import java.util.concurrent.Executors
|
||||||
|
|
||||||
class CodeTableActivity : BaseActivity<ActivityCodeTableBinding>() {
|
class CodeTableActivity : BaseActivity<ActivityCodeTableBinding>() {
|
||||||
|
@ -37,14 +36,20 @@ class CodeTableActivity : BaseActivity<ActivityCodeTableBinding>() {
|
||||||
loadData()
|
loadData()
|
||||||
//设置上下选择按钮
|
//设置上下选择按钮
|
||||||
viewBinding.listTop.setOnClickListener {
|
viewBinding.listTop.setOnClickListener {
|
||||||
|
if (CodeTableAdapter.picklist.isEmpty()) {
|
||||||
|
return@setOnClickListener
|
||||||
|
}
|
||||||
|
|
||||||
if (--CodeTableAdapter.pick < 0) {
|
if (--CodeTableAdapter.pick < 0) {
|
||||||
CodeTableAdapter.pick = 0
|
CodeTableAdapter.pick = 0
|
||||||
}
|
}
|
||||||
val get = CodeTableAdapter.picklist[CodeTableAdapter.pick]
|
val get = CodeTableAdapter.picklist[CodeTableAdapter.pick]
|
||||||
(viewBinding.codeRecyclerB.layoutManager as LinearLayoutManager).scrollToPositionWithOffset(get, 0)
|
(viewBinding.codeRecyclerB.layoutManager as LinearLayoutManager).scrollToPositionWithOffset(get, 0)
|
||||||
adapter.item?.notifyDataSetChanged()
|
|
||||||
}
|
}
|
||||||
viewBinding.listButtom.setOnClickListener {
|
viewBinding.listButtom.setOnClickListener {
|
||||||
|
if (CodeTableAdapter.picklist.isEmpty()) {
|
||||||
|
return@setOnClickListener
|
||||||
|
}
|
||||||
val size = CodeTableAdapter.picklist.size
|
val size = CodeTableAdapter.picklist.size
|
||||||
|
|
||||||
if (++CodeTableAdapter.pick == size - 1) {
|
if (++CodeTableAdapter.pick == size - 1) {
|
||||||
|
@ -53,7 +58,6 @@ class CodeTableActivity : BaseActivity<ActivityCodeTableBinding>() {
|
||||||
val get = CodeTableAdapter.picklist[CodeTableAdapter.pick]
|
val get = CodeTableAdapter.picklist[CodeTableAdapter.pick]
|
||||||
(viewBinding.codeRecyclerB.layoutManager as LinearLayoutManager).scrollToPositionWithOffset(get,
|
(viewBinding.codeRecyclerB.layoutManager as LinearLayoutManager).scrollToPositionWithOffset(get,
|
||||||
0)
|
0)
|
||||||
adapter.item?.notifyDataSetChanged()
|
|
||||||
}
|
}
|
||||||
viewBinding.edittext.addTextChangedListener(object : TextWatcher {
|
viewBinding.edittext.addTextChangedListener(object : TextWatcher {
|
||||||
override fun beforeTextChanged(a: CharSequence?, p1: Int, p2: Int, p3: Int) {
|
override fun beforeTextChanged(a: CharSequence?, p1: Int, p2: Int, p3: Int) {
|
||||||
|
@ -67,7 +71,7 @@ class CodeTableActivity : BaseActivity<ActivityCodeTableBinding>() {
|
||||||
loadData(a.toString())*/
|
loadData(a.toString())*/
|
||||||
if (a.isNullOrEmpty()) {
|
if (a.isNullOrEmpty()) {
|
||||||
viewBinding.searchPick.isVisible = false
|
viewBinding.searchPick.isVisible = false
|
||||||
// loadData()
|
loadData()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -107,14 +111,6 @@ class CodeTableActivity : BaseActivity<ActivityCodeTableBinding>() {
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
private fun ifNeedFinish() {
|
|
||||||
if (filterMode) {
|
|
||||||
loadData()
|
|
||||||
} else {
|
|
||||||
finish()
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 加载数据
|
* 加载数据
|
||||||
* @param key String? 键
|
* @param key String? 键
|
||||||
|
@ -210,6 +206,7 @@ class CodeTableActivity : BaseActivity<ActivityCodeTableBinding>() {
|
||||||
* 没有找到节
|
* 没有找到节
|
||||||
* @param key String?
|
* @param key String?
|
||||||
*/
|
*/
|
||||||
|
@SuppressLint("StringFormatInvalid")
|
||||||
private fun notFindKey(key: String?) {
|
private fun notFindKey(key: String?) {
|
||||||
if (!key.isNullOrBlank()) {
|
if (!key.isNullOrBlank()) {
|
||||||
val tip = String.format(getString(R.string.not_find_code_name), key)
|
val tip = String.format(getString(R.string.not_find_code_name), key)
|
||||||
|
@ -240,9 +237,10 @@ class CodeTableActivity : BaseActivity<ActivityCodeTableBinding>() {
|
||||||
return true
|
return true
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Deprecated("Deprecated in Java", ReplaceWith("moveTaskToBack(true)"))
|
||||||
override fun onBackPressed() {
|
override fun onBackPressed() {
|
||||||
//显示桌面
|
//显示桌面
|
||||||
moveTaskToBack(true);
|
moveTaskToBack(true)
|
||||||
// ifNeedFinish()
|
// ifNeedFinish()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1,13 +1,8 @@
|
||||||
package com.coldmint.rust.pro
|
package com.coldmint.rust.pro
|
||||||
|
|
||||||
import android.content.Context
|
|
||||||
import android.content.Intent
|
import android.content.Intent
|
||||||
import android.content.pm.PackageInfo
|
import android.content.pm.PackageInfo
|
||||||
import android.content.pm.PackageManager
|
import android.content.pm.PackageManager
|
||||||
import android.content.pm.ShortcutInfo
|
|
||||||
import android.content.pm.ShortcutManager
|
|
||||||
import android.graphics.drawable.Icon
|
|
||||||
import android.os.Build
|
|
||||||
import android.os.Bundle
|
import android.os.Bundle
|
||||||
import android.os.Handler
|
import android.os.Handler
|
||||||
import android.os.Looper
|
import android.os.Looper
|
||||||
|
@ -47,11 +42,10 @@ import com.google.android.material.snackbar.Snackbar
|
||||||
import com.google.gson.Gson
|
import com.google.gson.Gson
|
||||||
import org.json.JSONObject
|
import org.json.JSONObject
|
||||||
import java.io.File
|
import java.io.File
|
||||||
import java.util.Arrays
|
import java.util.Locale
|
||||||
import java.util.concurrent.Executors
|
import java.util.concurrent.Executors
|
||||||
import java.util.zip.ZipEntry
|
import java.util.zip.ZipEntry
|
||||||
|
@Suppress("ConstPropertyName")
|
||||||
|
|
||||||
class MainActivity : BaseActivity<ActivityMainBinding>() {
|
class MainActivity : BaseActivity<ActivityMainBinding>() {
|
||||||
|
|
||||||
private lateinit var appBarConfiguration: AppBarConfiguration
|
private lateinit var appBarConfiguration: AppBarConfiguration
|
||||||
|
@ -67,14 +61,8 @@ class MainActivity : BaseActivity<ActivityMainBinding>() {
|
||||||
|
|
||||||
companion object {
|
companion object {
|
||||||
//仓库和社区碎片链接TabLayout间隔
|
//仓库和社区碎片链接TabLayout间隔
|
||||||
const val linkInterval: Long = 195
|
|
||||||
const val hideViewDelay: Long = 150
|
const val hideViewDelay: Long = 150
|
||||||
}
|
// private var time:Long=0;
|
||||||
|
|
||||||
/**
|
|
||||||
* 将Toolbar设置为ActionBar
|
|
||||||
*/
|
|
||||||
private fun useToolbarSetSupportActionBar() {
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -264,7 +252,7 @@ class MainActivity : BaseActivity<ActivityMainBinding>() {
|
||||||
val dataBase = menu.findItem(R.id.database_item)
|
val dataBase = menu.findItem(R.id.database_item)
|
||||||
val template = menu.findItem(R.id.template_item)
|
val template = menu.findItem(R.id.template_item)
|
||||||
val codeTable = menu.findItem(R.id.code_table)
|
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 community = menu.findItem(R.id.community_item)
|
||||||
// val group = menu.findItem(R.id.user_group)
|
// val group = menu.findItem(R.id.user_group)
|
||||||
// group.setOnMenuItemClickListener {
|
// group.setOnMenuItemClickListener {
|
||||||
|
@ -284,18 +272,15 @@ class MainActivity : BaseActivity<ActivityMainBinding>() {
|
||||||
template.isVisible = isActive
|
template.isVisible = isActive
|
||||||
// help.isVisible = isActive
|
// help.isVisible = isActive
|
||||||
codeTable.isVisible = isActive
|
codeTable.isVisible = isActive
|
||||||
if (mod.isChecked) {
|
|
||||||
// viewBinding.mainButton.isVisible = isActive
|
|
||||||
}
|
|
||||||
if (isActive) {
|
if (isActive) {
|
||||||
//数据库
|
//数据库
|
||||||
/* dataBase.setOnMenuItemClickListener {
|
/* dataBase.setOnMenuItemClickListener {
|
||||||
viewBinding.mainButton.postOnAnimationDelayed({
|
viewBinding.mainButton.postOnAnimationDelayed({
|
||||||
// viewBinding.tabLayout.isVisible = false
|
// viewBinding.tabLayout.isVisible = false
|
||||||
viewBinding.mainButton.hide()
|
viewBinding.mainButton.hide()
|
||||||
}, hideViewDelay)
|
}, hideViewDelay)
|
||||||
false
|
false
|
||||||
}*/
|
}*/
|
||||||
|
|
||||||
/* template.setOnMenuItemClickListener {
|
/* template.setOnMenuItemClickListener {
|
||||||
viewBinding.mainButton.postOnAnimationDelayed({
|
viewBinding.mainButton.postOnAnimationDelayed({
|
||||||
|
@ -331,49 +316,49 @@ class MainActivity : BaseActivity<ActivityMainBinding>() {
|
||||||
// 添加动态快捷方式
|
// 添加动态快捷方式
|
||||||
shortcutManager.addDynamicShortcuts(listOf(info))*/
|
shortcutManager.addDynamicShortcuts(listOf(info))*/
|
||||||
val intent = Intent(this@MainActivity, CodeTableActivity::class.java)
|
val intent = Intent(this@MainActivity, CodeTableActivity::class.java)
|
||||||
/* intent.addFlags(Intent.FLAG_ACTIVITY_MULTIPLE_TASK)
|
/* intent.addFlags(Intent.FLAG_ACTIVITY_MULTIPLE_TASK)
|
||||||
intent.addFlags(Intent.FLAG_ACTIVITY_NEW_DOCUMENT)*/
|
intent.addFlags(Intent.FLAG_ACTIVITY_NEW_DOCUMENT)*/
|
||||||
startActivity(intent)
|
startActivity(intent)
|
||||||
false
|
false
|
||||||
}
|
}
|
||||||
/*重要部分
|
/*重要部分
|
||||||
viewBinding.mainButton.setOnClickListener {
|
viewBinding.mainButton.setOnClickListener {
|
||||||
val item = viewBinding.navaiagtion.checkedItem.toString()
|
val item = viewBinding.navaiagtion.checkedItem.toString()
|
||||||
val warehouseItem = getString(R.string.warehouse)
|
val warehouseItem = getString(R.string.warehouse)
|
||||||
//final String database_item = getString(R.string.menu_title3);
|
//final String database_item = getString(R.string.menu_title3);
|
||||||
val templateItem = getString(R.string.template_title)
|
val templateItem = getString(R.string.template_title)
|
||||||
when (item) {
|
when (item) {
|
||||||
warehouseItem -> {
|
warehouseItem -> {
|
||||||
val intent = Intent(this, CreationWizardActivity::class.java)
|
val intent = Intent(this, CreationWizardActivity::class.java)
|
||||||
intent.putExtra("type", "mod")
|
intent.putExtra("type", "mod")
|
||||||
startActivity(intent)
|
startActivity(intent)
|
||||||
}
|
}
|
||||||
|
|
||||||
templateItem -> {
|
templateItem -> {
|
||||||
val intent = Intent(this, CreationWizardActivity::class.java)
|
val intent = Intent(this, CreationWizardActivity::class.java)
|
||||||
intent.putExtra("type", "template")
|
intent.putExtra("type", "template")
|
||||||
startActivity(intent)
|
startActivity(intent)
|
||||||
}
|
}
|
||||||
|
|
||||||
else -> {
|
else -> {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}*/
|
}*/
|
||||||
}
|
}
|
||||||
|
|
||||||
/* mod.setOnMenuItemClickListener {
|
/* mod.setOnMenuItemClickListener {
|
||||||
GlobalMethod.requestStoragePermissions(this) {
|
GlobalMethod.requestStoragePermissions(this) {
|
||||||
if (it) {
|
if (it) {
|
||||||
viewBinding.mainButton.postOnAnimationDelayed({
|
viewBinding.mainButton.postOnAnimationDelayed({
|
||||||
// viewBinding.tabLayout.isVisible = true
|
// viewBinding.tabLayout.isVisible = true
|
||||||
if (isActive) {
|
if (isActive) {
|
||||||
viewBinding.mainButton.show()
|
viewBinding.mainButton.show()
|
||||||
|
}
|
||||||
|
}, hideViewDelay)
|
||||||
}
|
}
|
||||||
}, hideViewDelay)
|
}
|
||||||
}
|
false
|
||||||
}
|
}*/
|
||||||
false
|
|
||||||
}*/
|
|
||||||
community.setOnMenuItemClickListener {
|
community.setOnMenuItemClickListener {
|
||||||
false
|
false
|
||||||
}
|
}
|
||||||
|
@ -395,13 +380,13 @@ class MainActivity : BaseActivity<ActivityMainBinding>() {
|
||||||
false
|
false
|
||||||
}
|
}
|
||||||
|
|
||||||
menu.findItem(R.id.rust_api).setOnMenuItemClickListener {
|
// menu.findItem(R.id.rust_api).setOnMenuItemClickListener {
|
||||||
val thisIntent = Intent(this, BrowserActivity::class.java)
|
// val thisIntent = Intent(this, BrowserActivity::class.java)
|
||||||
thisIntent.putExtra("link", "https://git.coldmint.top/")
|
// thisIntent.putExtra("link", "https://git.coldmint.top/")
|
||||||
thisIntent.putExtra("javaScriptEnabled", true)
|
// thisIntent.putExtra("javaScriptEnabled", true)
|
||||||
startActivity(thisIntent)
|
// startActivity(thisIntent)
|
||||||
false
|
// false
|
||||||
}
|
// }
|
||||||
|
|
||||||
menu.findItem(R.id.about).setOnMenuItemClickListener {
|
menu.findItem(R.id.about).setOnMenuItemClickListener {
|
||||||
startActivity(Intent(this@MainActivity, AboutActivity::class.java))
|
startActivity(Intent(this@MainActivity, AboutActivity::class.java))
|
||||||
|
@ -449,7 +434,10 @@ class MainActivity : BaseActivity<ActivityMainBinding>() {
|
||||||
override fun onActivityResult(requestCode: Int, resultCode: Int, data: Intent?) {
|
override fun onActivityResult(requestCode: Int, resultCode: Int, data: Intent?) {
|
||||||
super.onActivityResult(requestCode, resultCode, data)
|
super.onActivityResult(requestCode, resultCode, data)
|
||||||
if (resultCode == RESULT_OK) {
|
if (resultCode == RESULT_OK) {
|
||||||
val from = File(data!!.getStringExtra("File"))
|
if (data == null) {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
val from = File(data.getStringExtra("File").toString())
|
||||||
val type = FileOperator.getFileType(from)
|
val type = FileOperator.getFileType(from)
|
||||||
if (requestCode == 1) {
|
if (requestCode == 1) {
|
||||||
if ("rwmod" == type || "zip" == type) {
|
if ("rwmod" == type || "zip" == type) {
|
||||||
|
@ -458,13 +446,13 @@ class MainActivity : BaseActivity<ActivityMainBinding>() {
|
||||||
if (FileOperator.copyFile(from, to)) {
|
if (FileOperator.copyFile(from, to)) {
|
||||||
Snackbar.make(
|
Snackbar.make(
|
||||||
viewBinding.root,
|
viewBinding.root,
|
||||||
String.format(getString(R.string.import_complete), from.name),
|
String.format(Locale.getDefault(),getString(R.string.import_complete), from.name),
|
||||||
Snackbar.LENGTH_SHORT
|
Snackbar.LENGTH_SHORT
|
||||||
).show()
|
).show()
|
||||||
} else {
|
} else {
|
||||||
Snackbar.make(
|
Snackbar.make(
|
||||||
viewBinding.root,
|
viewBinding.root,
|
||||||
String.format(getString(R.string.import_failed), from.name),
|
String.format(Locale.getDefault(),getString(R.string.import_failed), from.name),
|
||||||
Snackbar.LENGTH_SHORT
|
Snackbar.LENGTH_SHORT
|
||||||
).show()
|
).show()
|
||||||
}
|
}
|
||||||
|
@ -503,6 +491,8 @@ class MainActivity : BaseActivity<ActivityMainBinding>() {
|
||||||
private fun importTemplate(formFile: File, templateDirectory: File) {
|
private fun importTemplate(formFile: File, templateDirectory: File) {
|
||||||
val handler = Handler(Looper.getMainLooper())
|
val handler = Handler(Looper.getMainLooper())
|
||||||
Thread(Runnable {
|
Thread(Runnable {
|
||||||
|
try {
|
||||||
|
|
||||||
//如果建立缓存完成,并且模板文件存在
|
//如果建立缓存完成,并且模板文件存在
|
||||||
val compressionManager = CompressionManager.instance
|
val compressionManager = CompressionManager.instance
|
||||||
if (templateDirectory.exists()) {
|
if (templateDirectory.exists()) {
|
||||||
|
@ -538,7 +528,7 @@ class MainActivity : BaseActivity<ActivityMainBinding>() {
|
||||||
handler.post {
|
handler.post {
|
||||||
Snackbar.make(
|
Snackbar.make(
|
||||||
viewBinding.root,
|
viewBinding.root,
|
||||||
String.format(
|
String.format(Locale.getDefault(),
|
||||||
getString(R.string.app_version_error),
|
getString(R.string.app_version_error),
|
||||||
formFile.name
|
formFile.name
|
||||||
), Snackbar.LENGTH_LONG
|
), Snackbar.LENGTH_LONG
|
||||||
|
@ -549,7 +539,7 @@ class MainActivity : BaseActivity<ActivityMainBinding>() {
|
||||||
if (newInfo.versionNum < oldInfo.versionNum) {
|
if (newInfo.versionNum < oldInfo.versionNum) {
|
||||||
handler.post {
|
handler.post {
|
||||||
MaterialAlertDialogBuilder(this).setTitle(oldInfo.name).setMessage(
|
MaterialAlertDialogBuilder(this).setTitle(oldInfo.name).setMessage(
|
||||||
String.format(
|
String.format(Locale.getDefault(),
|
||||||
getString(R.string.covers_the_import),
|
getString(R.string.covers_the_import),
|
||||||
newInfo.versionName, oldInfo.versionName
|
newInfo.versionName, oldInfo.versionName
|
||||||
)
|
)
|
||||||
|
@ -585,7 +575,7 @@ class MainActivity : BaseActivity<ActivityMainBinding>() {
|
||||||
handler.post {
|
handler.post {
|
||||||
Snackbar.make(
|
Snackbar.make(
|
||||||
viewBinding.root,
|
viewBinding.root,
|
||||||
String.format(
|
String.format(Locale.getDefault(),
|
||||||
getString(R.string.app_version_error),
|
getString(R.string.app_version_error),
|
||||||
formFile.name
|
formFile.name
|
||||||
), Snackbar.LENGTH_LONG
|
), Snackbar.LENGTH_LONG
|
||||||
|
@ -613,7 +603,7 @@ class MainActivity : BaseActivity<ActivityMainBinding>() {
|
||||||
handler.post {
|
handler.post {
|
||||||
Snackbar.make(
|
Snackbar.make(
|
||||||
viewBinding.root,
|
viewBinding.root,
|
||||||
String.format(
|
String.format(Locale.getDefault(),
|
||||||
getString(R.string.import_complete),
|
getString(R.string.import_complete),
|
||||||
formFile.name
|
formFile.name
|
||||||
), Snackbar.LENGTH_LONG
|
), Snackbar.LENGTH_LONG
|
||||||
|
@ -624,25 +614,30 @@ class MainActivity : BaseActivity<ActivityMainBinding>() {
|
||||||
|
|
||||||
|
|
||||||
})
|
})
|
||||||
|
}catch (e: Exception){
|
||||||
|
error(e)
|
||||||
|
}
|
||||||
}).start()
|
}).start()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@Deprecated("Deprecated in Java")
|
||||||
override fun onBackPressed() {
|
override fun onBackPressed() {
|
||||||
val navController = findNavController(R.id.baseFragment)
|
val navController = findNavController(R.id.baseFragment)
|
||||||
//判断是否在第一个导航 社区或者仓库
|
//判断是否在第一个导航 社区或者仓库
|
||||||
if (navController.currentDestination?.id == navController.graph.startDestinationId) {
|
if (navController.currentDestination?.id == navController.graph.startDestinationId) {
|
||||||
MaterialAlertDialogBuilder(this).setTitle(R.string.dialog_close).setMessage(
|
MaterialAlertDialogBuilder(this).setTitle(R.string.dialog_close).setMessage(
|
||||||
String.format(
|
String.format(Locale.getDefault(),
|
||||||
getString(R.string.exit_tip),
|
getString(R.string.exit_tip),
|
||||||
getString(R.string.app_name)
|
getString(R.string.app_name)
|
||||||
)
|
)
|
||||||
).setPositiveButton(R.string.dialog_ok) { _, _ ->
|
).setPositiveButton(R.string.dialog_ok) { _, _ ->
|
||||||
super.onBackPressed()
|
finish()
|
||||||
}.setNegativeButton(R.string.dialog_cancel) { _, _ ->
|
}.setNegativeButton(R.string.dialog_cancel) { _, _ ->
|
||||||
}.show()
|
}.show()
|
||||||
} else {
|
} else {
|
||||||
super.onBackPressed()
|
finish()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
/*
|
/*
|
||||||
|
@ -770,18 +765,18 @@ class MainActivity : BaseActivity<ActivityMainBinding>() {
|
||||||
initNav()
|
initNav()
|
||||||
observeStartViewModel()
|
observeStartViewModel()
|
||||||
//偏移fab
|
//偏移fab
|
||||||
/* if (ImmersionBar.hasNavigationBar(this)) {
|
/* if (ImmersionBar.hasNavigationBar(this)) {
|
||||||
val layoutParams =
|
val layoutParams =
|
||||||
viewBinding.mainButton.layoutParams as CoordinatorLayout.LayoutParams
|
viewBinding.mainButton.layoutParams as CoordinatorLayout.LayoutParams
|
||||||
layoutParams.setMargins(
|
layoutParams.setMargins(
|
||||||
GlobalMethod.dp2px(16),
|
GlobalMethod.dp2px(16),
|
||||||
GlobalMethod.dp2px(16),
|
GlobalMethod.dp2px(16),
|
||||||
GlobalMethod.dp2px(16),
|
GlobalMethod.dp2px(16),
|
||||||
ImmersionBar.getNavigationBarHeight(this) + GlobalMethod.dp2px(16)
|
ImmersionBar.getNavigationBarHeight(this) + GlobalMethod.dp2px(16)
|
||||||
)
|
)
|
||||||
DebugHelper.printLog("导航适配", "已调整fab按钮的位置。")
|
DebugHelper.printLog("导航适配", "已调整fab按钮的位置。")
|
||||||
}*/
|
}*/
|
||||||
checkAppUpdate()
|
// checkAppUpdate() 禁用检查更新
|
||||||
} else {
|
} else {
|
||||||
startViewModel.initAllData()
|
startViewModel.initAllData()
|
||||||
}
|
}
|
||||||
|
|
|
@ -9,7 +9,6 @@ import android.os.Bundle
|
||||||
import cat.ereza.customactivityoncrash.config.CaocConfig
|
import cat.ereza.customactivityoncrash.config.CaocConfig
|
||||||
import com.coldmint.rust.core.debug.LogCat
|
import com.coldmint.rust.core.debug.LogCat
|
||||||
import com.coldmint.rust.core.debug.LogCatObserver
|
import com.coldmint.rust.core.debug.LogCatObserver
|
||||||
import com.muqing.wj
|
|
||||||
import com.coldmint.rust.pro.tool.AppSettings
|
import com.coldmint.rust.pro.tool.AppSettings
|
||||||
import com.google.android.material.color.DynamicColors
|
import com.google.android.material.color.DynamicColors
|
||||||
import com.google.android.material.color.DynamicColorsOptions
|
import com.google.android.material.color.DynamicColorsOptions
|
||||||
|
@ -34,7 +33,6 @@ class RustApplication : Application() {
|
||||||
|
|
||||||
override fun onCreate() {
|
override fun onCreate() {
|
||||||
super.onCreate()
|
super.onCreate()
|
||||||
wj(this)
|
|
||||||
|
|
||||||
|
|
||||||
instanceObject = this
|
instanceObject = this
|
||||||
|
|
|
@ -2,10 +2,8 @@ package com.coldmint.rust.pro.adapters
|
||||||
|
|
||||||
import android.annotation.SuppressLint
|
import android.annotation.SuppressLint
|
||||||
import android.content.Context
|
import android.content.Context
|
||||||
import android.graphics.Color
|
|
||||||
import android.view.LayoutInflater
|
import android.view.LayoutInflater
|
||||||
import android.view.ViewGroup
|
import android.view.ViewGroup
|
||||||
import androidx.core.content.ContextCompat
|
|
||||||
import androidx.recyclerview.widget.RecyclerView
|
import androidx.recyclerview.widget.RecyclerView
|
||||||
import com.coldmint.rust.core.database.code.CodeInfo
|
import com.coldmint.rust.core.database.code.CodeInfo
|
||||||
import com.coldmint.rust.core.database.code.SectionInfo
|
import com.coldmint.rust.core.database.code.SectionInfo
|
||||||
|
@ -13,6 +11,7 @@ import com.coldmint.rust.core.tool.LineParser
|
||||||
import com.coldmint.rust.pro.R
|
import com.coldmint.rust.pro.R
|
||||||
import com.coldmint.rust.pro.databinding.ActivityCodeTableBinding
|
import com.coldmint.rust.pro.databinding.ActivityCodeTableBinding
|
||||||
import com.coldmint.rust.pro.databinding.ItemCodetableBinding
|
import com.coldmint.rust.pro.databinding.ItemCodetableBinding
|
||||||
|
import com.coldmint.rust.pro.tool.GlobalMethod
|
||||||
import com.google.android.gms.common.internal.Objects
|
import com.google.android.gms.common.internal.Objects
|
||||||
import com.muqing.VH
|
import com.muqing.VH
|
||||||
|
|
||||||
|
@ -204,7 +203,7 @@ class CodeTableAdapter(
|
||||||
lineParser.symbol = ","
|
lineParser.symbol = ","
|
||||||
}
|
}
|
||||||
|
|
||||||
@SuppressLint("StringFormatInvalid")
|
@SuppressLint("NotifyDataSetChanged", "StringFormatInvalid")
|
||||||
override fun onBindViewHolder(holder: VH<ItemCodetableBinding>, position: Int) {
|
override fun onBindViewHolder(holder: VH<ItemCodetableBinding>, position: Int) {
|
||||||
holder.binging.title.text = group[position].translate
|
holder.binging.title.text = group[position].translate
|
||||||
val format = String.format(
|
val format = String.format(
|
||||||
|
@ -214,22 +213,22 @@ class CodeTableAdapter(
|
||||||
holder.binging.message.text = format
|
holder.binging.message.text = format
|
||||||
holder.itemView.setOnClickListener {
|
holder.itemView.setOnClickListener {
|
||||||
i = group[position].translate
|
i = group[position].translate
|
||||||
|
pick = 0
|
||||||
|
pickString = ""
|
||||||
|
picklist.clear()
|
||||||
if (item != null) {
|
if (item != null) {
|
||||||
item!!.list = itemList[position]
|
item!!.list = itemList[position]
|
||||||
binding.codeRecyclerB.adapter = item
|
binding.codeRecyclerB.adapter = item
|
||||||
notifyDataSetChanged()
|
notifyDataSetChanged()
|
||||||
}
|
}
|
||||||
if (!binding.edittext.text.isNullOrEmpty())
|
|
||||||
binding.edittext.setText("")
|
|
||||||
|
|
||||||
// notifyItemChanged(p)
|
// notifyItemChanged(p)
|
||||||
}
|
}
|
||||||
if (Objects.equal(group[position].translate, i)) {
|
if (Objects.equal(group[position].translate, i)) {
|
||||||
//背景高亮
|
//背景高亮
|
||||||
holder.binging.root.setCardBackgroundColor(ContextCompat.getColor(context, R.color.md_theme_dark_onSecondaryContainer))
|
holder.binging.root.setCardBackgroundColor(GlobalMethod.getThemeColor(context, R.attr.colorPrimaryContainer))
|
||||||
} else {
|
} else {
|
||||||
//背景恢复
|
//背景恢复
|
||||||
holder.binging.root.setCardBackgroundColor(Color.parseColor("#FBEEF5"))
|
holder.binging.root.setCardBackgroundColor(GlobalMethod.getThemeColor(context, R.attr.colorSurface))
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -52,6 +52,8 @@ class CodeTableItemAdapter(val recyclerView: RecyclerView,
|
||||||
//在list查找是否有这个关键字
|
//在list查找是否有这个关键字
|
||||||
fun search(keyword: String) {
|
fun search(keyword: String) {
|
||||||
CodeTableAdapter.pickString = keyword
|
CodeTableAdapter.pickString = keyword
|
||||||
|
CodeTableAdapter.pick = 0
|
||||||
|
CodeTableAdapter.picklist.clear()
|
||||||
for (i in list.indices) {
|
for (i in list.indices) {
|
||||||
if (list[i].translate.contains(keyword) || list[i].description.contains(keyword) || list[i].code.contains(keyword)) {
|
if (list[i].translate.contains(keyword) || list[i].description.contains(keyword) || list[i].code.contains(keyword)) {
|
||||||
CodeTableAdapter.picklist.add(i)
|
CodeTableAdapter.picklist.add(i)
|
||||||
|
|
|
@ -7,7 +7,6 @@ import android.view.ViewGroup
|
||||||
import android.widget.Toast
|
import android.widget.Toast
|
||||||
import androidx.fragment.app.Fragment
|
import androidx.fragment.app.Fragment
|
||||||
import androidx.viewbinding.ViewBinding
|
import androidx.viewbinding.ViewBinding
|
||||||
import com.coldmint.rust.pro.tool.AppSettings
|
|
||||||
import com.google.firebase.analytics.FirebaseAnalytics
|
import com.google.firebase.analytics.FirebaseAnalytics
|
||||||
import com.google.firebase.analytics.ktx.analytics
|
import com.google.firebase.analytics.ktx.analytics
|
||||||
import com.google.firebase.ktx.Firebase
|
import com.google.firebase.ktx.Firebase
|
||||||
|
@ -55,7 +54,11 @@ abstract class BaseFragment<T : ViewBinding> : Fragment() {
|
||||||
|
|
||||||
override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
|
override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
|
||||||
super.onViewCreated(view, savedInstanceState)
|
super.onViewCreated(view, savedInstanceState)
|
||||||
firebaseAnalytics = Firebase.analytics
|
try {
|
||||||
|
firebaseAnalytics = Firebase.analytics
|
||||||
|
} catch (e: Exception) {
|
||||||
|
e.printStackTrace()
|
||||||
|
}
|
||||||
whenViewCreated(layoutInflater, savedInstanceState)
|
whenViewCreated(layoutInflater, savedInstanceState)
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -1,7 +1,6 @@
|
||||||
package com.coldmint.rust.pro.edit.autoComplete
|
package com.coldmint.rust.pro.edit.autoComplete
|
||||||
|
|
||||||
import android.os.Bundle
|
import android.os.Bundle
|
||||||
import com.coldmint.rust.pro.edit.RustAutoComplete
|
|
||||||
import com.coldmint.rust.pro.edit.RustCompletionItem
|
import com.coldmint.rust.pro.edit.RustCompletionItem
|
||||||
import io.github.rosemoe.sora.lang.completion.CompletionPublisher
|
import io.github.rosemoe.sora.lang.completion.CompletionPublisher
|
||||||
import io.github.rosemoe.sora.text.CharPosition
|
import io.github.rosemoe.sora.text.CharPosition
|
||||||
|
|
|
@ -1,142 +0,0 @@
|
||||||
package com.muqing;
|
|
||||||
import android.content.Context;
|
|
||||||
import android.os.Build;
|
|
||||||
|
|
||||||
import java.io.BufferedReader;
|
|
||||||
import java.io.File;
|
|
||||||
import java.io.FileInputStream;
|
|
||||||
import java.io.FileOutputStream;
|
|
||||||
import java.io.IOException;
|
|
||||||
import java.io.InputStream;
|
|
||||||
import java.io.InputStreamReader;
|
|
||||||
import java.io.OutputStream;
|
|
||||||
import java.nio.file.Files;
|
|
||||||
import java.security.MessageDigest;
|
|
||||||
import java.security.NoSuchAlgorithmException;
|
|
||||||
import java.util.Objects;
|
|
||||||
|
|
||||||
/** @noinspection unused, ResultOfMethodCallIgnored, ResultOfMethodCallIgnored */
|
|
||||||
public class wj {
|
|
||||||
public static String filesdri;
|
|
||||||
public wj(Context context) {
|
|
||||||
wj.filesdri = Objects.requireNonNull(context.getExternalFilesDir("")).
|
|
||||||
getAbsolutePath() + "/";
|
|
||||||
// context.getFilesDir().toString() + "/";
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
|
||||||
* 这里定义的是一个文件保存的方法,写入到文件中,所以是输出流
|
|
||||||
* */
|
|
||||||
public static boolean xrwb(String url, String text) {
|
|
||||||
if (text == null) {
|
|
||||||
text = "";
|
|
||||||
}
|
|
||||||
File file = new File(url);
|
|
||||||
//如果文件不存在,创建文件
|
|
||||||
try {
|
|
||||||
File parentFile = file.getParentFile();
|
|
||||||
if (!Objects.requireNonNull(parentFile).isDirectory()) {
|
|
||||||
parentFile.mkdirs();
|
|
||||||
}
|
|
||||||
if (!file.exists())
|
|
||||||
file.createNewFile();
|
|
||||||
//创建FileOutputStream对象,写入内容
|
|
||||||
FileOutputStream fos = new FileOutputStream(file);
|
|
||||||
//向文件中写入内容
|
|
||||||
fos.write(text.getBytes());
|
|
||||||
fos.close();
|
|
||||||
} catch (Exception e) {
|
|
||||||
e.printStackTrace();
|
|
||||||
}
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
public static String dqwb(String url) {
|
|
||||||
try {
|
|
||||||
File file = new File(url);
|
|
||||||
if (!file.exists()) {
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
FileInputStream fis = new FileInputStream(file);
|
|
||||||
BufferedReader br = new BufferedReader(new InputStreamReader(fis));
|
|
||||||
StringBuilder str = new StringBuilder();
|
|
||||||
String line;
|
|
||||||
while ((line = br.readLine()) != null) {
|
|
||||||
str.append(line);
|
|
||||||
}
|
|
||||||
br.close();
|
|
||||||
fis.close();
|
|
||||||
return str.toString();
|
|
||||||
} catch (Exception e) {
|
|
||||||
e.printStackTrace();
|
|
||||||
}
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
public static boolean cz(String url) {
|
|
||||||
return new File(url).exists();
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
public static boolean sc(String url) {
|
|
||||||
File file = new File(url);
|
|
||||||
return file.delete();
|
|
||||||
}
|
|
||||||
|
|
||||||
public static boolean sc(File file, boolean bool) {
|
|
||||||
if (!bool) {
|
|
||||||
return file.delete();
|
|
||||||
}
|
|
||||||
if (file.exists()) {
|
|
||||||
File[] files = file.listFiles();
|
|
||||||
if (files != null) {
|
|
||||||
for (File a : files) {
|
|
||||||
// 递归调用,删除子文件夹及其内容
|
|
||||||
// 删除文件
|
|
||||||
sc(a, a.isDirectory());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return sc(file, false); // 删除当前文件夹
|
|
||||||
}
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
public String convertToMd5(String url) {
|
|
||||||
try {
|
|
||||||
MessageDigest md = MessageDigest.getInstance("MD5");
|
|
||||||
byte[] messageDigest = md.digest(url.getBytes());
|
|
||||||
StringBuilder hexString = new StringBuilder();
|
|
||||||
for (byte value : messageDigest) {
|
|
||||||
String hex = Integer.toHexString(0xFF & value);
|
|
||||||
if (hex.length() == 1) {
|
|
||||||
hexString.append('0');
|
|
||||||
}
|
|
||||||
hexString.append(hex);
|
|
||||||
}
|
|
||||||
return hexString.toString();
|
|
||||||
} catch (NoSuchAlgorithmException e) {
|
|
||||||
e.printStackTrace();
|
|
||||||
}
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
public static void fz(String sourceFilePath, String targetFilePath) {
|
|
||||||
File sourceFile = new File(sourceFilePath);
|
|
||||||
File targetFile = new File(targetFilePath);
|
|
||||||
|
|
||||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
|
|
||||||
try (InputStream in = Files.newInputStream(sourceFile.toPath());
|
|
||||||
OutputStream out = Files.newOutputStream(targetFile.toPath())) {
|
|
||||||
byte[] buf = new byte[1024];
|
|
||||||
int bytesRead;
|
|
||||||
while ((bytesRead = in.read(buf)) > 0) {
|
|
||||||
out.write(buf, 0, bytesRead);
|
|
||||||
}
|
|
||||||
// 文件复制完成
|
|
||||||
} catch (IOException e) {
|
|
||||||
e.printStackTrace();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -4,7 +4,6 @@
|
||||||
style="@style/Widget.Material3.CardView.Elevated"
|
style="@style/Widget.Material3.CardView.Elevated"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
app:cardBackgroundColor="@null"
|
|
||||||
app:cardUseCompatPadding="true">
|
app:cardUseCompatPadding="true">
|
||||||
|
|
||||||
<LinearLayout
|
<LinearLayout
|
||||||
|
|
|
@ -64,10 +64,10 @@
|
||||||
android:icon="@drawable/github"
|
android:icon="@drawable/github"
|
||||||
android:title="@string/github" />
|
android:title="@string/github" />
|
||||||
|
|
||||||
<item
|
<!-- <item-->
|
||||||
android:id="@+id/rust_api"
|
<!-- android:id="@+id/rust_api"-->
|
||||||
android:icon="@drawable/outline_book_24"
|
<!-- android:icon="@drawable/outline_book_24"-->
|
||||||
android:title="@string/rust_api" />
|
<!-- android:title="@string/rust_api" />-->
|
||||||
|
|
||||||
|
|
||||||
<item
|
<item
|
||||||
|
|
|
@ -4,10 +4,10 @@ data class TemplateInfo(
|
||||||
val appVersionNum: Int,
|
val appVersionNum: Int,
|
||||||
val description: String,
|
val description: String,
|
||||||
val developer: String,
|
val developer: String,
|
||||||
@Deprecated(
|
// @Deprecated(
|
||||||
"不要直接读取模板名称,请使用getName方法",
|
// "不要直接读取模板名称,请使用getName方法",
|
||||||
ReplaceWith("getName()", "com.coldmint.rust.core"), DeprecationLevel.WARNING
|
// ReplaceWith("getName()", "com.coldmint.rust.core"), DeprecationLevel.WARNING
|
||||||
)
|
// ) 可惜你没有 getName() 方法
|
||||||
val name: String,
|
val name: String,
|
||||||
val update: String,
|
val update: String,
|
||||||
val versionName: String,
|
val versionName: String,
|
||||||
|
|
|
@ -92,7 +92,7 @@ class Report private constructor() {
|
||||||
val requestBody = requestBodyBuilder.build()
|
val requestBody = requestBodyBuilder.build()
|
||||||
val request =
|
val request =
|
||||||
Request.Builder()
|
Request.Builder()
|
||||||
.url(ServerConfiguration.website + "php/report.php?action=list")
|
.url(ServerConfiguration.website + "php/report.php?action=reportRecordList")
|
||||||
.post(requestBody).build()
|
.post(requestBody).build()
|
||||||
val call = okHttpClient.newCall(request)
|
val call = okHttpClient.newCall(request)
|
||||||
val handler = Handler(Looper.getMainLooper())
|
val handler = Handler(Looper.getMainLooper())
|
||||||
|
|
|
@ -1,7 +1,4 @@
|
||||||
package com.coldmint.dialog
|
package com.coldmint.dialog
|
||||||
|
|
||||||
import android.app.Dialog
|
|
||||||
import android.content.Context
|
|
||||||
import android.view.View
|
import android.view.View
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -27,6 +27,7 @@ import android.content.Context;
|
||||||
import android.graphics.Color;
|
import android.graphics.Color;
|
||||||
import android.graphics.drawable.ColorDrawable;
|
import android.graphics.drawable.ColorDrawable;
|
||||||
import android.util.AttributeSet;
|
import android.util.AttributeSet;
|
||||||
|
import android.util.Log;
|
||||||
import android.widget.Button;
|
import android.widget.Button;
|
||||||
import android.widget.LinearLayout;
|
import android.widget.LinearLayout;
|
||||||
|
|
||||||
|
@ -95,6 +96,8 @@ public class SymbolInputView extends LinearLayout {
|
||||||
for (int i = 0; i < getChildCount(); i++) {
|
for (int i = 0; i < getChildCount(); i++) {
|
||||||
((Button) getChildAt(i)).setTextColor(color);
|
((Button) getChildAt(i)).setTextColor(color);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Log.i("SymbolInputView", "Set text color to " + color);
|
||||||
textColor = color;
|
textColor = color;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -23,6 +23,7 @@
|
||||||
*/
|
*/
|
||||||
package io.github.rosemoe.sora.widget.base;
|
package io.github.rosemoe.sora.widget.base;
|
||||||
|
|
||||||
|
import android.util.Log;
|
||||||
import android.view.Gravity;
|
import android.view.Gravity;
|
||||||
import android.view.View;
|
import android.view.View;
|
||||||
import android.widget.PopupWindow;
|
import android.widget.PopupWindow;
|
||||||
|
@ -271,6 +272,7 @@ public class EditorPopupWindow {
|
||||||
if (isShowing()) {
|
if (isShowing()) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
Log.i("EditorPopupWindow", "Created a new window for editor");
|
||||||
applyWindowAttributes(true);
|
applyWindowAttributes(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -23,6 +23,7 @@
|
||||||
*/
|
*/
|
||||||
package io.github.rosemoe.sora.widget.component;
|
package io.github.rosemoe.sora.widget.component;
|
||||||
|
|
||||||
|
import android.graphics.Color;
|
||||||
import android.util.TypedValue;
|
import android.util.TypedValue;
|
||||||
import android.view.LayoutInflater;
|
import android.view.LayoutInflater;
|
||||||
import android.view.View;
|
import android.view.View;
|
||||||
|
@ -30,6 +31,8 @@ import android.view.ViewGroup;
|
||||||
import android.widget.ImageView;
|
import android.widget.ImageView;
|
||||||
import android.widget.TextView;
|
import android.widget.TextView;
|
||||||
|
|
||||||
|
import androidx.core.content.ContextCompat;
|
||||||
|
|
||||||
import io.github.rosemoe.sora.R;
|
import io.github.rosemoe.sora.R;
|
||||||
import io.github.rosemoe.sora.widget.schemes.EditorColorScheme;
|
import io.github.rosemoe.sora.widget.schemes.EditorColorScheme;
|
||||||
|
|
||||||
|
@ -53,13 +56,18 @@ public final class DefaultCompletionItemAdapter extends EditorCompletionAdapter
|
||||||
}
|
}
|
||||||
var item = getItem(pos);
|
var item = getItem(pos);
|
||||||
|
|
||||||
|
|
||||||
|
//编辑器代码提示文本渲染
|
||||||
TextView tv = view.findViewById(R.id.result_item_label);
|
TextView tv = view.findViewById(R.id.result_item_label);
|
||||||
tv.setText(item.label);
|
tv.setText(item.label);
|
||||||
tv.setTextColor(getThemeColor(EditorColorScheme.COMPLETION_WND_TEXT_PRIMARY));
|
// tv.setTextColor(getThemeColor(EditorColorScheme.COMPLETION_WND_TEXT_PRIMARY));
|
||||||
|
tv.setTextColor(ContextCompat.getColor(getContext(),R.color.defaultSymbolInputTextColor));
|
||||||
|
|
||||||
|
|
||||||
tv = view.findViewById(R.id.result_item_desc);
|
tv = view.findViewById(R.id.result_item_desc);
|
||||||
tv.setText(item.desc);
|
tv.setText(item.desc);
|
||||||
tv.setTextColor(getThemeColor(EditorColorScheme.COMPLETION_WND_TEXT_SECONDARY));
|
// tv.setTextColor(getThemeColor(EditorColorScheme.COMPLETION_WND_TEXT_SECONDARY));
|
||||||
|
tv.setTextColor(ContextCompat.getColor(getContext(),R.color.defaultSymbolInputTextColor));
|
||||||
|
|
||||||
view.setTag(pos);
|
view.setTag(pos);
|
||||||
if (isCurrentCursorPosition) {
|
if (isCurrentCursorPosition) {
|
||||||
|
|
|
@ -25,6 +25,7 @@
|
||||||
package io.github.rosemoe.sora.widget.component
|
package io.github.rosemoe.sora.widget.component
|
||||||
|
|
||||||
import android.graphics.drawable.GradientDrawable
|
import android.graphics.drawable.GradientDrawable
|
||||||
|
import android.util.Log
|
||||||
import android.view.LayoutInflater
|
import android.view.LayoutInflater
|
||||||
import android.view.MotionEvent
|
import android.view.MotionEvent
|
||||||
import android.view.View
|
import android.view.View
|
||||||
|
|
|
@ -52,9 +52,8 @@
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:text="Medium Text"
|
android:text="Medium Text"
|
||||||
android:textColor="#FF000000"
|
style="@style/TextAppearance.Material3.TitleSmall"
|
||||||
android:id="@+id/result_item_label"
|
android:id="@+id/result_item_label" />
|
||||||
android:textSize="15sp"/>
|
|
||||||
|
|
||||||
<TextView
|
<TextView
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
|
|
Loading…
Reference in New Issue
Block a user