diff --git a/Sources/FirstUsage/OAFirstUsageWizardController.mm b/Sources/FirstUsage/OAFirstUsageWizardController.mm index 4a9cfa02d5..ffacd03e91 100644 --- a/Sources/FirstUsage/OAFirstUsageWizardController.mm +++ b/Sources/FirstUsage/OAFirstUsageWizardController.mm @@ -165,7 +165,7 @@ - (void)viewDidLoad [_btnDownload setTitle:OALocalizedString(@"shared_string_download") forState:UIControlStateNormal]; // Init progress view - [_btnGoToMap setTitle:OALocalizedString(@"show_region_on_map_go") forState:UIControlStateNormal]; + [self setDownloadingButtonTitle:OALocalizedString(@"show_region_on_map_go")]; _bottomTextView.textContainerInset = UIEdgeInsetsZero; _bottomTextView.textContainer.lineFragmentPadding = 0; @@ -312,6 +312,13 @@ -(void)viewWillLayoutSubviews } } +- (void) setDownloadingButtonTitle:(NSString *)title +{ + NSMutableAttributedString *attributedTitle = [[NSMutableAttributedString alloc] initWithString:title]; + [attributedTitle addAttribute:NSFontAttributeName value:[UIFont monospacedFontAt:15 withTextStyle:UIFontTextStyleBody] range:NSMakeRange(0, attributedTitle.string.length)]; + [_btnGoToMap setAttributedTitle:attributedTitle forState:UIControlStateNormal]; +} + - (void)showCard:(UIView *)cardView { [self clearSubViews]; @@ -525,8 +532,7 @@ - (void) initWizard:(WizardType)wizardType OARepositoryResourceItem *item = _indexItems[0]; _lbMapName1.text = item.title; - [_btnGoToMap setTitle:[OALocalizedString(@"downloading") stringByAppendingFormat:@" %@", [NSByteCountFormatter stringFromByteCount:item.sizePkg countStyle:NSByteCountFormatterCountStyleFile]] forState:UIControlStateNormal]; - + [self setDownloadingButtonTitle:[OALocalizedString(@"downloading") stringByAppendingFormat:@" %@", [NSByteCountFormatter stringFromByteCount:item.sizePkg countStyle:NSByteCountFormatterCountStyleFile]]]; if (_mapDownloadCancelled) { _progress1.hidden = YES; @@ -901,7 +907,8 @@ - (void)onDownloadTaskProgressChanged:(id)observer withKey uint64_t size = _indexItems[0].size; float progress = [value floatValue]; NSString *progressStr = [OAResourcesUISwiftHelper formatedDownloadingProgressString:size progress:progress addZero:YES combineViaSlash:YES]; - [_btnGoToMap setTitle:[OALocalizedString(@"downloading") stringByAppendingFormat:@" %@", progressStr] forState:UIControlStateNormal]; + [self setDownloadingButtonTitle:[OALocalizedString(@"downloading") stringByAppendingFormat:@" %@", progressStr]]; + [_progress1 setProgress:[value floatValue]]; } }); @@ -919,7 +926,7 @@ - (void)onDownloadTaskFinished:(id)observer withKey:(id)ke if (_indexItems.count > 0) { - [_btnGoToMap setTitle:OALocalizedString(@"show_region_on_map_go") forState:UIControlStateNormal]; + [self setDownloadingButtonTitle:OALocalizedString(@"show_region_on_map_go")]; } if (task.progressCompleted < 1.0) diff --git a/Sources/SwiftExtensions/UIFont+Extension.swift b/Sources/SwiftExtensions/UIFont+Extension.swift index 6c13f774a4..c695184433 100644 --- a/Sources/SwiftExtensions/UIFont+Extension.swift +++ b/Sources/SwiftExtensions/UIFont+Extension.swift @@ -9,7 +9,7 @@ import Foundation extension UIFont { - static func monospacedFont(at size: CGFloat, withTextStyle style: TextStyle) -> UIFont { + @objc static func monospacedFont(at size: CGFloat, withTextStyle style: TextStyle) -> UIFont { let bodyFontDescriptor = UIFontDescriptor.preferredFontDescriptor(withTextStyle: style) let bodyMonospacedNumbersFontDescriptor = bodyFontDescriptor.addingAttributes( [ diff --git a/Sources/Views/OATargetPointView.mm b/Sources/Views/OATargetPointView.mm index fb268eab9d..a661c3bf8f 100644 --- a/Sources/Views/OATargetPointView.mm +++ b/Sources/Views/OATargetPointView.mm @@ -2401,6 +2401,7 @@ - (void) showProgressBar [_downloadProgressBar setProgress:0.]; _downloadProgressLabel.text = OALocalizedString(@"download_pending"); + _downloadProgressLabel.font = [UIFont monospacedFontAt:15 withTextStyle:UIFontTextStyleBody]; [self doLayoutSubviews:YES]; }