{
int type = (int) data;
- if (type == TYPE_ON) {
- _D("EXIT on BOOTING");
- if (vconf_set_int(VCONFKEY_BOOT_ANIMATION_FINISHED, 1) != 0) {
- _E("Failed to set finished set");
- }
- elm_exit();
- } else {
- /* Delete Previous Layout */
+ if (type == TYPE_OFF) {
_D("EXIT on SHUTDOWN");
+ /* Delete Previous Layout */
if (s_animation.layout) evas_object_del(s_animation.layout);
Evas_Object *disp_block = NULL;
elm_win_resize_object_add(s_animation.win, disp_block);
evas_object_color_set(disp_block, 0, 0, 0, 255);
evas_object_show(disp_block);
+ } else {
+ _D("EXIT on BOOTING");
+ if (vconf_set_int(VCONFKEY_BOOT_ANIMATION_FINISHED, 1) != 0) {
+ _E("Failed to set finished set");
+ }
+ elm_exit();
}
return ECORE_CALLBACK_CANCEL;
}
-static void __set_poweroff_message(void)
-{
- Evas_Coord w;
- Evas_Coord h;
-
- evas_object_size_hint_weight_set(s_animation.txt, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
- evas_object_size_hint_fill_set(s_animation.txt, EVAS_HINT_FILL, EVAS_HINT_FILL);
- evas_object_resize(s_animation.txt, s_animation.w, s_animation.h);
- evas_object_color_set(s_animation.txt, 255, 255, 255, 255);
- evas_object_text_font_set(s_animation.txt, "SLP:style=medium", 30);
- evas_object_geometry_get(s_animation.txt, NULL, NULL, &w, &h);
- evas_object_move(s_animation.txt, (s_animation.w - w) >> 1, (s_animation.h - h) >> 1);
- evas_object_show(s_animation.txt);
-}
-
-static void __edje_cb(void *d, Evas_Object * obj, const char *e, const char *s)
+static void __animation_finished_cb(void *d, Evas_Object * obj, const char *e, const char *s)
{
- if (s_animation.state == TYPE_OFF || s_animation.state == TYPE_OFF_WITH_MSG) {
+ if (s_animation.state == TYPE_OFF) {
_D("TYPE OFF");
if (vconf_set_int(VCONFKEY_BOOT_ANIMATION_FINISHED, 1) != 0) {
_E("Failed to set finished set");
}
- if (s_animation.txt) {
- __set_poweroff_message();
- }
ecore_timer_add(1, __end_cb, (void *)TYPE_OFF);
} else {
_D("TYPE_ON");
}
}
-static Eina_Bool __layout_file_set(Evas_Object *layout, int state)
+static Eina_Bool __layout_file_set(Evas_Object *layout, const char *file_name, int state)
{
- char file_name[1024];
- char *on_off;
- int ret;
-
- if (state == TYPE_ON) {
- snprintf(file_name, sizeof(file_name), FILE_PATH"%dx%d_PowerOn.edj", s_animation.w, s_animation.h);
- on_off = GRP_ON;
- } else {
- snprintf(file_name, sizeof(file_name), FILE_PATH"%dx%d_PowerOff.edj", s_animation.w, s_animation.h);
- on_off = GRP_OFF;
- }
- _D("File name for Animation is: %s", file_name);
-
- ret = access(file_name, 0);
- if (ret == 0) {
- _D("This Resolution[%d]x[%d] is supported !!", s_animation.w, s_animation.h);
- if (!elm_layout_file_set(layout, file_name, on_off)) return EINA_FALSE;
+ if (state == TYPE_OFF) {
+ if (!elm_layout_file_set(layout, file_name, GRP_OFF)) {
+ return EINA_FALSE;
+ }
} else {
- _E("This Resolution[%d]x[%d] is STRANGE !!, Set default image '720x1280'", s_animation.w, s_animation.h);
- if (state == TYPE_ON) {
- if (!elm_layout_file_set(layout, DEFAULT_ON, on_off)) return EINA_FALSE;
- } else {
- if (!elm_layout_file_set(layout, DEFAULT_OFF, on_off)) return EINA_FALSE;
+ if (!elm_layout_file_set(layout, file_name, GRP_ON)) {
+ return EINA_FALSE;
}
}
- return EINA_TRUE;
-}
-
-static Evas_Object *__create_layout(const char *msg)
-{
- Eina_Bool ret;
- Evas_Object *layout = elm_layout_add(s_animation.win);
- if (!layout) {
- _E("Failed to create layout");
- return NULL;
- }
-
- ret = __layout_file_set(layout, s_animation.state);
- if (ret != EINA_TRUE) {
- _E("Failed to set layout file");
- evas_object_del(layout);
- return NULL;
- }
-
- evas_object_size_hint_weight_set(layout, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
- elm_win_resize_object_add(s_animation.win, layout);
- edje_object_signal_callback_add(elm_layout_edje_get(layout), "end", "animation", __edje_cb, NULL);
evas_object_show(layout);
- if (msg) {
- if (!s_animation.txt) {
- s_animation.txt = evas_object_text_add(evas_object_evas_get(s_animation.win));
- if (!s_animation.txt) {
- _E("Failed to add text");
- evas_object_del(layout);
- return NULL;
- }
- }
-
- evas_object_text_text_set(s_animation.txt, msg);
- evas_object_hide(s_animation.txt);
- }
-
- return layout;
+ return EINA_TRUE;
}
static void __fini_layout(void)
_D("Create Window");
printf("Create Window\n");
- int x, y = 0;
Evas_Object *win;
win = elm_win_add(NULL, "BOOT_ANIMATION", ELM_WIN_NOTIFICATION);
- elm_win_aux_hint_add(win, "wm.comp.win.always.selective.mode", "1");
-
- elm_win_role_set(win, "alert");
if (!win) {
_E("Failed to create a new window");
printf("Failed to create a new window\n");
return NULL;
}
- if (s_animation.state == TYPE_OFF || s_animation.state == TYPE_OFF_WITH_MSG) {
- _D("We are turning off the Tizen");
- }
+ elm_win_aux_hint_add(win, "wm.comp.win.always.selective.mode", "1");
+ elm_win_role_set(win, "alert");
efl_util_set_notification_window_level(win, EFL_UTIL_NOTIFICATION_LEVEL_HIGH);
evas_object_smart_callback_add(win, "delete-request", win_del, NULL);
- elm_win_screen_size_get(win, &x, &y, &s_animation.w, &s_animation.h);
- _D("Window size is x: %d, y: %d, w: %d, h: %d", x, y, s_animation.w, s_animation.h);
- elm_win_borderless_set(win, 1);
+ elm_win_screen_size_get(win, NULL, NULL, &s_animation.w, &s_animation.h);
+ elm_win_borderless_set(win, EINA_TRUE);
elm_win_indicator_mode_set(win, ELM_WIN_INDICATOR_HIDE);
evas_object_move(win, 0, 0);
evas_object_show(win);
return win;
}
-int init_animation(int state, const char *msg)
+static char *__get_layout_file_name(int state, int w, int h)
+{
+ char file_name[1024];
+ int ret = 0;
+
+ if (state == TYPE_OFF) {
+ snprintf(file_name, sizeof(file_name), FILE_PATH"%dx%d_PowerOff.edj", s_animation.w, s_animation.h);
+ } else {
+ snprintf(file_name, sizeof(file_name), FILE_PATH"%dx%d_PowerOn.edj", s_animation.w, s_animation.h);
+ }
+ _D("File name for Animation is: %s", file_name);
+
+ ret = access(file_name, 0);
+ if (ret == 0) {
+ } else {
+ _W("There's no Image same with [%s], So set Default[720x1280] image", file_name);
+ if (state == TYPE_OFF) {
+ snprintf(file_name, sizeof(file_name), "%s", DEFAULT_OFF);
+ } else {
+ snprintf(file_name, sizeof(file_name), "%s", DEFAULT_ON);
+ }
+
+ ret = access(file_name, 0);
+ if (ret) {
+ _E("There's no Image file[%s] on target", file_name);
+ return NULL;
+ }
+ }
+
+ return strdup(file_name);
+}
+
+Eina_Bool __is_layout_file_exist(const char *file_name)
+{
+ int ret = 0;
+
+ ret = access(file_name, 0);
+ if (ret == 0) {
+ return EINA_TRUE;
+ } else {
+ return EINA_FALSE;
+ }
+}
+static Evas_Object *__create_layout(Evas_Object *win)
+{
+ Evas_Object *layout = elm_layout_add(win);
+ if (!layout) {
+ _E("Failed to create layout");
+ return NULL;
+ }
+ evas_object_size_hint_weight_set(layout, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
+ elm_win_resize_object_add(s_animation.win, layout);
+ elm_layout_signal_callback_add(layout, "end", "animation", __animation_finished_cb, NULL);
+
+ return layout;
+}
+
+int init_animation(int state)
{
_D("Init animation");
printf("Init animation\n");
return EXIT_FAILURE;
}
- s_animation.layout = __create_layout(msg);
+ s_animation.layout = __create_layout(s_animation.win);
if (!s_animation.layout) {
_E("Failed to create layout");
- if (s_animation.txt) {
- evas_object_del(s_animation.txt);
- }
evas_object_del(s_animation.win);
return EXIT_FAILURE;
}
+ char *layout_file_name = NULL;
+ layout_file_name = __get_layout_file_name(state, s_animation.w, s_animation.h);
+ if (!layout_file_name) {
+ _E("Failed to get layout file name");
+ return EXIT_FAILURE;
+ }
+
+ if (!__is_layout_file_exist(layout_file_name)) {
+ _E("This file is not exist");
+ free(layout_file_name);
+ return EXIT_FAILURE;
+ }
+
+ if (!__layout_file_set(s_animation.layout, layout_file_name, state)) {
+ _E("Failed to set layaout file");
+ free(layout_file_name);
+ return EXIT_FAILURE;
+ }
+
+ free(layout_file_name);
+
return EXIT_SUCCESS;
}
return EXIT_SUCCESS;
}
+#include "test.h"
#if TEST_MODE
Evas_Object *__t_create_window(void)
{
return __create_window();
}
+
+Evas_Object *__t_create_layout(Evas_Object *win)
+{
+ return __create_layout(win);
+}
+
+char *__t_get_layout_file_name(int state, int w, int h)
+{
+ return __get_layout_file_name(state, w, h);
+}
+
+Eina_Bool __t_layout_file_set(Evas_Object *layout, const char *layout_file_name, int state)
+{
+ return __layout_file_set(layout, layout_file_name, state);
+}
+
+Eina_Bool __t_is_layout_file_exist(const char *file_name)
+{
+ return __is_layout_file_exist(file_name);
+}
#endif