mirror of
https://github.com/AyuGram/AyuGramDesktop.git
synced 2025-06-05 06:33:57 +02:00
Removed repeated animation from some settings lottie icons.
This commit is contained in:
parent
d16ccf0d9e
commit
3ff4bf77e7
4 changed files with 30 additions and 14 deletions
|
@ -162,13 +162,17 @@ void Blocked::setupContent() {
|
||||||
|
|
||||||
{
|
{
|
||||||
const auto content = emptyWrap->entity();
|
const auto content = emptyWrap->entity();
|
||||||
auto icon = CreateLottieIcon(content, {
|
auto icon = CreateLottieIcon(
|
||||||
.name = u"blocked_peers_empty"_q,
|
content,
|
||||||
.sizeOverride = {
|
{
|
||||||
st::changePhoneIconSize,
|
.name = u"blocked_peers_empty"_q,
|
||||||
st::changePhoneIconSize,
|
.sizeOverride = {
|
||||||
|
st::changePhoneIconSize,
|
||||||
|
st::changePhoneIconSize,
|
||||||
|
},
|
||||||
},
|
},
|
||||||
}, st::blockedUsersListIconPadding);
|
st::blockedUsersListIconPadding,
|
||||||
|
true);
|
||||||
content->add(std::move(icon.widget));
|
content->add(std::move(icon.widget));
|
||||||
|
|
||||||
_showFinished.events(
|
_showFinished.events(
|
||||||
|
|
|
@ -249,7 +249,8 @@ not_null<Ui::FlatLabel*> AddSubsectionTitle(
|
||||||
LottieIcon CreateLottieIcon(
|
LottieIcon CreateLottieIcon(
|
||||||
not_null<QWidget*> parent,
|
not_null<QWidget*> parent,
|
||||||
Lottie::IconDescriptor &&descriptor,
|
Lottie::IconDescriptor &&descriptor,
|
||||||
style::margins padding) {
|
style::margins padding,
|
||||||
|
bool playOnce) {
|
||||||
auto object = object_ptr<Ui::RpWidget>(parent);
|
auto object = object_ptr<Ui::RpWidget>(parent);
|
||||||
const auto raw = object.data();
|
const auto raw = object.data();
|
||||||
|
|
||||||
|
@ -262,8 +263,14 @@ LottieIcon CreateLottieIcon(
|
||||||
const auto icon = owned.get();
|
const auto icon = owned.get();
|
||||||
|
|
||||||
raw->lifetime().add([kept = std::move(owned)]{});
|
raw->lifetime().add([kept = std::move(owned)]{});
|
||||||
|
const auto animationRequired = raw->lifetime().make_state<bool>(true);
|
||||||
|
|
||||||
const auto animate = [=] {
|
const auto animate = [=] {
|
||||||
|
if (playOnce) {
|
||||||
|
if (!base::take(*animationRequired)) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
icon->animate([=] { raw->update(); }, 0, icon->framesCount() - 1);
|
icon->animate([=] { raw->update(); }, 0, icon->framesCount() - 1);
|
||||||
};
|
};
|
||||||
raw->paintRequest(
|
raw->paintRequest(
|
||||||
|
|
|
@ -185,7 +185,8 @@ struct LottieIcon {
|
||||||
[[nodiscard]] LottieIcon CreateLottieIcon(
|
[[nodiscard]] LottieIcon CreateLottieIcon(
|
||||||
not_null<QWidget*> parent,
|
not_null<QWidget*> parent,
|
||||||
Lottie::IconDescriptor &&descriptor,
|
Lottie::IconDescriptor &&descriptor,
|
||||||
style::margins padding = {});
|
style::margins padding = {},
|
||||||
|
bool playOnce = false);
|
||||||
|
|
||||||
void FillMenu(
|
void FillMenu(
|
||||||
not_null<Window::SessionController*> controller,
|
not_null<Window::SessionController*> controller,
|
||||||
|
|
|
@ -604,13 +604,17 @@ QPointer<Ui::RpWidget> Folders::createPinnedToTop(not_null<QWidget*> parent) {
|
||||||
const auto divider = Ui::CreateChild<Ui::BoxContentDivider>(parent.get());
|
const auto divider = Ui::CreateChild<Ui::BoxContentDivider>(parent.get());
|
||||||
const auto verticalLayout = Ui::CreateChild<Ui::VerticalLayout>(divider);
|
const auto verticalLayout = Ui::CreateChild<Ui::VerticalLayout>(divider);
|
||||||
|
|
||||||
auto icon = CreateLottieIcon(this, {
|
auto icon = CreateLottieIcon(
|
||||||
.name = u"filters"_q,
|
this,
|
||||||
.sizeOverride = {
|
{
|
||||||
st::settingsFilterIconSize,
|
.name = u"filters"_q,
|
||||||
st::settingsFilterIconSize,
|
.sizeOverride = {
|
||||||
|
st::settingsFilterIconSize,
|
||||||
|
st::settingsFilterIconSize,
|
||||||
|
},
|
||||||
},
|
},
|
||||||
}, st::settingsFilterIconPadding);
|
st::settingsFilterIconPadding,
|
||||||
|
true);
|
||||||
_showFinished.events(
|
_showFinished.events(
|
||||||
) | rpl::start_with_next([animate = std::move(icon.animate)] {
|
) | rpl::start_with_next([animate = std::move(icon.animate)] {
|
||||||
animate();
|
animate();
|
||||||
|
|
Loading…
Add table
Reference in a new issue