From 89ce5b12603256ceb581e44c7ff98eea77edc92d Mon Sep 17 00:00:00 2001 From: Ran Greenberg Date: Mon, 21 Aug 2017 12:00:13 +0300 Subject: [PATCH] when image is remote download the image overlay now will show behinds the download indicator --- .../CKGalleryCollectionViewCell.m | 22 ++++++++++++++----- 1 file changed, 17 insertions(+), 5 deletions(-) diff --git a/ios/lib/ReactNativeCameraKit/CKGalleryCollectionViewCell.m b/ios/lib/ReactNativeCameraKit/CKGalleryCollectionViewCell.m index afad334..92c6611 100644 --- a/ios/lib/ReactNativeCameraKit/CKGalleryCollectionViewCell.m +++ b/ios/lib/ReactNativeCameraKit/CKGalleryCollectionViewCell.m @@ -350,6 +350,20 @@ static NSString *remoteDownloadIndicatorType = REMOTE_DOWNLOAD_INDICATOR_TYPE_SP } } +-(void)setSelectedOverLay:(BOOL)shouldShowOverlayColor forceOverlay:(BOOL)force{ + if (force) { + self.imageOveray.backgroundColor = [[UIColor whiteColor] colorWithAlphaComponent:0.5]; + return; + } + + if (shouldShowOverlayColor) { + self.imageOveray.backgroundColor = selectionOverlayColor ? selectionOverlayColor : [[UIColor whiteColor] colorWithAlphaComponent:0.5]; + } + else { + self.imageOveray.backgroundColor = [UIColor clearColor]; + } +} + -(void)setIsSelected:(BOOL)isSelected { @@ -357,9 +371,9 @@ static NSString *remoteDownloadIndicatorType = REMOTE_DOWNLOAD_INDICATOR_TYPE_SP if (self.disableSelectionIcons) return; + [self setSelectedOverLay:isSelected forceOverlay:NO]; + if (_isSelected) { - self.imageOveray.backgroundColor = selectionOverlayColor ? selectionOverlayColor : [[UIColor whiteColor] colorWithAlphaComponent:0.5]; - if (selectedImageIcon) { double frameDuration = 1.0/2.0; // 4 = number of keyframes self.badgeImageView.image = selectedImageIcon; @@ -379,7 +393,6 @@ static NSString *remoteDownloadIndicatorType = REMOTE_DOWNLOAD_INDICATOR_TYPE_SP } } else { - self.imageOveray.backgroundColor = [UIColor clearColor]; if (unSelectedImageIcon) { self.badgeImageView.image = unSelectedImageIcon; [self updateBadgeImageViewFrame]; @@ -392,6 +405,7 @@ static NSString *remoteDownloadIndicatorType = REMOTE_DOWNLOAD_INDICATOR_TYPE_SP -(void)setIsDownloading:(BOOL)isDownloading { _isDownloading = isDownloading; + [self setSelectedOverLay:isDownloading forceOverlay:isDownloading]; [self updateRemoteDownload]; } @@ -403,10 +417,8 @@ static NSString *remoteDownloadIndicatorType = REMOTE_DOWNLOAD_INDICATOR_TYPE_SP } else if ([remoteDownloadIndicatorType isEqualToString:REMOTE_DOWNLOAD_INDICATOR_TYPE_PROGRESS_PIE]) { [self.progressPieView setProgress:downloadingProgress animated:YES]; - } - [self updateRemoteDownload]; }