Compare commits
No commits in common. "master" and "2.1.1_Test(2024-7-20)" have entirely different histories.
master
...
2.1.1_Test
3
.gitignore
vendored
3
.gitignore
vendored
|
@ -60,5 +60,4 @@ build/
|
|||
release/
|
||||
|
||||
# Local configuration file (sdk path, etc)
|
||||
local.properties
|
||||
app/debug/
|
||||
local.properties
|
|
@ -32,7 +32,7 @@ android {
|
|||
minSdkVersion 23
|
||||
targetSdkVersion 33
|
||||
versionCode 28
|
||||
versionName "2.1.1 Test(2024-7-20)"
|
||||
versionName "2.1.1 Test1(2024-4-18)"
|
||||
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
|
||||
}
|
||||
|
||||
|
@ -95,8 +95,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'
|
||||
|
|
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"
|
||||
}
|
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
|
||||
|
@ -22,6 +21,8 @@ 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>() {
|
||||
|
@ -36,20 +37,14 @@ 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) {
|
||||
|
@ -58,6 +53,7 @@ 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) {
|
||||
|
@ -71,7 +67,7 @@ class CodeTableActivity : BaseActivity<ActivityCodeTableBinding>() {
|
|||
loadData(a.toString())*/
|
||||
if (a.isNullOrEmpty()) {
|
||||
viewBinding.searchPick.isVisible = false
|
||||
loadData()
|
||||
// loadData()
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -111,6 +107,14 @@ class CodeTableActivity : BaseActivity<ActivityCodeTableBinding>() {
|
|||
*/
|
||||
|
||||
|
||||
private fun ifNeedFinish() {
|
||||
if (filterMode) {
|
||||
loadData()
|
||||
} else {
|
||||
finish()
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 加载数据
|
||||
* @param key String? 键
|
||||
|
@ -206,7 +210,6 @@ 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)
|
||||
|
@ -237,10 +240,9 @@ class CodeTableActivity : BaseActivity<ActivityCodeTableBinding>() {
|
|||
return true
|
||||
}
|
||||
|
||||
@Deprecated("Deprecated in Java", ReplaceWith("moveTaskToBack(true)"))
|
||||
override fun onBackPressed() {
|
||||
//显示桌面
|
||||
moveTaskToBack(true)
|
||||
moveTaskToBack(true);
|
||||
// ifNeedFinish()
|
||||
}
|
||||
|
||||
|
|
|
@ -1,8 +1,13 @@
|
|||
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
|
||||
|
@ -42,10 +47,11 @@ import com.google.android.material.snackbar.Snackbar
|
|||
import com.google.gson.Gson
|
||||
import org.json.JSONObject
|
||||
import java.io.File
|
||||
import java.util.Locale
|
||||
import java.util.Arrays
|
||||
import java.util.concurrent.Executors
|
||||
import java.util.zip.ZipEntry
|
||||
@Suppress("ConstPropertyName")
|
||||
|
||||
|
||||
class MainActivity : BaseActivity<ActivityMainBinding>() {
|
||||
|
||||
private lateinit var appBarConfiguration: AppBarConfiguration
|
||||
|
@ -61,8 +67,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 +264,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,15 +284,18 @@ 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({
|
||||
|
@ -316,49 +331,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()
|
||||
}
|
||||
}, 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 +395,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 +449,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 +458,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 +503,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 +538,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 +549,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 +585,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 +613,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 +624,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()
|
||||
}
|
||||
}
|
||||
/*
|
||||
|
@ -765,18 +770,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,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
|
||||
|
|
|
@ -2,8 +2,10 @@ 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
|
||||
|
@ -11,7 +13,6 @@ 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
|
||||
|
||||
|
@ -203,7 +204,7 @@ class CodeTableAdapter(
|
|||
lineParser.symbol = ","
|
||||
}
|
||||
|
||||
@SuppressLint("NotifyDataSetChanged", "StringFormatInvalid")
|
||||
@SuppressLint("StringFormatInvalid")
|
||||
override fun onBindViewHolder(holder: VH<ItemCodetableBinding>, position: Int) {
|
||||
holder.binging.title.text = group[position].translate
|
||||
val format = String.format(
|
||||
|
@ -213,22 +214,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(GlobalMethod.getThemeColor(context, R.attr.colorPrimaryContainer))
|
||||
holder.binging.root.setCardBackgroundColor(ContextCompat.getColor(context, R.color.md_theme_dark_onSecondaryContainer))
|
||||
} else {
|
||||
//背景恢复
|
||||
holder.binging.root.setCardBackgroundColor(GlobalMethod.getThemeColor(context, R.attr.colorSurface))
|
||||
holder.binging.root.setCardBackgroundColor(Color.parseColor("#FBEEF5"))
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -52,8 +52,6 @@ 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,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,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
|
||||
|
|
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,6 +4,7 @@
|
|||
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
|
||||
// ) 可惜你没有 getName() 方法
|
||||
@Deprecated(
|
||||
"不要直接读取模板名称,请使用getName方法",
|
||||
ReplaceWith("getName()", "com.coldmint.rust.core"), DeprecationLevel.WARNING
|
||||
)
|
||||
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=reportRecordList")
|
||||
.url(ServerConfiguration.website + "php/report.php?action=list")
|
||||
.post(requestBody).build()
|
||||
val call = okHttpClient.newCall(request)
|
||||
val handler = Handler(Looper.getMainLooper())
|
||||
|
|
|
@ -1,4 +1,7 @@
|
|||
package com.coldmint.dialog
|
||||
|
||||
import android.app.Dialog
|
||||
import android.content.Context
|
||||
import android.view.View
|
||||
|
||||
/**
|
||||
|
|
|
@ -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