60 lines
2.1 KiB
Text
60 lines
2.1 KiB
Text
|
|
#import "MWMSearchCommonCell.h"
|
||
|
|
#import "CLLocation+Mercator.h"
|
||
|
|
#import "MWMLocationManager.h"
|
||
|
|
#import "SwiftBridge.h"
|
||
|
|
#import "SearchResult.h"
|
||
|
|
|
||
|
|
@interface MWMSearchCommonCell ()
|
||
|
|
|
||
|
|
@property(weak, nonatomic) IBOutlet UILabel * distanceLabel;
|
||
|
|
@property(weak, nonatomic) IBOutlet UILabel * infoLabel;
|
||
|
|
@property(weak, nonatomic) IBOutlet UILabel * locationLabel;
|
||
|
|
@property(weak, nonatomic) IBOutlet UILabel * openLabel;
|
||
|
|
@property(weak, nonatomic) IBOutlet UIView * popularView;
|
||
|
|
@property(weak, nonatomic) IBOutlet UIImageView * iconImageView;
|
||
|
|
|
||
|
|
@end
|
||
|
|
|
||
|
|
@implementation MWMSearchCommonCell
|
||
|
|
|
||
|
|
- (void)configureWith:(SearchResult * _Nonnull)result isPartialMatching:(BOOL)isPartialMatching {
|
||
|
|
[super configureWith:result isPartialMatching:isPartialMatching];
|
||
|
|
self.locationLabel.text = result.addressText;
|
||
|
|
[self.locationLabel sizeToFit];
|
||
|
|
self.infoLabel.text = result.infoText;
|
||
|
|
self.distanceLabel.text = result.distanceText;
|
||
|
|
self.distanceLabel.textColor = [UIColor.labelColor colorWithAlphaComponent:0.7];
|
||
|
|
self.popularView.hidden = YES;
|
||
|
|
self.openLabel.text = result.openStatusText;
|
||
|
|
self.openLabel.textColor = result.openStatusColor;
|
||
|
|
[self.openLabel setHidden:result.openStatusText.length == 0];
|
||
|
|
[self setStyleNameAndApply:@"Background"];
|
||
|
|
if (result.iconImageName != nil) {
|
||
|
|
self.iconImageView.image = [[UIImage imageNamed:result.iconImageName] imageWithTintColor:UIColor.white];
|
||
|
|
}
|
||
|
|
self.iconImageView.backgroundColor = [UIColor colorNamed:@"Base Colors/Blue Color"];
|
||
|
|
self.separatorInset = UIEdgeInsetsMake(0, kSearchCellSeparatorInset, 0, 0);
|
||
|
|
}
|
||
|
|
|
||
|
|
- (void)layoutSubviews {
|
||
|
|
[super layoutSubviews];
|
||
|
|
self.iconImageView.image = [self.iconImageView.image imageWithTintColor:UIColor.white];
|
||
|
|
[self.iconImageView.layer setCornerRadius:self.iconImageView.height / 2];
|
||
|
|
}
|
||
|
|
|
||
|
|
- (NSDictionary *)selectedTitleAttributes {
|
||
|
|
return @{
|
||
|
|
NSForegroundColorAttributeName : [UIColor black],
|
||
|
|
NSFontAttributeName : [UIFont bold17]
|
||
|
|
};
|
||
|
|
}
|
||
|
|
|
||
|
|
- (NSDictionary *)unselectedTitleAttributes {
|
||
|
|
return @{
|
||
|
|
NSForegroundColorAttributeName : [UIColor blackPrimaryText],
|
||
|
|
NSFontAttributeName : [UIFont medium17]
|
||
|
|
};
|
||
|
|
}
|
||
|
|
|
||
|
|
@end
|