mirror of
https://gitlab.opencode.de/bwi/bundesmessenger/clients/bundesmessenger-ios.git
synced 2026-04-23 10:02:46 +02:00
Add basic info cells
This commit is contained in:
@@ -0,0 +1,47 @@
|
||||
//
|
||||
// Copyright 2020 New Vector Ltd
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
// you may not use this file except in compliance with the License.
|
||||
// You may obtain a copy of the License at
|
||||
//
|
||||
// http://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
// Unless required by applicable law or agreed to in writing, software
|
||||
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
//
|
||||
|
||||
import UIKit
|
||||
import Reusable
|
||||
import MatrixKit
|
||||
|
||||
class RoomInfoBasicTableViewCell: UITableViewCell {
|
||||
|
||||
@IBOutlet private weak var avatarImageView: MXKImageView!
|
||||
@IBOutlet private weak var badgeImageView: UIImageView!
|
||||
@IBOutlet private weak var roomNameLabel: UILabel!
|
||||
@IBOutlet private weak var roomAddressLabel: UILabel!
|
||||
|
||||
func configure(withViewModel viewModel: RoomInfoBasicTableViewCellVM) {
|
||||
viewModel.setAvatar(in: avatarImageView)
|
||||
viewModel.setEncryptionIcon(in: badgeImageView)
|
||||
roomNameLabel.text = viewModel.roomName
|
||||
roomAddressLabel.text = viewModel.roomAddress
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
extension RoomInfoBasicTableViewCell: NibReusable {}
|
||||
|
||||
extension RoomInfoBasicTableViewCell: Themable {
|
||||
|
||||
func update(theme: Theme) {
|
||||
contentView.backgroundColor = theme.headerBackgroundColor
|
||||
roomNameLabel.textColor = theme.textPrimaryColor
|
||||
roomAddressLabel.textColor = theme.textSecondaryColor
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,77 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<document type="com.apple.InterfaceBuilder3.CocoaTouch.XIB" version="3.0" toolsVersion="16096" 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="16087"/>
|
||||
<capability name="Safe area layout guides" minToolsVersion="9.0"/>
|
||||
<capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/>
|
||||
</dependencies>
|
||||
<objects>
|
||||
<placeholder placeholderIdentifier="IBFilesOwner" id="-1" userLabel="File's Owner"/>
|
||||
<placeholder placeholderIdentifier="IBFirstResponder" id="-2" customClass="UIResponder"/>
|
||||
<tableViewCell contentMode="scaleToFill" selectionStyle="default" indentationWidth="10" rowHeight="176" id="KGk-i7-Jjw" customClass="RoomInfoBasicTableViewCell" customModule="Riot" customModuleProvider="target">
|
||||
<rect key="frame" x="0.0" y="0.0" width="320" height="176"/>
|
||||
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/>
|
||||
<tableViewCellContentView key="contentView" opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="center" tableViewCell="KGk-i7-Jjw" id="H2p-sc-9uM">
|
||||
<rect key="frame" x="0.0" y="0.0" width="320" height="176"/>
|
||||
<autoresizingMask key="autoresizingMask"/>
|
||||
<subviews>
|
||||
<view clipsSubviews="YES" contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="Ih9-pn-UCp" customClass="MXKImageView">
|
||||
<rect key="frame" x="120" y="20" width="80" height="80"/>
|
||||
<color key="backgroundColor" white="0.0" alpha="0.0" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
|
||||
<constraints>
|
||||
<constraint firstAttribute="width" constant="80" id="O3p-iU-hNS"/>
|
||||
<constraint firstAttribute="height" constant="80" id="x7L-ck-2Yh"/>
|
||||
</constraints>
|
||||
<userDefinedRuntimeAttributes>
|
||||
<userDefinedRuntimeAttribute type="number" keyPath="layer.cornerRadius">
|
||||
<integer key="value" value="40"/>
|
||||
</userDefinedRuntimeAttribute>
|
||||
</userDefinedRuntimeAttributes>
|
||||
</view>
|
||||
<imageView clipsSubviews="YES" userInteractionEnabled="NO" contentMode="scaleAspectFit" horizontalHuggingPriority="251" verticalHuggingPriority="251" translatesAutoresizingMaskIntoConstraints="NO" id="w9i-el-cnZ">
|
||||
<rect key="frame" x="178" y="78" width="24" height="24"/>
|
||||
<constraints>
|
||||
<constraint firstAttribute="height" constant="24" id="bnv-KV-cKC"/>
|
||||
<constraint firstAttribute="width" constant="24" id="okP-qE-wlS"/>
|
||||
</constraints>
|
||||
</imageView>
|
||||
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" verticalCompressionResistancePriority="751" text="Label" textAlignment="center" lineBreakMode="tailTruncation" numberOfLines="2" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="uiN-p3-IYo">
|
||||
<rect key="frame" x="16" y="110" width="288" 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" text="Label" textAlignment="center" lineBreakMode="tailTruncation" numberOfLines="2" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="Ack-lj-oiX">
|
||||
<rect key="frame" x="16" y="142" width="288" height="18"/>
|
||||
<fontDescription key="fontDescription" type="system" pointSize="16"/>
|
||||
<nil key="textColor"/>
|
||||
<nil key="highlightedColor"/>
|
||||
</label>
|
||||
</subviews>
|
||||
<constraints>
|
||||
<constraint firstItem="uiN-p3-IYo" firstAttribute="top" secondItem="Ih9-pn-UCp" secondAttribute="bottom" constant="10" id="0lK-pr-i7O"/>
|
||||
<constraint firstAttribute="bottom" secondItem="Ack-lj-oiX" secondAttribute="bottom" constant="16" id="2NF-DW-HlN"/>
|
||||
<constraint firstItem="Ack-lj-oiX" firstAttribute="top" secondItem="uiN-p3-IYo" secondAttribute="bottom" constant="8" id="61S-XG-WG5"/>
|
||||
<constraint firstAttribute="trailing" secondItem="uiN-p3-IYo" secondAttribute="trailing" constant="16" id="CQu-se-rNL"/>
|
||||
<constraint firstItem="uiN-p3-IYo" firstAttribute="leading" secondItem="H2p-sc-9uM" secondAttribute="leading" constant="16" id="DxO-wJ-0ER"/>
|
||||
<constraint firstItem="Ih9-pn-UCp" firstAttribute="top" secondItem="H2p-sc-9uM" secondAttribute="top" constant="20" id="TR9-Ku-qVl"/>
|
||||
<constraint firstAttribute="trailing" secondItem="Ack-lj-oiX" secondAttribute="trailing" constant="16" id="Unh-dc-S3G"/>
|
||||
<constraint firstItem="w9i-el-cnZ" firstAttribute="bottom" secondItem="Ih9-pn-UCp" secondAttribute="bottom" constant="2" id="lCQ-6E-yIp"/>
|
||||
<constraint firstItem="w9i-el-cnZ" firstAttribute="trailing" secondItem="Ih9-pn-UCp" secondAttribute="trailing" constant="2" id="o7w-oC-qoA"/>
|
||||
<constraint firstItem="Ack-lj-oiX" firstAttribute="leading" secondItem="H2p-sc-9uM" secondAttribute="leading" constant="16" id="zET-7P-QbW"/>
|
||||
<constraint firstItem="Ih9-pn-UCp" firstAttribute="centerX" secondItem="H2p-sc-9uM" secondAttribute="centerX" id="znG-nA-X2V"/>
|
||||
</constraints>
|
||||
</tableViewCellContentView>
|
||||
<viewLayoutGuide key="safeArea" id="njF-e1-oar"/>
|
||||
<connections>
|
||||
<outlet property="avatarImageView" destination="Ih9-pn-UCp" id="U8T-qs-55q"/>
|
||||
<outlet property="badgeImageView" destination="w9i-el-cnZ" id="WcY-6X-XFR"/>
|
||||
<outlet property="roomAddressLabel" destination="Ack-lj-oiX" id="YDF-XH-PfM"/>
|
||||
<outlet property="roomNameLabel" destination="uiN-p3-IYo" id="rN5-Cr-Qf8"/>
|
||||
</connections>
|
||||
<point key="canvasLocation" x="137.68115942028987" y="135.60267857142856"/>
|
||||
</tableViewCell>
|
||||
</objects>
|
||||
</document>
|
||||
@@ -0,0 +1,25 @@
|
||||
//
|
||||
// Copyright 2020 New Vector Ltd
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
// you may not use this file except in compliance with the License.
|
||||
// You may obtain a copy of the License at
|
||||
//
|
||||
// http://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
// Unless required by applicable law or agreed to in writing, software
|
||||
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
//
|
||||
|
||||
import Foundation
|
||||
import MatrixKit
|
||||
|
||||
protocol RoomInfoBasicTableViewCellVM {
|
||||
func setAvatar(in avatarImageView: MXKImageView)
|
||||
func setEncryptionIcon(in imageView: UIImageView)
|
||||
var roomName: String? { get }
|
||||
var roomAddress: String? { get }
|
||||
}
|
||||
Reference in New Issue
Block a user