Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 255eb84a authored by Sumit Pundir's avatar Sumit Pundir Committed by Nishith Khanna
Browse files

recovery: ui: rebrand logo and initial /e/ layout



* Included the grid layout icons too.

Signed-off-by: default avatarSumit Pundir <pundirsumit11@gmail.com>
Change-Id: I8bd8e8cb39387e234cd9ad40a99cf07e25e4fe88
parent 08f25047
Loading
Loading
Loading
Loading
+9 −3
Original line number Diff line number Diff line
@@ -882,13 +882,19 @@ Device::BuiltinAction start_recovery(Device* device, const std::vector<std::stri
    "Version " + android::base::GetProperty("ro.lineage.build.version", "(unknown)") +
        " (" + ver_date + ")",
  };
  
  title_lines.push_back("Product name - " + android::base::GetProperty("ro.product.device", ""));
  ui->SetTitle(title_lines);
  
  if (android::base::GetBoolProperty("ro.build.ab_update", false)) {
    std::string slot = android::base::GetProperty("ro.boot.slot_suffix", "");
    if (android::base::StartsWith(slot, "_")) slot.erase(0, 1);
    title_lines.push_back("Active slot: " + slot);
  }
  ui->SetTitle(title_lines);
    std::vector<std::string> active_slot = {
	"Active slot: " + slot,
    };

    ui->SetTitle(active_slot);
  };
  
  ui->ResetKeyInterruptStatus();
  device->StartRecovery();
+3 −2
Original line number Diff line number Diff line
@@ -465,7 +465,7 @@ class ScreenRecoveryUI : public RecoveryUI, public DrawInterface {
  std::unique_ptr<GRSurface> wipe_data_confirmation_text_;
  std::unique_ptr<GRSurface> wipe_data_menu_header_text_;

  std::unique_ptr<GRSurface> lineage_logo_;
  std::unique_ptr<GRSurface> e_logo_;
  std::unique_ptr<GRSurface> back_icon_;
  std::unique_ptr<GRSurface> back_icon_sel_;
  std::unique_ptr<GRSurface> fastbootd_logo_;
@@ -502,7 +502,8 @@ class ScreenRecoveryUI : public RecoveryUI, public DrawInterface {
  bool show_text;
  bool show_text_ever;  // has show_text ever been true?

  std::vector<std::string> title_lines_;
  std::vector<std::string> version_num_;
  std::vector<std::string> active_slot_;

  std::unique_ptr<Menu> menu_;
  int menu_start_y_;
+50 −33
Original line number Diff line number Diff line
@@ -519,7 +519,7 @@ void ScreenRecoveryUI::draw_background_locked() {
    const auto& text_surface = GetCurrentText();
    int text_x = (ScreenWidth() - gr_get_width(text_surface)) / 2;
    int text_y = GetTextBaseline();
    gr_color(255, 255, 255, 255);
    gr_color(0, 0, 0, 255);
    DrawTextIcon(text_x, text_y, text_surface);
  }
}
@@ -546,7 +546,7 @@ void ScreenRecoveryUI::draw_foreground_locked() {
    int progress_y = GetProgressBaseline();

    // Erase behind the progress bar (in case this was a progress-only update)
    gr_color(0, 0, 0, 255);
    gr_color(255, 255, 255, 0);
    DrawFill(progress_x, progress_y, width, height);

    if (progressBarType == DETERMINATE) {
@@ -576,8 +576,8 @@ void ScreenRecoveryUI::draw_foreground_locked() {
  }
}

/* recovery dark:  #7C4DFF
   recovery light: #F890FF
/* recovery dark:  #0883ff
   recovery light: #9ACD32
   fastbootd dark: #E65100
   fastboot light: #FDD835 */
void ScreenRecoveryUI::SetColor(UIElement e) const {
@@ -592,23 +592,23 @@ void ScreenRecoveryUI::SetColor(UIElement e) const {
      if (fastbootd_logo_enabled_)
        gr_color(0xfd, 0xd8, 0x35, 255);
      else
        gr_color(0xf8, 0x90, 0xff, 255);
        gr_color(0, 0, 0, 255);
      break;
    case UIElement::HEADER:
      if (fastbootd_logo_enabled_)
        gr_color(0xfd, 0xd8,0x35, 255);
      else
        gr_color(0xf8, 0x90, 0xff, 255);
        gr_color(154, 205, 50, 255);
      break;
    case UIElement::MENU:
      gr_color(0xd8, 0xd8, 0xd8, 255);
      gr_color(0, 0, 0, 255);
      break;
    case UIElement::MENU_SEL_BG:
    case UIElement::SCROLLBAR:
      if (fastbootd_logo_enabled_)
        gr_color(0xe6, 0x51, 0x00, 255);
      else
        gr_color(0x7c, 0x4d, 0xff, 255);
        gr_color(8, 131, 255, 255);
      break;
    case UIElement::MENU_SEL_BG_ACTIVE:
      gr_color(0, 156, 100, 255);
@@ -620,10 +620,10 @@ void ScreenRecoveryUI::SetColor(UIElement e) const {
        gr_color(0xd8, 0xd8, 0xd8, 255);
      break;
    case UIElement::LOG:
      gr_color(196, 196, 196, 255);
      gr_color(0, 0, 0, 255);
      break;
    case UIElement::TEXT_FILL:
      gr_color(0, 0, 0, 160);
      gr_color(0, 0, 0, 255);
      break;
    default:
      gr_color(255, 255, 255, 255);
@@ -672,7 +672,7 @@ void ScreenRecoveryUI::SelectAndShowBackgroundText(const std::vector<std::string
    text_y += line_spacing;
    SetColor(UIElement::LOG);
    text_y += DrawTextLine(text_x, text_y, p.first, false);
    gr_color(255, 255, 255, 255);
    gr_color(0, 0, 0, 255);
    gr_texticon(text_x, text_y, p.second.get());
    text_y += gr_get_height(p.second.get());
  }
@@ -794,7 +794,10 @@ int ScreenRecoveryUI::DrawWrappedTextLines(int x, int y,
}

void ScreenRecoveryUI::SetTitle(const std::vector<std::string>& lines) {
  title_lines_ = lines;
  if (version_num_.empty())
    version_num_ = lines;
  else
    active_slot_ = lines;
}

std::vector<std::string> ScreenRecoveryUI::GetMenuHelpMessage() const {
@@ -821,7 +824,7 @@ void ScreenRecoveryUI::draw_screen_locked() {
    return;
  }

  gr_color(0, 0, 0, 255);
  gr_color(255, 255, 255, 0);
  gr_clear();

  draw_menu_and_text_buffer_locked(GetMenuHelpMessage());
@@ -832,30 +835,47 @@ void ScreenRecoveryUI::draw_screen_locked() {
void ScreenRecoveryUI::draw_menu_and_text_buffer_locked(
    const std::vector<std::string>& help_message) {
  int y = margin_height_;
  int h_unit = gr_fb_width() / 9;
  int v_unit = gr_fb_height() / 16;

  y += v_unit/2;

  if (menu_) {
    auto& logo = fastbootd_logo_enabled_ ? fastbootd_logo_ : lineage_logo_;
    auto logo_width = gr_get_width(logo.get());
    auto logo_height = gr_get_height(logo.get());
    auto centered_x = ScreenWidth() / 2 - logo_width / 2;
    DrawSurface(logo.get(), 0, 0, logo_width, logo_height, centered_x, y);
    y += logo_height;

    if (!menu_->IsMain()) {
      auto icon_w = gr_get_width(back_icon_.get());
      auto icon_h = gr_get_height(back_icon_.get());
      auto icon_x = centered_x / 2 - icon_w / 2;
      auto icon_y = y - logo_height / 2 - icon_h / 2;
      auto icon_x = (h_unit / 2) + ((h_unit * 1) - icon_w) / 2;
      auto icon_y = y + ((v_unit * 1) - icon_h) / 2;
      gr_blit(back_icon_sel_ && menu_->selection() == -1 ? back_icon_sel_.get() : back_icon_.get(),
              0, 0, icon_w, icon_h, icon_x, icon_y);
    }

    y += v_unit * 2;

    auto& logo = fastbootd_logo_enabled_ ? fastbootd_logo_ : e_logo_;
    auto logo_width = gr_get_width(logo.get());
    auto logo_height = gr_get_height(logo.get());
    auto centered_x = ScreenWidth() / 2 - logo_width / 2;
    DrawSurface(logo.get(), 0, 0, logo_width, logo_height, centered_x, y);
    y += logo_height; 

    y += v_unit/4;
    int x = margin_width_ + kMenuIndent;
    if (!title_lines_.empty()) {
    if (!version_num_.empty()) {
      SetColor(UIElement::INFO);
      auto text_x = ScreenWidth() / 2 - (h_unit * 5) / 3;
      y += DrawTextLines(text_x, y, version_num_);
    }

    if (!active_slot_.empty()) {
      SetColor(UIElement::INFO);
      y += DrawTextLines(x, y, title_lines_);
      auto text_x = ScreenWidth() / 2 - gr_fb_width() / 8.5;
      y += DrawTextLines(text_x, y, active_slot_);
    }

    y += menu_->DrawHeader(x, y);
    
    menu_start_y_ = y + 12; // Skip horizontal rule and some margin
    menu_->SetMenuHeight(std::max(0, ScreenHeight() - menu_start_y_));
    y += menu_->DrawItems(x, y, ScreenWidth(), IsLongPress());
@@ -882,7 +902,7 @@ void ScreenRecoveryUI::draw_menu_and_text_buffer_locked(
// Draws the battery capacity on the screen. Should only be called with updateMutex locked.
void ScreenRecoveryUI::draw_battery_capacity_locked() {
  int x;
  int y = margin_height_ + gr_get_height(lineage_logo_.get());
  int y = margin_height_ + gr_get_height(e_logo_.get());
  int icon_x, icon_y, icon_h, icon_w;

  if (is_battery_less) return;
@@ -1188,14 +1208,12 @@ bool ScreenRecoveryUI::Init(const std::string& locale) {
  no_command_text_ = LoadLocalizedBitmap("no_command_text");
  error_text_ = LoadLocalizedBitmap("error_text");

  e_logo_ = LoadBitmap("logo_image_switch");
  back_icon_ = LoadBitmap("ic_back");
  back_icon_sel_ = LoadBitmap("ic_back_sel");
  if (android::base::GetBoolProperty("ro.boot.dynamic_partitions", false) ||
      android::base::GetBoolProperty("ro.fastbootd.available", false)) {
    lineage_logo_ = LoadBitmap("logo_image_switch");
    fastbootd_logo_ = LoadBitmap("fastbootd");
  } else {
    lineage_logo_ = LoadBitmap("logo_image");
  }

  // Background text for "installing_update" could be "installing update" or
@@ -1461,7 +1479,7 @@ std::unique_ptr<Menu> ScreenRecoveryUI::CreateMenu(
  size_t max_width = ScreenWidth() - margin_width_ - kMenuIndent;
  // vertical unusable area: margin height + title lines + helper message + high light bar.
  // It is safe to reserve more space.
  size_t max_height = ScreenHeight() - margin_height_ - char_height_ * (title_lines_.size() + 3);
  size_t max_height = ScreenHeight() - margin_height_ - char_height_ * (version_num_.size() + 3);
  if (GraphicMenu::Validate(max_width, max_height, graphic_header, graphic_items)) {
    return std::make_unique<GraphicMenu>(graphic_header, graphic_items, initial_selection, *this);
  }
@@ -1530,13 +1548,12 @@ int ScreenRecoveryUI::SelectMenu(const Point& p) {
  if (menu_) {
    if (!menu_->IsMain()) {
      // Back arrow hitbox
      const static int logo_width = gr_get_width(lineage_logo_.get());
      const static int logo_height = gr_get_height(lineage_logo_.get());
      const static int h_unit = gr_fb_width() / 9;
      const static int v_unit = gr_fb_height() / 16;
      const static int icon_w = gr_get_width(back_icon_.get());
      const static int icon_h = gr_get_height(back_icon_.get());
      const static int centered_x = ScreenWidth() / 2 - logo_width / 2;
      const static int icon_x = centered_x / 2 - icon_w / 2;
      const static int icon_y = margin_height_ + logo_height / 2 - icon_h / 2;
      const static int icon_x = (h_unit / 2) + ((h_unit * 1) - icon_w) / 2;
      const static int icon_y = (margin_height_ + v_unit/2) + ((v_unit * 1) - icon_h) / 2; 

      if (point.x() >= icon_x && point.x() <= icon_x + icon_w &&
          point.y() >= icon_y && point.y() <= icon_y + icon_h) {
+366 B (810 B)
Loading image diff...
+1.76 KiB
Loading image diff...
Loading