Commit 764f1850 authored by Rohit Rao's avatar Rohit Rao Committed by Commit Bot

[ios] Change text color to black when editing bookmarks fields.

BUG=855320

Cq-Include-Trybots: luci.chromium.try:ios-simulator-full-configs;master.tryserver.chromium.mac:ios-simulator-cronet
Change-Id: I4fb596298e417795877400a94fc7d80349c80673
Reviewed-on: https://chromium-review.googlesource.com/1186701Reviewed-by: default avatarSergio Collazos <sczs@chromium.org>
Commit-Queue: Rohit Rao <rohitrao@chromium.org>
Cr-Commit-Position: refs/heads/master@{#585804}
parent 866afbed
......@@ -515,6 +515,14 @@ const CGFloat kEstimatedTableSectionFooterHeight = 40;
}
}
- (void)textFieldDidBeginEditing:(UITextField*)textField {
textField.textColor = [BookmarkTextFieldCell textColorForEditing:YES];
}
- (void)textFieldDidEndEditing:(UITextField*)textField {
textField.textColor = [BookmarkTextFieldCell textColorForEditing:NO];
}
- (BOOL)textFieldShouldReturn:(UITextField*)textField {
[textField resignFirstResponder];
return YES;
......
......@@ -387,6 +387,14 @@ folderEditorWithBookmarkModel:(bookmarks::BookmarkModel*)bookmarkModel
[self updateSaveButtonState];
}
- (void)textFieldDidBeginEditing:(UITextField*)textField {
textField.textColor = [BookmarkTextFieldCell textColorForEditing:YES];
}
- (void)textFieldDidEndEditing:(UITextField*)textField {
textField.textColor = [BookmarkTextFieldCell textColorForEditing:NO];
}
- (BOOL)textFieldShouldReturn:(UITextField*)textField {
[textField resignFirstResponder];
return YES;
......
......@@ -42,6 +42,9 @@
// Text field to display the title or the URL of the bookmark node.
@property(nonatomic, strong) UITextField* textField;
// Returns the appropriate text color to use for the given |editing| state.
+ (UIColor*)textColorForEditing:(BOOL)editing;
@end
@interface LegacyBookmarkTextFieldCell : UITableViewCell
......
......@@ -112,7 +112,7 @@
self.textField = [[UITextField alloc] init];
self.textField.font = [UIFont preferredFontForTextStyle:UIFontTextStyleBody];
self.textField.adjustsFontForContentSizeCategory = YES;
self.textField.textColor = [UIColor lightGrayColor];
self.textField.textColor = [BookmarkTextFieldCell textColorForEditing:NO];
self.textField.clearButtonMode = UITextFieldViewModeWhileEditing;
self.textField.textAlignment = NSTextAlignmentRight;
[self.textField setContentHuggingPriority:UILayoutPriorityDefaultLow
......@@ -153,6 +153,10 @@
return self;
}
+ (UIColor*)textColorForEditing:(BOOL)editing {
return editing ? [UIColor blackColor] : [UIColor lightGrayColor];
}
- (void)prepareForReuse {
[super prepareForReuse];
[self.textField resignFirstResponder];
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment