mirror of
https://gitlab.linphone.org/BC/public/linphone-iphone.git
synced 2026-01-17 11:08:06 +00:00
Added border to file attachement icons in reply bubbles
This commit is contained in:
parent
3ab4afd23a
commit
e2dc4dad8b
2 changed files with 29 additions and 27 deletions
|
|
@ -1,9 +1,9 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<document type="com.apple.InterfaceBuilder3.CocoaTouch.XIB" version="3.0" toolsVersion="18122" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" useSafeAreas="YES" colorMatched="YES">
|
||||
<document type="com.apple.InterfaceBuilder3.CocoaTouch.XIB" version="3.0" toolsVersion="19162" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" useSafeAreas="YES" colorMatched="YES">
|
||||
<device id="retina6_1" orientation="portrait" appearance="light"/>
|
||||
<dependencies>
|
||||
<deployment identifier="iOS"/>
|
||||
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="18093"/>
|
||||
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="19144"/>
|
||||
<capability name="Safe area layout guides" minToolsVersion="9.0"/>
|
||||
<capability name="System colors in document resources" minToolsVersion="11.0"/>
|
||||
<capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/>
|
||||
|
|
@ -45,7 +45,7 @@
|
|||
<autoresizingMask key="autoresizingMask" widthSizable="YES" flexibleMaxY="YES"/>
|
||||
<color key="backgroundColor" white="0.0" alpha="0.0" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
|
||||
<collectionViewFlowLayout key="collectionViewLayout" scrollDirection="horizontal" minimumLineSpacing="10" minimumInteritemSpacing="10" id="gR0-ml-XVX">
|
||||
<size key="itemSize" width="55" height="55"/>
|
||||
<size key="itemSize" width="53" height="60"/>
|
||||
<size key="headerReferenceSize" width="0.0" height="0.0"/>
|
||||
<size key="footerReferenceSize" width="0.0" height="0.0"/>
|
||||
<inset key="sectionInset" minX="0.0" minY="0.0" maxX="0.0" maxY="0.0"/>
|
||||
|
|
|
|||
|
|
@ -1,21 +1,21 @@
|
|||
/*
|
||||
* Copyright (c) 2010-2020 Belledonne Communications SARL.
|
||||
*
|
||||
* This file is part of linphone-iphone
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
* Copyright (c) 2010-2020 Belledonne Communications SARL.
|
||||
*
|
||||
* This file is part of linphone-iphone
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
import UIKit
|
||||
|
||||
|
|
@ -25,19 +25,15 @@ import UIKit
|
|||
let textColor = UIColor.black
|
||||
let fontMax = UIFont.systemFont(ofSize: 12)
|
||||
let backgroundColor = forReplyBubble ? UIColor(red: 246/255.0, green: 246/255.0, blue: 246/255.0, alpha: 1.0) : UIColor.white
|
||||
|
||||
let size = CGSize(width: 120, height: 120)
|
||||
|
||||
let scale = UIScreen.main.scale
|
||||
UIGraphicsBeginImageContextWithOptions(size, false, scale)
|
||||
let context = UIGraphicsGetCurrentContext()
|
||||
backgroundColor.setFill()
|
||||
context!.fill(CGRect(x: 0, y: 0, width: size.width, height: size.height))
|
||||
|
||||
let imageSize:CGSize = forReplyBubble ? CGSize(width: 80, height:80*(image.size.height / image.size.width)): image.size
|
||||
|
||||
image.draw(in: CGRect(origin: CGPoint(x: size.width/2 - (imageSize.width)/2,y: (forReplyBubble ? size.height/2 : 90/2) - (imageSize.height)/2), size: imageSize))
|
||||
|
||||
|
||||
if (!forReplyBubble) {
|
||||
let label = UILabel(frame: CGRect(x: 0,y: 0,width: size.width,height: 30))
|
||||
label.numberOfLines = 1
|
||||
|
|
@ -49,8 +45,14 @@ import UIKit
|
|||
label.allowsDefaultTighteningForTruncation = true
|
||||
label.lineBreakMode = .byTruncatingMiddle
|
||||
imageWithLabel(label: label).draw(in: CGRect(origin: CGPoint(x:5,y: 70), size: CGSize(width: size.width-10,height: 30)))
|
||||
let view = UIView(frame: CGRect(x: 0,y: 0,width: size.width,height: 30))
|
||||
view.addSubview(label)
|
||||
} else {
|
||||
let borderWidth: CGFloat = 2.0
|
||||
let path = UIBezierPath(roundedRect: CGRect(x: 0, y: 0, width: 120, height: 120).insetBy(dx: borderWidth / 2, dy: borderWidth / 2), cornerRadius: 5.0)
|
||||
context!.saveGState()
|
||||
path.addClip()
|
||||
UIColor.gray.setStroke()
|
||||
path.lineWidth = borderWidth
|
||||
path.stroke()
|
||||
}
|
||||
|
||||
let newImage = UIGraphicsGetImageFromCurrentImageContext()
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue