From 3845a87f2ec11055cc887d438ede7912b781b42c Mon Sep 17 00:00:00 2001 From: 23rd <23rd@vivaldi.net> Date: Tue, 26 Mar 2024 18:56:00 +0300 Subject: [PATCH] Added fade animation to center label of slider in earn channel section. --- .../info/channel_statistics/earn/channel_earn.style | 1 + .../info/channel_statistics/earn/info_earn_inner_widget.cpp | 6 +++++- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/Telegram/SourceFiles/info/channel_statistics/earn/channel_earn.style b/Telegram/SourceFiles/info/channel_statistics/earn/channel_earn.style index c3007e16d..7f0815fc4 100644 --- a/Telegram/SourceFiles/info/channel_statistics/earn/channel_earn.style +++ b/Telegram/SourceFiles/info/channel_statistics/earn/channel_earn.style @@ -101,6 +101,7 @@ channelEarnBalanceMinorLabel: FlatLabel(channelEarnOverviewMinorLabel) { } } channelEarnBalanceMinorLabelSkip: 6px; +channelEarnFadeDuration: 60; channelEarnLearnDescription: FlatLabel(defaultFlatLabel) { maxHeight: 0px; diff --git a/Telegram/SourceFiles/info/channel_statistics/earn/info_earn_inner_widget.cpp b/Telegram/SourceFiles/info/channel_statistics/earn/info_earn_inner_widget.cpp index 90277d90a..0526f52bb 100644 --- a/Telegram/SourceFiles/info/channel_statistics/earn/info_earn_inner_widget.cpp +++ b/Telegram/SourceFiles/info/channel_statistics/earn/info_earn_inner_widget.cpp @@ -26,6 +26,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL #include "statistics/chart_widget.h" #include "ui/controls/userpic_button.h" #include "ui/effects/animation_value_f.h" +#include "ui/effects/fade_animation.h" #include "ui/layers/generic_box.h" #include "ui/painter.h" #include "ui/rect.h" @@ -852,6 +853,8 @@ void InnerWidget::fill() { const auto center = Ui::CreateChild( line, st::defaultFlatLabel); + const auto fade = lifetime().make_state(center); + fade->setUpdatedCallback([=](float64 o) { center->setOpacity(o); }); const auto right = Ui::CreateChild( line, st::defaultFlatLabel); @@ -902,8 +905,9 @@ void InnerWidget::fill() { EmojiCurrency(session), Ui::Text::RichLangValue), makeContext(center)); + fade->fadeIn(st::channelEarnFadeDuration); } else { - center->setText({}); + fade->fadeOut(st::channelEarnFadeDuration); } center->setTextColorOverride(activeColor);