From: Krzysztof Wieclaw Date: Fri, 13 Jul 2018 14:00:34 +0000 (+0200) Subject: Style for middle button added X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=4e53ca7717ed0cfc97a83897bba75f5d4642705e;p=apps%2Fnative%2Fgear-racing-controller.git Style for middle button added Change-Id: Idbda414ec99236e079e3c5e8d636f16416de2853 Signed-off-by: Krzysztof Wieclaw --- diff --git a/edje/images/button_middle.png b/edje/images/button_middle.png new file mode 100644 index 0000000..25b2a2a Binary files /dev/null and b/edje/images/button_middle.png differ diff --git a/res/edje/button_style.edc b/res/edje/button_style.edc index 803d134..c0203f6 100644 --- a/res/edje/button_style.edc +++ b/res/edje/button_style.edc @@ -116,4 +116,28 @@ collections { } } } + group { "elm/button/base/racing_middle"; + inherit: "elm/button/base/racing_bottom"; + images { + image: "button_middle.png" COMP; + } + parts { + image { "background" + desc { "default"; + rel1.relative: 0.0 0.0; + rel2.relative: 1.0 1.0; + image.normal: "button_middle.png"; + } + desc { "pressed"; + image.normal: "button_middle.png"; + } + } + swallow { "elm.swallow.content"; + desc { "default"; + rel1.relative: 0.1 0.1; + rel2.relative: 0.9 0.9; + } + } + } + } } \ No newline at end of file diff --git a/res/edje/view_name_input.edc b/res/edje/view_name_input.edc index 30074e9..e8192e2 100644 --- a/res/edje/view_name_input.edc +++ b/res/edje/view_name_input.edc @@ -47,7 +47,7 @@ collections{ } text{ text: "Enter name"; - size: 19; + size: 24; font: "SamsungOne"; } } @@ -63,20 +63,24 @@ collections{ } } part{ - name: "entry_text_rectangle"; - type: RECT; + name: "button_middle"; + type: SWALLOW; desc{ state: "default" 0.0; - color_class: "ui_red"; rel1{ - relative: 0.2 0.1; + relative: 0.1 0.27; to: "entry_text_border"; } rel2{ - relative: 0.8 0.9; + relative: 0.9 0.73; to: "entry_text_border"; } } + desc{ + inherit: "default" 0.0; + state: "invisible" 0.0; + visible: 0; + } } part{ name: "entry_placeholder"; @@ -114,11 +118,6 @@ collections{ } programs{ program{ - signal: "mouse,clicked,*"; - source: "button_ok"; - action: SIGNAL_EMIT "ok_clicked" ""; - } - program{ signal: "player,name,validated"; action: STATE_SET "visible" 0.0; target: "button_ok"; @@ -129,6 +128,18 @@ collections{ action: STATE_SET "default" 0.0; target: "button_ok"; } + program{ + signal: "entry,active"; + source: "entry"; + action: STATE_SET "invisible" 0.0; + target: "button_middle"; + } + program{ + signal: "entry,inactive"; + source: "entry"; + action: STATE_SET "default" 0.0; + target: "button_middle"; + } } } } diff --git a/src/view/view_name_input.c b/src/view/view_name_input.c index d33c360..2f60c47 100644 --- a/src/view/view_name_input.c +++ b/src/view/view_name_input.c @@ -20,6 +20,8 @@ #include "controller/controller_name_input.h" #include +#include "log.h" + #define ENTRY_STYLE "DEFAULT='align=center'" typedef struct _ss_view_name_input { @@ -72,6 +74,7 @@ static void _text_entered(Evas_Object * entry) static void _text_set_cb(void *data, Evas_Object *obj, void *event_info) { + _text_entered(obj); elm_object_focus_set(obj, EINA_FALSE); } @@ -81,11 +84,26 @@ static void _char_changed_cb(void *data, Evas_Object *obj, void *event_info) _text_entered(obj); } +static void _entry_focused_cb(void *data, Evas_Object *obj, void *event_info) +{ + elm_layout_signal_emit(s_info.view_base.layout, "entry,active", "entry"); +} + +static void _entry_unfocused_cb(void *data, Evas_Object *obj, void *event_info) +{ + if (elm_entry_is_empty(obj)) { + elm_layout_signal_emit(s_info.view_base.layout, "entry,inactive", "entry"); + } +} + static void _view_name_input_create_gui(Evas_Object *parent) { s_info.view_base.layout = view_base_create_layout(parent, "edje/view_name_input.edj", GRP_MAIN); eext_object_event_callback_add(s_info.view_base.layout, EEXT_CALLBACK_BACK, _layout_back_cb, NULL); + //Creating middle button + view_base_create_button(s_info.view_base.layout, "button_middle", "Tap to enter text", NULL, "racing_middle", NULL, NULL); + //Creating entry for player's name Evas_Object *entry = elm_entry_add(parent); if (!entry) { @@ -94,8 +112,9 @@ static void _view_name_input_create_gui(Evas_Object *parent) static Elm_Entry_Filter_Limit_Size limit_size = { .max_char_count = PLAYER_NAME_MAX_LEN, .max_byte_count = 0}; elm_entry_markup_filter_append(entry, elm_entry_filter_limit_size, &limit_size); elm_entry_single_line_set(entry, EINA_TRUE); - elm_object_part_text_set(entry, "guide", "Tap to enter text"); elm_entry_text_style_user_push(entry, ENTRY_STYLE); + evas_object_smart_callback_add(entry, "focused", _entry_focused_cb, NULL); + evas_object_smart_callback_add(entry, "unfocused", _entry_unfocused_cb, NULL); evas_object_smart_callback_add(entry, "changed", _char_changed_cb, NULL); evas_object_smart_callback_add(entry, "activated", _text_set_cb, NULL); elm_layout_content_set(s_info.view_base.layout, "entry_placeholder", entry);