forked from organicmaps/organicmaps
Clang-format.
This commit is contained in:
parent
5411f68eaa
commit
68f5e9b963
8 changed files with 101 additions and 124 deletions
|
@ -1,6 +1,6 @@
|
|||
#import "MWMOpeningHoursClosedSpanTableViewCell.h"
|
||||
#import "UIFont+MapsMeFonts.h"
|
||||
#import "UIColor+MapsMeColor.h"
|
||||
#import "UIFont+MapsMeFonts.h"
|
||||
|
||||
static NSString * const kLabelText = L(@"editor_hours_closed");
|
||||
|
||||
|
@ -23,24 +23,20 @@ BOOL isCompactForCellWidth(CGFloat width)
|
|||
|
||||
@interface MWMOpeningHoursClosedSpanTableViewCell ()
|
||||
|
||||
@property (weak, nonatomic) IBOutlet UILabel * hoursClosedLabel;
|
||||
@property (weak, nonatomic) IBOutlet UILabel * timeSpanLabel;
|
||||
@property(weak, nonatomic) IBOutlet UILabel * hoursClosedLabel;
|
||||
@property(weak, nonatomic) IBOutlet UILabel * timeSpanLabel;
|
||||
|
||||
@property (weak, nonatomic) IBOutlet NSLayoutConstraint * timeSpanHorizontalAlignment;
|
||||
@property (weak, nonatomic) IBOutlet NSLayoutConstraint * timeSpanVerticalAlignment;
|
||||
@property (weak, nonatomic) IBOutlet NSLayoutConstraint * hoursClosedTrailing;
|
||||
@property(weak, nonatomic) IBOutlet NSLayoutConstraint * timeSpanHorizontalAlignment;
|
||||
@property(weak, nonatomic) IBOutlet NSLayoutConstraint * timeSpanVerticalAlignment;
|
||||
@property(weak, nonatomic) IBOutlet NSLayoutConstraint * hoursClosedTrailing;
|
||||
|
||||
@property (nonatomic) BOOL isCompact;
|
||||
@property(nonatomic) BOOL isCompact;
|
||||
|
||||
@end
|
||||
|
||||
@implementation MWMOpeningHoursClosedSpanTableViewCell
|
||||
|
||||
+ (CGFloat)heightForWidth:(CGFloat)width
|
||||
{
|
||||
return isCompactForCellWidth(width) ? 44.0 : 64.0;
|
||||
}
|
||||
|
||||
+ (CGFloat)heightForWidth:(CGFloat)width { return isCompactForCellWidth(width) ? 44.0 : 64.0; }
|
||||
- (void)awakeFromNib
|
||||
{
|
||||
[super awakeFromNib];
|
||||
|
@ -101,11 +97,7 @@ BOOL isCompactForCellWidth(CGFloat width)
|
|||
|
||||
#pragma mark - Actions
|
||||
|
||||
- (IBAction)cancelTap
|
||||
{
|
||||
[self.section removeClosedTime:self.row];
|
||||
}
|
||||
|
||||
- (IBAction)cancelTap { [self.section removeClosedTime:self.row]; }
|
||||
- (IBAction)expandTap
|
||||
{
|
||||
if (!self.isVisible)
|
||||
|
|
|
@ -1,29 +1,27 @@
|
|||
#import "Common.h"
|
||||
#import "MWMMapDownloaderPlaceTableViewCell.h"
|
||||
#import "Common.h"
|
||||
#import "UIFont+MapsMeFonts.h"
|
||||
|
||||
#include "Framework.h"
|
||||
|
||||
@interface MWMMapDownloaderTableViewCell ()
|
||||
|
||||
- (NSAttributedString *)matchedString:(NSString *)str selectedAttrs:(NSDictionary *)selectedAttrs unselectedAttrs:(NSDictionary *)unselectedAttrs;
|
||||
- (NSAttributedString *)matchedString:(NSString *)str
|
||||
selectedAttrs:(NSDictionary *)selectedAttrs
|
||||
unselectedAttrs:(NSDictionary *)unselectedAttrs;
|
||||
|
||||
@end
|
||||
|
||||
@interface MWMMapDownloaderPlaceTableViewCell ()
|
||||
|
||||
@property (weak, nonatomic) IBOutlet UILabel * descriptionLabel;
|
||||
@property (weak, nonatomic) IBOutlet NSLayoutConstraint * titleBottomOffset;
|
||||
@property(weak, nonatomic) IBOutlet UILabel * descriptionLabel;
|
||||
@property(weak, nonatomic) IBOutlet NSLayoutConstraint * titleBottomOffset;
|
||||
|
||||
@end
|
||||
|
||||
@implementation MWMMapDownloaderPlaceTableViewCell
|
||||
|
||||
+ (CGFloat)estimatedHeight
|
||||
{
|
||||
return 62.0;
|
||||
}
|
||||
|
||||
+ (CGFloat)estimatedHeight { return 62.0; }
|
||||
- (void)layoutSubviews
|
||||
{
|
||||
[super layoutSubviews];
|
||||
|
@ -40,8 +38,8 @@
|
|||
{
|
||||
[super config:nodeAttrs];
|
||||
BOOL isDescriptionVisible = NO;
|
||||
NSDictionary * const selectedAreaAttrs = @{ NSFontAttributeName : [UIFont bold12] };
|
||||
NSDictionary * const unselectedAreaAttrs = @{ NSFontAttributeName : [UIFont regular12] };
|
||||
NSDictionary * const selectedAreaAttrs = @{NSFontAttributeName : [UIFont bold12]};
|
||||
NSDictionary * const unselectedAreaAttrs = @{NSFontAttributeName : [UIFont regular12]};
|
||||
if (self.needDisplayArea && nodeAttrs.m_topmostParentInfo.size() == 1)
|
||||
{
|
||||
string const & areaName = nodeAttrs.m_topmostParentInfo[0].m_localName;
|
||||
|
@ -54,12 +52,14 @@
|
|||
else if (!nodeAttrs.m_nodeLocalDescription.empty())
|
||||
{
|
||||
isDescriptionVisible = YES;
|
||||
self.descriptionLabel.attributedText = [self matchedString:@(nodeAttrs.m_nodeLocalDescription.c_str())
|
||||
selectedAttrs:selectedAreaAttrs
|
||||
unselectedAttrs:unselectedAreaAttrs];
|
||||
self.descriptionLabel.attributedText =
|
||||
[self matchedString:@(nodeAttrs.m_nodeLocalDescription.c_str())
|
||||
selectedAttrs:selectedAreaAttrs
|
||||
unselectedAttrs:unselectedAreaAttrs];
|
||||
}
|
||||
self.descriptionLabel.hidden = !isDescriptionVisible;
|
||||
self.titleBottomOffset.priority = isDescriptionVisible ? UILayoutPriorityDefaultLow : UILayoutPriorityDefaultHigh;
|
||||
self.titleBottomOffset.priority =
|
||||
isDescriptionVisible ? UILayoutPriorityDefaultLow : UILayoutPriorityDefaultHigh;
|
||||
}
|
||||
|
||||
@end
|
||||
|
|
|
@ -1,26 +1,24 @@
|
|||
#import "Common.h"
|
||||
#import "MWMMapDownloaderSubplaceTableViewCell.h"
|
||||
#import "Common.h"
|
||||
#import "UIFont+MapsMeFonts.h"
|
||||
|
||||
@interface MWMMapDownloaderTableViewCell ()
|
||||
|
||||
- (NSAttributedString *)matchedString:(NSString *)str selectedAttrs:(NSDictionary *)selectedAttrs unselectedAttrs:(NSDictionary *)unselectedAttrs;
|
||||
- (NSAttributedString *)matchedString:(NSString *)str
|
||||
selectedAttrs:(NSDictionary *)selectedAttrs
|
||||
unselectedAttrs:(NSDictionary *)unselectedAttrs;
|
||||
|
||||
@end
|
||||
|
||||
@interface MWMMapDownloaderSubplaceTableViewCell ()
|
||||
|
||||
@property (weak, nonatomic) IBOutlet UILabel * subPlace;
|
||||
@property(weak, nonatomic) IBOutlet UILabel * subPlace;
|
||||
|
||||
@end
|
||||
|
||||
@implementation MWMMapDownloaderSubplaceTableViewCell
|
||||
|
||||
+ (CGFloat)estimatedHeight
|
||||
{
|
||||
return 82.0;
|
||||
}
|
||||
|
||||
+ (CGFloat)estimatedHeight { return 82.0; }
|
||||
- (void)layoutSubviews
|
||||
{
|
||||
[super layoutSubviews];
|
||||
|
@ -33,8 +31,8 @@
|
|||
|
||||
- (void)setSubplaceText:(NSString *)text
|
||||
{
|
||||
NSDictionary * const selectedSubPlaceAttrs = @{ NSFontAttributeName : [UIFont bold14] };
|
||||
NSDictionary * const unselectedSubPlaceAttrs = @{ NSFontAttributeName : [UIFont regular14] };
|
||||
NSDictionary * const selectedSubPlaceAttrs = @{NSFontAttributeName : [UIFont bold14]};
|
||||
NSDictionary * const unselectedSubPlaceAttrs = @{NSFontAttributeName : [UIFont regular14]};
|
||||
self.subPlace.attributedText = [self matchedString:text
|
||||
selectedAttrs:selectedSubPlaceAttrs
|
||||
unselectedAttrs:unselectedSubPlaceAttrs];
|
||||
|
|
|
@ -1,20 +1,20 @@
|
|||
#import "MWMMapDownloaderTableViewCell.h"
|
||||
#import "Common.h"
|
||||
#import "MWMCircularProgress.h"
|
||||
#import "MWMMapDownloaderLargeCountryTableViewCell.h"
|
||||
#import "MWMMapDownloaderTableViewCell.h"
|
||||
#import "NSString+Categories.h"
|
||||
#import "UIFont+MapsMeFonts.h"
|
||||
|
||||
#include "Framework.h"
|
||||
|
||||
@interface MWMMapDownloaderTableViewCell () <MWMCircularProgressProtocol>
|
||||
@interface MWMMapDownloaderTableViewCell ()<MWMCircularProgressProtocol>
|
||||
|
||||
@property (nonatomic) MWMCircularProgress * progress;
|
||||
@property (copy, nonatomic) NSString * searchQuery;
|
||||
@property(nonatomic) MWMCircularProgress * progress;
|
||||
@property(copy, nonatomic) NSString * searchQuery;
|
||||
|
||||
@property (weak, nonatomic) IBOutlet UIView * stateWrapper;
|
||||
@property (weak, nonatomic) IBOutlet UILabel * title;
|
||||
@property (weak, nonatomic) IBOutlet UILabel * downloadSize;
|
||||
@property(weak, nonatomic) IBOutlet UIView * stateWrapper;
|
||||
@property(weak, nonatomic) IBOutlet UILabel * title;
|
||||
@property(weak, nonatomic) IBOutlet UILabel * downloadSize;
|
||||
|
||||
@end
|
||||
|
||||
|
@ -23,11 +23,7 @@
|
|||
storage::TCountryId m_countryId;
|
||||
}
|
||||
|
||||
+ (CGFloat)estimatedHeight
|
||||
{
|
||||
return 52.0;
|
||||
}
|
||||
|
||||
+ (CGFloat)estimatedHeight { return 52.0; }
|
||||
- (void)awakeFromNib
|
||||
{
|
||||
[super awakeFromNib];
|
||||
|
@ -53,7 +49,9 @@
|
|||
|
||||
#pragma mark - Search matching
|
||||
|
||||
- (NSAttributedString *)matchedString:(NSString *)str selectedAttrs:(NSDictionary *)selectedAttrs unselectedAttrs:(NSDictionary *)unselectedAttrs
|
||||
- (NSAttributedString *)matchedString:(NSString *)str
|
||||
selectedAttrs:(NSDictionary *)selectedAttrs
|
||||
unselectedAttrs:(NSDictionary *)unselectedAttrs
|
||||
{
|
||||
NSMutableAttributedString * attrTitle = [[NSMutableAttributedString alloc] initWithString:str];
|
||||
[attrTitle addAttributes:unselectedAttrs range:{0, str.length}];
|
||||
|
@ -70,8 +68,8 @@
|
|||
{
|
||||
[self configProgress:nodeAttrs];
|
||||
|
||||
NSDictionary * const selectedTitleAttrs = @{ NSFontAttributeName : [UIFont bold17] };
|
||||
NSDictionary * const unselectedTitleAttrs = @{ NSFontAttributeName : [UIFont regular17] };
|
||||
NSDictionary * const selectedTitleAttrs = @{NSFontAttributeName : [UIFont bold17]};
|
||||
NSDictionary * const unselectedTitleAttrs = @{NSFontAttributeName : [UIFont regular17]};
|
||||
self.title.attributedText = [self matchedString:@(nodeAttrs.m_nodeLocalName.c_str())
|
||||
selectedAttrs:selectedTitleAttrs
|
||||
unselectedAttrs:unselectedTitleAttrs];
|
||||
|
@ -85,49 +83,42 @@
|
|||
- (void)configProgress:(storage::NodeAttrs const &)nodeAttrs
|
||||
{
|
||||
MWMCircularProgress * progress = self.progress;
|
||||
MWMButtonColoring const coloring = self.mode == mwm::DownloaderMode::Downloaded
|
||||
? MWMButtonColoringBlack
|
||||
: MWMButtonColoringBlue;
|
||||
MWMButtonColoring const coloring =
|
||||
self.mode == mwm::DownloaderMode::Downloaded ? MWMButtonColoringBlack : MWMButtonColoringBlue;
|
||||
switch (nodeAttrs.m_status)
|
||||
{
|
||||
case NodeStatus::NotDownloaded:
|
||||
case NodeStatus::Partly:
|
||||
{
|
||||
MWMCircularProgressStateVec const affectedStates = {MWMCircularProgressStateNormal,
|
||||
MWMCircularProgressStateSelected};
|
||||
UIImage * image = [self isKindOfClass:[MWMMapDownloaderLargeCountryTableViewCell class]]
|
||||
? [UIImage imageNamed:@"ic_folder"]
|
||||
: [UIImage imageNamed:@"ic_download"];
|
||||
[progress setImage:image forStates:affectedStates];
|
||||
[progress setColoring:coloring forStates:affectedStates];
|
||||
progress.state = MWMCircularProgressStateNormal;
|
||||
break;
|
||||
}
|
||||
case NodeStatus::Downloading:
|
||||
{
|
||||
auto const & prg = nodeAttrs.m_downloadingProgress;
|
||||
progress.progress = static_cast<CGFloat>(prg.first) / prg.second;
|
||||
break;
|
||||
}
|
||||
case NodeStatus::InQueue:
|
||||
progress.state = MWMCircularProgressStateSpinner;
|
||||
break;
|
||||
case NodeStatus::Undefined:
|
||||
case NodeStatus::Error:
|
||||
progress.state = MWMCircularProgressStateFailed;
|
||||
break;
|
||||
case NodeStatus::OnDisk:
|
||||
progress.state = MWMCircularProgressStateCompleted;
|
||||
break;
|
||||
case NodeStatus::OnDiskOutOfDate:
|
||||
{
|
||||
MWMCircularProgressStateVec const affectedStates = {MWMCircularProgressStateNormal,
|
||||
MWMCircularProgressStateSelected};
|
||||
[progress setImage:[UIImage imageNamed:@"ic_update"] forStates:affectedStates];
|
||||
[progress setColoring:MWMButtonColoringOther forStates:affectedStates];
|
||||
progress.state = MWMCircularProgressStateNormal;
|
||||
break;
|
||||
}
|
||||
case NodeStatus::NotDownloaded:
|
||||
case NodeStatus::Partly:
|
||||
{
|
||||
MWMCircularProgressStateVec const affectedStates = {MWMCircularProgressStateNormal,
|
||||
MWMCircularProgressStateSelected};
|
||||
UIImage * image = [self isKindOfClass:[MWMMapDownloaderLargeCountryTableViewCell class]]
|
||||
? [UIImage imageNamed:@"ic_folder"]
|
||||
: [UIImage imageNamed:@"ic_download"];
|
||||
[progress setImage:image forStates:affectedStates];
|
||||
[progress setColoring:coloring forStates:affectedStates];
|
||||
progress.state = MWMCircularProgressStateNormal;
|
||||
break;
|
||||
}
|
||||
case NodeStatus::Downloading:
|
||||
{
|
||||
auto const & prg = nodeAttrs.m_downloadingProgress;
|
||||
progress.progress = static_cast<CGFloat>(prg.first) / prg.second;
|
||||
break;
|
||||
}
|
||||
case NodeStatus::InQueue: progress.state = MWMCircularProgressStateSpinner; break;
|
||||
case NodeStatus::Undefined:
|
||||
case NodeStatus::Error: progress.state = MWMCircularProgressStateFailed; break;
|
||||
case NodeStatus::OnDisk: progress.state = MWMCircularProgressStateCompleted; break;
|
||||
case NodeStatus::OnDiskOutOfDate:
|
||||
{
|
||||
MWMCircularProgressStateVec const affectedStates = {MWMCircularProgressStateNormal,
|
||||
MWMCircularProgressStateSelected};
|
||||
[progress setImage:[UIImage imageNamed:@"ic_update"] forStates:affectedStates];
|
||||
[progress setColoring:MWMButtonColoringOther forStates:affectedStates];
|
||||
progress.state = MWMCircularProgressStateNormal;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -142,7 +133,8 @@
|
|||
[self config:nodeAttrs];
|
||||
}
|
||||
|
||||
- (void)processCountry:(TCountryId const &)countryId progress:(MapFilesDownloader::TProgress const &)progress
|
||||
- (void)processCountry:(TCountryId const &)countryId
|
||||
progress:(MapFilesDownloader::TProgress const &)progress
|
||||
{
|
||||
if (countryId != m_countryId)
|
||||
return;
|
||||
|
@ -157,26 +149,19 @@
|
|||
GetFramework().Storage().GetNodeAttrs(m_countryId, nodeAttrs);
|
||||
switch (nodeAttrs.m_status)
|
||||
{
|
||||
case NodeStatus::NotDownloaded:
|
||||
case NodeStatus::Partly:
|
||||
if ([self isKindOfClass:[MWMMapDownloaderLargeCountryTableViewCell class]])
|
||||
[self.delegate openNodeSubtree:m_countryId];
|
||||
else
|
||||
[self.delegate downloadNode:m_countryId];
|
||||
break;
|
||||
case NodeStatus::Undefined:
|
||||
case NodeStatus::Error:
|
||||
[self.delegate retryDownloadNode:m_countryId];
|
||||
break;
|
||||
case NodeStatus::OnDiskOutOfDate:
|
||||
[self.delegate updateNode:m_countryId];
|
||||
break;
|
||||
case NodeStatus::Downloading:
|
||||
case NodeStatus::InQueue:
|
||||
[self.delegate cancelNode:m_countryId];
|
||||
break;
|
||||
case NodeStatus::OnDisk:
|
||||
break;
|
||||
case NodeStatus::NotDownloaded:
|
||||
case NodeStatus::Partly:
|
||||
if ([self isKindOfClass:[MWMMapDownloaderLargeCountryTableViewCell class]])
|
||||
[self.delegate openNodeSubtree:m_countryId];
|
||||
else
|
||||
[self.delegate downloadNode:m_countryId];
|
||||
break;
|
||||
case NodeStatus::Undefined:
|
||||
case NodeStatus::Error: [self.delegate retryDownloadNode:m_countryId]; break;
|
||||
case NodeStatus::OnDiskOutOfDate: [self.delegate updateNode:m_countryId]; break;
|
||||
case NodeStatus::Downloading:
|
||||
case NodeStatus::InQueue: [self.delegate cancelNode:m_countryId]; break;
|
||||
case NodeStatus::OnDisk: break;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -22,11 +22,11 @@
|
|||
#import "MWMPageController.h"
|
||||
#import "MWMPlacePageEntity.h"
|
||||
#import "MWMRouter.h"
|
||||
#import "MWMRouterSavedState.h"
|
||||
#import "MWMStorage.h"
|
||||
#import "MWMTableViewController.h"
|
||||
#import "MWMWhatsNewNavigationController.h"
|
||||
#import "MapsAppDelegate.h"
|
||||
#import "MWMRouterSavedState.h"
|
||||
#import "Statistics.h"
|
||||
#import "UIColor+MapsMeColor.h"
|
||||
#import "UIFont+MapsMeFonts.h"
|
||||
|
|
|
@ -13,11 +13,11 @@
|
|||
#import "MWMFrameworkObservers.h"
|
||||
#import "MWMLocationManager.h"
|
||||
#import "MWMRouter.h"
|
||||
#import "MWMRouterSavedState.h"
|
||||
#import "MWMStorage.h"
|
||||
#import "MWMTextToSpeech.h"
|
||||
#import "MapViewController.h"
|
||||
#import "Preferences.h"
|
||||
#import "MWMRouterSavedState.h"
|
||||
#import "Statistics.h"
|
||||
#import "UIColor+MapsMeColor.h"
|
||||
#import "UIFont+MapsMeFonts.h"
|
||||
|
|
|
@ -6,12 +6,12 @@
|
|||
#import "MWMLocationManager.h"
|
||||
#import "MWMMapViewControlsManager.h"
|
||||
#import "MWMNavigationDashboardManager.h"
|
||||
#import "MWMRouterSavedState.h"
|
||||
#import "MWMSearch.h"
|
||||
#import "MWMStorage.h"
|
||||
#import "MWMTextToSpeech.h"
|
||||
#import "MapViewController.h"
|
||||
#import "MapsAppDelegate.h"
|
||||
#import "MWMRouterSavedState.h"
|
||||
#import "Statistics.h"
|
||||
|
||||
#include "Framework.h"
|
||||
|
|
|
@ -24,7 +24,8 @@ static NSString * const kETAKey = @"eta";
|
|||
if (self)
|
||||
{
|
||||
_forceStateChange = MWMRouterForceStateChange::None;
|
||||
NSDictionary * const stateDict = [NSDictionary dictionaryWithContentsOfURL:[MWMRouterSavedState stateFileURL]];
|
||||
NSDictionary * const stateDict =
|
||||
[NSDictionary dictionaryWithContentsOfURL:[MWMRouterSavedState stateFileURL]];
|
||||
if (stateDict)
|
||||
{
|
||||
m2::PointD point;
|
||||
|
@ -67,7 +68,8 @@ static NSString * const kETAKey = @"eta";
|
|||
|
||||
+ (NSURL *)stateFileURL
|
||||
{
|
||||
return [NSURL fileURLWithPath:[NSTemporaryDirectory() stringByAppendingPathComponent:@"route_info.ini"]];
|
||||
return [NSURL
|
||||
fileURLWithPath:[NSTemporaryDirectory() stringByAppendingPathComponent:@"route_info.ini"]];
|
||||
}
|
||||
|
||||
+ (void)restore
|
||||
|
|
Loading…
Add table
Reference in a new issue