Apply design decisions

This commit is contained in:
ismailgulek
2020-10-06 22:48:04 +03:00
parent bff0e15be9
commit cce9a52607
6 changed files with 106 additions and 47 deletions
@@ -40,6 +40,12 @@ class RoomInfoBasicView: UIView {
@IBOutlet private weak var badgeImageView: UIImageView!
@IBOutlet private weak var roomNameLabel: UILabel!
@IBOutlet private weak var roomAddressLabel: UILabel!
@IBOutlet private weak var topicContainerView: UIView!
@IBOutlet private weak var topicTitleLabel: UILabel! {
didSet {
topicTitleLabel.text = VectorL10n.roomDetailsTopic
}
}
@IBOutlet private weak var roomTopicTextView: ReadMoreTextView! {
didSet {
roomTopicTextView.contentInset = .zero
@@ -50,11 +56,14 @@ class RoomInfoBasicView: UIView {
roomTopicTextView.shouldTrim = true
roomTopicTextView.maximumNumberOfLines = 4
roomTopicTextView.onSizeChange = { _ in
self.roomTopicTextView.textAlignment = .center
self.roomTopicTextView.textAlignment = .left
self.onTopicSizeChange?(self)
}
}
}
@IBOutlet private weak var securityContainerView: UIView!
@IBOutlet private weak var securityTitleLabel: UILabel!
@IBOutlet private weak var securityInformationLabel: UILabel!
/// Block to be invoked when topic text view changes its content size.
var onTopicSizeChange: ((RoomInfoBasicView) -> Void)?
@@ -66,7 +75,7 @@ class RoomInfoBasicView: UIView {
let currentValue = roomTopicTextView.shouldTrim
roomTopicTextView.shouldTrim = !currentValue
roomTopicTextView.shouldTrim = currentValue
roomTopicTextView.textAlignment = .center
roomTopicTextView.textAlignment = .left
}
func configure(withViewData viewData: RoomInfoBasicViewData) {
@@ -90,7 +99,12 @@ class RoomInfoBasicView: UIView {
roomAddressLabel.text = viewData.mainRoomAlias
roomAddressLabel.isHidden = roomAddressLabel.text?.isEmpty ?? true
roomTopicTextView.text = viewData.roomTopic
roomTopicTextView.isHidden = roomTopicTextView.text?.isEmpty ?? true
topicContainerView.isHidden = roomTopicTextView.text?.isEmpty ?? true
securityTitleLabel.text = VectorL10n.securitySettingsTitle
securityInformationLabel.text = viewData.isDirect ?
VectorL10n.roomParticipantsSecurityInformationRoomEncryptedForDm :
VectorL10n.roomParticipantsSecurityInformationRoomEncrypted
securityContainerView.isHidden = !viewData.isEncrypted
}
}
@@ -103,17 +117,18 @@ extension RoomInfoBasicView: Themable {
backgroundColor = theme.headerBackgroundColor
roomNameLabel.textColor = theme.textPrimaryColor
roomAddressLabel.textColor = theme.textSecondaryColor
roomTopicTextView.textColor = theme.textSecondaryColor
topicTitleLabel.textColor = theme.textSecondaryColor
roomTopicTextView.textColor = theme.textPrimaryColor
roomTopicTextView.linkTextAttributes = [
NSAttributedString.Key.font: UIFont.systemFont(ofSize: 16),
NSAttributedString.Key.font: UIFont.systemFont(ofSize: 15),
NSAttributedString.Key.foregroundColor: theme.tintColor
]
let mutableReadMore = NSMutableAttributedString(string: "... ", attributes: [
NSAttributedString.Key.font: UIFont.systemFont(ofSize: 16),
NSAttributedString.Key.foregroundColor: theme.textSecondaryColor
NSAttributedString.Key.font: UIFont.systemFont(ofSize: 15),
NSAttributedString.Key.foregroundColor: theme.textPrimaryColor
])
let attributedMore = NSAttributedString(string: VectorL10n.more, attributes: [
NSAttributedString.Key.font: UIFont.systemFont(ofSize: 16),
NSAttributedString.Key.font: UIFont.systemFont(ofSize: 15),
NSAttributedString.Key.foregroundColor: theme.tintColor
])
mutableReadMore.append(attributedMore)
@@ -121,11 +136,14 @@ extension RoomInfoBasicView: Themable {
let mutableReadLess = NSMutableAttributedString(string: " ")
let attributedLess = NSAttributedString(string: VectorL10n.less, attributes: [
NSAttributedString.Key.font: UIFont.systemFont(ofSize: 16),
NSAttributedString.Key.font: UIFont.systemFont(ofSize: 15),
NSAttributedString.Key.foregroundColor: theme.tintColor
])
mutableReadLess.append(attributedLess)
roomTopicTextView.attributedReadLessText = mutableReadLess
securityTitleLabel.textColor = theme.textSecondaryColor
securityInformationLabel.textColor = theme.textPrimaryColor
}
}
@@ -10,11 +10,11 @@
<placeholder placeholderIdentifier="IBFilesOwner" id="-1" userLabel="File's Owner"/>
<placeholder placeholderIdentifier="IBFirstResponder" id="-2" customClass="UIResponder"/>
<view contentMode="scaleToFill" id="iN0-l3-epB" customClass="RoomInfoBasicView" customModule="Riot" customModuleProvider="target">
<rect key="frame" x="0.0" y="0.0" width="414" height="198"/>
<rect key="frame" x="0.0" y="0.0" width="414" height="307"/>
<autoresizingMask key="autoresizingMask" flexibleMinX="YES" widthSizable="YES" flexibleMaxX="YES" flexibleMinY="YES" heightSizable="YES" flexibleMaxY="YES"/>
<subviews>
<stackView opaque="NO" contentMode="scaleToFill" verticalCompressionResistancePriority="751" axis="vertical" alignment="center" spacing="8" translatesAutoresizingMaskIntoConstraints="NO" id="xmU-kN-zva">
<rect key="frame" x="26" y="0.0" width="362" height="198"/>
<rect key="frame" x="26" y="0.0" width="362" height="307"/>
<subviews>
<view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="Tgy-Pv-0Gz">
<rect key="frame" x="61" y="0.0" width="240" height="1"/>
@@ -64,36 +64,84 @@
</constraints>
</view>
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" text="Label" textAlignment="center" lineBreakMode="tailTruncation" numberOfLines="0" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="ekk-PI-fnh">
<rect key="frame" x="156" y="97" width="50.5" height="29.5"/>
<rect key="frame" x="156" y="97" width="50.5" height="24"/>
<fontDescription key="fontDescription" type="system" weight="semibold" pointSize="20"/>
<nil key="textColor"/>
<nil key="highlightedColor"/>
</label>
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" verticalHuggingPriority="251" text="Label" textAlignment="center" lineBreakMode="tailTruncation" numberOfLines="0" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="Yjw-ez-u4W">
<rect key="frame" x="161.5" y="134.5" width="39.5" height="19.5"/>
<rect key="frame" x="161.5" y="129" width="39.5" height="19.5"/>
<fontDescription key="fontDescription" type="system" pointSize="16"/>
<nil key="textColor"/>
<nil key="highlightedColor"/>
</label>
<textView clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="scaleToFill" verticalHuggingPriority="252" scrollEnabled="NO" showsHorizontalScrollIndicator="NO" showsVerticalScrollIndicator="NO" editable="NO" text="Lorem ipsum" textAlignment="center" translatesAutoresizingMaskIntoConstraints="NO" id="DCx-MH-TSC" customClass="ReadMoreTextView" customModule="ReadMoreTextView">
<rect key="frame" x="0.0" y="162" width="362" height="36"/>
<view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="NSk-JY-5iY">
<rect key="frame" x="0.0" y="156.5" width="362" height="78"/>
<subviews>
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" verticalHuggingPriority="251" text="Topic" textAlignment="center" lineBreakMode="tailTruncation" numberOfLines="0" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="cTV-D7-Uha">
<rect key="frame" x="0.0" y="8" width="33" height="16"/>
<fontDescription key="fontDescription" type="system" pointSize="13"/>
<nil key="textColor"/>
<nil key="highlightedColor"/>
</label>
<textView clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="scaleToFill" verticalHuggingPriority="252" scrollEnabled="NO" showsHorizontalScrollIndicator="NO" showsVerticalScrollIndicator="NO" editable="NO" text="Lorem ipsum" translatesAutoresizingMaskIntoConstraints="NO" id="DCx-MH-TSC" customClass="ReadMoreTextView" customModule="ReadMoreTextView">
<rect key="frame" x="0.0" y="36" width="362" height="34"/>
<color key="backgroundColor" white="0.0" alpha="0.0" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
<color key="textColor" systemColor="labelColor" cocoaTouchSystemColor="darkTextColor"/>
<fontDescription key="fontDescription" type="system" pointSize="15"/>
<textInputTraits key="textInputTraits" autocapitalizationType="sentences"/>
<dataDetectorType key="dataDetectorTypes" phoneNumber="YES" link="YES" address="YES" calendarEvent="YES" shipmentTrackingNumber="YES" flightNumber="YES"/>
<userDefinedRuntimeAttributes>
<userDefinedRuntimeAttribute type="number" keyPath="maximumNumberOfLines">
<integer key="value" value="4"/>
</userDefinedRuntimeAttribute>
<userDefinedRuntimeAttribute type="boolean" keyPath="shouldTrim" value="YES"/>
</userDefinedRuntimeAttributes>
</textView>
</subviews>
<color key="backgroundColor" white="0.0" alpha="0.0" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
<color key="textColor" systemColor="labelColor" cocoaTouchSystemColor="darkTextColor"/>
<fontDescription key="fontDescription" type="system" pointSize="16"/>
<textInputTraits key="textInputTraits" autocapitalizationType="sentences"/>
<dataDetectorType key="dataDetectorTypes" phoneNumber="YES" link="YES" address="YES" calendarEvent="YES" shipmentTrackingNumber="YES" flightNumber="YES"/>
<userDefinedRuntimeAttributes>
<userDefinedRuntimeAttribute type="number" keyPath="maximumNumberOfLines">
<integer key="value" value="4"/>
</userDefinedRuntimeAttribute>
<userDefinedRuntimeAttribute type="boolean" keyPath="shouldTrim" value="YES"/>
</userDefinedRuntimeAttributes>
</textView>
<constraints>
<constraint firstItem="DCx-MH-TSC" firstAttribute="top" secondItem="cTV-D7-Uha" secondAttribute="bottom" constant="12" id="LY8-cQ-p3H"/>
<constraint firstAttribute="trailing" secondItem="DCx-MH-TSC" secondAttribute="trailing" id="Nrg-wG-AlG"/>
<constraint firstItem="cTV-D7-Uha" firstAttribute="leading" secondItem="NSk-JY-5iY" secondAttribute="leading" id="Uab-wX-GVB"/>
<constraint firstItem="cTV-D7-Uha" firstAttribute="top" secondItem="NSk-JY-5iY" secondAttribute="top" constant="8" id="Ut8-xr-JTf"/>
<constraint firstItem="DCx-MH-TSC" firstAttribute="leading" secondItem="NSk-JY-5iY" secondAttribute="leading" id="c6P-hF-axm"/>
<constraint firstAttribute="bottom" secondItem="DCx-MH-TSC" secondAttribute="bottom" constant="8" id="h2M-48-9Ly"/>
</constraints>
</view>
<view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="l54-5L-xAv">
<rect key="frame" x="0.0" y="242.5" width="362" height="64.5"/>
<subviews>
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" verticalHuggingPriority="251" text="Security" textAlignment="center" lineBreakMode="tailTruncation" numberOfLines="0" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="peB-51-q5w">
<rect key="frame" x="0.0" y="8" width="50" height="18.5"/>
<fontDescription key="fontDescription" type="system" pointSize="13"/>
<nil key="textColor"/>
<nil key="highlightedColor"/>
</label>
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" verticalHuggingPriority="251" text="Messages in this room are end to end encrypted" lineBreakMode="tailTruncation" numberOfLines="0" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="HAS-Tr-iTE">
<rect key="frame" x="0.0" y="38.5" width="362" height="18"/>
<fontDescription key="fontDescription" type="system" pointSize="15"/>
<nil key="textColor"/>
<nil key="highlightedColor"/>
</label>
</subviews>
<color key="backgroundColor" white="0.0" alpha="0.0" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
<constraints>
<constraint firstAttribute="trailing" secondItem="HAS-Tr-iTE" secondAttribute="trailing" id="6Ai-05-Ysx"/>
<constraint firstItem="HAS-Tr-iTE" firstAttribute="top" secondItem="peB-51-q5w" secondAttribute="bottom" constant="12" id="HZu-IN-h4I"/>
<constraint firstItem="peB-51-q5w" firstAttribute="leading" secondItem="l54-5L-xAv" secondAttribute="leading" id="IjP-wz-F8H"/>
<constraint firstItem="peB-51-q5w" firstAttribute="top" secondItem="l54-5L-xAv" secondAttribute="top" constant="8" id="LFK-W4-Gpw"/>
<constraint firstAttribute="bottom" secondItem="HAS-Tr-iTE" secondAttribute="bottom" constant="8" id="Sjx-QS-Rfb"/>
<constraint firstItem="HAS-Tr-iTE" firstAttribute="leading" secondItem="l54-5L-xAv" secondAttribute="leading" id="vnf-AI-9s6"/>
</constraints>
</view>
</subviews>
<color key="backgroundColor" white="0.0" alpha="0.0" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
<constraints>
<constraint firstItem="DCx-MH-TSC" firstAttribute="leading" secondItem="xmU-kN-zva" secondAttribute="leading" id="Sv1-Mq-Zt2"/>
<constraint firstAttribute="trailing" secondItem="DCx-MH-TSC" secondAttribute="trailing" id="rpo-QH-rrI"/>
<constraint firstItem="NSk-JY-5iY" firstAttribute="leading" secondItem="xmU-kN-zva" secondAttribute="leading" id="Rds-uI-ZDv"/>
<constraint firstAttribute="trailing" secondItem="l54-5L-xAv" secondAttribute="trailing" id="ggk-iS-EdG"/>
<constraint firstAttribute="trailing" secondItem="NSk-JY-5iY" secondAttribute="trailing" id="lwP-Fm-6fy"/>
<constraint firstItem="l54-5L-xAv" firstAttribute="leading" secondItem="xmU-kN-zva" secondAttribute="leading" id="q9M-lt-GmG"/>
</constraints>
</stackView>
</subviews>
@@ -112,9 +160,14 @@
<outlet property="roomAddressLabel" destination="Yjw-ez-u4W" id="R1L-VC-qHV"/>
<outlet property="roomNameLabel" destination="ekk-PI-fnh" id="prM-OG-suY"/>
<outlet property="roomTopicTextView" destination="DCx-MH-TSC" id="MB0-cS-wfD"/>
<outlet property="securityContainerView" destination="l54-5L-xAv" id="Duy-QA-wrD"/>
<outlet property="securityInformationLabel" destination="HAS-Tr-iTE" id="GZC-gT-q2z"/>
<outlet property="securityTitleLabel" destination="peB-51-q5w" id="hbl-K6-AbE"/>
<outlet property="shadowView" destination="szu-r5-TIX" id="LDd-uy-FAG"/>
<outlet property="topicContainerView" destination="NSk-JY-5iY" id="YCo-cp-dbU"/>
<outlet property="topicTitleLabel" destination="cTV-D7-Uha" id="nt9-MZ-4t7"/>
</connections>
<point key="canvasLocation" x="155.07246376811597" y="-290.625"/>
<point key="canvasLocation" x="155.07246376811597" y="-254.12946428571428"/>
</view>
</objects>
</document>
@@ -26,4 +26,6 @@ struct RoomInfoBasicViewData {
let mainRoomAlias: String?
let roomTopic: String?
let encryptionImage: UIImage?
let isEncrypted: Bool
let isDirect: Bool
}