add_invite_rooms_section

-> reduce the recent cell height
This commit is contained in:
yannick
2015-12-09 16:09:46 +01:00
parent 984e341e75
commit 2ff73cded1
6 changed files with 68 additions and 24 deletions
+1
View File
@@ -62,6 +62,7 @@
"room_recents_favourites" = "FAVORITES";
"room_recents_conversations" = "CONVERSATIONS";
"room_recents_low_priority" = "LOW PRIORITY";
"room_recents_invites" = "INVITES";
// Chat participants
"room_participants_title" = "Participants";
+36 -3
View File
@@ -22,10 +22,12 @@
@interface RecentsDataSource()
{
NSMutableArray* invitesCellDataArray;
NSMutableArray* favoriteCellDataArray;
NSMutableArray* conversationCellDataArray;
NSMutableArray* lowPriorityCellDataArray;
NSInteger invitesSection;
NSInteger favoritesSection;
NSInteger conversationSection;
NSInteger lowPrioritySection;
@@ -49,6 +51,7 @@
conversationCellDataArray = [[NSMutableArray alloc] init];
lowPriorityCellDataArray = [[NSMutableArray alloc] init];
invitesSection = -1;
favoritesSection = -1;
conversationSection = -1;
lowPrioritySection = -1;
@@ -111,7 +114,7 @@
*/
- (CGFloat)heightForHeaderInSection:(NSInteger)section
{
if ((section == favoritesSection) || (section == conversationSection) || (section == lowPrioritySection))
if ((section == invitesSection) || (section == favoritesSection) || (section == conversationSection) || (section == lowPrioritySection))
{
return 30.0f;
}
@@ -146,6 +149,11 @@
{
count = lowPriorityCellDataArray.count;
}
else if (section == invitesSection)
{
count = invitesCellDataArray.count;
}
return count;
}
@@ -154,7 +162,7 @@
{
// add multi accounts section management
if ((section == favoritesSection) || (section == conversationSection) || (section == lowPrioritySection))
if ((section == favoritesSection) || (section == conversationSection) || (section == lowPrioritySection) || (section == invitesSection))
{
UILabel* label = [[UILabel alloc] initWithFrame:frame];
@@ -172,6 +180,10 @@
{
text = NSLocalizedStringFromTable(@"room_recents_low_priority", @"Vector", nil);
}
else if (section == invitesSection)
{
text = NSLocalizedStringFromTable(@"room_recents_invites", @"Vector", nil);
}
label.text = [NSString stringWithFormat:@" %@", text];
label.font = [UIFont boldSystemFontOfSize:15.0];
@@ -199,6 +211,10 @@
{
cellData = [lowPriorityCellDataArray objectAtIndex:indexPath.row];
}
else if (indexPath.section == invitesSection)
{
cellData = [invitesCellDataArray objectAtIndex:indexPath.row];
}
return cellData;
}
@@ -211,6 +227,7 @@
if (cellData && self.delegate)
{
Class<MXKCellRendering> class = [self.delegate cellViewClassForCellData:cellData];
return [class heightForCellData:cellData withMaximumWidth:0];
}
@@ -240,7 +257,7 @@
conversationCellDataArray = [[NSMutableArray alloc] init];
lowPriorityCellDataArray = [[NSMutableArray alloc] init];
favoritesSection = conversationSection = lowPrioritySection = -1;
favoritesSection = conversationSection = lowPrioritySection = invitesSection = -1;
sectionsCount = 0;
if (displayedRecentsDataSourceArray.count > 0)
@@ -248,9 +265,11 @@
MXKSessionRecentsDataSource *recentsDataSource = [displayedRecentsDataSourceArray objectAtIndex:0];
MXSession* session = recentsDataSource.mxSession;
NSArray* sortedInvitesRooms = [session invitedRooms];
NSArray* sortedFavRooms = [session roomsWithTag:kMXRoomTagFavourite];
NSArray* sortedLowPriorRooms = [session roomsWithTag:kMXRoomTagLowPriority];
invitesCellDataArray = [self createEmptyArray:sortedInvitesRooms.count];
favoriteCellDataArray = [self createEmptyArray:sortedFavRooms.count];
lowPriorityCellDataArray = [self createEmptyArray:sortedLowPriorRooms.count];
@@ -276,6 +295,13 @@
[lowPriorityCellDataArray replaceObjectAtIndex:pos withObject:recentCellDataStoring];
}
}
else if ((pos = [sortedInvitesRooms indexOfObject:room]) != NSNotFound)
{
if (pos < invitesCellDataArray.count)
{
[invitesCellDataArray replaceObjectAtIndex:pos withObject:recentCellDataStoring];
}
}
else
{
[conversationCellDataArray addObject:recentCellDataStoring];
@@ -284,6 +310,13 @@
int sectionIndex = 0;
[invitesCellDataArray removeObject:[NSNull null]];
if (invitesCellDataArray.count > 0)
{
invitesSection = sectionIndex;
sectionIndex++;
}
[favoriteCellDataArray removeObject:[NSNull null]];
if (favoriteCellDataArray.count > 0)
{
+4
View File
@@ -45,7 +45,11 @@
localTimeZone = [NSTimeZone localTimeZone];
self.defaultTextColor = VECTOR_TEXT_GRAY_COLOR;
self.bingTextColor = VECTOR_GREEN_COLOR;
self.sendingTextColor = VECTOR_LIGHT_GRAY_COLOR;
self.errorTextColor = [UIColor redColor];
}
return self;
}
+2
View File
@@ -17,6 +17,8 @@
// the green text color
#define VECTOR_GREEN_COLOR [UIColor colorWithRed:(98.0/256.0) green:(206.0/256.0) blue:(156.0/256.0) alpha:1.0]
#define VECTOR_TEXT_GRAY_COLOR [UIColor colorWithRed:(164.0 / 256.0) green:(164.0 / 256.0) blue:(164.0 / 256.0) alpha:1.0]
#define VECTOR_LIGHT_GRAY_COLOR [UIColor colorWithRed:(242.0 / 256.0) green:(242.0 / 256.0) blue:(242.0 / 256.0) alpha:1.0]
// to update the navigation bar buttons color
+7 -3
View File
@@ -20,6 +20,8 @@
#import "MXEvent.h"
#import "VectorDesignValues.h"
@implementation RecentTableViewCell
#pragma mark - Class methods
@@ -52,6 +54,8 @@
self.lastEventDescription.text = roomCellData.lastEventTextMessage;
}
self.lastEventDate.textColor = VECTOR_TEXT_GRAY_COLOR;
// Notify unreads and bing
self.bingIndicator.hidden = YES;
@@ -62,11 +66,11 @@
self.bingIndicator.hidden = NO;
self.bingIndicator.backgroundColor = roomCellData.recentsDataSource.eventFormatter.bingTextColor;
}
self.roomTitle.font = [UIFont boldSystemFontOfSize:19];
self.roomTitle.font = [UIFont boldSystemFontOfSize:17];
}
else
{
self.roomTitle.font = [UIFont systemFontOfSize:19];
self.roomTitle.font = [UIFont systemFontOfSize:17];
}
self.roomAvatar.backgroundColor = [UIColor clearColor];
@@ -118,7 +122,7 @@
+ (CGFloat)heightForCellData:(MXKCellData *)cellData withMaximumWidth:(CGFloat)maxWidth
{
// The height is fixed
return 74;
return 54;
}
@end
+18 -18
View File
@@ -1,17 +1,17 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<document type="com.apple.InterfaceBuilder3.CocoaTouch.XIB" version="3.0" toolsVersion="9059" systemVersion="15B42" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES">
<document type="com.apple.InterfaceBuilder3.CocoaTouch.XIB" version="3.0" toolsVersion="9060" systemVersion="15B42" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES">
<dependencies>
<deployment identifier="iOS"/>
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="9049"/>
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="9051"/>
</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="RecentTableViewCell">
<rect key="frame" x="0.0" y="0.0" width="600" height="74"/>
<rect key="frame" x="0.0" y="0.0" width="600" height="54"/>
<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="73"/>
<rect key="frame" x="0.0" y="0.0" width="600" height="53"/>
<autoresizingMask key="autoresizingMask"/>
<subviews>
<view hidden="YES" contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="e7r-zL-9bw" userLabel="Bing indicator">
@@ -24,35 +24,35 @@
</constraints>
</view>
<view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="RX5-eD-c3c" userLabel="Room avatar" customClass="MXKImageView">
<rect key="frame" x="11" y="16" width="42" height="42"/>
<rect key="frame" x="11" y="10" width="34" height="34"/>
<animations/>
<color key="backgroundColor" white="0.89720269880000003" alpha="1" colorSpace="calibratedWhite"/>
<constraints>
<constraint firstAttribute="width" constant="42" id="7Ys-gS-ja8"/>
<constraint firstAttribute="height" constant="42" id="WPC-tL-hnM"/>
<constraint firstAttribute="width" constant="34" id="7Ys-gS-ja8"/>
<constraint firstAttribute="height" constant="34" id="WPC-tL-hnM"/>
</constraints>
</view>
<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="61" y="40" width="532" height="20"/>
<rect key="frame" x="53" y="31" width="538" height="14"/>
<animations/>
<fontDescription key="fontDescription" type="system" pointSize="16"/>
<color key="textColor" cocoaTouchSystemColor="darkTextColor"/>
<fontDescription key="fontDescription" type="system" pointSize="11"/>
<color key="textColor" white="0.66666666666666663" alpha="1" colorSpace="calibratedWhite"/>
<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"/>
<rect key="frame" x="522" y="9" width="70" height="14"/>
<animations/>
<constraints>
<constraint firstAttribute="width" relation="greaterThanOrEqual" constant="70" id="uOj-6w-G8q"/>
</constraints>
<fontDescription key="fontDescription" type="system" pointSize="12"/>
<fontDescription key="fontDescription" type="system" pointSize="11"/>
<color key="textColor" cocoaTouchSystemColor="darkTextColor"/>
<nil key="highlightedColor"/>
</label>
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" verticalHuggingPriority="251" text="RoomTitle" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="Lg1-xQ-AGn">
<rect key="frame" x="61" y="15" width="453" height="23"/>
<rect key="frame" x="53" y="9" width="461" height="21"/>
<animations/>
<fontDescription key="fontDescription" type="system" pointSize="19"/>
<fontDescription key="fontDescription" type="system" pointSize="17"/>
<color key="textColor" cocoaTouchSystemColor="darkTextColor"/>
<nil key="highlightedColor"/>
</label>
@@ -63,13 +63,13 @@
<constraint firstItem="e7r-zL-9bw" firstAttribute="leading" secondItem="aXz-IR-jj5" secondAttribute="leading" id="PUW-if-ewh"/>
<constraint firstItem="Lg1-xQ-AGn" firstAttribute="leading" secondItem="RX5-eD-c3c" secondAttribute="trailing" constant="8" id="Pgp-JM-oQd"/>
<constraint firstItem="e7r-zL-9bw" firstAttribute="top" secondItem="aXz-IR-jj5" secondAttribute="top" id="VHj-kc-U2A"/>
<constraint firstAttribute="bottom" secondItem="dQt-mN-T6b" secondAttribute="bottom" constant="13" id="VTl-c8-5s2"/>
<constraint firstAttribute="bottom" secondItem="dQt-mN-T6b" secondAttribute="bottom" constant="8" id="VTl-c8-5s2"/>
<constraint firstItem="dQt-mN-T6b" firstAttribute="leading" secondItem="RX5-eD-c3c" secondAttribute="trailing" constant="8" id="XFM-LG-4uJ"/>
<constraint firstItem="360-Go-RcG" firstAttribute="top" secondItem="aXz-IR-jj5" secondAttribute="top" constant="8" id="XyO-tl-6SX"/>
<constraint firstItem="360-Go-RcG" firstAttribute="top" secondItem="aXz-IR-jj5" secondAttribute="top" constant="9" id="XyO-tl-6SX"/>
<constraint firstAttribute="trailing" secondItem="360-Go-RcG" secondAttribute="trailing" constant="8" id="YqC-WC-Wqe"/>
<constraint firstItem="360-Go-RcG" firstAttribute="leading" secondItem="Lg1-xQ-AGn" secondAttribute="trailing" constant="8" id="cmh-bM-EmX"/>
<constraint firstAttribute="trailing" secondItem="dQt-mN-T6b" secondAttribute="trailing" constant="7" id="t2m-pb-5zd"/>
<constraint firstItem="Lg1-xQ-AGn" firstAttribute="top" secondItem="aXz-IR-jj5" secondAttribute="top" constant="15" id="tY3-6V-A3B"/>
<constraint firstAttribute="trailing" secondItem="dQt-mN-T6b" secondAttribute="trailing" constant="9" id="t2m-pb-5zd"/>
<constraint firstItem="Lg1-xQ-AGn" firstAttribute="top" secondItem="aXz-IR-jj5" secondAttribute="top" constant="9" id="tY3-6V-A3B"/>
</constraints>
</tableViewCellContentView>
<animations/>