修复MOD导入模板不能上滑的BUG

优化评论区,文件管理器,代码表
This commit is contained in:
muqing 2024-01-29 15:09:25 +08:00
parent c5fa00b988
commit d1a1adae99
15 changed files with 157 additions and 186 deletions

View File

@ -6,9 +6,12 @@ import android.text.Spannable
import android.text.SpannableString import android.text.SpannableString
import android.text.method.LinkMovementMethod import android.text.method.LinkMovementMethod
import android.text.style.ClickableSpan import android.text.style.ClickableSpan
import android.view.* import android.view.LayoutInflater
import android.view.Menu
import android.view.MenuItem
import android.view.View
import android.widget.SearchView
import androidx.core.view.isVisible import androidx.core.view.isVisible
import com.coldmint.dialog.InputDialog
import com.coldmint.rust.core.database.code.CodeDataBase import com.coldmint.rust.core.database.code.CodeDataBase
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
@ -28,6 +31,7 @@ class CodeTableActivity : BaseActivity<ActivityCodeTableBinding>() {
} }
} }
/*
override fun onKeyDown(keyCode: Int, event: KeyEvent): Boolean { override fun onKeyDown(keyCode: Int, event: KeyEvent): Boolean {
if (keyCode == KeyEvent.KEYCODE_BACK && event.action == KeyEvent.ACTION_DOWN) { if (keyCode == KeyEvent.KEYCODE_BACK && event.action == KeyEvent.ACTION_DOWN) {
@ -36,6 +40,7 @@ class CodeTableActivity : BaseActivity<ActivityCodeTableBinding>() {
} }
return super.onKeyDown(keyCode, event) return super.onKeyDown(keyCode, event)
} }
*/
fun ifNeedFinish() { fun ifNeedFinish() {
@ -133,13 +138,14 @@ class CodeTableActivity : BaseActivity<ActivityCodeTableBinding>() {
spannableString.setSpan( spannableString.setSpan(
object : ClickableSpan() { object : ClickableSpan() {
override fun onClick(p0: View) { override fun onClick(p0: View) {
sea.setQuery("", false)
loadData() loadData()
} }
}, start, start + action.length, Spannable.SPAN_EXCLUSIVE_EXCLUSIVE }, start, start + action.length, Spannable.SPAN_EXCLUSIVE_EXCLUSIVE
) )
} }
viewBinding.displayView.movementMethod = LinkMovementMethod.getInstance(); viewBinding.displayView.movementMethod = LinkMovementMethod.getInstance()
viewBinding.displayView.highlightColor = Color.parseColor("#36969696"); viewBinding.displayView.highlightColor = Color.parseColor("#36969696")
viewBinding.displayView.text = spannableString viewBinding.displayView.text = spannableString
} }
@ -147,11 +153,26 @@ class CodeTableActivity : BaseActivity<ActivityCodeTableBinding>() {
viewBinding.expandableListView.isVisible = false viewBinding.expandableListView.isVisible = false
viewBinding.progressBar.isVisible = false viewBinding.progressBar.isVisible = false
} }
lateinit var sea: SearchView
override fun onCreateOptionsMenu(menu: Menu): Boolean { override fun onCreateOptionsMenu(menu: Menu): Boolean {
val inflater = menuInflater // val inflater = menuInflater
inflater.inflate(R.menu.menu_code_table, menu) menuInflater.inflate(R.menu.menu_code_table, menu)
val findItem = menu.findItem(R.id.filter_units)
sea = findItem.actionView as SearchView
sea.queryHint = "请输入关键字"
sea.setOnQueryTextListener(object : SearchView.OnQueryTextListener {
override fun onQueryTextSubmit(query: String?): Boolean {
// 在这里执行搜索操作
loadData(query)
return false
}
override fun onQueryTextChange(newText: String?): Boolean {
// 在这里更新搜索结果列表
loadData(newText)
return false
}
})
return true return true
} }
@ -159,6 +180,8 @@ class CodeTableActivity : BaseActivity<ActivityCodeTableBinding>() {
override fun onOptionsItemSelected(item: MenuItem): Boolean { override fun onOptionsItemSelected(item: MenuItem): Boolean {
when (item.itemId) { when (item.itemId) {
R.id.filter_units -> { R.id.filter_units -> {
// editisVisible(true)
/*
InputDialog(this).setTitle(R.string.filter).setMessage(R.string.filter_tip) InputDialog(this).setTitle(R.string.filter).setMessage(R.string.filter_tip)
.setInputCanBeEmpty(false).setMaxNumber(20) .setInputCanBeEmpty(false).setMaxNumber(20)
.setPositiveButton(R.string.dialog_ok) { text -> .setPositiveButton(R.string.dialog_ok) { text ->
@ -170,8 +193,9 @@ class CodeTableActivity : BaseActivity<ActivityCodeTableBinding>() {
true true
}.setNegativeButton(R.string.dialog_close) { }.setNegativeButton(R.string.dialog_close) {
}.show() }.show()*/
} }
android.R.id.home -> { android.R.id.home -> {
ifNeedFinish() ifNeedFinish()
return true return true
@ -180,6 +204,14 @@ class CodeTableActivity : BaseActivity<ActivityCodeTableBinding>() {
return super.onOptionsItemSelected(item) return super.onOptionsItemSelected(item)
} }
override fun onBackPressed() {
if (sea != null && !sea.isIconified) {
sea.isIconified = true
return
}
ifNeedFinish()
}
override fun getViewBindingObject(layoutInflater: LayoutInflater): ActivityCodeTableBinding { override fun getViewBindingObject(layoutInflater: LayoutInflater): ActivityCodeTableBinding {
return ActivityCodeTableBinding.inflate(layoutInflater) return ActivityCodeTableBinding.inflate(layoutInflater)
} }

View File

@ -882,6 +882,7 @@ class FileManagerActivity : BaseActivity<ActivityFileBinding>() {
* 设置排序方式 * 设置排序方式
* @param sortType SortType * @param sortType SortType
*/ */
fun setSortType(sortType: FileManagerViewModel.SortType) { fun setSortType(sortType: FileManagerViewModel.SortType) {
if (this::menuBinding.isInitialized) { if (this::menuBinding.isInitialized) {
when (sortType) { when (sortType) {

View File

@ -1,37 +1,34 @@
package com.coldmint.rust.pro
import com.coldmint.rust.pro.viewmodel.FileManagerViewModel
import java.io.File import java.io.File
import java.util.* import java.util.Collections
class FileSort(a: MutableList<File>, manner: Int) { class FileSort(a: MutableList<File?>,sortType: FileManagerViewModel.SortType) {
val name = 0
val time = 1
val size = 2
val type = 3
//内置的类型排序筛选器数据 可以不用 但是类型排序必须要进行筛选才能正常排序 //内置的类型排序筛选器数据 可以不用 但是类型排序必须要进行筛选才能正常排序
init { init {
when (manner) { when (sortType) {
name -> sort_name(a) FileManagerViewModel.SortType.BY_NAME -> sort_name(a)
time -> sort_time(a) FileManagerViewModel.SortType.BY_LAST_MODIFIED -> sort_time(a)
size -> sort_size(a) FileManagerViewModel.SortType.BY_SIZE -> sort_size(a)
type -> sort_type(a) FileManagerViewModel.SortType.BY_TYPE -> sort_type(a)
} }
sort_front(a)
// println(manner) // println(manner)
//一个内置的排序筛选器 也可以在外部调用 FileSort.sort_front(List<File> a) 等静态的方法 //一个内置的排序筛选器 也可以在外部调用 com.coldmint.rust.pro.FileSort.sort_front(List<File> a) 等静态的方法
} }
companion object { companion object {
//0表示 名称排序 1表示 时间排序 2表示 大小排序 3表示类型排序 //0表示 名称排序 1表示 时间排序 2表示 大小排序 3表示类型排序
lateinit var type_list: Array<String> private fun sort_front(a: MutableList<File?>) {
fun sort_front(a: MutableList<File>) {
Collections.sort(a, kotlin.Comparator { o1, o2 -> Collections.sort(a, kotlin.Comparator { o1, o2 ->
if (o1!!.isDirectory && o2!!.isFile) return@Comparator -1 if (o1!!.isDirectory && o2!!.isFile) return@Comparator -1
if (o1!!.isFile && o2!!.isDirectory) return@Comparator 1 if (o1.isFile && o2!!.isDirectory) return@Comparator 1
else return@Comparator 0 else return@Comparator 0
}) })
} }
//文件夹在前面的排序算法 每次sort_name等排序方法前后或者都会调研次方法 //文件夹在前面的排序算法 每次sort_name等排序方法前后或者都会调研次方法
fun sort_name(a: MutableList<File>) { fun sort_name(a: MutableList<File?>) {
Collections.sort(a, Comparator { o1, o2 -> Collections.sort(a, Comparator { o1, o2 ->
if (o1!!.isDirectory && o2!!.isFile) if (o1!!.isDirectory && o2!!.isFile)
return@Comparator -1 return@Comparator -1
@ -40,59 +37,36 @@ class FileSort(a: MutableList<File>, manner: Int) {
else o1.name.compareTo(o2!!.name) else o1.name.compareTo(o2!!.name)
return@Comparator 0 return@Comparator 0
}) })
sort_front(a)
} }
fun sort_time(a: MutableList<File>) { fun sort_time(a: MutableList<File?>) {
Collections.sort(a, Comparator { f1, f2 -> a.sortWith { f1, f2 ->
val diff = f1!!.lastModified() - f2!!.lastModified() val diff = f1!!.lastModified() - f2!!.lastModified()
if (diff > 0) 1 else if (diff == 0L) 0 else -1 if (diff > 0) 1 else if (diff == 0L) 0 else -1
//如果 if 中修改为 返回-1 同时此处修改为返回 1 排序就会是递减 //如果 if 中修改为 返回-1 同时此处修改为返回 1 排序就会是递减
}) }
sort_front(a)
} }
fun sort_size(a: MutableList<File>) { fun sort_size(a: MutableList<File?>) {
Collections.sort(a, kotlin.Comparator { o1, o2 -> a.sortWith { o1, o2 ->
val diff = o1!!.length() - o2!!.length() val diff = o1!!.length() - o2!!.length()
if (diff > 0) 1 if (diff > 0) 1
else if (diff == 0L) 0 else if (diff == 0L) 0
else -1 else -1
}) }
sort_front(a)
} }
fun sort_type(a: MutableList<File>) { fun sort_type(a: MutableList<File?>) {
//文件类型排序 按照后缀优先级 //文件类型排序 按照后缀优先级
sort_front(a) a.sortWith { o1, o2 ->
//先进行文件夹在前面的排序算法 val extension1 = o1?.extension?.lowercase()
Collections.sort(a, Comparator { o1, o2 -> val extension2 = o2?.extension?.lowercase()
if (o1!!.isFile) { // 定义文件类型的优先级顺序
val name = o1.name val typePriority = listOf("txt", "jpg", "png")
val suffix = name.substring(name.lastIndexOf(".")) val typeIndex1 = typePriority.indexOf(extension1)
//获取name文件名字的后缀 val typeIndex2 = typePriority.indexOf(extension2)
val length = length(type_list, suffix) typeIndex1.compareTo(typeIndex2)
//查找后缀是不是存在于 type_list数据中 如果存在返回存在位置 如果不存在则返回<0的值
if (length >= 0) return@Comparator -1
} else if (o2!!.isFile) {
val name = o2.name
val suffix = name.substring(name.lastIndexOf("."))
//获取name文件名字的后缀
val length = length(type_list, suffix)
//查找后缀是不是存在于 type_list数据中 如果存在返回存在位置 如果不存在则返回<0的值
if (length >= 0) return@Comparator 1
} }
0
})
}
private fun length(sz: Array<String>, a: String): Int {
//引入外部数据sz 去进行筛选让后返回位置
for (i in sz.indices) {
if (sz[i] == a) {
return i
}
}
return -1
} }
} }
} }

View File

@ -1,62 +1,25 @@
package com.coldmint.rust.pro package com.coldmint.rust.pro
import android.annotation.SuppressLint
import android.app.DownloadManager
import android.content.Context
import android.content.Intent import android.content.Intent
import android.net.Uri
import android.os.Bundle import android.os.Bundle
import android.os.Environment import android.os.Environment
import android.util.Log
import android.view.* import android.view.*
import android.view.inputmethod.EditorInfo
import android.widget.EditText
import android.widget.Toast
import androidx.core.app.NotificationManagerCompat
import androidx.core.view.isVisible
import androidx.recyclerview.widget.DividerItemDecoration
import androidx.recyclerview.widget.LinearLayoutManager
import com.afollestad.materialdialogs.LayoutMode
import com.afollestad.materialdialogs.MaterialDialog
import com.afollestad.materialdialogs.bottomsheets.BottomSheet
import com.afollestad.materialdialogs.bottomsheets.setPeekHeight
import com.afollestad.materialdialogs.customview.customView
import com.afollestad.materialdialogs.input.getInputField
import com.afollestad.materialdialogs.input.input
import com.bumptech.glide.Glide
import com.bumptech.glide.request.RequestOptions
import com.coldmint.dialog.CoreDialog import com.coldmint.dialog.CoreDialog
import com.coldmint.rust.core.ModClass
import com.coldmint.rust.core.dataBean.ApiResponse
import com.coldmint.rust.core.dataBean.AppUpdateData import com.coldmint.rust.core.dataBean.AppUpdateData
import com.coldmint.rust.core.dataBean.mod.WebModCommentData
import com.coldmint.rust.core.dataBean.mod.WebModInfoData
import com.coldmint.rust.core.dataBean.mod.WebModUpdateLogData
import com.coldmint.rust.core.dataBean.user.SpaceInfoData
import com.coldmint.rust.core.interfaces.ApiCallBack
import com.coldmint.rust.core.tool.AppOperator import com.coldmint.rust.core.tool.AppOperator
import com.coldmint.rust.core.tool.FileLoader import com.coldmint.rust.core.tool.FileLoader
import com.coldmint.rust.core.tool.LineParser
import com.coldmint.rust.core.tool.ProgressResponseBody import com.coldmint.rust.core.tool.ProgressResponseBody
import com.coldmint.rust.core.web.ServerConfiguration import com.coldmint.rust.core.web.ServerConfiguration
import com.coldmint.rust.core.web.User
import com.coldmint.rust.core.web.WebMod import com.coldmint.rust.core.web.WebMod
import com.coldmint.rust.pro.adapters.CommentAdapter
import com.coldmint.rust.pro.adapters.ModPageDetailsAdapter import com.coldmint.rust.pro.adapters.ModPageDetailsAdapter
import com.coldmint.rust.pro.databinding.ActivityWebModInfoBinding
import com.coldmint.rust.pro.tool.AppSettings
import com.coldmint.rust.pro.base.BaseActivity import com.coldmint.rust.pro.base.BaseActivity
import com.coldmint.rust.pro.databinding.ActivityWebModInfoBinding
import com.coldmint.rust.pro.databinding.LoadFileLayoutBinding import com.coldmint.rust.pro.databinding.LoadFileLayoutBinding
import com.coldmint.rust.pro.dialog.CommentDialog import com.coldmint.rust.pro.tool.AppSettings
import com.coldmint.rust.pro.tool.GlobalMethod import com.coldmint.rust.pro.tool.GlobalMethod
import com.coldmint.rust.pro.tool.TextStyleMaker
import com.google.android.material.appbar.AppBarLayout
import com.google.android.material.snackbar.Snackbar import com.google.android.material.snackbar.Snackbar
import com.google.android.material.tabs.TabLayoutMediator import com.google.android.material.tabs.TabLayoutMediator
import com.google.gson.Gson import com.google.gson.Gson
import com.youth.banner.adapter.BannerImageAdapter
import com.youth.banner.holder.BannerImageHolder
import com.youth.banner.indicator.CircleIndicator
import java.io.File import java.io.File
import java.text.NumberFormat import java.text.NumberFormat

View File

@ -4,15 +4,12 @@ import android.content.Context
import android.util.Log import android.util.Log
import android.view.LayoutInflater import android.view.LayoutInflater
import android.view.ViewGroup import android.view.ViewGroup
import androidx.recyclerview.widget.RecyclerView
import com.bumptech.glide.Glide import com.bumptech.glide.Glide
import com.bumptech.glide.request.RequestOptions
import com.coldmint.dialog.CoreDialog import com.coldmint.dialog.CoreDialog
import com.coldmint.rust.core.dataBean.ApiResponse import com.coldmint.rust.core.dataBean.ApiResponse
import com.coldmint.rust.core.dataBean.mod.WebModCommentData import com.coldmint.rust.core.dataBean.mod.WebModCommentData
import com.coldmint.rust.core.interfaces.ApiCallBack import com.coldmint.rust.core.interfaces.ApiCallBack
import com.coldmint.rust.core.tool.AppOperator import com.coldmint.rust.core.tool.AppOperator
import com.coldmint.rust.core.web.Dynamic
import com.coldmint.rust.core.web.ServerConfiguration import com.coldmint.rust.core.web.ServerConfiguration
import com.coldmint.rust.core.web.WebMod import com.coldmint.rust.core.web.WebMod
import com.coldmint.rust.pro.R import com.coldmint.rust.pro.R
@ -68,12 +65,18 @@ class CommentAdapter(context: Context, dataList: MutableList<WebModCommentData.D
).show() ).show()
} }
viewBinding.shareImageView.setOnClickListener { viewBinding.shareImageView.setOnClickListener {
AppOperator.shareText(context, context.getString(R.string.share_message), data.content); AppOperator.shareText(context, context.getString(R.string.share_message), data.content)
}
viewBinding.contentView.setOnLongClickListener {
GlobalMethod.copyText(context, "", it.rootView)
false
} }
viewBinding.moreImageView.setOnClickListener { view -> viewBinding.moreImageView.setOnClickListener { view ->
val menu = GlobalMethod.createPopMenu(view) val menu = GlobalMethod.createPopMenu(view)
menu.menu.add(R.string.copy) // menu.menu.add(R.string.copy)
menu.menu.add(R.string.delete_title) menu.menu.add(R.string.delete_title)
menu.menu.add(R.string.report)
menu.setOnMenuItemClickListener { menu.setOnMenuItemClickListener {
val title = it.title val title = it.title
when (title) { when (title) {
@ -129,7 +132,15 @@ class CommentAdapter(context: Context, dataList: MutableList<WebModCommentData.D
}.show() }.show()
} }
context.getString(R.string.report) -> {
Snackbar.make(
context,view,
"暂不可用,请等待下一个版本!",
Snackbar.LENGTH_SHORT
).show()
} }
}
true true
} }
menu.show() menu.show()

View File

@ -1,28 +1,20 @@
package com.coldmint.rust.pro.adapters package com.coldmint.rust.pro.adapters
import android.os.Build
import android.view.ViewGroup
import android.view.LayoutInflater
import com.coldmint.rust.pro.R
import android.content.Context import android.content.Context
import com.coldmint.rust.pro.tool.GlobalMethod
import android.content.res.ColorStateList import android.content.res.ColorStateList
import android.graphics.Color import android.view.LayoutInflater
import android.view.View import android.view.ViewGroup
import androidx.core.view.isVisible import androidx.core.view.isVisible
import com.bumptech.glide.Glide import com.bumptech.glide.Glide
import com.coldmint.rust.core.tool.FileOperator import com.coldmint.rust.core.tool.FileOperator
import com.coldmint.rust.core.web.ServerConfiguration import com.coldmint.rust.core.web.ServerConfiguration
import com.coldmint.rust.pro.R
import com.coldmint.rust.pro.base.BaseAdapter import com.coldmint.rust.pro.base.BaseAdapter
import com.coldmint.rust.pro.databinding.FileItemBinding import com.coldmint.rust.pro.databinding.FileItemBinding
import com.coldmint.rust.pro.tool.GlobalMethod
import com.coldmint.rust.pro.viewmodel.FileManagerViewModel import com.coldmint.rust.pro.viewmodel.FileManagerViewModel
import com.github.promeg.pinyinhelper.Pinyin
import com.google.android.material.dialog.MaterialAlertDialogBuilder
import me.zhanghai.android.fastscroll.PopupTextProvider import me.zhanghai.android.fastscroll.PopupTextProvider
import java.io.File import java.io.File
import java.lang.StringBuilder
import java.text.SimpleDateFormat
import java.util.ArrayList
class FileAdapter(context: Context, dataList: MutableList<File?>) : class FileAdapter(context: Context, dataList: MutableList<File?>) :
BaseAdapter<FileItemBinding, File?>(context, dataList), PopupTextProvider { BaseAdapter<FileItemBinding, File?>(context, dataList), PopupTextProvider {
@ -89,6 +81,7 @@ class FileAdapter(context: Context, dataList: MutableList<File?>) :
} }
override fun setNewDataList(dataList: MutableList<File?>) { override fun setNewDataList(dataList: MutableList<File?>) {
// FileSort(dataList, sortType)
when (sortType) { when (sortType) {
FileManagerViewModel.SortType.BY_NAME -> { FileManagerViewModel.SortType.BY_NAME -> {
dataList.sortBy { dataList.sortBy {
@ -125,6 +118,10 @@ class FileAdapter(context: Context, dataList: MutableList<File?>) :
} }
} }
} }
dataList.sortBy {
val name = it?.isFile ?: it?.isDirectory
name
}
super.setNewDataList(dataList) super.setNewDataList(dataList)
} }
@ -139,7 +136,7 @@ class FileAdapter(context: Context, dataList: MutableList<File?>) :
override fun onBingView( override fun onBingView(
data: File?, data: File?,
viewBinding: FileItemBinding, viewBinding: FileItemBinding,
viewHolder: BaseAdapter.ViewHolder<FileItemBinding>, viewHolder: ViewHolder<FileItemBinding>,
position: Int position: Int
) { ) {
if (data == null) { if (data == null) {
@ -173,8 +170,7 @@ class FileAdapter(context: Context, dataList: MutableList<File?>) :
} }
} }
} else { } else {
val type = FileOperator.getFileType(data) when (FileOperator.getFileType(data)) {
when (type) {
"ini", "txt", "template", "log" -> viewBinding.fileIcon.setImageDrawable( "ini", "txt", "template", "log" -> viewBinding.fileIcon.setImageDrawable(
GlobalMethod.tintDrawable( GlobalMethod.tintDrawable(
context.getDrawable(R.drawable.file), context.getDrawable(R.drawable.file),

View File

@ -12,16 +12,12 @@ import android.graphics.Color
import android.graphics.Paint import android.graphics.Paint
import android.graphics.drawable.Drawable import android.graphics.drawable.Drawable
import android.os.Build import android.os.Build
import android.os.Handler
import android.os.Looper
import android.os.Message
import android.util.TypedValue import android.util.TypedValue
import android.view.Gravity import android.view.Gravity
import android.view.View import android.view.View
import android.widget.PopupMenu import android.widget.PopupMenu
import android.widget.TextView import android.widget.TextView
import android.widget.Toast import android.widget.Toast
import androidx.core.content.ContextCompat.getSystemService
import androidx.core.graphics.drawable.DrawableCompat import androidx.core.graphics.drawable.DrawableCompat
import androidx.fragment.app.FragmentActivity import androidx.fragment.app.FragmentActivity
import com.bumptech.glide.load.MultiTransformation import com.bumptech.glide.load.MultiTransformation
@ -36,8 +32,9 @@ import com.flask.colorpicker.builder.ColorPickerDialogBuilder
import com.google.android.material.dialog.MaterialAlertDialogBuilder import com.google.android.material.dialog.MaterialAlertDialogBuilder
import com.google.android.material.snackbar.Snackbar import com.google.android.material.snackbar.Snackbar
import com.permissionx.guolindev.PermissionX import com.permissionx.guolindev.PermissionX
import jp.wasabeef.glide.transformations.* import jp.wasabeef.glide.transformations.BitmapTransformation
import jp.wasabeef.glide.transformations.internal.Utils import jp.wasabeef.glide.transformations.CropCircleTransformation
import jp.wasabeef.glide.transformations.GrayscaleTransformation
/*全局方法类*/ /*全局方法类*/
object GlobalMethod { object GlobalMethod {

View File

@ -1,15 +1,12 @@
package com.coldmint.rust.pro.viewmodel package com.coldmint.rust.pro.viewmodel
import android.content.Context import android.content.Context
import android.content.Intent
import android.net.Uri import android.net.Uri
import android.os.Build import android.os.Build
import android.os.Environment import android.os.Environment
import android.provider.MediaStore import android.provider.MediaStore
import android.util.Log
import androidx.lifecycle.MutableLiveData import androidx.lifecycle.MutableLiveData
import androidx.lifecycle.viewModelScope import androidx.lifecycle.viewModelScope
import com.coldmint.rust.core.tool.AppOperator
import com.coldmint.rust.core.tool.FileOperator import com.coldmint.rust.core.tool.FileOperator
import com.coldmint.rust.pro.R import com.coldmint.rust.pro.R
import com.coldmint.rust.pro.base.BaseViewModel import com.coldmint.rust.pro.base.BaseViewModel
@ -18,7 +15,6 @@ import com.coldmint.rust.pro.tool.BookmarkManager
import com.yalantis.ucrop.util.FileUtils.getPath import com.yalantis.ucrop.util.FileUtils.getPath
import kotlinx.coroutines.launch import kotlinx.coroutines.launch
import java.io.File import java.io.File
import java.util.HashMap
class FileManagerViewModel : BaseViewModel() { class FileManagerViewModel : BaseViewModel() {
@ -59,7 +55,7 @@ class FileManagerViewModel : BaseViewModel() {
} }
/** /**
* 文件排序方式 * 文件排序方式 名称 大小 类型 时间
*/ */
enum class SortType { enum class SortType {
BY_NAME, BY_SIZE, BY_TYPE, BY_LAST_MODIFIED BY_NAME, BY_SIZE, BY_TYPE, BY_LAST_MODIFIED

View File

@ -12,12 +12,10 @@
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:fitsSystemWindows="true"> android:fitsSystemWindows="true">
<com.google.android.material.appbar.MaterialToolbar <com.google.android.material.appbar.MaterialToolbar
android:id="@+id/toolbar" android:id="@+id/toolbar"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="?attr/actionBarSize" /> android:layout_height="?attr/actionBarSize" />
</com.google.android.material.appbar.AppBarLayout> </com.google.android.material.appbar.AppBarLayout>
<LinearLayout <LinearLayout

View File

@ -55,7 +55,7 @@
android:id="@+id/button" android:id="@+id/button"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_gravity="bottom|right" android:layout_gravity="bottom|end"
android:layout_margin="16dp" android:layout_margin="16dp"
android:text="@string/installation" android:text="@string/installation"
app:icon="@drawable/cloud_download" /> app:icon="@drawable/cloud_download" />

View File

@ -1,10 +1,6 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<androidx.swiperefreshlayout.widget.SwipeRefreshLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/swipeRefreshLayout"
android:layout_width="match_parent"
android:layout_height="match_parent">
<LinearLayout <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="match_parent" android:layout_height="match_parent"
android:orientation="vertical"> android:orientation="vertical">
@ -32,11 +28,14 @@
</RelativeLayout> </RelativeLayout>
<androidx.swiperefreshlayout.widget.SwipeRefreshLayout
android:id="@+id/swipeRefreshLayout"
android:layout_width="match_parent"
android:layout_height="match_parent">
<ExpandableListView <ExpandableListView
android:id="@+id/expandableList" android:id="@+id/expandableList"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="match_parent" /> android:layout_height="match_parent" />
</androidx.swiperefreshlayout.widget.SwipeRefreshLayout>
</LinearLayout> </LinearLayout>
</androidx.swiperefreshlayout.widget.SwipeRefreshLayout>

View File

@ -8,8 +8,6 @@
android:paddingHorizontal="16dp" android:paddingHorizontal="16dp"
android:paddingTop="8dp" android:paddingTop="8dp"
tools:context=".fragments.ModCommentsFragment"> tools:context=".fragments.ModCommentsFragment">
<LinearLayout <LinearLayout
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
@ -64,10 +62,6 @@
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:text="@string/no_content" /> android:text="@string/no_content" />
</LinearLayout> </LinearLayout>
</LinearLayout> </LinearLayout>
</androidx.swiperefreshlayout.widget.SwipeRefreshLayout> </androidx.swiperefreshlayout.widget.SwipeRefreshLayout>

View File

@ -55,13 +55,13 @@
android:id="@+id/thumb_up_image_view" android:id="@+id/thumb_up_image_view"
android:layout_width="24dp" android:layout_width="24dp"
android:layout_height="24dp" android:layout_height="24dp"
android:background="?attr/selectableItemBackgroundBorderless"
android:layout_below="@id/contentView" android:layout_below="@id/contentView"
android:layout_marginTop="8dp" android:layout_marginTop="8dp"
android:padding="2dp" android:background="?attr/selectableItemBackgroundBorderless"
android:clickable="true" android:clickable="true"
android:src="@drawable/outline_thumb_up_24" android:focusable="true"
android:focusable="true" /> android:padding="2dp"
android:src="@drawable/outline_thumb_up_24" />
<TextView <TextView
android:id="@+id/thumb_up_text_view" android:id="@+id/thumb_up_text_view"

View File

@ -1,6 +1,10 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<menu xmlns:android="http://schemas.android.com/apk/res/android"> <menu xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:andorid="http://schemas.android.com/tools">
<item <item
android:id="@+id/filter_units" android:id="@+id/filter_units"
android:title="@string/filter" /> android:title="@string/filter"
android:icon="@drawable/ic_search_black_24dp"
android:showAsAction="ifRoom"
android:actionViewClass="android.widget.SearchView"/>
</menu> </menu>

View File

@ -50,8 +50,14 @@
<item <item
android:id="@+id/reloadFile" android:id="@+id/reloadFile"
android:title="@string/reload_files" /> android:title="@string/reload_files" />
<!--
<item
android:id="@+id/app_bar_switch"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:checkable="true"
android:checked="false"
android:title="隐藏文件" />-->
<item <item
android:id="@+id/selectFile" android:id="@+id/selectFile"
android:title="@string/select_file"> android:title="@string/select_file">