TizenRefApp-7612 Implement support of record's interrupt events 94/96894/2
authorNataliia Kamyshna <n.kamyshna@samsung.com>
Thu, 10 Nov 2016 13:13:01 +0000 (15:13 +0200)
committerAleksandr Sapozhnik <a.sapozhnik@samsung.com>
Fri, 11 Nov 2016 07:52:12 +0000 (23:52 -0800)
Change-Id: Idc9d8adc5a88ca0b484bebacd84d0ff96397a2ae
Signed-off-by: Nataliia Kamyshna <n.kamyshna@samsung.com>
lib-common/src/Common/Player.cpp
memo-app/inc/Input/RecordField.h
memo-app/src/Input/RecordField.cpp

index 5b47c3f6ab4ebbff1af51127c977b76408e41f71..5ffc556ce2ddcc02d39db9959ec3ea96509b56f0 100644 (file)
@@ -92,7 +92,7 @@ void Player::onCompleted()
 
 void Player::onInterrupted(player_interrupted_code_e code)
 {
-       if (m_OnInterrupted) {
+       if (m_OnInterrupted && code != PLAYER_INTERRUPTED_COMPLETED) {
                m_OnInterrupted();
        }
 }
index ad2d07752d3df7ac70d95d9f2ec0a30cf74b841b..3fe31f15ff8b5eeff544aa78a4cbd04b8c3b25f8 100644 (file)
@@ -104,11 +104,13 @@ namespace Input
 
                void onRecording(unsigned long long elapsedTime, unsigned long long fileSize);
                void onMaxLengthReached();
+               void onRecordInterrupted();
                void onStopPressed();
                void onRecordPressed();
                void onRecordPausePressed();
 
                void onPlayCompleted();
+               void onPlayInterrupted();
                void onPlayPressed();
                void onPlayPausePressed();
                Eina_Bool onPlaying();
index 2cc583690358a0d143db3e88eba983ab0f79b325..d5ea98322a062bbfccd8729d251fbc69349468a6 100644 (file)
@@ -132,6 +132,7 @@ void RecordField::setMode(Mode mode)
                        m_Recorder->setMaxLength(MAX_RECORD_LEN);
                        m_Recorder->setRecordingCallback(std::bind(&RecordField::onRecording, this, _1, _2));
                        m_Recorder->setMaxLengthReachCallback(std::bind(&RecordField::onMaxLengthReached, this));
+                       m_Recorder->setInterruptCallback(std::bind(&RecordField::onRecordInterrupted, this));
                        createRecorderView();
                        break;
                case ModePlayer:
@@ -141,6 +142,7 @@ void RecordField::setMode(Mode mode)
                        }
                        m_Player = new Player(m_Path.c_str());
                        m_Player->setCompleteCallback(std::bind(&RecordField::onPlayCompleted, this));
+                       m_Player->setInterruptCallback(std::bind(&RecordField::onPlayInterrupted, this));
                        createPlayerView();
                        break;
        }
@@ -239,6 +241,11 @@ void RecordField::onMaxLengthReached()
        notification_status_message_post(_("IDS_MEMO_TPOP_MAXIMUM_RECORDING_TIME_REACHED"));
 }
 
+void RecordField::onRecordInterrupted()
+{
+       stop();
+}
+
 void RecordField::onStopPressed()
 {
        stop();
@@ -266,6 +273,11 @@ void RecordField::onPlayCompleted()
        elm_object_signal_emit(getEvasObject(), SIGNAL_PROGRESS_BAR_HIDE, "*");
 }
 
+void RecordField::onPlayInterrupted()
+{
+       pausePlayer();
+}
+
 void RecordField::onPlayPressed()
 {
        m_Player->start();