From 834021fe39f3b650dab04e324da24fd22eb4af62 Mon Sep 17 00:00:00 2001 From: Michael Kirk Date: Tue, 10 Jul 2018 11:28:00 -0600 Subject: [PATCH 1/2] tweak selected color for homeview cells --- Signal/src/ViewControllers/HomeView/HomeViewCell.m | 4 ++++ SignalMessaging/categories/UIColor+OWS.h | 3 ++- SignalMessaging/categories/UIColor+OWS.m | 7 ++++++- 3 files changed, 12 insertions(+), 2 deletions(-) diff --git a/Signal/src/ViewControllers/HomeView/HomeViewCell.m b/Signal/src/ViewControllers/HomeView/HomeViewCell.m index e6e88f715..195bf690a 100644 --- a/Signal/src/ViewControllers/HomeView/HomeViewCell.m +++ b/Signal/src/ViewControllers/HomeView/HomeViewCell.m @@ -65,6 +65,10 @@ NS_ASSUME_NONNULL_BEGIN _viewConstraints = [NSMutableArray new]; + UIView *selectedBackgroundView = [UIView new]; + selectedBackgroundView.backgroundColor = UIColor.ows_tableCellSelectedBackgroundColor; + self.selectedBackgroundView = selectedBackgroundView; + self.avatarView = [[AvatarImageView alloc] init]; [self.contentView addSubview:self.avatarView]; [self.avatarView autoSetDimension:ALDimensionWidth toSize:self.avatarSize]; diff --git a/SignalMessaging/categories/UIColor+OWS.h b/SignalMessaging/categories/UIColor+OWS.h index c412210d9..b5355e04b 100644 --- a/SignalMessaging/categories/UIColor+OWS.h +++ b/SignalMessaging/categories/UIColor+OWS.h @@ -31,6 +31,7 @@ NS_ASSUME_NONNULL_BEGIN @property (class, readonly, nonatomic) UIColor *ows_infoMessageBorderColor; @property (class, readonly, nonatomic) UIColor *ows_toolbarBackgroundColor; @property (class, readonly, nonatomic) UIColor *ows_messageBubbleLightGrayColor; +@property (class, readonly, nonatomic) UIColor *ows_tableCellSelectedBackgroundColor; + (UIColor *)colorWithRGBHex:(unsigned long)value; @@ -45,7 +46,7 @@ NS_ASSUME_NONNULL_BEGIN - (UIColor *)blendWithColor:(UIColor *)otherColor alpha:(CGFloat)alpha; -#pragma mark - +#pragma mark - Color Palette @property (class, readonly, nonatomic) UIColor *ows_signalBlueColor; @property (class, readonly, nonatomic) UIColor *ows_greenColor; diff --git a/SignalMessaging/categories/UIColor+OWS.m b/SignalMessaging/categories/UIColor+OWS.m index 45470a908..e02d26986 100644 --- a/SignalMessaging/categories/UIColor+OWS.m +++ b/SignalMessaging/categories/UIColor+OWS.m @@ -117,6 +117,11 @@ NS_ASSUME_NONNULL_BEGIN return [UIColor colorWithHue:240.0f / 360.0f saturation:0.02f brightness:0.92f alpha:1.0f]; } ++ (UIColor *)ows_tableCellSelectedBackgroundColor +{ + return [[UIColor colorWithRGBHex:0x000000] colorWithAlphaComponent:0.08]; +} + + (UIColor *)colorWithRGBHex:(unsigned long)value { CGFloat red = ((value >> 16) & 0xff) / 255.f; @@ -147,7 +152,7 @@ NS_ASSUME_NONNULL_BEGIN alpha:CGFloatLerp(a0, a1, alpha)]; } -#pragma mark - New Colors +#pragma mark - Color Palette + (UIColor *)ows_signalBlueColor { From 998c2f392c61043d879ea4847ba4d511f8c637ff Mon Sep 17 00:00:00 2001 From: Michael Kirk Date: Tue, 10 Jul 2018 11:33:24 -0600 Subject: [PATCH 2/2] CR: inline per code review --- Signal/src/ViewControllers/HomeView/HomeViewCell.m | 3 ++- SignalMessaging/categories/UIColor+OWS.h | 1 - SignalMessaging/categories/UIColor+OWS.m | 5 ----- 3 files changed, 2 insertions(+), 7 deletions(-) diff --git a/Signal/src/ViewControllers/HomeView/HomeViewCell.m b/Signal/src/ViewControllers/HomeView/HomeViewCell.m index 195bf690a..6d4e9731c 100644 --- a/Signal/src/ViewControllers/HomeView/HomeViewCell.m +++ b/Signal/src/ViewControllers/HomeView/HomeViewCell.m @@ -66,7 +66,8 @@ NS_ASSUME_NONNULL_BEGIN _viewConstraints = [NSMutableArray new]; UIView *selectedBackgroundView = [UIView new]; - selectedBackgroundView.backgroundColor = UIColor.ows_tableCellSelectedBackgroundColor; + selectedBackgroundView.backgroundColor = [[UIColor colorWithRGBHex:0x000000] colorWithAlphaComponent:0.08]; + self.selectedBackgroundView = selectedBackgroundView; self.avatarView = [[AvatarImageView alloc] init]; diff --git a/SignalMessaging/categories/UIColor+OWS.h b/SignalMessaging/categories/UIColor+OWS.h index b5355e04b..419b20bc5 100644 --- a/SignalMessaging/categories/UIColor+OWS.h +++ b/SignalMessaging/categories/UIColor+OWS.h @@ -31,7 +31,6 @@ NS_ASSUME_NONNULL_BEGIN @property (class, readonly, nonatomic) UIColor *ows_infoMessageBorderColor; @property (class, readonly, nonatomic) UIColor *ows_toolbarBackgroundColor; @property (class, readonly, nonatomic) UIColor *ows_messageBubbleLightGrayColor; -@property (class, readonly, nonatomic) UIColor *ows_tableCellSelectedBackgroundColor; + (UIColor *)colorWithRGBHex:(unsigned long)value; diff --git a/SignalMessaging/categories/UIColor+OWS.m b/SignalMessaging/categories/UIColor+OWS.m index e02d26986..3c979ad8c 100644 --- a/SignalMessaging/categories/UIColor+OWS.m +++ b/SignalMessaging/categories/UIColor+OWS.m @@ -117,11 +117,6 @@ NS_ASSUME_NONNULL_BEGIN return [UIColor colorWithHue:240.0f / 360.0f saturation:0.02f brightness:0.92f alpha:1.0f]; } -+ (UIColor *)ows_tableCellSelectedBackgroundColor -{ - return [[UIColor colorWithRGBHex:0x000000] colorWithAlphaComponent:0.08]; -} - + (UIColor *)colorWithRGBHex:(unsigned long)value { CGFloat red = ((value >> 16) & 0xff) / 255.f;