mirror of
https://github.com/AyuGram/AyuGramDesktop.git
synced 2025-04-16 14:17:12 +02:00
Added ability to recount height of dialog rows by chats filter id.
This commit is contained in:
parent
aea2d34080
commit
0d58b32914
4 changed files with 17 additions and 9 deletions
|
@ -408,7 +408,7 @@ bool InnerWidget::updateEntryHeight(not_null<Entry*> entry) {
|
|||
result.top = top;
|
||||
}
|
||||
if (result.row->key().entry() == entry) {
|
||||
result.row->recountHeight(_narrowRatio);
|
||||
result.row->recountHeight(_narrowRatio, _filterId);
|
||||
changing = true;
|
||||
top = result.top;
|
||||
}
|
||||
|
@ -2812,7 +2812,7 @@ void InnerWidget::applySearchState(SearchState state) {
|
|||
end(results));
|
||||
for (const auto e = end(_filterResults); i != e; ++i) {
|
||||
i->top = top;
|
||||
i->row->recountHeight(_narrowRatio);
|
||||
i->row->recountHeight(_narrowRatio, _filterId);
|
||||
top += i->row->height();
|
||||
}
|
||||
};
|
||||
|
@ -2885,7 +2885,7 @@ void InnerWidget::appendToFiltered(Key key) {
|
|||
}
|
||||
}
|
||||
auto row = std::make_unique<Row>(key, 0, 0);
|
||||
row->recountHeight(_narrowRatio);
|
||||
row->recountHeight(_narrowRatio, _filterId);
|
||||
const auto &[i, ok] = _filterResultsGlobal.emplace(key, std::move(row));
|
||||
const auto height = filteredHeight();
|
||||
_filterResults.emplace_back(i->second.get());
|
||||
|
|
|
@ -32,7 +32,7 @@ not_null<Row*> List::addToEnd(Key key) {
|
|||
key,
|
||||
std::make_unique<Row>(key, _rows.size(), height())
|
||||
).first->second.get();
|
||||
result->recountHeight(_narrowRatio);
|
||||
result->recountHeight(_narrowRatio, _filterId);
|
||||
_rows.emplace_back(result);
|
||||
if (_sortMode == SortMode::Date) {
|
||||
adjustByDate(result);
|
||||
|
@ -112,7 +112,7 @@ bool List::updateHeight(Key key, float64 narrowRatio) {
|
|||
const auto index = row->index();
|
||||
auto top = row->top();
|
||||
const auto was = row->height();
|
||||
row->recountHeight(narrowRatio);
|
||||
row->recountHeight(narrowRatio, _filterId);
|
||||
if (row->height() == was) {
|
||||
return false;
|
||||
}
|
||||
|
@ -129,7 +129,7 @@ bool List::updateHeights(float64 narrowRatio) {
|
|||
auto top = 0;
|
||||
for (const auto &row : _rows) {
|
||||
row->_top = top;
|
||||
row->recountHeight(narrowRatio);
|
||||
row->recountHeight(narrowRatio, _filterId);
|
||||
top += row->height();
|
||||
}
|
||||
return (height() != was);
|
||||
|
|
|
@ -316,11 +316,19 @@ Row::~Row() {
|
|||
clearTopicJumpRipple();
|
||||
}
|
||||
|
||||
void Row::recountHeight(float64 narrowRatio) {
|
||||
void Row::recountHeight(float64 narrowRatio, FilterId filterId) {
|
||||
if (const auto history = _id.history()) {
|
||||
const auto hasTags = _id.entry()->hasChatsFilterTags(filterId);
|
||||
_height = history->isForum()
|
||||
? anim::interpolate(
|
||||
st::forumDialogRow.height,
|
||||
hasTags
|
||||
? st::taggedForumDialogRow.height
|
||||
: st::forumDialogRow.height,
|
||||
st::defaultDialogRow.height,
|
||||
narrowRatio)
|
||||
: hasTags
|
||||
? anim::interpolate(
|
||||
st::taggedDialogRow.height,
|
||||
st::defaultDialogRow.height,
|
||||
narrowRatio)
|
||||
: st::defaultDialogRow.height;
|
||||
|
|
|
@ -94,7 +94,7 @@ public:
|
|||
|
||||
return _height;
|
||||
}
|
||||
void recountHeight(float64 narrowRatio);
|
||||
void recountHeight(float64 narrowRatio, FilterId filterId);
|
||||
|
||||
void updateCornerBadgeShown(
|
||||
not_null<PeerData*> peer,
|
||||
|
|
Loading…
Add table
Reference in a new issue