Create new labels for inner content view

This commit is contained in:
ismailgulek
2021-03-12 02:26:03 +03:00
parent b0def4305a
commit fea1d3a75c
2 changed files with 49 additions and 6 deletions
@@ -19,6 +19,11 @@ import Reusable
class CallBubbleCellBaseContentView: UIView {
private enum Constants {
static let callSummaryWithBottomViewHeight: CGFloat = 20
static let callSummaryStandaloneViewHeight: CGFloat = 20 + 64
}
@IBOutlet private weak var paginationTitleView: UIView!
@IBOutlet private weak var paginationLabel: UILabel!
@IBOutlet private weak var paginationSeparatorView: UIView!
@@ -28,13 +33,34 @@ class CallBubbleCellBaseContentView: UIView {
@IBOutlet private weak var callerNameLabel: UILabel!
@IBOutlet private weak var callIconView: UIImageView!
@IBOutlet private weak var callTypeLabel: UILabel!
@IBOutlet private weak var dotLabel: UILabel!
@IBOutlet private weak var callStatusLabel: UILabel!
@IBOutlet private weak var callSummaryHeightConstraint: NSLayoutConstraint!
@IBOutlet weak var bubbleOverlayContainer: UIView!
@IBOutlet weak var bottomContainerView: UIView!
var statusText: String? {
didSet {
dotLabel.isHidden = statusText == nil
callStatusLabel.text = statusText
}
}
private var theme: Theme = ThemeService.shared().theme
func relayoutCallSummary() {
if bottomContainerView.subviews.isEmpty {
callSummaryHeightConstraint.constant = Constants.callSummaryStandaloneViewHeight
} else {
callSummaryHeightConstraint.constant = Constants.callSummaryWithBottomViewHeight
}
setNeedsLayout()
layoutIfNeeded()
}
func render(_ cellData: MXKCellData) {
guard let bubbleCellData = cellData as? RoomBubbleCellData else {
return
@@ -110,6 +136,8 @@ extension CallBubbleCellBaseContentView: Themable {
bgView.backgroundColor = theme.headerBackgroundColor
callIconView.tintColor = theme.textSecondaryColor
callTypeLabel.textColor = theme.textSecondaryColor
dotLabel.textColor = theme.textSecondaryColor
callStatusLabel.textColor = theme.textSecondaryColor
if let bottomContainerView = bottomContainerView as? Themable {
bottomContainerView.update(theme: theme)
@@ -1,9 +1,9 @@
<?xml version="1.0" encoding="UTF-8"?>
<document type="com.apple.InterfaceBuilder3.CocoaTouch.XIB" version="3.0" toolsVersion="17506" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" useSafeAreas="YES" colorMatched="YES">
<document type="com.apple.InterfaceBuilder3.CocoaTouch.XIB" version="3.0" toolsVersion="17701" 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="17505"/>
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="17703"/>
<capability name="Safe area layout guides" minToolsVersion="9.0"/>
<capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/>
</dependencies>
@@ -74,16 +74,16 @@
</userDefinedRuntimeAttributes>
</view>
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="Caller Name" textAlignment="center" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="ONW-WU-t2g">
<rect key="frame" x="8" y="56" width="328" height="27"/>
<rect key="frame" x="8" y="56" width="328" height="32"/>
<constraints>
<constraint firstAttribute="height" constant="27" id="iNJ-kn-6dl"/>
<constraint firstAttribute="height" constant="32" id="iNJ-kn-6dl"/>
</constraints>
<fontDescription key="fontDescription" type="system" weight="semibold" pointSize="15"/>
<nil key="textColor"/>
<nil key="highlightedColor"/>
</label>
<stackView opaque="NO" contentMode="scaleToFill" alignment="center" spacing="2" translatesAutoresizingMaskIntoConstraints="NO" id="kdm-vj-rsY">
<rect key="frame" x="136" y="83" width="72" height="20"/>
<rect key="frame" x="102" y="88" width="140" height="20"/>
<subviews>
<imageView clipsSubviews="YES" userInteractionEnabled="NO" contentMode="scaleAspectFit" horizontalHuggingPriority="251" verticalHuggingPriority="251" image="voice_call_hangon_icon" translatesAutoresizingMaskIntoConstraints="NO" id="iQL-Bn-D9b">
<rect key="frame" x="0.0" y="2" width="16" height="16"/>
@@ -98,13 +98,25 @@
<nil key="textColor"/>
<nil key="highlightedColor"/>
</label>
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="•" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="6xJ-gU-ls1">
<rect key="frame" x="74" y="3" width="6" height="14.5"/>
<fontDescription key="fontDescription" type="system" pointSize="12"/>
<nil key="textColor"/>
<nil key="highlightedColor"/>
</label>
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="Active call" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="A3h-4o-nXF">
<rect key="frame" x="82" y="3" width="58" height="14.5"/>
<fontDescription key="fontDescription" type="system" pointSize="12"/>
<nil key="textColor"/>
<nil key="highlightedColor"/>
</label>
</subviews>
<constraints>
<constraint firstAttribute="height" constant="20" id="xI1-oH-QU6"/>
</constraints>
</stackView>
<view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="ce0-Kh-hec">
<rect key="frame" x="0.0" y="103" width="344" height="50"/>
<rect key="frame" x="0.0" y="108" width="344" height="45"/>
<color key="backgroundColor" white="0.0" alpha="0.0" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
</view>
</subviews>
@@ -155,8 +167,11 @@
<outlet property="bottomContainerView" destination="ce0-Kh-hec" id="Bab-JS-9Th"/>
<outlet property="bubbleOverlayContainer" destination="8Fb-Sw-AW5" id="E46-Pt-XXj"/>
<outlet property="callIconView" destination="iQL-Bn-D9b" id="Cih-PG-EM2"/>
<outlet property="callStatusLabel" destination="A3h-4o-nXF" id="9Zf-aC-DAq"/>
<outlet property="callSummaryHeightConstraint" destination="xI1-oH-QU6" id="EnC-Bt-TkY"/>
<outlet property="callTypeLabel" destination="alq-3S-yHg" id="lgA-Dw-PH2"/>
<outlet property="callerNameLabel" destination="ONW-WU-t2g" id="0Vj-Xn-CLD"/>
<outlet property="dotLabel" destination="6xJ-gU-ls1" id="8ln-dF-l7V"/>
<outlet property="paginationLabel" destination="GQH-kh-LXA" id="Mww-Ps-yv1"/>
<outlet property="paginationSeparatorView" destination="YdR-PH-eGM" id="aK7-LF-awm"/>
<outlet property="paginationTitleView" destination="H6S-AE-DTm" id="yep-a0-QYq"/>