diff options
author | moon87.park <moon87.park@samsung.com> | 2017-04-05 14:40:08 +0900 |
---|---|---|
committer | moon87.park <moon87.park@samsung.com> | 2017-04-05 14:40:08 +0900 |
commit | 237813ae87afb155d4d5105f332f89e8420dd5a0 (patch) | |
tree | dcac50963a6757ff3abfe9cac441037ff2525b29 | |
parent | 863d310172074466776c114a201c88b81accb83e (diff) | |
download | w-clock-viewer-237813ae87afb155d4d5105f332f89e8420dd5a0.tar.gz w-clock-viewer-237813ae87afb155d4d5105f332f89e8420dd5a0.tar.bz2 w-clock-viewer-237813ae87afb155d4d5105f332f89e8420dd5a0.zip |
[W-clock-viewer] Show the oprsubmit/tizen/20170406.075032accepted/tizen/unified/20170406.173424
Change-Id: Ibad2402637d9965909391e80a3e7ab29f90c619c
-rw-r--r-- | clock-viewer/data/CMakeLists.txt | 4 | ||||
-rw-r--r-- | clock-viewer/data/clock-viewer.edc | 71 | ||||
-rwxr-xr-x | clock-viewer/data/opr_bg.png | bin | 0 -> 4220 bytes | |||
-rw-r--r-- | clock-viewer/include/clock-viewer-widget.h | 2 | ||||
-rw-r--r-- | clock-viewer/src/clock-viewer-widget.c | 23 | ||||
-rw-r--r-- | clock-viewer/src/clock-viewer.c | 42 |
6 files changed, 140 insertions, 2 deletions
diff --git a/clock-viewer/data/CMakeLists.txt b/clock-viewer/data/CMakeLists.txt index 5d417d2..1570dff 100644 --- a/clock-viewer/data/CMakeLists.txt +++ b/clock-viewer/data/CMakeLists.txt @@ -1,12 +1,12 @@ # install edj ADD_CUSTOM_TARGET(clock-viewer.edj - COMMAND edje_cc -id ${CMAKE_CURRENT_SOURCE_DIR}/images ${EDJE_CFLAGS} + COMMAND edje_cc -id ${CMAKE_CURRENT_SOURCE_DIR} ${EDJE_CFLAGS} ${CMAKE_CURRENT_SOURCE_DIR}/clock-viewer.edc clock-viewer.edj DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/clock-viewer.edc ) ADD_DEPENDENCIES(${PROJECT_NAME} clock-viewer.edj) ADD_CUSTOM_TARGET(default-clock-fallback.edj - COMMAND edje_cc -id ${CMAKE_CURRENT_SOURCE_DIR}/images ${EDJE_CFLAGS} + COMMAND edje_cc -id ${CMAKE_CURRENT_SOURCE_DIR} ${EDJE_CFLAGS} ${CMAKE_CURRENT_SOURCE_DIR}/default-clock-fallback.edc default-clock-fallback.edj DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/default-clock-fallback.edc ) diff --git a/clock-viewer/data/clock-viewer.edc b/clock-viewer/data/clock-viewer.edc index 6654ff5..a5b5804 100644 --- a/clock-viewer/data/clock-viewer.edc +++ b/clock-viewer/data/clock-viewer.edc @@ -26,6 +26,9 @@ } collections { + images { + image: "opr_bg.png" COMP; + } group { name: "layout_manual_clock_position"; parts { @@ -90,6 +93,58 @@ collections { rel2 { relative: 0.98 0.98; to: "bg"; } } } + part { + name: "opr_bg"; + type: SPACER; + description { + state: "default" 0.0; + rel1 { relative: 0.0 0.0; to: "bg"; } + rel2 { relative: 1.0 0.14; to: "bg"; } + } + } + part { + name: "opr_bg_image"; + type: IMAGE; + scale: 1; + description { + state: "default" 0.0; + rel1 { relative: 0.0 0.0; to: "opr_bg"; } + rel2 { relative: 1.0 1.0; to: "opr_bg"; } + image { normal: "opr_bg.png"; } + color: 0 0 0 178; + visible: 0; + } + description { + state: "show" 0.0; + inherit: "default" 0.0; + visible: 1; + } + } + part { + name: "opr_text"; + type: TEXT; + scale: 1; + description { + state: "default" 0.0; + rel1 { relative: 0.0 0.5; to: "opr_bg"; } + rel2 { relative: 1.0 0.5; to: "opr_bg"; } + text { + font: "Tizen:style=Regular"; + text: "Loading"; + size: 18; + align: 0.5 0.5; + min: 0 1; + } + fixed: 0 1; + color: 77 207 255 255; + visible: 0; + } + description { + state: "show" 0.0; + inherit: "default" 0.0; + visible: 1; + } + } } programs { IDLE_CLOCK_ALPM_STATE_CHANGE(elm.swallow.body, default) @@ -101,6 +156,22 @@ collections { IDLE_CLOCK_ALPM_STATE_CHANGE(elm.swallow.body, bottomright) IDLE_CLOCK_ALPM_STATE_CHANGE(elm.swallow.body, bottomleft) IDLE_CLOCK_ALPM_STATE_CHANGE(elm.swallow.body, topleft) + program { + name: "opr,show"; + signal: "opr_info.show"; + source: "clock"; + action: STATE_SET "show" 0.0; + target: "opr_bg_image"; + target: "opr_text"; + } + program { + name: "opr,hide"; + signal: "opr_info.hide"; + source: "clock"; + action: STATE_SET "default" 0.0; + target: "opr_bg_image"; + target: "opr_text"; + } } } } diff --git a/clock-viewer/data/opr_bg.png b/clock-viewer/data/opr_bg.png Binary files differnew file mode 100755 index 0000000..c3c7461 --- /dev/null +++ b/clock-viewer/data/opr_bg.png diff --git a/clock-viewer/include/clock-viewer-widget.h b/clock-viewer/include/clock-viewer-widget.h index 49a9170..e647905 100644 --- a/clock-viewer/include/clock-viewer-widget.h +++ b/clock-viewer/include/clock-viewer-widget.h @@ -28,6 +28,8 @@ extern void clock_viewer_widget_init(void *data, Evas_Object *parent, char *pkgn extern void clock_viewer_widget_fini(void *data); extern void clock_viewer_widget_pause(void); extern void clock_viewer_widget_resume(void); +extern void clock_viewer_widget_show_opr(void); +extern void clock_viewer_widget_hide_opr(void); extern void clock_viewer_default_widget_init(void *data, Evas_Object *parent, char *clock_name); extern void clock_viewer_default_widget_fini(void *data); diff --git a/clock-viewer/src/clock-viewer-widget.c b/clock-viewer/src/clock-viewer-widget.c index fd44338..febddf9 100644 --- a/clock-viewer/src/clock-viewer-widget.c +++ b/clock-viewer/src/clock-viewer-widget.c @@ -101,6 +101,29 @@ static void _watch_removed_cb(void *data, Evas_Object *obj, void *event_info) evas_object_del(clock); } +void clock_viewer_widget_show_opr(void) +{ + char opr_buf[16]; + float opr = 0; + watch_manager_get_opr(&opr); + _DBG("opr show (%.2f)\n", opr); + opr = opr * 100; + + snprintf(opr_buf, sizeof(opr_buf), "OPR %d%%", (int)opr); + elm_object_part_text_set(s_widget_info.layout, "opr_text", opr_buf); + + elm_object_signal_emit(s_widget_info.layout, "opr_info.show", "clock"); + edje_object_message_signal_process(elm_layout_edje_get(s_widget_info.layout)); +} + +void clock_viewer_widget_hide_opr(void) +{ + _DBG("opr hide"); + + elm_object_signal_emit(s_widget_info.layout, "opr_info.hide", "clock"); + edje_object_message_signal_process(elm_layout_edje_get(s_widget_info.layout)); +} + void clock_viewer_default_widget_init(void *data, Evas_Object *parent, char *clock_name) { app_control_h watch_control = NULL; diff --git a/clock-viewer/src/clock-viewer.c b/clock-viewer/src/clock-viewer.c index 2828870..7601419 100644 --- a/clock-viewer/src/clock-viewer.c +++ b/clock-viewer/src/clock-viewer.c @@ -54,6 +54,7 @@ static struct _info { clock_viewer_ambient_type ambient_type; char *clock_pkgname; int resource_id; + int is_opr_show; /* clockend condition check list */ int is_drawdone; @@ -69,6 +70,7 @@ static struct _info { .is_render_added = 0, .is_clock_resumed = 0, .resource_id = 0, + .is_opr_show = 0, .home_clock_visibitity = 0, .clock_visibitity = 0, @@ -168,6 +170,8 @@ static void __clock_viewer_widget_updated_cb(void *data, Evas_Object *obj, void { __clock_viewer_render_pre_cb(data, NULL, NULL); __clock_viewer_render_post_cb(data, NULL, NULL); + if (s_info.is_opr_show) + clock_viewer_widget_show_opr(); } Eina_Bool __clock_viewer_render_first_timer_cb(void *data) @@ -233,6 +237,14 @@ static void __clock_viewer_lcdon_cb(void *data, DBusMessage *msg) } } +static Eina_Bool __opr_timer_cb(void *data) +{ + if (s_info.is_opr_show) { + clock_viewer_widget_show_opr(); + } + return EINA_FALSE; +} + static void __clock_viewer_lcdoff_cb(void *data, DBusMessage *msg) { clock_viewer_s *clock_viewer = (clock_viewer_s *) data; @@ -293,6 +305,11 @@ static void __clock_viewer_lcdoff_cb(void *data, DBusMessage *msg) if (!s_info.clock_visibitity) { clock_viewer_show(clock_viewer, 0); } + + if (s_info.is_opr_show) + ecore_timer_add(1.0f, __opr_timer_cb, NULL); + else + clock_viewer_widget_hide_opr(); } } @@ -350,6 +367,24 @@ static void __clock_viewer_homescreen_clock_visibility_changed_cb(keynode_t *nod s_info.home_clock_visibitity = value; } +static void __clock_viewer_opr_changed_cb(keynode_t *node, void *data) +{ + int ret = 0; + int value = 0; + + ret = vconf_get_bool("db/setting/aod_on_pixel_ratio", &value); + if (ret != 0) { + _ERR("Failed to get aod on pixel ratio[%d]", ret); + } + _DBG("aod on pixel ratio changed [%d]->[%d]", s_info.is_opr_show, value); + s_info.is_opr_show = value; + if (s_info.is_opr_show == 0) { + clock_viewer_widget_hide_opr(); + } else { + clock_viewer_widget_show_opr(); + } +} + static void _clock_viewer_set_current_clock(clock_viewer_s *clock_viewer) { clock_viewer_ambient_type ambient_type; @@ -422,7 +457,14 @@ static void _clock_viewer_register_event(clock_viewer_s *clock_viewer) if (ret != 0) { _ERR("Failed to notify homescreen clock visibility changed event[%d]", ret); } + + ret = vconf_notify_key_changed("db/setting/aod_on_pixel_ratio", __clock_viewer_opr_changed_cb, clock_viewer); + if (ret != 0) { + _ERR("Failed to notify aod_on_pixel_ratio chagned event[%d]", ret); + } + __clock_viewer_homescreen_clock_visibility_changed_cb(NULL, NULL); + __clock_viewer_opr_changed_cb(NULL, NULL); } static void _clock_viewer_unregister_event(clock_viewer_s *clock_viewer) |