feat(app): 添加相册快捷入口并优化文件管理功能
- 在菜单栏添加相册快捷入口,提高用户体验 - 移除冗余代码,优化文件管理活动- 更新菜单资源,增加相册快捷项 - 添加相册图标资源 - 修正版权年份为动态显示
This commit is contained in:
parent
a0baf28cd2
commit
3f9b2484bb
|
@ -70,9 +70,8 @@ class AboutActivity : BaseActivity<ActivityAboutBinding>() {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun getViewBindingObject(layoutInflater: LayoutInflater): ActivityAboutBinding {
|
override fun getViewBindingObject(layoutInflater: LayoutInflater): ActivityAboutBinding =
|
||||||
return ActivityAboutBinding.inflate(layoutInflater)
|
ActivityAboutBinding.inflate(layoutInflater)
|
||||||
}
|
|
||||||
|
|
||||||
override fun whenCreateActivity(savedInstanceState: Bundle?, canUseView: Boolean) {
|
override fun whenCreateActivity(savedInstanceState: Bundle?, canUseView: Boolean) {
|
||||||
if (canUseView) {
|
if (canUseView) {
|
||||||
|
|
|
@ -41,128 +41,30 @@ import java.io.File
|
||||||
class FileManagerActivity : BaseActivity<ActivityFileBinding>() {
|
class FileManagerActivity : BaseActivity<ActivityFileBinding>() {
|
||||||
|
|
||||||
|
|
||||||
//
|
|
||||||
// /**
|
|
||||||
// * 编辑模板
|
|
||||||
// * @param file File
|
|
||||||
// */
|
|
||||||
// fun editTemplate(file: File) {
|
|
||||||
// val intent = Intent(this, TemplateMakerActivity::class.java)
|
|
||||||
// val bundle = Bundle()
|
|
||||||
// intent.putExtra("data", bundle)
|
|
||||||
// bundle.putString("path", file.absolutePath)
|
|
||||||
// bundle.putBoolean("loadTemplate", true)
|
|
||||||
// bundle.putString("templatePath", additionalData)
|
|
||||||
// startActivity(intent)
|
|
||||||
// }
|
|
||||||
//
|
|
||||||
// /**
|
|
||||||
// * 编辑文本
|
|
||||||
// * @param file File
|
|
||||||
// */
|
|
||||||
// fun editText(file: File) {
|
|
||||||
// val bundle = Bundle()
|
|
||||||
// bundle.putString("path", file.absolutePath)
|
|
||||||
// bundle.putString(
|
|
||||||
// "modPath",
|
|
||||||
// FileOperator.getSuperDirectory(file)
|
|
||||||
// )
|
|
||||||
// val intent = Intent(
|
|
||||||
// this@FileManagerActivity,
|
|
||||||
// EditActivity::class.java
|
|
||||||
// )
|
|
||||||
// intent.putExtra("data", bundle)
|
|
||||||
// this@FileManagerActivity.startActivity(intent)
|
|
||||||
// }
|
|
||||||
|
|
||||||
// override fun onPause() {
|
|
||||||
// viewModel.getBookmarkManager().save()
|
|
||||||
// super.onPause()
|
|
||||||
// }
|
|
||||||
|
|
||||||
override fun onResume() {
|
override fun onResume() {
|
||||||
viewModel.getBookmarkManager().load()
|
viewModel.getBookmarkManager().load()
|
||||||
loadMineBookmarksMenu()
|
loadMineBookmarksMenu()
|
||||||
super.onResume()
|
super.onResume()
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun onActivityResult(requestCode: Int, resultCode: Int, data: Intent?) {
|
|
||||||
super.onActivityResult(requestCode, resultCode, data)
|
|
||||||
if (resultCode == RESULT_OK) {
|
|
||||||
if (viewModel.startTypeData == FileManagerViewModel.StartType.SELECT_FILE && requestCode == 1) {
|
|
||||||
// val path = FileOperator.parsePicturePath(this@FileManagerActivity, data)
|
|
||||||
// if (path != null) {
|
|
||||||
// val intent = Intent()
|
|
||||||
// intent.putExtra("File", path)
|
|
||||||
// setResult(RESULT_OK, intent)
|
|
||||||
// finish()
|
|
||||||
// }
|
|
||||||
} else if (viewModel.startTypeData == FileManagerViewModel.StartType.SELECT_FILE && requestCode == 2) {
|
|
||||||
// val path = viewModel.parseFilePath(this@FileManagerActivity, data)
|
|
||||||
// if (path != null) {
|
|
||||||
// val intent = Intent()
|
|
||||||
// intent.putExtra("File", path)
|
|
||||||
// setResult(RESULT_OK, intent)
|
|
||||||
//// bookmarkManager.save()
|
|
||||||
// finish()
|
|
||||||
// }
|
|
||||||
}
|
|
||||||
// else if (requestCode == 3) {
|
|
||||||
//新建源文件
|
|
||||||
// loadFiles(directs)
|
|
||||||
// } else if (requestCode == 4) {
|
|
||||||
// val file = File(data!!.getStringExtra("File"))
|
|
||||||
// val copyResult =
|
|
||||||
// FileOperator.copyFile(file, File(directs.toString() + "/" + file.name))
|
|
||||||
// if (!copyResult) {
|
|
||||||
// Snackbar.make(
|
|
||||||
// viewBinding.fab,
|
|
||||||
// getText(R.string.copy_file_error),
|
|
||||||
// Snackbar.LENGTH_SHORT
|
|
||||||
// ).show()
|
|
||||||
// } else {
|
|
||||||
// loadFiles(directs)
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
lateinit var photoAlbumResultLauncher: ActivityResultLauncher<Intent>
|
lateinit var photoAlbumResultLauncher: ActivityResultLauncher<Intent>
|
||||||
|
|
||||||
lateinit var systemFileManagerResultLauncher: ActivityResultLauncher<String>
|
lateinit var systemFileManagerResultLauncher: ActivityResultLauncher<String>
|
||||||
|
|
||||||
|
|
||||||
//
|
|
||||||
override fun onOptionsItemSelected(item: MenuItem): Boolean {
|
override fun onOptionsItemSelected(item: MenuItem): Boolean {
|
||||||
val id = item.itemId
|
val id = item.itemId
|
||||||
when (id) {
|
when (id) {
|
||||||
android.R.id.home -> {
|
android.R.id.home -> {
|
||||||
// bookmarkManager.save()
|
|
||||||
finish()
|
finish()
|
||||||
return true
|
return true
|
||||||
}
|
}
|
||||||
|
|
||||||
R.id.reloadFile -> {
|
R.id.reloadFile -> {
|
||||||
viewModel.loadFiles(viewModel.getCurrentPath())
|
viewModel.loadFiles(viewModel.getCurrentPath())
|
||||||
return true
|
return true
|
||||||
}
|
}
|
||||||
// R.id.photo_album -> {
|
|
||||||
// this@FileManagerActivity.startActivityForResult(
|
|
||||||
// Intent(
|
|
||||||
// Intent.ACTION_PICK,
|
|
||||||
// MediaStore.Images.Media.EXTERNAL_CONTENT_URI
|
|
||||||
// ), 1
|
|
||||||
// )
|
|
||||||
// return true
|
|
||||||
// }
|
|
||||||
// R.id.system_file_manager -> {
|
|
||||||
// val intent = Intent(Intent.ACTION_GET_CONTENT)
|
|
||||||
// intent.type = "*/*"
|
|
||||||
// intent.addCategory(Intent.CATEGORY_OPENABLE)
|
|
||||||
// this@FileManagerActivity.startActivityForResult(intent, 2)
|
|
||||||
// return true
|
|
||||||
// }
|
|
||||||
}
|
}
|
||||||
// loadBook(item.title)
|
|
||||||
return super.onOptionsItemSelected(item)
|
return super.onOptionsItemSelected(item)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -182,33 +84,6 @@ class FileManagerActivity : BaseActivity<ActivityFileBinding>() {
|
||||||
viewBinding.fab.setOnClickListener {
|
viewBinding.fab.setOnClickListener {
|
||||||
val startType = viewModel.startTypeData
|
val startType = viewModel.startTypeData
|
||||||
when (startType) {
|
when (startType) {
|
||||||
// "exportFile" -> {
|
|
||||||
// val oldFile = File(additionalData)
|
|
||||||
// val result = FileOperator.copyFile(
|
|
||||||
// oldFile,
|
|
||||||
// File(directs.absolutePath + "/" + oldFile.name)
|
|
||||||
// )
|
|
||||||
// if (result) {
|
|
||||||
// setResult(RESULT_OK)
|
|
||||||
// }
|
|
||||||
// finish()
|
|
||||||
// }
|
|
||||||
// "selectDirectents" -> {
|
|
||||||
// intent.putExtra("Directents", directs.absolutePath)
|
|
||||||
// setResult(RESULT_OK, intent)
|
|
||||||
// bookmarkManager.save()
|
|
||||||
// finish()
|
|
||||||
// }
|
|
||||||
// "selectFile" -> {
|
|
||||||
// intent.putExtra("File", filePath)
|
|
||||||
// setResult(RESULT_OK, intent)
|
|
||||||
// bookmarkManager.save()
|
|
||||||
// finish()
|
|
||||||
// }
|
|
||||||
|
|
||||||
// FileManagerViewModel.StartType.SELECT_FILE -> {
|
|
||||||
//
|
|
||||||
// }
|
|
||||||
FileManagerViewModel.StartType.DEFAULT, FileManagerViewModel.StartType.SELECT_FILE, FileManagerViewModel.StartType.SELECT_DIRECTORY -> {
|
FileManagerViewModel.StartType.DEFAULT, FileManagerViewModel.StartType.SELECT_FILE, FileManagerViewModel.StartType.SELECT_DIRECTORY -> {
|
||||||
var popupMenu = GlobalMethod.createPopMenu(viewBinding.fab)
|
var popupMenu = GlobalMethod.createPopMenu(viewBinding.fab)
|
||||||
if (adapter != null) {
|
if (adapter != null) {
|
||||||
|
@ -226,7 +101,6 @@ class FileManagerActivity : BaseActivity<ActivityFileBinding>() {
|
||||||
popupMenu.menu.add(R.string.select_file)
|
popupMenu.menu.add(R.string.select_file)
|
||||||
popupMenu.setOnMenuItemClickListener { item ->
|
popupMenu.setOnMenuItemClickListener { item ->
|
||||||
val title = item.title
|
val title = item.title
|
||||||
// val handler = Handler(Looper.getMainLooper())
|
|
||||||
when (title) {
|
when (title) {
|
||||||
getText(R.string.create_unit) -> {
|
getText(R.string.create_unit) -> {
|
||||||
val intent =
|
val intent =
|
||||||
|
@ -237,6 +111,7 @@ class FileManagerActivity : BaseActivity<ActivityFileBinding>() {
|
||||||
intent.putExtra("data", bundle)
|
intent.putExtra("data", bundle)
|
||||||
startActivityForResult(intent, 3)
|
startActivityForResult(intent, 3)
|
||||||
}
|
}
|
||||||
|
|
||||||
getText(R.string.select_file) -> {
|
getText(R.string.select_file) -> {
|
||||||
val bundle = Bundle()
|
val bundle = Bundle()
|
||||||
val intent =
|
val intent =
|
||||||
|
@ -249,9 +124,11 @@ class FileManagerActivity : BaseActivity<ActivityFileBinding>() {
|
||||||
intent.putExtra("data", bundle)
|
intent.putExtra("data", bundle)
|
||||||
startActivityForResult(intent, 4)
|
startActivityForResult(intent, 4)
|
||||||
}
|
}
|
||||||
|
|
||||||
getText(R.string.create_folder) -> {
|
getText(R.string.create_folder) -> {
|
||||||
createFolderAction()
|
createFolderAction()
|
||||||
}
|
}
|
||||||
|
|
||||||
getText(R.string.copy_to_this) -> {
|
getText(R.string.copy_to_this) -> {
|
||||||
val job = Job()
|
val job = Job()
|
||||||
val handler = Handler(Looper.getMainLooper())
|
val handler = Handler(Looper.getMainLooper())
|
||||||
|
@ -281,6 +158,7 @@ class FileManagerActivity : BaseActivity<ActivityFileBinding>() {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
getText(R.string.cut_to_this) -> {
|
getText(R.string.cut_to_this) -> {
|
||||||
val job = Job()
|
val job = Job()
|
||||||
val handler = Handler(Looper.getMainLooper())
|
val handler = Handler(Looper.getMainLooper())
|
||||||
|
@ -314,126 +192,14 @@ class FileManagerActivity : BaseActivity<ActivityFileBinding>() {
|
||||||
}
|
}
|
||||||
popupMenu.show()
|
popupMenu.show()
|
||||||
}
|
}
|
||||||
|
|
||||||
else -> {
|
else -> {
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
//
|
|
||||||
// /**
|
|
||||||
// * 创建文件夹活动
|
|
||||||
// */
|
|
||||||
// private fun createFolderAction() {
|
|
||||||
// MaterialDialog(this).show {
|
|
||||||
// title(R.string.create_folder)
|
|
||||||
// input(
|
|
||||||
// maxLength = 255,
|
|
||||||
// waitForPositiveButton = false
|
|
||||||
// ) { dialog, text ->
|
|
||||||
// if (text.length in 1..255) {
|
|
||||||
// dialog.setActionButtonEnabled(WhichButton.POSITIVE, true)
|
|
||||||
// }
|
|
||||||
// }.positiveButton(R.string.dialog_ok, null) { dialog ->
|
|
||||||
// val string = dialog.getInputField().text.toString()
|
|
||||||
// val file = File("$directs/$string")
|
|
||||||
// if (file.exists()) {
|
|
||||||
// Toast.makeText(
|
|
||||||
// this@FileManagerActivity,
|
|
||||||
// R.string.folder_error,
|
|
||||||
// Toast.LENGTH_SHORT
|
|
||||||
// ).show()
|
|
||||||
// } else {
|
|
||||||
// file.mkdirs()
|
|
||||||
// loadFiles(directs)
|
|
||||||
// }
|
|
||||||
// }.negativeButton(R.string.dialog_close)
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
//
|
|
||||||
//
|
|
||||||
|
|
||||||
//
|
|
||||||
// private fun getPath(context: Context, uri: Uri?): String? {
|
|
||||||
// val isKitKat = Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT
|
|
||||||
//
|
|
||||||
// // DocumentProvider
|
|
||||||
// if (isKitKat && DocumentsContract.isDocumentUri(context, uri)) {
|
|
||||||
// // ExternalStorageProvider
|
|
||||||
// if (isExternalStorageDocument(uri)) {
|
|
||||||
// val docId = DocumentsContract.getDocumentId(uri)
|
|
||||||
// val split = docId.split(":").toTypedArray()
|
|
||||||
// val type = split[0]
|
|
||||||
// if ("primary".equals(type, ignoreCase = true)) {
|
|
||||||
// return Environment.getExternalStorageDirectory().toString() + "/" + split[1]
|
|
||||||
// }
|
|
||||||
// } else if (isDownloadsDocument(uri)) {
|
|
||||||
// val id = DocumentsContract.getDocumentId(uri)
|
|
||||||
// val contentUri = ContentUris.withAppendedId(
|
|
||||||
// Uri.parse("content://downloads/public_downloads"),
|
|
||||||
// java.lang.Long.valueOf(id)
|
|
||||||
// )
|
|
||||||
// return getDataColumn(context, contentUri, null, null)
|
|
||||||
// } else if (isMediaDocument(uri)) {
|
|
||||||
// val docId = DocumentsContract.getDocumentId(uri)
|
|
||||||
// val split = docId.split(":").toTypedArray()
|
|
||||||
// val type = split[0]
|
|
||||||
// var contentUri: Uri? = null
|
|
||||||
// if ("image" == type) {
|
|
||||||
// contentUri = MediaStore.Images.Media.EXTERNAL_CONTENT_URI
|
|
||||||
// } else if ("video" == type) {
|
|
||||||
// contentUri = MediaStore.Video.Media.EXTERNAL_CONTENT_URI
|
|
||||||
// } else if ("audio" == type) {
|
|
||||||
// contentUri = MediaStore.Audio.Media.EXTERNAL_CONTENT_URI
|
|
||||||
// }
|
|
||||||
// val selection = "_id=?"
|
|
||||||
// val selectionArgs = arrayOf(split[1])
|
|
||||||
// return getDataColumn(context, contentUri, selection, selectionArgs)
|
|
||||||
// }
|
|
||||||
// } else if ("content".equals(uri!!.scheme, ignoreCase = true)) {
|
|
||||||
// return getDataColumn(context, uri, null, null)
|
|
||||||
// } else if ("file".equals(uri.scheme, ignoreCase = true)) {
|
|
||||||
// uri.path
|
|
||||||
// }
|
|
||||||
// return null
|
|
||||||
// }
|
|
||||||
//
|
|
||||||
// private fun isMediaDocument(uri: Uri?): Boolean {
|
|
||||||
// return "com.android.providers.media.documents" == uri!!.authority
|
|
||||||
// }
|
|
||||||
//
|
|
||||||
// private fun isExternalStorageDocument(uri: Uri?): Boolean {
|
|
||||||
// return "com.android.externalstorage.documents" == uri!!.authority
|
|
||||||
// }
|
|
||||||
//
|
|
||||||
// private fun isDownloadsDocument(uri: Uri?): Boolean {
|
|
||||||
// return "com.android.providers.downloads.documents" == uri!!.authority
|
|
||||||
// }
|
|
||||||
//
|
|
||||||
// private fun getDataColumn(
|
|
||||||
// context: Context,
|
|
||||||
// uri: Uri?,
|
|
||||||
// selection: String?,
|
|
||||||
// selectionArgs: Array<String>?
|
|
||||||
// ): String? {
|
|
||||||
// var cursor: Cursor? = null
|
|
||||||
// val column = "_data"
|
|
||||||
// val projection = arrayOf(column)
|
|
||||||
// try {
|
|
||||||
// cursor = context.contentResolver.query(
|
|
||||||
// uri!!, projection, selection, selectionArgs,
|
|
||||||
// null
|
|
||||||
// )
|
|
||||||
// if (cursor != null && cursor.moveToFirst()) {
|
|
||||||
// val column_index = cursor.getColumnIndexOrThrow(column)
|
|
||||||
// return cursor.getString(column_index)
|
|
||||||
// }
|
|
||||||
// } finally {
|
|
||||||
// cursor?.close()
|
|
||||||
// }
|
|
||||||
// return null
|
|
||||||
// }
|
|
||||||
//
|
|
||||||
private lateinit var menuBinding: MenuBinding
|
private lateinit var menuBinding: MenuBinding
|
||||||
private val viewModel: FileManagerViewModel by lazy {
|
private val viewModel: FileManagerViewModel by lazy {
|
||||||
ViewModelProvider(this).get(FileManagerViewModel::class.java)
|
ViewModelProvider(this).get(FileManagerViewModel::class.java)
|
||||||
|
@ -493,7 +259,8 @@ class FileManagerActivity : BaseActivity<ActivityFileBinding>() {
|
||||||
override fun whenCreateActivity(savedInstanceState: Bundle?, canUseView: Boolean) {
|
override fun whenCreateActivity(savedInstanceState: Bundle?, canUseView: Boolean) {
|
||||||
if (canUseView) {
|
if (canUseView) {
|
||||||
setReturnButton()
|
setReturnButton()
|
||||||
viewBinding.recyclerView.layoutManager = StableLinearLayoutManager(this@FileManagerActivity)
|
viewBinding.recyclerView.layoutManager =
|
||||||
|
StableLinearLayoutManager(this@FileManagerActivity)
|
||||||
val linearLayoutManager = StableLinearLayoutManager(this)
|
val linearLayoutManager = StableLinearLayoutManager(this)
|
||||||
linearLayoutManager.orientation = LinearLayoutManager.HORIZONTAL
|
linearLayoutManager.orientation = LinearLayoutManager.HORIZONTAL
|
||||||
viewBinding.fileTabNav.layoutManager = linearLayoutManager
|
viewBinding.fileTabNav.layoutManager = linearLayoutManager
|
||||||
|
@ -539,6 +306,7 @@ class FileManagerActivity : BaseActivity<ActivityFileBinding>() {
|
||||||
}.setGestureInsetBottomIgnored(true).show()
|
}.setGestureInsetBottomIgnored(true).show()
|
||||||
FileManagerViewModel.StartType.SELECT_DIRECTORY
|
FileManagerViewModel.StartType.SELECT_DIRECTORY
|
||||||
}
|
}
|
||||||
|
|
||||||
"exportFile" -> {
|
"exportFile" -> {
|
||||||
Snackbar.make(
|
Snackbar.make(
|
||||||
viewBinding.fab,
|
viewBinding.fab,
|
||||||
|
@ -557,9 +325,11 @@ class FileManagerActivity : BaseActivity<ActivityFileBinding>() {
|
||||||
}.setGestureInsetBottomIgnored(true).show()
|
}.setGestureInsetBottomIgnored(true).show()
|
||||||
FileManagerViewModel.StartType.EXPORT_FILE
|
FileManagerViewModel.StartType.EXPORT_FILE
|
||||||
}
|
}
|
||||||
|
|
||||||
"selectFile" -> {
|
"selectFile" -> {
|
||||||
FileManagerViewModel.StartType.SELECT_FILE
|
FileManagerViewModel.StartType.SELECT_FILE
|
||||||
}
|
}
|
||||||
|
|
||||||
else -> {
|
else -> {
|
||||||
FileManagerViewModel.StartType.DEFAULT
|
FileManagerViewModel.StartType.DEFAULT
|
||||||
}
|
}
|
||||||
|
@ -586,7 +356,7 @@ class FileManagerActivity : BaseActivity<ActivityFileBinding>() {
|
||||||
systemFileManagerResultLauncher.launch("*/*")
|
systemFileManagerResultLauncher.launch("*/*")
|
||||||
true
|
true
|
||||||
}
|
}
|
||||||
menuBinding.photoAlbumItem.setOnMenuItemClickListener {
|
val photoAlbumOnMenuItemClickListener = { _: MenuItem ->
|
||||||
val intent = Intent(
|
val intent = Intent(
|
||||||
Intent.ACTION_PICK,
|
Intent.ACTION_PICK,
|
||||||
MediaStore.Images.Media.EXTERNAL_CONTENT_URI
|
MediaStore.Images.Media.EXTERNAL_CONTENT_URI
|
||||||
|
@ -594,6 +364,10 @@ class FileManagerActivity : BaseActivity<ActivityFileBinding>() {
|
||||||
photoAlbumResultLauncher.launch(intent)
|
photoAlbumResultLauncher.launch(intent)
|
||||||
true
|
true
|
||||||
}
|
}
|
||||||
|
menuBinding.photoAlbumItemShortcut.setOnMenuItemClickListener(
|
||||||
|
photoAlbumOnMenuItemClickListener
|
||||||
|
)
|
||||||
|
menuBinding.photoAlbumItem.setOnMenuItemClickListener(photoAlbumOnMenuItemClickListener)
|
||||||
menuBinding.actionSortByType.setOnMenuItemClickListener {
|
menuBinding.actionSortByType.setOnMenuItemClickListener {
|
||||||
viewModel.sortTypeLiveData.value = FileManagerViewModel.SortType.BY_TYPE
|
viewModel.sortTypeLiveData.value = FileManagerViewModel.SortType.BY_TYPE
|
||||||
true
|
true
|
||||||
|
@ -776,6 +550,7 @@ class FileManagerActivity : BaseActivity<ActivityFileBinding>() {
|
||||||
viewModel.getBookmarkManager().save()
|
viewModel.getBookmarkManager().save()
|
||||||
loadMineBookmarksMenu()
|
loadMineBookmarksMenu()
|
||||||
}
|
}
|
||||||
|
|
||||||
R.id.renameAction -> {
|
R.id.renameAction -> {
|
||||||
val finalFile =
|
val finalFile =
|
||||||
adapter!!.getItemData(viewHolder.absoluteAdapterPosition)
|
adapter!!.getItemData(viewHolder.absoluteAdapterPosition)
|
||||||
|
@ -798,6 +573,7 @@ class FileManagerActivity : BaseActivity<ActivityFileBinding>() {
|
||||||
|
|
||||||
}.setCancelable(false).show()
|
}.setCancelable(false).show()
|
||||||
}
|
}
|
||||||
|
|
||||||
R.id.deleteAction -> {
|
R.id.deleteAction -> {
|
||||||
val finalFile =
|
val finalFile =
|
||||||
adapter!!.getItemData(viewHolder.absoluteAdapterPosition)
|
adapter!!.getItemData(viewHolder.absoluteAdapterPosition)
|
||||||
|
@ -816,11 +592,13 @@ class FileManagerActivity : BaseActivity<ActivityFileBinding>() {
|
||||||
|
|
||||||
}.show()
|
}.show()
|
||||||
}
|
}
|
||||||
|
|
||||||
R.id.copyAction -> {
|
R.id.copyAction -> {
|
||||||
val finalFile =
|
val finalFile =
|
||||||
adapter!!.getItemData(viewHolder.absoluteAdapterPosition)
|
adapter!!.getItemData(viewHolder.absoluteAdapterPosition)
|
||||||
adapter!!.setSelectPath(finalFile!!.absolutePath, true)
|
adapter!!.setSelectPath(finalFile!!.absolutePath, true)
|
||||||
}
|
}
|
||||||
|
|
||||||
R.id.cutOffAction -> {
|
R.id.cutOffAction -> {
|
||||||
val finalFile =
|
val finalFile =
|
||||||
adapter!!.getItemData(viewHolder.absoluteAdapterPosition)
|
adapter!!.getItemData(viewHolder.absoluteAdapterPosition)
|
||||||
|
@ -889,15 +667,19 @@ class FileManagerActivity : BaseActivity<ActivityFileBinding>() {
|
||||||
FileManagerViewModel.SortType.BY_NAME -> {
|
FileManagerViewModel.SortType.BY_NAME -> {
|
||||||
menuBinding.actionSortByName.isChecked = true
|
menuBinding.actionSortByName.isChecked = true
|
||||||
}
|
}
|
||||||
|
|
||||||
FileManagerViewModel.SortType.BY_SIZE -> {
|
FileManagerViewModel.SortType.BY_SIZE -> {
|
||||||
menuBinding.actionSortBySize.isChecked = true
|
menuBinding.actionSortBySize.isChecked = true
|
||||||
}
|
}
|
||||||
|
|
||||||
FileManagerViewModel.SortType.BY_LAST_MODIFIED -> {
|
FileManagerViewModel.SortType.BY_LAST_MODIFIED -> {
|
||||||
menuBinding.actionSortByLastModified.isChecked = true
|
menuBinding.actionSortByLastModified.isChecked = true
|
||||||
}
|
}
|
||||||
|
|
||||||
FileManagerViewModel.SortType.BY_TYPE -> {
|
FileManagerViewModel.SortType.BY_TYPE -> {
|
||||||
menuBinding.actionSortByType.isChecked = true
|
menuBinding.actionSortByType.isChecked = true
|
||||||
}
|
}
|
||||||
|
|
||||||
else -> {
|
else -> {
|
||||||
menuBinding.actionSortByName.isChecked = true
|
menuBinding.actionSortByName.isChecked = true
|
||||||
}
|
}
|
||||||
|
@ -916,6 +698,7 @@ class FileManagerActivity : BaseActivity<ActivityFileBinding>() {
|
||||||
FileManagerViewModel.StartType.DEFAULT -> {
|
FileManagerViewModel.StartType.DEFAULT -> {
|
||||||
getString(R.string.file_manager)
|
getString(R.string.file_manager)
|
||||||
}
|
}
|
||||||
|
|
||||||
else -> {
|
else -> {
|
||||||
getString(R.string.file_manager)
|
getString(R.string.file_manager)
|
||||||
}
|
}
|
||||||
|
@ -931,6 +714,7 @@ class FileManagerActivity : BaseActivity<ActivityFileBinding>() {
|
||||||
val menu: Menu,
|
val menu: Menu,
|
||||||
val reloadFileItem: MenuItem,
|
val reloadFileItem: MenuItem,
|
||||||
val photoAlbumItem: MenuItem,
|
val photoAlbumItem: MenuItem,
|
||||||
|
val photoAlbumItemShortcut: MenuItem,
|
||||||
val systemFileManagerItem: MenuItem,
|
val systemFileManagerItem: MenuItem,
|
||||||
val actionSortByName: MenuItem,
|
val actionSortByName: MenuItem,
|
||||||
val actionSortByType: MenuItem,
|
val actionSortByType: MenuItem,
|
||||||
|
@ -947,6 +731,7 @@ 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.photo_album_shortcut),
|
||||||
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_name),
|
||||||
menu.findItem(R.id.action_sort_by_type),
|
menu.findItem(R.id.action_sort_by_type),
|
||||||
|
|
12
app/src/main/res/drawable/outline_photo_album_24.xml
Normal file
12
app/src/main/res/drawable/outline_photo_album_24.xml
Normal file
|
@ -0,0 +1,12 @@
|
||||||
|
<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
|
android:width="24dp"
|
||||||
|
android:height="24dp"
|
||||||
|
android:tint="?attr/colorControlNormal"
|
||||||
|
android:viewportWidth="24"
|
||||||
|
android:viewportHeight="24">
|
||||||
|
|
||||||
|
<path
|
||||||
|
android:fillColor="@android:color/white"
|
||||||
|
android:pathData="M18,2H6C4.9,2 4,2.9 4,4v16c0,1.1 0.9,2 2,2h12c1.1,0 2,-0.9 2,-2V4C20,2.9 19.1,2 18,2zM18,20H6V4h5v7l2.5,-1.5L16,11V4h2V20zM13.62,13.5L17,18H7l2.38,-3.17L11,17L13.62,13.5z" />
|
||||||
|
|
||||||
|
</vector>
|
|
@ -1,12 +1,16 @@
|
||||||
<?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:app="http://schemas.android.com/apk/res-auto">
|
<item
|
||||||
|
android:showAsAction="always"
|
||||||
|
android:id="@+id/photo_album_shortcut"
|
||||||
|
android:icon="@drawable/outline_photo_album_24"
|
||||||
|
android:title="@string/photo_album" />
|
||||||
|
|
||||||
<item
|
<item
|
||||||
android:icon="@drawable/ic_outline_sort_24"
|
android:icon="@drawable/ic_outline_sort_24"
|
||||||
android:title="@string/soft"
|
android:showAsAction="ifRoom"
|
||||||
app:showAsAction="always">
|
android:title="@string/soft">
|
||||||
<menu>
|
<menu>
|
||||||
|
|
||||||
<group android:checkableBehavior="single">
|
<group android:checkableBehavior="single">
|
||||||
<item
|
<item
|
||||||
android:id="@+id/action_sort_by_name"
|
android:id="@+id/action_sort_by_name"
|
||||||
|
@ -26,8 +30,8 @@
|
||||||
<item
|
<item
|
||||||
android:id="@+id/action_bookmark"
|
android:id="@+id/action_bookmark"
|
||||||
android:icon="@drawable/ic_outline_bookmarks_24"
|
android:icon="@drawable/ic_outline_bookmarks_24"
|
||||||
android:title="@string/bookmark_manager"
|
android:showAsAction="ifRoom"
|
||||||
app:showAsAction="ifRoom">
|
android:title="@string/bookmark_manager">
|
||||||
|
|
||||||
<menu>
|
<menu>
|
||||||
<item
|
<item
|
||||||
|
@ -49,14 +53,6 @@
|
||||||
<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">
|
||||||
|
|
|
@ -129,7 +129,7 @@
|
||||||
<string name="copy_file_absolutely_path_error">复制绝对路径错误。</string>
|
<string name="copy_file_absolutely_path_error">复制绝对路径错误。</string>
|
||||||
<string name="create_folder">创建文件夹</string>
|
<string name="create_folder">创建文件夹</string>
|
||||||
<string name="photo_album">相册</string>
|
<string name="photo_album">相册</string>
|
||||||
<string name="system_file_manager">文件管理器</string>
|
<string name="system_file_manager">系统文件管理器</string>
|
||||||
<string name="reload_files">刷新</string>
|
<string name="reload_files">刷新</string>
|
||||||
<string name="convert_template">制作模板</string>
|
<string name="convert_template">制作模板</string>
|
||||||
<string name="open_game_test">测试此单位</string>
|
<string name="open_game_test">测试此单位</string>
|
||||||
|
@ -305,7 +305,7 @@
|
||||||
<string name="complete_settings">已完成设置</string>
|
<string name="complete_settings">已完成设置</string>
|
||||||
<string name="edit">编辑</string>
|
<string name="edit">编辑</string>
|
||||||
<string name="restore_all">全部还原</string>
|
<string name="restore_all">全部还原</string>
|
||||||
<string name="copyright" translatable="false">Copyright ©coldmint 2020-%1$d All Rights Reserved.</string>
|
<string name="copyright" translatable="false">Copyright ©Cold-Mint 2020-%1$d All Rights Reserved.</string>
|
||||||
<string name="about">关于</string>
|
<string name="about">关于</string>
|
||||||
<string name="additional_selection">附加项</string>
|
<string name="additional_selection">附加项</string>
|
||||||
<string name="delete_source_file">打包完成后删除源文件</string>
|
<string name="delete_source_file">打包完成后删除源文件</string>
|
||||||
|
|
Loading…
Reference in New Issue
Block a user