MELS: Add RoomMembershipExpandedBubbleCell that displays the first membership event of serie that can be collapsable.

This commit is contained in:
manuroe 2017-07-07 11:11:42 +02:00
parent 9a818ea5b3
commit 54b8ba2399
6 changed files with 217 additions and 12 deletions

View file

@ -14,6 +14,8 @@
3205ED851E97725E003D65FA /* DirectoryServerTableViewCell.xib in Resources */ = {isa = PBXBuildFile; fileRef = 3205ED831E97725E003D65FA /* DirectoryServerTableViewCell.xib */; };
321082B21F0E9F40002E0091 /* RoomMembershipCollapsedBubbleCell.m in Sources */ = {isa = PBXBuildFile; fileRef = 321082B01F0E9F40002E0091 /* RoomMembershipCollapsedBubbleCell.m */; };
321082B31F0E9F41002E0091 /* RoomMembershipCollapsedBubbleCell.xib in Resources */ = {isa = PBXBuildFile; fileRef = 321082B11F0E9F40002E0091 /* RoomMembershipCollapsedBubbleCell.xib */; };
322806A01F0F64C4008C53D7 /* RoomMembershipExpandedBubbleCell.m in Sources */ = {isa = PBXBuildFile; fileRef = 3228069E1F0F64C4008C53D7 /* RoomMembershipExpandedBubbleCell.m */; };
322806A11F0F64C4008C53D7 /* RoomMembershipExpandedBubbleCell.xib in Resources */ = {isa = PBXBuildFile; fileRef = 3228069F1F0F64C4008C53D7 /* RoomMembershipExpandedBubbleCell.xib */; };
325072141E8C0AC900A084B6 /* LaunchScreenLogo.png in Resources */ = {isa = PBXBuildFile; fileRef = 325072131E8C0AC900A084B6 /* LaunchScreenLogo.png */; };
325E1C151E8D03950018D91E /* LaunchScreen.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 325E1C131E8D03950018D91E /* LaunchScreen.storyboard */; };
32AE61E41F0A971B007255F4 /* RoomMembershipBubbleCell.m in Sources */ = {isa = PBXBuildFile; fileRef = 32AE61E21F0A971B007255F4 /* RoomMembershipBubbleCell.m */; };
@ -493,6 +495,9 @@
321082AF1F0E9F40002E0091 /* RoomMembershipCollapsedBubbleCell.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = RoomMembershipCollapsedBubbleCell.h; sourceTree = "<group>"; };
321082B01F0E9F40002E0091 /* RoomMembershipCollapsedBubbleCell.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = RoomMembershipCollapsedBubbleCell.m; sourceTree = "<group>"; };
321082B11F0E9F40002E0091 /* RoomMembershipCollapsedBubbleCell.xib */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = file.xib; path = RoomMembershipCollapsedBubbleCell.xib; sourceTree = "<group>"; };
3228069D1F0F64C4008C53D7 /* RoomMembershipExpandedBubbleCell.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = RoomMembershipExpandedBubbleCell.h; sourceTree = "<group>"; };
3228069E1F0F64C4008C53D7 /* RoomMembershipExpandedBubbleCell.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = RoomMembershipExpandedBubbleCell.m; sourceTree = "<group>"; };
3228069F1F0F64C4008C53D7 /* RoomMembershipExpandedBubbleCell.xib */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = file.xib; path = RoomMembershipExpandedBubbleCell.xib; sourceTree = "<group>"; };
325072131E8C0AC900A084B6 /* LaunchScreenLogo.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; name = LaunchScreenLogo.png; path = Assets/Images/LaunchScreenLogo.png; sourceTree = "<group>"; };
325E1C141E8D03950018D91E /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/LaunchScreen.storyboard; sourceTree = "<group>"; };
32AE61E11F0A971B007255F4 /* RoomMembershipBubbleCell.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = RoomMembershipBubbleCell.h; sourceTree = "<group>"; };
@ -1730,6 +1735,9 @@
321082AF1F0E9F40002E0091 /* RoomMembershipCollapsedBubbleCell.h */,
321082B01F0E9F40002E0091 /* RoomMembershipCollapsedBubbleCell.m */,
321082B11F0E9F40002E0091 /* RoomMembershipCollapsedBubbleCell.xib */,
3228069D1F0F64C4008C53D7 /* RoomMembershipExpandedBubbleCell.h */,
3228069E1F0F64C4008C53D7 /* RoomMembershipExpandedBubbleCell.m */,
3228069F1F0F64C4008C53D7 /* RoomMembershipExpandedBubbleCell.xib */,
F083BCA81E7009EC00A9B29C /* RoomIncomingAttachmentBubbleCell.h */,
F083BCA91E7009EC00A9B29C /* RoomIncomingAttachmentBubbleCell.m */,
F083BCAA1E7009EC00A9B29C /* RoomIncomingAttachmentBubbleCell.xib */,
@ -2383,6 +2391,7 @@
F083BD421E7009ED00A9B29C /* call_speaker_on_icon.png in Resources */,
F083BD9A1E7009ED00A9B29C /* logo@3x.png in Resources */,
F083BDE51E7009ED00A9B29C /* voice_call_icon@3x.png in Resources */,
322806A11F0F64C4008C53D7 /* RoomMembershipExpandedBubbleCell.xib in Resources */,
F083BE201E7009ED00A9B29C /* RoomParticipantsViewController.xib in Resources */,
F083BE471E7009ED00A9B29C /* RoomIncomingEncryptedTextMsgWithPaginationTitleBubbleCell.xib in Resources */,
32AE61E51F0A971B007255F4 /* RoomMembershipBubbleCell.xib in Resources */,
@ -2524,6 +2533,7 @@
F083BE7C1E7009ED00A9B29C /* DirectoryRecentTableViewCell.m in Sources */,
F0E05A031E963103004B83FB /* RoomsViewController.m in Sources */,
F083BE801E7009ED00A9B29C /* PublicRoomTableViewCell.m in Sources */,
322806A01F0F64C4008C53D7 /* RoomMembershipExpandedBubbleCell.m in Sources */,
F083BE031E7009ED00A9B29C /* EventFormatter.m in Sources */,
F083BE4A1E7009ED00A9B29C /* RoomOutgoingEncryptedAttachmentBubbleCell.m in Sources */,
F083BE601E7009ED00A9B29C /* RoomIncomingTextMsgBubbleCell.m in Sources */,

View file

@ -381,7 +381,7 @@
if (cellData.collapsed)
{
// Select nothing for a collased cell but open it
[self expandRoomBubble:cellData];
[self collapseRoomBubble:cellData collapsed:NO];
return;
}
else
@ -393,14 +393,4 @@
_selectedEventId = selectedEventId;
}
- (void)expandRoomBubble:(RoomBubbleCellData*)cellData
{
RoomBubbleCellData *nextBubbleData = (RoomBubbleCellData*)cellData;
do
{
nextBubbleData.collapsed = NO;
}
while ((nextBubbleData = nextBubbleData.nextCollapsableCellData));
}
@end

View file

@ -88,6 +88,7 @@
#import "RoomMembershipBubbleCell.h"
#import "RoomMembershipBubbleCellWithPaginationTitleBubbleCell.h"
#import "RoomMembershipCollapsedBubbleCell.h"
#import "RoomMembershipExpandedBubbleCell.h"
#import "MXKRoomBubbleTableViewCell+Riot.h"
@ -285,6 +286,7 @@
[self.bubblesTableView registerClass:RoomMembershipBubbleCell.class forCellReuseIdentifier:RoomMembershipBubbleCell.defaultReuseIdentifier];
[self.bubblesTableView registerClass:RoomMembershipBubbleCellWithPaginationTitleBubbleCell.class forCellReuseIdentifier:RoomMembershipBubbleCellWithPaginationTitleBubbleCell.defaultReuseIdentifier];
[self.bubblesTableView registerClass:RoomMembershipCollapsedBubbleCell.class forCellReuseIdentifier:RoomMembershipCollapsedBubbleCell.defaultReuseIdentifier];
[self.bubblesTableView registerClass:RoomMembershipExpandedBubbleCell.class forCellReuseIdentifier:RoomMembershipExpandedBubbleCell.defaultReuseIdentifier];
// Prepare jump to last unread banner
self.jumpToLastUnreadLabel.attributedText = [[NSAttributedString alloc] initWithString:NSLocalizedStringFromTable(@"room_jump_to_first_unread", @"Vector", nil) attributes:@{NSUnderlineStyleAttributeName: @(NSUnderlineStyleSingle), NSUnderlineColorAttributeName: kRiotTextColorBlack, NSForegroundColorAttributeName: kRiotTextColorBlack}];
@ -1557,7 +1559,20 @@
}
else
{
cellViewClass = bubbleData.collapsed ? RoomMembershipCollapsedBubbleCell.class : RoomMembershipBubbleCell.class;
if (bubbleData.collapsed)
{
cellViewClass = RoomMembershipCollapsedBubbleCell.class;
}
else if (bubbleData.collapsedAttributedTextMessage)
{
// The cell (and its serie) is not collapsed but this cell is the first
// of the serie. So, use the cell with the "collapse" button
cellViewClass = RoomMembershipExpandedBubbleCell.class;
}
else
{
cellViewClass = RoomMembershipBubbleCell.class;
}
}
}
else if (bubbleData.isIncoming)

View file

@ -0,0 +1,28 @@
/*
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 "RoomMembershipBubbleCell.h"
/**
`RoomMembershipExpandedBubbleCell` displays the first membership event of serie
that can be collapsable.
*/
@interface RoomMembershipExpandedBubbleCell : RoomMembershipBubbleCell
@property (weak, nonatomic) IBOutlet UIButton *collapseButton;
@property (weak, nonatomic) IBOutlet UIView *separatorView;
@end

View file

@ -0,0 +1,44 @@
/*
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 "RoomMembershipExpandedBubbleCell.h"
#import "RiotDesignValues.h"
#import "RoomBubbleCellData.h"
@implementation RoomMembershipExpandedBubbleCell
- (void)awakeFromNib
{
[super awakeFromNib];
self.separatorView.backgroundColor = kRiotColorLightGrey;
NSString* title = NSLocalizedStringFromTable(@"collapse", @"Vector", nil);
[self.collapseButton setTitle:title forState:UIControlStateNormal];
[self.collapseButton setTitle:title forState:UIControlStateHighlighted];
[self.collapseButton setTintColor:kRiotColorGreen];
self.collapseButton.titleLabel.font = [UIFont systemFontOfSize:14];
}
- (IBAction)onCollapseButtonTap:(id)sender
{
[((MXKRoomBubbleCellData*)self.bubbleData).roomDataSource collapseRoomBubble:self.bubbleData collapsed:YES];
}
@end

View file

@ -0,0 +1,118 @@
<?xml version="1.0" encoding="UTF-8"?>
<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="12089"/>
<capability name="Constraints to layout margins" minToolsVersion="6.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"/>
<tableViewCell contentMode="scaleToFill" selectionStyle="none" indentationWidth="10" id="WmY-Jw-mqv" customClass="RoomMembershipExpandedBubbleCell">
<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="WmY-Jw-mqv" id="ef1-Tq-U3Z">
<rect key="frame" x="0.0" y="0.0" width="600" height="69.5"/>
<autoresizingMask key="autoresizingMask"/>
<subviews>
<button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" buttonType="roundedRect" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="df5-x1-Zhy">
<rect key="frame" x="531" y="3" width="54" height="29"/>
<fontDescription key="fontDescription" type="system" pointSize="14"/>
<state key="normal" title="collapse"/>
<connections>
<action selector="onCollapseButtonTap:" destination="WmY-Jw-mqv" eventType="touchUpInside" id="ECj-ic-h0T"/>
</connections>
</button>
<view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="dJl-MG-cbs">
<rect key="frame" x="55" y="35" width="530" height="1"/>
<color key="backgroundColor" white="0.33333333333333331" alpha="1" colorSpace="calibratedWhite"/>
<constraints>
<constraint firstAttribute="height" constant="1" id="Jyb-5H-rlc"/>
</constraints>
</view>
<view clipsSubviews="YES" contentMode="scaleAspectFill" translatesAutoresizingMaskIntoConstraints="NO" id="hgp-Z5-rAj" userLabel="Picture View" customClass="MXKImageView">
<rect key="frame" x="55" y="48" width="16" height="16"/>
<color key="backgroundColor" red="0.66666666666666663" green="0.66666666666666663" blue="0.66666666666666663" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
<accessibility key="accessibilityConfiguration" identifier="PictureView"/>
<constraints>
<constraint firstAttribute="width" constant="16" id="NQk-ck-Lo8"/>
<constraint firstAttribute="height" constant="16" id="dNT-QU-CUG"/>
</constraints>
</view>
<textView clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="scaleToFill" scrollEnabled="NO" editable="NO" text="text message" translatesAutoresizingMaskIntoConstraints="NO" id="HTH-5n-MSU">
<rect key="frame" x="71" y="39" width="102" height="30.5"/>
<color key="backgroundColor" red="0.0" green="0.0" blue="0.0" alpha="0.0" colorSpace="custom" customColorSpace="sRGB"/>
<accessibility key="accessibilityConfiguration" identifier="MessageTextView"/>
<constraints>
<constraint firstAttribute="width" constant="102" id="OX6-NK-oti"/>
<constraint firstAttribute="height" relation="greaterThanOrEqual" constant="30" id="ZZt-rc-tVJ"/>
</constraints>
<fontDescription key="fontDescription" type="system" pointSize="15"/>
<textInputTraits key="textInputTraits" autocapitalizationType="sentences"/>
<dataDetectorType key="dataDetectorTypes" link="YES"/>
</textView>
<view hidden="YES" userInteractionEnabled="NO" contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="IOg-Kt-8vW">
<rect key="frame" x="515" y="42" width="70" height="27.5"/>
<color key="backgroundColor" red="0.0" green="0.0" blue="0.0" alpha="0.0" colorSpace="custom" customColorSpace="sRGB"/>
<accessibility key="accessibilityConfiguration" identifier="BubbleInfoContainer"/>
<constraints>
<constraint firstAttribute="width" constant="70" id="1E4-Lu-3sr"/>
</constraints>
</view>
<view hidden="YES" contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="stw-MD-khQ">
<rect key="frame" x="0.0" y="0.0" width="600" height="79.5"/>
<color key="backgroundColor" red="1" green="1" blue="1" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
</view>
</subviews>
<color key="backgroundColor" red="0.0" green="0.0" blue="0.0" alpha="0.0" colorSpace="custom" customColorSpace="sRGB"/>
<constraints>
<constraint firstItem="stw-MD-khQ" firstAttribute="leading" secondItem="ef1-Tq-U3Z" secondAttribute="leadingMargin" constant="-8" id="0oH-d5-525"/>
<constraint firstItem="hgp-Z5-rAj" firstAttribute="top" secondItem="ef1-Tq-U3Z" secondAttribute="top" constant="48" id="2Ih-ga-N9s"/>
<constraint firstItem="IOg-Kt-8vW" firstAttribute="top" secondItem="ef1-Tq-U3Z" secondAttribute="top" constant="42" id="4Ac-p5-610"/>
<constraint firstAttribute="bottomMargin" secondItem="stw-MD-khQ" secondAttribute="bottom" constant="-8" id="8Lj-ay-d6E"/>
<constraint firstItem="df5-x1-Zhy" firstAttribute="top" secondItem="ef1-Tq-U3Z" secondAttribute="top" constant="3" id="A0F-3b-DdS"/>
<constraint firstAttribute="trailing" secondItem="dJl-MG-cbs" secondAttribute="trailing" constant="15" id="IqK-FM-2sV"/>
<constraint firstItem="stw-MD-khQ" firstAttribute="top" secondItem="ef1-Tq-U3Z" secondAttribute="topMargin" constant="-8" id="JXb-n4-O4S"/>
<constraint firstAttribute="trailing" relation="greaterThanOrEqual" secondItem="HTH-5n-MSU" secondAttribute="trailing" constant="15" id="Shz-6S-kGd"/>
<constraint firstItem="dJl-MG-cbs" firstAttribute="top" secondItem="ef1-Tq-U3Z" secondAttribute="topMargin" constant="27" id="cTz-wW-wDq"/>
<constraint firstItem="HTH-5n-MSU" firstAttribute="leading" secondItem="ef1-Tq-U3Z" secondAttribute="leadingMargin" constant="63" id="cxO-Px-nau"/>
<constraint firstAttribute="bottom" secondItem="IOg-Kt-8vW" secondAttribute="bottom" id="f24-Fr-D4j"/>
<constraint firstItem="dJl-MG-cbs" firstAttribute="leading" secondItem="ef1-Tq-U3Z" secondAttribute="leading" constant="55" id="lWu-UJ-6BJ"/>
<constraint firstItem="HTH-5n-MSU" firstAttribute="top" secondItem="ef1-Tq-U3Z" secondAttribute="top" constant="39" id="mkw-3s-H8B"/>
<constraint firstAttribute="trailing" secondItem="df5-x1-Zhy" secondAttribute="trailing" constant="15" id="oAn-Qb-KHL"/>
<constraint firstAttribute="bottom" secondItem="HTH-5n-MSU" secondAttribute="bottom" id="oTk-3F-SEC"/>
<constraint firstAttribute="trailing" secondItem="IOg-Kt-8vW" secondAttribute="trailing" constant="15" id="pWt-Mb-kAX"/>
<constraint firstAttribute="trailingMargin" secondItem="stw-MD-khQ" secondAttribute="trailing" constant="-8" id="qO5-ZZ-mHI"/>
<constraint firstItem="hgp-Z5-rAj" firstAttribute="leading" secondItem="ef1-Tq-U3Z" secondAttribute="leading" constant="55" id="tuw-aU-ncu"/>
</constraints>
<variation key="default">
<mask key="subviews">
<exclude reference="stw-MD-khQ"/>
</mask>
</variation>
</tableViewCellContentView>
<color key="backgroundColor" red="0.0" green="0.0" blue="0.0" alpha="0.0" colorSpace="custom" customColorSpace="sRGB"/>
<accessibility key="accessibilityConfiguration" identifier="RoomBubbleCell"/>
<connections>
<outlet property="bubbleInfoContainer" destination="IOg-Kt-8vW" id="TAw-QY-Y9e"/>
<outlet property="bubbleInfoContainerTopConstraint" destination="4Ac-p5-610" id="lmm-l8-kaq"/>
<outlet property="bubbleOverlayContainer" destination="stw-MD-khQ" id="fDX-tM-vSH"/>
<outlet property="collapseButton" destination="df5-x1-Zhy" id="Mei-j7-0ez"/>
<outlet property="messageTextView" destination="HTH-5n-MSU" id="YN4-iK-gNc"/>
<outlet property="msgTextViewBottomConstraint" destination="oTk-3F-SEC" id="nmX-GC-tPw"/>
<outlet property="msgTextViewLeadingConstraint" destination="cxO-Px-nau" id="yrt-qb-Eit"/>
<outlet property="msgTextViewMinHeightConstraint" destination="ZZt-rc-tVJ" id="hDD-TL-PFM"/>
<outlet property="msgTextViewTopConstraint" destination="mkw-3s-H8B" id="lON-oG-Xx9"/>
<outlet property="msgTextViewTrailingConstraint" destination="Shz-6S-kGd" id="5ib-m6-Lna"/>
<outlet property="msgTextViewWidthConstraint" destination="OX6-NK-oti" id="Ptq-cZ-07y"/>
<outlet property="pictureView" destination="hgp-Z5-rAj" id="rKM-QG-RJN"/>
<outlet property="pictureViewTopConstraint" destination="2Ih-ga-N9s" id="rpQ-bN-moE"/>
<outlet property="separatorView" destination="dJl-MG-cbs" id="Vnp-K7-DEh"/>
</connections>
</tableViewCell>
</objects>
</document>