constexpr int kDefaultProgressBarBaseline = 259;
constexpr int kDefaultMenuUnusableRows = 9;
constexpr int kProgressBarVerticalOffsetDp = 72;
constexpr bool kDefaultIsScreenCircle = true;
WearRecoveryUI::WearRecoveryUI()
: ScreenRecoveryUI(true),
progress_bar_baseline_(android::base::GetIntProperty("ro.recovery.ui.progress_bar_baseline",
kDefaultProgressBarBaseline)),
menu_unusable_rows_(android::base::GetIntProperty("ro.recovery.ui.menu_unusable_rows",
kDefaultMenuUnusableRows)),
is_screen_circle_(android::base::GetBoolProperty("ro.recovery.ui.is_screen_circle",
kDefaultIsScreenCircle)) { // TODO: menu_unusable_rows_ should be computed based on the lines in draw_screen_locked().
touch_screen_allowed_ = true;
}
bool WearRecoveryUI::Init(const std::string& locale) { auto result = ScreenRecoveryUI::Init(locale); auto wrist_orientation_enabled =
android::base::GetBoolProperty("config.enable_wristorientation", false);
LOG(INFO) << "WearRecoveryUI::Init(): enable_wristorientation=" << wrist_orientation_enabled; if (wrist_orientation_enabled) {
InitWristOrientation();
} return result;
}
// Draw background frame on the screen. Does not flip pages. // Should only be called with updateMutex locked. // TODO merge drawing routines with screen_ui void WearRecoveryUI::draw_background_locked() {
pagesIdentical = false;
gr_color(0, 0, 0, 255);
gr_fill(0, 0, gr_fb_width(), gr_fb_height());
if (current_icon_ == ERROR) { constauto& frame = GetCurrentFrame(); int frame_width = gr_get_width(frame); int frame_height = gr_get_height(frame); int frame_x = (gr_fb_width() - frame_width) / 2; int frame_y = (gr_fb_height() - frame_height) / 2;
gr_blit(frame, 0, 0, frame_width, frame_height, frame_x, frame_y);
}
if (current_icon_ != NONE) { // Draw recovery text on screen centered constauto& text = GetCurrentText(); int text_x = (ScreenWidth() - gr_get_width(text)) / 2; int text_y = (ScreenHeight() - gr_get_height(text)) / 2;
gr_color(255, 255, 255, 255);
gr_texticon(text_x, text_y, text);
}
}
void WearRecoveryUI::draw_screen_locked() { if (!show_text) {
draw_background_locked(); if (is_screen_circle_) {
draw_circle_foreground_locked();
} else {
draw_foreground_locked();
} return;
}
SetColor(UIElement::TEXT_FILL);
gr_clear();
// clang-format off static std::vector<std::string> SWIPE_HELP = { "Swipe up/down to move.", "Swipe left/right to select.", "",
}; // clang-format on
draw_menu_and_text_buffer_locked(SWIPE_HELP);
}
void WearRecoveryUI::draw_circle_foreground_locked() { if (current_icon_ != NONE) { constauto& frame = GetCurrentFrame(); int frame_width = gr_get_width(frame); int frame_height = gr_get_height(frame); int frame_x = (ScreenWidth() - frame_width) / 2; int frame_y = GetAnimationBaseline();
DrawSurface(frame, 0, 0, frame_width, frame_height, frame_x, frame_y);
}
if (progressBarType == DETERMINATE) { constauto& first_progress_frame = rtl_locale_ ? rtl_progress_frames_[0].get()
:progress_frames_[0].get(); int width = gr_get_width(first_progress_frame); int height = gr_get_height(first_progress_frame);
int progress_x = (ScreenWidth() - width) / 2; int progress_y = GetProgressBaseline();
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.