ContactTableViewCell: Display power label instead of badge.

This commit is contained in:
SBiOSoftWhare 2020-04-08 12:35:18 +02:00
parent 10ad3f3262
commit 40b48a78ac
3 changed files with 22 additions and 35 deletions

View file

@ -28,11 +28,11 @@
MXKContact *contact;
}
@property (nonatomic) IBOutlet MXKImageView *thumbnailView;
@property (nonatomic) IBOutlet UIImageView *thumbnailBadgeView;
@property (nonatomic) IBOutlet UILabel *contactDisplayNameLabel;
@property (nonatomic) IBOutlet UILabel *contactInformationLabel;
@property (nonatomic) IBOutlet UIView *customAccessoryView;
@property (weak, nonatomic) IBOutlet MXKImageView *thumbnailView;
@property (weak, nonatomic) IBOutlet UILabel *contactDisplayNameLabel;
@property (weak, nonatomic) IBOutlet UILabel *powerLevelLabel;
@property (weak, nonatomic) IBOutlet UILabel *contactInformationLabel;
@property (weak, nonatomic) IBOutlet UIView *customAccessoryView;
@property (weak, nonatomic) IBOutlet UIImageView *avatarBadgeImageView;
@property (nonatomic) BOOL showCustomAccessoryView;

View file

@ -56,6 +56,7 @@
// apply the vector colours
self.contactDisplayNameLabel.textColor = ThemeService.shared.theme.textPrimaryColor;
self.contactInformationLabel.textColor = ThemeService.shared.theme.textSecondaryColor;
self.powerLevelLabel.textColor = ThemeService.shared.theme.textSecondaryColor;
// Clear the default background color of a MXKImageView instance
self.thumbnailView.defaultBackgroundColor = [UIColor clearColor];
@ -134,8 +135,6 @@
mxPresenceObserver = nil;
}
self.thumbnailBadgeView.hidden = YES;
// Sanity check: accept only object of MXKContact classes or sub-classes
NSParameterAssert([cellData isKindOfClass:[MXKContact class]]);
contact = (MXKContact*)cellData;
@ -147,6 +146,7 @@
self.thumbnailView.image = nil;
self.contactDisplayNameLabel.text = nil;
self.contactInformationLabel.text = nil;
self.powerLevelLabel.text = nil;
return;
}
@ -310,18 +310,7 @@
}
- (void)refreshLocalContactInformation
{
NSArray *identifiers = contact.matrixIdentifiers;
if (identifiers.count)
{
self.thumbnailBadgeView.image = [UIImage imageNamed:@"riot_icon"];
self.thumbnailBadgeView.hidden = NO;
}
else
{
self.thumbnailBadgeView.hidden = YES;
}
{
// Display the first contact method in sub label.
NSString *subLabelText = nil;
if (contact.emailAddresses.count)

View file

@ -30,25 +30,23 @@
<imageView clipsSubviews="YES" userInteractionEnabled="NO" contentMode="scaleAspectFit" horizontalHuggingPriority="251" verticalHuggingPriority="251" translatesAutoresizingMaskIntoConstraints="NO" id="Wg7-no-cax">
<rect key="frame" x="41" y="43" width="16" height="16"/>
<constraints>
<constraint firstAttribute="width" constant="16" id="KYi-Aj-oCp"/>
<constraint firstAttribute="width" secondItem="Wg7-no-cax" secondAttribute="height" multiplier="1:1" id="Lh5-LD-3eg"/>
</constraints>
</imageView>
<imageView hidden="YES" userInteractionEnabled="NO" contentMode="scaleToFill" horizontalHuggingPriority="251" verticalHuggingPriority="251" translatesAutoresizingMaskIntoConstraints="NO" id="e2Q-sr-Kz4">
<rect key="frame" x="42" y="10" width="20" height="21"/>
<accessibility key="accessibilityConfiguration" identifier="ThumbnailBadgeView"/>
<constraints>
<constraint firstAttribute="height" constant="21" id="5Do-zm-vSO"/>
<constraint firstAttribute="width" constant="20" id="IIL-0b-xCh"/>
<constraint firstAttribute="width" constant="16" id="Rcc-M1-2hb"/>
</constraints>
</imageView>
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" verticalHuggingPriority="251" text="Display name" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontForContentSizeCategory="YES" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="Lg1-xQ-AGn" userLabel="member display name">
<rect key="frame" x="69" y="14" width="481" height="21"/>
<rect key="frame" x="69" y="14" width="489" height="21"/>
<accessibility key="accessibilityConfiguration" identifier="MemberDisplayName"/>
<fontDescription key="fontDescription" style="UICTFontTextStyleHeadline"/>
<color key="textColor" red="0.0" green="0.0" blue="0.0" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
<nil key="highlightedColor"/>
</label>
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" text="" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontForContentSizeCategory="YES" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="1nR-ck-5Xd">
<rect key="frame" x="563" y="24.5" width="0.0" height="0.0"/>
<accessibility key="accessibilityConfiguration" identifier="ContactInformationLabel"/>
<fontDescription key="fontDescription" type="system" pointSize="12"/>
<color key="textColor" red="0.66666666669999997" green="0.66666666669999997" blue="0.66666666669999997" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
<nil key="highlightedColor"/>
</label>
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" text="info label" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontForContentSizeCategory="YES" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="dQt-mN-T6b">
<rect key="frame" x="69" y="39" width="531" height="19.5"/>
<accessibility key="accessibilityConfiguration" identifier="ContactInformationLabel"/>
@ -67,21 +65,20 @@
</view>
</subviews>
<constraints>
<constraint firstItem="Wg7-no-cax" firstAttribute="width" secondItem="Wg7-no-cax" secondAttribute="height" multiplier="1:1" id="07s-nq-mon"/>
<constraint firstAttribute="bottom" relation="greaterThanOrEqual" secondItem="RX5-eD-c3c" secondAttribute="bottom" constant="15" id="0MH-4P-AYF"/>
<constraint firstAttribute="bottom" secondItem="dQt-mN-T6b" secondAttribute="bottom" constant="15" id="2cU-tU-nDT"/>
<constraint firstItem="e2Q-sr-Kz4" firstAttribute="trailing" secondItem="RX5-eD-c3c" secondAttribute="trailing" constant="7" id="Fib-p7-t8G"/>
<constraint firstItem="Lg1-xQ-AGn" firstAttribute="leading" secondItem="RX5-eD-c3c" secondAttribute="trailing" constant="14" id="Pgp-JM-oQd"/>
<constraint firstItem="dQt-mN-T6b" firstAttribute="leading" secondItem="RX5-eD-c3c" secondAttribute="trailing" constant="14" id="XFM-LG-4uJ"/>
<constraint firstItem="dQt-mN-T6b" firstAttribute="top" secondItem="Lg1-xQ-AGn" secondAttribute="bottom" constant="4" id="iaT-57-GOs"/>
<constraint firstItem="1nR-ck-5Xd" firstAttribute="centerY" secondItem="Lg1-xQ-AGn" secondAttribute="centerY" id="m01-Lq-3wa"/>
<constraint firstItem="RX5-eD-c3c" firstAttribute="top" secondItem="aXz-IR-jj5" secondAttribute="top" constant="15" id="mga-fG-I0L"/>
<constraint firstItem="Ogo-Qt-u2C" firstAttribute="leading" secondItem="Lg1-xQ-AGn" secondAttribute="trailing" constant="13" id="oNi-JM-zCJ"/>
<constraint firstItem="Ogo-Qt-u2C" firstAttribute="leading" secondItem="1nR-ck-5Xd" secondAttribute="trailing" id="nbn-Je-HEE"/>
<constraint firstItem="Wg7-no-cax" firstAttribute="bottom" secondItem="RX5-eD-c3c" secondAttribute="bottom" constant="2" id="pck-mZ-FjJ"/>
<constraint firstItem="Wg7-no-cax" firstAttribute="width" secondItem="Wg7-no-cax" secondAttribute="height" multiplier="1:1" id="sZo-F2-fpL"/>
<constraint firstAttribute="trailing" secondItem="dQt-mN-T6b" secondAttribute="trailing" id="t2m-pb-5zd"/>
<constraint firstItem="Lg1-xQ-AGn" firstAttribute="top" secondItem="aXz-IR-jj5" secondAttribute="top" constant="14" id="tY3-6V-A3B"/>
<constraint firstItem="1nR-ck-5Xd" firstAttribute="leading" secondItem="Lg1-xQ-AGn" secondAttribute="trailing" constant="5" id="tat-Fj-BSw"/>
<constraint firstItem="RX5-eD-c3c" firstAttribute="leading" secondItem="aXz-IR-jj5" secondAttribute="leading" constant="13" id="tgy-cX-Wxm"/>
<constraint firstItem="RX5-eD-c3c" firstAttribute="top" secondItem="e2Q-sr-Kz4" secondAttribute="top" constant="5" id="xrs-nE-h6t"/>
<constraint firstItem="Wg7-no-cax" firstAttribute="trailing" secondItem="RX5-eD-c3c" secondAttribute="trailing" constant="2" id="zT4-CH-fH8"/>
</constraints>
</tableViewCellContentView>
@ -98,9 +95,10 @@
<outlet property="customAccessViewWidthConstraint" destination="pDU-SS-0mb" id="A22-tz-iIz"/>
<outlet property="customAccessoryView" destination="Ogo-Qt-u2C" id="Hec-bO-0Av"/>
<outlet property="customAccessoryViewLeadingConstraint" destination="cWl-2f-cvI" id="WSj-ru-Qxx"/>
<outlet property="thumbnailBadgeView" destination="e2Q-sr-Kz4" id="kMn-et-a0z"/>
<outlet property="powerLevelLabel" destination="1nR-ck-5Xd" id="aIO-tg-fBq"/>
<outlet property="thumbnailView" destination="RX5-eD-c3c" id="GBi-K9-LhK"/>
</connections>
<point key="canvasLocation" x="80" y="48.575712143928037"/>
</tableViewCell>
</objects>
</document>