优化文件排序方式,移除头像框
This commit is contained in:
parent
e7db8eeedc
commit
e1c2b55a1c
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
|
@ -68,7 +68,7 @@ android {
|
||||||
|
|
||||||
|
|
||||||
dependencies {
|
dependencies {
|
||||||
implementation 'com.luolc:emoji-rain:0.1.1'
|
// implementation 'com.luolc:emoji-rain:0.1.1'
|
||||||
implementation 'me.zhanghai.android.fastscroll:library:1.1.8'
|
implementation 'me.zhanghai.android.fastscroll:library:1.1.8'
|
||||||
// 语种切换框架:https://github.com/getActivity/MultiLanguages
|
// 语种切换框架:https://github.com/getActivity/MultiLanguages
|
||||||
implementation 'com.github.getActivity:MultiLanguages:8.0'
|
implementation 'com.github.getActivity:MultiLanguages:8.0'
|
||||||
|
|
|
@ -111,29 +111,29 @@ class EditUserInfoActivity : BaseActivity<ActivityEditUserInfoBinding>() {
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun initAction() {
|
private fun initAction() {
|
||||||
viewBinding.changeColorButton.setOnClickListener {
|
// viewBinding.changeColorButton.setOnClickListener {
|
||||||
ColorPickerDialogBuilder
|
// ColorPickerDialogBuilder
|
||||||
.with(this)
|
// .with(this)
|
||||||
.setTitle(getString(R.string.choose_color))
|
// .setTitle(getString(R.string.choose_color))
|
||||||
.initialColor(Color.WHITE)
|
// .initialColor(Color.WHITE)
|
||||||
.wheelType(ColorPickerView.WHEEL_TYPE.FLOWER)
|
// .wheelType(ColorPickerView.WHEEL_TYPE.FLOWER)
|
||||||
.density(12)
|
// .density(12)
|
||||||
.setOnColorSelectedListener {
|
// .setOnColorSelectedListener {
|
||||||
//toast("onColorSelected: 0x" + Integer.toHexString(selectedColor));
|
// //toast("onColorSelected: 0x" + Integer.toHexString(selectedColor));
|
||||||
}
|
// }
|
||||||
.setPositiveButton(R.string.dialog_ok) { dialog, selectedColor, allColors ->
|
// .setPositiveButton(R.string.dialog_ok) { dialog, selectedColor, allColors ->
|
||||||
GlobalMethod.temColor = selectedColor
|
// GlobalMethod.temColor = selectedColor
|
||||||
if (iconLink != null) {
|
// if (iconLink != null) {
|
||||||
Glide.with(this@EditUserInfoActivity)
|
// Glide.with(this@EditUserInfoActivity)
|
||||||
.load(iconLink)
|
// .load(iconLink)
|
||||||
.apply(GlobalMethod.getRequestOptions(true, !GlobalMethod.isActive))
|
// .apply(GlobalMethod.getRequestOptions(true, !GlobalMethod.isActive))
|
||||||
.into(viewBinding.iconView)
|
// .into(viewBinding.iconView)
|
||||||
}
|
// }
|
||||||
}
|
// }
|
||||||
.setNegativeButton(R.string.dialog_cancel) { dialog, which -> }
|
// .setNegativeButton(R.string.dialog_cancel) { dialog, which -> }
|
||||||
.build()
|
// .build()
|
||||||
.show()
|
// .show()
|
||||||
}
|
// }
|
||||||
viewBinding.userNameView.addTextChangedListener(object : TextWatcher {
|
viewBinding.userNameView.addTextChangedListener(object : TextWatcher {
|
||||||
override fun beforeTextChanged(s: CharSequence?, start: Int, count: Int, after: Int) {
|
override fun beforeTextChanged(s: CharSequence?, start: Int, count: Int, after: Int) {
|
||||||
|
|
||||||
|
|
|
@ -27,6 +27,7 @@ import com.coldmint.rust.core.tool.FileOperator
|
||||||
import com.coldmint.rust.pro.adapters.FileAdapter
|
import com.coldmint.rust.pro.adapters.FileAdapter
|
||||||
import com.coldmint.rust.pro.databinding.ActivityFileBinding
|
import com.coldmint.rust.pro.databinding.ActivityFileBinding
|
||||||
import com.coldmint.rust.pro.interfaces.BookmarkListener
|
import com.coldmint.rust.pro.interfaces.BookmarkListener
|
||||||
|
import com.coldmint.rust.pro.tool.AppSettings
|
||||||
import com.coldmint.rust.pro.viewmodel.FileManagerViewModel
|
import com.coldmint.rust.pro.viewmodel.FileManagerViewModel
|
||||||
import com.google.android.material.dialog.MaterialAlertDialogBuilder
|
import com.google.android.material.dialog.MaterialAlertDialogBuilder
|
||||||
import me.zhanghai.android.fastscroll.FastScrollerBuilder
|
import me.zhanghai.android.fastscroll.FastScrollerBuilder
|
||||||
|
@ -899,6 +900,7 @@ class FileManagerActivity : BaseActivity<ActivityFileBinding>() {
|
||||||
viewBinding.swipeRefreshLayout.isRefreshing = false
|
viewBinding.swipeRefreshLayout.isRefreshing = false
|
||||||
}
|
}
|
||||||
viewModel.loadFiles()
|
viewModel.loadFiles()
|
||||||
|
viewModel.loadSortType(this)
|
||||||
} else {
|
} else {
|
||||||
val bundle = intent.getBundleExtra("data")
|
val bundle = intent.getBundleExtra("data")
|
||||||
if (bundle == null) {
|
if (bundle == null) {
|
||||||
|
@ -917,9 +919,14 @@ class FileManagerActivity : BaseActivity<ActivityFileBinding>() {
|
||||||
|
|
||||||
override fun onCreateOptionsMenu(menu: Menu): Boolean {
|
override fun onCreateOptionsMenu(menu: Menu): Boolean {
|
||||||
menuBinding = MenuBinding.inflate(menu, menuInflater)
|
menuBinding = MenuBinding.inflate(menu, menuInflater)
|
||||||
|
val value = viewModel.sortTypeLiveData.value
|
||||||
|
if (value != null) {
|
||||||
|
setSortType(value)
|
||||||
|
}
|
||||||
return true
|
return true
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 加载观察者
|
* 加载观察者
|
||||||
*/
|
*/
|
||||||
|
@ -930,6 +937,9 @@ class FileManagerActivity : BaseActivity<ActivityFileBinding>() {
|
||||||
viewBinding.fileError.isVisible = it
|
viewBinding.fileError.isVisible = it
|
||||||
viewBinding.progressBar.isVisible = it
|
viewBinding.progressBar.isVisible = it
|
||||||
}
|
}
|
||||||
|
viewModel.sortTypeLiveData.observe(this) {
|
||||||
|
setSortType(it)
|
||||||
|
}
|
||||||
viewModel.fileListLiveData.observe(this) {
|
viewModel.fileListLiveData.observe(this) {
|
||||||
if (adapter == null) {
|
if (adapter == null) {
|
||||||
//创建实例(设置适配器)
|
//创建实例(设置适配器)
|
||||||
|
@ -957,6 +967,34 @@ class FileManagerActivity : BaseActivity<ActivityFileBinding>() {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 设置排序方式
|
||||||
|
* @param sortType SortType
|
||||||
|
*/
|
||||||
|
fun setSortType(sortType: FileManagerViewModel.SortType) {
|
||||||
|
if (this::menuBinding.isInitialized) {
|
||||||
|
when (sortType) {
|
||||||
|
FileManagerViewModel.SortType.BY_NAME -> {
|
||||||
|
menuBinding.actionSortByName.isChecked = true
|
||||||
|
}
|
||||||
|
FileManagerViewModel.SortType.BY_SIZE -> {
|
||||||
|
menuBinding.actionSortBySize.isChecked = true
|
||||||
|
}
|
||||||
|
FileManagerViewModel.SortType.BY_LAST_MODIFIED -> {
|
||||||
|
menuBinding.actionSortByLastModified.isChecked = true
|
||||||
|
}
|
||||||
|
FileManagerViewModel.SortType.BY_TYPE -> {
|
||||||
|
menuBinding.actionSortByType.isChecked = true
|
||||||
|
}
|
||||||
|
else -> {
|
||||||
|
menuBinding.actionSortByName.isChecked = true
|
||||||
|
}
|
||||||
|
}
|
||||||
|
adapter?.setSort(sortType)
|
||||||
|
viewModel.loadFiles(viewModel.getCurrentPath())
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 加载页面标题
|
* 加载页面标题
|
||||||
*/
|
*/
|
||||||
|
@ -980,7 +1018,10 @@ class FileManagerActivity : BaseActivity<ActivityFileBinding>() {
|
||||||
val menu: Menu,
|
val menu: Menu,
|
||||||
val reloadFileItem: MenuItem,
|
val reloadFileItem: MenuItem,
|
||||||
val photoAlbumItem: MenuItem,
|
val photoAlbumItem: MenuItem,
|
||||||
val systemFileManagerItem: MenuItem
|
val systemFileManagerItem: MenuItem,
|
||||||
|
val actionSortByName: MenuItem,
|
||||||
|
val actionSortByType: MenuItem,
|
||||||
|
val actionSortBySize: MenuItem, val actionSortByLastModified: MenuItem
|
||||||
) {
|
) {
|
||||||
companion object {
|
companion object {
|
||||||
//填充
|
//填充
|
||||||
|
@ -990,7 +1031,11 @@ class FileManagerActivity : BaseActivity<ActivityFileBinding>() {
|
||||||
menu,
|
menu,
|
||||||
menu.findItem(R.id.reloadFile),
|
menu.findItem(R.id.reloadFile),
|
||||||
menu.findItem(R.id.photo_album),
|
menu.findItem(R.id.photo_album),
|
||||||
menu.findItem(R.id.system_file_manager)
|
menu.findItem(R.id.system_file_manager),
|
||||||
|
menu.findItem(R.id.action_sort_by_name),
|
||||||
|
menu.findItem(R.id.action_sort_by_type),
|
||||||
|
menu.findItem(R.id.action_sort_by_size),
|
||||||
|
menu.findItem(R.id.action_sort_by_last_modified)
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -90,10 +90,10 @@ class UserHomePageActivity : BaseActivity<ActivityUserHomePageBinding>() {
|
||||||
// }
|
// }
|
||||||
// viewBinding.bubbleView.setDrawableList(dlist)
|
// viewBinding.bubbleView.setDrawableList(dlist)
|
||||||
// viewBinding.bubbleView.startAnimation(5000, 5000,30)
|
// viewBinding.bubbleView.startAnimation(5000, 5000,30)
|
||||||
viewBinding.emojiRainLayout.addEmoji(R.drawable.emoji_1_3)
|
// viewBinding.emojiRainLayout.addEmoji(R.drawable.emoji_1_3)
|
||||||
viewBinding.emojiRainLayout.addEmoji(R.drawable.emoji_2_3)
|
// viewBinding.emojiRainLayout.addEmoji(R.drawable.emoji_2_3)
|
||||||
viewBinding.emojiRainLayout.addEmoji(R.drawable.emoji_3_3)
|
// viewBinding.emojiRainLayout.addEmoji(R.drawable.emoji_3_3)
|
||||||
viewBinding.emojiRainLayout.startDropping()
|
// viewBinding.emojiRainLayout.startDropping()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -12,8 +12,10 @@ import android.view.View
|
||||||
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.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.viewmodel.FileManagerViewModel
|
||||||
import com.github.promeg.pinyinhelper.Pinyin
|
import com.github.promeg.pinyinhelper.Pinyin
|
||||||
import com.google.android.material.dialog.MaterialAlertDialogBuilder
|
import com.google.android.material.dialog.MaterialAlertDialogBuilder
|
||||||
import me.zhanghai.android.fastscroll.PopupTextProvider
|
import me.zhanghai.android.fastscroll.PopupTextProvider
|
||||||
|
@ -42,6 +44,8 @@ class FileAdapter(private val context: Context, dataList: MutableList<File?>) :
|
||||||
private set
|
private set
|
||||||
|
|
||||||
|
|
||||||
|
private var sortType: FileManagerViewModel.SortType = FileManagerViewModel.SortType.BY_NAME
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 清除选中目录
|
* 清除选中目录
|
||||||
*/
|
*/
|
||||||
|
@ -76,10 +80,50 @@ class FileAdapter(private val context: Context, dataList: MutableList<File?>) :
|
||||||
// }
|
// }
|
||||||
// }
|
// }
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 设置排序方式
|
||||||
|
* @param sortType SortType
|
||||||
|
*/
|
||||||
|
fun setSort(sortType: FileManagerViewModel.SortType) {
|
||||||
|
this.sortType = sortType
|
||||||
|
}
|
||||||
|
|
||||||
override fun setNewDataList(dataList: MutableList<File?>) {
|
override fun setNewDataList(dataList: MutableList<File?>) {
|
||||||
dataList.sortBy {
|
when (sortType) {
|
||||||
val name = it?.name ?: "#"
|
FileManagerViewModel.SortType.BY_NAME -> {
|
||||||
getInitial(name)
|
dataList.sortBy {
|
||||||
|
val name = it?.name ?: "#"
|
||||||
|
getInitial(name)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
FileManagerViewModel.SortType.BY_SIZE -> {
|
||||||
|
dataList.sortBy {
|
||||||
|
val size = it?.length() ?: 0.toLong()
|
||||||
|
size
|
||||||
|
}
|
||||||
|
}
|
||||||
|
FileManagerViewModel.SortType.BY_TYPE -> {
|
||||||
|
dataList.sortBy {
|
||||||
|
val type = if (it != null) {
|
||||||
|
FileOperator.getFileType(it)
|
||||||
|
} else {
|
||||||
|
"#"
|
||||||
|
}
|
||||||
|
type
|
||||||
|
}
|
||||||
|
}
|
||||||
|
FileManagerViewModel.SortType.BY_LAST_MODIFIED -> {
|
||||||
|
dataList.sortBy {
|
||||||
|
val lastModified = it?.lastModified() ?: 0.toLong()
|
||||||
|
lastModified
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else -> {
|
||||||
|
dataList.sortBy {
|
||||||
|
val name = it?.name ?: "#"
|
||||||
|
getInitial(name)
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
super.setNewDataList(dataList)
|
super.setNewDataList(dataList)
|
||||||
}
|
}
|
||||||
|
@ -161,7 +205,32 @@ class FileAdapter(private val context: Context, dataList: MutableList<File?>) :
|
||||||
|
|
||||||
override fun getPopupText(position: Int): String {
|
override fun getPopupText(position: Int): String {
|
||||||
val file = dataList[position]
|
val file = dataList[position]
|
||||||
val name = file?.name ?: "#"
|
val data = when (sortType) {
|
||||||
return getInitial(name).toString()
|
FileManagerViewModel.SortType.BY_NAME -> {
|
||||||
|
val name = file?.name ?: "#"
|
||||||
|
getInitial(name)
|
||||||
|
}
|
||||||
|
FileManagerViewModel.SortType.BY_SIZE -> {
|
||||||
|
val size = file?.length() ?: 0.toLong()
|
||||||
|
size
|
||||||
|
}
|
||||||
|
FileManagerViewModel.SortType.BY_TYPE -> {
|
||||||
|
val type = if (file != null) {
|
||||||
|
FileOperator.getFileType(file)
|
||||||
|
} else {
|
||||||
|
"#"
|
||||||
|
}
|
||||||
|
type
|
||||||
|
}
|
||||||
|
FileManagerViewModel.SortType.BY_LAST_MODIFIED -> {
|
||||||
|
val lastModified = file?.lastModified() ?: 0.toLong()
|
||||||
|
ServerConfiguration.toStringTime(lastModified)
|
||||||
|
}
|
||||||
|
else -> {
|
||||||
|
val name = file?.name ?: "#"
|
||||||
|
getInitial(name)
|
||||||
|
}
|
||||||
|
}.toString()
|
||||||
|
return data
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -44,7 +44,7 @@ class AppSettings private constructor(val mContext: Context) {
|
||||||
private val editor: SharedPreferences.Editor = sharedPreferences.edit()
|
private val editor: SharedPreferences.Editor = sharedPreferences.edit()
|
||||||
|
|
||||||
enum class Setting {
|
enum class Setting {
|
||||||
DatabaseDirectory, DatabasePath, TemplateDirectory, AppLanguage, DeveloperMode, CustomSymbol, AutoCreateNomedia, OnlyLoadConantLanguageTemple, NightMode, GamePackage, KeepRwmodFile, EnableRecoveryStation, RecoveryStationFileSaveDays, RecoveryStationFolder, IndependentFolder, SetGameStorage, PackDirectory, IdentifiersPromptNumber, UserName, UseJetBrainsMonoFont, AppID, Account, PassWord, ExpirationTime, CheckBetaUpdate, UpdateData, ShareTip, AgreePolicy, EnglishEditingMode, NightModeFollowSystem, UseMobileNetwork, MapFolder, ModFolder, UseTheCommunityAsTheLaunchPage, AutoSave, ServerAddress, Token, LoginStatus, DynamicColor, ExperiencePlan
|
DatabaseDirectory, DatabasePath, TemplateDirectory, AppLanguage, DeveloperMode, CustomSymbol, AutoCreateNomedia, OnlyLoadConantLanguageTemple, NightMode, GamePackage, KeepRwmodFile, EnableRecoveryStation, RecoveryStationFileSaveDays, RecoveryStationFolder, IndependentFolder, SetGameStorage, PackDirectory, IdentifiersPromptNumber, UserName, UseJetBrainsMonoFont, AppID, Account, PassWord, ExpirationTime, CheckBetaUpdate, UpdateData, ShareTip, AgreePolicy, EnglishEditingMode, NightModeFollowSystem, UseMobileNetwork, MapFolder, ModFolder, UseTheCommunityAsTheLaunchPage, AutoSave, ServerAddress, Token, LoginStatus, DynamicColor, ExperiencePlan, FileSortType
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -289,7 +289,8 @@ class AppSettings private constructor(val mContext: Context) {
|
||||||
map[Setting.AutoSave] = mContext.getString(R.string.setting_auto_save)
|
map[Setting.AutoSave] = mContext.getString(R.string.setting_auto_save)
|
||||||
map[Setting.ServerAddress] = mContext.getString(R.string.setting_server_address)
|
map[Setting.ServerAddress] = mContext.getString(R.string.setting_server_address)
|
||||||
map[Setting.DynamicColor] = mContext.getString(R.string.setting_dynamic_color)
|
map[Setting.DynamicColor] = mContext.getString(R.string.setting_dynamic_color)
|
||||||
map[Setting.ExperiencePlan] = mContext.getString(R.string.experience_the_plan)
|
map[Setting.ExperiencePlan] = mContext.getString(R.string.setting_experience_the_plan)
|
||||||
|
map[Setting.FileSortType] = mContext.getString(R.string.setting_file_sort_type)
|
||||||
//仅保存不可显示
|
//仅保存不可显示
|
||||||
map[Setting.SetGameStorage] = "SetGameStorage"
|
map[Setting.SetGameStorage] = "SetGameStorage"
|
||||||
map[Setting.AppID] = "AppId"
|
map[Setting.AppID] = "AppId"
|
||||||
|
|
|
@ -42,7 +42,6 @@ object GlobalMethod {
|
||||||
const val DEFAULT_GAME_PACKAGE = "com.corrodinggames.rts"
|
const val DEFAULT_GAME_PACKAGE = "com.corrodinggames.rts"
|
||||||
const val DEBUG_SIGN = "963dfd616924b27f9247a35e45bc130a"
|
const val DEBUG_SIGN = "963dfd616924b27f9247a35e45bc130a"
|
||||||
const val RELEASE_SIGN = "5320b24894fe7ed449842a81a2dfceda"
|
const val RELEASE_SIGN = "5320b24894fe7ed449842a81a2dfceda"
|
||||||
var temColor = Color.RED
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -53,7 +52,7 @@ object GlobalMethod {
|
||||||
//变换列表
|
//变换列表
|
||||||
val transformations = ArrayList<BitmapTransformation>()
|
val transformations = ArrayList<BitmapTransformation>()
|
||||||
if (circleCrop) {
|
if (circleCrop) {
|
||||||
transformations.add(CropCircleWithBorderTransformation(Utils.toDp(4), temColor))
|
transformations.add(CropCircleTransformation())
|
||||||
}
|
}
|
||||||
if (grayscale) {
|
if (grayscale) {
|
||||||
transformations.add(GrayscaleTransformation())
|
transformations.add(GrayscaleTransformation())
|
||||||
|
|
|
@ -1,11 +1,15 @@
|
||||||
package com.coldmint.rust.pro.viewmodel
|
package com.coldmint.rust.pro.viewmodel
|
||||||
|
|
||||||
|
import android.content.Context
|
||||||
import android.os.Environment
|
import android.os.Environment
|
||||||
import android.util.Log
|
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.base.BaseViewModel
|
import com.coldmint.rust.pro.base.BaseViewModel
|
||||||
|
import com.coldmint.rust.pro.tool.AppSettings
|
||||||
import kotlinx.coroutines.launch
|
import kotlinx.coroutines.launch
|
||||||
import java.io.File
|
import java.io.File
|
||||||
|
|
||||||
|
@ -19,6 +23,13 @@ class FileManagerViewModel : BaseViewModel() {
|
||||||
DEFAULT, SELECT_DIRECTORY, EXPORT_FILE, SELECT_FILE
|
DEFAULT, SELECT_DIRECTORY, EXPORT_FILE, SELECT_FILE
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 文件排序方式
|
||||||
|
*/
|
||||||
|
enum class SortType {
|
||||||
|
BY_NAME, BY_SIZE, BY_TYPE, BY_LAST_MODIFIED
|
||||||
|
}
|
||||||
|
|
||||||
private var directs = Environment.getExternalStorageDirectory().absolutePath
|
private var directs = Environment.getExternalStorageDirectory().absolutePath
|
||||||
|
|
||||||
//根目录
|
//根目录
|
||||||
|
@ -31,6 +42,41 @@ class FileManagerViewModel : BaseViewModel() {
|
||||||
MutableLiveData(rootPath)
|
MutableLiveData(rootPath)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 文件排序方式
|
||||||
|
*/
|
||||||
|
val sortTypeLiveData: MutableLiveData<SortType> by lazy {
|
||||||
|
MutableLiveData(SortType.BY_NAME)
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 从设置中读取排序方式
|
||||||
|
*/
|
||||||
|
fun loadSortType(context: Context) {
|
||||||
|
val appSettings = AppSettings.getInstance(context)
|
||||||
|
//从设置中读取排序方式
|
||||||
|
val sortType = appSettings.getValue(
|
||||||
|
AppSettings.Setting.FileSortType,
|
||||||
|
context.getString(R.string.setting_file_list_action_sort_by_name)
|
||||||
|
)
|
||||||
|
when (sortType) {
|
||||||
|
context.getString(R.string.setting_file_list_action_sort_by_name) -> {
|
||||||
|
sortTypeLiveData.value = SortType.BY_NAME
|
||||||
|
}
|
||||||
|
context.getString(R.string.setting_file_list_action_sort_by_last_modified) -> {
|
||||||
|
sortTypeLiveData.value = SortType.BY_LAST_MODIFIED
|
||||||
|
}
|
||||||
|
context.getString(R.string.setting_file_list_action_sort_by_size) -> {
|
||||||
|
sortTypeLiveData.value = SortType.BY_SIZE
|
||||||
|
}
|
||||||
|
context.getString(R.string.setting_file_list_action_sort_by_type) -> {
|
||||||
|
sortTypeLiveData.value = SortType.BY_TYPE
|
||||||
|
}
|
||||||
|
else -> {
|
||||||
|
sortTypeLiveData.value = SortType.BY_NAME
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 获取当前打开的目录
|
* 获取当前打开的目录
|
||||||
|
@ -40,6 +86,7 @@ class FileManagerViewModel : BaseViewModel() {
|
||||||
return currentPathLiveData.value ?: rootPath
|
return currentPathLiveData.value ?: rootPath
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 加载状态
|
* 加载状态
|
||||||
*/
|
*/
|
||||||
|
|
|
@ -241,6 +241,7 @@ class StartViewModel(application: Application) : BaseAndroidViewModel(applicatio
|
||||||
appSettings.initSetting(AppSettings.Setting.AutoSave, true)
|
appSettings.initSetting(AppSettings.Setting.AutoSave, true)
|
||||||
appSettings.initSetting(AppSettings.Setting.AgreePolicy, false)
|
appSettings.initSetting(AppSettings.Setting.AgreePolicy, false)
|
||||||
appSettings.initSetting(AppSettings.Setting.LoginStatus, false)
|
appSettings.initSetting(AppSettings.Setting.LoginStatus, false)
|
||||||
|
appSettings.initSetting(AppSettings.Setting.FileSortType,context.getString(R.string.setting_file_list_action_sort_by_name))
|
||||||
//如果启用动态颜色
|
//如果启用动态颜色
|
||||||
appSettings.initSetting(
|
appSettings.initSetting(
|
||||||
AppSettings.Setting.DynamicColor,
|
AppSettings.Setting.DynamicColor,
|
||||||
|
|
|
@ -139,26 +139,26 @@
|
||||||
</com.google.android.material.textfield.TextInputLayout>
|
</com.google.android.material.textfield.TextInputLayout>
|
||||||
|
|
||||||
|
|
||||||
<RelativeLayout
|
<!-- <RelativeLayout-->
|
||||||
android:layout_width="match_parent"
|
<!-- android:layout_width="match_parent"-->
|
||||||
android:layout_height="wrap_content"
|
<!-- android:layout_height="wrap_content"-->
|
||||||
android:layout_marginTop="8dp">
|
<!-- android:layout_marginTop="8dp">-->
|
||||||
|
|
||||||
<TextView
|
<!-- <TextView-->
|
||||||
android:layout_width="wrap_content"
|
<!-- android:layout_width="wrap_content"-->
|
||||||
android:layout_height="wrap_content"
|
<!-- android:layout_height="wrap_content"-->
|
||||||
android:layout_centerVertical="true"
|
<!-- android:layout_centerVertical="true"-->
|
||||||
android:text="@string/profile_picture_box_color" />
|
<!-- android:text="@string/profile_picture_box_color" />-->
|
||||||
|
|
||||||
<Button
|
<!-- <Button-->
|
||||||
android:id="@+id/changeColorButton"
|
<!-- android:id="@+id/changeColorButton"-->
|
||||||
style="@style/Widget.Material3.Button.OutlinedButton"
|
<!-- style="@style/Widget.Material3.Button.OutlinedButton"-->
|
||||||
android:layout_width="wrap_content"
|
<!-- android:layout_width="wrap_content"-->
|
||||||
android:layout_height="wrap_content"
|
<!-- android:layout_height="wrap_content"-->
|
||||||
android:layout_alignParentEnd="true"
|
<!-- android:layout_alignParentEnd="true"-->
|
||||||
android:text="@string/choose_color" />
|
<!-- android:text="@string/choose_color" />-->
|
||||||
|
|
||||||
</RelativeLayout>
|
<!-- </RelativeLayout>-->
|
||||||
|
|
||||||
<LinearLayout
|
<LinearLayout
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
|
|
|
@ -254,10 +254,6 @@
|
||||||
android:layout_height="match_parent"
|
android:layout_height="match_parent"
|
||||||
app:layout_behavior="com.google.android.material.appbar.AppBarLayout$ScrollingViewBehavior" />
|
app:layout_behavior="com.google.android.material.appbar.AppBarLayout$ScrollingViewBehavior" />
|
||||||
|
|
||||||
<com.luolc.emojirain.EmojiRainLayout
|
|
||||||
android:id="@+id/emojiRainLayout"
|
|
||||||
android:layout_width="match_parent"
|
|
||||||
android:layout_height="match_parent"/>
|
|
||||||
|
|
||||||
<com.google.android.material.floatingactionbutton.FloatingActionButton
|
<com.google.android.material.floatingactionbutton.FloatingActionButton
|
||||||
android:id="@+id/fab"
|
android:id="@+id/fab"
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
<!-- 语言条目 -->
|
<!-- 语言条目 -->
|
||||||
<string-array name="language_entries">
|
<string-array name="language_entries">
|
||||||
<item>简体中文</item>
|
<item>简体中文</item>
|
||||||
<!-- <item>繁體中文</item>-->
|
<!-- <item>繁體中文</item>-->
|
||||||
<item>English</item>
|
<item>English</item>
|
||||||
<item>日本語</item>
|
<item>日本語</item>
|
||||||
<item>Россия</item>
|
<item>Россия</item>
|
||||||
|
@ -10,12 +10,25 @@
|
||||||
|
|
||||||
<string-array name="language_values">
|
<string-array name="language_values">
|
||||||
<item>zh</item>
|
<item>zh</item>
|
||||||
<!-- <item>zh_TW</item>-->
|
<!-- <item>zh_TW</item>-->
|
||||||
<item>en</item>
|
<item>en</item>
|
||||||
<item>ja</item>
|
<item>ja</item>
|
||||||
<item>ru</item>
|
<item>ru</item>
|
||||||
</string-array>
|
</string-array>
|
||||||
|
|
||||||
|
<string-array name="file_sort_entries">
|
||||||
|
<item>@string/file_list_action_sort_by_name</item>
|
||||||
|
<item>@string/file_list_action_sort_by_type</item>
|
||||||
|
<item>@string/file_list_action_sort_by_size</item>
|
||||||
|
<item>@string/file_list_action_sort_by_last_modified</item>
|
||||||
|
</string-array>
|
||||||
|
<string-array name="file_sort_values">
|
||||||
|
<item>@string/setting_file_list_action_sort_by_name</item>
|
||||||
|
<item>@string/setting_file_list_action_sort_by_type</item>
|
||||||
|
<item>@string/setting_file_list_action_sort_by_size</item>
|
||||||
|
<item>@string/setting_file_list_action_sort_by_last_modified</item>
|
||||||
|
</string-array>
|
||||||
|
|
||||||
<string-array name="update_type_entries">
|
<string-array name="update_type_entries">
|
||||||
<item>@string/web_link</item>
|
<item>@string/web_link</item>
|
||||||
<item>@string/qq_group</item>
|
<item>@string/qq_group</item>
|
||||||
|
@ -26,7 +39,7 @@
|
||||||
<item>@string/text_head_additional</item>
|
<item>@string/text_head_additional</item>
|
||||||
<item>@string/text_tail_additional</item>
|
<item>@string/text_tail_additional</item>
|
||||||
</string-array>
|
</string-array>
|
||||||
|
|
||||||
<string-array name="pay_type_entries">
|
<string-array name="pay_type_entries">
|
||||||
<item>@string/wechat_pay</item>
|
<item>@string/wechat_pay</item>
|
||||||
<item>@string/alipay</item>
|
<item>@string/alipay</item>
|
||||||
|
|
|
@ -855,7 +855,13 @@
|
||||||
<string name="file_list_action_sort_by_type">类型</string>
|
<string name="file_list_action_sort_by_type">类型</string>
|
||||||
<string name="file_list_action_sort_by_size">大小</string>
|
<string name="file_list_action_sort_by_size">大小</string>
|
||||||
<string name="file_list_action_sort_by_last_modified">修改时间</string>
|
<string name="file_list_action_sort_by_last_modified">修改时间</string>
|
||||||
|
<string name="setting_file_list_action_sort_by_name" translatable="false">ByName</string>
|
||||||
|
<string name="setting_file_list_action_sort_by_type" translatable="false">ByType</string>
|
||||||
|
<string name="setting_file_list_action_sort_by_size" translatable="false">BySize</string>
|
||||||
|
<string name="setting_file_list_action_sort_by_last_modified" translatable="false">ByLastModified</string>
|
||||||
|
<string name="file_sort_type">文件排序方式</string>
|
||||||
|
<string name="setting_file_sort_type" translatable="false">FileSortType</string>
|
||||||
<!-- <string name="search_suggestions_null">无搜索建议。</string>-->
|
<!-- <string name="search_suggestions_null">无搜索建议。</string>-->
|
||||||
<!-- <string name="search_suggestions_number">共%1$d个搜索建议。</string>-->
|
<!-- <string name="search_suggestions_number">共%1$d个搜索建议。</string>-->
|
||||||
|
|
||||||
</resources>
|
</resources>
|
|
@ -5,7 +5,7 @@
|
||||||
<PreferenceCategory app:title="@string/messages_header">
|
<PreferenceCategory app:title="@string/messages_header">
|
||||||
|
|
||||||
<rikka.preference.SimpleMenuPreference
|
<rikka.preference.SimpleMenuPreference
|
||||||
app:defaultValue="简体中文"
|
app:defaultValue="zh"
|
||||||
app:entries="@array/language_entries"
|
app:entries="@array/language_entries"
|
||||||
app:entryValues="@array/language_values"
|
app:entryValues="@array/language_values"
|
||||||
app:key="@string/setting_app_language"
|
app:key="@string/setting_app_language"
|
||||||
|
@ -45,6 +45,15 @@
|
||||||
app:summary="@string/use_the_community_as_the_launch_page_tip" />
|
app:summary="@string/use_the_community_as_the_launch_page_tip" />
|
||||||
</PreferenceCategory>
|
</PreferenceCategory>
|
||||||
|
|
||||||
|
<PreferenceCategory android:title="@string/file_manager">
|
||||||
|
<rikka.preference.SimpleMenuPreference
|
||||||
|
app:entries="@array/file_sort_entries"
|
||||||
|
app:entryValues="@array/file_sort_values"
|
||||||
|
app:key="@string/setting_file_sort_type"
|
||||||
|
app:title="@string/file_sort_type"
|
||||||
|
app:useSimpleSummaryProvider="true" />
|
||||||
|
</PreferenceCategory>
|
||||||
|
|
||||||
<PreferenceCategory android:title="@string/data_transfer">
|
<PreferenceCategory android:title="@string/data_transfer">
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -2,4 +2,5 @@
|
||||||
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
|
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
package="com.coldmint.rust.core">
|
package="com.coldmint.rust.core">
|
||||||
|
|
||||||
|
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
|
||||||
</manifest>
|
</manifest>
|
|
@ -75,6 +75,9 @@ object ServerConfiguration {
|
||||||
(-2).toLong() -> {
|
(-2).toLong() -> {
|
||||||
ForeverTime
|
ForeverTime
|
||||||
}
|
}
|
||||||
|
(0).toLong() -> {
|
||||||
|
"#"
|
||||||
|
}
|
||||||
else -> {
|
else -> {
|
||||||
val formatter = SimpleDateFormat("yyyy-MM-dd HH:mm:ss")
|
val formatter = SimpleDateFormat("yyyy-MM-dd HH:mm:ss")
|
||||||
formatter.format(longTime)
|
formatter.format(longTime)
|
||||||
|
|
Loading…
Reference in New Issue
Block a user