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/
|
||||
|
||||
# Local configuration file (sdk path, etc)
|
||||
local.properties
|
||||
local.properties
|
||||
app/debug/
|
|
@ -32,7 +32,7 @@ android {
|
|||
minSdkVersion 23
|
||||
targetSdkVersion 33
|
||||
versionCode 28
|
||||
versionName "2.1.1 Test1(2024-4-18)"
|
||||
versionName "2.1.1 Test(2024-7-20)"
|
||||
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
|
||||
}
|
||||
|
||||
|
@ -95,7 +95,8 @@ dependencies {
|
|||
implementation 'androidx.appcompat:appcompat:1.6.1'
|
||||
implementation 'com.google.android.material:material:1.9.0'
|
||||
|
||||
implementation platform('com.google.firebase:firebase-bom:31.1.1')
|
||||
//引发BUG的组件
|
||||
implementation platform('com.google.firebase:firebase-bom:31.3.0')
|
||||
implementation 'com.google.firebase:firebase-analytics-ktx'
|
||||
implementation 'com.google.firebase:firebase-crashlytics-ktx'
|
||||
implementation 'com.google.firebase:firebase-perf-ktx'
|
||||
|
|
|
@ -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
|
||||
|
||||
import android.annotation.SuppressLint
|
||||
import android.graphics.Color
|
||||
import android.os.Bundle
|
||||
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.base.BaseActivity
|
||||
import com.coldmint.rust.pro.databinding.ActivityCodeTableBinding
|
||||
import com.google.rpc.Code
|
||||
import com.muqing.gj
|
||||
import java.util.concurrent.Executors
|
||||
|
||||
class CodeTableActivity : BaseActivity<ActivityCodeTableBinding>() {
|
||||
|
@ -37,14 +36,20 @@ class CodeTableActivity : BaseActivity<ActivityCodeTableBinding>() {
|
|||
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)
|
||||
adapter.item?.notifyDataSetChanged()
|
||||
}
|
||||
viewBinding.listButtom.setOnClickListener {
|
||||
if (CodeTableAdapter.picklist.isEmpty()) {
|
||||
return@setOnClickListener
|
||||
}
|
||||
val size = CodeTableAdapter.picklist.size
|
||||
|
||||
if (++CodeTableAdapter.pick == size - 1) {
|
||||
|
@ -53,7 +58,6 @@ class CodeTableActivity : BaseActivity<ActivityCodeTableBinding>() {
|
|||
val get = CodeTableAdapter.picklist[CodeTableAdapter.pick]
|
||||
(viewBinding.codeRecyclerB.layoutManager as LinearLayoutManager).scrollToPositionWithOffset(get,
|
||||
0)
|
||||
adapter.item?.notifyDataSetChanged()
|
||||
}
|
||||
viewBinding.edittext.addTextChangedListener(object : TextWatcher {
|
||||
override fun beforeTextChanged(a: CharSequence?, p1: Int, p2: Int, p3: Int) {
|
||||
|
@ -67,7 +71,7 @@ class CodeTableActivity : BaseActivity<ActivityCodeTableBinding>() {
|
|||
loadData(a.toString())*/
|
||||
if (a.isNullOrEmpty()) {
|
||||
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? 键
|
||||
|
@ -210,6 +206,7 @@ class CodeTableActivity : BaseActivity<ActivityCodeTableBinding>() {
|
|||
* 没有找到节
|
||||
* @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)
|
||||
|
@ -240,9 +237,10 @@ class CodeTableActivity : BaseActivity<ActivityCodeTableBinding>() {
|
|||
return true
|
||||
}
|
||||
|
||||
@Deprecated("Deprecated in Java", ReplaceWith("moveTaskToBack(true)"))
|
||||
override fun onBackPressed() {
|
||||
//显示桌面
|
||||
moveTaskToBack(true);
|
||||
moveTaskToBack(true)
|
||||
// ifNeedFinish()
|
||||
}
|
||||
|
||||
|
|
|
@ -1,13 +1,8 @@
|
|||
package com.coldmint.rust.pro
|
||||
|
||||
import android.content.Context
|
||||
import android.content.Intent
|
||||
import android.content.pm.PackageInfo
|
||||
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.Handler
|
||||
import android.os.Looper
|
||||
|
@ -47,11 +42,10 @@ import com.google.android.material.snackbar.Snackbar
|
|||
import com.google.gson.Gson
|
||||
import org.json.JSONObject
|
||||
import java.io.File
|
||||
import java.util.Arrays
|
||||
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
|
||||
|
@ -67,14 +61,8 @@ class MainActivity : BaseActivity<ActivityMainBinding>() {
|
|||
|
||||
companion object {
|
||||
//仓库和社区碎片链接TabLayout间隔
|
||||
const val linkInterval: Long = 195
|
||||
const val hideViewDelay: Long = 150
|
||||
}
|
||||
|
||||
/**
|
||||
* 将Toolbar设置为ActionBar
|
||||
*/
|
||||
private fun useToolbarSetSupportActionBar() {
|
||||
// private var time:Long=0;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -264,7 +252,7 @@ class MainActivity : BaseActivity<ActivityMainBinding>() {
|
|||
val dataBase = menu.findItem(R.id.database_item)
|
||||
val template = menu.findItem(R.id.template_item)
|
||||
val codeTable = menu.findItem(R.id.code_table)
|
||||
val mod = menu.findItem(R.id.mod_item)
|
||||
// val mod = menu.findItem(R.id.mod_item)
|
||||
val community = menu.findItem(R.id.community_item)
|
||||
// val group = menu.findItem(R.id.user_group)
|
||||
// group.setOnMenuItemClickListener {
|
||||
|
@ -284,18 +272,15 @@ 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({
|
||||
|
@ -331,49 +316,49 @@ class MainActivity : BaseActivity<ActivityMainBinding>() {
|
|||
// 添加动态快捷方式
|
||||
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)*/
|
||||
/* intent.addFlags(Intent.FLAG_ACTIVITY_MULTIPLE_TASK)
|
||||
intent.addFlags(Intent.FLAG_ACTIVITY_NEW_DOCUMENT)*/
|
||||
startActivity(intent)
|
||||
false
|
||||
}
|
||||
/*重要部分
|
||||
viewBinding.mainButton.setOnClickListener {
|
||||
val item = viewBinding.navaiagtion.checkedItem.toString()
|
||||
val warehouseItem = getString(R.string.warehouse)
|
||||
//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()
|
||||
/* mod.setOnMenuItemClickListener {
|
||||
GlobalMethod.requestStoragePermissions(this) {
|
||||
if (it) {
|
||||
viewBinding.mainButton.postOnAnimationDelayed({
|
||||
// viewBinding.tabLayout.isVisible = true
|
||||
if (isActive) {
|
||||
viewBinding.mainButton.show()
|
||||
}
|
||||
}, hideViewDelay)
|
||||
}
|
||||
}, hideViewDelay)
|
||||
}
|
||||
}
|
||||
false
|
||||
}*/
|
||||
}
|
||||
false
|
||||
}*/
|
||||
community.setOnMenuItemClickListener {
|
||||
false
|
||||
}
|
||||
|
@ -395,13 +380,13 @@ class MainActivity : BaseActivity<ActivityMainBinding>() {
|
|||
false
|
||||
}
|
||||
|
||||
menu.findItem(R.id.rust_api).setOnMenuItemClickListener {
|
||||
val thisIntent = Intent(this, BrowserActivity::class.java)
|
||||
thisIntent.putExtra("link", "https://git.coldmint.top/")
|
||||
thisIntent.putExtra("javaScriptEnabled", true)
|
||||
startActivity(thisIntent)
|
||||
false
|
||||
}
|
||||
// menu.findItem(R.id.rust_api).setOnMenuItemClickListener {
|
||||
// val thisIntent = Intent(this, BrowserActivity::class.java)
|
||||
// thisIntent.putExtra("link", "https://git.coldmint.top/")
|
||||
// thisIntent.putExtra("javaScriptEnabled", true)
|
||||
// startActivity(thisIntent)
|
||||
// false
|
||||
// }
|
||||
|
||||
menu.findItem(R.id.about).setOnMenuItemClickListener {
|
||||
startActivity(Intent(this@MainActivity, AboutActivity::class.java))
|
||||
|
@ -449,7 +434,10 @@ class MainActivity : BaseActivity<ActivityMainBinding>() {
|
|||
override fun onActivityResult(requestCode: Int, resultCode: Int, data: Intent?) {
|
||||
super.onActivityResult(requestCode, resultCode, data)
|
||||
if (resultCode == RESULT_OK) {
|
||||
val from = File(data!!.getStringExtra("File"))
|
||||
if (data == null) {
|
||||
return
|
||||
}
|
||||
val from = File(data.getStringExtra("File").toString())
|
||||
val type = FileOperator.getFileType(from)
|
||||
if (requestCode == 1) {
|
||||
if ("rwmod" == type || "zip" == type) {
|
||||
|
@ -458,13 +446,13 @@ class MainActivity : BaseActivity<ActivityMainBinding>() {
|
|||
if (FileOperator.copyFile(from, to)) {
|
||||
Snackbar.make(
|
||||
viewBinding.root,
|
||||
String.format(getString(R.string.import_complete), from.name),
|
||||
String.format(Locale.getDefault(),getString(R.string.import_complete), from.name),
|
||||
Snackbar.LENGTH_SHORT
|
||||
).show()
|
||||
} else {
|
||||
Snackbar.make(
|
||||
viewBinding.root,
|
||||
String.format(getString(R.string.import_failed), from.name),
|
||||
String.format(Locale.getDefault(),getString(R.string.import_failed), from.name),
|
||||
Snackbar.LENGTH_SHORT
|
||||
).show()
|
||||
}
|
||||
|
@ -503,6 +491,8 @@ class MainActivity : BaseActivity<ActivityMainBinding>() {
|
|||
private fun importTemplate(formFile: File, templateDirectory: File) {
|
||||
val handler = Handler(Looper.getMainLooper())
|
||||
Thread(Runnable {
|
||||
try {
|
||||
|
||||
//如果建立缓存完成,并且模板文件存在
|
||||
val compressionManager = CompressionManager.instance
|
||||
if (templateDirectory.exists()) {
|
||||
|
@ -538,7 +528,7 @@ class MainActivity : BaseActivity<ActivityMainBinding>() {
|
|||
handler.post {
|
||||
Snackbar.make(
|
||||
viewBinding.root,
|
||||
String.format(
|
||||
String.format(Locale.getDefault(),
|
||||
getString(R.string.app_version_error),
|
||||
formFile.name
|
||||
), Snackbar.LENGTH_LONG
|
||||
|
@ -549,7 +539,7 @@ class MainActivity : BaseActivity<ActivityMainBinding>() {
|
|||
if (newInfo.versionNum < oldInfo.versionNum) {
|
||||
handler.post {
|
||||
MaterialAlertDialogBuilder(this).setTitle(oldInfo.name).setMessage(
|
||||
String.format(
|
||||
String.format(Locale.getDefault(),
|
||||
getString(R.string.covers_the_import),
|
||||
newInfo.versionName, oldInfo.versionName
|
||||
)
|
||||
|
@ -585,7 +575,7 @@ class MainActivity : BaseActivity<ActivityMainBinding>() {
|
|||
handler.post {
|
||||
Snackbar.make(
|
||||
viewBinding.root,
|
||||
String.format(
|
||||
String.format(Locale.getDefault(),
|
||||
getString(R.string.app_version_error),
|
||||
formFile.name
|
||||
), Snackbar.LENGTH_LONG
|
||||
|
@ -613,7 +603,7 @@ class MainActivity : BaseActivity<ActivityMainBinding>() {
|
|||
handler.post {
|
||||
Snackbar.make(
|
||||
viewBinding.root,
|
||||
String.format(
|
||||
String.format(Locale.getDefault(),
|
||||
getString(R.string.import_complete),
|
||||
formFile.name
|
||||
), Snackbar.LENGTH_LONG
|
||||
|
@ -624,25 +614,30 @@ class MainActivity : BaseActivity<ActivityMainBinding>() {
|
|||
|
||||
|
||||
})
|
||||
}catch (e: Exception){
|
||||
error(e)
|
||||
}
|
||||
}).start()
|
||||
}
|
||||
|
||||
|
||||
|
||||
@Deprecated("Deprecated in Java")
|
||||
override fun onBackPressed() {
|
||||
val navController = findNavController(R.id.baseFragment)
|
||||
//判断是否在第一个导航 社区或者仓库
|
||||
if (navController.currentDestination?.id == navController.graph.startDestinationId) {
|
||||
MaterialAlertDialogBuilder(this).setTitle(R.string.dialog_close).setMessage(
|
||||
String.format(
|
||||
String.format(Locale.getDefault(),
|
||||
getString(R.string.exit_tip),
|
||||
getString(R.string.app_name)
|
||||
)
|
||||
).setPositiveButton(R.string.dialog_ok) { _, _ ->
|
||||
super.onBackPressed()
|
||||
finish()
|
||||
}.setNegativeButton(R.string.dialog_cancel) { _, _ ->
|
||||
}.show()
|
||||
} else {
|
||||
super.onBackPressed()
|
||||
finish()
|
||||
}
|
||||
}
|
||||
/*
|
||||
|
@ -770,18 +765,18 @@ 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,7 +9,6 @@ import android.os.Bundle
|
|||
import cat.ereza.customactivityoncrash.config.CaocConfig
|
||||
import com.coldmint.rust.core.debug.LogCat
|
||||
import com.coldmint.rust.core.debug.LogCatObserver
|
||||
import com.muqing.wj
|
||||
import com.coldmint.rust.pro.tool.AppSettings
|
||||
import com.google.android.material.color.DynamicColors
|
||||
import com.google.android.material.color.DynamicColorsOptions
|
||||
|
@ -34,7 +33,6 @@ class RustApplication : Application() {
|
|||
|
||||
override fun onCreate() {
|
||||
super.onCreate()
|
||||
wj(this)
|
||||
|
||||
|
||||
instanceObject = this
|
||||
|
|
|
@ -2,10 +2,8 @@ package com.coldmint.rust.pro.adapters
|
|||
|
||||
import android.annotation.SuppressLint
|
||||
import android.content.Context
|
||||
import android.graphics.Color
|
||||
import android.view.LayoutInflater
|
||||
import android.view.ViewGroup
|
||||
import androidx.core.content.ContextCompat
|
||||
import androidx.recyclerview.widget.RecyclerView
|
||||
import com.coldmint.rust.core.database.code.CodeInfo
|
||||
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.databinding.ActivityCodeTableBinding
|
||||
import com.coldmint.rust.pro.databinding.ItemCodetableBinding
|
||||
import com.coldmint.rust.pro.tool.GlobalMethod
|
||||
import com.google.android.gms.common.internal.Objects
|
||||
import com.muqing.VH
|
||||
|
||||
|
@ -204,7 +203,7 @@ class CodeTableAdapter(
|
|||
lineParser.symbol = ","
|
||||
}
|
||||
|
||||
@SuppressLint("StringFormatInvalid")
|
||||
@SuppressLint("NotifyDataSetChanged", "StringFormatInvalid")
|
||||
override fun onBindViewHolder(holder: VH<ItemCodetableBinding>, position: Int) {
|
||||
holder.binging.title.text = group[position].translate
|
||||
val format = String.format(
|
||||
|
@ -214,22 +213,22 @@ class CodeTableAdapter(
|
|||
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()
|
||||
}
|
||||
if (!binding.edittext.text.isNullOrEmpty())
|
||||
binding.edittext.setText("")
|
||||
|
||||
// notifyItemChanged(p)
|
||||
}
|
||||
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 {
|
||||
//背景恢复
|
||||
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查找是否有这个关键字
|
||||
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)
|
||||
|
|
|
@ -7,7 +7,6 @@ import android.view.ViewGroup
|
|||
import android.widget.Toast
|
||||
import androidx.fragment.app.Fragment
|
||||
import androidx.viewbinding.ViewBinding
|
||||
import com.coldmint.rust.pro.tool.AppSettings
|
||||
import com.google.firebase.analytics.FirebaseAnalytics
|
||||
import com.google.firebase.analytics.ktx.analytics
|
||||
import com.google.firebase.ktx.Firebase
|
||||
|
@ -55,7 +54,11 @@ abstract class BaseFragment<T : ViewBinding> : Fragment() {
|
|||
|
||||
override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
|
||||
super.onViewCreated(view, savedInstanceState)
|
||||
firebaseAnalytics = Firebase.analytics
|
||||
try {
|
||||
firebaseAnalytics = Firebase.analytics
|
||||
} catch (e: Exception) {
|
||||
e.printStackTrace()
|
||||
}
|
||||
whenViewCreated(layoutInflater, savedInstanceState)
|
||||
}
|
||||
}
|
|
@ -1,7 +1,6 @@
|
|||
package com.coldmint.rust.pro.edit.autoComplete
|
||||
|
||||
import android.os.Bundle
|
||||
import com.coldmint.rust.pro.edit.RustAutoComplete
|
||||
import com.coldmint.rust.pro.edit.RustCompletionItem
|
||||
import io.github.rosemoe.sora.lang.completion.CompletionPublisher
|
||||
import io.github.rosemoe.sora.text.CharPosition
|
||||
|
|
|
@ -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"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
app:cardBackgroundColor="@null"
|
||||
app:cardUseCompatPadding="true">
|
||||
|
||||
<LinearLayout
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -4,10 +4,10 @@ data class TemplateInfo(
|
|||
val appVersionNum: Int,
|
||||
val description: String,
|
||||
val developer: String,
|
||||
@Deprecated(
|
||||
"不要直接读取模板名称,请使用getName方法",
|
||||
ReplaceWith("getName()", "com.coldmint.rust.core"), DeprecationLevel.WARNING
|
||||
)
|
||||
// @Deprecated(
|
||||
// "不要直接读取模板名称,请使用getName方法",
|
||||
// ReplaceWith("getName()", "com.coldmint.rust.core"), DeprecationLevel.WARNING
|
||||
// ) 可惜你没有 getName() 方法
|
||||
val name: String,
|
||||
val update: String,
|
||||
val versionName: String,
|
||||
|
|
|
@ -92,7 +92,7 @@ class Report private constructor() {
|
|||
val requestBody = requestBodyBuilder.build()
|
||||
val request =
|
||||
Request.Builder()
|
||||
.url(ServerConfiguration.website + "php/report.php?action=list")
|
||||
.url(ServerConfiguration.website + "php/report.php?action=reportRecordList")
|
||||
.post(requestBody).build()
|
||||
val call = okHttpClient.newCall(request)
|
||||
val handler = Handler(Looper.getMainLooper())
|
||||
|
|
|
@ -1,7 +1,4 @@
|
|||
package com.coldmint.dialog
|
||||
|
||||
import android.app.Dialog
|
||||
import android.content.Context
|
||||
import android.view.View
|
||||
|
||||
/**
|
||||
|
|
|
@ -27,6 +27,7 @@ import android.content.Context;
|
|||
import android.graphics.Color;
|
||||
import android.graphics.drawable.ColorDrawable;
|
||||
import android.util.AttributeSet;
|
||||
import android.util.Log;
|
||||
import android.widget.Button;
|
||||
import android.widget.LinearLayout;
|
||||
|
||||
|
@ -95,6 +96,8 @@ public class SymbolInputView extends LinearLayout {
|
|||
for (int i = 0; i < getChildCount(); i++) {
|
||||
((Button) getChildAt(i)).setTextColor(color);
|
||||
}
|
||||
|
||||
Log.i("SymbolInputView", "Set text color to " + color);
|
||||
textColor = color;
|
||||
}
|
||||
|
||||
|
|
|
@ -23,6 +23,7 @@
|
|||
*/
|
||||
package io.github.rosemoe.sora.widget.base;
|
||||
|
||||
import android.util.Log;
|
||||
import android.view.Gravity;
|
||||
import android.view.View;
|
||||
import android.widget.PopupWindow;
|
||||
|
@ -271,6 +272,7 @@ public class EditorPopupWindow {
|
|||
if (isShowing()) {
|
||||
return;
|
||||
}
|
||||
Log.i("EditorPopupWindow", "Created a new window for editor");
|
||||
applyWindowAttributes(true);
|
||||
}
|
||||
|
||||
|
|
|
@ -23,6 +23,7 @@
|
|||
*/
|
||||
package io.github.rosemoe.sora.widget.component;
|
||||
|
||||
import android.graphics.Color;
|
||||
import android.util.TypedValue;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
|
@ -30,6 +31,8 @@ import android.view.ViewGroup;
|
|||
import android.widget.ImageView;
|
||||
import android.widget.TextView;
|
||||
|
||||
import androidx.core.content.ContextCompat;
|
||||
|
||||
import io.github.rosemoe.sora.R;
|
||||
import io.github.rosemoe.sora.widget.schemes.EditorColorScheme;
|
||||
|
||||
|
@ -53,13 +56,18 @@ public final class DefaultCompletionItemAdapter extends EditorCompletionAdapter
|
|||
}
|
||||
var item = getItem(pos);
|
||||
|
||||
|
||||
//编辑器代码提示文本渲染
|
||||
TextView tv = view.findViewById(R.id.result_item_label);
|
||||
tv.setText(item.label);
|
||||
tv.setTextColor(getThemeColor(EditorColorScheme.COMPLETION_WND_TEXT_PRIMARY));
|
||||
// tv.setTextColor(getThemeColor(EditorColorScheme.COMPLETION_WND_TEXT_PRIMARY));
|
||||
tv.setTextColor(ContextCompat.getColor(getContext(),R.color.defaultSymbolInputTextColor));
|
||||
|
||||
|
||||
tv = view.findViewById(R.id.result_item_desc);
|
||||
tv.setText(item.desc);
|
||||
tv.setTextColor(getThemeColor(EditorColorScheme.COMPLETION_WND_TEXT_SECONDARY));
|
||||
// tv.setTextColor(getThemeColor(EditorColorScheme.COMPLETION_WND_TEXT_SECONDARY));
|
||||
tv.setTextColor(ContextCompat.getColor(getContext(),R.color.defaultSymbolInputTextColor));
|
||||
|
||||
view.setTag(pos);
|
||||
if (isCurrentCursorPosition) {
|
||||
|
|
|
@ -25,6 +25,7 @@
|
|||
package io.github.rosemoe.sora.widget.component
|
||||
|
||||
import android.graphics.drawable.GradientDrawable
|
||||
import android.util.Log
|
||||
import android.view.LayoutInflater
|
||||
import android.view.MotionEvent
|
||||
import android.view.View
|
||||
|
|
|
@ -52,9 +52,8 @@
|
|||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="Medium Text"
|
||||
android:textColor="#FF000000"
|
||||
android:id="@+id/result_item_label"
|
||||
android:textSize="15sp"/>
|
||||
style="@style/TextAppearance.Material3.TitleSmall"
|
||||
android:id="@+id/result_item_label" />
|
||||
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
|
|
Loading…
Reference in New Issue
Block a user