diff --git a/app/src/main/java/com/nextcloud/talk/adapters/messages/PreviewMessageViewHolder.kt b/app/src/main/java/com/nextcloud/talk/adapters/messages/PreviewMessageViewHolder.kt index edc737866..487e68474 100644 --- a/app/src/main/java/com/nextcloud/talk/adapters/messages/PreviewMessageViewHolder.kt +++ b/app/src/main/java/com/nextcloud/talk/adapters/messages/PreviewMessageViewHolder.kt @@ -44,7 +44,6 @@ import com.nextcloud.android.common.ui.theme.utils.ColorRole import com.nextcloud.talk.R import com.nextcloud.talk.application.NextcloudTalkApplication import com.nextcloud.talk.application.NextcloudTalkApplication.Companion.sharedApplication -import com.nextcloud.talk.components.filebrowser.models.BrowserFile import com.nextcloud.talk.components.filebrowser.webdav.ReadFilesystemOperation import com.nextcloud.talk.data.user.model.User import com.nextcloud.talk.databinding.ReactionsInsideMessageBinding @@ -56,6 +55,7 @@ import com.nextcloud.talk.utils.DisplayUtils import com.nextcloud.talk.utils.DrawableUtils.getDrawableResourceIdForMimeType import com.nextcloud.talk.utils.FileViewerUtils import com.nextcloud.talk.utils.FileViewerUtils.ProgressUi +import com.owncloud.android.lib.resources.files.model.RemoteFile import com.stfalcon.chatkit.messages.MessageHolders.IncomingImageMessageViewHolder import io.reactivex.Single import io.reactivex.SingleObserver @@ -287,7 +287,7 @@ abstract class PreviewMessageViewHolder(itemView: View?, payload: Any?) : override fun onSuccess(readFilesystemOperation: ReadFilesystemOperation) { val davResponse = readFilesystemOperation.readRemotePath() if (davResponse.data != null) { - val browserFileList = davResponse.data as List + val browserFileList = davResponse.data as List if (browserFileList.isNotEmpty()) { Handler(context!!.mainLooper).post { val resourceId = getDrawableResourceIdForMimeType(browserFileList[0].mimeType) diff --git a/app/src/main/java/com/nextcloud/talk/components/filebrowser/webdav/ReadFilesystemOperation.java b/app/src/main/java/com/nextcloud/talk/components/filebrowser/webdav/ReadFilesystemOperation.java index 107c50ae0..5d7f9cb82 100644 --- a/app/src/main/java/com/nextcloud/talk/components/filebrowser/webdav/ReadFilesystemOperation.java +++ b/app/src/main/java/com/nextcloud/talk/components/filebrowser/webdav/ReadFilesystemOperation.java @@ -23,7 +23,6 @@ package com.nextcloud.talk.components.filebrowser.webdav; import android.net.Uri; import android.util.Log; -import com.nextcloud.talk.components.filebrowser.models.BrowserFile; import com.nextcloud.talk.components.filebrowser.models.DavResponse; import com.nextcloud.talk.dagger.modules.RestModule; import com.nextcloud.talk.data.user.model.User; @@ -73,8 +72,6 @@ public class ReadFilesystemOperation { DavResponse davResponse = new DavResponse(); final List memberElements = new ArrayList<>(); final Response[] rootElement = new Response[1]; - final List browserFiles = new ArrayList<>(); - final List remoteFiles = new ArrayList<>(); try { new DavResource(okHttpClient, HttpUrl.parse(url)).propfind(depth, @@ -101,16 +98,12 @@ public class ReadFilesystemOperation { WebDavFileUtils webDavFileUtils = new WebDavFileUtils(); - browserFiles.add(BrowserFile.Companion.getModelFromResponse(rootElement[0], - rootElement[0].getHref().toString().substring(basePath.length()))); + final List remoteFiles = new ArrayList<>(1 + memberElements.size()); remoteFiles.add(webDavFileUtils.parseResponse(rootElement[0], Uri.parse(basePath))); for (Response memberElement : memberElements) { - browserFiles.add(BrowserFile.Companion.getModelFromResponse(memberElement, - memberElement.getHref().toString().substring(basePath.length()))); - remoteFiles.add(webDavFileUtils.parseResponse(memberElement, Uri.parse(basePath))); }