fix: search: do not show result if no result
This commit is contained in:
parent
1ceb0f669b
commit
5d4dd31b70
2 changed files with 10 additions and 7 deletions
|
@ -45,10 +45,8 @@ import androidx.compose.ui.unit.sp
|
|||
import androidx.core.content.FileProvider
|
||||
import com.dazuoye.filemanager.R
|
||||
import com.dazuoye.filemanager.fileSystem.WrappedFile
|
||||
import com.dazuoye.filemanager.fileSystem.WrappedFile.Type
|
||||
import com.dazuoye.filemanager.fileSystem.searchFile
|
||||
import com.dazuoye.filemanager.main_page
|
||||
import com.dazuoye.filemanager.utils.AlertHelper
|
||||
import kotlinx.coroutines.CoroutineScope
|
||||
import kotlinx.coroutines.Dispatchers
|
||||
import kotlinx.coroutines.launch
|
||||
|
@ -68,7 +66,7 @@ class SearchFileColumn(
|
|||
var isOkay by remember { mutableStateOf(false) }
|
||||
var sortByTime by remember { mutableStateOf(true) }
|
||||
|
||||
LaunchedEffect(isOkay, list,sortByTime) {
|
||||
LaunchedEffect(isOkay, list, sortByTime) {
|
||||
isOkay = false
|
||||
fileList.clear()
|
||||
val wfList = list.map { WrappedFile(File(it)) }
|
||||
|
@ -109,7 +107,11 @@ class SearchFileColumn(
|
|||
}
|
||||
|
||||
Text(
|
||||
text = context.getString(R.string.search_result, searchTypeName),
|
||||
text = if (list.isEmpty()) {
|
||||
context.getString(R.string.search_here, searchTypeName)
|
||||
} else {
|
||||
context.getString(R.string.search_result, searchTypeName)
|
||||
},
|
||||
fontSize = 28.sp,
|
||||
modifier = Modifier
|
||||
.padding(start = 10.dp)
|
||||
|
@ -333,7 +335,7 @@ class SearchFileColumn(
|
|||
|
||||
IconButton(
|
||||
onClick = {
|
||||
showFileInfoAlert(context,file.path)
|
||||
showFileInfoAlert(context, file.path)
|
||||
},
|
||||
modifier = Modifier.padding(horizontal = 10.dp)
|
||||
) {
|
||||
|
@ -342,8 +344,8 @@ class SearchFileColumn(
|
|||
)
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
fun showFileInfoAlert(context: Context, file: String) {
|
||||
val f = File(file)
|
||||
if (!f.exists()) {
|
||||
|
|
|
@ -74,6 +74,7 @@
|
|||
<string name="error_already_exist">已存在此文件(夹)</string>
|
||||
<string name="title_activity_view_file">ViewFileActivity</string>
|
||||
<string name="title_activity_search">SearchActivity</string>
|
||||
<string name="search_here">搜索%s</string>
|
||||
<string name="search_result">搜索%s结果</string>
|
||||
<string name="error_need_search_input">请输入要搜索的内容</string>
|
||||
<string name="error_search_input_illegal">输入的搜索内容不合法</string>
|
||||
|
@ -84,7 +85,7 @@
|
|||
<string name="sort_by_time">已选择按时间排序</string>
|
||||
<string name="title_activity_setting">SettingActivity</string>
|
||||
<string name="setting_hide_extension">隐藏扩展名</string>
|
||||
<string name="setting_hide_extension_description">如果打开,则会显示文件名 abc.efg,否则显示文件全名 abc.efg.txt</string>
|
||||
<string name="setting_hide_extension_description">如果打开,则会显示文件名 abc.efg,否则显示文件全名 abc.efg.txt\n此选项不会影响搜索页面显示扩展名</string>
|
||||
<string name="setting_hide_hidden_file">隐藏点文件</string>
|
||||
<string name="setting_hide_hidden_file_description">隐藏所有以 . 开头的文件和文件夹\n. 开头的文件(或文件夹)通常表示隐藏文件(或文件夹)\n此选项只对查看全部文件功能有效</string>
|
||||
|
||||
|
|
Loading…
Reference in a new issue