session-ios/Signal/src/util/UIUtil.m
Michael Kirk 06ca3c9290 Mail and Message invite flow
* Spruce up compose contact-picker
- Fix random sorting for contacts missing first or last name
- Add Avatar to contact picker
- de-dupe contacts

Better copy for INVALID_MESSAGE error.

// FREEBIE
2016-11-22 12:11:35 -05:00

60 lines
2.1 KiB
Objective-C

#import "UIUtil.h"
#define CONTACT_PICTURE_VIEW_BORDER_WIDTH 0.5f
@implementation UIUtil
+ (void)applyRoundedBorderToImageView:(UIImageView *)imageView
{
imageView.layer.borderWidth = CONTACT_PICTURE_VIEW_BORDER_WIDTH;
imageView.layer.borderColor = [UIColor clearColor].CGColor;
imageView.layer.cornerRadius = CGRectGetWidth(imageView.frame) / 2;
imageView.layer.masksToBounds = YES;
}
+ (void)removeRoundedBorderToImageView:(UIImageView *__strong *)imageView {
[[*imageView layer] setBorderWidth:0];
[[*imageView layer] setCornerRadius:0];
}
+ (completionBlock)modalCompletionBlock {
completionBlock block = ^void() {
[[UIApplication sharedApplication] setStatusBarStyle:UIStatusBarStyleLightContent];
};
return block;
}
+ (void)applyDefaultSystemAppearence
{
[[UIApplication sharedApplication] setStatusBarStyle:UIStatusBarStyleDefault];
[[UINavigationBar appearance] setBarStyle:UIBarStyleDefault];
[[UIBarButtonItem appearance] setTintColor:[UIColor blackColor]];
NSDictionary *navbarTitleTextAttributes = @{ NSForegroundColorAttributeName : [UIColor blackColor] };
[[UINavigationBar appearance] setTitleTextAttributes:navbarTitleTextAttributes];
}
+ (void)applySignalAppearence
{
[[UIApplication sharedApplication] setStatusBarStyle:UIStatusBarStyleLightContent];
[[UINavigationBar appearance] setBarTintColor:[UIColor ows_materialBlueColor]];
[[UINavigationBar appearance] setTintColor:[UIColor whiteColor]];
[[UIBarButtonItem appearanceWhenContainedIn:[UISearchBar class], nil] setTintColor:[UIColor ows_materialBlueColor]];
[[UISwitch appearance] setOnTintColor:[UIColor ows_materialBlueColor]];
[[UIToolbar appearance] setTintColor:[UIColor ows_materialBlueColor]];
[[UIBarButtonItem appearance] setTintColor:[UIColor whiteColor]];
NSShadow *shadow = [NSShadow new];
[shadow setShadowColor:[UIColor clearColor]];
NSDictionary *navbarTitleTextAttributes = @{
NSForegroundColorAttributeName : [UIColor whiteColor],
NSShadowAttributeName : shadow,
};
[[UINavigationBar appearance] setTitleTextAttributes:navbarTitleTextAttributes];
}
@end