mirror of
https://github.com/AyuGram/AyuGramDesktop.git
synced 2025-06-05 06:33:57 +02:00
Prettified fast locking of voice record.
This commit is contained in:
parent
57eb4f8234
commit
367b487a6c
1 changed files with 18 additions and 1 deletions
|
@ -110,8 +110,11 @@ private:
|
||||||
void init();
|
void init();
|
||||||
|
|
||||||
void drawProgress(Painter &p);
|
void drawProgress(Painter &p);
|
||||||
|
void setProgress(float64 progress);
|
||||||
|
void startLockingAnimation(float64 to);
|
||||||
|
|
||||||
Ui::Animations::Simple _lockAnimation;
|
Ui::Animations::Simple _lockAnimation;
|
||||||
|
Ui::Animations::Simple _lockEnderAnimation;
|
||||||
|
|
||||||
rpl::variable<float64> _progress = 0.;
|
rpl::variable<float64> _progress = 0.;
|
||||||
};
|
};
|
||||||
|
@ -381,10 +384,24 @@ void RecordLock::drawProgress(Painter &p) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void RecordLock::startLockingAnimation(float64 to) {
|
||||||
|
auto callback = [=](auto value) { setProgress(value); };
|
||||||
|
const auto duration = st::historyRecordVoiceShowDuration;
|
||||||
|
_lockEnderAnimation.start(std::move(callback), 0., to, duration);
|
||||||
|
}
|
||||||
|
|
||||||
void RecordLock::requestPaintProgress(float64 progress) {
|
void RecordLock::requestPaintProgress(float64 progress) {
|
||||||
if (isHidden() || isLocked()) {
|
if (isHidden() || isLocked() || _lockEnderAnimation.animating()) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
if (!_progress.current() && (progress > .3)) {
|
||||||
|
startLockingAnimation(progress);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
setProgress(progress);
|
||||||
|
}
|
||||||
|
|
||||||
|
void RecordLock::setProgress(float64 progress) {
|
||||||
_progress = progress;
|
_progress = progress;
|
||||||
update();
|
update();
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue