OLD | NEW |
---|---|
1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #ifndef CHROME_BROWSER_CHROMEOS_DISPLAY_TOUCH_CALIBRATOR_TOUCH_CALIBRATOR_VIEW_H _ | 5 #ifndef CHROME_BROWSER_CHROMEOS_DISPLAY_TOUCH_CALIBRATOR_TOUCH_CALIBRATOR_VIEW_H _ |
6 #define CHROME_BROWSER_CHROMEOS_DISPLAY_TOUCH_CALIBRATOR_TOUCH_CALIBRATOR_VIEW_H _ | 6 #define CHROME_BROWSER_CHROMEOS_DISPLAY_TOUCH_CALIBRATOR_TOUCH_CALIBRATOR_VIEW_H _ |
7 | 7 |
8 #include "base/macros.h" | 8 #include "base/macros.h" |
9 #include "ui/display/display.h" | 9 #include "ui/display/display.h" |
10 #include "ui/gfx/animation/animation_delegate.h" | 10 #include "ui/gfx/animation/animation_delegate.h" |
11 #include "ui/views/view.h" | 11 #include "ui/views/view.h" |
12 | 12 |
13 namespace views { | 13 namespace views { |
14 class Label; | 14 class Label; |
15 class Widget; | 15 class Widget; |
16 } | 16 } |
17 | 17 |
18 namespace gfx { | 18 namespace gfx { |
19 class Animation; | 19 class Animation; |
20 class LinearAnimation; | 20 class LinearAnimation; |
21 } | 21 } |
22 | 22 |
23 namespace chromeos { | 23 namespace chromeos { |
24 | 24 |
25 class CircularThrobberView; | |
26 class HintBox; | |
27 | |
25 // An overlay view used during touch calibration. This view is responsible for | 28 // An overlay view used during touch calibration. This view is responsible for |
26 // all animations and UX during touch calibration on all displays currently | 29 // all animations and UX during touch calibration on all displays currently |
27 // active on the device. The view on the display being calibrated is the primary | 30 // active on the device. The view on the display being calibrated is the primary |
28 // touch calibration view. | 31 // touch calibration view. |
29 // |TouchCalibratorView| acts as a state machine and has an API to toggle its | 32 // |TouchCalibratorView| acts as a state machine and has an API to toggle its |
30 // state or get the current state. | 33 // state or get the current state. |
31 class TouchCalibratorView : public views::View, public gfx::AnimationDelegate { | 34 class TouchCalibratorView : public views::View, public gfx::AnimationDelegate { |
32 public: | 35 public: |
33 // Different states of |TouchCalibratorView| in order. | 36 // Different states of |TouchCalibratorView| in order. |
34 enum State { | 37 enum State { |
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
83 | 86 |
84 // Returns the current state of the view. | 87 // Returns the current state of the view. |
85 State state() { return state_; } | 88 State state() { return state_; } |
86 | 89 |
87 private: | 90 private: |
88 void InitViewContents(); | 91 void InitViewContents(); |
89 | 92 |
90 // The target display on which this view is rendered on. | 93 // The target display on which this view is rendered on. |
91 const display::Display display_; | 94 const display::Display display_; |
92 | 95 |
96 // Offset from the edge of the screens for the touch points. | |
97 const int touch_point_offset_; | |
98 | |
93 // True if this view is on the display that is being calibrated. | 99 // True if this view is on the display that is being calibrated. |
94 bool is_primary_view_ = false; | 100 bool is_primary_view_ = false; |
95 | 101 |
96 std::unique_ptr<views::Widget> widget_; | 102 std::unique_ptr<views::Widget> widget_; |
97 | 103 |
98 SkPaint paint_; | 104 SkPaint paint_; |
99 | 105 |
100 // Defines the bounds for the background animation. | 106 // Defines the bounds for the background animation. |
101 gfx::RectF background_rect_; | 107 gfx::RectF background_rect_; |
102 | 108 |
103 // Text label indicating how to exit the touch calibration. | 109 // Text label indicating how to exit the touch calibration. |
104 views::Label* exit_label_; | 110 views::Label* exit_label_; |
105 | 111 |
106 // Start and end opacity values used during the fade animation. This is set | 112 // Start and end opacity values used during the fade animation. This is set |
107 // before the animation begins. | 113 // before the animation begins. |
108 float start_opacity_value_; | 114 float start_opacity_value_; |
109 float end_opacity_value_; | 115 float end_opacity_value_; |
110 | 116 |
111 // Linear animation used for various aniations including fade-in, fade out, | 117 // Linear animation used for various aniations including fade-in, fade out, |
112 // and view translation. | 118 // and view translation. |
113 std::unique_ptr<gfx::LinearAnimation> animator_; | 119 std::unique_ptr<gfx::LinearAnimation> animator_; |
114 | 120 |
121 // View responsible for displaying the animated circular icon that the user | |
122 // touches to calibrate the screen. | |
123 CircularThrobberView* throbber_circle_; | |
124 | |
125 // A hint box displayed next to the first touch point to assist user with | |
126 // information about the next step. | |
127 HintBox* hint_box_view_; | |
oshima
2017/01/05 23:29:04
looks like these views can also be just views::Vie
malaykeshav
2017/01/09 18:59:41
I need a rounded rectangle for the hint box. Would
oshima
2017/01/09 19:44:16
You can do that when you create the view, not late
malaykeshav
2017/01/09 22:29:57
Done
| |
128 | |
129 // View that contains the animated throbber circle and a text label informing | |
130 // the user to tap the circle to continue calibration. | |
131 views::View* touch_point_view_; | |
132 | |
115 State state_ = UNKNOWN; | 133 State state_ = UNKNOWN; |
116 | 134 |
117 DISALLOW_COPY_AND_ASSIGN(TouchCalibratorView); | 135 DISALLOW_COPY_AND_ASSIGN(TouchCalibratorView); |
118 }; | 136 }; |
119 | 137 |
120 } // namespace chromeos | 138 } // namespace chromeos |
121 | 139 |
122 #endif // CHROME_BROWSER_CHROMEOS_DISPLAY_TOUCH_CALIBRATOR_TOUCH_CALIBRATOR_VIE W_H_ | 140 #endif // CHROME_BROWSER_CHROMEOS_DISPLAY_TOUCH_CALIBRATOR_TOUCH_CALIBRATOR_VIE W_H_ |
OLD | NEW |