mirror of
https://github.com/AyuGram/AyuGramDesktop.git
synced 2025-06-05 06:33:57 +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;
|
result.top = top;
|
||||||
}
|
}
|
||||||
if (result.row->key().entry() == entry) {
|
if (result.row->key().entry() == entry) {
|
||||||
result.row->recountHeight(_narrowRatio);
|
result.row->recountHeight(_narrowRatio, _filterId);
|
||||||
changing = true;
|
changing = true;
|
||||||
top = result.top;
|
top = result.top;
|
||||||
}
|
}
|
||||||
|
@ -2812,7 +2812,7 @@ void InnerWidget::applySearchState(SearchState state) {
|
||||||
end(results));
|
end(results));
|
||||||
for (const auto e = end(_filterResults); i != e; ++i) {
|
for (const auto e = end(_filterResults); i != e; ++i) {
|
||||||
i->top = top;
|
i->top = top;
|
||||||
i->row->recountHeight(_narrowRatio);
|
i->row->recountHeight(_narrowRatio, _filterId);
|
||||||
top += i->row->height();
|
top += i->row->height();
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
@ -2885,7 +2885,7 @@ void InnerWidget::appendToFiltered(Key key) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
auto row = std::make_unique<Row>(key, 0, 0);
|
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 &[i, ok] = _filterResultsGlobal.emplace(key, std::move(row));
|
||||||
const auto height = filteredHeight();
|
const auto height = filteredHeight();
|
||||||
_filterResults.emplace_back(i->second.get());
|
_filterResults.emplace_back(i->second.get());
|
||||||
|
|
|
@ -32,7 +32,7 @@ not_null<Row*> List::addToEnd(Key key) {
|
||||||
key,
|
key,
|
||||||
std::make_unique<Row>(key, _rows.size(), height())
|
std::make_unique<Row>(key, _rows.size(), height())
|
||||||
).first->second.get();
|
).first->second.get();
|
||||||
result->recountHeight(_narrowRatio);
|
result->recountHeight(_narrowRatio, _filterId);
|
||||||
_rows.emplace_back(result);
|
_rows.emplace_back(result);
|
||||||
if (_sortMode == SortMode::Date) {
|
if (_sortMode == SortMode::Date) {
|
||||||
adjustByDate(result);
|
adjustByDate(result);
|
||||||
|
@ -112,7 +112,7 @@ bool List::updateHeight(Key key, float64 narrowRatio) {
|
||||||
const auto index = row->index();
|
const auto index = row->index();
|
||||||
auto top = row->top();
|
auto top = row->top();
|
||||||
const auto was = row->height();
|
const auto was = row->height();
|
||||||
row->recountHeight(narrowRatio);
|
row->recountHeight(narrowRatio, _filterId);
|
||||||
if (row->height() == was) {
|
if (row->height() == was) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
@ -129,7 +129,7 @@ bool List::updateHeights(float64 narrowRatio) {
|
||||||
auto top = 0;
|
auto top = 0;
|
||||||
for (const auto &row : _rows) {
|
for (const auto &row : _rows) {
|
||||||
row->_top = top;
|
row->_top = top;
|
||||||
row->recountHeight(narrowRatio);
|
row->recountHeight(narrowRatio, _filterId);
|
||||||
top += row->height();
|
top += row->height();
|
||||||
}
|
}
|
||||||
return (height() != was);
|
return (height() != was);
|
||||||
|
|
|
@ -316,11 +316,19 @@ Row::~Row() {
|
||||||
clearTopicJumpRipple();
|
clearTopicJumpRipple();
|
||||||
}
|
}
|
||||||
|
|
||||||
void Row::recountHeight(float64 narrowRatio) {
|
void Row::recountHeight(float64 narrowRatio, FilterId filterId) {
|
||||||
if (const auto history = _id.history()) {
|
if (const auto history = _id.history()) {
|
||||||
|
const auto hasTags = _id.entry()->hasChatsFilterTags(filterId);
|
||||||
_height = history->isForum()
|
_height = history->isForum()
|
||||||
? anim::interpolate(
|
? 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,
|
st::defaultDialogRow.height,
|
||||||
narrowRatio)
|
narrowRatio)
|
||||||
: st::defaultDialogRow.height;
|
: st::defaultDialogRow.height;
|
||||||
|
|
|
@ -94,7 +94,7 @@ public:
|
||||||
|
|
||||||
return _height;
|
return _height;
|
||||||
}
|
}
|
||||||
void recountHeight(float64 narrowRatio);
|
void recountHeight(float64 narrowRatio, FilterId filterId);
|
||||||
|
|
||||||
void updateCornerBadgeShown(
|
void updateCornerBadgeShown(
|
||||||
not_null<PeerData*> peer,
|
not_null<PeerData*> peer,
|
||||||
|
|
Loading…
Add table
Reference in a new issue