[apps/shared] Create static ints for cell types

This commit is contained in:
Léa Saviot
2018-05-21 10:33:04 +02:00
parent dfca5d8438
commit cb67aa535d
2 changed files with 6 additions and 4 deletions

View File

@@ -39,10 +39,10 @@ int StoreController::indexFromCumulatedWidth(KDCoordinate offsetX) {
HighlightCell * StoreController::reusableCell(int index, int type) {
assert(index >= 0);
switch (type) {
case 0:
case k_titleCellType:
assert(index < k_numberOfTitleCells);
return titleCells(index);
case 1:
case k_editableCellType:
assert(index < k_maxNumberOfEditableCells);
return m_editableCells[index];
default:
@@ -52,14 +52,14 @@ HighlightCell * StoreController::reusableCell(int index, int type) {
}
int StoreController::reusableCellCount(int type) {
if (type == 0) {
if (type == k_titleCellType) {
return k_numberOfTitleCells;
}
return k_maxNumberOfEditableCells;
}
int StoreController::typeAtLocation(int i, int j) {
return j!=0;
return j == 0 ? k_titleCellType : k_editableCellType;
}
void StoreController::willDisplayCellAtLocation(HighlightCell * cell, int i, int j) {

View File

@@ -26,6 +26,8 @@ protected:
static constexpr KDCoordinate k_cellWidth = Ion::Display::Width/2 - Metric::CommonRightMargin/2 - Metric::CommonLeftMargin/2;
constexpr static int k_maxNumberOfEditableCells = 22;
constexpr static int k_numberOfTitleCells = 2;
static constexpr int k_titleCellType = 0;
static constexpr int k_editableCellType = 1;
Responder * tabController() const override;
View * loadView() override;
void unloadView(View * view) override;