diff --git a/app/src/main/AndroidManifest.xml b/app/src/main/AndroidManifest.xml
index 3ed858b..79caff2 100644
--- a/app/src/main/AndroidManifest.xml
+++ b/app/src/main/AndroidManifest.xml
@@ -1,15 +1,6 @@
-
-
-
-
-
-
-
+
+
+
+
-
+
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/app/src/main/ic_camera-playstore.png b/app/src/main/ic_camera-playstore.png
deleted file mode 100644
index 4f2e4d2..0000000
Binary files a/app/src/main/ic_camera-playstore.png and /dev/null differ
diff --git a/app/src/main/ic_launcher-playstore.png b/app/src/main/ic_launcher-playstore.png
deleted file mode 100644
index 3a76d6f..0000000
Binary files a/app/src/main/ic_launcher-playstore.png and /dev/null differ
diff --git a/app/src/main/ic_picture1-playstore.png b/app/src/main/ic_picture1-playstore.png
deleted file mode 100644
index 4f2e4d2..0000000
Binary files a/app/src/main/ic_picture1-playstore.png and /dev/null differ
diff --git a/app/src/main/ic_wechat-playstore.png b/app/src/main/ic_wechat-playstore.png
deleted file mode 100644
index bf3fd5a..0000000
Binary files a/app/src/main/ic_wechat-playstore.png and /dev/null differ
diff --git a/app/src/main/java/com/example/myapplication/compose/PasteHelper.kt b/app/src/main/java/com/example/myapplication/compose/PasteHelper.kt
index 88f5896..8c3ca05 100644
--- a/app/src/main/java/com/example/myapplication/compose/PasteHelper.kt
+++ b/app/src/main/java/com/example/myapplication/compose/PasteHelper.kt
@@ -6,7 +6,7 @@ import java.io.FileOutputStream
import java.nio.channels.FileChannel
class PasteHelper {
- companion object{
+ companion object {
fun copyDirectory(sourceDir: File, destDir: File) {
// creates the destination directory if it does not exist
if (!destDir.exists()) {
@@ -40,7 +40,7 @@ class PasteHelper {
}
}
- private fun copySingleFile(sourceFile: File, destFile: File){
+ private fun copySingleFile(sourceFile: File, destFile: File) {
if (!destFile.exists()) {
destFile.createNewFile()
}
diff --git a/app/src/main/java/com/example/myapplication/compose/RequirePermissionActivity.kt b/app/src/main/java/com/example/myapplication/compose/RequirePermissionActivity.kt
index 33c6332..3f24235 100644
--- a/app/src/main/java/com/example/myapplication/compose/RequirePermissionActivity.kt
+++ b/app/src/main/java/com/example/myapplication/compose/RequirePermissionActivity.kt
@@ -44,7 +44,8 @@ class RequirePermissionActivity : ComponentActivity() {
window.statusBarColor = getColor(R.color.WhiteSmoke)
setContent {
Column(
- modifier = Modifier.statusBarsPadding()
+ modifier = Modifier
+ .statusBarsPadding()
.fillMaxHeight(0.9f)
.fillMaxWidth(),
horizontalAlignment = Alignment.CenterHorizontally,
@@ -72,7 +73,11 @@ class RequirePermissionActivity : ComponentActivity() {
startActivity(intent)
}
if (VERSION.SDK_INT >= VERSION_CODES.TIRAMISU) {
- val perm33 = arrayOf(permission.READ_MEDIA_AUDIO,permission.READ_MEDIA_VIDEO,permission.READ_MEDIA_IMAGES)
+ val perm33 = arrayOf(
+ permission.READ_MEDIA_AUDIO,
+ permission.READ_MEDIA_VIDEO,
+ permission.READ_MEDIA_IMAGES
+ )
ActivityCompat.requestPermissions(
activity, perm33, 101
)
@@ -96,7 +101,6 @@ class RequirePermissionActivity : ComponentActivity() {
}
}
}
-
}
override fun onResume() {
@@ -119,7 +123,11 @@ fun checkPermissions(context: Context): Boolean {
return false
}
if (VERSION.SDK_INT >= VERSION_CODES.TIRAMISU) {
- val perm33 = arrayOf(permission.READ_MEDIA_AUDIO,permission.READ_MEDIA_VIDEO,permission.READ_MEDIA_IMAGES)
+ val perm33 = arrayOf(
+ permission.READ_MEDIA_AUDIO,
+ permission.READ_MEDIA_VIDEO,
+ permission.READ_MEDIA_IMAGES
+ )
perm33.forEach {
if (context.checkSelfPermission(it) != PackageManager.PERMISSION_GRANTED) {
return false
@@ -137,7 +145,7 @@ fun checkPermissions(context: Context): Boolean {
return true
}
-fun initSystem(){
+fun initSystem() {
ImageLister.instance.initialize()
VideoLister.instance.initialize()
MusicLister.instance.initialize()
diff --git a/app/src/main/java/com/example/myapplication/compose/SearchActivity.kt b/app/src/main/java/com/example/myapplication/compose/SearchActivity.kt
new file mode 100644
index 0000000..2e3d3a7
--- /dev/null
+++ b/app/src/main/java/com/example/myapplication/compose/SearchActivity.kt
@@ -0,0 +1,29 @@
+package com.example.myapplication.compose
+
+import android.os.Bundle
+import androidx.activity.ComponentActivity
+import androidx.activity.compose.setContent
+import androidx.activity.enableEdgeToEdge
+import com.example.myapplication.fileSystem.byTypeFileLister.DocumentLister
+import com.example.myapplication.fileSystem.byTypeFileLister.ImageLister
+import com.example.myapplication.fileSystem.byTypeFileLister.MusicLister
+import com.example.myapplication.fileSystem.byTypeFileLister.VideoLister
+
+class SearchActivity : ComponentActivity() {
+ override fun onCreate(savedInstanceState: Bundle?) {
+ super.onCreate(savedInstanceState)
+ val type = intent.extras?.getString("type")
+ val searchTypeRegex: Regex? = when (type) {
+ "music" -> MusicLister.regex
+ "image" -> ImageLister.regex
+ "video" -> VideoLister.regex
+ "document" -> DocumentLister.regex
+ else -> null
+ }
+
+ enableEdgeToEdge()
+ setContent {
+
+ }
+ }
+}
diff --git a/app/src/main/java/com/example/myapplication/compose/ViewFileActivity.kt b/app/src/main/java/com/example/myapplication/compose/ViewFileActivity.kt
index ba659e7..59649ad 100644
--- a/app/src/main/java/com/example/myapplication/compose/ViewFileActivity.kt
+++ b/app/src/main/java/com/example/myapplication/compose/ViewFileActivity.kt
@@ -20,7 +20,7 @@ class ViewFileActivity : ComponentActivity() {
var path =
intent.extras?.getString("folder") ?: Environment.getExternalStorageDirectory().path
val file = File(path)
- if (!file.isDirectory){
+ if (!file.isDirectory) {
path = Environment.getExternalStorageDirectory().path
}
enableEdgeToEdge()
@@ -30,7 +30,7 @@ class ViewFileActivity : ComponentActivity() {
modifier = Modifier
.fillMaxSize()
.background(Color(getColor(R.color.WhiteSmoke)))
- ){
+ ) {
FileColumn(this).Draw(path)
}
}
diff --git a/app/src/main/java/com/example/myapplication/compose/ui/FileColumn.kt b/app/src/main/java/com/example/myapplication/compose/ui/FileColumn.kt
index 9539c9c..06155ff 100644
--- a/app/src/main/java/com/example/myapplication/compose/ui/FileColumn.kt
+++ b/app/src/main/java/com/example/myapplication/compose/ui/FileColumn.kt
@@ -1,5 +1,6 @@
package com.example.myapplication.compose.ui
+import android.annotation.SuppressLint
import android.content.ClipData
import android.content.ClipDescription
import android.content.Context
@@ -160,7 +161,7 @@ class FileColumn(val context: Context) {
}
}
- private companion object{
+ private companion object {
var dropTarget: String? = null
}
@@ -177,7 +178,7 @@ class FileColumn(val context: Context) {
object : DragAndDropTarget {
override fun onDrop(event: DragAndDropEvent): Boolean {
val target = File(dropTarget ?: return false)
- if (!target.exists()){
+ if (!target.exists()) {
return false.also {
dropTarget = null
}
@@ -197,7 +198,7 @@ class FileColumn(val context: Context) {
}
}
- if (source.path == target.path){
+ if (source.path == target.path) {
dropTarget = null
return false
}
@@ -206,14 +207,14 @@ class FileColumn(val context: Context) {
if (source.isFile) {
val dir = source.parent ?: return false
val f = File("$dir/合并文件夹")
- if (!f.exists()){
+ if (!f.exists()) {
f.mkdir()
}
- ClipHelper.getInstance(context).copy(source,context)
+ ClipHelper.getInstance(context).copy(source, context)
val sourceUri = ClipHelper.getInstance(context).paste() ?: return false
val inputStream = try {
context.contentResolver.openInputStream(sourceUri)
- }catch (e: FileNotFoundException) {
+ } catch (e: FileNotFoundException) {
return false.also {
dropTarget = null
}
@@ -223,7 +224,7 @@ class FileColumn(val context: Context) {
actualFile.writeBytes(IOUtils.toByteArray(inputStream))
inputStream.close()
}
- ClipHelper.getInstance(context).copy(target,context)
+ ClipHelper.getInstance(context).copy(target, context)
val targetUri = ClipHelper.getInstance(context).paste() ?: return false
val inputStream2 = context.contentResolver.openInputStream(targetUri)
if (inputStream2 != null) {
@@ -237,13 +238,13 @@ class FileColumn(val context: Context) {
Toast.LENGTH_SHORT
).show()
} else if (source.isDirectory) {
- ClipHelper.getInstance(context).copy(target,context)
+ ClipHelper.getInstance(context).copy(target, context)
val sourceUri = ClipHelper.getInstance(context).paste() ?: return false.also {
dropTarget = null
}
val inputStream = try {
context.contentResolver.openInputStream(sourceUri)
- }catch (e: FileNotFoundException) {
+ } catch (e: FileNotFoundException) {
return false.also {
dropTarget = null
}
@@ -261,13 +262,13 @@ class FileColumn(val context: Context) {
}
} else if (target.isDirectory) {
if (source.isFile) {
- ClipHelper.getInstance(context).copy(source,context)
- val sourceUri = ClipHelper.getInstance(context).paste() ?: return false.also {
+ ClipHelper.getInstance(context).copy(source, context)
+ val sourceUri = ClipHelper.getInstance(context).paste() ?: return false.also {
dropTarget = null
}
val inputStream = try {
context.contentResolver.openInputStream(sourceUri)
- }catch (e: FileNotFoundException) {
+ } catch (e: FileNotFoundException) {
return false.also {
dropTarget = null
}
@@ -349,8 +350,7 @@ class FileColumn(val context: Context) {
)
)
})
- }
- ,
+ },
dragAndDropCallBack = dragAndDropCallBack,
onItemClick = onItemClick
)
@@ -367,7 +367,7 @@ class FileColumn(val context: Context) {
forceName: String? = null,
forceParent: String? = null,
update: (() -> Unit)? = null,
- dragAndDrop: Modifier = Modifier,
+ @SuppressLint("ModifierParameter") dragAndDrop: Modifier = Modifier,
dragAndDropCallBack: DragAndDropTarget? = null,
onItemClick: ((String) -> Unit)? = null
) {
@@ -443,7 +443,8 @@ class FileColumn(val context: Context) {
.padding(vertical = 3.dp)
.clickable {
onItemClick?.invoke(file.path)
- }.then(
+ }
+ .then(
if (dragAndDropCallBack != null) {
Modifier.dragAndDropTarget(
shouldStartDragAndDrop = { event ->
@@ -456,12 +457,10 @@ class FileColumn(val context: Context) {
result
}, target = dragAndDropCallBack
)
- }else{
+ } else {
Modifier
}
- )
-
- ,
+ ),
verticalAlignment = Alignment.CenterVertically,
) {
Image(
@@ -509,9 +508,6 @@ class FileColumn(val context: Context) {
if (f.isFile) {
ClipHelper.getInstance(context).copy(f, context)
}
- },
- onPaste = {
-
},
onDelete = {
AlertHelper.showDeleteAlert(context, file.path) {
@@ -533,9 +529,6 @@ class FileColumn(val context: Context) {
if (f.isDirectory) {
ClipHelper.getInstance(context).copyFolder(f.path)
}
- },
- onPaste = {
-
},
onDelete = {
AlertHelper.showDeleteAlert(context, file.path) {
diff --git a/app/src/main/java/com/example/myapplication/document_page.kt b/app/src/main/java/com/example/myapplication/document_page.kt
index c9ede47..0481e02 100644
--- a/app/src/main/java/com/example/myapplication/document_page.kt
+++ b/app/src/main/java/com/example/myapplication/document_page.kt
@@ -1,11 +1,11 @@
package com.example.myapplication
+import android.annotation.SuppressLint
import android.content.ActivityNotFoundException
import android.content.DialogInterface
import android.content.Intent
import android.os.Bundle
import android.os.Environment
-import android.util.Log
import android.view.View
import android.widget.AdapterView
import android.widget.GridView
@@ -21,6 +21,7 @@ import androidx.core.view.WindowInsetsCompat
import androidx.core.view.WindowInsetsCompat.Type
import com.example.myapplication.adapters.DocumentAdapter
import com.example.myapplication.adapters.DocumentModel
+import com.example.myapplication.compose.SearchActivity
import com.example.myapplication.fileSystem.CutHelper
import com.example.myapplication.fileSystem.byTypeFileLister.DocumentLister.Companion.instance
import com.example.myapplication.fileSystem.byTypeFileLister.DocumentLister.Companion.regex
@@ -71,9 +72,12 @@ class document_page : AppCompatActivity() {
searchImageView.setOnClickListener { v: View? ->
val intent =
Intent(
- this@document_page,
- document_page_search::class.java
+ this,
+ SearchActivity::class.java
)
+ val bundle = Bundle()
+ bundle.putString("type", "document")
+ intent.putExtras(bundle)
startActivity(intent) // 跳转到搜索页面
}
@@ -93,23 +97,27 @@ class document_page : AppCompatActivity() {
file
)
val intent = Intent(Intent.ACTION_VIEW)
- intent.setDataAndType(uri, when(file.extension){
- "xls" -> "application/vnd.ms-excel"
- "xlsx" -> "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet"
- "doc" -> "application/msword"
- "docx" -> "application/vnd.openxmlformats-officedocument.wordprocessingml.document"
- "ppt" -> "application/vnd.ms-powerpoint"
- "pptx" -> "application/vnd.openxmlformats-officedocument.presentationml.presentation"
- "txt" -> "text/plain"
- "htm","html" -> "text/html"
- "pdf" -> "application/pdf"
+ intent.setDataAndType(
+ uri, when (file.extension) {
+ "xls" -> "application/vnd.ms-excel"
+ "xlsx" -> "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet"
+ "doc" -> "application/msword"
+ "docx" -> "application/vnd.openxmlformats-officedocument.wordprocessingml.document"
+ "ppt" -> "application/vnd.ms-powerpoint"
+ "pptx" -> "application/vnd.openxmlformats-officedocument.presentationml.presentation"
+ "txt" -> "text/plain"
+ "htm", "html" -> "text/html"
+ "pdf" -> "application/pdf"
- else -> "application/*"
- })
+ else -> "application/*"
+ }
+ )
intent.addFlags(Intent.FLAG_GRANT_READ_URI_PERMISSION)
- try { startActivity(intent) }
- catch (e: ActivityNotFoundException){
- Toast.makeText(baseContext,"没有安装可以打开此类型文件的应用",Toast.LENGTH_SHORT).show()
+ try {
+ startActivity(intent)
+ } catch (e: ActivityNotFoundException) {
+ Toast.makeText(baseContext, "没有安装可以打开此类型文件的应用", Toast.LENGTH_SHORT)
+ .show()
}
}
}
@@ -125,7 +133,7 @@ class document_page : AppCompatActivity() {
CoroutineScope(Dispatchers.Default).launch {
val loadingTextView = findViewById(R.id.LoadingBlankText)
val defaultText = loadingTextView.text
- launch { loadingText(loadingTextView,defaultText) }
+ launch { loadingText(loadingTextView, defaultText) }
documentList = instance.dateOrderedList()
val models = ArrayList()
for (path in documentList) {
@@ -133,8 +141,7 @@ class document_page : AppCompatActivity() {
}
runOnUiThread {
val adapter = DocumentAdapter(this@document_page, models)
- val grid = findViewById(R.id.DocumentGrid)
- grid.setAdapter(adapter)
+ documentGrid.setAdapter(adapter)
findViewById(R.id.LoadingBlankText).visibility = View.GONE
}
}
@@ -157,7 +164,7 @@ class document_page : AppCompatActivity() {
}
val name = uri.path?.split('/')?.last() ?: "somePastedItem"
val ext = name.split('.').last()
- if (!"$ext.".matches(regex)){
+ if (!"$ext.".matches(regex)) {
Toast.makeText(this, getString(R.string.error_nothing_to_paste), Toast.LENGTH_SHORT)
.show()
return@showItemAlert
@@ -201,12 +208,17 @@ class document_page : AppCompatActivity() {
when (which) {
0 -> {
listOrderType = 0
- runOnUiThread{
+ runOnUiThread {
loadingTextView.visibility = View.VISIBLE
}
- CoroutineScope(Dispatchers.IO).launch { loadingText(loadingTextView,loadingTextView.text) }
+ CoroutineScope(Dispatchers.IO).launch {
+ loadingText(
+ loadingTextView,
+ loadingTextView.text
+ )
+ }
update {
- runOnUiThread{
+ runOnUiThread {
loadingTextView.visibility = View.GONE
Toast.makeText(
this@document_page,
@@ -219,12 +231,17 @@ class document_page : AppCompatActivity() {
1 -> {
listOrderType = 1
- runOnUiThread{
+ runOnUiThread {
loadingTextView.visibility = View.VISIBLE
}
- CoroutineScope(Dispatchers.IO).launch { loadingText(loadingTextView,loadingTextView.text) }
+ CoroutineScope(Dispatchers.IO).launch {
+ loadingText(
+ loadingTextView,
+ loadingTextView.text
+ )
+ }
update {
- runOnUiThread{
+ runOnUiThread {
loadingTextView.visibility = View.GONE
Toast.makeText(
this@document_page,
@@ -242,7 +259,7 @@ class document_page : AppCompatActivity() {
.show()
}
- private fun update(runSomethingMore: (()->Unit)? = null) {
+ private fun update(runSomethingMore: (() -> Unit)? = null) {
instance.initialize {
documentList = when (listOrderType) {
0 -> instance.dateOrderedList()
@@ -262,6 +279,7 @@ class document_page : AppCompatActivity() {
}
}
+ @SuppressLint("SetTextI18n")
private fun loadingText(
loadingTextView: TextView,
defaultText: CharSequence,
diff --git a/app/src/main/java/com/example/myapplication/document_page_search.java b/app/src/main/java/com/example/myapplication/document_page_search.java
deleted file mode 100644
index 35765db..0000000
--- a/app/src/main/java/com/example/myapplication/document_page_search.java
+++ /dev/null
@@ -1,44 +0,0 @@
-package com.example.myapplication;
-
-import android.content.Intent;
-import android.os.Bundle;
-import android.widget.ImageView;
-import android.widget.SearchView;
-import android.widget.Toast;
-
-import androidx.activity.EdgeToEdge;
-import androidx.appcompat.app.AppCompatActivity;
-
-public class document_page_search extends AppCompatActivity {
-
- @Override
- protected void onCreate(Bundle savedInstanceState) {
- super.onCreate(savedInstanceState);
- EdgeToEdge.enable(this);
- setContentView(R.layout.document_page_search);
- // 设置左箭头的点击事件,返回上一级页面
- ImageView leftArrowImageView = findViewById(R.id.leftArrowImageView);
- leftArrowImageView.setOnClickListener(v -> {
- Intent intent = new Intent(document_page_search.this, document_page.class);
- intent.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP | Intent.FLAG_ACTIVITY_SINGLE_TOP);
- startActivity(intent);
- });
- SearchView searchView = findViewById(R.id.searchDocument); // 确保使用正确的 ID
-
- searchView.setOnQueryTextListener(new SearchView.OnQueryTextListener() {
- @Override
- public boolean onQueryTextSubmit(String query) {
- // 处理搜索提交
- Toast.makeText(document_page_search.this, "搜索: " + query, Toast.LENGTH_SHORT).show();
- return false;
- }
-
- @Override
- public boolean onQueryTextChange(String newText) {
- // 处理搜索文本变化
- // 可以在这里添加过滤逻辑
- return false;
- }
- });
- }
-}
\ No newline at end of file
diff --git a/app/src/main/java/com/example/myapplication/fileSystem/DeleteHelper.kt b/app/src/main/java/com/example/myapplication/fileSystem/DeleteHelper.kt
index 78d2fb1..b79faad 100644
--- a/app/src/main/java/com/example/myapplication/fileSystem/DeleteHelper.kt
+++ b/app/src/main/java/com/example/myapplication/fileSystem/DeleteHelper.kt
@@ -7,23 +7,23 @@ import com.example.myapplication.utils.ClipHelper
import java.io.File
class DeleteHelper {
- companion object{
- fun delete(path: String){
+ companion object {
+ fun delete(path: String) {
val file = File(path)
- if (file.isFile){
+ if (file.isFile) {
file.delete()
- }else if (file.isDirectory){
+ } else if (file.isDirectory) {
file.deleteRecursively()
}
}
}
}
-class CutHelper{
+class CutHelper {
companion object {
- fun cut(context: Context, file: File){
+ fun cut(context: Context, file: File) {
val cacheDir = File("${Environment.getExternalStorageDirectory()}/.copy")
- if (!cacheDir.exists()){
+ if (!cacheDir.exists()) {
cacheDir.mkdir()
}
@@ -36,15 +36,15 @@ class CutHelper{
}
}
- fun cutFolder(context: Context,folder: File){
+ fun cutFolder(context: Context, folder: File) {
val cacheDir = File("${Environment.getExternalStorageDirectory()}/.copy")
- if (!cacheDir.exists()){
+ if (!cacheDir.exists()) {
cacheDir.mkdir()
}
if (folder.exists()) {
val tempFolder = File("${Environment.getExternalStorageDirectory()}/.copy", folder.name)
- PasteHelper.copyDirectory(folder,tempFolder)
+ PasteHelper.copyDirectory(folder, tempFolder)
ClipHelper.getInstance(context).copyFolder(tempFolder.path)
DeleteHelper.delete(folder.path)
}
diff --git a/app/src/main/java/com/example/myapplication/fileSystem/SystemStorageInfo.kt b/app/src/main/java/com/example/myapplication/fileSystem/SystemStorageInfo.kt
index 0bb369f..1fda380 100644
--- a/app/src/main/java/com/example/myapplication/fileSystem/SystemStorageInfo.kt
+++ b/app/src/main/java/com/example/myapplication/fileSystem/SystemStorageInfo.kt
@@ -6,7 +6,7 @@ import android.os.Environment
import android.os.storage.StorageManager
import java.io.IOException
-class SystemStorageInfo(private val context: Context) {
+class SystemStorageInfo(context: Context) {
private val storageManager = context.getSystemService(Context.STORAGE_SERVICE) as StorageManager
private val storageStatsManager =
context.getSystemService(Context.STORAGE_STATS_SERVICE) as StorageStatsManager
@@ -34,6 +34,7 @@ class SystemStorageInfo(private val context: Context) {
}
}
- fun getUsedPercentage(): Int = 100 - Math.round(freeStorage.toDouble() * 100 / totalStorage.toDouble()).toInt()
+ fun getUsedPercentage(): Int =
+ 100 - Math.round(freeStorage.toDouble() * 100 / totalStorage.toDouble()).toInt()
}
diff --git a/app/src/main/java/com/example/myapplication/fileSystem/WrappedFile.kt b/app/src/main/java/com/example/myapplication/fileSystem/WrappedFile.kt
index 7b06124..cccfddd 100644
--- a/app/src/main/java/com/example/myapplication/fileSystem/WrappedFile.kt
+++ b/app/src/main/java/com/example/myapplication/fileSystem/WrappedFile.kt
@@ -121,9 +121,9 @@ class WrappedFile(private val f: File, skipCalculateDirectorySize: Boolean = fal
)
lastModifiedTime = attr.lastModifiedTime().toInstant()
- mime = if (f.isDirectory){
+ mime = if (f.isDirectory) {
"dir"
- }else {
+ } else {
guessMime(f.extension)
}
}
@@ -131,11 +131,11 @@ class WrappedFile(private val f: File, skipCalculateDirectorySize: Boolean = fal
fun getSizeString(): String {
if (size == 0L) {
if (type == Type.DIRECTORY) {
- if (!isSizeCalculated){
+ if (!isSizeCalculated) {
// Calculate Size
size = getFolderSize(f)
isSizeCalculated = true
- }else{
+ } else {
return "0B"
}
} else {
diff --git a/app/src/main/java/com/example/myapplication/fileSystem/byTypeFileLister/MusicLister.kt b/app/src/main/java/com/example/myapplication/fileSystem/byTypeFileLister/MusicLister.kt
index f3d31c8..bbcc82b 100644
--- a/app/src/main/java/com/example/myapplication/fileSystem/byTypeFileLister/MusicLister.kt
+++ b/app/src/main/java/com/example/myapplication/fileSystem/byTypeFileLister/MusicLister.kt
@@ -10,7 +10,8 @@ import java.io.File
class MusicLister : Lister() {
companion object {
val instance by lazy { MusicLister() }
- val directories = listOf("Recordings", "Download", "Audiobooks", "Music", "Podcasts", "Ringtones")
+ val directories =
+ listOf("Recordings", "Download", "Audiobooks", "Music", "Podcasts", "Ringtones")
val regex = "\\.(mp3|ogg|aac|wav)".toRegex()
}
diff --git a/app/src/main/java/com/example/myapplication/fileSystem/byTypeFileLister/Walker.kt b/app/src/main/java/com/example/myapplication/fileSystem/byTypeFileLister/Walker.kt
index c78528a..988eb25 100644
--- a/app/src/main/java/com/example/myapplication/fileSystem/byTypeFileLister/Walker.kt
+++ b/app/src/main/java/com/example/myapplication/fileSystem/byTypeFileLister/Walker.kt
@@ -2,8 +2,13 @@ package com.example.myapplication.fileSystem.byTypeFileLister
import java.io.File
-fun Lister.walkDir(directory: File,list: MutableList,pattern: Regex ,ignoreDotFile: Boolean = true){
- if (!directory.exists() || !directory.isDirectory){
+fun Lister.walkDir(
+ directory: File,
+ list: MutableList,
+ pattern: Regex,
+ ignoreDotFile: Boolean = true
+) {
+ if (!directory.exists() || !directory.isDirectory) {
return
}
directory.listFiles()?.forEach {
diff --git a/app/src/main/java/com/example/myapplication/main_page.java b/app/src/main/java/com/example/myapplication/main_page.java
index 9d0486f..2cbe49c 100644
--- a/app/src/main/java/com/example/myapplication/main_page.java
+++ b/app/src/main/java/com/example/myapplication/main_page.java
@@ -96,7 +96,7 @@ public class main_page extends AppCompatActivity {
Intent intent = new Intent(context, ViewFileActivity.class);
Bundle bundle = new Bundle();
bundle.putString("folder",
- Environment.getExternalStorageDirectory().getPath() + "/Download");
+ Environment.getExternalStorageDirectory().getPath() + "/Download");
intent.putExtras(bundle);
startActivity(intent);
}
@@ -104,7 +104,7 @@ public class main_page extends AppCompatActivity {
Intent intent = new Intent(context, ViewFileActivity.class);
Bundle bundle = new Bundle();
bundle.putString("folder",
- Environment.getExternalStorageDirectory().getPath() + "/Documents");
+ Environment.getExternalStorageDirectory().getPath() + "/Documents");
intent.putExtras(bundle);
startActivity(intent);
}
@@ -112,7 +112,7 @@ public class main_page extends AppCompatActivity {
Intent intent = new Intent(context, ViewFileActivity.class);
Bundle bundle = new Bundle();
bundle.putString("folder",
- Environment.getExternalStorageDirectory().getPath() + "/Recordings");
+ Environment.getExternalStorageDirectory().getPath() + "/Recordings");
intent.putExtras(bundle);
startActivity(intent);
}
diff --git a/app/src/main/java/com/example/myapplication/music_page.kt b/app/src/main/java/com/example/myapplication/music_page.kt
index 67a29a9..b44681f 100644
--- a/app/src/main/java/com/example/myapplication/music_page.kt
+++ b/app/src/main/java/com/example/myapplication/music_page.kt
@@ -1,10 +1,10 @@
package com.example.myapplication
+import android.annotation.SuppressLint
import android.content.DialogInterface
import android.content.Intent
import android.os.Bundle
import android.os.Environment
-import android.util.Log
import android.view.View
import android.widget.AdapterView
import android.widget.GridView
@@ -20,11 +20,10 @@ import androidx.core.view.WindowInsetsCompat
import androidx.core.view.WindowInsetsCompat.Type
import com.example.myapplication.adapters.MusicAdapter
import com.example.myapplication.adapters.MusicModel
+import com.example.myapplication.compose.SearchActivity
import com.example.myapplication.fileSystem.CutHelper
import com.example.myapplication.fileSystem.byTypeFileLister.DocumentLister
-import com.example.myapplication.fileSystem.byTypeFileLister.DocumentLister.Companion
import com.example.myapplication.fileSystem.byTypeFileLister.MusicLister.Companion.instance
-import com.example.myapplication.fileSystem.byTypeFileLister.MusicLister.Companion.regex
import com.example.myapplication.utils.AlertHelper
import com.example.myapplication.utils.ClipHelper
import kotlinx.coroutines.CoroutineScope
@@ -71,9 +70,12 @@ class music_page : AppCompatActivity() {
searchImageView.setOnClickListener { v: View? ->
val intent =
Intent(
- this@music_page,
- music_page_search::class.java
+ this,
+ SearchActivity::class.java
)
+ val bundle = Bundle()
+ bundle.putString("type", "music")
+ intent.putExtras(bundle)
startActivity(intent) // 跳转到搜索页面
}
@@ -110,7 +112,7 @@ class music_page : AppCompatActivity() {
CoroutineScope(Dispatchers.Default).launch {
val loadingTextView = findViewById(R.id.LoadingBlankText)
val defaultText = loadingTextView.text
- launch { loadingText(loadingTextView,defaultText) }
+ launch { loadingText(loadingTextView, defaultText) }
musicList = instance.dateOrderedList()
val models = ArrayList()
for (path in musicList) {
@@ -118,8 +120,7 @@ class music_page : AppCompatActivity() {
}
runOnUiThread {
val adapter = MusicAdapter(this@music_page, models)
- val grid = findViewById(R.id.MusicGrid)
- grid.setAdapter(adapter)
+ musicGrid.setAdapter(adapter)
findViewById(R.id.LoadingBlankText).visibility = View.GONE
}
}
@@ -142,7 +143,7 @@ class music_page : AppCompatActivity() {
}
val name = uri.path?.split('/')?.last() ?: "somePastedItem"
val ext = name.split('.').last()
- if (!"$ext.".matches(DocumentLister.regex)){
+ if (!"$ext.".matches(DocumentLister.regex)) {
Toast.makeText(this, getString(R.string.error_nothing_to_paste), Toast.LENGTH_SHORT)
.show()
return@showItemAlert
@@ -186,12 +187,17 @@ class music_page : AppCompatActivity() {
when (which) {
0 -> {
listOrderType = 0
- runOnUiThread{
+ runOnUiThread {
loadingTextView.visibility = View.VISIBLE
}
- CoroutineScope(Dispatchers.IO).launch { loadingText(loadingTextView,loadingTextView.text) }
+ CoroutineScope(Dispatchers.IO).launch {
+ loadingText(
+ loadingTextView,
+ loadingTextView.text
+ )
+ }
update {
- runOnUiThread{
+ runOnUiThread {
loadingTextView.visibility = View.GONE
Toast.makeText(
this@music_page,
@@ -204,12 +210,17 @@ class music_page : AppCompatActivity() {
1 -> {
listOrderType = 1
- runOnUiThread{
+ runOnUiThread {
loadingTextView.visibility = View.VISIBLE
}
- CoroutineScope(Dispatchers.IO).launch { loadingText(loadingTextView,loadingTextView.text) }
+ CoroutineScope(Dispatchers.IO).launch {
+ loadingText(
+ loadingTextView,
+ loadingTextView.text
+ )
+ }
update {
- runOnUiThread{
+ runOnUiThread {
loadingTextView.visibility = View.GONE
Toast.makeText(
this@music_page,
@@ -227,7 +238,7 @@ class music_page : AppCompatActivity() {
.show()
}
- private fun update(runSomethingMore: (()->Unit)? = null) {
+ private fun update(runSomethingMore: (() -> Unit)? = null) {
instance.initialize {
musicList = when (listOrderType) {
0 -> instance.dateOrderedList()
@@ -247,6 +258,7 @@ class music_page : AppCompatActivity() {
}
}
+ @SuppressLint("SetTextI18n")
private fun loadingText(
loadingTextView: TextView,
defaultText: CharSequence,
diff --git a/app/src/main/java/com/example/myapplication/music_page_search.java b/app/src/main/java/com/example/myapplication/music_page_search.java
deleted file mode 100644
index ebc1027..0000000
--- a/app/src/main/java/com/example/myapplication/music_page_search.java
+++ /dev/null
@@ -1,43 +0,0 @@
-package com.example.myapplication;
-
-import android.content.Intent;
-import android.os.Bundle;
-import android.widget.ImageView;
-import android.widget.SearchView;
-import android.widget.Toast;
-
-import androidx.activity.EdgeToEdge;
-import androidx.appcompat.app.AppCompatActivity;
-
-public class music_page_search extends AppCompatActivity {
- @Override
- protected void onCreate(Bundle savedInstanceState) {
- super.onCreate(savedInstanceState);
- EdgeToEdge.enable(this);
- setContentView(R.layout.music_page_search);
- // 设置左箭头的点击事件,返回上一级页面
- ImageView leftArrowImageView = findViewById(R.id.leftArrowImageView);
- leftArrowImageView.setOnClickListener(v -> {
- Intent intent = new Intent(music_page_search.this, music_page.class);
- intent.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP | Intent.FLAG_ACTIVITY_SINGLE_TOP);
- startActivity(intent);
- });
- SearchView searchView = findViewById(R.id.searchMusic); // 确保使用正确的 ID
-
- searchView.setOnQueryTextListener(new SearchView.OnQueryTextListener() {
- @Override
- public boolean onQueryTextSubmit(String query) {
- // 处理搜索提交
- Toast.makeText(music_page_search.this, "搜索: " + query, Toast.LENGTH_SHORT).show();
- return false;
- }
-
- @Override
- public boolean onQueryTextChange(String newText) {
- // 处理搜索文本变化
- // 可以在这里添加过滤逻辑
- return false;
- }
- });
- }
-}
diff --git a/app/src/main/java/com/example/myapplication/picture_page.kt b/app/src/main/java/com/example/myapplication/picture_page.kt
index c010fad..3bef84f 100644
--- a/app/src/main/java/com/example/myapplication/picture_page.kt
+++ b/app/src/main/java/com/example/myapplication/picture_page.kt
@@ -1,5 +1,6 @@
package com.example.myapplication
+import android.annotation.SuppressLint
import android.content.DialogInterface
import android.content.Intent
import android.os.Bundle
@@ -19,11 +20,10 @@ import androidx.core.view.WindowInsetsCompat
import androidx.core.view.WindowInsetsCompat.Type
import com.example.myapplication.adapters.ImageAdapter
import com.example.myapplication.adapters.ImageModel
+import com.example.myapplication.compose.SearchActivity
import com.example.myapplication.fileSystem.CutHelper
import com.example.myapplication.fileSystem.byTypeFileLister.DocumentLister
-import com.example.myapplication.fileSystem.byTypeFileLister.DocumentLister.Companion
import com.example.myapplication.fileSystem.byTypeFileLister.ImageLister.Companion.instance
-import com.example.myapplication.fileSystem.byTypeFileLister.ImageLister.Companion.regex
import com.example.myapplication.utils.AlertHelper
import com.example.myapplication.utils.ClipHelper
import kotlinx.coroutines.CoroutineScope
@@ -73,8 +73,11 @@ class picture_page : AppCompatActivity() {
val intent =
Intent(
this@picture_page,
- picture_page_search::class.java
+ SearchActivity::class.java
)
+ val bundle = Bundle()
+ bundle.putString("type", "image")
+ intent.putExtras(bundle)
startActivity(intent) // 跳转到搜索页面
}
@@ -111,7 +114,7 @@ class picture_page : AppCompatActivity() {
CoroutineScope(Dispatchers.Default).launch {
val loadingTextView = findViewById(R.id.LoadingBlankText)
val defaultText = loadingTextView.text
- launch { loadingText(loadingTextView,defaultText) }
+ launch { loadingText(loadingTextView, defaultText) }
imageList = instance.dateOrderedList()
val imageModels = ArrayList()
for (path in imageList) {
@@ -119,8 +122,7 @@ class picture_page : AppCompatActivity() {
}
runOnUiThread {
val adapter = ImageAdapter(this@picture_page, imageModels)
- val grid = findViewById(R.id.PicturePageGrid)
- grid.setAdapter(adapter)
+ pictureGrid.setAdapter(adapter)
findViewById(R.id.LoadingBlankText).visibility = View.GONE
}
}
@@ -143,7 +145,7 @@ class picture_page : AppCompatActivity() {
}
val name = uri.path?.split('/')?.last() ?: "somePastedItem"
val ext = name.split('.').last()
- if (!"$ext.".matches(DocumentLister.regex)){
+ if (!"$ext.".matches(DocumentLister.regex)) {
Toast.makeText(this, getString(R.string.error_nothing_to_paste), Toast.LENGTH_SHORT)
.show()
return@showItemAlert
@@ -187,12 +189,17 @@ class picture_page : AppCompatActivity() {
when (which) {
0 -> {
imageListOrderType = 0
- runOnUiThread{
+ runOnUiThread {
loadingTextView.visibility = View.VISIBLE
}
- CoroutineScope(Dispatchers.IO).launch { loadingText(loadingTextView,loadingTextView.text) }
+ CoroutineScope(Dispatchers.IO).launch {
+ loadingText(
+ loadingTextView,
+ loadingTextView.text
+ )
+ }
update {
- runOnUiThread{
+ runOnUiThread {
loadingTextView.visibility = View.GONE
Toast.makeText(
this@picture_page,
@@ -205,12 +212,17 @@ class picture_page : AppCompatActivity() {
1 -> {
imageListOrderType = 1
- runOnUiThread{
+ runOnUiThread {
loadingTextView.visibility = View.VISIBLE
}
- CoroutineScope(Dispatchers.IO).launch { loadingText(loadingTextView,loadingTextView.text) }
+ CoroutineScope(Dispatchers.IO).launch {
+ loadingText(
+ loadingTextView,
+ loadingTextView.text
+ )
+ }
update {
- runOnUiThread{
+ runOnUiThread {
loadingTextView.visibility = View.GONE
Toast.makeText(
this@picture_page,
@@ -228,7 +240,7 @@ class picture_page : AppCompatActivity() {
.show()
}
- private fun update(runSomethingMore: (()->Unit)? = null) {
+ private fun update(runSomethingMore: (() -> Unit)? = null) {
instance.initialize {
imageList = when (imageListOrderType) {
0 -> instance.dateOrderedList()
@@ -248,6 +260,7 @@ class picture_page : AppCompatActivity() {
}
}
+ @SuppressLint("SetTextI18n")
private fun loadingText(
loadingTextView: TextView,
defaultText: CharSequence,
diff --git a/app/src/main/java/com/example/myapplication/picture_page_search.java b/app/src/main/java/com/example/myapplication/picture_page_search.java
deleted file mode 100644
index 932f6fd..0000000
--- a/app/src/main/java/com/example/myapplication/picture_page_search.java
+++ /dev/null
@@ -1,43 +0,0 @@
-package com.example.myapplication;
-
-import android.content.Intent;
-import android.os.Bundle;
-import android.widget.ImageView;
-import android.widget.SearchView;
-import android.widget.Toast;
-
-import androidx.activity.EdgeToEdge;
-import androidx.appcompat.app.AppCompatActivity;
-
-public class picture_page_search extends AppCompatActivity {
- @Override
- protected void onCreate(Bundle savedInstanceState) {
- super.onCreate(savedInstanceState);
- EdgeToEdge.enable(this);
- setContentView(R.layout.picture_page_search);
- // 设置左箭头的点击事件,返回上一级页面
- ImageView leftArrowImageView = findViewById(R.id.leftArrowImageView);
- leftArrowImageView.setOnClickListener(v -> {
- Intent intent = new Intent(picture_page_search.this, picture_page.class);
- intent.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP | Intent.FLAG_ACTIVITY_SINGLE_TOP);
- startActivity(intent);
- });
- SearchView searchView = findViewById(R.id.searchPicture); // 确保使用正确的 ID
-
- searchView.setOnQueryTextListener(new SearchView.OnQueryTextListener() {
- @Override
- public boolean onQueryTextSubmit(String query) {
- // 处理搜索提交
- Toast.makeText(picture_page_search.this, "搜索: " + query, Toast.LENGTH_SHORT).show();
- return false;
- }
-
- @Override
- public boolean onQueryTextChange(String newText) {
- // 处理搜索文本变化
- // 可以在这里添加过滤逻辑
- return false;
- }
- });
- }
-}
diff --git a/app/src/main/java/com/example/myapplication/store_page.kt b/app/src/main/java/com/example/myapplication/store_page.kt
index e43a718..1ed4be2 100644
--- a/app/src/main/java/com/example/myapplication/store_page.kt
+++ b/app/src/main/java/com/example/myapplication/store_page.kt
@@ -58,9 +58,10 @@ class store_page : AppCompatActivity() {
val musicSizeString = WrappedFile.getSizeString(musicSize)
val documentSize = DocumentLister.instance.getFullSize()
val documentSizeString = WrappedFile.getSizeString(documentSize)
- val otherSize = systemStorageInfo.getTotalStorageSize() - systemStorageInfo.getFreeStorageSize() - imageSize - musicSize - documentSize
+ val otherSize =
+ systemStorageInfo.getTotalStorageSize() - systemStorageInfo.getFreeStorageSize() - imageSize - musicSize - documentSize
val otherSizeString = WrappedFile.getSizeString(otherSize)
- runOnUiThread{
+ runOnUiThread {
findViewById(R.id.pictureStorage).text = imageSizeString
findViewById(R.id.videoStorage).text = videoSizeString
findViewById(R.id.audioStorage).text = musicSizeString
diff --git a/app/src/main/java/com/example/myapplication/utils/AlertHelper.kt b/app/src/main/java/com/example/myapplication/utils/AlertHelper.kt
index ee770d8..bf9ebfa 100644
--- a/app/src/main/java/com/example/myapplication/utils/AlertHelper.kt
+++ b/app/src/main/java/com/example/myapplication/utils/AlertHelper.kt
@@ -59,7 +59,6 @@ class AlertHelper {
fun showNoPasteAlert(
context: Context,
onCopy: () -> Unit,
- onPaste: () -> Unit,
onDelete: () -> Unit,
onCut: () -> Unit,
onInfo: () -> Unit
@@ -117,8 +116,8 @@ class AlertHelper {
when (which) {
0 -> onPaste()
1 -> onInfo()
- 2-> onNewFile()
- 3-> onNewFolder()
+ 2 -> onNewFile()
+ 3 -> onNewFolder()
}
}
.setNegativeButton(context.getString(R.string.action_cancel))
diff --git a/app/src/main/java/com/example/myapplication/utils/ClipHelper.kt b/app/src/main/java/com/example/myapplication/utils/ClipHelper.kt
index 25d06db..d084d4b 100644
--- a/app/src/main/java/com/example/myapplication/utils/ClipHelper.kt
+++ b/app/src/main/java/com/example/myapplication/utils/ClipHelper.kt
@@ -33,7 +33,7 @@ class ClipHelper private constructor(context: Context) {
context,
context.applicationContext.packageName + ".provider",
file
- )
+ )
val clip = ClipData.newUri(contentResolver, label, uri)
clipboard.setPrimaryClip(clip)
}
@@ -47,8 +47,8 @@ class ClipHelper private constructor(context: Context) {
return null
}
- fun copyFolder(folder: String){
- val clip = ClipData.newPlainText("SingleFolderCopy","$ENCODE_LABEL:${folder}")
+ fun copyFolder(folder: String) {
+ val clip = ClipData.newPlainText("SingleFolderCopy", "$ENCODE_LABEL:${folder}")
clipboard.setPrimaryClip(clip)
}
@@ -58,8 +58,8 @@ class ClipHelper private constructor(context: Context) {
val item: ClipData.Item = getItemAt(0)
item.text
}
- if (content != null){
- if (content.startsWith(ENCODE_LABEL)){
+ if (content != null) {
+ if (content.startsWith(ENCODE_LABEL)) {
return content.split(':').last()
}
}
diff --git a/app/src/main/java/com/example/myapplication/video_page.kt b/app/src/main/java/com/example/myapplication/video_page.kt
index 35e2a39..8288bb5 100644
--- a/app/src/main/java/com/example/myapplication/video_page.kt
+++ b/app/src/main/java/com/example/myapplication/video_page.kt
@@ -1,5 +1,6 @@
package com.example.myapplication
+import android.annotation.SuppressLint
import android.content.DialogInterface
import android.content.Intent
import android.os.Bundle
@@ -17,14 +18,11 @@ import androidx.core.content.FileProvider
import androidx.core.view.ViewCompat
import androidx.core.view.WindowInsetsCompat
import androidx.core.view.WindowInsetsCompat.Type
-import com.example.myapplication.adapters.ImageAdapter
-import com.example.myapplication.adapters.ImageModel
import com.example.myapplication.adapters.VideoAdapter
import com.example.myapplication.adapters.VideoModel
+import com.example.myapplication.compose.SearchActivity
import com.example.myapplication.fileSystem.CutHelper
import com.example.myapplication.fileSystem.byTypeFileLister.DocumentLister
-import com.example.myapplication.fileSystem.byTypeFileLister.DocumentLister.Companion
-import com.example.myapplication.fileSystem.byTypeFileLister.VideoLister.Companion.regex
import com.example.myapplication.fileSystem.byTypeFileLister.VideoLister.Companion.instance
import com.example.myapplication.utils.AlertHelper
import com.example.myapplication.utils.ClipHelper
@@ -73,9 +71,12 @@ class video_page : AppCompatActivity() {
searchImageView.setOnClickListener { v: View? ->
val intent =
Intent(
- this@video_page,
- video_page_search::class.java
+ this,
+ SearchActivity::class.java
)
+ val bundle = Bundle()
+ bundle.putString("type", "video")
+ intent.putExtras(bundle)
startActivity(intent) // 跳转到搜索页面
}
@@ -112,7 +113,7 @@ class video_page : AppCompatActivity() {
CoroutineScope(Dispatchers.Default).launch {
val loadingTextView = findViewById(R.id.LoadingBlankText)
val defaultText = loadingTextView.text
- launch { loadingText(loadingTextView,defaultText) }
+ launch { loadingText(loadingTextView, defaultText) }
videoList = instance.dateOrderedList()
val videoModels = ArrayList()
for (path in videoList) {
@@ -120,8 +121,7 @@ class video_page : AppCompatActivity() {
}
runOnUiThread {
val adapter = VideoAdapter(this@video_page, videoModels)
- val grid = findViewById(R.id.VideoGrid)
- grid.setAdapter(adapter)
+ videoGrid.setAdapter(adapter)
findViewById(R.id.LoadingBlankText).visibility = View.GONE
}
}
@@ -144,7 +144,7 @@ class video_page : AppCompatActivity() {
}
val name = uri.path?.split('/')?.last() ?: "somePastedItem"
val ext = name.split('.').last()
- if (!"$ext.".matches(DocumentLister.regex)){
+ if (!"$ext.".matches(DocumentLister.regex)) {
Toast.makeText(this, getString(R.string.error_nothing_to_paste), Toast.LENGTH_SHORT)
.show()
return@showItemAlert
@@ -188,12 +188,17 @@ class video_page : AppCompatActivity() {
when (which) {
0 -> {
videoListOrderType = 0
- runOnUiThread{
+ runOnUiThread {
loadingTextView.visibility = View.VISIBLE
}
- CoroutineScope(Dispatchers.IO).launch { loadingText(loadingTextView,loadingTextView.text) }
+ CoroutineScope(Dispatchers.IO).launch {
+ loadingText(
+ loadingTextView,
+ loadingTextView.text
+ )
+ }
update {
- runOnUiThread{
+ runOnUiThread {
loadingTextView.visibility = View.GONE
Toast.makeText(
this@video_page,
@@ -206,12 +211,17 @@ class video_page : AppCompatActivity() {
1 -> {
videoListOrderType = 1
- runOnUiThread{
+ runOnUiThread {
loadingTextView.visibility = View.VISIBLE
}
- CoroutineScope(Dispatchers.IO).launch { loadingText(loadingTextView,loadingTextView.text) }
+ CoroutineScope(Dispatchers.IO).launch {
+ loadingText(
+ loadingTextView,
+ loadingTextView.text
+ )
+ }
update {
- runOnUiThread{
+ runOnUiThread {
loadingTextView.visibility = View.GONE
Toast.makeText(
this@video_page,
@@ -229,7 +239,7 @@ class video_page : AppCompatActivity() {
.show()
}
- private fun update(runSomethingMore: (()->Unit)? = null) {
+ private fun update(runSomethingMore: (() -> Unit)? = null) {
instance.initialize {
videoList = when (videoListOrderType) {
0 -> instance.dateOrderedList()
@@ -249,6 +259,7 @@ class video_page : AppCompatActivity() {
}
}
+ @SuppressLint("SetTextI18n")
private fun loadingText(
loadingTextView: TextView,
defaultText: CharSequence,
diff --git a/app/src/main/java/com/example/myapplication/video_page_search.java b/app/src/main/java/com/example/myapplication/video_page_search.java
deleted file mode 100644
index 89210b6..0000000
--- a/app/src/main/java/com/example/myapplication/video_page_search.java
+++ /dev/null
@@ -1,43 +0,0 @@
-package com.example.myapplication;
-
-import android.content.Intent;
-import android.os.Bundle;
-import android.widget.ImageView;
-import android.widget.SearchView;
-import android.widget.Toast;
-
-import androidx.activity.EdgeToEdge;
-import androidx.appcompat.app.AppCompatActivity;
-
-public class video_page_search extends AppCompatActivity {
- @Override
- protected void onCreate(Bundle savedInstanceState) {
- super.onCreate(savedInstanceState);
- EdgeToEdge.enable(this);
- setContentView(R.layout.video_page_search);
- // 设置左箭头的点击事件,返回上一级页面
- ImageView leftArrowImageView = findViewById(R.id.leftArrowImageView);
- leftArrowImageView.setOnClickListener(v -> {
- Intent intent = new Intent(video_page_search.this, video_page.class);
- intent.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP | Intent.FLAG_ACTIVITY_SINGLE_TOP);
- startActivity(intent);
- });
- SearchView searchView = findViewById(R.id.searchVideo); // 确保使用正确的 ID
-
- searchView.setOnQueryTextListener(new SearchView.OnQueryTextListener() {
- @Override
- public boolean onQueryTextSubmit(String query) {
- // 处理搜索提交
- Toast.makeText(video_page_search.this, "搜索: " + query, Toast.LENGTH_SHORT).show();
- return false;
- }
-
- @Override
- public boolean onQueryTextChange(String newText) {
- // 处理搜索文本变化
- // 可以在这里添加过滤逻辑
- return false;
- }
- });
- }
-}
diff --git a/app/src/main/res/layout/document_page_search.xml b/app/src/main/res/layout/document_page_search.xml
deleted file mode 100644
index 648b52e..0000000
--- a/app/src/main/res/layout/document_page_search.xml
+++ /dev/null
@@ -1,29 +0,0 @@
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/app/src/main/res/layout/music_page_search.xml b/app/src/main/res/layout/music_page_search.xml
deleted file mode 100644
index 63e2009..0000000
--- a/app/src/main/res/layout/music_page_search.xml
+++ /dev/null
@@ -1,29 +0,0 @@
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/app/src/main/res/layout/picture_page_search.xml b/app/src/main/res/layout/picture_page_search.xml
deleted file mode 100644
index 13caffe..0000000
--- a/app/src/main/res/layout/picture_page_search.xml
+++ /dev/null
@@ -1,29 +0,0 @@
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/app/src/main/res/layout/video_page_search.xml b/app/src/main/res/layout/video_page_search.xml
deleted file mode 100644
index ec38b13..0000000
--- a/app/src/main/res/layout/video_page_search.xml
+++ /dev/null
@@ -1,29 +0,0 @@
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml
index 58ff89c..b7e1b7c 100644
--- a/app/src/main/res/values/strings.xml
+++ b/app/src/main/res/values/strings.xml
@@ -127,4 +127,5 @@
请输入名称
已存在此文件(夹)
ViewFileActivity
+ SearchActivity
\ No newline at end of file