Tao Bao | 337db14 | 2015-08-20 14:52:57 -0700 | [diff] [blame] | 1 | /* |
| 2 | * Copyright (C) 2014 The Android Open Source Project |
| 3 | * |
| 4 | * Licensed under the Apache License, Version 2.0 (the "License"); |
| 5 | * you may not use this file except in compliance with the License. |
| 6 | * You may obtain a copy of the License at |
| 7 | * |
| 8 | * http://www.apache.org/licenses/LICENSE-2.0 |
| 9 | * |
| 10 | * Unless required by applicable law or agreed to in writing, software |
| 11 | * distributed under the License is distributed on an "AS IS" BASIS, |
| 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 13 | * See the License for the specific language governing permissions and |
| 14 | * limitations under the License. |
| 15 | */ |
| 16 | |
| 17 | #ifndef RECOVERY_WEAR_UI_H |
| 18 | #define RECOVERY_WEAR_UI_H |
| 19 | |
Prashant Malani | 7d9fd96 | 2016-03-08 13:18:45 -0800 | [diff] [blame] | 20 | #include "screen_ui.h" |
Tao Bao | 337db14 | 2015-08-20 14:52:57 -0700 | [diff] [blame] | 21 | |
Tao Bao | 736d59c | 2017-01-03 10:15:33 -0800 | [diff] [blame] | 22 | #include <string> |
| 23 | |
Prashant Malani | 7d9fd96 | 2016-03-08 13:18:45 -0800 | [diff] [blame] | 24 | class WearRecoveryUI : public ScreenRecoveryUI { |
Tao Bao | 5d2e3bd | 2017-06-23 22:23:50 -0700 | [diff] [blame] | 25 | public: |
| 26 | WearRecoveryUI(); |
Tao Bao | 337db14 | 2015-08-20 14:52:57 -0700 | [diff] [blame] | 27 | |
Tao Bao | 5d2e3bd | 2017-06-23 22:23:50 -0700 | [diff] [blame] | 28 | bool Init(const std::string& locale) override; |
Prashant Malani | f7f9e50 | 2016-03-10 03:40:20 +0000 | [diff] [blame] | 29 | |
Tao Bao | 5d2e3bd | 2017-06-23 22:23:50 -0700 | [diff] [blame] | 30 | void SetStage(int current, int max) override; |
Tao Bao | 337db14 | 2015-08-20 14:52:57 -0700 | [diff] [blame] | 31 | |
Tao Bao | 5d2e3bd | 2017-06-23 22:23:50 -0700 | [diff] [blame] | 32 | // printing messages |
| 33 | void Print(const char* fmt, ...) override; |
| 34 | void PrintOnScreenOnly(const char* fmt, ...) override __printflike(2, 3); |
| 35 | void ShowFile(const char* filename) override; |
| 36 | void ShowFile(FILE* fp) override; |
Tao Bao | 337db14 | 2015-08-20 14:52:57 -0700 | [diff] [blame] | 37 | |
Tao Bao | 5d2e3bd | 2017-06-23 22:23:50 -0700 | [diff] [blame] | 38 | // menu display |
| 39 | void StartMenu(const char* const* headers, const char* const* items, |
| 40 | int initial_selection) override; |
| 41 | int SelectMenu(int sel) override; |
Tao Bao | 337db14 | 2015-08-20 14:52:57 -0700 | [diff] [blame] | 42 | |
Tao Bao | 5d2e3bd | 2017-06-23 22:23:50 -0700 | [diff] [blame] | 43 | protected: |
| 44 | // progress bar vertical position, it's centered horizontally |
Tao Bao | 0470cee | 2017-08-02 17:11:04 -0700 | [diff] [blame] | 45 | const int kProgressBarBaseline; |
Tao Bao | 337db14 | 2015-08-20 14:52:57 -0700 | [diff] [blame] | 46 | |
Tao Bao | 99b2d77 | 2017-06-23 22:47:03 -0700 | [diff] [blame] | 47 | // Unusable rows when displaying the recovery menu, including the lines for headers (Android |
| 48 | // Recovery, build id and etc) and the bottom lines that may otherwise go out of the screen. |
Tao Bao | eea3af3 | 2017-08-11 13:50:24 -0700 | [diff] [blame] | 49 | const int kMenuUnusableRows; |
Tao Bao | 337db14 | 2015-08-20 14:52:57 -0700 | [diff] [blame] | 50 | |
Tao Bao | 99b2d77 | 2017-06-23 22:47:03 -0700 | [diff] [blame] | 51 | int GetProgressBaseline() const override; |
Tao Bao | 337db14 | 2015-08-20 14:52:57 -0700 | [diff] [blame] | 52 | |
Tao Bao | 5d2e3bd | 2017-06-23 22:23:50 -0700 | [diff] [blame] | 53 | bool InitTextParams() override; |
Damien Bargiacchi | 5e7cfb9 | 2016-08-24 18:28:43 -0700 | [diff] [blame] | 54 | |
Tao Bao | 5d2e3bd | 2017-06-23 22:23:50 -0700 | [diff] [blame] | 55 | void update_progress_locked() override; |
Damien Bargiacchi | ad8b5a6 | 2016-09-09 08:18:06 -0700 | [diff] [blame] | 56 | |
Tao Bao | 5d2e3bd | 2017-06-23 22:23:50 -0700 | [diff] [blame] | 57 | void PrintV(const char*, bool, va_list) override; |
Tao Bao | b723f4f | 2015-12-11 15:18:51 -0800 | [diff] [blame] | 58 | |
Tao Bao | 5d2e3bd | 2017-06-23 22:23:50 -0700 | [diff] [blame] | 59 | private: |
| 60 | GRSurface* backgroundIcon[5]; |
Tao Bao | 337db14 | 2015-08-20 14:52:57 -0700 | [diff] [blame] | 61 | |
Tao Bao | 5d2e3bd | 2017-06-23 22:23:50 -0700 | [diff] [blame] | 62 | static const int kMaxCols = 96; |
| 63 | static const int kMaxRows = 96; |
Tao Bao | 337db14 | 2015-08-20 14:52:57 -0700 | [diff] [blame] | 64 | |
Tao Bao | 5d2e3bd | 2017-06-23 22:23:50 -0700 | [diff] [blame] | 65 | // Number of text rows seen on screen |
| 66 | int visible_text_rows; |
Tao Bao | 337db14 | 2015-08-20 14:52:57 -0700 | [diff] [blame] | 67 | |
Tao Bao | 5d2e3bd | 2017-06-23 22:23:50 -0700 | [diff] [blame] | 68 | const char* const* menu_headers_; |
| 69 | int menu_start, menu_end; |
Tao Bao | 337db14 | 2015-08-20 14:52:57 -0700 | [diff] [blame] | 70 | |
Tao Bao | 5d2e3bd | 2017-06-23 22:23:50 -0700 | [diff] [blame] | 71 | void draw_background_locked() override; |
| 72 | void draw_screen_locked() override; |
Damien Bargiacchi | 5e7cfb9 | 2016-08-24 18:28:43 -0700 | [diff] [blame] | 73 | |
Tao Bao | 5d2e3bd | 2017-06-23 22:23:50 -0700 | [diff] [blame] | 74 | void PutChar(char); |
Tao Bao | 337db14 | 2015-08-20 14:52:57 -0700 | [diff] [blame] | 75 | }; |
| 76 | |
| 77 | #endif // RECOVERY_WEAR_UI_H |