Removed first animation from radio button in premium graphics.

This commit is contained in:
23rd 2023-07-24 18:38:08 +03:00
parent 6d69a78a05
commit 3a472d1b90
3 changed files with 12 additions and 6 deletions

View file

@ -156,14 +156,15 @@ void GiftBox(
// List. // List.
const auto group = std::make_shared<Ui::RadiobuttonGroup>(); const auto group = std::make_shared<Ui::RadiobuttonGroup>();
group->setChangedCallback([=](int value) { const auto groupValueChangedCallback = [=](int value) {
Expects(value < options.size() && value >= 0); Expects(value < options.size() && value >= 0);
auto text = tr::lng_premium_gift_button( auto text = tr::lng_premium_gift_button(
tr::now, tr::now,
lt_cost, lt_cost,
options[value].costTotal); options[value].costTotal);
state->buttonText.fire(std::move(text)); state->buttonText.fire(std::move(text));
}); };
group->setChangedCallback(groupValueChangedCallback);
Ui::Premium::AddGiftOptions( Ui::Premium::AddGiftOptions(
buttonsParent, buttonsParent,
group, group,
@ -215,7 +216,7 @@ void GiftBox(
}); });
box->addButton(std::move(button)); box->addButton(std::move(button));
group->setValue(0); groupValueChangedCallback(0);
Data::PeerPremiumValue( Data::PeerPremiumValue(
user user

View file

@ -1653,7 +1653,7 @@ QPointer<Ui::RpWidget> Premium::createPinnedToBottom(
} else { } else {
#endif #endif
{ {
_radioGroup->setChangedCallback([=](int value) { const auto callback = [=](int value) {
const auto options = const auto options =
_controller->session().api().premium().subscriptionOptions(); _controller->session().api().premium().subscriptionOptions();
if (options.empty()) { if (options.empty()) {
@ -1665,8 +1665,9 @@ QPointer<Ui::RpWidget> Premium::createPinnedToBottom(
lt_cost, lt_cost,
options[value].costPerMonth); options[value].costPerMonth);
_buttonText = std::move(text); _buttonText = std::move(text);
}); };
_radioGroup->setValue(0); _radioGroup->setChangedCallback(callback);
callback(0);
} }
_showFinished.events( _showFinished.events(

View file

@ -1138,6 +1138,10 @@ void AddGiftOptions(
stCheckbox, stCheckbox,
std::move(radioView)); std::move(radioView));
radio->setAttribute(Qt::WA_TransparentForMouseEvents); radio->setAttribute(Qt::WA_TransparentForMouseEvents);
{ // Paint the last frame instantly for the layer animation.
group->setValue(0);
radio->finishAnimating();
}
row->sizeValue( row->sizeValue(
) | rpl::start_with_next([=, margins = stCheckbox.margin]( ) | rpl::start_with_next([=, margins = stCheckbox.margin](