NCTrashGridCell.swift 1.9 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758
  1. //
  2. // NCTrashGridCell.swift
  3. // Nextcloud
  4. //
  5. // Created by Marino Faggiana on 08/10/2018.
  6. // Copyright © 2018 TWS. All rights reserved.
  7. //
  8. import Foundation
  9. import UIKit
  10. class NCTrashGridCell: UICollectionViewCell {
  11. @IBOutlet weak var imageItem: UIImageView!
  12. @IBOutlet weak var restore: UIImageView!
  13. @IBOutlet weak var tapRestore: UIImageView!
  14. @IBOutlet weak var labelTitle: UILabel!
  15. @IBOutlet weak var more: UIImageView!
  16. @IBOutlet weak var tapMore: UIImageView!
  17. var delegate: NCTrashGridDelegate?
  18. var fileID = ""
  19. override func awakeFromNib() {
  20. super.awakeFromNib()
  21. restore.image = CCGraphics.changeThemingColorImage(UIImage.init(named: "trashRestore"), multiplier: 2, color: NCBrandColor.sharedInstance.optionItem)
  22. more.image = CCGraphics.changeThemingColorImage(UIImage.init(named: "trashMore"), multiplier: 2, color: NCBrandColor.sharedInstance.optionItem)
  23. let tapGestureRestore = UITapGestureRecognizer(target: self, action: #selector(NCTrashGridCell.tapRestore(sender:)))
  24. addGestureRecognizer(tapGestureRestore)
  25. tapGestureRestore.numberOfTapsRequired = 1
  26. tapRestore.isUserInteractionEnabled = true
  27. tapRestore.addGestureRecognizer(tapGestureRestore)
  28. let tapGestureMore = UITapGestureRecognizer(target: self, action: #selector(NCTrashGridCell.tapMore(sender:)))
  29. addGestureRecognizer(tapGestureMore)
  30. tapGestureMore.numberOfTapsRequired = 1
  31. tapMore.isUserInteractionEnabled = true
  32. tapMore.addGestureRecognizer(tapGestureMore)
  33. }
  34. @objc func tapRestore(sender: UITapGestureRecognizer) {
  35. delegate?.tapRestoreItem(with: fileID)
  36. }
  37. @objc func tapMore(sender: UITapGestureRecognizer) {
  38. delegate?.tapMoreItem(with: fileID)
  39. }
  40. }
  41. protocol NCTrashGridDelegate {
  42. func tapRestoreItem(with fileID: String)
  43. func tapMoreItem(with fileID: String)
  44. }