mirror of
https://gitlab.opencode.de/bwi/bundesmessenger/clients/bundesmessenger-ios.git
synced 2026-04-21 17:12:45 +02:00
Add thread decoration views for search results, fix #5268
This commit is contained in:
@@ -0,0 +1,54 @@
|
||||
//
|
||||
// Copyright 2021 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 Reusable
|
||||
|
||||
@objcMembers
|
||||
class FromThreadView: UIView {
|
||||
|
||||
private enum Constants {
|
||||
static let viewHeight: CGFloat = 18
|
||||
}
|
||||
|
||||
@IBOutlet private weak var iconView: UIImageView!
|
||||
@IBOutlet private weak var titleLabel: UILabel!
|
||||
|
||||
static func contentViewHeight(forEvent event: MXEvent,
|
||||
fitting maxWidth: CGFloat) -> CGFloat {
|
||||
return Constants.viewHeight
|
||||
}
|
||||
|
||||
static func instantiate() -> FromThreadView {
|
||||
let view = FromThreadView.loadFromNib()
|
||||
view.update(theme: ThemeService.shared().theme)
|
||||
view.titleLabel.text = VectorL10n.messageFromAThread
|
||||
return view
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
extension FromThreadView: NibLoadable {}
|
||||
|
||||
extension FromThreadView: Themable {
|
||||
|
||||
func update(theme: Theme) {
|
||||
backgroundColor = .clear
|
||||
iconView.tintColor = theme.colors.secondaryContent
|
||||
titleLabel.textColor = theme.colors.secondaryContent
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,59 @@
|
||||
<?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">
|
||||
<device id="retina6_1" orientation="portrait" appearance="light"/>
|
||||
<dependencies>
|
||||
<deployment identifier="iOS"/>
|
||||
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="18093"/>
|
||||
<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"/>
|
||||
</dependencies>
|
||||
<objects>
|
||||
<placeholder placeholderIdentifier="IBFilesOwner" id="-1" userLabel="File's Owner"/>
|
||||
<placeholder placeholderIdentifier="IBFirstResponder" id="-2" customClass="UIResponder"/>
|
||||
<view contentMode="scaleToFill" id="iN0-l3-epB" customClass="FromThreadView" customModule="Riot" customModuleProvider="target">
|
||||
<rect key="frame" x="0.0" y="0.0" width="139" height="44"/>
|
||||
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
|
||||
<subviews>
|
||||
<stackView opaque="NO" contentMode="scaleToFill" spacing="4" translatesAutoresizingMaskIntoConstraints="NO" id="gZf-Nh-De6">
|
||||
<rect key="frame" x="0.0" y="0.0" width="139" height="44"/>
|
||||
<subviews>
|
||||
<imageView clipsSubviews="YES" userInteractionEnabled="NO" contentMode="scaleAspectFit" horizontalHuggingPriority="251" verticalHuggingPriority="251" image="threads_icon" translatesAutoresizingMaskIntoConstraints="NO" id="cdy-fz-kjn">
|
||||
<rect key="frame" x="0.0" y="0.0" width="18" height="44"/>
|
||||
<constraints>
|
||||
<constraint firstAttribute="height" constant="18" id="3mH-It-De7"/>
|
||||
<constraint firstAttribute="width" constant="18" id="Jzw-cL-zxG"/>
|
||||
</constraints>
|
||||
</imageView>
|
||||
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="From a thread" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="fX6-Xz-I4e">
|
||||
<rect key="frame" x="22" y="0.0" width="117" height="44"/>
|
||||
<fontDescription key="fontDescription" type="system" pointSize="13"/>
|
||||
<nil key="textColor"/>
|
||||
<nil key="highlightedColor"/>
|
||||
</label>
|
||||
</subviews>
|
||||
</stackView>
|
||||
</subviews>
|
||||
<viewLayoutGuide key="safeArea" id="vUN-kp-3ea"/>
|
||||
<color key="backgroundColor" systemColor="systemBackgroundColor"/>
|
||||
<constraints>
|
||||
<constraint firstItem="gZf-Nh-De6" firstAttribute="top" secondItem="iN0-l3-epB" secondAttribute="top" id="0Hy-t1-GHo"/>
|
||||
<constraint firstAttribute="bottom" secondItem="gZf-Nh-De6" secondAttribute="bottom" id="Pye-fH-Zny"/>
|
||||
<constraint firstItem="gZf-Nh-De6" firstAttribute="leading" secondItem="vUN-kp-3ea" secondAttribute="leading" id="b2i-tg-f7D"/>
|
||||
<constraint firstItem="vUN-kp-3ea" firstAttribute="trailing" secondItem="gZf-Nh-De6" secondAttribute="trailing" id="w9I-0I-lD2"/>
|
||||
</constraints>
|
||||
<freeformSimulatedSizeMetrics key="simulatedDestinationMetrics"/>
|
||||
<connections>
|
||||
<outlet property="iconView" destination="cdy-fz-kjn" id="Kev-ko-oTu"/>
|
||||
<outlet property="titleLabel" destination="fX6-Xz-I4e" id="65X-PJ-RpF"/>
|
||||
</connections>
|
||||
<point key="canvasLocation" x="-119.56521739130436" y="-252.45535714285714"/>
|
||||
</view>
|
||||
</objects>
|
||||
<resources>
|
||||
<image name="threads_icon" width="27" height="28.5"/>
|
||||
<systemColor name="systemBackgroundColor">
|
||||
<color white="1" alpha="1" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
|
||||
</systemColor>
|
||||
</resources>
|
||||
</document>
|
||||
Reference in New Issue
Block a user