TizenRefApp-8672 [Call UI] Implement KeypadPage prototype 99/133499/2
authorIgor Olshevskyi <i.olshevskyi@samsung.com>
Fri, 9 Jun 2017 11:23:17 +0000 (14:23 +0300)
committerIgor Olshevskyi <i.olshevskyi@samsung.com>
Thu, 15 Jun 2017 08:31:21 +0000 (11:31 +0300)
Change-Id: I9a8cf28d25fb8bce7e0e9a201a850ed58ff32b4a

edc/keypad.edc [new file with mode: 0644]
inc/presenters/KeypadPage.h [new file with mode: 0644]
inc/presenters/MoreOptionsPresenter.h
inc/presenters/types.h
res/edje/theme.edc
src/presenters/KeypadPage.cpp [new file with mode: 0644]
src/presenters/MainPage.cpp
src/presenters/MoreOptionsPresenter.cpp

diff --git a/edc/keypad.edc b/edc/keypad.edc
new file mode 100644 (file)
index 0000000..696b988
--- /dev/null
@@ -0,0 +1,26 @@
+/*
+ * Copyright 2017 Samsung Electronics Co., Ltd
+ *
+ * Licensed under the Flora License, Version 1.1 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://floralicense.org/license/
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+group { "elm/layout/callui/keypad";
+       parts {
+               rect { "bg";
+                       scale;
+                       desc { "default";
+                               color: 0 0 0 255;
+                       }
+               }
+       }
+}
\ No newline at end of file
diff --git a/inc/presenters/KeypadPage.h b/inc/presenters/KeypadPage.h
new file mode 100644 (file)
index 0000000..50e859a
--- /dev/null
@@ -0,0 +1,54 @@
+/*
+ * Copyright 2017 Samsung Electronics Co., Ltd
+ *
+ * Licensed under the Flora License, Version 1.1 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://floralicense.org/license/
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef __CALLUI_PRESENTERS_KEYPAD_PAGE_H__
+#define __CALLUI_PRESENTERS_KEYPAD_PAGE_H__
+
+#include "Page.h"
+
+#include "ucl/gui/Layout.h"
+
+#include "types.h"
+
+namespace callui {
+
+       class KeypadPage final : public Page {
+       public:
+               class Builder {
+               public:
+                       Builder();
+                       ~Builder();
+                       Builder &setNaviframe(const ucl::NaviframeSRef &navi);
+                       KeypadPageSRef build(const ExitRequestHandler onExitRequest) const;
+               private:
+                       ucl::NaviframeSRef m_navi;
+               };
+
+       private:
+               friend class ucl::RefCountObj<KeypadPage>;
+               KeypadPage(ucl::RefCountObjBase &rc,
+                               const ucl::NaviframeSRef &navi,
+                               const ExitRequestHandler onExitRequest);
+               virtual ~KeypadPage();
+
+               ucl::Result prepare();
+
+       private:
+               ucl::LayoutSRef m_widget;
+       };
+}
+
+#endif // __CALLUI_PRESENTERS_KEYPAD_PAGE_H__
index 2955e52a09cf91ad35232792d2f0eefc439a77f4..b82aaba0165e3c04315760d122a8eb66e880dd84 100644 (file)
@@ -21,6 +21,9 @@
 
 #include "ucl/gui/Layout.h"
 #include "ucl/gui/StyledWidget.h"
+#include "ucl/gui/Naviframe.h"
+
+#include "Page.h"
 
 #include "types.h"
 
@@ -33,10 +36,12 @@ namespace callui {
                        Builder();
                        Builder &setCallManager(const ICallManagerSRef &cm);
                        Builder &setSoundManager(const ISoundManagerSRef &sm);
+                       Builder &setNaviframe(const ucl::NaviframeSRef &navi);
                        MoreOptionsPresenterSRef build(ucl::ElmWidget &parent) const;
                private:
                        ICallManagerSRef m_cm;
                        ISoundManagerSRef m_sm;
+                       ucl::NaviframeSRef m_navi;
                };
 
        public:
@@ -47,7 +52,8 @@ namespace callui {
                friend class ucl::RefCountObj<MoreOptionsPresenter>;
                MoreOptionsPresenter(ucl::RefCountObjBase &rc,
                                const ICallManagerSRef &cm,
-                               const ISoundManagerSRef &sm);
+                               const ISoundManagerSRef &sm,
+                               const ucl::NaviframeSRef &navi);
                virtual ~MoreOptionsPresenter();
 
                ucl::Result prepare(ucl::ElmWidget &parent);
@@ -92,6 +98,8 @@ namespace callui {
                void unsetPanelContent(const ucl::EdjePart &part);
                void setPanelContent(ucl::StyledWidgetSRef &widget, const ucl::EdjePart &part);
 
+               void onPageExitRequest(Page &page);
+
        private:
                ucl::LayoutSRef m_widget;
                ucl::StyledWidgetSRef m_panel;
@@ -102,9 +110,12 @@ namespace callui {
                ucl::StyledWidgetSRef m_btnPhone;
                ucl::StyledWidgetSRef m_btnKeypad;
                ucl::StyledWidgetSRef m_btnGear;
+               PageWRef m_keypad;
 
                ICallManagerSRef m_cm;
                ISoundManagerSRef m_sm;
+               ucl::NaviframeWRef m_navi;
+
                ICallInfoWCRef m_info;
 
                Ecore_Timer *m_timer;
index fc5fe6c4e43cc3c240b13973765ee1590ba80126..dbccc849a1920f21113e6823bbce30e691e2f39f 100644 (file)
@@ -46,6 +46,7 @@ namespace callui {
 
        UCL_DECLARE_REF_ALIASES(Page);
        UCL_DECLARE_REF_ALIASES(MainPage);
+       UCL_DECLARE_REF_ALIASES(KeypadPage);
 
        UCL_DECLARE_REF_ALIASES(AcceptRejectPresenter);
        UCL_DECLARE_REF_ALIASES(AcceptDialog);
index e178e7353c2c4f6796f2b2e7f323643a7d1484bc..9fbddf06b56f6dfe0508de598bce84b41d121ab9 100644 (file)
@@ -46,5 +46,5 @@ collections {
        #include "../../edc/volume_control.edc"
        #include "../../edc/accessory.edc"
        #include "../../edc/more_option.edc"
-
+       #include "../../edc/keypad.edc"
 }
diff --git a/src/presenters/KeypadPage.cpp b/src/presenters/KeypadPage.cpp
new file mode 100644 (file)
index 0000000..15cdf8a
--- /dev/null
@@ -0,0 +1,99 @@
+/*
+ * Copyright 2017 Samsung Electronics Co., Ltd
+ *
+ * Licensed under the Flora License, Version 1.1 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://floralicense.org/license/
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#include "presenters/KeypadPage.h"
+
+#include "common.h"
+
+namespace callui { namespace { namespace impl {
+
+       using namespace ucl;
+
+       constexpr LayoutTheme LAYOUT_KEYPAD_WIDGET
+               {"layout", "callui", "keypad"};
+
+}}}
+
+namespace callui {
+
+       using namespace ucl;
+
+       // KeypadPage::Builder
+
+       KeypadPage::Builder::Builder()
+       {
+       }
+
+       KeypadPage::Builder::~Builder()
+       {
+       }
+
+       KeypadPage::Builder &KeypadPage::Builder::setNaviframe(
+                       const NaviframeSRef &navi)
+       {
+               m_navi = navi;
+               return *this;
+       }
+
+       KeypadPageSRef KeypadPage::Builder::build(
+                       const ExitRequestHandler onExitRequest) const
+       {
+               if (!onExitRequest) {
+                       LOG_RETURN_VALUE(RES_INVALID_ARGUMENTS, {},
+                                       "onExitRequest is NULL");
+               }
+               if (!m_navi) {
+                       LOG_RETURN_VALUE(RES_INVALID_ARGUMENTS, {},
+                                       "m_navi is NULL");
+               }
+
+               auto result = makeShared<KeypadPage>(m_navi, onExitRequest);
+
+               FAIL_RETURN_VALUE(result->prepare(), {},
+                               "result->prepare() failed!");
+
+               return result;
+       }
+
+       // KeypadPage
+
+       KeypadPage::KeypadPage(RefCountObjBase &rc,
+                       const NaviframeSRef &navi,
+                       const ExitRequestHandler onExitRequest):
+               Page(rc, navi, onExitRequest)
+       {
+       }
+
+       KeypadPage::~KeypadPage()
+       {
+       }
+
+       Result KeypadPage::prepare()
+       {
+               m_widget = Layout::Builder().
+                               setTheme(impl::LAYOUT_KEYPAD_WIDGET).
+                               setIsOwner(true).
+                               build(getNaviframe());
+               if (!m_widget) {
+                       LOG_RETURN(RES_FAIL, "Layout::build() failed!");
+               }
+
+               return Page::prepare([this]() {
+                       return getNaviframe().push(*m_widget);
+               });
+       }
+
+}
index ef15cb9a64bcf5c36ebd9e182a6810d1c0d6696f..f81a420ad2d68e105f19e16c66cafda1042b8bf5 100644 (file)
@@ -17,7 +17,6 @@
 #include "presenters/MainPage.h"
 
 #include "ucl/gui/Window.h"
-#include "ucl/gui/Layout.h"
 #include "ucl/gui/Widget.h"
 
 #include "model/ICall.h"
@@ -242,7 +241,7 @@ namespace callui {
                processKeyPress();
        }
 
-       void MainPage::onPowerKeyUp(ucl::Widget &widget, void *eventInfo)
+       void MainPage::onPowerKeyUp(Widget &widget, void *eventInfo)
        {
                if (isActive()) {
                        processKeyPress();
@@ -501,6 +500,7 @@ namespace callui {
                m_moreOptions = MoreOptionsPresenter::Builder().
                                setCallManager(m_cm).
                                setSoundManager(m_call->getSoundManager()).
+                               setNaviframe(asShared(getNaviframe())).
                                build(*m_widget);
 
                if (!m_moreOptions) {
index a0b236e8004aae3775366b90f8dc009ea655a253..e14d91b90c73f754f4790641d10bbf07f5601760 100644 (file)
@@ -26,6 +26,8 @@
 #include "model/ICallInfo.h"
 #include "model/ISoundManager.h"
 
+#include "presenters/KeypadPage.h"
+
 #include "resources.h"
 #include "common.h"
 
@@ -86,14 +88,21 @@ namespace callui {
                return *this;
        }
 
+       MoreOptionsPresenter::Builder &
+       MoreOptionsPresenter::Builder::setNaviframe(const NaviframeSRef &navi)
+       {
+               m_navi = navi;
+               return *this;
+       }
+
        MoreOptionsPresenterSRef
        MoreOptionsPresenter::Builder::build(ElmWidget &parent) const
        {
-               if (!m_cm || !m_sm) {
+               if (!m_cm || !m_sm || !m_navi) {
                        LOG_RETURN_VALUE(RES_FAIL, {}, "Main params are not set");
                }
 
-               auto result = makeShared<MoreOptionsPresenter>(m_cm, m_sm);
+               auto result = makeShared<MoreOptionsPresenter>(m_cm, m_sm, m_navi);
                FAIL_RETURN_VALUE(result->prepare(parent), {},
                                "result->prepare() failed!");
 
@@ -104,10 +113,12 @@ namespace callui {
 
        MoreOptionsPresenter::MoreOptionsPresenter(RefCountObjBase &rc,
                        const ICallManagerSRef &cm,
-                       const ISoundManagerSRef &sm):
+                       const ISoundManagerSRef &sm,
+                       const NaviframeSRef &navi):
                        Presenter(rc),
                        m_cm(cm),
                        m_sm(sm),
+                       m_navi(navi),
                        m_timer(nullptr)
        {
        }
@@ -125,6 +136,10 @@ namespace callui {
 
                m_sm->removeAudioStateHandler(DELEGATE(
                                MoreOptionsPresenter::onAudioStateChanged, this));
+
+               if (m_keypad) {
+                       m_keypad->exitNoTransition();
+               }
        }
 
        Result MoreOptionsPresenter::prepare(ElmWidget &parent)
@@ -352,7 +367,20 @@ namespace callui {
 
        void MoreOptionsPresenter::onKeypadBtnClick(Widget &sender, void *eventInfo)
        {
-               ELOG("Not implemented");
+               KeypadPage::Builder builder;
+               if (m_navi) {
+                       builder.setNaviframe(m_navi);
+               } else {
+                       LOG_RETURN_VOID(RES_FAIL, "Naviframe is NULL");
+               }
+               m_keypad = builder.build(DELEGATE(
+                               MoreOptionsPresenter::onPageExitRequest, this));
+       }
+
+       void MoreOptionsPresenter::onPageExitRequest(Page &page)
+       {
+               m_keypad.reset();
+               page.exit();
        }
 
        void MoreOptionsPresenter::onGearBtnClick(Widget &sender, void *eventInfo)