Add favorite indicator in room list.

Signed-off-by: Ivan Sein <ivan@nextcloud.com>
This commit is contained in:
Ivan Sein 2018-08-08 15:22:26 +02:00
Родитель d3c17046f2
Коммит 87440263ac
8 изменённых файлов: 36 добавлений и 0 удалений

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

@ -55,10 +55,15 @@
<color key="textColor" red="0.0" green="0.0" blue="0.0" alpha="0.5" colorSpace="custom" customColorSpace="sRGB"/>
<nil key="highlightedColor"/>
</label>
<imageView userInteractionEnabled="NO" contentMode="scaleToFill" horizontalHuggingPriority="251" verticalHuggingPriority="251" fixedFrame="YES" translatesAutoresizingMaskIntoConstraints="NO" id="dQI-ne-wFt">
<rect key="frame" x="45" y="8" width="20" height="20"/>
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/>
</imageView>
</subviews>
</tableViewCellContentView>
<connections>
<outlet property="dateLabel" destination="iMQ-sR-n2H" id="aA6-go-w56"/>
<outlet property="favoriteImage" destination="dQI-ne-wFt" id="AgV-VE-JLZ"/>
<outlet property="labelSubTitle" destination="FDH-Ta-zgI" id="NHp-dM-chx"/>
<outlet property="labelTitle" destination="L2w-ad-rRt" id="CNq-cb-Kc7"/>
<outlet property="roomImage" destination="eGM-8o-ipF" id="Ae7-yR-KGf"/>

23
VideoCalls/Images.xcassets/favorite-room.imageset/Contents.json поставляемый Normal file
Просмотреть файл

@ -0,0 +1,23 @@
{
"images" : [
{
"idiom" : "universal",
"filename" : "favorite-room.png",
"scale" : "1x"
},
{
"idiom" : "universal",
"filename" : "favorite-room@2x.png",
"scale" : "2x"
},
{
"idiom" : "universal",
"filename" : "favorite-room@3x.png",
"scale" : "3x"
}
],
"info" : {
"version" : 1,
"author" : "xcode"
}
}

Двоичные данные
VideoCalls/Images.xcassets/favorite-room.imageset/favorite-room.png поставляемый Normal file

Двоичный файл не отображается.

После

Ширина:  |  Высота:  |  Размер: 519 B

Двоичные данные
VideoCalls/Images.xcassets/favorite-room.imageset/favorite-room@2x.png поставляемый Normal file

Двоичный файл не отображается.

После

Ширина:  |  Высота:  |  Размер: 962 B

Двоичные данные
VideoCalls/Images.xcassets/favorite-room.imageset/favorite-room@3x.png поставляемый Normal file

Двоичный файл не отображается.

После

Ширина:  |  Высота:  |  Размер: 1.3 KiB

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

@ -17,6 +17,7 @@ extern NSString *const kRoomCellIdentifier;
@property (nonatomic, weak) IBOutlet UILabel *labelSubTitle;
@property (nonatomic, weak) IBOutlet UIView *unreadMessagesView;
@property (nonatomic, weak) IBOutlet UILabel *dateLabel;
@property (weak, nonatomic) IBOutlet UIImageView *favoriteImage;
@property (nonatomic, assign) BOOL titleOnly;

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

@ -21,6 +21,7 @@ NSString *const kRoomCellIdentifier = @"RoomCellIdentifier";
self.roomImage.layer.cornerRadius = 24.0;
self.roomImage.layer.masksToBounds = YES;
self.favoriteImage.contentMode = UIViewContentModeCenter;
}
- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
@ -37,6 +38,7 @@ NSString *const kRoomCellIdentifier = @"RoomCellIdentifier";
[self.roomImage cancelImageDownloadTask];
self.roomImage.image = nil;
self.favoriteImage.image = nil;
self.labelSubTitle.text = @"";
self.dateLabel.text = @"";

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

@ -741,6 +741,11 @@ typedef void (^FetchRoomsCompletionBlock)(BOOL success);
break;
}
// Set favorite image
if (room.isFavorite) {
[cell.favoriteImage setImage:[UIImage imageNamed:@"favorite-room"]];
}
cell.accessoryType = UITableViewCellAccessoryDisclosureIndicator;
return cell;