Commit 923be286 authored by Felix Paul Kühne's avatar Felix Paul Kühne

Improve bar button rendering if device runs in the future

parent 9efab407
......@@ -17,12 +17,16 @@
style:UIBarButtonItemStyleBordered
target:target
action:selector];
[doneButton setBackgroundImage:[UIImage imageNamed:@"doneButton"]
forState:UIControlStateNormal
barMetrics:UIBarMetricsDefault];
[doneButton setBackgroundImage:[UIImage imageNamed:@"doneButtonHighlight"]
forState:UIControlStateHighlighted
barMetrics:UIBarMetricsDefault];
if (SYSTEM_RUNS_IN_THE_FUTURE)
doneButton.tintColor = [UIColor whiteColor];
else {
[doneButton setBackgroundImage:[UIImage imageNamed:@"doneButton"]
forState:UIControlStateNormal
barMetrics:UIBarMetricsDefault];
[doneButton setBackgroundImage:[UIImage imageNamed:@"doneButtonHighlight"]
forState:UIControlStateHighlighted
barMetrics:UIBarMetricsDefault];
}
[doneButton setTitleTextAttributes:@{UITextAttributeTextShadowColor : [UIColor whiteColor], UITextAttributeTextColor : [UIColor blackColor]}
forState:UIControlStateNormal];
return doneButton;
......@@ -34,12 +38,16 @@
style:UIBarButtonItemStyleBordered
target:target
action:selector];
[backButton setBackgroundImage:[[UIImage imageNamed:@"backButton"] resizableImageWithCapInsets:UIEdgeInsetsMake(0, 12, 0, 6)]
forState:UIControlStateNormal
barMetrics:UIBarMetricsDefault];
[backButton setBackgroundImage:[[UIImage imageNamed:@"backButtonHighlight"] resizableImageWithCapInsets:UIEdgeInsetsMake(0, 12, 0, 6)]
forState:UIControlStateHighlighted
barMetrics:UIBarMetricsDefault];
if (SYSTEM_RUNS_IN_THE_FUTURE)
backButton.tintColor = [UIColor whiteColor];
else {
[backButton setBackgroundImage:[[UIImage imageNamed:@"backButton"] resizableImageWithCapInsets:UIEdgeInsetsMake(0, 12, 0, 6)]
forState:UIControlStateNormal
barMetrics:UIBarMetricsDefault];
[backButton setBackgroundImage:[[UIImage imageNamed:@"backButtonHighlight"] resizableImageWithCapInsets:UIEdgeInsetsMake(0, 12, 0, 6)]
forState:UIControlStateHighlighted
barMetrics:UIBarMetricsDefault];
}
[backButton setTitleTextAttributes:@{UITextAttributeTextShadowColor : [UIColor colorWithWhite:0. alpha:.37], UITextAttributeTextColor : [UIColor whiteColor]} forState:UIControlStateNormal];
[backButton setTitlePositionAdjustment:UIOffsetMake(3, 0) forBarMetrics:UIBarMetricsDefault];
return backButton;
......@@ -48,8 +56,12 @@
+ (UIBarButtonItem *)themedRevealMenuButtonWithTarget:(id)target andSelector:(SEL)selector
{
UIBarButtonItem *menuButton = [[UIBarButtonItem alloc] initWithImage:[UIImage imageNamed:@"menuCone"] style:UIBarButtonItemStyleBordered target:target action:selector];
[menuButton setBackgroundImage:[UIImage imageNamed:@"button"] forState:UIControlStateNormal barMetrics:UIBarMetricsDefault];
[menuButton setBackgroundImage:[UIImage imageNamed:@"buttonHighlight"] forState:UIControlStateHighlighted barMetrics:UIBarMetricsDefault];
if (SYSTEM_RUNS_IN_THE_FUTURE)
menuButton.tintColor = [UIColor whiteColor];
else {
[menuButton setBackgroundImage:[UIImage imageNamed:@"button"] forState:UIControlStateNormal barMetrics:UIBarMetricsDefault];
[menuButton setBackgroundImage:[UIImage imageNamed:@"buttonHighlight"] forState:UIControlStateHighlighted barMetrics:UIBarMetricsDefault];
}
menuButton.accessibilityLabel = NSLocalizedString(@"OPEN_VLC_MENU", @"");
menuButton.isAccessibilityElement = YES;
......
......@@ -18,6 +18,10 @@
#import "VLCConstants.h"
#define SYSTEM_VERSION_GREATER_THAN_OR_EQUAL_TO(v) ([[[UIDevice currentDevice] systemVersion] compare:v options:NSNumericSearch] != NSOrderedAscending)
#define SYSTEM_RUNS_IN_THE_FUTURE SYSTEM_VERSION_GREATER_THAN_OR_EQUAL_TO(@"7.0")
#ifndef NDEBUG
#define APLog(format, ...) NSLog(format, ## __VA_ARGS__)
#else
......
......@@ -21,8 +21,12 @@
self.navigationItem.titleView = [[UIImageView alloc] initWithImage:[UIImage imageNamed:@"title"]];
UIBarButtonItem *contributeButton = [[UIBarButtonItem alloc] initWithTitle:NSLocalizedString(@"BUTTON_CONTRIBUTE",@"") style:UIBarButtonItemStyleBordered target:self action:@selector(openContributePage:)];
[contributeButton setBackgroundImage:[UIImage imageNamed:@"button"] forState:UIControlStateNormal barMetrics:UIBarMetricsDefault];
[contributeButton setBackgroundImage:[UIImage imageNamed:@"buttonHighlight"] forState:UIControlStateHighlighted barMetrics:UIBarMetricsDefault];
if (SYSTEM_RUNS_IN_THE_FUTURE)
contributeButton.tintColor = [UIColor whiteColor];
else {
[contributeButton setBackgroundImage:[UIImage imageNamed:@"button"] forState:UIControlStateNormal barMetrics:UIBarMetricsDefault];
[contributeButton setBackgroundImage:[UIImage imageNamed:@"buttonHighlight"] forState:UIControlStateHighlighted barMetrics:UIBarMetricsDefault];
}
self.navigationItem.rightBarButtonItem = contributeButton;
self.navigationItem.leftBarButtonItem = [UIBarButtonItem themedRevealMenuButtonWithTarget:self andSelector:@selector(goBack:)];
......
......@@ -72,10 +72,14 @@
self.navigationItem.leftBarButtonItem = _menuButton;
[self.editButtonItem setBackgroundImage:[UIImage imageNamed:@"button"]
forState:UIControlStateNormal barMetrics:UIBarMetricsDefault];
[self.editButtonItem setBackgroundImage:[UIImage imageNamed:@"buttonHighlight"]
forState:UIControlStateHighlighted barMetrics:UIBarMetricsDefault];
if (SYSTEM_RUNS_IN_THE_FUTURE)
self.editButtonItem.tintColor = [UIColor whiteColor];
else {
[self.editButtonItem setBackgroundImage:[UIImage imageNamed:@"button"]
forState:UIControlStateNormal barMetrics:UIBarMetricsDefault];
[self.editButtonItem setBackgroundImage:[UIImage imageNamed:@"buttonHighlight"]
forState:UIControlStateHighlighted barMetrics:UIBarMetricsDefault];
}
if (UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomPad) {
_gridView.separatorStyle = AQGridViewCellSeparatorStyleEmptySpace;
......@@ -391,11 +395,15 @@
UIBarButtonItem *editButton = self.editButtonItem;
NSString *editImage = editing? @"doneButton": @"button";
NSString *editImageHighlight = editing? @"doneButtonHighlight": @"buttonHighlight";
[editButton setBackgroundImage:[UIImage imageNamed:editImage] forState:UIControlStateNormal
barMetrics:UIBarMetricsDefault];
[editButton setBackgroundImage:[UIImage imageNamed:editImageHighlight]
forState:UIControlStateHighlighted barMetrics:UIBarMetricsDefault];
[editButton setTitleTextAttributes: editing ? @{UITextAttributeTextShadowColor : [UIColor whiteColor], UITextAttributeTextColor : [UIColor blackColor]} : @{UITextAttributeTextShadowColor : [UIColor colorWithWhite:0. alpha:.37], UITextAttributeTextColor : [UIColor whiteColor]} forState:UIControlStateNormal];
if (SYSTEM_RUNS_IN_THE_FUTURE)
editButton.tintColor = [UIColor whiteColor];
else {
[editButton setBackgroundImage:[UIImage imageNamed:editImage] forState:UIControlStateNormal
barMetrics:UIBarMetricsDefault];
[editButton setBackgroundImage:[UIImage imageNamed:editImageHighlight]
forState:UIControlStateHighlighted barMetrics:UIBarMetricsDefault];
[editButton setTitleTextAttributes: editing ? @{UITextAttributeTextShadowColor : [UIColor whiteColor], UITextAttributeTextColor : [UIColor blackColor]} : @{UITextAttributeTextShadowColor : [UIColor colorWithWhite:0. alpha:.37], UITextAttributeTextColor : [UIColor whiteColor]} forState:UIControlStateNormal];
}
if (UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomPad)
[self.gridView setEditing:editing];
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment