Update rail icons.

This commit is contained in:
Matthew Chen 2019-03-12 13:27:35 -04:00
parent 2f7880af8e
commit 66efcb4639
6 changed files with 39 additions and 13 deletions

View file

@ -0,0 +1,23 @@
{
"images" : [
{
"idiom" : "universal",
"filename" : "x-24@1x.png",
"scale" : "1x"
},
{
"idiom" : "universal",
"filename" : "x-24@2x.png",
"scale" : "2x"
},
{
"idiom" : "universal",
"filename" : "x-24@3x.png",
"scale" : "3x"
}
],
"info" : {
"version" : 1,
"author" : "xcode"
}
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 243 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 398 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 573 B

View file

@ -1676,12 +1676,14 @@ public class ApprovalRailCellView: GalleryRailCellView {
strongSelf.approvalRailCellDelegate?.approvalRailCellView(strongSelf, didRemoveItem: attachmentItem)
}
button.setImage(#imageLiteral(resourceName: "ic_circled_x"), for: .normal)
button.setImage(UIImage(named: "x-24")?.withRenderingMode(.alwaysTemplate), for: .normal)
button.tintColor = .white
button.layer.shadowColor = UIColor.black.cgColor
button.layer.shadowRadius = 2
button.layer.shadowOpacity = 0.66
button.layer.shadowOffset = .zero
let kInsetDistance: CGFloat = 5
button.imageEdgeInsets = UIEdgeInsets(top: kInsetDistance, left: kInsetDistance, bottom: kInsetDistance, right: kInsetDistance)
let kButtonWidth: CGFloat = 24 + kInsetDistance * 2
let kButtonWidth: CGFloat = 24
button.autoSetDimensions(to: CGSize(width: kButtonWidth, height: kButtonWidth))
return button
@ -1704,8 +1706,8 @@ public class ApprovalRailCellView: GalleryRailCellView {
if isSelected {
addSubview(deleteButton)
deleteButton.autoPinEdge(toSuperviewEdge: .top, withInset: -12)
deleteButton.autoPinEdge(toSuperviewEdge: .trailing, withInset: -8)
deleteButton.autoPinEdge(toSuperviewEdge: .top, withInset: cellBorderWidth)
deleteButton.autoPinEdge(toSuperviewEdge: .trailing, withInset: cellBorderWidth + 4)
} else {
deleteButton.removeFromSuperview()
}
@ -1726,8 +1728,8 @@ public class ApprovalRailCellView: GalleryRailCellView {
if hasCaption {
addSubview(captionIndicator)
captionIndicator.autoPinEdge(toSuperviewEdge: .top, withInset: 2)
captionIndicator.autoPinEdge(toSuperviewEdge: .leading, withInset: 6)
captionIndicator.autoPinEdge(toSuperviewEdge: .top, withInset: cellBorderWidth)
captionIndicator.autoPinEdge(toSuperviewEdge: .leading, withInset: cellBorderWidth + 4)
} else {
captionIndicator.removeFromSuperview()
}

View file

@ -63,17 +63,18 @@ public class GalleryRailCellView: UIView {
private(set) var isSelected: Bool = false
public let cellBorderWidth: CGFloat = 2
func setIsSelected(_ isSelected: Bool) {
let borderWidth: CGFloat = 2
self.isSelected = isSelected
// Reserve space for the selection border whether or not the cell is selected.
layoutMargins = UIEdgeInsets(top: 0, left: borderWidth, bottom: 0, right: borderWidth)
layoutMargins = UIEdgeInsets(top: 0, left: cellBorderWidth, bottom: 0, right: cellBorderWidth)
if isSelected {
imageView.layer.borderColor = Theme.galleryHighlightColor.cgColor
imageView.layer.borderWidth = borderWidth
imageView.layer.cornerRadius = borderWidth
imageView.layer.borderWidth = cellBorderWidth
imageView.layer.cornerRadius = cellBorderWidth
} else {
imageView.layer.borderWidth = 0
imageView.layer.cornerRadius = 0