diff --git a/Telegram/Resources/icons/voice_lock/input_mic_s.png b/Telegram/Resources/icons/voice_lock/input_mic_s.png new file mode 100644 index 0000000000..86c1146a5d Binary files /dev/null and b/Telegram/Resources/icons/voice_lock/input_mic_s.png differ diff --git a/Telegram/Resources/icons/voice_lock/input_mic_s@2x.png b/Telegram/Resources/icons/voice_lock/input_mic_s@2x.png new file mode 100644 index 0000000000..e70fd6a669 Binary files /dev/null and b/Telegram/Resources/icons/voice_lock/input_mic_s@2x.png differ diff --git a/Telegram/Resources/icons/voice_lock/input_mic_s@3x.png b/Telegram/Resources/icons/voice_lock/input_mic_s@3x.png new file mode 100644 index 0000000000..d7a4ad9814 Binary files /dev/null and b/Telegram/Resources/icons/voice_lock/input_mic_s@3x.png differ diff --git a/Telegram/SourceFiles/chat_helpers/chat_helpers.style b/Telegram/SourceFiles/chat_helpers/chat_helpers.style index c692b4cb6a..1cd58f181e 100644 --- a/Telegram/SourceFiles/chat_helpers/chat_helpers.style +++ b/Telegram/SourceFiles/chat_helpers/chat_helpers.style @@ -1122,6 +1122,7 @@ historyRecordLockBodyShadow: icon {{ "voice_lock/record_lock_body_shadow", histo historyRecordLockBody: icon {{ "voice_lock/record_lock_body", historyToDownBg }}; historyRecordLockMargin: margins(4px, 4px, 4px, 4px); historyRecordLockArrow: icon {{ "voice_lock/voice_arrow", historyToDownFg }}; +historyRecordLockInput: icon {{ "voice_lock/input_mic_s", historyToDownFg }}; historyRecordLockRippleMargin: margins(6px, 6px, 6px, 6px); historyRecordDelete: IconButton(historyAttach) { diff --git a/Telegram/SourceFiles/history/view/controls/history_view_voice_record_bar.cpp b/Telegram/SourceFiles/history/view/controls/history_view_voice_record_bar.cpp index 95bec71181..42d9f2b145 100644 --- a/Telegram/SourceFiles/history/view/controls/history_view_voice_record_bar.cpp +++ b/Telegram/SourceFiles/history/view/controls/history_view_voice_record_bar.cpp @@ -574,6 +574,8 @@ void ListenWrap::init() { if (!_isShowAnimation) { p.setOpacity(progress); + } else { + p.fillRect(bgRect, _st.bg); } p.setPen(Qt::NoPen); p.setBrush(_st.cancelActive); @@ -826,6 +828,7 @@ public: void requestPaintProgress(float64 progress); void requestPaintLockToStopProgress(float64 progress); + void requestPaintPauseToInputProgress(float64 progress); void setVisibleTopPart(int part); [[nodiscard]] rpl::producer<> locks() const; @@ -852,6 +855,7 @@ private: Ui::Animations::Simple _lockEnderAnimation; float64 _lockToStopProgress = 0.; + float64 _pauseToInputProgress = 0.; rpl::variable _progress = 0.; int _visibleTopPart = -1; @@ -888,6 +892,7 @@ void RecordLock::init() { setAttribute(Qt::WA_TransparentForMouseEvents, true); _lockEnderAnimation.stop(); _lockToStopProgress = 0.; + _pauseToInputProgress = 0.; _progress = 0.; } }, lifetime()); @@ -964,6 +969,13 @@ void RecordLock::drawProgress(QPainter &p) { p.translate(inner.topLeft() + lockTranslation); p.setPen(Qt::NoPen); p.setBrush(_st.fg); + if (_pauseToInputProgress > 0.) { + p.setOpacity(_pauseToInputProgress); + st::historyRecordLockInput.paintInCenter( + p, + blockRect.toRect()); + p.setOpacity(1. - _pauseToInputProgress); + } p.drawRoundedRect( blockRect - QMargins(0, 0, pauseLineOffset, 0), xRadius, @@ -1078,6 +1090,11 @@ void RecordLock::requestPaintLockToStopProgress(float64 progress) { update(); } +void RecordLock::requestPaintPauseToInputProgress(float64 progress) { + _pauseToInputProgress = progress; + update(); +} + float64 RecordLock::lockToStopProgress() const { return _lockToStopProgress; } @@ -1420,10 +1437,24 @@ void VoiceRecordBar::init() { }, _recordingLifetime); }; + const auto paintShowListenCallback = [=](float64 value) { + _listen->requestPaintProgress(value); + _level->requestPaintProgress(1. - value); + _lock->requestPaintPauseToInputProgress(value); + update(); + }; + _lock->setClickedCallback([=] { if (isListenState()) { startRecording(); - _listen = nullptr; + _showListenAnimation.stop(); + _showListenAnimation.start([=](float64 value) { + _listen->requestPaintProgress(1.); + paintShowListenCallback(value); + if (!value) { + _listen = nullptr; + } + }, 1., 0., st::historyRecordVoiceShowDuration * 2); setLevelAsSend(); return; @@ -1445,10 +1476,7 @@ void VoiceRecordBar::init() { const auto to = 1.; const auto &duration = st::historyRecordVoiceShowDuration; auto callback = [=](float64 value) { - _listen->requestPaintProgress(value); - const auto reverseValue = to - value; - _level->requestPaintProgress(reverseValue); - update(); + paintShowListenCallback(value); if (to == value) { _recordingLifetime.destroy(); } @@ -1956,7 +1984,11 @@ float64 VoiceRecordBar::showAnimationRatio() const { } float64 VoiceRecordBar::showListenAnimationRatio() const { - return _showListenAnimation.value(_listen ? 1. : 0.); + const auto value = _showListenAnimation.value(_listen ? 1. : 0.); + if (_paused.current()) { + return value * value; + } + return value; } void VoiceRecordBar::computeAndSetLockProgress(QPoint globalPos) {