Commit a2af7137 authored by Javier Ernesto Flores Robles's avatar Javier Ernesto Flores Robles Committed by Commit Bot

[iOS][Alert] Create buttons with gray highlight

Adds a button that changes its background to gray when highlighted. This
is to be used in the buttons of the new AlertViewController.

Bug: 951358, 951300
Change-Id: Ib76fb1eef38f911de096781050b101997f091b70
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1578743Reviewed-by: default avatarMark Cogan <marq@chromium.org>
Reviewed-by: default avatarKurt Horimoto <kkhorimoto@chromium.org>
Commit-Queue: Javier Ernesto Flores Robles <javierrobles@chromium.org>
Auto-Submit: Javier Ernesto Flores Robles <javierrobles@chromium.org>
Cr-Commit-Position: refs/heads/master@{#653550}
parent be0f160e
...@@ -7,6 +7,8 @@ source_set("elements") { ...@@ -7,6 +7,8 @@ source_set("elements") {
sources = [ sources = [
"extended_touch_target_button.h", "extended_touch_target_button.h",
"extended_touch_target_button.mm", "extended_touch_target_button.mm",
"gray_highlight_button.h",
"gray_highlight_button.mm",
"selector_coordinator.h", "selector_coordinator.h",
"selector_coordinator.mm", "selector_coordinator.mm",
"selector_picker_presentation_controller.h", "selector_picker_presentation_controller.h",
......
// Copyright 2019 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#ifndef IOS_CHROME_BROWSER_UI_ELEMENTS_GRAY_HIGHLIGHT_BUTTON_H_
#define IOS_CHROME_BROWSER_UI_ELEMENTS_GRAY_HIGHLIGHT_BUTTON_H_
#import <UIKit/UIKit.h>
// A button that makes its background light gray when highlighted and clear
// when not. Also its text is not dimmed.
@interface GrayHighlightButton : UIButton
@end
#endif // IOS_CHROME_BROWSER_UI_ELEMENTS_GRAY_HIGHLIGHT_BUTTON_H_
// Copyright 2019 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#import "ios/chrome/browser/ui/elements/gray_highlight_button.h"
#if !defined(__has_feature) || !__has_feature(objc_arc)
#error "This file requires ARC support."
#endif
@implementation GrayHighlightButton
- (void)setHighlighted:(BOOL)highlighted {
[super setHighlighted:highlighted];
if (highlighted) {
self.backgroundColor = [UIColor colorWithWhite:235.0 / 255.0 alpha:1.0];
} else {
self.backgroundColor = [UIColor clearColor];
}
}
@end
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