Home: display the room name on 2 lines

This commit is contained in:
Giom Foret
2017-06-30 17:06:23 +02:00
parent 3e976e1919
commit 10acccc29d
3 changed files with 51 additions and 12 deletions
+21 -2
View File
@@ -22,6 +22,8 @@
#import "MXRoom+Riot.h"
#import "MXTools.h"
@implementation RoomCollectionViewCell
#pragma mark - Class methods
@@ -66,7 +68,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)
@@ -143,12 +162,12 @@
+ (CGFloat)heightForCellData:(MXKCellData *)cellData withMaximumWidth:(CGFloat)maxWidth
{
// The height is fixed
return 100;
return 120;
}
+ (CGSize)defaultCellSize
{
return CGSizeMake(80, 100);
return CGSizeMake(80, 120);
}
- (void)prepareForReuse