mirror of
https://github.com/UpsilonNumworks/Upsilon.git
synced 2026-01-19 00:37:25 +01:00
[apps/calculation] Additional outputs: Clean cells when the pop-up
disappears to avoid uselessly overloading the Poincare pool
This commit is contained in:
committed by
LeaNumworks
parent
94daf465c4
commit
99e88df284
@@ -24,6 +24,13 @@ int ExpressionsListController::reusableCellCount(int type) {
|
||||
return k_maxNumberOfCells;
|
||||
}
|
||||
|
||||
void ExpressionsListController::viewDidDisappear() {
|
||||
// Reset cell memoization to avoid taking extra space in the pool
|
||||
for (int i = 0; i < k_maxNumberOfCells; i++) {
|
||||
m_cells[i].setLayout(Layout());
|
||||
}
|
||||
}
|
||||
|
||||
HighlightCell * ExpressionsListController::reusableCell(int index, int type) {
|
||||
return &m_cells[index];
|
||||
}
|
||||
|
||||
@@ -13,6 +13,7 @@ public:
|
||||
ExpressionsListController(Responder * parentResponder, EditExpressionController * editExpressionController);
|
||||
|
||||
// Responder
|
||||
void viewDidDisappear() override;
|
||||
void didEnterResponderChain(Responder * previousFirstResponder) override;
|
||||
|
||||
//ListViewDataSource
|
||||
|
||||
@@ -42,6 +42,10 @@ void IllustratedListController::viewDidDisappear() {
|
||||
Poincare::Symbol s = Poincare::Symbol::Builder(expressionSymbol());
|
||||
context->setExpressionForSymbolAbstract(m_savedExpression, s);
|
||||
}
|
||||
// Reset cell memoization to avoid taking extra space in the pool
|
||||
for (int i = 0; i < k_maxNumberOfAdditionalCalculations; i++) {
|
||||
m_additionalCalculationCells[i].resetMemoization();
|
||||
}
|
||||
}
|
||||
|
||||
int IllustratedListController::numberOfRows() const {
|
||||
|
||||
@@ -4,11 +4,15 @@
|
||||
|
||||
namespace Calculation {
|
||||
|
||||
void ScrollableThreeExpressionsView::resetMemoization() {
|
||||
setLayouts(Poincare::Layout(), Poincare::Layout(), Poincare::Layout());
|
||||
}
|
||||
|
||||
void ScrollableThreeExpressionsView::setCalculation(Calculation * calculation) {
|
||||
Poincare::Context * context = App::app()->localContext();
|
||||
|
||||
// Clean the layouts to make room in the pool
|
||||
setLayouts(Poincare::Layout(), Poincare::Layout(), Poincare::Layout());
|
||||
resetMemoization();
|
||||
|
||||
// Create the input layout
|
||||
Poincare::Layout inputLayout = calculation->createInputLayout();
|
||||
|
||||
@@ -14,6 +14,7 @@ public:
|
||||
setMargins(Metric::CommonSmallMargin, Metric::CommonSmallMargin, Metric::CommonSmallMargin, Metric::CommonSmallMargin); // Left Right margins are already added by TableCell
|
||||
setBackgroundColor(KDColorWhite);
|
||||
}
|
||||
void resetMemoization();
|
||||
void setCalculation(Calculation * calculation);
|
||||
private:
|
||||
class ContentCell : public Shared::AbstractScrollableMultipleExpressionsView::ContentCell {
|
||||
@@ -50,6 +51,7 @@ public:
|
||||
View * labelView() const override { return (View *)&m_view; }
|
||||
|
||||
void setHighlighted(bool highlight) override { m_view.evenOddCell()->setHighlighted(highlight); }
|
||||
void resetMemoization() { m_view.resetMemoization(); }
|
||||
void setCalculation(Calculation * calculation);
|
||||
void setDisplayCenter(bool display);
|
||||
ScrollableThreeExpressionsView::SubviewPosition selectedSubviewPosition() { return m_view.selectedSubviewPosition(); }
|
||||
|
||||
Reference in New Issue
Block a user