2
0
mirror of https://github.com/telegramdesktop/tdesktop synced 2025-08-31 06:26:18 +00:00

Support dialog rows with variable height.

This commit is contained in:
John Preston
2022-11-11 10:23:23 +04:00
parent 248337daf5
commit 37308cde21
26 changed files with 600 additions and 401 deletions

View File

@@ -143,9 +143,14 @@ void BasicRow::paintUserpic(
context.paused);
}
Row::Row(Key key, int pos) : _id(key), _pos(pos) {
Row::Row(Key key, int index, int top) : _id(key), _top(top), _index(index) {
if (const auto history = key.history()) {
updateCornerBadgeShown(history->peer);
_height = history->peer->isForum()
? st::forumDialogRow.height
: st::defaultDialogRow.height;
} else {
_height = st::forumTopicRow.height;
}
}
@@ -173,10 +178,11 @@ void Row::validateListEntryCache() const {
void Row::setCornerBadgeShown(
bool shown,
Fn<void()> updateCallback) const {
if (_cornerBadgeShown == shown) {
const auto value = shown ? 1 : 0;
if (_cornerBadgeShown == value) {
return;
}
_cornerBadgeShown = shown;
_cornerBadgeShown = value;
if (_cornerBadgeUserpic && _cornerBadgeUserpic->animation.animating()) {
_cornerBadgeUserpic->animation.change(
_cornerBadgeShown ? 1. : 0.,