From: Sergei Kobec Date: Tue, 13 Dec 2016 13:46:12 +0000 (+0200) Subject: TizenRefApp-7647 Audio less than 1 second can be recorded X-Git-Tag: submit/tizen/20161221.140202^2~5 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=c291216713a334b04be185fff6b3de1e255f6405;p=profile%2Fmobile%2Fapps%2Fnative%2Fmemo.git TizenRefApp-7647 Audio less than 1 second can be recorded Change-Id: I9f448d599c5423a799f489f3f3ef381d611e91d9 Signed-off-by: Sergei Kobec --- diff --git a/lib-common/inc/Common/Recorder.h b/lib-common/inc/Common/Recorder.h index 4435e72..3f8d4c9 100644 --- a/lib-common/inc/Common/Recorder.h +++ b/lib-common/inc/Common/Recorder.h @@ -107,6 +107,11 @@ namespace Common */ void save(); + /** + * @brief Cancel recording and reset result. + */ + void cancel(); + private: void onRecording(unsigned long long elapsedTime, unsigned long long fileSize); void onLimitReached(recorder_recording_limit_type_e type); diff --git a/lib-common/src/Common/Recorder.cpp b/lib-common/src/Common/Recorder.cpp index 7f167e5..9c09ed5 100644 --- a/lib-common/src/Common/Recorder.cpp +++ b/lib-common/src/Common/Recorder.cpp @@ -92,6 +92,11 @@ void Recorder::save() recorder_commit(m_Recorder); } +void Recorder::cancel() +{ + recorder_cancel(m_Recorder); +} + void Recorder::onRecording(unsigned long long elapsedTime, unsigned long long fileSize) { m_RecordLength = elapsedTime; diff --git a/memo-app/src/Input/RecordField.cpp b/memo-app/src/Input/RecordField.cpp index 1671c55..c0328ad 100644 --- a/memo-app/src/Input/RecordField.cpp +++ b/memo-app/src/Input/RecordField.cpp @@ -216,10 +216,17 @@ Evas_Object *RecordField::createProgressBar(Evas_Object *parent) void RecordField::stop() { - m_Recorder->save(); elm_object_signal_emit(getEvasObject(), SIGNAL_BTN_STOP_HIDE, "*"); elm_object_signal_emit(getEvasObject(), SIGNAL_ICON_HIDE, "*"); - setMode(ModePlayer); + if (m_Recorder->getRecordLength() <= MIN_RECORD_LEN) { + m_Recorder->cancel(); + elm_object_signal_emit(m_RecordBtn, SIGNAL_BTN_RESUME, "*"); + elm_layout_text_set(getEvasObject(), PART_RECORD_TIME, DEFAULT_TIME); + notification_status_message_post(_("IDS_MEMO_TPOP_RECORDING_CANCELLED_RECORDING_TOO_SHORT")); + } else { + m_Recorder->save(); + setMode(ModePlayer); + } } void RecordField::pauseRecorder()