diff options
Diffstat (limited to 'viewer/src')
-rwxr-xr-x | viewer/src/msg-ui-viewer-callback.c | 2 | ||||
-rwxr-xr-x | viewer/src/msg-ui-viewer-gadget.c | 35 | ||||
-rwxr-xr-x | viewer/src/msg-ui-viewer-main.c | 143 | ||||
-rwxr-xr-x | viewer/src/msg-ui-viewer-play-view-callback.c | 10 | ||||
-rwxr-xr-x | viewer/src/msg-ui-viewer-play-view.c | 522 |
5 files changed, 495 insertions, 217 deletions
diff --git a/viewer/src/msg-ui-viewer-callback.c b/viewer/src/msg-ui-viewer-callback.c index 2121301..34421e7 100755 --- a/viewer/src/msg-ui-viewer-callback.c +++ b/viewer/src/msg-ui-viewer-callback.c @@ -38,8 +38,6 @@ void msg_ui_viewer_layout_cb(ui_gadget_h ug, enum ug_mode mode, void *priv) return; } - Evas_Object *win = ug_get_window(); - switch (mode) { case UG_MODE_FULLVIEW: evas_object_size_hint_weight_set(base, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); diff --git a/viewer/src/msg-ui-viewer-gadget.c b/viewer/src/msg-ui-viewer-gadget.c index 83949cf..1f51b33 100755 --- a/viewer/src/msg-ui-viewer-gadget.c +++ b/viewer/src/msg-ui-viewer-gadget.c @@ -26,7 +26,6 @@ #include "msg-ui-common-utility.h" #include "msg-ui-viewer-main.h" #include "msg-ui-image-resource.h" -#include <Ecore_X.h> #include <glib.h> #include <vconf.h> #include "msg-ui-common-utility.h" @@ -231,18 +230,6 @@ static void *__msg_ui_viewer_on_create(ui_gadget_h ug, enum ug_mode mode, servic return NULL; } - viewer_main_data->xdisplay = ecore_x_display_get(); - if (viewer_main_data->xdisplay == NULL) { - MSG_UI_DEBUG(MSG_UI_LEVEL_ERR, "ecore_x_display_get() is failed"); - return NULL; - } - - /* key grap setting */ - int use_volume_key = 0; - vconf_get_bool(VCONFKEY_MSG_APP_USE_VOLUME_KEY, &use_volume_key); - if (use_volume_key) - msg_ui_viewer_grab_key_setting(viewer_main_data); - return layout; } @@ -265,8 +252,6 @@ static void __msg_ui_viewer_on_pause(ui_gadget_h ug, service_h svc_handle, void MSG_VIEWER_MAIN_DATA_S *viewer_main_data = (MSG_VIEWER_MAIN_DATA_S *)priv; MSG_UI_DEBUG(MSG_UI_LEVEL_DEBUG, "viewer_main_data->view_mode : %d", viewer_main_data->view_mode); - msg_ui_viewer_ungrab_key_setting(viewer_main_data); - if (viewer_main_data->view_mode == MSG_VIEWER_PLAYER_VIEW) { if (viewer_main_data->player_view) { MSG_UI_DEBUG(MSG_UI_LEVEL_DEBUG, "Player view launch_cmd : %d, cmd_type : %d", viewer_main_data->player_view->launch_cmd, viewer_main_data->player_view->cmd_type); @@ -366,26 +351,6 @@ static void __msg_ui_viewer_on_destroy(ui_gadget_h ug, service_h svc_handle, voi viewer_main_data->layout_main = NULL; } - if (viewer_main_data->volkey_release_handler) { - ecore_event_handler_del(viewer_main_data->volkey_release_handler); - viewer_main_data->volkey_release_handler = NULL; - } - - if (viewer_main_data->vol_up_key_longpress) { - ecore_timer_del(viewer_main_data->vol_up_key_longpress); - viewer_main_data->vol_up_key_longpress = NULL; - } - - if (viewer_main_data->volkey_press_handler) { - ecore_event_handler_del(viewer_main_data->volkey_press_handler); - viewer_main_data->volkey_press_handler = NULL; - } - - if (viewer_main_data->vol_down_key_longpress) { - ecore_timer_del(viewer_main_data->vol_down_key_longpress); - viewer_main_data->vol_down_key_longpress = NULL; - } - /*destroy viewer_main data*/ /*free the drm list*/ if (viewer_main_data->drm_list) { diff --git a/viewer/src/msg-ui-viewer-main.c b/viewer/src/msg-ui-viewer-main.c index f5b9cbc..e0ffbd9 100755 --- a/viewer/src/msg-ui-viewer-main.c +++ b/viewer/src/msg-ui-viewer-main.c @@ -19,7 +19,6 @@ *==================================================================================================*/ #include <msg.h> #include <msg_storage.h> -#include <utilX.h> #include "msg-smil-player-interface.h" #include "msg-ui-common-utility.h" @@ -37,8 +36,6 @@ static MSG_BOOL __msg_ui_viewer_launch_drm_list(void *data); static MSG_BOOL __msg_ui_viewer_launch_play_view(void *data); static MSG_BOOL __msg_ui_viewer_show_play_view(void *data); -static Eina_Bool __msg_ui_viewer_up_key_long_press_cb(void *data); -static Eina_Bool __msg_ui_viewer_down_key_long_press_cb(void *data); /*================================================================================================== * FUNCTION IMPLEMENTATIONS *================================================================================================*/ @@ -62,11 +59,6 @@ void msg_ui_viewer_main_init(void *data) viewer_main_data->player_view = NULL; viewer_main_data->drm_list_view = NULL; viewer_main_data->del_idler = NULL; - viewer_main_data->volkey_release_handler = NULL; - viewer_main_data->volkey_press_handler = NULL; - viewer_main_data->vol_up_key_longpress = NULL; - viewer_main_data->vol_down_key_longpress = NULL; - viewer_main_data->xdisplay = NULL; } MSG_BOOL msg_ui_viewer_launch(void *data) @@ -419,141 +411,6 @@ Evas_Object *msg_ui_viewer_get_bg_layout(void *data) return viewer_main_data->bg; } -void msg_ui_viewer_grab_key_setting(void *data) -{ - MSG_UI_ENTER(MSG_UI_LEVEL_DEBUG); - MSG_UI_RET_IF(MSG_UI_LEVEL_ERR, data == NULL); - MSG_VIEWER_MAIN_DATA_S *viewer_main_data = (MSG_VIEWER_MAIN_DATA_S *)data; - - utilx_grab_key(viewer_main_data->xdisplay, elm_win_xwindow_get(viewer_main_data->main_window), KEY_VOLUMEUP, EXCLUSIVE_GRAB); - utilx_grab_key(viewer_main_data->xdisplay, elm_win_xwindow_get(viewer_main_data->main_window), KEY_VOLUMEDOWN, EXCLUSIVE_GRAB); -} - -void msg_ui_viewer_ungrab_key_setting(void *data) -{ - MSG_UI_ENTER(MSG_UI_LEVEL_DEBUG); - MSG_UI_RET_IF(MSG_UI_LEVEL_ERR, data == NULL); - MSG_VIEWER_MAIN_DATA_S *viewer_main_data = (MSG_VIEWER_MAIN_DATA_S *)data; - - utilx_ungrab_key(viewer_main_data->xdisplay, elm_win_xwindow_get(viewer_main_data->main_window), KEY_VOLUMEUP); - utilx_ungrab_key(viewer_main_data->xdisplay, elm_win_xwindow_get(viewer_main_data->main_window), KEY_VOLUMEDOWN); -} - -Eina_Bool msg_ui_viewer_key_release_cb(void *data, int type, void *event) -{ - MSG_UI_ENTER(MSG_UI_LEVEL_DEBUG); - MSG_UI_RETV_IF(MSG_UI_LEVEL_DEBUG, data == NULL, EINA_FALSE); - MSG_UI_RETV_IF(MSG_UI_LEVEL_DEBUG, event == NULL, EINA_FALSE); - MSG_VIEWER_MAIN_DATA_S *viewer_main_data = (MSG_VIEWER_MAIN_DATA_S *)data; - Ecore_Event_Key *ev = event; - int use_volume_key = false; - - vconf_get_bool(VCONFKEY_MSG_APP_USE_VOLUME_KEY, &use_volume_key); - - if (use_volume_key) { - if (!g_strcmp0(ev->keyname, KEY_VOLUMEUP)) { /* KEY_VOLUMEUP */ - MSG_UI_DEBUG(MSG_UI_LEVEL_DEBUG, "KEY_VOLUMEUP is released"); - - if (viewer_main_data->vol_up_key_longpress) { - ecore_timer_del(viewer_main_data->vol_up_key_longpress); - viewer_main_data->vol_up_key_longpress = NULL; - } - } else if (!g_strcmp0(ev->keyname, KEY_VOLUMEDOWN)) { /* KEY_VOLUMEDOWN */ - MSG_UI_DEBUG(MSG_UI_LEVEL_DEBUG, "KEY_VOLUMEDOWN is released"); - - if (viewer_main_data->vol_down_key_longpress) { - ecore_timer_del(viewer_main_data->vol_down_key_longpress); - viewer_main_data->vol_down_key_longpress = NULL; - } - } else { - MSG_UI_DEBUG(MSG_UI_LEVEL_DEBUG, "key_name is not applicable!"); - } - } else { - MSG_UI_DEBUG(MSG_UI_LEVEL_DEBUG, "Use volume key setting is not activated. Do volume key action"); - } - - return EINA_TRUE; -} - -Eina_Bool msg_ui_viewer_key_press_cb(void *data, int type, void *event) -{ - MSG_UI_ENTER(MSG_UI_LEVEL_DEBUG); - MSG_UI_RETV_IF(MSG_UI_LEVEL_DEBUG, data == NULL, EINA_FALSE); - MSG_UI_RETV_IF(MSG_UI_LEVEL_DEBUG, event == NULL, EINA_FALSE); - MSG_VIEWER_MAIN_DATA_S *viewer_main_data = (MSG_VIEWER_MAIN_DATA_S *)data; - Ecore_Event_Key *ev = event; - int use_volume_key = false; - - vconf_get_bool(VCONFKEY_MSG_APP_USE_VOLUME_KEY, &use_volume_key); - - if (use_volume_key) { - if (!g_strcmp0(ev->keyname, KEY_VOLUMEUP)) { /* KEY_VOLUMEUP */ - MSG_UI_DEBUG(MSG_UI_LEVEL_DEBUG, "KEY_VOLUMEUP is pressed"); - - msg_common_increase_font_size(); - - if (viewer_main_data->player_view && viewer_main_data->player_view->render_entry) { - bool isHelpText = (!viewer_main_data->player_view->smil_eventStatus) ? false : ((viewer_main_data->player_view->smil_eventStatus->isHelpSlide) ? true : false); - MSG_VIEWER_ENTRY_TYPE_E entry_type = (isHelpText) ? MSG_VIEWER_ENTRY_HELP_TEXT : MSG_VIEWER_ENTRY_NORMAL_TEXT; - msg_ui_viewer_set_font_size(viewer_main_data->player_view, entry_type, MSG_VIEWER_FONT_CHANGE_LOAD_SETTING); - } - - viewer_main_data->vol_up_key_longpress = ecore_timer_add(0.3, (Ecore_Task_Cb) __msg_ui_viewer_up_key_long_press_cb, (void *)viewer_main_data); - } else if (!g_strcmp0(ev->keyname, KEY_VOLUMEDOWN)) { /* KEY_VOLUMEDOWN */ - MSG_UI_DEBUG(MSG_UI_LEVEL_DEBUG, "KEY_VOLUMEDOWN is pressed"); - - msg_common_decrease_font_size(); - - if (viewer_main_data->player_view && viewer_main_data->player_view->render_entry) { - bool isHelpText = (!viewer_main_data->player_view->smil_eventStatus) ? false : ((viewer_main_data->player_view->smil_eventStatus->isHelpSlide) ? true : false); - MSG_VIEWER_ENTRY_TYPE_E entry_type = (isHelpText) ? MSG_VIEWER_ENTRY_HELP_TEXT : MSG_VIEWER_ENTRY_NORMAL_TEXT; - msg_ui_viewer_set_font_size(viewer_main_data->player_view, entry_type, MSG_VIEWER_FONT_CHANGE_LOAD_SETTING); - } - - viewer_main_data->vol_down_key_longpress = ecore_timer_add(0.3, (Ecore_Task_Cb) __msg_ui_viewer_down_key_long_press_cb, (void *)viewer_main_data); - } else { - MSG_UI_DEBUG(MSG_UI_LEVEL_DEBUG, "key_name is not applicable!"); - } - } else { - MSG_UI_DEBUG(MSG_UI_LEVEL_DEBUG, "Use volume key setting is not activated. Do volume key action"); - } - - return EINA_TRUE; -} - -static Eina_Bool __msg_ui_viewer_up_key_long_press_cb(void *data) -{ - MSG_UI_ENTER(MSG_UI_LEVEL_DEBUG); - MSG_UI_RETV_IF(MSG_UI_LEVEL_DEBUG, data == NULL, EINA_FALSE); - MSG_VIEWER_MAIN_DATA_S *viewer_main_data = (MSG_VIEWER_MAIN_DATA_S *)data; - - msg_common_increase_font_size(); - - if (viewer_main_data->player_view && viewer_main_data->player_view->render_entry) { - bool isHelpText = (!viewer_main_data->player_view->smil_eventStatus) ? false : ((viewer_main_data->player_view->smil_eventStatus->isHelpSlide) ? true : false); - MSG_VIEWER_ENTRY_TYPE_E entry_type = (isHelpText) ? MSG_VIEWER_ENTRY_HELP_TEXT : MSG_VIEWER_ENTRY_NORMAL_TEXT; - msg_ui_viewer_set_font_size(viewer_main_data->player_view, entry_type, MSG_VIEWER_FONT_CHANGE_LOAD_SETTING); - } - - return EINA_TRUE; -} -static Eina_Bool __msg_ui_viewer_down_key_long_press_cb(void *data) -{ - MSG_UI_ENTER(MSG_UI_LEVEL_DEBUG); - MSG_UI_RETV_IF(MSG_UI_LEVEL_DEBUG, data == NULL, EINA_FALSE); - MSG_VIEWER_MAIN_DATA_S *viewer_main_data = (MSG_VIEWER_MAIN_DATA_S *)data; - - msg_common_decrease_font_size(); - - if (viewer_main_data->player_view && viewer_main_data->player_view->render_entry) { - bool isHelpText = (!viewer_main_data->player_view->smil_eventStatus) ? false : ((viewer_main_data->player_view->smil_eventStatus->isHelpSlide) ? true : false); - MSG_VIEWER_ENTRY_TYPE_E entry_type = (isHelpText) ? MSG_VIEWER_ENTRY_HELP_TEXT : MSG_VIEWER_ENTRY_NORMAL_TEXT; - msg_ui_viewer_set_font_size(viewer_main_data->player_view, entry_type, MSG_VIEWER_FONT_CHANGE_LOAD_SETTING); - } - - return EINA_TRUE; -} - void msg_ui_viewer_change_language(void *data) { MSG_UI_ENTER(MSG_UI_LEVEL_DEBUG); diff --git a/viewer/src/msg-ui-viewer-play-view-callback.c b/viewer/src/msg-ui-viewer-play-view-callback.c index 6b5e3b7..d11a086 100755 --- a/viewer/src/msg-ui-viewer-play-view-callback.c +++ b/viewer/src/msg-ui-viewer-play-view-callback.c @@ -83,6 +83,11 @@ Eina_Bool msg_ui_viewer_mouse_up_cb(void *data, int type, void *event) int screen_width = 0; int rotate = 0; + if (viewer_play_data->drag_volume_slider) { + MSG_UI_DEBUG(MSG_UI_LEVEL_DEBUG, "volume slider is dragging, do not navigate page!"); + return FALSE; + } + play_status = msg_smil_get_current_slide_status(viewer_play_data->SmilHandle); MSG_UI_DEBUG(MSG_UI_LEVEL_DEBUG, "play_status : %d", play_status); @@ -813,7 +818,10 @@ void msg_ui_viewer_volume_button_cb(void *data, Evas_Object * o, const char *emi MSG_UI_RET_IF(MSG_UI_LEVEL_ERR, data == NULL); MSG_PLAY_DATA_S *viewer_play_data = (MSG_PLAY_DATA_S *)data; - syspopup_launch("volume", NULL); + if (!viewer_play_data->volumebar) + msg_ui_viewer_create_volume_bar((void *)viewer_play_data); + else + msg_ui_viewer_destroy_volume_bar((void *)viewer_play_data); //create play controller timer repeatedly msg_ui_viewer_create_play_controller_timer(viewer_play_data); diff --git a/viewer/src/msg-ui-viewer-play-view.c b/viewer/src/msg-ui-viewer-play-view.c index 734b1e5..f756ad3 100755 --- a/viewer/src/msg-ui-viewer-play-view.c +++ b/viewer/src/msg-ui-viewer-play-view.c @@ -28,6 +28,7 @@ #include <msg_transport.h> #include <Ecore_X.h> +#include <utilX.h> #include <glib.h> #include <contacts.h> #include "appsvc.h" @@ -60,6 +61,31 @@ static void __msg_ui_viewer_help_page_gl_del(void *data, Evas_Object *obj); /* message details */ static void __msg_ui_viewer_message_details_popup_close_clicked_cb(void *data, Evas_Object *obj, void *event_info); +/* volume key action related with volume bar */ +static void __msg_ui_viewer_grab_volume_key(void *data); +static void __msg_ui_viewer_ungrab_volume_key(void *data); +static void __msg_ui_viewer_volumebar_volume_up(Evas_Object *obj); +static void __msg_ui_viewer_volumebar_volume_down(Evas_Object *obj); + +/* volume action with volume key and slide callback */ +static Eina_Bool __msg_ui_viewer_volume_key_release_cb(void *data, int type, void *event); +static Eina_Bool __msg_ui_viewer_volume_key_press_cb(void *data, int type, void *event); +static Eina_Bool __msg_ui_viewer_up_key_long_press_cb(void *data); +static Eina_Bool __msg_ui_viewer_down_key_long_press_cb(void *data); +static Eina_Bool __msg_ui_viewer_volumebar_timer_cb(void *data); + +/* volume action related with volumebar slider */ +static void __msg_ui_viewer_volumebar_drag_start_cb(void *data, Evas_Object *obj, void *event_info); +static void __msg_ui_viewer_volumebar_drag_stop_cb(void *data, Evas_Object *obj, void *event_info); +static void __msg_ui_viewer_volumebar_changed_cb(void *data, Evas_Object *obj, void *event_info); +static void __msg_ui_viewer_volumebar_event_cb(void *user_data, Evas_Object *obj, MSG_VIEWER_VOLUME_BAR_EVENT_E event); +static void __msg_ui_viewer_volumebar_event_callback_add(Evas_Object *obj, MSG_VIEWER_VOLUMEBAR_CB event_cb); + +/* volume action related with SOUNDMANAGER */ +static int __msg_ui_viewer_get_max_volume(void); +static int __msg_ui_viewer_get_current_volume(void); +static bool __msg_ui_viewer_set_volume(int volume); + /*================================================================================================== * FUNCTION IMPLEMENTATIONS *================================================================================================*/ @@ -404,6 +430,12 @@ void msg_ui_viewer_play_view_init(void *data) viewer_play_data->title_menu_opened = 0; viewer_play_data->playcontroller_opened = 0; viewer_play_data->auto_resume_state = true; + viewer_play_data->drag_volume_slider = false; + viewer_play_data->volkey_release_handler = NULL; + viewer_play_data->volkey_press_handler = NULL; + viewer_play_data->vol_up_key_longpress = NULL; + viewer_play_data->vol_down_key_longpress = NULL; + viewer_play_data->xdisplay = NULL; viewer_play_data->title_th = elm_theme_new(); elm_theme_ref_set(viewer_play_data->title_th, NULL); @@ -507,7 +539,30 @@ void msg_ui_viewer_destroy_play_view(void *data) viewer_play_data->progress_th = NULL; } - sound_manager_set_volume_key_type(VOLUME_KEY_TYPE_NONE); + if (viewer_play_data->volumebar_timer) { + ecore_timer_del(viewer_play_data->volumebar_timer); + viewer_play_data->volumebar_timer = NULL; + } + + if (viewer_play_data->volkey_release_handler) { + ecore_event_handler_del(viewer_play_data->volkey_release_handler); + viewer_play_data->volkey_release_handler = NULL; + } + + if (viewer_play_data->vol_up_key_longpress) { + ecore_timer_del(viewer_play_data->vol_up_key_longpress); + viewer_play_data->vol_up_key_longpress = NULL; + } + + if (viewer_play_data->volkey_press_handler) { + ecore_event_handler_del(viewer_play_data->volkey_press_handler); + viewer_play_data->volkey_press_handler = NULL; + } + + if (viewer_play_data->vol_down_key_longpress) { + ecore_timer_del(viewer_play_data->vol_down_key_longpress); + viewer_play_data->vol_down_key_longpress = NULL; + } MSG_UI_LEAVE(MSG_UI_LEVEL_DEBUG); } @@ -522,20 +577,14 @@ void msg_ui_viewer_connect_handler(void *data) if (!viewer_play_data->mouse_down_event_handler) viewer_play_data->mouse_down_event_handler = ecore_event_handler_add(ECORE_EVENT_MOUSE_BUTTON_DOWN, msg_ui_viewer_mouse_down_cb, (void *)viewer_play_data); - int use_volume_key = 0; - vconf_get_bool(VCONFKEY_MSG_APP_USE_VOLUME_KEY, &use_volume_key); + __msg_ui_viewer_grab_volume_key(viewer_play_data); - if (use_volume_key && viewer_play_data->viewer_main) { - MSG_VIEWER_MAIN_DATA_S *viewer_main_data = (MSG_VIEWER_MAIN_DATA_S *)viewer_play_data->viewer_main; + /* connect key handler for volume up/down */ + if (!viewer_play_data->volkey_release_handler) + viewer_play_data->volkey_release_handler = ecore_event_handler_add(ECORE_EVENT_KEY_UP, __msg_ui_viewer_volume_key_release_cb, (void *)viewer_play_data); - msg_ui_viewer_grab_key_setting(viewer_main_data); - /* connect key handler for volume up/down */ - if (!viewer_main_data->volkey_release_handler) - viewer_main_data->volkey_release_handler = ecore_event_handler_add(ECORE_EVENT_KEY_UP, msg_ui_viewer_key_release_cb, (void *)viewer_main_data); - - if (!viewer_main_data->volkey_press_handler) - viewer_main_data->volkey_press_handler = ecore_event_handler_add(ECORE_EVENT_KEY_DOWN, msg_ui_viewer_key_press_cb, (void *)viewer_main_data); - } + if (!viewer_play_data->volkey_press_handler) + viewer_play_data->volkey_press_handler = ecore_event_handler_add(ECORE_EVENT_KEY_DOWN, __msg_ui_viewer_volume_key_press_cb, (void *)viewer_play_data); MSG_UI_LEAVE(MSG_UI_LEVEL_DEBUG); } @@ -556,30 +605,27 @@ void msg_ui_viewer_disconnect_handler(void *data) viewer_play_data->mouse_down_event_handler = NULL; } - if (viewer_play_data->viewer_main) { - MSG_VIEWER_MAIN_DATA_S *viewer_main_data = (MSG_VIEWER_MAIN_DATA_S *)viewer_play_data->viewer_main; - if (viewer_main_data->volkey_release_handler) { - ecore_event_handler_del(viewer_main_data->volkey_release_handler); - viewer_main_data->volkey_release_handler = NULL; - } + if (viewer_play_data->volkey_release_handler) { + ecore_event_handler_del(viewer_play_data->volkey_release_handler); + viewer_play_data->volkey_release_handler = NULL; + } - if (viewer_main_data->vol_up_key_longpress) { - ecore_timer_del(viewer_main_data->vol_up_key_longpress); - viewer_main_data->vol_up_key_longpress = NULL; - } + if (viewer_play_data->vol_up_key_longpress) { + ecore_timer_del(viewer_play_data->vol_up_key_longpress); + viewer_play_data->vol_up_key_longpress = NULL; + } - if (viewer_main_data->volkey_press_handler) { - ecore_event_handler_del(viewer_main_data->volkey_press_handler); - viewer_main_data->volkey_press_handler = NULL; - } + if (viewer_play_data->volkey_press_handler) { + ecore_event_handler_del(viewer_play_data->volkey_press_handler); + viewer_play_data->volkey_press_handler = NULL; + } - if (viewer_main_data->vol_down_key_longpress) { - ecore_timer_del(viewer_main_data->vol_down_key_longpress); - viewer_main_data->vol_down_key_longpress = NULL; - } + if (viewer_play_data->vol_down_key_longpress) { + ecore_timer_del(viewer_play_data->vol_down_key_longpress); + viewer_play_data->vol_down_key_longpress = NULL; + } - msg_ui_viewer_ungrab_key_setting(viewer_main_data); - } + __msg_ui_viewer_ungrab_volume_key(viewer_play_data); MSG_UI_LEAVE(MSG_UI_LEVEL_DEBUG); } @@ -595,6 +641,12 @@ MSG_BOOL msg_ui_viewer_create_player_view(MSG_PLAY_DATA_S *data) Evas_Object *layout = NULL; MSG_VIEWER_LAUNCH_VIEW_MODE_E launchmode = MSG_VIEWER_INVALID_MODE; + viewer_play_data->xdisplay = ecore_x_display_get(); + if (viewer_play_data->xdisplay == NULL) { + MSG_UI_DEBUG(MSG_UI_LEVEL_ERR, "ecore_x_display_get() is failed"); + return FALSE; + } + /*get message information like bgcolor, insert and attach count *it should be called before __msg_ui_viewer_create_control_toolbar*/ if (__msg_ui_viewer_play_view_get_message_info(viewer_play_data) == FALSE) @@ -725,9 +777,6 @@ MSG_BOOL msg_ui_viewer_create_player_view(MSG_PLAY_DATA_S *data) } } - /* set volume key type as MEDIA, not SYSTEM */ - sound_manager_set_volume_key_type(VOLUME_KEY_TYPE_MEDIA); - MSG_UI_LEAVE(MSG_UI_LEVEL_DEBUG); return TRUE; } @@ -2455,3 +2504,404 @@ MSG_BOOL msg_ui_viewer_check_address_is_blocked(void *data, char *address, int * return FALSE; } +static void __msg_ui_viewer_grab_volume_key(void *data) +{ + MSG_UI_ENTER(MSG_UI_LEVEL_DEBUG); + MSG_UI_RET_IF(MSG_UI_LEVEL_ERR, data == NULL); + MSG_PLAY_DATA_S *viewer_play_data = (MSG_PLAY_DATA_S *)data; + int ret = 0; + + ret = utilx_grab_key(viewer_play_data->xdisplay, elm_win_xwindow_get(viewer_play_data->main_window), KEY_VOLUMEUP, TOP_POSITION_GRAB); + MSG_UI_DEBUG(MSG_UI_LEVEL_DEBUG, "KEY_VOLUMEUP utilx_grab_key() ret = %d", ret); + + ret = utilx_grab_key(viewer_play_data->xdisplay, elm_win_xwindow_get(viewer_play_data->main_window), KEY_VOLUMEDOWN, TOP_POSITION_GRAB); + MSG_UI_DEBUG(MSG_UI_LEVEL_DEBUG, "KEY_VOLUMEDOWN utilx_grab_key() ret = %d", ret); +} + +static void __msg_ui_viewer_ungrab_volume_key(void *data) +{ + MSG_UI_ENTER(MSG_UI_LEVEL_DEBUG); + MSG_UI_RET_IF(MSG_UI_LEVEL_ERR, data == NULL); + MSG_PLAY_DATA_S *viewer_play_data = (MSG_PLAY_DATA_S *)data; + int ret = 0; + + ret = utilx_ungrab_key(viewer_play_data->xdisplay, elm_win_xwindow_get(viewer_play_data->main_window), KEY_VOLUMEUP); + MSG_UI_DEBUG(MSG_UI_LEVEL_DEBUG, "KEY_VOLUMEUP utilx_ungrab_key() ret = %d", ret); + + ret = utilx_ungrab_key(viewer_play_data->xdisplay, elm_win_xwindow_get(viewer_play_data->main_window), KEY_VOLUMEDOWN); + MSG_UI_DEBUG(MSG_UI_LEVEL_DEBUG, "KEY_VOLUMEDOWN utilx_ungrab_key() ret = %d", ret); +} + +static Eina_Bool __msg_ui_viewer_up_key_long_press_cb(void *data) +{ + MSG_UI_ENTER(MSG_UI_LEVEL_DEBUG); + MSG_UI_RETV_IF(MSG_UI_LEVEL_DEBUG, data == NULL, EINA_FALSE); + MSG_PLAY_DATA_S *viewer_play_data = (MSG_PLAY_DATA_S *)data; + int use_volume_key = false; + + vconf_get_bool(VCONFKEY_MSG_APP_USE_VOLUME_KEY, &use_volume_key); + + if (use_volume_key) { + msg_common_increase_font_size(); + + if (viewer_play_data->render_entry) { + SMIL_SLIDE_INFO_S *slide = msg_smil_get_current_slide_info(viewer_play_data->SmilHandle); + MSG_VIEWER_ENTRY_TYPE_E entry_type = (slide && slide->pageInfo && slide->pageInfo->isHelpPage) ? MSG_VIEWER_ENTRY_HELP_TEXT : MSG_VIEWER_ENTRY_NORMAL_TEXT; + msg_ui_viewer_set_font_size(viewer_play_data, entry_type, MSG_VIEWER_FONT_CHANGE_LOAD_SETTING); + } + } else { + __msg_ui_viewer_volumebar_volume_up(viewer_play_data->volume_slider); + } + + return EINA_TRUE; +} + +static Eina_Bool __msg_ui_viewer_down_key_long_press_cb(void *data) +{ + MSG_UI_ENTER(MSG_UI_LEVEL_DEBUG); + MSG_UI_RETV_IF(MSG_UI_LEVEL_DEBUG, data == NULL, EINA_FALSE); + MSG_PLAY_DATA_S *viewer_play_data = (MSG_PLAY_DATA_S *)data; + int use_volume_key = false; + + vconf_get_bool(VCONFKEY_MSG_APP_USE_VOLUME_KEY, &use_volume_key); + + if (use_volume_key) { + msg_common_decrease_font_size(); + + if (viewer_play_data->render_entry) { + SMIL_SLIDE_INFO_S *slide = msg_smil_get_current_slide_info(viewer_play_data->SmilHandle); + MSG_VIEWER_ENTRY_TYPE_E entry_type = (slide && slide->pageInfo && slide->pageInfo->isHelpPage) ? MSG_VIEWER_ENTRY_HELP_TEXT : MSG_VIEWER_ENTRY_NORMAL_TEXT; + msg_ui_viewer_set_font_size(viewer_play_data, entry_type, MSG_VIEWER_FONT_CHANGE_LOAD_SETTING); + } + } else { + __msg_ui_viewer_volumebar_volume_down(viewer_play_data->volume_slider); + } + + return EINA_TRUE; +} + +static Eina_Bool __msg_ui_viewer_volume_key_release_cb(void *data, int type, void *event) +{ + MSG_UI_ENTER(MSG_UI_LEVEL_DEBUG); + MSG_UI_RETV_IF(MSG_UI_LEVEL_DEBUG, data == NULL, EINA_FALSE); + MSG_UI_RETV_IF(MSG_UI_LEVEL_DEBUG, event == NULL, EINA_FALSE); + MSG_PLAY_DATA_S *viewer_play_data = (MSG_PLAY_DATA_S *)data; + Ecore_Event_Key *ev = event; + int use_volume_key = false; + + vconf_get_bool(VCONFKEY_MSG_APP_USE_VOLUME_KEY, &use_volume_key); + + if (!use_volume_key) { + if (viewer_play_data->volumebar_timer) { + ecore_timer_del(viewer_play_data->volumebar_timer); + viewer_play_data->volumebar_timer = NULL; + } + viewer_play_data->volumebar_timer = ecore_timer_add(VIEWER_VOLUMEBAR_LIFETIME, __msg_ui_viewer_volumebar_timer_cb, viewer_play_data); + } + + if (!g_strcmp0(ev->keyname, KEY_VOLUMEUP)) { /* KEY_VOLUMEUP */ + MSG_UI_DEBUG(MSG_UI_LEVEL_DEBUG, "KEY_VOLUMEUP is released"); + + if (viewer_play_data->vol_up_key_longpress) { + ecore_timer_del(viewer_play_data->vol_up_key_longpress); + viewer_play_data->vol_up_key_longpress = NULL; + } + } else if (!g_strcmp0(ev->keyname, KEY_VOLUMEDOWN)) { /* KEY_VOLUMEDOWN */ + MSG_UI_DEBUG(MSG_UI_LEVEL_DEBUG, "KEY_VOLUMEDOWN is released"); + + if (viewer_play_data->vol_down_key_longpress) { + ecore_timer_del(viewer_play_data->vol_down_key_longpress); + viewer_play_data->vol_down_key_longpress = NULL; + } + } else { + MSG_UI_DEBUG(MSG_UI_LEVEL_DEBUG, "key_name is not applicable!"); + } + + return EINA_TRUE; +} + +static Eina_Bool __msg_ui_viewer_volume_key_press_cb(void *data, int type, void *event) +{ + MSG_UI_ENTER(MSG_UI_LEVEL_DEBUG); + MSG_UI_RETV_IF(MSG_UI_LEVEL_DEBUG, data == NULL, EINA_FALSE); + MSG_UI_RETV_IF(MSG_UI_LEVEL_DEBUG, event == NULL, EINA_FALSE); + MSG_PLAY_DATA_S *viewer_play_data = (MSG_PLAY_DATA_S *)data; + Ecore_Event_Key *ev = event; + int use_volume_key = false; + + vconf_get_bool(VCONFKEY_MSG_APP_USE_VOLUME_KEY, &use_volume_key); + + if (use_volume_key) { + if (!g_strcmp0(ev->keyname, KEY_VOLUMEUP)) { /* KEY_VOLUMEUP */ + MSG_UI_DEBUG(MSG_UI_LEVEL_DEBUG, "KEY_VOLUMEUP is pressed"); + + msg_common_increase_font_size(); + + if (viewer_play_data->render_entry) { + SMIL_SLIDE_INFO_S *slide = msg_smil_get_current_slide_info(viewer_play_data->SmilHandle); + MSG_VIEWER_ENTRY_TYPE_E entry_type = (slide && slide->pageInfo && slide->pageInfo->isHelpPage) ? MSG_VIEWER_ENTRY_HELP_TEXT : MSG_VIEWER_ENTRY_NORMAL_TEXT; + msg_ui_viewer_set_font_size(viewer_play_data, entry_type, MSG_VIEWER_FONT_CHANGE_LOAD_SETTING); + } + + viewer_play_data->vol_up_key_longpress = ecore_timer_add(VIEWER_VOLUME_KEY_FONT_LONG_PRESS_TIME, (Ecore_Task_Cb) __msg_ui_viewer_up_key_long_press_cb, (void *)viewer_play_data); + } else if (!g_strcmp0(ev->keyname, KEY_VOLUMEDOWN)) { /* KEY_VOLUMEDOWN */ + MSG_UI_DEBUG(MSG_UI_LEVEL_DEBUG, "KEY_VOLUMEDOWN is pressed"); + + msg_common_decrease_font_size(); + + if (viewer_play_data->render_entry) { + SMIL_SLIDE_INFO_S *slide = msg_smil_get_current_slide_info(viewer_play_data->SmilHandle); + MSG_VIEWER_ENTRY_TYPE_E entry_type = (slide && slide->pageInfo && slide->pageInfo->isHelpPage) ? MSG_VIEWER_ENTRY_HELP_TEXT : MSG_VIEWER_ENTRY_NORMAL_TEXT; + msg_ui_viewer_set_font_size(viewer_play_data, entry_type, MSG_VIEWER_FONT_CHANGE_LOAD_SETTING); + } + + viewer_play_data->vol_down_key_longpress = ecore_timer_add(VIEWER_VOLUME_KEY_FONT_LONG_PRESS_TIME, (Ecore_Task_Cb) __msg_ui_viewer_down_key_long_press_cb, (void *)viewer_play_data); + } else { + MSG_UI_DEBUG(MSG_UI_LEVEL_DEBUG, "key_name is not applicable!"); + } + } else { + MSG_UI_DEBUG(MSG_UI_LEVEL_DEBUG, "Use volume key setting is not activated. Do volume key action"); + + if (!viewer_play_data->volumebar || !viewer_play_data->volume_slider) + msg_ui_viewer_create_volume_bar(viewer_play_data); + + if (!g_strcmp0(ev->keyname, KEY_VOLUMEUP)) { /* KEY_VOLUMEUP */ + if (viewer_play_data->volumebar_timer) { + ecore_timer_del(viewer_play_data->volumebar_timer); + viewer_play_data->volumebar_timer = NULL; + } + __msg_ui_viewer_volumebar_volume_up(viewer_play_data->volume_slider); + + viewer_play_data->vol_up_key_longpress = ecore_timer_add(VIEWER_VOLUME_KEY_VOLUME_LONG_PRESS_TIME, (Ecore_Task_Cb) __msg_ui_viewer_up_key_long_press_cb, (void *)viewer_play_data); + } else if (!g_strcmp0(ev->keyname, KEY_VOLUMEDOWN)) { /* KEY_VOLUMEDOWN */ + if (viewer_play_data->volumebar_timer) { + ecore_timer_del(viewer_play_data->volumebar_timer); + viewer_play_data->volumebar_timer = NULL; + } + __msg_ui_viewer_volumebar_volume_down(viewer_play_data->volume_slider); + + viewer_play_data->vol_down_key_longpress = ecore_timer_add(VIEWER_VOLUME_KEY_VOLUME_LONG_PRESS_TIME, (Ecore_Task_Cb) __msg_ui_viewer_down_key_long_press_cb, (void *)viewer_play_data); + } else { + MSG_UI_DEBUG(MSG_UI_LEVEL_DEBUG, "key_name is not applicable!"); + } + } + + return EINA_TRUE; +} + +void msg_ui_viewer_create_volume_bar(void *data) +{ + MSG_UI_ENTER(MSG_UI_LEVEL_DEBUG); + MSG_UI_RET_IF(MSG_UI_LEVEL_ERR, data == NULL); + MSG_PLAY_DATA_S *viewer_play_data = (MSG_PLAY_DATA_S *)data; + + Evas_Object *layout = NULL; + Evas_Object *slider = NULL; + Evas_Object *icon_start = NULL; + Evas_Object *icon_end = NULL; + + layout = elm_layout_add(viewer_play_data->play_layout); + elm_layout_file_set(layout, MSG_VIEWER_THEME, "volume_controller"); + evas_object_size_hint_weight_set(layout, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); + evas_object_show(layout); + + slider = elm_slider_add(layout); + elm_slider_indicator_show_set(slider, EINA_TRUE); + evas_object_size_hint_weight_set(slider, EVAS_HINT_EXPAND, 0.0); + evas_object_size_hint_align_set(slider, EVAS_HINT_FILL, 0.5); + elm_slider_indicator_format_set(slider, "%1.0f"); + evas_object_show(slider); + + icon_start = elm_icon_add(layout); + elm_image_file_set(icon_start, MSG_IMAGES_EDJ, MSG_VIEWER_VOLUME_MIN); + evas_object_size_hint_aspect_set(icon_start, EVAS_ASPECT_CONTROL_VERTICAL, 1, 1); + + icon_end = elm_icon_add(layout); + elm_image_file_set(icon_end, MSG_IMAGES_EDJ, MSG_VIEWER_VOLUME_MAX); + evas_object_size_hint_aspect_set(icon_end, EVAS_ASPECT_CONTROL_VERTICAL, 1, 1); + + elm_object_content_set(slider,icon_start); + elm_object_part_content_set(slider, "end", icon_end); + + elm_slider_min_max_set(slider, 0, __msg_ui_viewer_get_max_volume()); + elm_slider_value_set(slider, __msg_ui_viewer_get_current_volume()); + + elm_object_part_content_set(layout, "slider", slider); + + viewer_play_data->volumebar = layout; + viewer_play_data->volume_slider = slider; + elm_object_part_content_set(viewer_play_data->play_layout, "volume_layout", viewer_play_data->volumebar); + + evas_object_data_set(slider, "viewer_play_data", viewer_play_data); + + __msg_ui_viewer_volumebar_event_callback_add(slider, __msg_ui_viewer_volumebar_event_cb); + + evas_object_smart_callback_add(slider, "slider,drag,start", __msg_ui_viewer_volumebar_drag_start_cb, viewer_play_data); + evas_object_smart_callback_add(slider, "slider,drag,stop", __msg_ui_viewer_volumebar_drag_stop_cb, viewer_play_data); + evas_object_smart_callback_add(slider, "changed", __msg_ui_viewer_volumebar_changed_cb, viewer_play_data); + + //create timer + if (viewer_play_data->volumebar_timer) { + ecore_timer_del(viewer_play_data->volumebar_timer); + viewer_play_data->volumebar_timer = NULL; + } + viewer_play_data->volumebar_timer = ecore_timer_add(VIEWER_VOLUMEBAR_LIFETIME, __msg_ui_viewer_volumebar_timer_cb, viewer_play_data); + +} + +void msg_ui_viewer_destroy_volume_bar(void *data) +{ + MSG_UI_ENTER(MSG_UI_LEVEL_DEBUG); + MSG_UI_RET_IF(MSG_UI_LEVEL_ERR, data == NULL); + MSG_PLAY_DATA_S *viewer_play_data = (MSG_PLAY_DATA_S *)data; + + if (viewer_play_data->volumebar_timer) { + ecore_timer_del(viewer_play_data->volumebar_timer); + viewer_play_data->volumebar_timer = NULL; + } + + elm_object_part_content_unset(viewer_play_data->play_layout, "volume_layout"); + evas_object_del(viewer_play_data->volumebar); + viewer_play_data->volumebar = NULL; +} + +static Eina_Bool __msg_ui_viewer_volumebar_timer_cb(void *data) +{ + MSG_UI_ENTER(MSG_UI_LEVEL_DEBUG); + MSG_UI_RETVM_IF(MSG_UI_LEVEL_ERR, data == NULL, EINA_FALSE, "data is NULL"); + MSG_PLAY_DATA_S *viewer_play_data = (MSG_PLAY_DATA_S *)data; + + elm_object_part_content_unset(viewer_play_data->play_layout, "volume_layout"); + evas_object_del(viewer_play_data->volumebar); + viewer_play_data->volumebar = NULL; + + return ECORE_CALLBACK_CANCEL; +} + +static void __msg_ui_viewer_volumebar_drag_start_cb(void *data, Evas_Object *obj, void *event_info) +{ + MSG_UI_ENTER(MSG_UI_LEVEL_DEBUG); + MSG_UI_RETM_IF(MSG_UI_LEVEL_ERR, data == NULL, "data is NULL"); + MSG_PLAY_DATA_S *viewer_play_data = (MSG_PLAY_DATA_S *)data; + + if (viewer_play_data->volumebar_event_cb) + viewer_play_data->volumebar_event_cb(viewer_play_data, obj, MSG_VIEWER_VOLUME_EVENT_DRAG_START); + + viewer_play_data->drag_volume_slider = true; +} + +static void __msg_ui_viewer_volumebar_drag_stop_cb(void *data, Evas_Object *obj, void *event_info) +{ + MSG_UI_ENTER(MSG_UI_LEVEL_DEBUG); + MSG_UI_RETM_IF(MSG_UI_LEVEL_ERR, data == NULL, "data is NULL"); + MSG_PLAY_DATA_S *viewer_play_data = (MSG_PLAY_DATA_S *)data; + + if (viewer_play_data->volumebar_event_cb) + viewer_play_data->volumebar_event_cb(viewer_play_data, obj, MSG_VIEWER_VOLUME_EVENT_DRAG_STOP); + + viewer_play_data->drag_volume_slider = false; +} + +static void __msg_ui_viewer_volumebar_changed_cb(void *data, Evas_Object *obj, void *event_info) +{ + MSG_UI_ENTER(MSG_UI_LEVEL_DEBUG); + double val = elm_slider_value_get(obj); + + if ((int)val != __msg_ui_viewer_get_current_volume()) + __msg_ui_viewer_set_volume((int)val); +} + +static void __msg_ui_viewer_volumebar_event_cb(void *user_data, Evas_Object *obj, MSG_VIEWER_VOLUME_BAR_EVENT_E event) +{ + MSG_UI_ENTER(MSG_UI_LEVEL_DEBUG); + MSG_UI_RETM_IF(MSG_UI_LEVEL_ERR, user_data == NULL, "data is NULL"); + MSG_PLAY_DATA_S *viewer_play_data = (MSG_PLAY_DATA_S *)user_data; + + if (event == MSG_VIEWER_VOLUME_EVENT_DRAG_START) { + if (viewer_play_data->volumebar_timer) { + ecore_timer_del(viewer_play_data->volumebar_timer); + viewer_play_data->volumebar_timer = NULL; + } + } else if (event == MSG_VIEWER_VOLUME_EVENT_DRAG_STOP) { + viewer_play_data->volumebar_timer = ecore_timer_add(VIEWER_VOLUMEBAR_LIFETIME, __msg_ui_viewer_volumebar_timer_cb, viewer_play_data); + } +} + +static void __msg_ui_viewer_volumebar_event_callback_add(Evas_Object *obj, MSG_VIEWER_VOLUMEBAR_CB event_cb) +{ + MSG_UI_ENTER(MSG_UI_LEVEL_DEBUG); + MSG_UI_RET_IF(MSG_UI_LEVEL_ERR, obj == NULL); + MSG_PLAY_DATA_S *viewer_play_data = evas_object_data_get(obj, "viewer_play_data"); + + viewer_play_data->volumebar_event_cb = event_cb; +} + +static void __msg_ui_viewer_volumebar_volume_up(Evas_Object *obj) +{ + MSG_UI_ENTER(MSG_UI_LEVEL_DEBUG); + double max = 0.0; + elm_slider_min_max_get(obj, NULL, &max); + + double current = elm_slider_value_get(obj); + + if (current < max) + elm_slider_value_set(obj, (current + 1.0)); + + evas_object_smart_callback_call(obj, "changed", NULL); +} + +static void __msg_ui_viewer_volumebar_volume_down(Evas_Object *obj) +{ + MSG_UI_ENTER(MSG_UI_LEVEL_DEBUG); + double min = 0.0; + elm_slider_min_max_get(obj, &min, NULL); + + double current = elm_slider_value_get(obj); + + if (current > min) + elm_slider_value_set(obj, (current - 1.0)); + + evas_object_smart_callback_call(obj, "changed", NULL); +} + +static int __msg_ui_viewer_get_max_volume(void) +{ + MSG_UI_ENTER(MSG_UI_LEVEL_DEBUG); + int max_vol = 0; + + int ret = sound_manager_get_max_volume(SOUND_TYPE_MEDIA, &max_vol); + if (ret != SOUND_MANAGER_ERROR_NONE) { + MSG_UI_DEBUG(MSG_UI_LEVEL_ERR,"sound_manager_get_max_volume().. [0x%x]", ret); + return -1; + } + + return max_vol; +} + +static int __msg_ui_viewer_get_current_volume(void) +{ + MSG_UI_ENTER(MSG_UI_LEVEL_DEBUG); + int current = 0; + + int ret = sound_manager_get_volume(SOUND_TYPE_MEDIA, ¤t); + if (ret != SOUND_MANAGER_ERROR_NONE) { + MSG_UI_DEBUG(MSG_UI_LEVEL_ERR,"sound_manager_get_max_volume().. [0x%x]", ret); + return -1; + } + + return current; +} + +static bool __msg_ui_viewer_set_volume(int volume) +{ + MSG_UI_ENTER(MSG_UI_LEVEL_DEBUG); + int ret = sound_manager_set_volume(SOUND_TYPE_MEDIA, volume); + if (ret != SOUND_MANAGER_ERROR_NONE) { + MSG_UI_DEBUG(MSG_UI_LEVEL_ERR,"sound_manager_set_volume().. [0x%x]", ret); + return false; + } + + MSG_UI_DEBUG(MSG_UI_LEVEL_DEBUG,"set volume value = %d", volume); + + return true; +} |