Browse Source

Merge pull request #431 from deltachat/paper-clip

ui fixes attachment button
björn petersen 5 years ago
parent
commit
7b56047930

BIN
deltachat-ios/Assets.xcassets/ic_chat.imageset/icn_dc_1x.png


BIN
deltachat-ios/Assets.xcassets/ic_chat.imageset/icn_dc_2x.png


BIN
deltachat-ios/Assets.xcassets/ic_chat.imageset/icn_dc_3x.png


+ 15 - 10
deltachat-ios/Controller/ChatViewController.swift

@@ -137,6 +137,7 @@ class ChatViewController: MessagesViewController {
                 badge =  InitialsBadge(name: chat.name, color: chat.color, size: 28)
             }
             badge.setVerified(chat.isVerified)
+            badge.accessibilityTraits = .button
             navigationItem.rightBarButtonItem = UIBarButtonItem(customView: badge)
         }
 
@@ -414,7 +415,7 @@ class ChatViewController: MessagesViewController {
         messageInputBar.inputTextView.layer.borderColor = UIColor.themeColor(light: UIColor(red: 200 / 255, green: 200 / 255, blue: 200 / 255, alpha: 1),
                                                                              dark: UIColor(red: 55 / 255, green: 55/255, blue: 55/255, alpha: 1)).cgColor
         messageInputBar.inputTextView.layer.borderWidth = 1.0
-        messageInputBar.inputTextView.layer.cornerRadius = 16.0
+        messageInputBar.inputTextView.layer.cornerRadius = 13.0
         messageInputBar.inputTextView.layer.masksToBounds = true
         messageInputBar.inputTextView.scrollIndicatorInsets = UIEdgeInsets(top: 8, left: 0, bottom: 8, right: 0)
         configureInputBarItems()
@@ -422,20 +423,22 @@ class ChatViewController: MessagesViewController {
 
     private func configureInputBarItems() {
 
-        messageInputBar.setLeftStackViewWidthConstant(to: 30, animated: false)
-        messageInputBar.setRightStackViewWidthConstant(to: 30, animated: false)
+        messageInputBar.setLeftStackViewWidthConstant(to: 40, animated: false)
+        messageInputBar.setRightStackViewWidthConstant(to: 40, animated: false)
 
 
         let sendButtonImage = UIImage(named: "paper_plane")?.withRenderingMode(.alwaysTemplate)
         messageInputBar.sendButton.image = sendButtonImage
+        messageInputBar.sendButton.accessibilityLabel = String.localized("menu_send")
+        messageInputBar.sendButton.accessibilityTraits = .button
         messageInputBar.sendButton.title = nil
         messageInputBar.sendButton.tintColor = UIColor(white: 1, alpha: 1)
-        messageInputBar.sendButton.layer.cornerRadius = 15
-        messageInputBar.middleContentViewPadding = UIEdgeInsets(top: 0, left: 5, bottom: 0, right: 10)
+        messageInputBar.sendButton.layer.cornerRadius = 20
+        messageInputBar.middleContentViewPadding = UIEdgeInsets(top: 0, left: 0, bottom: 0, right: 10)
         // this adds a padding between textinputfield and send button
         messageInputBar.sendButton.contentEdgeInsets = UIEdgeInsets(top: 5, left: 5, bottom: 5, right: 5)
-        messageInputBar.sendButton.setSize(CGSize(width: 30, height: 30), animated: false)
-
+        messageInputBar.sendButton.setSize(CGSize(width: 40, height: 40), animated: false)
+        messageInputBar.padding = UIEdgeInsets(top: 6, left: 6, bottom: 6, right: 12)
 
         let leftItems = [
             InputBarButtonItem()
@@ -443,12 +446,14 @@ class ChatViewController: MessagesViewController {
                     $0.spacing = .fixed(0)
                     let clipperIcon = #imageLiteral(resourceName: "ic_attach_file_36pt").withRenderingMode(.alwaysTemplate)
                     $0.image = clipperIcon
-                    $0.tintColor = DcColors.colorDisabled
-                    $0.setSize(CGSize(width: 30, height: 30), animated: false)
+                    $0.tintColor = UIColor.themeColor(light: .lightGray, dark: .darkGray)
+                    $0.setSize(CGSize(width: 40, height: 40), animated: false)
+                    $0.accessibilityLabel = String.localized("menu_add_attachment")
+                    $0.accessibilityTraits = .button
                 }.onSelected {
                     $0.tintColor = DcColors.primary
                 }.onDeselected {
-                    $0.tintColor = DcColors.colorDisabled
+                    $0.tintColor = UIColor.themeColor(light: .lightGray, dark: .darkGray)
                 }.onTouchUpInside { _ in
                     self.clipperButtonPressed()
                 }

+ 1 - 0
deltachat-ios/View/ChatTitleView.swift

@@ -21,6 +21,7 @@ class ChatTitleView: UIView {
     init() {
         super.init(frame: .zero)
         setupSubviews()
+        isAccessibilityElement = true
     }
 
     required init?(coder aDecoder: NSCoder) {

+ 1 - 0
deltachat-ios/View/ContactCell.swift

@@ -15,6 +15,7 @@ class ContactCell: UITableViewCell {
     lazy var avatar: InitialsBadge = {
         let badge = InitialsBadge(size: badgeSize)
         badge.setColor(UIColor.lightGray)
+        badge.isAccessibilityElement = false
         return badge
     }()
 

+ 3 - 0
deltachat-ios/View/InitialsBadge.swift

@@ -11,6 +11,7 @@ class InitialsBadge: UIView {
         label.textAlignment = NSTextAlignment.center
         label.textColor = UIColor.white
         label.translatesAutoresizingMaskIntoConstraints = false
+        label.isAccessibilityElement = false
         return label
     }()
 
@@ -50,6 +51,7 @@ class InitialsBadge: UIView {
         heightAnchor.constraint(equalToConstant: size).isActive = true
         widthAnchor.constraint(equalToConstant: size).isActive = true
         setupSubviews(with: radius)
+        isAccessibilityElement = true
     }
 
     private func setupSubviews(with radius: CGFloat) {
@@ -81,6 +83,7 @@ class InitialsBadge: UIView {
         label.text = Utils.getInitials(inputName: name)
         label.isHidden = name.isEmpty
         imageView.isHidden = !name.isEmpty
+        accessibilityLabel = "avatar \(name)"
     }
 
     func setImage(_ image: UIImage, downscale: CGFloat? = nil) {