[apps/calculation] Fix HistoryController: update the OutputView when

reloading the table data
This commit is contained in:
Émilie Feral
2019-10-16 15:49:00 +02:00
committed by Léa Saviot
parent 904995f841
commit e932e8f895
2 changed files with 4 additions and 1 deletions

View File

@@ -26,6 +26,8 @@ void HistoryController::reload() {
*/
if (numberOfRows() > 0) {
m_selectableTableView.scrollToCell(0, numberOfRows()-1);
// Force to reload last added cell (hide the burger and exact output if necessary)
tableViewDidChangeSelection(&m_selectableTableView, 0, numberOfRows()-1);
}
}
@@ -135,6 +137,8 @@ void HistoryController::tableViewDidChangeSelection(SelectableTableView * t, int
setSelectedSubviewType(SubviewType::Output, previousSelectedCellX, previousSelectedCellY);
} else if (selectedRow() > previousSelectedCellY) {
setSelectedSubviewType(SubviewType::Input, previousSelectedCellX, previousSelectedCellY);
} else if (selectedRow() == -1) {
setSelectedSubviewType(SubviewType::Input, previousSelectedCellX, previousSelectedCellY);
}
HistoryViewCell * selectedCell = (HistoryViewCell *)(t->selectedCell());
if (selectedCell == nullptr) {

View File

@@ -165,7 +165,6 @@ void HistoryViewCell::setCalculation(Calculation * calculation) {
Poincare::Layout leftOutputLayout = calculation->createExactOutputLayout();
Poincare::Layout rightOutputLayout = (m_calculationDisplayOutput == Calculation::DisplayOutput::ExactOnly) ? leftOutputLayout :
calculation->createApproximateOutputLayout(context);
m_scrollableOutputView.setDisplayLeftLayout(m_calculationDisplayOutput == Calculation::DisplayOutput::ExactAndApproximate); // Must be before the setLayouts fo the reload
m_scrollableOutputView.setLayouts(rightOutputLayout, leftOutputLayout);
I18n::Message equalMessage = calculation->exactAndApproximateDisplayedOutputsAreEqual(context) == Calculation::EqualSign::Equal ? I18n::Message::Equal : I18n::Message::AlmostEqual;
m_scrollableOutputView.setEqualMessage(equalMessage);