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 20 #include <string> 21 #include <vector> 22 23 #include "screen_ui.h" 24 25 class WearRecoveryUI : public ScreenRecoveryUI { 26 public: 27 WearRecoveryUI(); 28 29 bool Init(const std::string& locale) override; 30 31 void SetStage(int current, int max) override; 32 33 protected: 34 // curved progress bar frames for round screens 35 std::vector<std::unique_ptr<GRSurface>> progress_frames_; 36 std::vector<std::unique_ptr<GRSurface>> rtl_progress_frames_; 37 38 // progress bar vertical position, it's centered horizontally 39 const int progress_bar_baseline_; 40 41 // Unusable rows when displaying the recovery menu, including the lines for headers (Android 42 // Recovery, build id and etc) and the bottom lines that may otherwise go out of the screen. 43 const int menu_unusable_rows_; 44 45 const bool is_screen_circle_; 46 47 std::unique_ptr<Menu> CreateMenu(const std::vector<std::string>& text_headers, 48 const std::vector<std::string>& text_items, 49 size_t initial_selection) const override; 50 51 int GetProgressBaseline() const override; 52 53 int GetTextBaseline() const override; 54 55 void update_progress_locked() override; 56 57 void LoadAnimation() override; 58 59 bool IsWearable() override; 60 61 void SetProgress(float fraction) override; 62 63 private: 64 void draw_background_locked() override; 65 void draw_screen_locked() override; 66 void draw_circle_foreground_locked(); 67 size_t GetProgressFrameIndex(float fraction) const; 68 69 }; 70 71 #endif // RECOVERY_WEAR_UI_H 72