Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

The images are displayed correctly in the list. #3495

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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