mirror of
https://gitlab.opencode.de/bwi/bundesmessenger/clients/bundesmessenger-ios.git
synced 2026-04-21 00:52:43 +02:00
Merge MatrixKit develop with commit hash: b85b736313bec0592bd1cabc68035d97f5331137
This commit is contained in:
@@ -0,0 +1,28 @@
|
||||
/*
|
||||
Copyright 2015 OpenMarket 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/UIKit.h>
|
||||
|
||||
#import "MXKRecentTableViewCell.h"
|
||||
|
||||
/**
|
||||
`MXKInterleavedRecentTableViewCell` instances display a room in the context of the recents list.
|
||||
*/
|
||||
@interface MXKInterleavedRecentTableViewCell : MXKRecentTableViewCell
|
||||
|
||||
@property (weak, nonatomic) IBOutlet UIView* userFlag;
|
||||
|
||||
@end
|
||||
@@ -0,0 +1,64 @@
|
||||
/*
|
||||
Copyright 2015 OpenMarket Ltd
|
||||
Copyright 2017 Vector Creations 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 "MXKInterleavedRecentTableViewCell.h"
|
||||
|
||||
#import "MXKSessionRecentsDataSource.h"
|
||||
|
||||
#import "MXKAccountManager.h"
|
||||
|
||||
@implementation MXKInterleavedRecentTableViewCell
|
||||
|
||||
#pragma mark - Class methods
|
||||
|
||||
- (void)awakeFromNib
|
||||
{
|
||||
[super awakeFromNib];
|
||||
|
||||
CAShapeLayer *userFlagMaskLayer = [[CAShapeLayer alloc] init];
|
||||
userFlagMaskLayer.frame = _userFlag.bounds;
|
||||
|
||||
UIBezierPath *path = [[UIBezierPath alloc] init];
|
||||
[path moveToPoint:CGPointMake(0, 0)];
|
||||
[path addLineToPoint:CGPointMake(_userFlag.frame.size.width, _userFlag.frame.size.height)];
|
||||
[path addLineToPoint:CGPointMake(_userFlag.frame.size.width, 0)];
|
||||
[path closePath];
|
||||
|
||||
userFlagMaskLayer.path = path.CGPath;
|
||||
_userFlag.layer.mask = userFlagMaskLayer;
|
||||
}
|
||||
|
||||
- (void)render:(MXKCellData *)cellData
|
||||
{
|
||||
[super render:cellData];
|
||||
|
||||
// Highlight the room owner by using his tint color.
|
||||
if (roomCellData)
|
||||
{
|
||||
MXKAccount *account = [[MXKAccountManager sharedManager] accountForUserId:roomCellData.mxSession.myUserId];
|
||||
if (account)
|
||||
{
|
||||
_userFlag.backgroundColor = account.userTintColor;
|
||||
}
|
||||
else
|
||||
{
|
||||
_userFlag.backgroundColor = [UIColor clearColor];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@end
|
||||
@@ -0,0 +1,72 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<document type="com.apple.InterfaceBuilder3.CocoaTouch.XIB" version="3.0" toolsVersion="11762" systemVersion="16C67" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" colorMatched="YES">
|
||||
<device id="retina4_7" orientation="portrait">
|
||||
<adaptation id="fullscreen"/>
|
||||
</device>
|
||||
<dependencies>
|
||||
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="11757"/>
|
||||
<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="blue" hidesAccessoryWhenEditing="NO" indentationLevel="1" indentationWidth="0.0" id="L2L-l5-wPx" customClass="MXKInterleavedRecentTableViewCell">
|
||||
<rect key="frame" x="0.0" y="0.0" width="600" height="70"/>
|
||||
<autoresizingMask key="autoresizingMask"/>
|
||||
<tableViewCellContentView key="contentView" opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="center" tableViewCell="L2L-l5-wPx" id="aXz-IR-jj5">
|
||||
<rect key="frame" x="0.0" y="0.0" width="600" height="69"/>
|
||||
<autoresizingMask key="autoresizingMask"/>
|
||||
<subviews>
|
||||
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" verticalHuggingPriority="251" text="RoomTitle" lineBreakMode="middleTruncation" baselineAdjustment="alignBaselines" minimumFontSize="17" translatesAutoresizingMaskIntoConstraints="NO" id="Lg1-xQ-AGn">
|
||||
<rect key="frame" x="8" y="8" width="506" height="23"/>
|
||||
<fontDescription key="fontDescription" type="system" pointSize="19"/>
|
||||
<color key="textColor" cocoaTouchSystemColor="darkTextColor"/>
|
||||
<nil key="highlightedColor"/>
|
||||
</label>
|
||||
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="LastEventDescription" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="dQt-mN-T6b">
|
||||
<rect key="frame" x="8" y="42" width="584" height="18"/>
|
||||
<fontDescription key="fontDescription" type="system" pointSize="15"/>
|
||||
<color key="textColor" cocoaTouchSystemColor="darkTextColor"/>
|
||||
<nil key="highlightedColor"/>
|
||||
</label>
|
||||
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="Oct 12 18:15" textAlignment="right" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="360-Go-RcG">
|
||||
<rect key="frame" x="520" y="8" width="70" height="15"/>
|
||||
<constraints>
|
||||
<constraint firstAttribute="width" relation="greaterThanOrEqual" constant="70" id="gIq-if-W1j"/>
|
||||
</constraints>
|
||||
<fontDescription key="fontDescription" type="system" pointSize="12"/>
|
||||
<color key="textColor" cocoaTouchSystemColor="darkTextColor"/>
|
||||
<nil key="highlightedColor"/>
|
||||
</label>
|
||||
<view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="HGL-DQ-ggW" userLabel="User Flag">
|
||||
<rect key="frame" x="585" y="0.0" width="15" height="15"/>
|
||||
<color key="backgroundColor" red="0.85659327649999994" green="0.0" blue="0.0086100643710000004" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
|
||||
<constraints>
|
||||
<constraint firstAttribute="width" constant="15" id="7tB-c8-gcm"/>
|
||||
<constraint firstAttribute="height" constant="15" id="OGT-6C-aJE"/>
|
||||
</constraints>
|
||||
</view>
|
||||
</subviews>
|
||||
<constraints>
|
||||
<constraint firstItem="Lg1-xQ-AGn" firstAttribute="leading" secondItem="aXz-IR-jj5" secondAttribute="leading" constant="8" id="3qc-BC-FYt"/>
|
||||
<constraint firstItem="HGL-DQ-ggW" firstAttribute="top" secondItem="aXz-IR-jj5" secondAttribute="top" id="EkK-TH-gq3"/>
|
||||
<constraint firstItem="360-Go-RcG" firstAttribute="leading" secondItem="Lg1-xQ-AGn" secondAttribute="trailing" constant="6" id="Mgl-SA-zTT"/>
|
||||
<constraint firstAttribute="trailing" secondItem="HGL-DQ-ggW" secondAttribute="trailing" id="U7B-DW-Irn"/>
|
||||
<constraint firstItem="dQt-mN-T6b" firstAttribute="leading" secondItem="aXz-IR-jj5" secondAttribute="leading" constant="8" id="UYQ-HG-YP1"/>
|
||||
<constraint firstItem="360-Go-RcG" firstAttribute="top" secondItem="aXz-IR-jj5" secondAttribute="top" constant="8" id="XyO-tl-6SX"/>
|
||||
<constraint firstAttribute="trailing" secondItem="360-Go-RcG" secondAttribute="trailing" constant="10" id="YqC-WC-Wqe"/>
|
||||
<constraint firstAttribute="bottom" secondItem="dQt-mN-T6b" secondAttribute="bottom" constant="9" id="sLb-Q4-AFW"/>
|
||||
<constraint firstItem="Lg1-xQ-AGn" firstAttribute="top" secondItem="aXz-IR-jj5" secondAttribute="top" constant="8" id="uCT-KE-X09"/>
|
||||
<constraint firstAttribute="trailing" secondItem="dQt-mN-T6b" secondAttribute="trailing" constant="8" id="ygG-1B-fu3"/>
|
||||
</constraints>
|
||||
</tableViewCellContentView>
|
||||
<color key="backgroundColor" red="1" green="1" blue="1" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
|
||||
<connections>
|
||||
<outlet property="lastEventDate" destination="360-Go-RcG" id="Sj9-Ur-tEZ"/>
|
||||
<outlet property="lastEventDescription" destination="dQt-mN-T6b" id="4OL-5b-Xr0"/>
|
||||
<outlet property="roomTitle" destination="Lg1-xQ-AGn" id="qMk-8c-q6L"/>
|
||||
<outlet property="userFlag" destination="HGL-DQ-ggW" id="RmM-bH-OPT"/>
|
||||
</connections>
|
||||
</tableViewCell>
|
||||
</objects>
|
||||
</document>
|
||||
@@ -0,0 +1,36 @@
|
||||
/*
|
||||
Copyright 2015 OpenMarket 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 <MatrixSDK/MatrixSDK.h>
|
||||
|
||||
#import "MXKTableViewCell.h"
|
||||
|
||||
@interface MXKPublicRoomTableViewCell : MXKTableViewCell
|
||||
|
||||
@property (weak, nonatomic) IBOutlet UILabel *roomDisplayName;
|
||||
@property (weak, nonatomic) IBOutlet UILabel *memberCount;
|
||||
@property (weak, nonatomic) IBOutlet UILabel *roomTopic;
|
||||
|
||||
@property (nonatomic, getter=isHighlightedPublicRoom) BOOL highlightedPublicRoom;
|
||||
|
||||
/**
|
||||
Configure the cell in order to display the public room.
|
||||
|
||||
@param publicRoom the public room to render.
|
||||
*/
|
||||
- (void)render:(MXPublicRoom*)publicRoom;
|
||||
|
||||
@end
|
||||
@@ -0,0 +1,75 @@
|
||||
/*
|
||||
Copyright 2015 OpenMarket 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 "MXKPublicRoomTableViewCell.h"
|
||||
|
||||
#import "NSBundle+MatrixKit.h"
|
||||
|
||||
#import "MXKSwiftHeader.h"
|
||||
|
||||
@implementation MXKPublicRoomTableViewCell
|
||||
|
||||
- (void)render:(MXPublicRoom*)publicRoom
|
||||
{
|
||||
// Check whether this public room has topic
|
||||
if (publicRoom.topic)
|
||||
{
|
||||
_roomTopic.hidden = NO;
|
||||
_roomTopic.text = [MXTools stripNewlineCharacters:publicRoom.topic];
|
||||
}
|
||||
else
|
||||
{
|
||||
_roomTopic.hidden = YES;
|
||||
}
|
||||
|
||||
// Set room display name
|
||||
_roomDisplayName.text = [publicRoom displayname];
|
||||
|
||||
// Set member count
|
||||
if (publicRoom.numJoinedMembers > 1)
|
||||
{
|
||||
_memberCount.text = [MatrixKitL10n numMembersOther:@(publicRoom.numJoinedMembers).stringValue];
|
||||
}
|
||||
else if (publicRoom.numJoinedMembers == 1)
|
||||
{
|
||||
_memberCount.text = [MatrixKitL10n numMembersOne:@(1).stringValue];
|
||||
}
|
||||
else
|
||||
{
|
||||
_memberCount.text = nil;
|
||||
}
|
||||
}
|
||||
|
||||
- (void)setHighlightedPublicRoom:(BOOL)highlightedPublicRoom
|
||||
{
|
||||
// Highlight?
|
||||
if (highlightedPublicRoom)
|
||||
{
|
||||
_roomDisplayName.font = [UIFont boldSystemFontOfSize:20];
|
||||
_roomTopic.font = [UIFont boldSystemFontOfSize:17];
|
||||
self.backgroundColor = [UIColor colorWithRed:1.0 green:1.0 blue:0.9 alpha:1.0];
|
||||
}
|
||||
else
|
||||
{
|
||||
_roomDisplayName.font = [UIFont systemFontOfSize:19];
|
||||
_roomTopic.font = [UIFont systemFontOfSize:16];
|
||||
self.backgroundColor = [UIColor clearColor];
|
||||
}
|
||||
_highlightedPublicRoom = highlightedPublicRoom;
|
||||
}
|
||||
|
||||
@end
|
||||
|
||||
@@ -0,0 +1,59 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<document type="com.apple.InterfaceBuilder3.CocoaTouch.XIB" version="3.0" toolsVersion="11762" systemVersion="16C67" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" colorMatched="YES">
|
||||
<device id="retina4_7" orientation="portrait">
|
||||
<adaptation id="fullscreen"/>
|
||||
</device>
|
||||
<dependencies>
|
||||
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="11757"/>
|
||||
<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="60" id="1og-XA-I5R" customClass="MXKPublicRoomTableViewCell">
|
||||
<rect key="frame" x="0.0" y="0.0" width="600" height="60"/>
|
||||
<autoresizingMask key="autoresizingMask"/>
|
||||
<tableViewCellContentView key="contentView" opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="center" tableViewCell="1og-XA-I5R" id="yko-nD-HEt">
|
||||
<rect key="frame" x="0.0" y="0.0" width="600" height="59"/>
|
||||
<autoresizingMask key="autoresizingMask"/>
|
||||
<subviews>
|
||||
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="roomDisplayName" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="Sv7-ni-jpf">
|
||||
<rect key="frame" x="8" y="8" width="504" height="23"/>
|
||||
<fontDescription key="fontDescription" type="system" pointSize="19"/>
|
||||
<color key="textColor" red="0.0" green="0.0" blue="0.0" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
|
||||
<nil key="highlightedColor"/>
|
||||
</label>
|
||||
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="topic" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="bDg-7n-8BT" userLabel="roomTopic">
|
||||
<rect key="frame" x="8" y="31" width="584" height="20"/>
|
||||
<fontDescription key="fontDescription" type="system" pointSize="16"/>
|
||||
<color key="textColor" red="0.0" green="0.0" blue="0.0" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
|
||||
<nil key="highlightedColor"/>
|
||||
</label>
|
||||
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="xx users" textAlignment="right" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="WXs-b0-uGi">
|
||||
<rect key="frame" x="520" y="11" width="72" height="18"/>
|
||||
<fontDescription key="fontDescription" type="system" pointSize="15"/>
|
||||
<color key="textColor" red="0.0" green="0.0" blue="0.0" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
|
||||
<nil key="highlightedColor"/>
|
||||
</label>
|
||||
</subviews>
|
||||
<constraints>
|
||||
<constraint firstItem="WXs-b0-uGi" firstAttribute="centerY" secondItem="Sv7-ni-jpf" secondAttribute="centerY" id="087-FX-uvV"/>
|
||||
<constraint firstAttribute="trailing" secondItem="WXs-b0-uGi" secondAttribute="trailing" constant="8" id="OD0-ei-aHz"/>
|
||||
<constraint firstItem="bDg-7n-8BT" firstAttribute="top" secondItem="Sv7-ni-jpf" secondAttribute="bottom" id="QbM-0u-MAT"/>
|
||||
<constraint firstItem="bDg-7n-8BT" firstAttribute="leading" secondItem="yko-nD-HEt" secondAttribute="leading" constant="8" id="Ro4-dk-HjK"/>
|
||||
<constraint firstItem="Sv7-ni-jpf" firstAttribute="leading" secondItem="yko-nD-HEt" secondAttribute="leading" constant="8" id="bfl-he-c33"/>
|
||||
<constraint firstItem="Sv7-ni-jpf" firstAttribute="top" secondItem="yko-nD-HEt" secondAttribute="top" constant="8" id="dTb-SA-ePQ"/>
|
||||
<constraint firstAttribute="trailing" secondItem="bDg-7n-8BT" secondAttribute="trailing" constant="8" id="fSL-au-CJv"/>
|
||||
<constraint firstAttribute="bottom" secondItem="bDg-7n-8BT" secondAttribute="bottom" constant="8" id="qdM-vi-lSq"/>
|
||||
<constraint firstItem="WXs-b0-uGi" firstAttribute="leading" secondItem="Sv7-ni-jpf" secondAttribute="trailing" constant="8" id="vj9-dw-ogx"/>
|
||||
<constraint firstAttribute="trailing" secondItem="Sv7-ni-jpf" secondAttribute="trailing" constant="88" id="y1t-fl-0na"/>
|
||||
</constraints>
|
||||
</tableViewCellContentView>
|
||||
<connections>
|
||||
<outlet property="memberCount" destination="WXs-b0-uGi" id="eN4-QZ-jhu"/>
|
||||
<outlet property="roomDisplayName" destination="Sv7-ni-jpf" id="4bX-M6-mjD"/>
|
||||
<outlet property="roomTopic" destination="bDg-7n-8BT" id="8bh-pT-n2L"/>
|
||||
</connections>
|
||||
</tableViewCell>
|
||||
</objects>
|
||||
</document>
|
||||
@@ -0,0 +1,39 @@
|
||||
/*
|
||||
Copyright 2015 OpenMarket 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 "MXKTableViewCell.h"
|
||||
|
||||
#import "MXKCellRendering.h"
|
||||
|
||||
#import "MXKRecentCellDataStoring.h"
|
||||
|
||||
/**
|
||||
`MXKRecentTableViewCell` instances display a room in the context of the recents list.
|
||||
*/
|
||||
@interface MXKRecentTableViewCell : MXKTableViewCell <MXKCellRendering>
|
||||
{
|
||||
@protected
|
||||
/**
|
||||
The current cell data displayed by the table view cell
|
||||
*/
|
||||
id<MXKRecentCellDataStoring> roomCellData;
|
||||
}
|
||||
|
||||
@property (weak, nonatomic) IBOutlet UILabel *roomTitle;
|
||||
@property (weak, nonatomic) IBOutlet UILabel *lastEventDescription;
|
||||
@property (weak, nonatomic) IBOutlet UILabel *lastEventDate;
|
||||
|
||||
@end
|
||||
@@ -0,0 +1,99 @@
|
||||
/*
|
||||
Copyright 2015 OpenMarket Ltd
|
||||
Copyright 2017 Vector Creations 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 "MXKRecentTableViewCell.h"
|
||||
|
||||
#import "MXKSessionRecentsDataSource.h"
|
||||
|
||||
@implementation MXKRecentTableViewCell
|
||||
@synthesize delegate;
|
||||
|
||||
#pragma mark - Class methods
|
||||
|
||||
- (void)render:(MXKCellData *)cellData
|
||||
{
|
||||
roomCellData = (id<MXKRecentCellDataStoring>)cellData;
|
||||
if (roomCellData)
|
||||
{
|
||||
|
||||
// Report computed values as is
|
||||
_roomTitle.text = roomCellData.roomDisplayname;
|
||||
_lastEventDate.text = roomCellData.lastEventDate;
|
||||
|
||||
// Manage lastEventAttributedTextMessage optional property
|
||||
if ([roomCellData respondsToSelector:@selector(lastEventAttributedTextMessage)])
|
||||
{
|
||||
_lastEventDescription.attributedText = roomCellData.lastEventAttributedTextMessage;
|
||||
}
|
||||
else
|
||||
{
|
||||
_lastEventDescription.text = roomCellData.lastEventTextMessage;
|
||||
}
|
||||
|
||||
// Set in bold public room name
|
||||
if ([roomCellData.roomSummary.joinRule isEqualToString:kMXRoomJoinRulePublic])
|
||||
{
|
||||
_roomTitle.font = [UIFont boldSystemFontOfSize:20];
|
||||
}
|
||||
else
|
||||
{
|
||||
_roomTitle.font = [UIFont systemFontOfSize:19];
|
||||
}
|
||||
|
||||
// Set background color and unread count
|
||||
if (roomCellData.hasUnread)
|
||||
{
|
||||
if (0 < roomCellData.highlightCount)
|
||||
{
|
||||
self.backgroundColor = [UIColor colorWithRed:0.9 green:0.9 blue:1 alpha:1.0];
|
||||
}
|
||||
else
|
||||
{
|
||||
self.backgroundColor = [UIColor colorWithRed:1 green:0.9 blue:0.9 alpha:1.0];
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
self.backgroundColor = [UIColor clearColor];
|
||||
}
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
_lastEventDescription.text = @"";
|
||||
}
|
||||
}
|
||||
|
||||
- (MXKCellData*)renderedCellData
|
||||
{
|
||||
return roomCellData;
|
||||
}
|
||||
|
||||
+ (CGFloat)heightForCellData:(MXKCellData *)cellData withMaximumWidth:(CGFloat)maxWidth
|
||||
{
|
||||
// The height is fixed
|
||||
return 70;
|
||||
}
|
||||
|
||||
- (void)prepareForReuse
|
||||
{
|
||||
[super prepareForReuse];
|
||||
|
||||
roomCellData = nil;
|
||||
}
|
||||
|
||||
@end
|
||||
@@ -0,0 +1,61 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<document type="com.apple.InterfaceBuilder3.CocoaTouch.XIB" version="3.0" toolsVersion="11762" systemVersion="16C67" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" colorMatched="YES">
|
||||
<device id="retina4_7" orientation="portrait">
|
||||
<adaptation id="fullscreen"/>
|
||||
</device>
|
||||
<dependencies>
|
||||
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="11757"/>
|
||||
<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="blue" hidesAccessoryWhenEditing="NO" indentationLevel="1" indentationWidth="0.0" id="L2L-l5-wPx" customClass="MXKRecentTableViewCell">
|
||||
<rect key="frame" x="0.0" y="0.0" width="600" height="70"/>
|
||||
<autoresizingMask key="autoresizingMask"/>
|
||||
<tableViewCellContentView key="contentView" opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="center" tableViewCell="L2L-l5-wPx" id="aXz-IR-jj5">
|
||||
<rect key="frame" x="0.0" y="0.0" width="600" height="69"/>
|
||||
<autoresizingMask key="autoresizingMask"/>
|
||||
<subviews>
|
||||
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" verticalHuggingPriority="251" text="RoomTitle" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" minimumFontSize="17" translatesAutoresizingMaskIntoConstraints="NO" id="Lg1-xQ-AGn">
|
||||
<rect key="frame" x="8" y="8" width="508" height="23"/>
|
||||
<fontDescription key="fontDescription" type="system" pointSize="19"/>
|
||||
<color key="textColor" cocoaTouchSystemColor="darkTextColor"/>
|
||||
<nil key="highlightedColor"/>
|
||||
</label>
|
||||
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="LastEventDescription" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="dQt-mN-T6b">
|
||||
<rect key="frame" x="8" y="42" width="584" height="18"/>
|
||||
<fontDescription key="fontDescription" type="system" pointSize="15"/>
|
||||
<color key="textColor" cocoaTouchSystemColor="darkTextColor"/>
|
||||
<nil key="highlightedColor"/>
|
||||
</label>
|
||||
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="Oct 12 18:15" textAlignment="right" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="360-Go-RcG">
|
||||
<rect key="frame" x="522" y="8" width="70" height="15"/>
|
||||
<constraints>
|
||||
<constraint firstAttribute="width" relation="greaterThanOrEqual" constant="70" id="uOj-6w-G8q"/>
|
||||
</constraints>
|
||||
<fontDescription key="fontDescription" type="system" pointSize="12"/>
|
||||
<color key="textColor" cocoaTouchSystemColor="darkTextColor"/>
|
||||
<nil key="highlightedColor"/>
|
||||
</label>
|
||||
</subviews>
|
||||
<constraints>
|
||||
<constraint firstItem="Lg1-xQ-AGn" firstAttribute="leading" secondItem="aXz-IR-jj5" secondAttribute="leading" constant="8" id="3qc-BC-FYt"/>
|
||||
<constraint firstItem="360-Go-RcG" firstAttribute="leading" secondItem="Lg1-xQ-AGn" secondAttribute="trailing" constant="6" id="8ff-tS-Ulq"/>
|
||||
<constraint firstItem="dQt-mN-T6b" firstAttribute="leading" secondItem="aXz-IR-jj5" secondAttribute="leading" constant="8" id="UYQ-HG-YP1"/>
|
||||
<constraint firstItem="360-Go-RcG" firstAttribute="top" secondItem="aXz-IR-jj5" secondAttribute="top" constant="8" id="XyO-tl-6SX"/>
|
||||
<constraint firstAttribute="trailing" secondItem="360-Go-RcG" secondAttribute="trailing" constant="8" id="YqC-WC-Wqe"/>
|
||||
<constraint firstAttribute="bottom" secondItem="dQt-mN-T6b" secondAttribute="bottom" constant="9" id="sLb-Q4-AFW"/>
|
||||
<constraint firstItem="Lg1-xQ-AGn" firstAttribute="top" secondItem="aXz-IR-jj5" secondAttribute="top" constant="8" id="uCT-KE-X09"/>
|
||||
<constraint firstAttribute="trailing" secondItem="dQt-mN-T6b" secondAttribute="trailing" constant="8" id="ygG-1B-fu3"/>
|
||||
</constraints>
|
||||
</tableViewCellContentView>
|
||||
<color key="backgroundColor" red="1" green="1" blue="1" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
|
||||
<connections>
|
||||
<outlet property="lastEventDate" destination="360-Go-RcG" id="JGU-FE-TFH"/>
|
||||
<outlet property="lastEventDescription" destination="dQt-mN-T6b" id="sh8-ZK-nJ7"/>
|
||||
<outlet property="roomTitle" destination="Lg1-xQ-AGn" id="Kz8-2x-4Rs"/>
|
||||
</connections>
|
||||
</tableViewCell>
|
||||
</objects>
|
||||
</document>
|
||||
Reference in New Issue
Block a user