Merge "[apps/graph/list] keep the function of interest selected when going forth and back to the parameter page"

This commit is contained in:
Émilie Feral
2016-09-26 14:17:02 +02:00
committed by Gerrit
2 changed files with 14 additions and 1 deletions

View File

@@ -12,7 +12,6 @@ ListController::ListController(Responder * parentResponder, Graph::FunctionStore
}
View * ListController::view() {
setActiveCell(0);
return &m_tableView;
}
@@ -37,6 +36,19 @@ void ListController::setActiveCell(int index) {
app()->setFirstResponder(cell);
}
void ListController::didBecomeFirstResponder() {
if (m_activeCell == -1) {
setActiveCell(0);
} else {
if (m_activeCell < m_functionStore->numberOfFunctions()) {
setActiveCell(m_activeCell);
} else {
setActiveCell(m_functionStore->numberOfFunctions()-1);
}
}
assert(m_activeCell >= 0);
}
void ListController::configureFunction(Graph::Function * function) {
StackViewController * stack = ((StackViewController *)parentResponder());
m_parameterController.setFunction(function);

View File

@@ -15,6 +15,7 @@ public:
View * view() override;
const char * title() const override;
bool handleEvent(Ion::Events::Event event) override;
void didBecomeFirstResponder() override;
int numberOfCells() override;
void willDisplayCellForIndex(View * cell, int index) override;