mirror of
https://github.com/vector-im/element-ios.git
synced 2024-09-28 23:32:41 +00:00
Merge pull request #1371 from vector-im/room_name_on_2_lines
Room name on 2 lines
This commit is contained in:
commit
e1c98ae657
3 changed files with 64 additions and 19 deletions
|
@ -29,6 +29,8 @@
|
|||
}
|
||||
|
||||
@property (weak, nonatomic) IBOutlet UILabel *roomTitle;
|
||||
@property (weak, nonatomic) IBOutlet UILabel *roomTitle1;
|
||||
@property (weak, nonatomic) IBOutlet UILabel *roomTitle2;
|
||||
|
||||
@property (weak, nonatomic) IBOutlet UIView *directRoomBorderView;
|
||||
@property (weak, nonatomic) IBOutlet MXKImageView *roomAvatar;
|
||||
|
|
|
@ -22,6 +22,8 @@
|
|||
|
||||
#import "MXRoom+Riot.h"
|
||||
|
||||
#import "MXTools.h"
|
||||
|
||||
@implementation RoomCollectionViewCell
|
||||
|
||||
#pragma mark - Class methods
|
||||
|
@ -39,6 +41,8 @@
|
|||
_missedNotifAndUnreadBadgeBgViewWidthConstraint.constant = 0;
|
||||
|
||||
self.roomTitle.textColor = kRiotTextColorBlack;
|
||||
self.roomTitle1.textColor = kRiotTextColorBlack;
|
||||
self.roomTitle2.textColor = kRiotTextColorBlack;
|
||||
self.missedNotifAndUnreadBadgeLabel.textColor = [UIColor whiteColor];
|
||||
|
||||
// Prepare direct room border
|
||||
|
@ -66,7 +70,24 @@
|
|||
if (roomCellData)
|
||||
{
|
||||
// Report computed values as is
|
||||
self.roomTitle.hidden = NO;
|
||||
self.roomTitle.text = roomCellData.roomDisplayname;
|
||||
self.roomTitle1.hidden = YES;
|
||||
self.roomTitle2.hidden = YES;
|
||||
|
||||
// Check whether the room display name is an alias to keep visible the HS.
|
||||
if ([MXTools isMatrixRoomAlias:roomCellData.roomDisplayname])
|
||||
{
|
||||
NSRange range = [roomCellData.roomDisplayname rangeOfString:@":" options:NSBackwardsSearch];
|
||||
if (range.location != NSNotFound)
|
||||
{
|
||||
self.roomTitle.hidden = YES;
|
||||
self.roomTitle1.hidden = NO;
|
||||
self.roomTitle1.text = [roomCellData.roomDisplayname substringToIndex:range.location + 1];
|
||||
self.roomTitle2.hidden = NO;
|
||||
self.roomTitle2.text = [roomCellData.roomDisplayname substringFromIndex:range.location + 1];
|
||||
}
|
||||
}
|
||||
|
||||
// Notify unreads and bing
|
||||
if (roomCellData.hasUnread)
|
||||
|
@ -85,11 +106,11 @@
|
|||
// Use bold font for the room title
|
||||
if ([UIFont respondsToSelector:@selector(systemFontOfSize:weight:)])
|
||||
{
|
||||
self.roomTitle.font = [UIFont systemFontOfSize:15 weight:UIFontWeightBold];
|
||||
self.roomTitle.font = self.roomTitle1.font = self.roomTitle2.font = [UIFont systemFontOfSize:13 weight:UIFontWeightBold];
|
||||
}
|
||||
else
|
||||
{
|
||||
self.roomTitle.font = [UIFont boldSystemFontOfSize:15];
|
||||
self.roomTitle.font = self.roomTitle1.font = self.roomTitle2.font = [UIFont boldSystemFontOfSize:13];
|
||||
}
|
||||
}
|
||||
else if (roomCellData.roomSummary.room.state.membership == MXMembershipInvite)
|
||||
|
@ -105,11 +126,11 @@
|
|||
// Use bold font for the room title
|
||||
if ([UIFont respondsToSelector:@selector(systemFontOfSize:weight:)])
|
||||
{
|
||||
self.roomTitle.font = [UIFont systemFontOfSize:15 weight:UIFontWeightBold];
|
||||
self.roomTitle.font = self.roomTitle1.font = self.roomTitle2.font = [UIFont systemFontOfSize:13 weight:UIFontWeightBold];
|
||||
}
|
||||
else
|
||||
{
|
||||
self.roomTitle.font = [UIFont boldSystemFontOfSize:15];
|
||||
self.roomTitle.font = self.roomTitle1.font = self.roomTitle2.font = [UIFont boldSystemFontOfSize:13];
|
||||
}
|
||||
}
|
||||
else
|
||||
|
@ -117,11 +138,11 @@
|
|||
// The room title is not bold anymore
|
||||
if ([UIFont respondsToSelector:@selector(systemFontOfSize:weight:)])
|
||||
{
|
||||
self.roomTitle.font = [UIFont systemFontOfSize:15 weight:UIFontWeightMedium];
|
||||
self.roomTitle.font = self.roomTitle1.font = self.roomTitle2.font = [UIFont systemFontOfSize:13 weight:UIFontWeightMedium];
|
||||
}
|
||||
else
|
||||
{
|
||||
self.roomTitle.font = [UIFont systemFontOfSize:15];
|
||||
self.roomTitle.font = self.roomTitle1.font = self.roomTitle2.font = [UIFont systemFontOfSize:13];
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -143,12 +164,12 @@
|
|||
+ (CGFloat)heightForCellData:(MXKCellData *)cellData withMaximumWidth:(CGFloat)maxWidth
|
||||
{
|
||||
// The height is fixed
|
||||
return 100;
|
||||
return 115;
|
||||
}
|
||||
|
||||
+ (CGSize)defaultCellSize
|
||||
{
|
||||
return CGSizeMake(80, 100);
|
||||
return CGSizeMake(80, 115);
|
||||
}
|
||||
|
||||
- (void)prepareForReuse
|
||||
|
|
|
@ -1,11 +1,11 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<document type="com.apple.InterfaceBuilder3.CocoaTouch.XIB" version="3.0" toolsVersion="12120" systemVersion="16E195" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" colorMatched="YES">
|
||||
<document type="com.apple.InterfaceBuilder3.CocoaTouch.XIB" version="3.0" toolsVersion="12121" systemVersion="16F73" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" colorMatched="YES">
|
||||
<device id="retina4_7" orientation="portrait">
|
||||
<adaptation id="fullscreen"/>
|
||||
</device>
|
||||
<dependencies>
|
||||
<deployment identifier="iOS"/>
|
||||
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="12088"/>
|
||||
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="12089"/>
|
||||
<capability name="Aspect ratio constraints" minToolsVersion="5.1"/>
|
||||
<capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/>
|
||||
</dependencies>
|
||||
|
@ -13,10 +13,10 @@
|
|||
<placeholder placeholderIdentifier="IBFilesOwner" id="-1" userLabel="File's Owner"/>
|
||||
<placeholder placeholderIdentifier="IBFirstResponder" id="-2" customClass="UIResponder"/>
|
||||
<collectionViewCell opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="center" id="eCk-zY-LXq" customClass="RoomCollectionViewCell">
|
||||
<rect key="frame" x="0.0" y="0.0" width="80" height="100"/>
|
||||
<rect key="frame" x="0.0" y="0.0" width="80" height="115"/>
|
||||
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/>
|
||||
<view key="contentView" opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="center">
|
||||
<rect key="frame" x="0.0" y="0.0" width="80" height="100"/>
|
||||
<rect key="frame" x="0.0" y="0.0" width="80" height="115"/>
|
||||
<autoresizingMask key="autoresizingMask"/>
|
||||
<subviews>
|
||||
<view contentMode="scaleAspectFit" translatesAutoresizingMaskIntoConstraints="NO" id="T1Q-RS-8o6" customClass="MXKImageView">
|
||||
|
@ -61,13 +61,24 @@
|
|||
<constraint firstAttribute="width" constant="15" id="bbS-D2-SZi"/>
|
||||
</constraints>
|
||||
</imageView>
|
||||
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" verticalHuggingPriority="251" text="RoomTitle" textAlignment="center" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="oxX-IL-dG4">
|
||||
<rect key="frame" x="4" y="74" width="72" height="21"/>
|
||||
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" verticalHuggingPriority="251" text="RoomTitle" textAlignment="center" lineBreakMode="tailTruncation" numberOfLines="2" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="oxX-IL-dG4">
|
||||
<rect key="frame" x="4" y="74" width="72" height="16"/>
|
||||
<accessibility key="accessibilityConfiguration" identifier="TitleLabel"/>
|
||||
<constraints>
|
||||
<constraint firstAttribute="height" constant="21" id="WA1-mL-sFU"/>
|
||||
</constraints>
|
||||
<fontDescription key="fontDescription" type="system" weight="medium" pointSize="14"/>
|
||||
<fontDescription key="fontDescription" type="system" weight="medium" pointSize="13"/>
|
||||
<color key="textColor" red="0.0" green="0.0" blue="0.0" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
|
||||
<nil key="highlightedColor"/>
|
||||
</label>
|
||||
<label hidden="YES" opaque="NO" userInteractionEnabled="NO" contentMode="left" verticalHuggingPriority="251" text="RoomTitle" textAlignment="center" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="X8H-1U-wc3">
|
||||
<rect key="frame" x="7" y="74" width="66" height="16"/>
|
||||
<accessibility key="accessibilityConfiguration" identifier="TitleLabel"/>
|
||||
<fontDescription key="fontDescription" type="system" weight="medium" pointSize="13"/>
|
||||
<color key="textColor" red="0.0" green="0.0" blue="0.0" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
|
||||
<nil key="highlightedColor"/>
|
||||
</label>
|
||||
<label hidden="YES" opaque="NO" userInteractionEnabled="NO" contentMode="left" verticalHuggingPriority="251" text="RoomTitle" textAlignment="center" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="Jkz-Zp-aaG">
|
||||
<rect key="frame" x="7" y="90" width="66" height="16"/>
|
||||
<accessibility key="accessibilityConfiguration" identifier="TitleLabel"/>
|
||||
<fontDescription key="fontDescription" type="system" weight="medium" pointSize="13"/>
|
||||
<color key="textColor" red="0.0" green="0.0" blue="0.0" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
|
||||
<nil key="highlightedColor"/>
|
||||
</label>
|
||||
|
@ -75,16 +86,25 @@
|
|||
</view>
|
||||
<constraints>
|
||||
<constraint firstAttribute="trailing" secondItem="5Yd-df-HbB" secondAttribute="trailing" constant="12" id="0gr-xn-dfD"/>
|
||||
<constraint firstAttribute="bottom" secondItem="oxX-IL-dG4" secondAttribute="bottom" constant="5" id="1JB-d1-zb9"/>
|
||||
<constraint firstAttribute="bottom" relation="greaterThanOrEqual" secondItem="oxX-IL-dG4" secondAttribute="bottom" constant="5" id="1JB-d1-zb9"/>
|
||||
<constraint firstItem="oxX-IL-dG4" firstAttribute="top" secondItem="T1Q-RS-8o6" secondAttribute="bottom" constant="4" id="2DB-H2-E2v"/>
|
||||
<constraint firstItem="oxX-IL-dG4" firstAttribute="leading" secondItem="eCk-zY-LXq" secondAttribute="leading" constant="4" id="6gu-JD-Gb1"/>
|
||||
<constraint firstItem="X8H-1U-wc3" firstAttribute="centerX" secondItem="oxX-IL-dG4" secondAttribute="centerX" id="K9T-eO-WNb"/>
|
||||
<constraint firstItem="xws-BR-H47" firstAttribute="centerX" secondItem="T1Q-RS-8o6" secondAttribute="centerX" id="Lo3-Ov-Bw8"/>
|
||||
<constraint firstAttribute="trailing" secondItem="Q6g-b0-3sZ" secondAttribute="trailing" id="Mf1-H6-oH4"/>
|
||||
<constraint firstItem="Jkz-Zp-aaG" firstAttribute="centerX" secondItem="oxX-IL-dG4" secondAttribute="centerX" id="OQy-tF-e3Z"/>
|
||||
<constraint firstItem="Jkz-Zp-aaG" firstAttribute="top" secondItem="X8H-1U-wc3" secondAttribute="bottom" id="XDO-yX-Zs5"/>
|
||||
<constraint firstItem="X8H-1U-wc3" firstAttribute="leading" secondItem="eCk-zY-LXq" secondAttribute="leading" constant="7" id="XU5-Lv-9Xn"/>
|
||||
<constraint firstItem="T1Q-RS-8o6" firstAttribute="top" secondItem="eCk-zY-LXq" secondAttribute="top" constant="10" id="cc7-bg-15Z"/>
|
||||
<constraint firstItem="Jkz-Zp-aaG" firstAttribute="leading" secondItem="eCk-zY-LXq" secondAttribute="leading" constant="7" id="fPh-Lb-Bv9"/>
|
||||
<constraint firstItem="xws-BR-H47" firstAttribute="centerY" secondItem="T1Q-RS-8o6" secondAttribute="centerY" id="faX-hg-WfP"/>
|
||||
<constraint firstItem="5Yd-df-HbB" firstAttribute="top" secondItem="eCk-zY-LXq" secondAttribute="top" constant="55" id="h4R-2d-Xxn"/>
|
||||
<constraint firstAttribute="trailing" secondItem="oxX-IL-dG4" secondAttribute="trailing" constant="4" id="hDl-X9-M4n"/>
|
||||
<constraint firstItem="T1Q-RS-8o6" firstAttribute="centerX" secondItem="eCk-zY-LXq" secondAttribute="centerX" id="hmB-fl-oN2"/>
|
||||
<constraint firstItem="Q6g-b0-3sZ" firstAttribute="top" secondItem="eCk-zY-LXq" secondAttribute="top" constant="5" id="jST-Ic-lsn"/>
|
||||
<constraint firstAttribute="trailing" secondItem="X8H-1U-wc3" secondAttribute="trailing" constant="7" id="o5i-7H-n0G"/>
|
||||
<constraint firstAttribute="trailing" secondItem="Jkz-Zp-aaG" secondAttribute="trailing" constant="7" id="uQe-FG-3lb"/>
|
||||
<constraint firstItem="X8H-1U-wc3" firstAttribute="top" secondItem="oxX-IL-dG4" secondAttribute="top" id="uTm-3W-QoM"/>
|
||||
</constraints>
|
||||
<connections>
|
||||
<outlet property="directRoomBorderView" destination="xws-BR-H47" id="34A-hu-DXq"/>
|
||||
|
@ -94,6 +114,8 @@
|
|||
<outlet property="missedNotifAndUnreadBadgeLabel" destination="ZUZ-tv-dVV" id="6IV-rz-s4I"/>
|
||||
<outlet property="roomAvatar" destination="T1Q-RS-8o6" id="4sR-Wm-jwz"/>
|
||||
<outlet property="roomTitle" destination="oxX-IL-dG4" id="vff-Fw-AOf"/>
|
||||
<outlet property="roomTitle1" destination="X8H-1U-wc3" id="nnS-Hp-1qV"/>
|
||||
<outlet property="roomTitle2" destination="Jkz-Zp-aaG" id="xO1-Av-NID"/>
|
||||
</connections>
|
||||
</collectionViewCell>
|
||||
</objects>
|
||||
|
|
Loading…
Reference in a new issue