The typing events are now displayed at the screen bottom.

This commit is contained in:
yannick 2015-11-18 15:59:04 +01:00
parent b63d07c32b
commit 2d87c1b686
4 changed files with 71 additions and 3 deletions

View file

@ -126,6 +126,12 @@
[self.menuListView addConstraint:heightConstraint]; [self.menuListView addConstraint:heightConstraint];
} }
[self.view setNeedsUpdateConstraints]; [self.view setNeedsUpdateConstraints];
if (self.roomDataSource)
{
// this room view controller has its own typing management.
self.roomDataSource.showTypingNotifications = NO;
}
} }
- (void)didReceiveMemoryWarning - (void)didReceiveMemoryWarning
@ -458,6 +464,8 @@
// get the room member names // get the room member names
NSMutableArray *names = [[NSMutableArray alloc] init]; NSMutableArray *names = [[NSMutableArray alloc] init];
// keeps the only the first two users
//
for(int i = 0; i < MIN(count, 2); i++) { for(int i = 0; i < MIN(count, 2); i++) {
NSString* name = [currentTypingUsers objectAtIndex:i]; NSString* name = [currentTypingUsers objectAtIndex:i];
@ -489,7 +497,7 @@
text = [NSString stringWithFormat:NSLocalizedStringFromTable(@"room_many_users_are_typing", @"Vector", nil), [names objectAtIndex:0], [names objectAtIndex:1]]; text = [NSString stringWithFormat:NSLocalizedStringFromTable(@"room_many_users_are_typing", @"Vector", nil), [names objectAtIndex:0], [names objectAtIndex:1]];
} }
//((RoomInputToolbarView*)self.inputToolbarView).typingNotifLabel.text = text; [((RoomExtraInfosInfoView*) self.extraInfoView) updateTypingMessage:text];
} }
@end @end

View file

@ -21,5 +21,14 @@
`RoomExtraInfosInfoView` instance is a view used to display extra information `RoomExtraInfosInfoView` instance is a view used to display extra information
*/ */
@interface RoomExtraInfosInfoView : MXKRoomExtraInfoView @interface RoomExtraInfosInfoView : MXKRoomExtraInfoView
@property (weak, nonatomic) IBOutlet UIImageView *typingImageView;
@property (weak, nonatomic) IBOutlet UILabel *messageLabel;
@property (weak, nonatomic) IBOutlet NSLayoutConstraint *mainHeightConstraint; @property (weak, nonatomic) IBOutlet NSLayoutConstraint *mainHeightConstraint;
// update the displayed typing message.
// nil message hides the typing icon too.
- (void)updateTypingMessage:(NSString*)message;
@end @end

View file

@ -47,5 +47,28 @@
// Remove default toolbar background color // Remove default toolbar background color
self.backgroundColor = [UIColor whiteColor]; self.backgroundColor = [UIColor whiteColor];
// TODO : put this mint grey color as a resource
self.typingImageView.backgroundColor = [UIColor colorWithRed:(98.0/256.0) green:(206.0/256.0) blue:(156.0/256.0) alpha:1.0];
self.typingImageView.layer.cornerRadius = self.typingImageView.frame.size.height / 2;
} }
// update the displayed typing message.
// nil message hides the typing icon too.
- (void)updateTypingMessage:(NSString*)message
{
if (message)
{
self.typingImageView.hidden = false;
self.messageLabel.hidden = false;
self.messageLabel.text = message;
}
else
{
self.typingImageView.hidden = true;
self.messageLabel.hidden = true;
}
}
@end @end

View file

@ -2,7 +2,7 @@
<document type="com.apple.InterfaceBuilder3.CocoaTouch.XIB" version="3.0" toolsVersion="8191" systemVersion="14F27" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES"> <document type="com.apple.InterfaceBuilder3.CocoaTouch.XIB" version="3.0" toolsVersion="8191" systemVersion="14F27" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES">
<dependencies> <dependencies>
<deployment identifier="iOS"/> <deployment identifier="iOS"/>
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="8191"/> <plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="8154"/>
</dependencies> </dependencies>
<objects> <objects>
<placeholder placeholderIdentifier="IBFilesOwner" id="-1" userLabel="File's Owner"/> <placeholder placeholderIdentifier="IBFilesOwner" id="-1" userLabel="File's Owner"/>
@ -13,8 +13,31 @@
<subviews> <subviews>
<view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="qhJ-5H-64e" userLabel="Container"> <view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="qhJ-5H-64e" userLabel="Container">
<rect key="frame" x="0.0" y="0.0" width="600" height="50"/> <rect key="frame" x="0.0" y="0.0" width="600" height="50"/>
<color key="backgroundColor" red="0.75890770890000003" green="1" blue="0.29818001440000003" alpha="1" colorSpace="calibratedRGB"/> <subviews>
<imageView userInteractionEnabled="NO" contentMode="scaleToFill" horizontalHuggingPriority="251" verticalHuggingPriority="251" image="typing.png" translatesAutoresizingMaskIntoConstraints="NO" id="d6j-oN-9uA">
<rect key="frame" x="8" y="5" width="40" height="40"/>
<color key="backgroundColor" red="1" green="0.0" blue="0.0" alpha="1" colorSpace="calibratedRGB"/>
<constraints>
<constraint firstAttribute="height" constant="40" id="657-fV-gDE"/>
<constraint firstAttribute="width" constant="40" id="vxL-QJ-z0p"/>
</constraints>
</imageView>
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="Label" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="7bS-1u-GUX" userLabel="Message Label">
<rect key="frame" x="56" y="5" width="536" height="40"/>
<constraints>
<constraint firstAttribute="height" constant="40" id="PVB-be-euJ"/>
</constraints>
<fontDescription key="fontDescription" type="system" pointSize="13"/>
<color key="textColor" white="0.66666666666666663" alpha="1" colorSpace="calibratedWhite"/>
<nil key="highlightedColor"/>
</label>
</subviews>
<constraints> <constraints>
<constraint firstItem="7bS-1u-GUX" firstAttribute="leading" secondItem="d6j-oN-9uA" secondAttribute="trailing" constant="8" id="6Js-Lq-pKz"/>
<constraint firstItem="7bS-1u-GUX" firstAttribute="top" secondItem="qhJ-5H-64e" secondAttribute="top" constant="5" id="EYf-ry-ZeK"/>
<constraint firstItem="d6j-oN-9uA" firstAttribute="top" secondItem="qhJ-5H-64e" secondAttribute="top" constant="5" id="MEa-LJ-cGx"/>
<constraint firstItem="d6j-oN-9uA" firstAttribute="leading" secondItem="qhJ-5H-64e" secondAttribute="leading" constant="8" id="YYC-Q1-IoC"/>
<constraint firstAttribute="trailing" secondItem="7bS-1u-GUX" secondAttribute="trailing" constant="8" id="tCW-EI-6Yt"/>
<constraint firstAttribute="height" constant="50" id="xPK-Yw-hQ9"/> <constraint firstAttribute="height" constant="50" id="xPK-Yw-hQ9"/>
</constraints> </constraints>
</view> </view>
@ -31,7 +54,12 @@
<freeformSimulatedSizeMetrics key="simulatedDestinationMetrics"/> <freeformSimulatedSizeMetrics key="simulatedDestinationMetrics"/>
<connections> <connections>
<outlet property="mainHeightConstraint" destination="xPK-Yw-hQ9" id="dJ5-pI-KyT"/> <outlet property="mainHeightConstraint" destination="xPK-Yw-hQ9" id="dJ5-pI-KyT"/>
<outlet property="messageLabel" destination="7bS-1u-GUX" id="5c1-hT-y49"/>
<outlet property="typingImageView" destination="d6j-oN-9uA" id="kvp-J3-bVj"/>
</connections> </connections>
</view> </view>
</objects> </objects>
<resources>
<image name="typing.png" width="20" height="20"/>
</resources>
</document> </document>