Skip to content

Commit

Permalink
Merge pull request #3495 from owncloud/new_arch/display_image_in_list
Browse files Browse the repository at this point in the history
The images are displayed correctly in the list.
  • Loading branch information
jabarros authored Jan 13, 2022
2 parents 0fcfa43 + 45cefcd commit 8f7c655
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -32,9 +32,11 @@ import androidx.recyclerview.widget.DiffUtil
import androidx.recyclerview.widget.GridLayoutManager
import androidx.recyclerview.widget.RecyclerView
import com.owncloud.android.R
import com.owncloud.android.authentication.AccountUtils
import com.owncloud.android.databinding.GridItemBinding
import com.owncloud.android.databinding.ItemFileListBinding
import com.owncloud.android.databinding.ListFooterBinding
import com.owncloud.android.datamodel.FileDataStorageManager
import com.owncloud.android.datamodel.ThumbnailsCacheManager
import com.owncloud.android.domain.files.model.OCFile
import com.owncloud.android.domain.files.model.OCFooterFile
Expand All @@ -51,6 +53,8 @@ class FileListAdapter(
) : RecyclerView.Adapter<RecyclerView.ViewHolder>() {

private var files = mutableListOf<Any>()
private var account = AccountUtils.getCurrentOwnCloudAccount(context)
private var storageManager: FileDataStorageManager = FileDataStorageManager(context, account, context.contentResolver)

fun updateFileList(filesToAdd: List<OCFile>) {
val diffUtilCallback = FileListDiffCallback(oldList = files, newList = filesToAdd)
Expand Down Expand Up @@ -217,14 +221,14 @@ class FileListAdapter(
if (file.needsToUpdateThumbnail) {
// generate new Thumbnail
if (ThumbnailsCacheManager.cancelPotentialThumbnailWork(file, fileIcon)) {
/*val task = ThumbnailsCacheManager.ThumbnailGenerationTask(fileIcon, storageManager, account)
val task = ThumbnailsCacheManager.ThumbnailGenerationTask(fileIcon, storageManager, account)
val asyncDrawable = ThumbnailsCacheManager.AsyncThumbnailDrawable(context.resources, thumbnail, task)

// If drawable is not visible, do not update it.
if (asyncDrawable.minimumHeight > 0 && asyncDrawable.minimumWidth > 0) {
fileIcon.setImageDrawable(asyncDrawable)
}
task.execute(file)*/
task.execute(file)
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ import androidx.lifecycle.MutableLiveData
import androidx.lifecycle.ViewModel
import androidx.lifecycle.viewModelScope
import com.owncloud.android.data.preferences.datasources.SharedPreferencesProvider
import com.owncloud.android.datamodel.FileDataStorageManager
import com.owncloud.android.db.PreferenceManager
import com.owncloud.android.domain.UseCaseResult
import com.owncloud.android.domain.files.model.OCFile
Expand Down Expand Up @@ -141,7 +142,7 @@ class MainFileListViewModel(
refreshFilesList(file.remotePath)
}

fun getFile(): OCFile{
fun getFile(): OCFile {
return file
}

Expand All @@ -159,7 +160,6 @@ class MainFileListViewModel(

fun isGridModeSetAsPreferred() = sharedPreferencesProvider.getBoolean(RECYCLER_VIEW_PREFERRED, false)


fun sortList(files: List<OCFile>): List<OCFile> {
val sortOrderSaved = PreferenceManager.getSortOrder(contextProvider.getContext(), FileStorageUtils.FILE_DISPLAY_SORT)
val ascendingModeSaved = PreferenceManager.getSortAscending(contextProvider.getContext(), FileStorageUtils.FILE_DISPLAY_SORT)
Expand Down

0 comments on commit 8f7c655

Please sign in to comment.