From 8a6c06367e7d04736e9634c013b37cc7430af51e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=89milie=20Feral?= Date: Tue, 8 May 2018 11:37:46 +0200 Subject: [PATCH] [home] Fix number of rows instead of fixing number of columns --- apps/home/controller.cpp | 14 +++++++------- apps/home/controller.h | 3 +-- build/config.mak | 2 +- 3 files changed, 9 insertions(+), 10 deletions(-) diff --git a/apps/home/controller.cpp b/apps/home/controller.cpp index 0d614c6f5..2b4963953 100644 --- a/apps/home/controller.cpp +++ b/apps/home/controller.cpp @@ -53,7 +53,7 @@ Controller::Controller(Responder * parentResponder, ::AppsContainer * container, bool Controller::handleEvent(Ion::Events::Event event) { if (event == Ion::Events::OK || event == Ion::Events::EXE) { - m_container->switchTo(m_container->appSnapshotAtIndex(m_selectionDataSource->selectedRow()*k_numberOfColumns+m_selectionDataSource->selectedColumn()+1)); + m_container->switchTo(m_container->appSnapshotAtIndex(m_selectionDataSource->selectedColumn()*k_numberOfRows+m_selectionDataSource->selectedRow()+1)); return true; } @@ -81,11 +81,11 @@ View * Controller::view() { } int Controller::numberOfRows() { - return ((numberOfIcons()-1)/k_numberOfColumns)+1; + return k_numberOfRows; } int Controller::numberOfColumns() { - return k_numberOfColumns; + return ((numberOfIcons()-1)/k_numberOfRows)+1; } KDCoordinate Controller::cellHeight() { @@ -106,12 +106,12 @@ int Controller::reusableCellCount() { void Controller::willDisplayCellAtLocation(HighlightCell * cell, int i, int j) { AppCell * appCell = (AppCell *)cell; - int appIndex = (j*k_numberOfColumns+i)+1; + int appIndex = (i*k_numberOfRows+j)+1; if (appIndex >= m_container->numberOfApps()) { appCell->setVisible(false); } else { appCell->setVisible(true); - ::App::Descriptor * descriptor = m_container->appSnapshotAtIndex((j*k_numberOfColumns+i)+1)->descriptor(); + ::App::Descriptor * descriptor = m_container->appSnapshotAtIndex(appIndex)->descriptor(); appCell->setAppDescriptor(descriptor); } } @@ -130,7 +130,7 @@ void Controller::tableViewDidChangeSelection(SelectableTableView * t, int previo * redrawing takes time and is visible at scrolling. Here, we avoid the * background complete redrawing but the code is a bit * clumsy. */ - if (m_container->numberOfApps()%2 == 0 && t->selectedColumn() == k_numberOfColumns -1) { + if (m_container->numberOfApps()%2 == 0 && t->selectedColumn() == numberOfColumns() -1) { m_view.reloadBottomRightCorner(this); } /* To prevent the selectable table view to select cells that are unvisible, @@ -138,7 +138,7 @@ void Controller::tableViewDidChangeSelection(SelectableTableView * t, int previo * unvisible. This trick does not create an endless loop as we ensure not to * stay on a unvisible cell and to initialize the first cell on a visible one * (so the previous one is always visible). */ - int appIndex = (t->selectedRow()*k_numberOfColumns+t->selectedColumn())+1; + int appIndex = (t->selectedColumn()*k_numberOfRows+t->selectedRow())+1; if (appIndex >= m_container->numberOfApps()) { t->selectCellAtLocation(previousSelectedCellX, previousSelectedCellY); } diff --git a/apps/home/controller.h b/apps/home/controller.h index b9cf1284b..0d15f4e12 100644 --- a/apps/home/controller.h +++ b/apps/home/controller.h @@ -44,8 +44,7 @@ private: static constexpr KDCoordinate k_sideMargin = 4; static constexpr KDCoordinate k_indicatorThickness = 28; static constexpr KDCoordinate k_indicatorMargin = 116; - static constexpr int k_numberOfColumns = 4; - static constexpr int k_numberOfApps = 10; + static constexpr int k_numberOfRows = 2; static constexpr int k_maxNumberOfCells = 16; static constexpr int k_cellHeight = 98; static constexpr int k_cellWidth = 104; diff --git a/build/config.mak b/build/config.mak index 44b7f2dc1..5838d790f 100644 --- a/build/config.mak +++ b/build/config.mak @@ -6,7 +6,7 @@ DEBUG ?= 0 EPSILON_VERSION ?= 1.4.1 EPSILON_ONBOARDING_APP ?= 1 EPSILON_SOFTWARE_UPDATE_PROMPT ?= 1 -EPSILON_APPS ?= calculation graph sequence settings statistics probability regression code +EPSILON_APPS ?= calculation statistics graph probability sequence regression settings code EPSILON_I18N ?= en fr es de pt EPSILON_GETOPT ?= 0