From: Radek Kintop Date: Thu, 20 Apr 2017 15:15:38 +0000 (+0200) Subject: Menu button style update (In Progress) X-Git-Tag: submit/tizen/20170421.015410^0 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=refs%2Fchanges%2F41%2F126241%2F1;p=profile%2Ftv%2Fapps%2Fnative%2Fair_settings.git Menu button style update (In Progress) Change-Id: If64f48805445f659e881eee506be4caba45ba5bf Signed-off-by: Radek Kintop --- diff --git a/res/images/4.0/bg_settings_item_selected.#.png b/res/images/4.0/bg_settings_item_selected.#.png new file mode 100644 index 0000000..f747480 Binary files /dev/null and b/res/images/4.0/bg_settings_item_selected.#.png differ diff --git a/res/widget/button.edc b/res/widget/button.edc index 832d3f8..21c5a53 100644 --- a/res/widget/button.edc +++ b/res/widget/button.edc @@ -22,6 +22,7 @@ #define BG_NORMAL "4.0/bg_settings_gray.#.png" #define SHADOW_IMG "4.0/bg_settings_item_shadow.#.png" +#define SELECTED_IMG "4.0/bg_settings_item_selected.#.png" #define TRANSITION_FOCUS LINEAR 0.333 @@ -563,17 +564,15 @@ group { images { image: BG_NORMAL COMP; image: SHADOW_IMG COMP; + image: SELECTED_IMG COMP; } parts { part { - name: "area"; - type: RECT; + type: SPACER; scale: 0; description { state: "default" 0.0; min: 428 318; - color: 0 0 128 128; - align: 0.0 0.0; } } part { @@ -584,8 +583,6 @@ group { state: "default" 0.0; rel1.relative: 0.0 0.0; rel2.relative: 1.0 1.0; - color: 255 255 255 255; - align: 0.5 0.5; image.normal: BG_NORMAL; } description { @@ -593,6 +590,29 @@ group { inherit, "default" 0.0; rel1.relative: -0.05 -0.05; rel2.relative: 1.05 1.05; + } + description { + state: "invis" 0.0; + inherit: "default" 0.0; + color: 255 255 255 0; + } + } + part { + name: "bg_selected"; + type: IMAGE; + scale: 0; + description { + state: "default" 0.0; + rel1.to: "bg"; + rel2.to: "bg"; + color: 255 255 255 0; + rel1.relative: 0.0 0.0; + rel2.relative: 1.0 1.0; + image.normal: SELECTED_IMG; + } + description { + state: "vis" 0.0; + inherit: "default" 0.0; color: 255 255 255 255; } } @@ -635,6 +655,83 @@ group { inherit, "default" 0.0; color, COLOR_TEXT_DISABLE; } + description { + state: "invis" 0.0; + inherit: "default" 0.0; + color: 0 0 0 0; + } + } + part { + name, "elm.text.selected"; + type, TEXT; + repeat_events, 1; + scale: 0; + description { + state, "default" 0.0; + rel1.to, "bg.content"; + rel2.to, "bg.content"; + text { + font, FONT_LIGHT; + size, 32; + align, 0.5 0.5; + } + color, 255 255 255 0; + } + description { + state, "vis" 0.0; + inherit, "default" 0.0; + color, 255 255 255 255; + } + } + } + script + { + public is_focused; + public is_mousedown; + + public mouse_down_anim(val, Float:pos) + { + set_tween_state(PART:"bg", pos, "focused", 0.0, "invis", 0.0); + set_tween_state(PART:"bg_selected", pos, "default", 0.0, "vis", 0.0); + set_tween_state(PART:"elm.text", pos, "focused", 0.0, "invis", 0.0); + set_tween_state(PART:"elm.text.selected", pos, "default", 0.0, "vis", 0.0); + } + public mouse_up_anim(val, Float:pos) + { + set_tween_state(PART:"bg", pos, "invis", 0.0, "focused", 0.0); + set_tween_state(PART:"bg_selected", pos, "vis", 0.0, "default", 0.0); + set_tween_state(PART:"elm.text", pos, "invis", 0.0, "focused", 0.0); + set_tween_state(PART:"elm.text.selected", pos, "vis", 0.0, "default", 0.0); + } + public focus_anim(val, Float:pos) + { + if(get_int(is_mousedown)) + { + set_tween_state(PART:"bg", pos, "default", 0.0, "focused", 0.0); + set_tween_state(PART:"bg_selected", pos, "vis", 0.0, "default", 0.0); + set_tween_state(PART:"elm.text", pos, "default", 0.0, "focused", 0.0); + set_tween_state(PART:"elm.text.selected", pos, "vis", 0.0, "default", 0.0); + } + else + { + set_tween_state(PART:"bg", pos, "default", 0.0, "focused", 0.0); + set_tween_state(PART:"elm.text", pos, "default", 0.0, "focused", 0.0); + } + } + public unfocus_anim(val, Float:pos) + { + if(get_int(is_mousedown)) + { + set_tween_state(PART:"bg", pos, "invis", 0.0, "default", 0.0); + set_tween_state(PART:"bg_selected", pos, "vis", 0.0, "default", 0.0); + set_tween_state(PART:"elm.text", pos, "invis", 0.0, "default", 0.0); + set_tween_state(PART:"elm.text.selected", pos, "vis", 0.0, "default", 0.0); + } + else + { + set_tween_state(PART:"bg", pos, "focused", 0.0, "default", 0.0); + set_tween_state(PART:"elm.text", pos, "focused", 0.0, "default", 0.0); + } } } programs { @@ -642,31 +739,58 @@ group { name, "button_clicked"; signal, "mouse,clicked,1"; source, "bg"; - action, SIGNAL_EMIT "elm,action,click" ""; + source: "bg_selected"; + //action, SIGNAL_EMIT "elm,action,click" ""; } program { name, "focused"; signal, SIG_FOCUSED; source, "elm"; - action, STATE_SET "focused" 0.0; - target, "bg"; - target, "elm.text"; - transition, TRANSITION_FOCUS; + script + { + static txt[128] = {'\0',}; + get_text(PART:"elm.text", txt, sizeof(txt)); + set_text(PART:"elm.text.selected", txt); + set_int(is_focused, 1); + anim(0.333, "focus_anim", 0); + } + } + program { + signal: "mouse,down,1"; + source: "bg"; + source: "bg_selected"; + script + { + if(get_int(is_focused) && !get_int(is_mousedown)) + { + anim(0.167, "mouse_down_anim", 0); + set_int(is_mousedown, 1); + } + } + } + program + { + signal: "mouse,up,1"; + source: "bg"; + source: "bg_selected"; + script + { + if(get_int(is_focused) && get_int(is_mousedown)) + { + anim(0.167, "mouse_up_anim", 0); + set_int(is_mousedown, 0); + } + } } program { name, "unfocused"; signal, SIG_UNFOCUSED; source, "elm"; - action, STATE_SET "image_change" 0.0; - target, "bg"; - transition, TRANSITION_FOCUS; - after: "unfocused_scale"; - } - program { - name, "unfocused_scale"; - action, STATE_SET "default" 0.0; - target, "bg"; - target, "elm.text"; + script + { + set_int(is_focused, 0); + anim(0.333, "unfocus_anim", 0); + } } program { name, "disabled"; @@ -746,14 +870,14 @@ group { } } programs { - program { + /*program { name, "focused"; target, PART_MENU_VALUE; } program { name, "unfocused"; target, PART_MENU_VALUE; - } + }*/ program { name, "disabled"; target, PART_MENU_VALUE; @@ -842,14 +966,14 @@ group { } } programs { - program { + /*program { name, "focused"; target, PART_MENU_VALUE; } program { name, "unfocused"; target, PART_MENU_VALUE; - } + }*/ program { name, "disabled"; target, PART_MENU_VALUE;