forked from organicmaps/organicmaps
[MAPSME-5820] [ios] Fixed day/night mode colorings.
This commit is contained in:
parent
6c37e0b75e
commit
3b7a3971b6
7 changed files with 113 additions and 38 deletions
|
@ -22,8 +22,12 @@ final class FilterCollectionHolderCell: MWMTableViewCell {
|
|||
self.tableView = tableView
|
||||
layout()
|
||||
collectionView.allowsMultipleSelection = true
|
||||
}
|
||||
|
||||
override func awakeFromNib() {
|
||||
super.awakeFromNib()
|
||||
isSeparatorHidden = true
|
||||
backgroundColor = UIColor.pressBackground()
|
||||
backgroundColor = UIColor.clear
|
||||
}
|
||||
|
||||
override func layoutSubviews() {
|
||||
|
|
|
@ -1,5 +1,15 @@
|
|||
@objc(MWMFilterPriceCategoryCell)
|
||||
final class FilterPriceCategoryCell: UITableViewCell {
|
||||
final class FilterPriceCategoryCell: MWMTableViewCell {
|
||||
|
||||
@IBOutlet private var priceButtons: [UIButton]! {
|
||||
didSet {
|
||||
priceButtons.map { $0.layer }.forEach {
|
||||
$0.cornerRadius = 4
|
||||
$0.borderWidth = 1
|
||||
$0.borderColor = UIColor.blackDividers().cgColor
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@IBOutlet weak var one: UIButton!
|
||||
@IBOutlet weak var two: UIButton!
|
||||
|
@ -7,5 +17,25 @@ final class FilterPriceCategoryCell: UITableViewCell {
|
|||
|
||||
@IBAction private func tap(sender: UIButton!) {
|
||||
sender.isSelected = !sender.isSelected
|
||||
|
||||
let priceCategory: String
|
||||
switch sender {
|
||||
case one: priceCategory = kStat1
|
||||
case two: priceCategory = kStat2
|
||||
case three: priceCategory = kStat3
|
||||
default:
|
||||
priceCategory = ""
|
||||
assert(false)
|
||||
}
|
||||
Statistics.logEvent(kStatSearchFilterClick, withParameters: [
|
||||
kStatCategory: kStatHotel,
|
||||
kStatPriceCategory: priceCategory,
|
||||
])
|
||||
}
|
||||
|
||||
override func awakeFromNib() {
|
||||
super.awakeFromNib()
|
||||
isSeparatorHidden = true
|
||||
backgroundColor = UIColor.clear
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,7 +1,15 @@
|
|||
@objc(MWMFilterRatingCell)
|
||||
final class FilterRatingCell: UITableViewCell {
|
||||
final class FilterRatingCell: MWMTableViewCell {
|
||||
@IBOutlet private var ratingButtons: [UIButton]! {
|
||||
didSet {
|
||||
ratingButtons.map { $0.layer }.forEach {
|
||||
$0.cornerRadius = 4
|
||||
$0.borderWidth = 1
|
||||
$0.borderColor = UIColor.blackDividers().cgColor
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@IBOutlet private var ratingButtons: [UIButton]!
|
||||
@IBOutlet weak var any: UIButton!
|
||||
@IBOutlet weak var good: UIButton!
|
||||
@IBOutlet weak var veryGood: UIButton!
|
||||
|
@ -12,5 +20,26 @@ final class FilterRatingCell: UITableViewCell {
|
|||
|
||||
ratingButtons.forEach { $0.isSelected = false }
|
||||
sender.isSelected = true
|
||||
|
||||
let rating: String
|
||||
switch sender {
|
||||
case any: rating = kStatAny
|
||||
case good: rating = kStat7
|
||||
case veryGood: rating = kStat8
|
||||
case excellent: rating = kStat9
|
||||
default:
|
||||
rating = ""
|
||||
assert(false)
|
||||
}
|
||||
Statistics.logEvent(kStatSearchFilterClick, withParameters: [
|
||||
kStatCategory: kStatHotel,
|
||||
kStatRating: rating,
|
||||
])
|
||||
}
|
||||
|
||||
override func awakeFromNib() {
|
||||
super.awakeFromNib()
|
||||
isSeparatorHidden = true
|
||||
backgroundColor = UIColor.clear
|
||||
}
|
||||
}
|
||||
|
|
|
@ -25,14 +25,14 @@ final class FilterTypeCell: UICollectionViewCell {
|
|||
|
||||
override var isSelected: Bool {
|
||||
didSet {
|
||||
backgroundColor = isSelected ? UIColor.linkBlue() : UIColor.pressBackground()
|
||||
backgroundColor = isSelected ? UIColor.linkBlue() : UIColor.white()
|
||||
tagName.textColor = isSelected ? UIColor.white() : UIColor.blackPrimaryText()
|
||||
}
|
||||
}
|
||||
|
||||
override var isHighlighted: Bool {
|
||||
didSet {
|
||||
backgroundColor = isHighlighted ? UIColor.linkBlueHighlighted() : UIColor.pressBackground()
|
||||
backgroundColor = isHighlighted ? UIColor.linkBlueHighlighted() : UIColor.white()
|
||||
tagName.textColor = isHighlighted ? UIColor.white() : UIColor.blackPrimaryText()
|
||||
}
|
||||
}
|
||||
|
|
|
@ -59,35 +59,38 @@ NSAttributedString * makeString(NSString * primaryText, NSDictionary * primaryAt
|
|||
|
||||
void configButton(UIButton * button, NSString * primaryText, NSString * secondaryText)
|
||||
{
|
||||
UIFont * regular17 = [UIFont regular17];
|
||||
UIFont * regular10 = [UIFont regular10];
|
||||
UIFont * primaryFont = [UIFont regular14];
|
||||
UIFont * secondaryFont = [UIFont medium10];
|
||||
|
||||
UIColor * white = [UIColor white];
|
||||
|
||||
UIImage * linkBlueImage = [UIImage imageWithColor:[UIColor linkBlue]];
|
||||
UIImage * linkBlueHighlightedImage = [UIImage imageWithColor:[UIColor linkBlueHighlighted]];
|
||||
|
||||
[button setBackgroundImage:[UIImage imageWithColor:white] forState:UIControlStateNormal];
|
||||
[button setBackgroundImage:linkBlueImage forState:UIControlStateSelected];
|
||||
[button setBackgroundImage:linkBlueImage
|
||||
[button setBackgroundImage:linkBlueHighlightedImage forState:UIControlStateHighlighted];
|
||||
[button setBackgroundImage:linkBlueHighlightedImage
|
||||
forState:UIControlStateSelected | UIControlStateHighlighted];
|
||||
|
||||
NSDictionary * primarySelected =
|
||||
@{NSFontAttributeName : regular17, NSForegroundColorAttributeName : white};
|
||||
@{NSFontAttributeName: primaryFont, NSForegroundColorAttributeName: white};
|
||||
NSDictionary * secondarySelected =
|
||||
@{NSFontAttributeName : regular10, NSForegroundColorAttributeName : white};
|
||||
@{NSFontAttributeName: secondaryFont, NSForegroundColorAttributeName: white};
|
||||
NSAttributedString * titleSelected =
|
||||
makeString(primaryText, primarySelected, secondaryText, secondarySelected);
|
||||
[button setAttributedTitle:titleSelected forState:UIControlStateSelected];
|
||||
[button setAttributedTitle:titleSelected forState:UIControlStateHighlighted];
|
||||
[button setAttributedTitle:titleSelected
|
||||
forState:UIControlStateSelected | UIControlStateHighlighted];
|
||||
|
||||
NSDictionary * primaryNormal = @{
|
||||
NSFontAttributeName : regular17,
|
||||
NSForegroundColorAttributeName : [UIColor blackPrimaryText]
|
||||
NSFontAttributeName: primaryFont,
|
||||
NSForegroundColorAttributeName: [UIColor blackPrimaryText]
|
||||
};
|
||||
NSDictionary * secondaryNormal = @{
|
||||
NSFontAttributeName : regular10,
|
||||
NSForegroundColorAttributeName : [UIColor blackSecondaryText]
|
||||
NSFontAttributeName: secondaryFont,
|
||||
NSForegroundColorAttributeName: [UIColor blackSecondaryText]
|
||||
};
|
||||
NSAttributedString * titleNormal =
|
||||
makeString(primaryText, primaryNormal, secondaryText, secondaryNormal);
|
||||
|
|
|
@ -40,56 +40,63 @@
|
|||
- (IBAction)clearFilter { [MWMSearch clearFilter]; }
|
||||
- (void)configNavigationBar:(UINavigationBar *)navBar
|
||||
{
|
||||
if (IPAD)
|
||||
{
|
||||
UIColor * white = [UIColor white];
|
||||
navBar.tintColor = white;
|
||||
navBar.barTintColor = white;
|
||||
navBar.translucent = NO;
|
||||
}
|
||||
navBar.titleTextAttributes = @{
|
||||
NSForegroundColorAttributeName : [UIColor blackPrimaryText],
|
||||
NSFontAttributeName : [UIFont regular17]
|
||||
NSForegroundColorAttributeName: IPAD ? [UIColor blackPrimaryText] : [UIColor whiteColor],
|
||||
NSFontAttributeName: [UIFont bold17]
|
||||
};
|
||||
navBar.translucent = NO;
|
||||
}
|
||||
|
||||
- (void)configNavigationItem:(UINavigationItem *)navItem
|
||||
{
|
||||
UIFont * regular17 = [UIFont regular17];
|
||||
UIFont * textFont = [UIFont regular17];
|
||||
|
||||
UIColor * linkBlue = [UIColor linkBlue];
|
||||
UIColor * linkBlueHighlighted = [UIColor linkBlueHighlighted];
|
||||
UIColor * lightGrayColor = [UIColor lightGrayColor];
|
||||
UIColor * normalStateColor = IPAD ? [UIColor linkBlue] : [UIColor whiteColor];
|
||||
UIColor * highlightedStateColor = IPAD ? [UIColor linkBlueHighlighted] : [UIColor whiteColor];
|
||||
UIColor * disabledStateColor = [UIColor lightGrayColor];
|
||||
|
||||
navItem.title = L(@"booking_filters");
|
||||
navItem.rightBarButtonItem =
|
||||
[[UIBarButtonItem alloc] initWithBarButtonSystemItem:UIBarButtonSystemItemDone
|
||||
target:self
|
||||
action:@selector(doneAction)];
|
||||
navItem.rightBarButtonItem = [[UIBarButtonItem alloc] initWithTitle:L(@"booking_filters_reset")
|
||||
style:UIBarButtonItemStylePlain
|
||||
target:self
|
||||
action:@selector(resetAction)];
|
||||
[navItem.rightBarButtonItem setTitleTextAttributes:@{
|
||||
NSForegroundColorAttributeName : linkBlue,
|
||||
NSFontAttributeName : regular17
|
||||
NSForegroundColorAttributeName: normalStateColor,
|
||||
NSFontAttributeName: textFont
|
||||
}
|
||||
forState:UIControlStateNormal];
|
||||
[navItem.rightBarButtonItem setTitleTextAttributes:@{
|
||||
NSForegroundColorAttributeName : linkBlueHighlighted,
|
||||
NSForegroundColorAttributeName: highlightedStateColor,
|
||||
}
|
||||
forState:UIControlStateHighlighted];
|
||||
[navItem.rightBarButtonItem setTitleTextAttributes:@{
|
||||
NSForegroundColorAttributeName : lightGrayColor,
|
||||
NSForegroundColorAttributeName: disabledStateColor,
|
||||
}
|
||||
forState:UIControlStateDisabled];
|
||||
|
||||
navItem.leftBarButtonItem = [[UIBarButtonItem alloc] initWithTitle:L(@"booking_filters_reset")
|
||||
style:UIBarButtonItemStylePlain
|
||||
target:self
|
||||
action:@selector(resetAction)];
|
||||
navItem.leftBarButtonItem =
|
||||
[[UIBarButtonItem alloc] initWithBarButtonSystemItem:UIBarButtonSystemItemCancel
|
||||
target:self
|
||||
action:@selector(closeAction)];
|
||||
|
||||
[navItem.leftBarButtonItem setTitleTextAttributes:@{
|
||||
NSForegroundColorAttributeName : linkBlue,
|
||||
NSFontAttributeName : regular17
|
||||
NSForegroundColorAttributeName: normalStateColor,
|
||||
NSFontAttributeName: textFont
|
||||
}
|
||||
forState:UIControlStateNormal];
|
||||
[navItem.leftBarButtonItem setTitleTextAttributes:@{
|
||||
NSForegroundColorAttributeName : linkBlueHighlighted,
|
||||
NSForegroundColorAttributeName: highlightedStateColor,
|
||||
}
|
||||
forState:UIControlStateHighlighted];
|
||||
|
||||
[navItem.leftBarButtonItem setTitleTextAttributes:@{
|
||||
NSForegroundColorAttributeName : lightGrayColor,
|
||||
NSForegroundColorAttributeName: disabledStateColor,
|
||||
}
|
||||
forState:UIControlStateDisabled];
|
||||
}
|
||||
|
|
|
@ -51,6 +51,8 @@
|
|||
}
|
||||
self.titleLabel.attributedText = attributedTitle;
|
||||
[self.titleLabel sizeToFit];
|
||||
|
||||
self.backgroundColor = [UIColor white];
|
||||
}
|
||||
|
||||
- (NSDictionary *)selectedTitleAttributes
|
||||
|
|
Loading…
Add table
Reference in a new issue