diff --git a/apps/sequence/sequence_title_cell.cpp b/apps/sequence/sequence_title_cell.cpp index f1802b10a..aeabfec6a 100644 --- a/apps/sequence/sequence_title_cell.cpp +++ b/apps/sequence/sequence_title_cell.cpp @@ -43,6 +43,16 @@ void SequenceTitleCell::setColor(KDColor color) { m_titleTextView.setTextColor(color); } +void SequenceTitleCell::reloadCell() { + /* When creating a new sequence, the layout has not yet been initialized, but + * it is needed in layoutSubview to compute the vertical alignment. */ + if (TreeNode::IsValidIdentifier(layout().identifier())) { + layoutSubviews(); + } + m_titleTextView.reloadCell(); + FunctionTitleCell::reloadCell(); +} + int SequenceTitleCell::numberOfSubviews() const { return 1; } @@ -53,6 +63,7 @@ View * SequenceTitleCell::subviewAtIndex(int index) { } void SequenceTitleCell::layoutSubviews(bool force) { + assert(TreeNode::IsValidIdentifier(layout().identifier())); if (m_orientation == Orientation::VerticalIndicator) { m_titleTextView.setAlignment(k_verticalOrientationHorizontalAlignment, verticalAlignment()); } diff --git a/apps/sequence/sequence_title_cell.h b/apps/sequence/sequence_title_cell.h index b858fe1a0..db5c7c209 100644 --- a/apps/sequence/sequence_title_cell.h +++ b/apps/sequence/sequence_title_cell.h @@ -20,6 +20,7 @@ public: Poincare::Layout layout() const override { return m_titleTextView.layout(); } + void reloadCell() override; private: static constexpr float k_horizontalOrientationAlignment = 0.5f; static constexpr float k_verticalOrientationHorizontalAlignment = 0.9f;