2017-07-03 15:57:10 +00:00
|
|
|
/*
|
|
|
|
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"
|
|
|
|
|
|
|
|
#import "RiotDesignValues.h"
|
|
|
|
|
2017-07-05 07:50:15 +00:00
|
|
|
#import "RoomBubbleCellData.h"
|
|
|
|
|
2017-07-05 10:29:54 +00:00
|
|
|
@interface RoomMembershipBubbleCell ()
|
|
|
|
{
|
|
|
|
CGFloat xibPictureViewTopConstraintConstant;
|
|
|
|
}
|
|
|
|
@end
|
2017-07-05 07:50:15 +00:00
|
|
|
|
2017-07-03 15:57:10 +00:00
|
|
|
@implementation RoomMembershipBubbleCell
|
|
|
|
|
|
|
|
- (void)awakeFromNib
|
|
|
|
{
|
|
|
|
[super awakeFromNib];
|
|
|
|
|
2017-07-05 10:29:54 +00:00
|
|
|
// Get original xib values
|
|
|
|
xibPictureViewTopConstraintConstant = self.pictureViewTopConstraint.constant;
|
2017-07-05 07:50:15 +00:00
|
|
|
}
|
|
|
|
|
2017-08-08 14:05:43 +00:00
|
|
|
- (void)customizeTableViewCellRendering
|
|
|
|
{
|
|
|
|
[super customizeTableViewCellRendering];
|
|
|
|
|
|
|
|
self.messageTextView.tintColor = kRiotColorGreen;
|
|
|
|
}
|
|
|
|
|
2017-07-05 07:50:15 +00:00
|
|
|
- (void)prepareForReuse
|
|
|
|
{
|
2017-09-26 14:10:42 +00:00
|
|
|
[super prepareForReuse];
|
|
|
|
|
2017-07-05 07:50:15 +00:00
|
|
|
if (self.pictureViewTopConstraint.constant != xibPictureViewTopConstraintConstant)
|
|
|
|
{
|
|
|
|
self.pictureViewTopConstraint.constant = xibPictureViewTopConstraintConstant;
|
|
|
|
}
|
2017-07-03 15:57:10 +00:00
|
|
|
}
|
|
|
|
|
2017-07-05 07:50:15 +00:00
|
|
|
- (void)render:(MXKCellData *)cellData
|
|
|
|
{
|
|
|
|
[super render:cellData];
|
|
|
|
|
|
|
|
RoomBubbleCellData *data = (RoomBubbleCellData*)cellData;
|
|
|
|
|
2017-07-05 12:13:38 +00:00
|
|
|
// If the text was moved down (selected cell or last event), do the same for the icon
|
|
|
|
if ((data.containsLastMessage || data.selectedComponentIndex != NSNotFound)
|
|
|
|
&& [data.attributedTextMessage.string hasPrefix:@"\n"])
|
2017-07-05 07:50:15 +00:00
|
|
|
{
|
|
|
|
self.pictureViewTopConstraint.constant = xibPictureViewTopConstraintConstant + 14;
|
|
|
|
}
|
|
|
|
}
|
2017-07-05 12:13:38 +00:00
|
|
|
|
2017-07-03 15:57:10 +00:00
|
|
|
@end
|