Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(859)

Unified Diff: ios/chrome/browser/ui/qr_scanner/qr_scanner_view.mm

Issue 2709943002: Make the QR Code scanner caption fit on multiple lines. (Closed)
Patch Set: AC Created 3 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ios/chrome/browser/ui/qr_scanner/qr_scanner_view.mm
diff --git a/ios/chrome/browser/ui/qr_scanner/qr_scanner_view.mm b/ios/chrome/browser/ui/qr_scanner/qr_scanner_view.mm
index 2101964d24e869103647dbd2bad3b2520181af46..913f0b678a90768a08cd5c58e294015f6cee28fc 100644
--- a/ios/chrome/browser/ui/qr_scanner/qr_scanner_view.mm
+++ b/ios/chrome/browser/ui/qr_scanner/qr_scanner_view.mm
@@ -41,7 +41,9 @@ const CGFloat kViewportBorderShadowOpacity = 1.0;
// Shadow radius of the viewport border.
const CGFloat kViewportBorderShadowRadius = 10.0;
// Padding of the viewport caption, below the viewport.
-const CGFloat kViewportCaptionPadding = 24.0;
+const CGFloat kViewportCaptionVerticalPadding = 14.0;
+// Padding of the viewport caption from the edges of the superview.
+const CGFloat kViewportCaptionHorizontalPadding = 20.0;
// Shadow opacity of the viewport caption.
const CGFloat kViewportCaptionShadowOpacity = 1.0;
// Shadow radius of the viewport caption.
@@ -470,6 +472,8 @@ CGFloat GetViewportSize() {
UILabel* viewportCaption = [[[UILabel alloc] init] autorelease];
NSString* label = l10n_util::GetNSString(IDS_IOS_QR_SCANNER_VIEWPORT_CAPTION);
[viewportCaption setText:label];
+ [viewportCaption setNumberOfLines:0];
+ [viewportCaption setTextAlignment:NSTextAlignmentCenter];
[viewportCaption setAccessibilityLabel:label];
[viewportCaption setAccessibilityIdentifier:@"qr_scanner_viewport_caption"];
[viewportCaption setTextColor:[UIColor whiteColor]];
@@ -484,11 +488,16 @@ CGFloat GetViewportSize() {
// Constraints for viewportCaption.
[viewportCaption setTranslatesAutoresizingMaskIntoConstraints:NO];
[NSLayoutConstraint activateConstraints:@[
- [[viewportCaption centerXAnchor]
- constraintEqualToAnchor:[self centerXAnchor]],
- [[viewportCaption centerYAnchor]
+ [[viewportCaption topAnchor]
constraintEqualToAnchor:[self centerYAnchor]
- constant:GetViewportSize() / 2 + kViewportCaptionPadding]
+ constant:GetViewportSize() / 2 +
+ kViewportCaptionVerticalPadding],
+ [viewportCaption.leadingAnchor
+ constraintEqualToAnchor:self.leadingAnchor
+ constant:kViewportCaptionHorizontalPadding],
+ [viewportCaption.trailingAnchor
+ constraintEqualToAnchor:self.trailingAnchor
+ constant:-kViewportCaptionHorizontalPadding],
]];
}
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698