Unified search: skip local file check for non-file results

Fixes https://github.com/nextcloud/android/issues/9171

Needs https://github.com/nextcloud/android-library/pull/739

Signed-off-by: Álvaro Brey Vilas <alvaro.brey@nextcloud.com>
This commit is contained in:
Álvaro Brey Vilas 2021-10-29 11:09:59 +02:00 committed by Álvaro Brey (Rebase PR Action)
parent 0558b25ee3
commit ac9f516027
2 changed files with 5 additions and 7 deletions

View file

@ -59,13 +59,11 @@ class UnifiedSearchItemViewHolder(
binding.title.text = entry.title
binding.subline.text = entry.subline
storageManager.getFileByDecryptedRemotePath(entry.remotePath())?.let {
if (it.isDown) {
if (entry.isFile && storageManager.getFileByDecryptedRemotePath(entry.remotePath()) != null) {
binding.localFileIndicator.visibility = View.VISIBLE
} else {
binding.localFileIndicator.visibility = View.GONE
}
}
val mimetype = MimeTypeUtil.getBestMimeTypeByFilename(entry.title)

View file

@ -144,7 +144,7 @@ class UnifiedSearchViewModel(application: Application) : AndroidViewModel(applic
}
override fun openResult(result: SearchResultEntry) {
if (result.fileId() != null) {
if (result.isFile) {
openFile(result.remotePath())
} else {
val uri = Uri.parse(result.resourceUrl)