From: Kamil Lipiszko Date: Thu, 6 Oct 2016 11:46:02 +0000 (+0200) Subject: timer: Time selector alignment fix. X-Git-Tag: submit/tizen/20161113.192141~21^2 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=bed7ea113dc712cd970758c47a0c29828d3f2159;p=profile%2Fmobile%2Fapps%2Fnative%2Fclock.git timer: Time selector alignment fix. This commit fixes time selector's alignment when keypad is visible. It sets different top padding value so not only entry space is aligned but the whole item with buttons and their headers. Change-Id: Id0b8b512d2c90f15ac8a768d7f373132d94698f5 --- diff --git a/clock/inc/View/MainView.h b/clock/inc/View/MainView.h index d09de20..9fa73c4 100644 --- a/clock/inc/View/MainView.h +++ b/clock/inc/View/MainView.h @@ -75,6 +75,11 @@ namespace view { Evas_Object *GetEvasObject(); /** + * @brief Retrieves conformant object. + */ + Evas_Object *GetConformant(); + + /** * @briefs Copies this class object instance. * @remarks Customized for singleton purpose - make no effect. */ diff --git a/clock/inc/View/TimerView.h b/clock/inc/View/TimerView.h index e3e0748..aa60cbc 100644 --- a/clock/inc/View/TimerView.h +++ b/clock/inc/View/TimerView.h @@ -76,6 +76,7 @@ namespace view { private: Evas_Object *layout_ = NULL; Evas_Object *selector_ = NULL; + Evas_Object *conformant = NULL; view::CounterView *counter_ = NULL; struct Time { @@ -118,6 +119,9 @@ namespace view { static void EntryChangedCb(void *data, Evas_Object *obj, void *event_info); static void EntryEditDoneCb(void *data, Evas *e, Evas_Object *obj, void *event_info); + static void VirtualKeypadVisibleCb(void *data, Evas_Object *obj, void *event_info); + static void VirtualKeypadHiddenCb(void *data, Evas_Object *obj, void *event_info); + static void AlarmDismiss(void *data, Evas_Object *obj, const char *emission, const char *source); }; } diff --git a/clock/res/edje/Timer.edc b/clock/res/edje/Timer.edc index becca2c..f9d2ae5 100644 --- a/clock/res/edje/Timer.edc +++ b/clock/res/edje/Timer.edc @@ -38,6 +38,18 @@ collections { rel1 { relative: 1.0 0.0; to_x: "pd.left"; } rel2 { relative: 0.0 0.0; to_x: "pd.right"; to_y: "pd.btn.bg"; } } + desc { "moved"; + inherit: "default"; + rel1 { relative: 1.0 1.0; to_x: "pd.left"; to_y: "pd.top"; } + } + } + spacer { "pd.top"; scale; + desc { "default"; + min: 0 42+80; + max: -1 42+80; + fixed: 0 1; + align: 0.5 0.0; + } } spacer { "pd.content.top"; scale; desc { "default"; @@ -403,6 +415,18 @@ collections { set_state(PART:"sw.btn.cancel", "visible", 0.0); } } + program { + signal: "keypad.visible"; + source: "timer"; + action: STATE_SET "moved"; + target: "sw.content"; + } + program { + signal: "keypad.hidden"; + source: "timer"; + action: STATE_SET "default"; + target: "sw.content"; + } } } diff --git a/clock/src/View/MainView.cpp b/clock/src/View/MainView.cpp index 19c4a53..abc52f3 100644 --- a/clock/src/View/MainView.cpp +++ b/clock/src/View/MainView.cpp @@ -203,6 +203,11 @@ Evas_Object *MainView::GetEvasObject() return naviframe_; } +Evas_Object *MainView::GetConformant() +{ + return conformant_; +} + ui::IView *MainView::GetView(ViewType type) { switch (type){ diff --git a/clock/src/View/TimerView.cpp b/clock/src/View/TimerView.cpp index 91e3549..234330b 100644 --- a/clock/src/View/TimerView.cpp +++ b/clock/src/View/TimerView.cpp @@ -51,6 +51,11 @@ TimerView::TimerView(ui::IView &main) : set_time_() CreateMenuButtons(); counter_ = new CounterView(*this, CounterType::COUNTER_TYPE_TIMER); + conformant = static_cast(main).GetConformant(); + + evas_object_smart_callback_add(conformant, "virtualkeypad,state,on", VirtualKeypadVisibleCb, this); + evas_object_smart_callback_add(conformant, "virtualkeypad,state,off", VirtualKeypadHiddenCb, this); + CreateSelector(); ShowStartupMenu(); @@ -58,6 +63,9 @@ TimerView::TimerView(ui::IView &main) : set_time_() TimerView::~TimerView() { + evas_object_smart_callback_del(conformant, "virtualkeypad,state,on", VirtualKeypadVisibleCb); + evas_object_smart_callback_del(conformant, "virtualkeypad,state,off", VirtualKeypadHiddenCb); + if (selector_) evas_object_del(selector_); if (layout_) @@ -76,6 +84,26 @@ const char *TimerView::GetEdjeFilePath() return utils::Utils::GetAppResourcePath(utils::Utils::APP_DIR_RESOURCE, EDJE_FILE); } + +void TimerView::VirtualKeypadVisibleCb(void *data, Evas_Object *obj, void *event_info) +{ + TimerView *object = static_cast(data); + + DBG(""); + + elm_object_signal_emit(object->layout_, "keypad.visible", "timer"); +} + +void TimerView::VirtualKeypadHiddenCb(void *data, Evas_Object *obj, void *event_info) +{ + TimerView *object = static_cast(data); + + DBG(""); + + elm_object_signal_emit(object->layout_, "keypad.hidden", "timer"); + object->UnfocusEntries(); +} + void TimerView::AlarmDismiss(void *data, Evas_Object *obj, const char *emission, const char *source) { TimerView *object = static_cast(data); @@ -299,29 +327,7 @@ void TimerView::EntryEditDoneCb(void *data, Evas *e, Evas_Object *obj, void *eve void TimerView::UnfocusEntries() { - Evas_Object *entry = elm_object_part_content_get(selector_, "sw.entry.hour"); - if (!entry) { - ERR("!entry"); - return; - } - - elm_object_focus_set(entry, EINA_FALSE); - - entry = elm_object_part_content_get(selector_, "sw.entry.minute"); - if (!entry) { - ERR("!entry"); - return; - } - - elm_object_focus_set(entry, EINA_FALSE); - - entry = elm_object_part_content_get(selector_, "sw.entry.second"); - if (!entry) { - ERR("!entry"); - return; - } - - elm_object_focus_set(entry, EINA_FALSE); + elm_object_focus_set(layout_, EINA_FALSE); } void TimerView::ShowSelector() @@ -338,7 +344,7 @@ void TimerView::ShowSelector() void TimerView::ShowCounter() { - Evas_Object *content = elm_object_part_content_unset(layout_, "sw.content"); + Evas_Object *content = elm_object_part_content_get(layout_, "sw.content"); if (counter_->GetEvasObject() && content != counter_->GetEvasObject()) { elm_object_part_content_unset(layout_, "sw.content"); evas_object_hide(content); @@ -479,6 +485,7 @@ void TimerView::ResetButtonClicked(void *data, Evas_Object *obj, void *event_inf object->set_time_.Sec = 0; object->UpdateView(); + object->UnfocusEntries(); } void TimerView::RegisterSignal(std::functionfunc, TimerSignal type)