Context menu improvements

This commit is contained in:
Peter
2019-08-29 15:37:35 +04:00
parent 50c80f4daa
commit 05dacf8fe4
13 changed files with 200 additions and 61 deletions

View File

@@ -149,6 +149,29 @@ final class ContextActionNode: ASDisplayNode {
}
}
func updateTheme(theme: PresentationTheme) {
self.backgroundNode.backgroundColor = theme.contextMenu.itemBackgroundColor
self.highlightedBackgroundNode.backgroundColor = theme.contextMenu.itemHighlightedBackgroundColor
let textColor: UIColor
switch action.textColor {
case .primary:
textColor = theme.contextMenu.primaryColor
case .destructive:
textColor = theme.contextMenu.destructiveColor
}
self.textNode.attributedText = NSAttributedString(string: self.action.text, font: textFont, textColor: textColor)
switch self.action.textLayout {
case let .secondLineWithValue(value):
self.statusNode?.attributedText = NSAttributedString(string: value, font: textFont, textColor: theme.contextMenu.secondaryColor)
default:
break
}
self.iconNode.image = self.action.icon(theme)
}
@objc private func buttonPressed() {
self.performAction()
}