Organize views by feature

This commit is contained in:
SBiOSoftWhare
2018-07-06 16:42:45 +02:00
parent 263c8f9246
commit fbe1264a5a
247 changed files with 1085 additions and 972 deletions
@@ -0,0 +1,30 @@
/*
Copyright 2016 OpenMarket 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 "RoomTitleView.h"
@interface ExpandedRoomTitleView : RoomTitleView
@property (weak, nonatomic) IBOutlet MXKImageView *roomAvatar;
@property (weak, nonatomic) IBOutlet UIView *roomAvatarHeaderBackground;
@property (weak, nonatomic) IBOutlet NSLayoutConstraint *roomAvatarHeaderBackgroundHeightConstraint;
@property (weak, nonatomic) IBOutlet UILabel *roomTopic;
@property (weak, nonatomic) IBOutlet UILabel *roomMembers;
@property (weak, nonatomic) IBOutlet UIView *bottomBorderView;
@end
@@ -0,0 +1,127 @@
/*
Copyright 2016 OpenMarket Ltd
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 "ExpandedRoomTitleView.h"
#import "RiotDesignValues.h"
#import "MXRoomSummary+Riot.h"
@implementation ExpandedRoomTitleView
+ (UINib *)nib
{
return [UINib nibWithNibName:NSStringFromClass([self class])
bundle:[NSBundle bundleForClass:[self class]]];
}
- (void)awakeFromNib
{
[super awakeFromNib];
}
-(void)customizeViewRendering
{
[super customizeViewRendering];
self.displayNameTextField.textColor = (self.mxRoom.summary.displayname.length ? kRiotPrimaryTextColor : kRiotSecondaryTextColor);
self.roomTopic.textColor = kRiotTopicTextColor;
self.roomMembers.textColor = kRiotColorGreen;
}
- (void)refreshDisplay
{
[super refreshDisplay];
if (self.mxRoom)
{
[self.mxRoom.summary setRoomAvatarImageIn:self.roomAvatar];
self.displayNameTextField.text = self.mxRoom.summary.displayname;
if (!self.displayNameTextField.text.length)
{
self.displayNameTextField.text = NSLocalizedStringFromTable(@"room_displayname_no_title", @"Vector", nil);
self.displayNameTextField.textColor = kRiotSecondaryTextColor;
}
else
{
self.displayNameTextField.textColor = kRiotPrimaryTextColor;
}
self.roomTopic.text = [MXTools stripNewlineCharacters:self.mxRoom.state.topic];
// Compute active members count
NSArray *members = [self.mxRoom.state membersWithMembership:MXMembershipJoin includeConferenceUser:NO];
NSUInteger activeCount = 0;
NSUInteger memberCount = 0;
for (MXRoomMember *mxMember in members)
{
memberCount ++;
// Get the user that corresponds to this member
MXUser *user = [self.mxRoom.mxSession userWithUserId:mxMember.userId];
// existing user ?
if (user && user.presence == MXPresenceOnline)
{
activeCount ++;
}
}
if (memberCount)
{
// Check whether the logged in user is alone in this room
if (memberCount == 1 && self.mxRoom.state.membership == MXMembershipJoin)
{
self.roomMembers.text = NSLocalizedStringFromTable(@"room_title_invite_members", @"Vector", nil);
}
else
{
if (activeCount > 1)
{
self.roomMembers.text = [NSString stringWithFormat:NSLocalizedStringFromTable(@"room_title_multiple_active_members", @"Vector", nil), @(activeCount), @(memberCount)];
}
else
{
self.roomMembers.text = [NSString stringWithFormat:NSLocalizedStringFromTable(@"room_title_one_active_member", @"Vector", nil), @(activeCount), @(memberCount)];
}
}
}
else
{
// Should not happen
self.roomMembers.text = nil;
}
}
else
{
self.roomAvatar.image = nil;
self.roomTopic.text = nil;
self.roomMembers.text = nil;
}
// Round image view for thumbnail
self.roomAvatar.layer.cornerRadius = self.roomAvatar.frame.size.width / 2;
self.roomAvatar.clipsToBounds = YES;
self.roomAvatar.defaultBackgroundColor = kRiotSecondaryBgColor;
// Force the layout of subviews to update the position of 'bottomBorderView' which is used to define the actual height of the preview container.
[self layoutIfNeeded];
}
@end
@@ -0,0 +1,163 @@
<?xml version="1.0" encoding="UTF-8"?>
<document type="com.apple.InterfaceBuilder3.CocoaTouch.XIB" version="3.0" toolsVersion="13196" 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="13173"/>
<capability name="Aspect ratio constraints" minToolsVersion="5.1"/>
<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"/>
<view contentMode="scaleToFill" id="BkF-x3-7fX" customClass="ExpandedRoomTitleView">
<rect key="frame" x="0.0" y="0.0" width="600" height="193"/>
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/>
<subviews>
<view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="uSp-YH-L18">
<rect key="frame" x="0.0" y="0.0" width="600" height="95"/>
<subviews>
<view clipsSubviews="YES" contentMode="scaleAspectFill" translatesAutoresizingMaskIntoConstraints="NO" id="eEk-n9-4dA" customClass="MXKImageView">
<rect key="frame" x="258" y="11" width="84" height="84"/>
<color key="backgroundColor" red="0.6886889638" green="1" blue="0.74383144840000004" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
<accessibility key="accessibilityConfiguration" identifier="MemberAvatar"/>
<constraints>
<constraint firstAttribute="width" secondItem="eEk-n9-4dA" secondAttribute="height" multiplier="1:1" id="2HI-Mo-nH4"/>
<constraint firstAttribute="width" constant="84" id="Yye-G1-hCH"/>
</constraints>
</view>
</subviews>
<color key="backgroundColor" red="0.0" green="0.0" blue="0.0" alpha="0.0" colorSpace="custom" customColorSpace="sRGB"/>
<accessibility key="accessibilityConfiguration" identifier="RoomAvatarHeaderBackground"/>
<constraints>
<constraint firstAttribute="height" constant="95" id="DzD-aR-3eV"/>
<constraint firstItem="eEk-n9-4dA" firstAttribute="centerX" secondItem="uSp-YH-L18" secondAttribute="centerX" id="W1w-ZX-f2d"/>
<constraint firstAttribute="bottom" secondItem="eEk-n9-4dA" secondAttribute="bottom" id="hXd-bM-Bbb"/>
</constraints>
</view>
<textField opaque="NO" clipsSubviews="YES" contentMode="scaleToFill" contentHorizontalAlignment="left" contentVerticalAlignment="center" text="Room Name" textAlignment="center" adjustsFontSizeToFit="NO" minimumFontSize="14" translatesAutoresizingMaskIntoConstraints="NO" id="6uH-I3-RQg">
<rect key="frame" x="249" y="103" width="103" height="23"/>
<color key="backgroundColor" red="0.0" green="0.0" blue="0.0" alpha="0.0" colorSpace="custom" customColorSpace="sRGB"/>
<accessibility key="accessibilityConfiguration" identifier="DisplayNameTextField"/>
<fontDescription key="fontDescription" type="system" weight="medium" pointSize="18"/>
<textInputTraits key="textInputTraits" returnKeyType="next"/>
<connections>
<outlet property="delegate" destination="BkF-x3-7fX" id="xX7-jB-9va"/>
</connections>
</textField>
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="Label" textAlignment="center" lineBreakMode="tailTruncation" numberOfLines="2" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="qD3-kA-DSI">
<rect key="frame" x="282" y="131" width="36" height="17"/>
<accessibility key="accessibilityConfiguration" identifier="RoomTopic"/>
<fontDescription key="fontDescription" type="system" pointSize="14"/>
<color key="textColor" cocoaTouchSystemColor="darkTextColor"/>
<nil key="highlightedColor"/>
</label>
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="Label" textAlignment="center" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="ou0-3Z-weL">
<rect key="frame" x="282" y="162" width="36" height="17"/>
<accessibility key="accessibilityConfiguration" identifier="RoomMembers"/>
<fontDescription key="fontDescription" type="system" weight="medium" pointSize="14"/>
<color key="textColor" cocoaTouchSystemColor="darkTextColor"/>
<nil key="highlightedColor"/>
</label>
<imageView userInteractionEnabled="NO" contentMode="scaleToFill" horizontalHuggingPriority="251" verticalHuggingPriority="251" image="members_list_icon.png" translatesAutoresizingMaskIntoConstraints="NO" id="S3Y-wJ-HOe">
<rect key="frame" x="260" y="163.5" width="15" height="15"/>
<accessibility key="accessibilityConfiguration" identifier="RoomMembersDetailsIcon"/>
<constraints>
<constraint firstAttribute="width" constant="15" id="XTx-6p-2wB"/>
<constraint firstAttribute="height" constant="15" id="tXh-eB-ave"/>
</constraints>
</imageView>
<view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="Ckb-7c-sTg">
<rect key="frame" x="0.0" y="192" width="600" height="1"/>
<color key="backgroundColor" red="0.0" green="0.0" blue="0.0" alpha="0.0" colorSpace="custom" customColorSpace="sRGB"/>
<constraints>
<constraint firstAttribute="height" constant="1" id="D7c-fR-aRY"/>
</constraints>
</view>
<view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="8HH-9b-1yH">
<rect key="frame" x="0.0" y="0.0" width="600" height="155"/>
<color key="backgroundColor" red="0.0" green="0.0" blue="0.0" alpha="0.0" colorSpace="custom" customColorSpace="sRGB"/>
</view>
<view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="MFb-0F-eO8">
<rect key="frame" x="0.0" y="155" width="322" height="38"/>
<color key="backgroundColor" red="0.0" green="0.0" blue="0.0" alpha="0.0" colorSpace="custom" customColorSpace="sRGB"/>
</view>
<view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="tsg-nl-P3k">
<rect key="frame" x="322" y="151.5" width="38" height="38"/>
<subviews>
<imageView userInteractionEnabled="NO" contentMode="scaleToFill" horizontalHuggingPriority="251" verticalHuggingPriority="251" image="add_participant.png" translatesAutoresizingMaskIntoConstraints="NO" id="i40-fd-AlH">
<rect key="frame" x="10" y="10" width="18" height="18"/>
<constraints>
<constraint firstAttribute="width" constant="18" id="Jxs-fk-U04"/>
<constraint firstAttribute="width" secondItem="i40-fd-AlH" secondAttribute="height" multiplier="1:1" id="cuB-Hn-Dl3"/>
</constraints>
</imageView>
</subviews>
<color key="backgroundColor" white="0.0" alpha="0.0" colorSpace="calibratedWhite"/>
<constraints>
<constraint firstAttribute="width" constant="38" id="E23-7d-llG"/>
<constraint firstItem="i40-fd-AlH" firstAttribute="centerX" secondItem="tsg-nl-P3k" secondAttribute="centerX" id="gK0-hw-x7R"/>
<constraint firstItem="i40-fd-AlH" firstAttribute="centerY" secondItem="tsg-nl-P3k" secondAttribute="centerY" id="tyV-XH-iOk"/>
<constraint firstAttribute="width" secondItem="tsg-nl-P3k" secondAttribute="height" multiplier="1:1" id="xH6-0P-TLQ"/>
</constraints>
</view>
</subviews>
<color key="backgroundColor" red="0.0" green="0.0" blue="0.0" alpha="0.0" colorSpace="custom" customColorSpace="sRGB"/>
<accessibility key="accessibilityConfiguration" identifier="RoomTitle"/>
<constraints>
<constraint firstAttribute="trailing" secondItem="uSp-YH-L18" secondAttribute="trailing" id="0UG-aH-hVB"/>
<constraint firstItem="qD3-kA-DSI" firstAttribute="centerX" secondItem="BkF-x3-7fX" secondAttribute="centerX" id="1MA-VE-nEM"/>
<constraint firstAttribute="bottom" secondItem="MFb-0F-eO8" secondAttribute="bottom" id="1W0-oZ-AQb"/>
<constraint firstItem="tsg-nl-P3k" firstAttribute="centerY" secondItem="ou0-3Z-weL" secondAttribute="centerY" id="3Pa-cx-AsC"/>
<constraint firstItem="6uH-I3-RQg" firstAttribute="centerX" secondItem="BkF-x3-7fX" secondAttribute="centerX" id="3uN-6W-rVZ"/>
<constraint firstItem="8HH-9b-1yH" firstAttribute="leading" secondItem="BkF-x3-7fX" secondAttribute="leading" id="49B-Gu-i1k"/>
<constraint firstItem="8HH-9b-1yH" firstAttribute="top" secondItem="BkF-x3-7fX" secondAttribute="top" id="4IU-hf-3R1"/>
<constraint firstAttribute="trailing" relation="greaterThanOrEqual" secondItem="tsg-nl-P3k" secondAttribute="trailing" id="4Y7-tV-Spc"/>
<constraint firstItem="ou0-3Z-weL" firstAttribute="centerX" secondItem="BkF-x3-7fX" secondAttribute="centerX" id="9kY-pQ-khO"/>
<constraint firstItem="S3Y-wJ-HOe" firstAttribute="centerY" secondItem="ou0-3Z-weL" secondAttribute="centerY" id="C0N-Rf-ncJ"/>
<constraint firstItem="S3Y-wJ-HOe" firstAttribute="leading" relation="greaterThanOrEqual" secondItem="BkF-x3-7fX" secondAttribute="leading" id="Dib-vF-l0D"/>
<constraint firstItem="qD3-kA-DSI" firstAttribute="top" secondItem="6uH-I3-RQg" secondAttribute="bottom" constant="5" id="IRZ-hl-lUU"/>
<constraint firstItem="MFb-0F-eO8" firstAttribute="leading" secondItem="BkF-x3-7fX" secondAttribute="leading" id="LTB-3D-soR"/>
<constraint firstItem="tsg-nl-P3k" firstAttribute="leading" secondItem="MFb-0F-eO8" secondAttribute="trailing" id="QOq-Cv-1pw"/>
<constraint firstItem="tsg-nl-P3k" firstAttribute="leading" secondItem="ou0-3Z-weL" secondAttribute="trailing" constant="4" id="RNc-DE-a8O"/>
<constraint firstAttribute="trailing" relation="greaterThanOrEqual" secondItem="qD3-kA-DSI" secondAttribute="trailing" constant="31" id="RSk-Fd-oq0"/>
<constraint firstAttribute="trailing" secondItem="8HH-9b-1yH" secondAttribute="trailing" id="SrK-30-YET"/>
<constraint firstItem="MFb-0F-eO8" firstAttribute="top" secondItem="8HH-9b-1yH" secondAttribute="bottom" id="ULI-RY-Ase"/>
<constraint firstItem="Ckb-7c-sTg" firstAttribute="leading" secondItem="BkF-x3-7fX" secondAttribute="leading" id="WJb-dz-Ak3"/>
<constraint firstAttribute="trailing" relation="greaterThanOrEqual" secondItem="6uH-I3-RQg" secondAttribute="trailing" constant="31" id="aK3-vQ-EVu"/>
<constraint firstItem="Ckb-7c-sTg" firstAttribute="top" secondItem="ou0-3Z-weL" secondAttribute="bottom" constant="13" id="aRN-om-eWc"/>
<constraint firstItem="uSp-YH-L18" firstAttribute="leading" secondItem="BkF-x3-7fX" secondAttribute="leading" id="anE-Sc-Gsn"/>
<constraint firstItem="ou0-3Z-weL" firstAttribute="leading" relation="greaterThanOrEqual" secondItem="BkF-x3-7fX" secondAttribute="leading" constant="31" id="c9h-h2-VEs"/>
<constraint firstItem="uSp-YH-L18" firstAttribute="top" secondItem="BkF-x3-7fX" secondAttribute="top" id="dn3-Hv-OyX"/>
<constraint firstAttribute="trailing" secondItem="Ckb-7c-sTg" secondAttribute="trailing" id="erV-R4-LXD"/>
<constraint firstItem="6uH-I3-RQg" firstAttribute="leading" relation="greaterThanOrEqual" secondItem="BkF-x3-7fX" secondAttribute="leading" constant="31" id="gnq-cO-l4Y"/>
<constraint firstItem="ou0-3Z-weL" firstAttribute="leading" secondItem="S3Y-wJ-HOe" secondAttribute="trailing" constant="7" id="iAL-UV-5nu"/>
<constraint firstItem="qD3-kA-DSI" firstAttribute="leading" relation="greaterThanOrEqual" secondItem="BkF-x3-7fX" secondAttribute="leading" constant="31" id="jjG-gN-eIv"/>
<constraint firstItem="6uH-I3-RQg" firstAttribute="top" secondItem="uSp-YH-L18" secondAttribute="bottom" constant="8" id="rAh-mV-nb5"/>
<constraint firstItem="ou0-3Z-weL" firstAttribute="top" secondItem="qD3-kA-DSI" secondAttribute="bottom" constant="14" id="sJB-Wr-gFl"/>
<constraint firstAttribute="trailing" relation="greaterThanOrEqual" secondItem="ou0-3Z-weL" secondAttribute="trailing" constant="31" id="sPZ-Hp-JeH"/>
<constraint firstItem="8HH-9b-1yH" firstAttribute="bottom" secondItem="qD3-kA-DSI" secondAttribute="bottom" constant="7" id="wzH-3D-S6C"/>
<constraint firstAttribute="bottom" secondItem="ou0-3Z-weL" secondAttribute="bottom" constant="14" id="yXn-jl-DeG"/>
</constraints>
<freeformSimulatedSizeMetrics key="simulatedDestinationMetrics"/>
<connections>
<outlet property="addParticipantMask" destination="tsg-nl-P3k" id="ADj-t1-9wf"/>
<outlet property="bottomBorderView" destination="Ckb-7c-sTg" id="2Ky-GN-bO0"/>
<outlet property="displayNameTextField" destination="6uH-I3-RQg" id="MfX-LQ-C2K"/>
<outlet property="roomAvatar" destination="eEk-n9-4dA" id="5jd-Dx-tXE"/>
<outlet property="roomAvatarHeaderBackground" destination="uSp-YH-L18" id="sfW-ED-5bD"/>
<outlet property="roomAvatarHeaderBackgroundHeightConstraint" destination="DzD-aR-3eV" id="SuC-mO-epX"/>
<outlet property="roomDetailsMask" destination="MFb-0F-eO8" id="ajK-sr-qf7"/>
<outlet property="roomMembers" destination="ou0-3Z-weL" id="FCF-ki-HuP"/>
<outlet property="roomTopic" destination="qD3-kA-DSI" id="mOj-AU-7LM"/>
<outlet property="titleMask" destination="8HH-9b-1yH" id="MFh-3r-I5e"/>
</connections>
</view>
</objects>
<resources>
<image name="add_participant.png" width="58" height="58"/>
<image name="members_list_icon.png" width="15" height="15"/>
</resources>
</document>