From 30478d064211791d7db21c2795e6df17dd556f70 Mon Sep 17 00:00:00 2001 From: Haifeng Deng Date: Wed, 31 Aug 2016 15:11:40 +0800 Subject: [PATCH] Add indicator window for wearable profile Change-Id: I037105dd63417526af5c3f7bc6a81d2497a3cf6a Signed-off-by: Haifeng Deng --- .../default/wearable/indicator_horizontal_dot.png | Bin 0 -> 1099 bytes .../wearable/indicator_horizontal_focus_dot.png | Bin 0 -> 1088 bytes src/ise.cpp | 139 +++++++++++++++++++++ 3 files changed, 139 insertions(+) create mode 100644 data/pixmaps/default/wearable/indicator_horizontal_dot.png create mode 100644 data/pixmaps/default/wearable/indicator_horizontal_focus_dot.png diff --git a/data/pixmaps/default/wearable/indicator_horizontal_dot.png b/data/pixmaps/default/wearable/indicator_horizontal_dot.png new file mode 100644 index 0000000000000000000000000000000000000000..8aa80442c0a9576b9d1a4421cb5143b01544d378 GIT binary patch literal 1099 zcmaJ=OK8+U7>-nYR6PhDR1}Bwpn}s4-f6%(7Ux) z5QGhtL8r#&bltmV6(6r=-#+2f7Uqt!5!z%e6ceH7(FOsP0F99vLEiMS*Q8$%dQSTF zQ8rpVU|||$P->HD2N6dLLjOQJLU@8O&>&-eSP;KIekKCnD~N}+s#1+?GVTw~#AIY< zsE%hQu<3~ddqIEO;sgO<2(*LAFtOSNah})W>-1O_!Mq8ZD2NN9MytcXrZE9pCMRJ9 zLZIszsA{?n_kgSdv$Dc}U4p8m=~gxmI-khB#a`2@IpvNozAK31j763#w_2@CE0>}1 zm<&zROgXYyiCaj?bjVO!3X{GrgF_M=`w{bL2vSDWpi`_Ma-|DT2%>6rkvL2`f#M;P z+bEJ@Mv;Rceb>Bo!fNE7jAgBp`gBC(8cFC>jCnqqeO)k*-Txh>hFpzxF!p&;(4<50 zR6s&jaS9^8$#}kJA!0zq^zu?($DX7%b4|%W9+t2M8^~y2WMZ|;vmD-b%6i!@yCv6k zAavDY$u#Uz$tY%R&2~+#i>-tSLm?(z-#+)>npyIi>-akFn)1exjZ>7nI$FE zJ>qqlE*BeuZx&mMguIVp-Y`2KJ>AEfjmNN9Z@+K+nVTEvfoIlUzPIkhO;_fOo5B-_F73V|TY5`Sfk>!HU6aXE%N+UqAH0xcO`QrH3~*Us|c0fBECCdFAVt vp8nf#-_P}LK7)&=&(D5TcJ!UN0E9J)aBuycQ#Ep{p0;DpRgb)lcbn1u%3j;f_AO@szZj-`L)x+Jp=l8w$y}t)jlNSbaCvt)y z4A#co2ES7|cR0(>N9yKVehsn8ESsin)d7B ztZ0_5!b(X~G|g13a@p-;Yhl7rh)F-T&tvzng?+KM6BEQ}+@y4|KLu0sl+k3KM!=cY z!I>F9^k^qJo3>~tW0%DK4dPW}8i4H@+x{N$t47tdMl`ixx>`kp&{S2&(cwtdQB6y6 z9I=P>{;S*0d~yxvAN6V2nrb49R4la#Zc7jvhJ=ik&JWW-h&iq=9Ze>&#m8ETVt7HUot(win), TRUE); + } + + sclint width = 0; + sclint height = 0; + if (g_ui) + g_ui->get_screen_resolution(&width, &height); + LOGD("screen width:%d, height:%d\n", width, height); + evas_object_resize(win, width, 22); + evas_object_move(win, 0, 0); + return win; +} + +static void create_indicator_dots(int dot_num) +{ + LOGD("dots number:%d\n", dot_num); + SclPoint *dots = NULL; + + if (dot_num == 3) { + dots = _dot_3; + } else if (dot_num == 4) { + dots = _dot_4; + } else { + dots = _dot_5; + } + + for (int i = 0; i < dot_num; i++) { + if (_indicator_dot[i]) + evas_object_del(_indicator_dot[i]); + + _indicator_dot[i] = evas_object_image_add(evas_object_evas_get(_indicator_win)); + evas_object_image_file_set(_indicator_dot[i], LAYOUTDIR"/wearable/image/indicator_horizontal_dot.png", NULL); + evas_object_image_filled_set(_indicator_dot[i], EINA_TRUE); + evas_object_image_alpha_set(_indicator_dot[i], EINA_TRUE); + evas_object_resize(_indicator_dot[i], 10, 10); + evas_object_move(_indicator_dot[i], dots[i].x, dots[i].y); + evas_object_show(_indicator_dot[i]); + } +} + +static void destroy_indicator_dots(void) +{ + for (int i = 0; i < MAX_DOTS_NUMBER; i++) { + if (_indicator_dot[i]) + evas_object_del(_indicator_dot[i]); + _indicator_dot[i] = NULL; + } +} + +static void destroy_indicator_window(void) +{ + destroy_indicator_dots(); + if (_indicator_win) { + evas_object_del(_indicator_win); + _indicator_win = NULL; + } +} +#endif + /* * This callback class will receive all response events from SCL * So you should perform desired tasks in this class. @@ -1325,6 +1399,62 @@ ise_show(int ic) ise_stt_finish(); ise_hide_stt_mode(); } + + int dot_num = 5; + switch (_context_layout) { + case ISE_LAYOUT_STYLE_PHONENUMBER: + case ISE_LAYOUT_STYLE_IP: + case ISE_LAYOUT_STYLE_MONTH: + case ISE_LAYOUT_STYLE_NUMBERONLY: + case ISE_LAYOUT_STYLE_DATETIME: + case ISE_LAYOUT_STYLE_TERMINAL: + dot_num = 0; + break; + case ISE_LAYOUT_STYLE_EMAIL: + case ISE_LAYOUT_STYLE_URL: + case ISE_LAYOUT_STYLE_PASSWORD: + if (_context_layout == ISE_LAYOUT_STYLE_PASSWORD && + _context_layout_variation == ECORE_IMF_INPUT_PANEL_LAYOUT_PASSWORD_VARIATION_NUMBERONLY) + dot_num = 0; + else + dot_num = 3; + break; + default: + dot_num = 5; + } + + if (dot_num > 0) { + if (_indicator_win == NULL) { + _indicator_win = create_indicator_window(); + } + destroy_indicator_dots(); + create_indicator_dots(dot_num); + + int focus_dot = 0; + switch (g_keyboard_state.layout) { + case ISE_LAYOUT_STYLE_NUMBER: + focus_dot = 1; + break; + case ISE_LAYOUT_STYLE_HEX: + focus_dot = 2; + break; + case ISE_LAYOUT_STYLE_EMOTICON: + focus_dot = 3; + break; + case ISE_LAYOUT_STYLE_VOICE: + focus_dot = 4; + break; + default: + break; + } + + evas_object_image_file_set(_indicator_dot[focus_dot], LAYOUTDIR"/wearable/image/indicator_horizontal_focus_dot.png", NULL); + + //evas_object_raise(_indicator_win); + evas_object_show(_indicator_win); + } else { + evas_object_hide(_indicator_win); + } #endif } @@ -1379,6 +1509,11 @@ ise_hide() if (g_keyboard_state.layout == ISE_LAYOUT_STYLE_VOICE) { ise_stt_finish(); } + +#ifdef _WEARABLE + if (_indicator_win) + evas_object_hide(_indicator_win); +#endif } void @@ -1491,6 +1626,10 @@ ise_destroy() g_candidate = NULL; } +#ifdef _WEARABLE + destroy_indicator_window(); +#endif + /* This is necessary. If this is not called, 3rd party IME might have auto period input regardless its settings */ vconf_set_bool(VCONFKEY_AUTOPERIOD_ALLOW_BOOL, false); } -- 2.7.4