diff --git a/apps/home/app_cell.cpp b/apps/home/app_cell.cpp index f42fc2f39..7edc72c99 100644 --- a/apps/home/app_cell.cpp +++ b/apps/home/app_cell.cpp @@ -20,15 +20,15 @@ View * AppCell::subviewAtIndex(int index) { } void AppCell::layoutSubviews() { - m_iconView.setFrame(KDRect(0,0,k_iconWidth,k_iconHeight)); - if (bounds().height() > k_iconHeight) { - m_nameView.setFrame(KDRect(0, k_iconHeight, bounds().width(), bounds().height()-k_iconHeight)); - } + m_iconView.setFrame(KDRect((bounds().width()-k_iconWidth)/2, 18, k_iconWidth,k_iconHeight)); + KDSize nameSize = m_nameView.minimalSizeForOptimalDisplay(); + m_nameView.setFrame(KDRect((bounds().width()-nameSize.width())/2-k_nameWidthMargin, bounds().height()-nameSize.height() - 2*k_nameHeightMargin, nameSize.width()+2*k_nameWidthMargin, nameSize.height()+2*k_nameHeightMargin)); } void AppCell::setApp(::App * app) { m_iconView.setImage(app->icon()); m_nameView.setText(app->name()); + layoutSubviews(); } void AppCell::setVisible(bool visible) { diff --git a/apps/home/app_cell.h b/apps/home/app_cell.h index 307e221eb..3e52e1434 100644 --- a/apps/home/app_cell.h +++ b/apps/home/app_cell.h @@ -19,6 +19,8 @@ public: private: static constexpr KDCoordinate k_iconWidth = 55; static constexpr KDCoordinate k_iconHeight = 56; + static constexpr KDCoordinate k_nameWidthMargin = 4; + static constexpr KDCoordinate k_nameHeightMargin = 2; ImageView m_iconView; PointerTextView m_nameView; bool m_visible; diff --git a/apps/home/controller.cpp b/apps/home/controller.cpp index 56341bf48..52173b5e8 100644 --- a/apps/home/controller.cpp +++ b/apps/home/controller.cpp @@ -43,11 +43,11 @@ int Controller::numberOfColumns() { } KDCoordinate Controller::cellHeight() { - return 98; + return k_cellHeight; } KDCoordinate Controller::cellWidth() { - return 104; + return k_cellWidth; } TableViewCell * Controller::reusableCell(int index) { diff --git a/apps/home/controller.h b/apps/home/controller.h index b1c0289c5..9c59e9e91 100644 --- a/apps/home/controller.h +++ b/apps/home/controller.h @@ -32,6 +32,8 @@ private: static constexpr int k_numberOfColumns = 3; static constexpr int k_numberOfApps = 10; static constexpr int k_maxNumberOfCells = 16; + static constexpr int k_cellHeight = 98; + static constexpr int k_cellWidth = 104; AppCell m_cells[k_maxNumberOfCells]; };