TizenRefApp-7604 Support record field in Detail view 20/96820/3
authorNataliia Kamyshna <n.kamyshna@samsung.com>
Thu, 10 Nov 2016 09:29:10 +0000 (11:29 +0200)
committerNataliia Kamyshna <n.kamyshna@samsung.com>
Fri, 11 Nov 2016 07:18:45 +0000 (09:18 +0200)
Change-Id: I2e2afdafb917370eaae6d58805046021fa8fcafd
Signed-off-by: Nataliia Kamyshna <n.kamyshna@samsung.com>
memo-app/inc/Input/InputView.h
memo-app/inc/Input/RecordField.h
memo-app/res/input/edje/RecordFieldLayout.h
memo-app/res/input/edje/input-layout.edc
memo-app/res/input/edje/record-field-layout.edc
memo-app/src/Input/DetailsView.cpp
memo-app/src/Input/InputView.cpp
memo-app/src/Input/RecordField.cpp

index afc96322b64c92ef6b129261d1c82d0418941291..1dbc69de9e3d4b992e060786729dd25449e90eb8 100644 (file)
@@ -17,8 +17,9 @@
 #ifndef INPUT_INPUT_VIEW_H
 #define INPUT_INPUT_VIEW_H
 
-#include "Input/InputBox.h"
 #include "Input/AttachPanel.h"
+#include "Input/InputBox.h"
+#include "Input/RecordField.h"
 
 #include "Common/Model/Memo.h"
 
@@ -39,7 +40,6 @@ namespace Input
        class TitleField;
        class CheckItem;
        class EntryItem;
-       class RecordField;
 
        /**
         * @brief Input view.
@@ -68,6 +68,7 @@ namespace Input
 
                InputBox *getInputBox() const;
                TitleField *getTitleField() const;
+               RecordField *getRecordField() const;
                Common::Model::Memo &getMemo();
                Common::Model::MemoProvider *getProvider() const;
 
@@ -77,6 +78,7 @@ namespace Input
                Evas_Object *createTitle(Evas_Object *parent);
                Evas_Object *createFavIcon(Evas_Object *parent);
                Evas_Object *createContent(Evas_Object *parent);
+               Evas_Object *createRecordField(Evas_Object *parent, RecordField::Mode mode);
 
                void onDonePressed(Evas_Object *button, void *eventInfo);
                void onCancelPressed(Evas_Object *button, void *eventInfo);
@@ -87,13 +89,13 @@ namespace Input
                void onColorChange();
                void onAddRecord();
                void onInsertImage(EntryItem *item);
-               void onRecordFieldDelete();
                void onImagesReceived(std::vector<std::string> results, EntryItem *item);
                void onAttachPanelHidden(EntryItem *item);
 
                void onTitleChanged(Evas_Object *entry, void *eventInfo);
                void onFavChanged(Evas_Object *check, void *eventInfo);
                void onContentChanged(bool isEmpty);
+               void onRecordFieldDelete();
                void onMemoChanged();
                void onMaxImagesReached();
                bool isSupportedResolution(const std::string &path) const;
index 9e92ca954910e06935ba89eb1d6085433a00a30d..94d3f363ceb62f48a438f299c136cfb43449204c 100644 (file)
@@ -65,10 +65,16 @@ namespace Input
 
                /**
                 * @brief Set rotation state.
-                * @param[in]   degree   Rotation angle
+                * @param[in]   degree   Rotation angle.
                 */
                void setRotation(int degree);
 
+               /**
+                * @brief Set editable state.
+                * @param[in]   isEditable   Editable state.
+                */
+               void setEditable(bool isEditable);
+
                /**
                 * @brief Pause recorder or player.
                 */
index 006877be718a2185d04d87750e8585394008b92e..f1802b528acf65f5097706fe9886d85a9728bf32 100644 (file)
@@ -50,4 +50,7 @@
 #define SIGNAL_PROGRESS_BAR_SHOW "progress_bar,state,show"
 #define SIGNAL_PROGRESS_BAR_HIDE "progress_bar,state,hide"
 
+#define SIGNAL_CLOSE_BTN_SHOW    "close_btn,state,show"
+#define SIGNAL_CLOSE_BTN_HIDE    "close_btn,state,hide"
+
 #endif /* RECORD_FIELD_LAYOUT_H */
index 9345230f8cbafef9868185ab98f9552971153a42..7a10ad06ce9da9f302a7a0866c1abe1fe5c3ca51 100644 (file)
@@ -92,7 +92,7 @@ collections {
                        textblock { PART_DATETIME; scale;
                                desc { "default";
                                        align: 1.0 1.0;
-                                       rel1 { relative: 0.0 0.0; to_x: "spacer.content.right"; to_y: PART_RECORD; }
+                                       rel1 { relative: 0.0 0.0; to_x: "spacer.content.right"; to_y: "spacer.datetime.bottom"; }
                                        rel2 { relative: 0.0 0.0; to_x: "spacer.content.right"; to_y: "spacer.datetime.bottom"; }
                                        text {
                                                style: "datetime_text";
index 379b5b99e61562a93881709099bfce694aabcde5..cc83cac5bd64c81960a42ad5bd0f94827d1210a9 100644 (file)
@@ -217,6 +217,10 @@ collections {
                                        image.normal: RECORD_BTN_CLOSE;
                                        color: 77 77 77 255;
                                }
+                               desc { "hiden";
+                                       inherit: "default";
+                                       visible: 0;
+                               }
                        }
                }
                programs {
@@ -314,6 +318,18 @@ collections {
                                action: STATE_SET "default" 0.0;
                                target: PART_PROGRESS_BAR;
                        }
+                       program {
+                               signal: SIGNAL_CLOSE_BTN_SHOW;
+                               source: "*";
+                               action: STATE_SET "default" 0.0;
+                               target: PART_CLOSE_BTN;
+                       }
+                       program {
+                               signal: SIGNAL_CLOSE_BTN_HIDE;
+                               source: "*";
+                               action: STATE_SET "hiden" 0.0;
+                               target: PART_CLOSE_BTN;
+                       }
                }
        }
 
index 17bc6b0d352979b80e5d0f9452c0187ed5826731..8fde64922a9fa1c36c419e1e64ff943fee0e9fcd 100644 (file)
@@ -158,6 +158,9 @@ void DetailsView::updateView()
                        getInputBox()->setCheckChangedCallback(std::bind(&DetailsView::onCheckChanged, this));
                        getInputBox()->setGuideTextEnabled(false);
                        getTitleField()->setFocusCallback(std::bind(&DetailsView::onContentFocused, this));
+                       if (getRecordField()) {
+                               getRecordField()->setEditable(false);
+                       }
                        subscribeToSystemSettings();
                        elm_object_signal_emit(getEvasObject(), SIGNAL_DATETIME_SHOW, "*");
                        elm_layout_text_set(getEvasObject(), PART_DATETIME,
@@ -169,6 +172,9 @@ void DetailsView::updateView()
                        getInputBox()->unsetCheckChangedCallback();
                        getInputBox()->setGuideTextEnabled(true);
                        getTitleField()->unsetFocusCallback();
+                       if (getRecordField()) {
+                               getRecordField()->setEditable(true);
+                       }
                        InputView::onPageAttached(getPage());
                        unsubscribeFromSystemSettings();
                        elm_object_signal_emit(getEvasObject(), SIGNAL_DATETIME_HIDE, "*");
index ad696a89b463266ce6a06270a2cb5235a523b89d..4d158054228fde250234808fa6bafe9c1f532f22 100644 (file)
@@ -18,7 +18,6 @@
 #include "Input/EntryItem.h"
 #include "Input/CheckItem.h"
 #include "Input/ColorSelector.h"
-#include "Input/RecordField.h"
 #include "Input/TitleField.h"
 
 #include "Common/Model/MemoProvider.h"
@@ -77,6 +76,9 @@ Evas_Object *InputView::onCreate(Evas_Object *parent)
        elm_layout_content_set(layout, PART_TITLE, createTitle(layout));
        elm_layout_content_set(layout, PART_FAV_BTN, createFavIcon(layout));
        elm_layout_content_set(layout, PART_CONTENT, createContent(layout));
+       if (m_Memo.getSoundRecord()) {
+               elm_layout_content_set(layout, PART_RECORD, createRecordField(layout, RecordField::ModePlayer));
+       }
 
        return layout;
 }
@@ -159,6 +161,11 @@ TitleField *InputView::getTitleField() const
        return m_TitleField;
 }
 
+RecordField *InputView::getRecordField() const
+{
+       return m_RecordField;
+}
+
 Common::Model::Memo &InputView::getMemo()
 {
        return m_Memo;
@@ -221,6 +228,16 @@ Evas_Object *InputView::createContent(Evas_Object *parent)
        return scroller;
 }
 
+Evas_Object *InputView::createRecordField(Evas_Object *parent, RecordField::Mode mode)
+{
+       m_RecordField = new RecordField(m_Memo.getSoundRecord()->getPath(), mode);
+       m_RecordField->create(parent);
+       m_RecordField->setRotation(getRotation());
+       m_RecordField->setDeleteCallback(std::bind(&InputView::onRecordFieldDelete, this));
+
+       return m_RecordField->getEvasObject();
+}
+
 void InputView::onDonePressed(Evas_Object *button, void *eventInfo)
 {
        m_Memo.setContent(m_InputBox->getContent());
@@ -295,11 +312,7 @@ void InputView::onColorChange()
 void InputView::onAddRecord()
 {
        m_Memo.addSoundRecord();
-       m_RecordField = new RecordField(m_Memo.getSoundRecord()->getPath());
-       m_RecordField->create(getEvasObject());
-       m_RecordField->setRotation(getRotation());
-       m_RecordField->setDeleteCallback(std::bind(&InputView::onRecordFieldDelete, this));
-       elm_layout_content_set(getEvasObject(), PART_RECORD, m_RecordField->getEvasObject());
+       elm_layout_content_set(getEvasObject(), PART_RECORD, createRecordField(getEvasObject(), RecordField::ModeRecorder));
 }
 
 void InputView::onInsertImage(EntryItem *item)
@@ -322,11 +335,6 @@ void InputView::onInsertImage(EntryItem *item)
        m_AttachPanel.show();
 }
 
-void InputView::onRecordFieldDelete()
-{
-       m_Memo.removeSoundRecord();
-}
-
 void InputView::onImagesReceived(std::vector<std::string> results, EntryItem *item)
 {
        for (auto &&path : results) {
@@ -363,6 +371,11 @@ void InputView::onContentChanged(bool isEmpty)
        }
 }
 
+void InputView::onRecordFieldDelete()
+{
+       m_Memo.removeSoundRecord();
+}
+
 void InputView::onMemoChanged()
 {
        elm_object_disabled_set(m_DoneButton, m_Memo.isEmpty());
index 297dec4ef705cd9f4d2a97c7473d7d94d4455175..b77f5ec489c0cb05a63220fed09d15d482782fe0 100644 (file)
@@ -74,11 +74,16 @@ void RecordField::setRotation(int degree)
 {
        if (degree == 0 || degree == 180) {
                elm_object_signal_emit(getEvasObject(), SIGNAL_RECORD_PORTRAIT, "*");
-       } else {
+       } else if (degree == 90 || degree == 270) {
                elm_object_signal_emit(getEvasObject(), SIGNAL_RECORD_LANDSCAPE, "*");
        }
 }
 
+void RecordField::setEditable(bool isEditable)
+{
+       elm_object_signal_emit(getEvasObject(), (isEditable) ? SIGNAL_CLOSE_BTN_SHOW : SIGNAL_CLOSE_BTN_HIDE, "*");
+}
+
 void RecordField::pause()
 {
        switch (m_Mode) {