Commit 7d7e41ab authored by Carola Nitz's avatar Carola Nitz

MediaEditCell: fix correct selected state

the cell was showing the empty state for selected and selected for unselected,
when the cell was reused it didn't correct show the selected state when scrolling up as well
parent 3c8a00f2
...@@ -55,7 +55,7 @@ class MediaEditCell: BaseCollectionViewCell { ...@@ -55,7 +55,7 @@ class MediaEditCell: BaseCollectionViewCell {
var isChecked: Bool = false { var isChecked: Bool = false {
didSet { didSet {
checkboxImageView.image = isChecked ? UIImage(named: "checkboxEmpty") : UIImage(named: "checkboxSelected") checkboxImageView.image = isChecked ? UIImage(named: "checkboxSelected") : UIImage(named: "checkboxEmpty")
} }
} }
...@@ -65,5 +65,6 @@ class MediaEditCell: BaseCollectionViewCell { ...@@ -65,5 +65,6 @@ class MediaEditCell: BaseCollectionViewCell {
timeLabel.text = "" timeLabel.text = ""
sizeLabel.text = "" sizeLabel.text = ""
thumbnailImageView.image = nil thumbnailImageView.image = nil
isChecked = false
} }
} }
...@@ -192,8 +192,9 @@ extension VLCEditController: UICollectionViewDataSource { ...@@ -192,8 +192,9 @@ extension VLCEditController: UICollectionViewDataSource {
func collectionView(_ collectionView: UICollectionView, cellForItemAt indexPath: IndexPath) -> UICollectionViewCell { func collectionView(_ collectionView: UICollectionView, cellForItemAt indexPath: IndexPath) -> UICollectionViewCell {
if let cell = collectionView.dequeueReusableCell(withReuseIdentifier: category.editCellType.defaultReuseIdentifier, if let cell = collectionView.dequeueReusableCell(withReuseIdentifier: category.editCellType.defaultReuseIdentifier,
for: indexPath) as? BaseCollectionViewCell { for: indexPath) as? MediaEditCell {
cell.media = category.anyfiles[indexPath.row] cell.media = category.anyfiles[indexPath.row]
cell.isChecked = selectedCellIndexPaths.contains(indexPath)
return cell return cell
} }
return UICollectionViewCell() return UICollectionViewCell()
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment