Use a textview in placeholder view.

Signed-off-by: Ivan Sein <ivan@nextcloud.com>
This commit is contained in:
Ivan Sein 2021-09-03 13:05:44 +02:00
Родитель ebad26a2c5
Коммит 6c82d9050b
11 изменённых файлов: 53 добавлений и 31 удалений

Просмотреть файл

@ -130,7 +130,7 @@
// Contacts placeholder view
_participantsBackgroundView = [[PlaceholderView alloc] init];
[_participantsBackgroundView setImage:[UIImage imageNamed:@"contacts-placeholder"]];
[_participantsBackgroundView.placeholderText setText:NSLocalizedString(@"No participants found", nil)];
[_participantsBackgroundView.placeholderTextView setText:NSLocalizedString(@"No participants found", nil)];
[_participantsBackgroundView.placeholderView setHidden:YES];
[_participantsBackgroundView.loadingView startAnimating];
self.tableView.backgroundView = _participantsBackgroundView;

Просмотреть файл

@ -75,7 +75,7 @@
// Directory placeholder view
_directoryBackgroundView = [[PlaceholderView alloc] init];
[_directoryBackgroundView setImage:[UIImage imageNamed:@"folder-placeholder"]];
[_directoryBackgroundView.placeholderText setText:NSLocalizedString(@"No files in here", nil)];
[_directoryBackgroundView.placeholderTextView setText:NSLocalizedString(@"No files in here", nil)];
[_directoryBackgroundView.placeholderView setHidden:YES];
[_directoryBackgroundView.loadingView startAnimating];
self.tableView.backgroundView = _directoryBackgroundView;

Просмотреть файл

@ -689,13 +689,13 @@ NSString * const NCChatViewControllerForwardNotification = @"NCChatViewControlle
- (void)checkLobbyState
{
if ([self shouldPresentLobbyView]) {
[_chatBackgroundView.placeholderText setText:NSLocalizedString(@"You are currently waiting in the lobby", nil)];
[_chatBackgroundView.placeholderTextView setText:NSLocalizedString(@"You are currently waiting in the lobby", nil)];
[_chatBackgroundView setImage:[UIImage imageNamed:@"lobby-placeholder"]];
if (_room.lobbyTimer > 0) {
NSDate *date = [[NSDate alloc] initWithTimeIntervalSince1970:_room.lobbyTimer];
NSString *meetingStart = [NCUtils readableDateFromDate:date];
NSString *placeHolderText = [NSString stringWithFormat:NSLocalizedString(@"You are currently waiting in the lobby.\nThis meeting is scheduled for\n%@", nil), meetingStart];
[_chatBackgroundView.placeholderText setText:placeHolderText];
[_chatBackgroundView.placeholderTextView setText:placeHolderText];
[_chatBackgroundView setImage:[UIImage imageNamed:@"lobby-placeholder"]];
}
[_chatBackgroundView.placeholderView setHidden:NO];
@ -704,7 +704,7 @@ NSString * const NCChatViewControllerForwardNotification = @"NCChatViewControlle
// Clear current chat since chat history will be retrieve when lobby is disabled
[self cleanChat];
} else {
[_chatBackgroundView.placeholderText setText:NSLocalizedString(@"No messages yet, start the conversation!", nil)];
[_chatBackgroundView.placeholderTextView setText:NSLocalizedString(@"No messages yet, start the conversation!", nil)];
[_chatBackgroundView setImage:[UIImage imageNamed:@"chat-placeholder"]];
[_chatBackgroundView.placeholderView setHidden:YES];
[_chatBackgroundView.loadingView startAnimating];

Просмотреть файл

@ -26,7 +26,7 @@
@property (weak, nonatomic) IBOutlet UIView *placeholderView;
@property (weak, nonatomic) IBOutlet UIImageView *placeholderImage;
@property (weak, nonatomic) IBOutlet UILabel *placeholderText;
@property (weak, nonatomic) IBOutlet UITextView *placeholderTextView;
@property (weak, nonatomic) IBOutlet UIActivityIndicatorView *loadingView;
- (void)setImage:(UIImage *)image;

Просмотреть файл

@ -1,9 +1,10 @@
<?xml version="1.0" encoding="UTF-8"?>
<document type="com.apple.InterfaceBuilder3.CocoaTouch.XIB" version="3.0" toolsVersion="17506" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" colorMatched="YES">
<document type="com.apple.InterfaceBuilder3.CocoaTouch.XIB" version="3.0" toolsVersion="18122" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" useSafeAreas="YES" colorMatched="YES">
<device id="retina4_7" orientation="portrait" appearance="dark"/>
<dependencies>
<deployment identifier="iOS"/>
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="17505"/>
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="18093"/>
<capability name="Safe area layout guides" minToolsVersion="9.0"/>
<capability name="System colors in document resources" minToolsVersion="11.0"/>
<capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/>
</dependencies>
@ -13,42 +14,63 @@
<outlet property="contentView" destination="iN0-l3-epB" id="OnQ-or-tGk"/>
<outlet property="loadingView" destination="FB3-Ig-rQB" id="gOr-Ol-aYj"/>
<outlet property="placeholderImage" destination="VTo-Dp-QXn" id="RiU-2M-0W8"/>
<outlet property="placeholderText" destination="gUX-lk-W7O" id="EJy-uk-Lyh"/>
<outlet property="placeholderTextView" destination="pmx-ec-gNw" id="YIT-Hn-RsI"/>
<outlet property="placeholderView" destination="Vla-vD-TGa" id="56h-KR-IJ3"/>
</connections>
</placeholder>
<placeholder placeholderIdentifier="IBFirstResponder" id="-2" customClass="UIResponder"/>
<view contentMode="scaleToFill" insetsLayoutMarginsFromSafeArea="NO" id="iN0-l3-epB">
<view contentMode="scaleToFill" id="iN0-l3-epB">
<rect key="frame" x="0.0" y="0.0" width="350" height="350"/>
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
<subviews>
<activityIndicatorView opaque="NO" contentMode="scaleToFill" horizontalHuggingPriority="750" verticalHuggingPriority="750" fixedFrame="YES" style="medium" translatesAutoresizingMaskIntoConstraints="NO" id="FB3-Ig-rQB">
<activityIndicatorView opaque="NO" contentMode="scaleToFill" horizontalHuggingPriority="750" verticalHuggingPriority="750" style="medium" translatesAutoresizingMaskIntoConstraints="NO" id="FB3-Ig-rQB">
<rect key="frame" x="165" y="165" width="20" height="20"/>
<autoresizingMask key="autoresizingMask" flexibleMinX="YES" flexibleMaxX="YES" flexibleMinY="YES" flexibleMaxY="YES"/>
<color key="color" systemColor="placeholderTextColor"/>
</activityIndicatorView>
<view contentMode="scaleToFill" fixedFrame="YES" translatesAutoresizingMaskIntoConstraints="NO" id="Vla-vD-TGa">
<view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="Vla-vD-TGa">
<rect key="frame" x="16" y="20" width="318" height="310"/>
<autoresizingMask key="autoresizingMask" flexibleMinX="YES" flexibleMaxX="YES" flexibleMinY="YES" flexibleMaxY="YES"/>
<subviews>
<imageView userInteractionEnabled="NO" contentMode="scaleToFill" horizontalHuggingPriority="251" verticalHuggingPriority="251" fixedFrame="YES" image="chat-placeholder" translatesAutoresizingMaskIntoConstraints="NO" id="VTo-Dp-QXn">
<rect key="frame" x="94" y="37" width="128" height="128"/>
<autoresizingMask key="autoresizingMask" flexibleMinX="YES" flexibleMaxX="YES" flexibleMaxY="YES"/>
<imageView userInteractionEnabled="NO" contentMode="scaleToFill" horizontalHuggingPriority="251" verticalHuggingPriority="251" image="chat-placeholder" translatesAutoresizingMaskIntoConstraints="NO" id="VTo-Dp-QXn">
<rect key="frame" x="95" y="27" width="128" height="128"/>
<constraints>
<constraint firstAttribute="height" constant="128" id="HMf-1J-e5D"/>
<constraint firstAttribute="width" constant="128" id="ert-mq-fmE"/>
</constraints>
</imageView>
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" fixedFrame="YES" text="No messages yet, start the conversation!" textAlignment="center" lineBreakMode="tailTruncation" numberOfLines="3" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="gUX-lk-W7O">
<rect key="frame" x="11" y="177" width="297" height="60"/>
<autoresizingMask key="autoresizingMask" flexibleMinX="YES" flexibleMaxX="YES" flexibleMaxY="YES"/>
<fontDescription key="fontDescription" type="system" pointSize="16"/>
<textView clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="scaleToFill" editable="NO" text="No messages yet, start the conversation!" textAlignment="center" translatesAutoresizingMaskIntoConstraints="NO" id="pmx-ec-gNw">
<rect key="frame" x="0.0" y="155" width="318" height="155"/>
<color key="textColor" systemColor="placeholderTextColor"/>
<nil key="highlightedColor"/>
</label>
<fontDescription key="fontDescription" type="system" pointSize="16"/>
<textInputTraits key="textInputTraits" autocapitalizationType="sentences"/>
</textView>
</subviews>
<color key="backgroundColor" systemColor="systemBackgroundColor"/>
<constraints>
<constraint firstAttribute="bottom" secondItem="pmx-ec-gNw" secondAttribute="bottom" id="8lK-bu-TwT"/>
<constraint firstItem="VTo-Dp-QXn" firstAttribute="centerX" secondItem="Vla-vD-TGa" secondAttribute="centerX" id="HYF-RJ-y8q"/>
<constraint firstItem="pmx-ec-gNw" firstAttribute="leading" secondItem="Vla-vD-TGa" secondAttribute="leading" id="KKv-DW-NOa"/>
<constraint firstItem="VTo-Dp-QXn" firstAttribute="top" relation="greaterThanOrEqual" secondItem="Vla-vD-TGa" secondAttribute="top" id="P2e-ge-Hoi"/>
<constraint firstItem="pmx-ec-gNw" firstAttribute="height" secondItem="Vla-vD-TGa" secondAttribute="height" multiplier="0.5" id="gI8-Om-K0y"/>
<constraint firstAttribute="trailing" secondItem="pmx-ec-gNw" secondAttribute="trailing" id="h8u-LI-cCf"/>
<constraint firstItem="VTo-Dp-QXn" firstAttribute="bottom" secondItem="pmx-ec-gNw" secondAttribute="top" id="iKn-nx-5ef"/>
<constraint firstItem="pmx-ec-gNw" firstAttribute="width" secondItem="Vla-vD-TGa" secondAttribute="width" id="wwW-vJ-RFD"/>
</constraints>
</view>
</subviews>
<viewLayoutGuide key="safeArea" id="MQb-YF-lsB"/>
<color key="backgroundColor" systemColor="systemBackgroundColor"/>
<constraints>
<constraint firstItem="FB3-Ig-rQB" firstAttribute="centerY" secondItem="iN0-l3-epB" secondAttribute="centerY" id="JXb-4p-Q1n"/>
<constraint firstItem="Vla-vD-TGa" firstAttribute="leading" secondItem="MQb-YF-lsB" secondAttribute="leading" constant="16" id="O8w-gy-WDd"/>
<constraint firstItem="MQb-YF-lsB" firstAttribute="bottom" secondItem="Vla-vD-TGa" secondAttribute="bottom" constant="20" id="bOS-hV-MdP"/>
<constraint firstItem="Vla-vD-TGa" firstAttribute="centerX" secondItem="iN0-l3-epB" secondAttribute="centerX" id="jWR-Hn-EeS"/>
<constraint firstItem="FB3-Ig-rQB" firstAttribute="centerX" secondItem="iN0-l3-epB" secondAttribute="centerX" id="o9d-6d-Hew"/>
<constraint firstItem="MQb-YF-lsB" firstAttribute="trailing" secondItem="Vla-vD-TGa" secondAttribute="trailing" constant="16" id="ocj-LQ-CoL"/>
<constraint firstItem="Vla-vD-TGa" firstAttribute="centerY" secondItem="iN0-l3-epB" secondAttribute="centerY" id="t8Q-1d-md6"/>
<constraint firstItem="Vla-vD-TGa" firstAttribute="top" secondItem="MQb-YF-lsB" secondAttribute="top" constant="20" id="ygl-nN-far"/>
</constraints>
<freeformSimulatedSizeMetrics key="simulatedDestinationMetrics"/>
<point key="canvasLocation" x="17" y="-236"/>
<point key="canvasLocation" x="16" y="-236.58170914542731"/>
</view>
</objects>
<resources>

Просмотреть файл

@ -47,7 +47,7 @@
// Contacts placeholder view
_contactsBackgroundView = [[PlaceholderView alloc] init];
[_contactsBackgroundView setImage:[UIImage imageNamed:@"contacts-placeholder"]];
[_contactsBackgroundView.placeholderText setText:NSLocalizedString(@"No results found", nil)];
[_contactsBackgroundView.placeholderTextView setText:NSLocalizedString(@"No results found", nil)];
[self showSearchingUI];
self.tableView.backgroundView = _contactsBackgroundView;
}

Просмотреть файл

@ -135,7 +135,7 @@
// Room creation placeholder view
_roomCreationBackgroundView = [[PlaceholderView alloc] init];
[_roomCreationBackgroundView setImage:[UIImage imageNamed:@"contacts-placeholder"]];
[_roomCreationBackgroundView.placeholderText setText:NSLocalizedString(@"No participants found", nil)];
[_roomCreationBackgroundView.placeholderTextView setText:NSLocalizedString(@"No participants found", nil)];
[_roomCreationBackgroundView.placeholderView setHidden:YES];
[_roomCreationBackgroundView.loadingView startAnimating];
self.tableView.backgroundView = _roomCreationBackgroundView;

Просмотреть файл

@ -51,7 +51,7 @@
// Contacts placeholder view
_roomSearchBackgroundView = [[PlaceholderView alloc] init];
[_roomSearchBackgroundView setImage:[UIImage imageNamed:@"conversations-placeholder"]];
[_roomSearchBackgroundView.placeholderText setText:NSLocalizedString(@"No results found", nil)];
[_roomSearchBackgroundView.placeholderTextView setText:NSLocalizedString(@"No results found", nil)];
[_roomSearchBackgroundView.placeholderView setHidden:YES];
[_roomSearchBackgroundView.loadingView startAnimating];
self.tableView.backgroundView = _roomSearchBackgroundView;

Просмотреть файл

@ -110,7 +110,7 @@ typedef void (^FetchRoomsCompletionBlock)(BOOL success);
// Rooms placeholder view
_roomsBackgroundView = [[PlaceholderView alloc] init];
[_roomsBackgroundView setImage:[UIImage imageNamed:@"conversations-placeholder"]];
[_roomsBackgroundView.placeholderText setText:NSLocalizedString(@"You are not part of any conversation. Press + to start a new one.", nil)];
[_roomsBackgroundView.placeholderTextView setText:NSLocalizedString(@"You are not part of any conversation. Press + to start a new one.", nil)];
[_roomsBackgroundView.placeholderView setHidden:YES];
[_roomsBackgroundView.loadingView startAnimating];
self.tableView.backgroundView = _roomsBackgroundView;

Просмотреть файл

@ -47,7 +47,7 @@
// Contacts placeholder view
_contactsBackgroundView = [[PlaceholderView alloc] init];
[_contactsBackgroundView setImage:[UIImage imageNamed:@"contacts-placeholder"]];
[_contactsBackgroundView.placeholderText setText:NSLocalizedString(@"No results found", nil)];
[_contactsBackgroundView.placeholderTextView setText:NSLocalizedString(@"No results found", nil)];
[self showSearchingUI];
self.tableView.backgroundView = _contactsBackgroundView;
}

Просмотреть файл

@ -198,14 +198,14 @@
// Rooms placeholder view
_roomsBackgroundView = [[PlaceholderView alloc] init];
[_roomsBackgroundView setImage:[UIImage imageNamed:@"conversations-placeholder"]];
[_roomsBackgroundView.placeholderText setText:NSLocalizedString(@"You are not part of any conversation", nil)];
[_roomsBackgroundView.placeholderTextView setText:NSLocalizedString(@"You are not part of any conversation", nil)];
[_roomsBackgroundView.placeholderView setHidden:(_rooms.count > 0)];
[_roomsBackgroundView.loadingView setHidden:YES];
self.tableView.backgroundView = _roomsBackgroundView;
_roomSearchBackgroundView = [[PlaceholderView alloc] init];
[_roomSearchBackgroundView setImage:[UIImage imageNamed:@"conversations-placeholder"]];
[_roomSearchBackgroundView.placeholderText setText:NSLocalizedString(@"No results found", nil)];
[_roomSearchBackgroundView.placeholderTextView setText:NSLocalizedString(@"No results found", nil)];
[_roomSearchBackgroundView.placeholderView setHidden:YES];
[_roomSearchBackgroundView.loadingView setHidden:YES];
_resultTableViewController.tableView.backgroundView = _roomSearchBackgroundView;