mirror of https://github.com/oxen-io/session-ios
You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
65 lines
2.1 KiB
Matlab
65 lines
2.1 KiB
Matlab
8 years ago
|
//
|
||
|
// Copyright (c) 2017 Open Whisper Systems. All rights reserved.
|
||
|
//
|
||
|
|
||
11 years ago
|
#import "UIUtil.h"
|
||
7 years ago
|
#import <SignalServiceKit/AppContext.h>
|
||
11 years ago
|
|
||
11 years ago
|
#define CONTACT_PICTURE_VIEW_BORDER_WIDTH 0.5f
|
||
11 years ago
|
|
||
|
@implementation UIUtil
|
||
|
|
||
9 years ago
|
+ (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;
|
||
11 years ago
|
}
|
||
|
|
||
7 years ago
|
+ (void)removeRoundedBorderToImageView:(UIImageView *__strong *)imageView
|
||
|
{
|
||
11 years ago
|
[[*imageView layer] setBorderWidth:0];
|
||
|
[[*imageView layer] setCornerRadius:0];
|
||
|
}
|
||
|
|
||
7 years ago
|
+ (completionBlock)modalCompletionBlock
|
||
|
{
|
||
10 years ago
|
completionBlock block = ^void() {
|
||
7 years ago
|
[CurrentAppContext() setStatusBarStyle:UIStatusBarStyleLightContent];
|
||
10 years ago
|
};
|
||
9 years ago
|
|
||
10 years ago
|
return block;
|
||
|
}
|
||
|
|
||
9 years ago
|
+ (void)applyDefaultSystemAppearence
|
||
|
{
|
||
7 years ago
|
[CurrentAppContext() setStatusBarStyle:UIStatusBarStyleDefault];
|
||
9 years ago
|
[[UINavigationBar appearance] setBarStyle:UIBarStyleDefault];
|
||
8 years ago
|
[[UINavigationBar appearance] setTintColor:[UIColor blackColor]];
|
||
9 years ago
|
[[UIBarButtonItem appearance] setTintColor:[UIColor blackColor]];
|
||
8 years ago
|
[[UINavigationBar appearance] setTitleTextAttributes:@{
|
||
7 years ago
|
NSForegroundColorAttributeName : [UIColor blackColor],
|
||
|
}];
|
||
9 years ago
|
}
|
||
|
|
||
|
+ (void)applySignalAppearence
|
||
|
{
|
||
7 years ago
|
[CurrentAppContext() setStatusBarStyle:UIStatusBarStyleLightContent];
|
||
9 years ago
|
[[UINavigationBar appearance] setBarTintColor:[UIColor ows_materialBlueColor]];
|
||
|
[[UINavigationBar appearance] setTintColor:[UIColor whiteColor]];
|
||
|
|
||
|
[[UIBarButtonItem appearanceWhenContainedIn:[UISearchBar class], nil] setTintColor:[UIColor ows_materialBlueColor]];
|
||
|
|
||
9 years ago
|
[[UISwitch appearance] setOnTintColor:[UIColor ows_materialBlueColor]];
|
||
9 years ago
|
[[UIToolbar appearance] setTintColor:[UIColor ows_materialBlueColor]];
|
||
|
[[UIBarButtonItem appearance] setTintColor:[UIColor whiteColor]];
|
||
|
|
||
8 years ago
|
// If we set NSShadowAttributeName, the NSForegroundColorAttributeName value is ignored.
|
||
|
[[UINavigationBar appearance] setTitleTextAttributes:@{
|
||
7 years ago
|
NSForegroundColorAttributeName : [UIColor whiteColor],
|
||
|
}];
|
||
9 years ago
|
}
|
||
|
|
||
11 years ago
|
@end
|