diff options
author | aman.jeph <aman.jeph@samsung.com> | 2020-06-23 16:18:35 +0530 |
---|---|---|
committer | aman.jeph <aman.jeph@samsung.com> | 2020-06-23 23:58:02 +0530 |
commit | 810190a537059c36c1820a387c0ddccf13ea3515 (patch) | |
tree | bb9a925d9f134b78679feacea847280356b7b03d | |
parent | 4506b2bebb647593c1bd9bd1656cba47fc3d5157 (diff) | |
download | video-player-810190a537059c36c1820a387c0ddccf13ea3515.tar.gz video-player-810190a537059c36c1820a387c0ddccf13ea3515.tar.bz2 video-player-810190a537059c36c1820a387c0ddccf13ea3515.zip |
Implemented folder view, folder-item-view and search-view according to new gui.submit/tizen/20200624.042510
Change-Id: I31fa2054047be20f11a02d4cd65e1424be813b78
Signed-off-by: aman.jeph <aman.jeph@samsung.com>
-rwxr-xr-x | include/view/mp-video-list-view-folder.h | 1 | ||||
-rwxr-xr-x | include/view/mp-video-list-view-item-of-folder.h | 2 | ||||
-rwxr-xr-x | include/view/mp-video-list-view-main.h | 7 | ||||
-rwxr-xr-x | include/view/mp-video-search-view.h | 2 | ||||
-rwxr-xr-x | include/widget/mp-footer-toolbar.h | 2 | ||||
-rwxr-xr-x | res/edje/vp-searchbar.edc | 26 | ||||
-rwxr-xr-x | res/edje/vp-videolist-custom-gengrid.edc | 19 | ||||
-rwxr-xr-x | src/view/mp-video-list-view-folder.c | 674 | ||||
-rwxr-xr-x | src/view/mp-video-list-view-item-of-folder.c | 1165 | ||||
-rwxr-xr-x | src/view/mp-video-list-view-main.c | 216 | ||||
-rwxr-xr-x | src/view/mp-video-list-view-thumbnail.c | 164 | ||||
-rwxr-xr-x | src/view/mp-video-search-view.c | 1277 | ||||
-rwxr-xr-x | src/viewMgr/videos-view-mgr.c | 3 | ||||
-rwxr-xr-x | src/widget/mp-footer-toolbar.c | 291 |
14 files changed, 1133 insertions, 2716 deletions
diff --git a/include/view/mp-video-list-view-folder.h b/include/view/mp-video-list-view-folder.h index 89ff6c5..f7db02b 100755 --- a/include/view/mp-video-list-view-folder.h +++ b/include/view/mp-video-list-view-folder.h @@ -20,6 +20,7 @@ #include "mp-video-list-view-common.h" #include "mp-video-type-define.h" +void mp_folder_view_add_folder_view_to_naviframe(); void mp_folder_view_folder_list_set(void *pMainHandle, void *pMainViewWidget, MpListUpdateType eUpdateType, UpdateListItemsCbFunc pUpdateVideoListUserCb); void mp_folder_view_destroy(void); diff --git a/include/view/mp-video-list-view-item-of-folder.h b/include/view/mp-video-list-view-item-of-folder.h index 4935cf5..c332a8a 100755 --- a/include/view/mp-video-list-view-item-of-folder.h +++ b/include/view/mp-video-list-view-item-of-folder.h @@ -20,7 +20,7 @@ #include "mp-video-list-view-common.h" #include "mp-video-type-define.h" -void mp_folder_item_view_push(void *pNaviFrame, int folder_index, +void mp_folder_item_view_push(void *pMainHandle, void *pMainWidget, int folder_index, UpdateListItemsCbFunc pChangeViewCb); bool mp_folder_item_view_is_current_view(); void mp_folder_item_view_check_more_button_of_toolbar(void); diff --git a/include/view/mp-video-list-view-main.h b/include/view/mp-video-list-view-main.h index b5f8b91..d728403 100755 --- a/include/view/mp-video-list-view-main.h +++ b/include/view/mp-video-list-view-main.h @@ -21,7 +21,7 @@ #include <stdbool.h> #include "mp-video-type-define.h" - +Evas_Object* mp_list_view_more_button_get(Elm_Object_Item *naviframe_item); void mp_list_view_push(void *pNaviFrame); void mp_list_view_destroy(void); void mp_list_view_update_widget(void); @@ -35,5 +35,10 @@ void mp_list_view_update_count_layout(); void mp_list_view_update_base_layout(); void mp_list_view_search_item_cb(void *pUserData, Evas_Object * pObject, void *pEventInfo); +void mp_list_view_view_type_set(int type); +int mp_list_view_view_type_get(); +Evas_Object* mp_list_view_base_layout_content_set(Evas_Object* content); +void mp_list_view_update_naviframe_title(const char *title, Evas_Object* prev_btn); +void mp_list_view_check_more_button_of_toolbar(void); #endif diff --git a/include/view/mp-video-search-view.h b/include/view/mp-video-search-view.h index fab6552..2972155 100755 --- a/include/view/mp-video-search-view.h +++ b/include/view/mp-video-search-view.h @@ -34,7 +34,7 @@ void mp_search_view_update_played_item(int nIndex); char *mp_search_view_search_markup_keyword(char *szOriginStr, char *szSearchWord, bool * bResult); -void mp_search_view_update_genlist(); +void mp_search_view_update_gengrid(); bool mp_search_view_get_active_view(); #endif diff --git a/include/widget/mp-footer-toolbar.h b/include/widget/mp-footer-toolbar.h index c70560c..e899b20 100755 --- a/include/widget/mp-footer-toolbar.h +++ b/include/widget/mp-footer-toolbar.h @@ -44,7 +44,7 @@ typedef struct { } st_RegisteCbFunc; -void mp_ft_ctrl_create(void *pNaviFrameHandle, void *pNaviFrameItem, +void mp_ft_ctrl_create(void *pNaviFrameHandle, void *pNaviFrameItem, void *more_button, MpFooterLibraryMainListTabType nFooterListTabType, st_RegisteCbFunc * pRegisteCbFunc); void mp_ft_ctrl_destroy(void); diff --git a/res/edje/vp-searchbar.edc b/res/edje/vp-searchbar.edc index 5090594..6cbad6a 100755 --- a/res/edje/vp-searchbar.edc +++ b/res/edje/vp-searchbar.edc @@ -13,6 +13,9 @@ * See the License for the specific language governing permissions and * limitations under the License. */ + +#include "vp-common.edc" + #define SEARCH_BAR_WIDTH 428 #define SEARCH_BAR_HEIGHT 48 #define SEARCH_BAR_LEFT_MARGIN 296 @@ -36,7 +39,7 @@ images { } collections { - base_scale: 2.6; + base_scale: CURRENT_BASE_SCALE; group { name: "homepage/searchbar"; parts { part { name: "base"; @@ -102,6 +105,7 @@ collections { description { state: "default" 0.0; min: 0 0; max: 0 0; + fixed: 1 1; rel.to: "search.icon.base"; align: 0.0 0.5; visible: 0; @@ -235,7 +239,8 @@ collections { program{ name: "search_icon_touch"; signal: "mouse,clicked,1"; source: "search.icon.space.touch"; - after: "show_search_bar"; + action: SIGNAL_EMIT "searchbar,clicked" "vp"; + //after: "show_search_bar"; } program { name: "show_search_bar"; signal: "searchbar,show"; @@ -250,7 +255,6 @@ collections { source: "vp"; action: STATE_SET "show" 0.0; target: "search.inputfiled.swallow"; - after: "show_clear_button"; after: "hide_touch_space"; } program { name: "hide_touch_space"; @@ -265,12 +269,16 @@ collections { action: STATE_SET "show_clear" 0.0; target: "clear.icon"; } + program { name: "hide_clear_button"; + signal: "searchbar,clear_button,hide"; + source: "vp"; + action: STATE_SET "default" 0.0; + target: "clear.icon"; + } program{ name: "clear_icon_touch"; signal: "mouse,clicked,1"; source: "clear.icon"; - action: STATE_SET "default" 0.0; - target: "clear.icon"; - after: "searchbar_default_state"; + action: SIGNAL_EMIT "clear_button,clicked" "vp"; } program { name: "searchbar_default_state"; signal: "searchbar,state,default"; @@ -281,12 +289,6 @@ collections { target: "margin.left"; target: "search.icon.space.touch"; } - program { name: "hide_clear_button"; - signal: "searchbar,clear_button,hide"; - source: "vp"; - action: STATE_SET "default" 0.0; - target: "clear.icon"; - } } } } diff --git a/res/edje/vp-videolist-custom-gengrid.edc b/res/edje/vp-videolist-custom-gengrid.edc index c152cd5..adec142 100755 --- a/res/edje/vp-videolist-custom-gengrid.edc +++ b/res/edje/vp-videolist-custom-gengrid.edc @@ -343,7 +343,7 @@ group { "elm/gengrid/item/videolist/default"; min: 0 4; max: -1 4; align: 0.0 1.0; - fixed: 0 1; + //fixed: 0 1; rel1 { to: "icon_area"; relative: 0.0 1.0; @@ -353,6 +353,11 @@ group { "elm/gengrid/item/videolist/default"; relative: 1.0 1.0; } } + desc { "show"; + inherit: "default"; + min: 0 4; + max: -1 4; + } } swallow { "elm.progress"; nomouse; scale; desc { "default"; @@ -415,6 +420,18 @@ group { "elm/gengrid/item/videolist/default"; target: "effect_cover"; transition: GLIDE_EASE_OUT(0.25); } + program { "show_progress"; + signal: "elm,state,progess,show"; + signal: "elm"; + action: STATE_SET "show"; + target: "progress_area"; + } + program { "hide_progress"; + signal: "elm,state,progess,hide"; + signal: "elm"; + action: STATE_SET "default"; + target: "progress_area"; + } GENGRID_PROGRAM_DEFAULT( target: "elm.icon"; target: "elm.progress"; diff --git a/src/view/mp-video-list-view-folder.c b/src/view/mp-video-list-view-folder.c index 1fa9d68..18f6cf6 100755 --- a/src/view/mp-video-list-view-folder.c +++ b/src/view/mp-video-list-view-folder.c @@ -46,18 +46,26 @@ #define NO_CONTENTS_W 720 #define NO_CONTENTS_H 897 +// Width is ICON(280) + LEFT_PADDING(12) RIGHT_PADDING(12) +#define GENGRID_ITEM_WIDTH 304 +//Height is ICON(160) + TEXT_PART(56) + Bottom_PADDING(40) +#define GENGRID_ITEM_HEIGHT 256 + +typedef struct _stGengridItemData{ + Elm_Object_Item *item; + Evas_Object *icon; + int folderIndex; +}stGengridItemData; typedef struct { st_VideoListViewMainViewHandle *pMainHandle; st_VideoListViewMainViewWidget *pMainWidget; UpdateListItemsCbFunc fUpdateListItemUserCb; - Evas_Object *pVideosGenlist; + Evas_Object *pFolderlistGengrid; + Elm_Gengrid_Item_Class *pFolderlistGIC; Evas_Object *pNocontentlayout; Evas_Object *pCurrentLayout; - Elm_Genlist_Item_Class *pFolderList_Itc; - Elm_Genlist_Item_Class *pFolderListLandscape_Itc; - Elm_Genlist_Item_Class *pGenGridItc; bool bItemSelected; @@ -82,38 +90,8 @@ static void __mp_folder_view_button_popup_cb(void *pUserData, Evas_Object * pObject, void *pEventInfo); static void __mp_folder_view_delete_popup_handle(void); - -/** - * - */ -void __mp_folder_view_create_no_content() -{ - if (!g_pFolderView) { - VideoLogError(""); - return; - } - - if (!g_pFolderView->pNocontentlayout) { - g_pFolderView->pNocontentlayout = - mp_create_nocontent_layout(g_pFolderView-> - pMainWidget->pListViewBaselayout, - VIDEOS_NOCONTENT_MSG_NO_VIDEOS_IDS, - VIDEOS_NOCONTENT_MSG_NO_VIDEOS_DESC_IDS); - Evas_Object *old_content = elm_object_part_content_unset(g_pFolderView-> - pMainWidget->pListViewBaselayout, - SWALLOW_LISTVIEW_CONTENT); - evas_object_hide(old_content); - if (g_pFolderView->pVideosGenlist) { - evas_object_hide(g_pFolderView->pVideosGenlist); - } - evas_object_show(g_pFolderView->pMainWidget->pListViewBaselayout); - elm_object_part_content_set(g_pFolderView-> - pMainWidget->pListViewBaselayout, - SWALLOW_LISTVIEW_CONTENT, - g_pFolderView->pNocontentlayout); - } - -} +static void __mp_folder_view_rotate_cb(void *data, Evas_Object * obj, + void *event_info); /** * @@ -148,12 +126,15 @@ void mp_folder_view_destroy(void) if (g_pFolderView) { __mp_folder_view_delete_popup_handle(); - MP_DEL_ITC(g_pFolderView->pFolderList_Itc); + MP_DEL_GRID_ITC(g_pFolderView->pFolderlistGIC); g_pFolderView->fUpdateListItemUserCb = NULL; g_pFolderView->pMainHandle = NULL; g_pFolderView->pMainWidget = NULL; MP_DEL_OBJ(g_pFolderView->pNocontentlayout); - MP_DEL_OBJ(g_pFolderView->pVideosGenlist); + MP_DEL_OBJ(g_pFolderView->pFolderlistGengrid); + evas_object_smart_callback_del((Evas_Object *)mp_util_get_main_window_handle(), + "wm,rotation,changed", + __mp_folder_view_rotate_cb); } MP_FREE_STRING(g_pFolderView); @@ -168,13 +149,15 @@ static void __mp_folder_view_reset(MpListUpdateType eUpdateType) if (g_pFolderView) { __mp_folder_view_delete_popup_handle(); - MP_DEL_ITC(g_pFolderView->pFolderList_Itc); g_pFolderView->fUpdateListItemUserCb = NULL; g_pFolderView->pMainHandle = NULL; g_pFolderView->pMainWidget = NULL; - if (g_pFolderView->pVideosGenlist) { - elm_genlist_clear(g_pFolderView->pVideosGenlist); + if (g_pFolderView->pFolderlistGengrid) { + elm_gengrid_clear(g_pFolderView->pFolderlistGengrid); } + evas_object_smart_callback_del((Evas_Object *)mp_util_get_main_window_handle(), + "wm,rotation,changed", + __mp_folder_view_rotate_cb); } @@ -244,45 +227,28 @@ static int mp_folder_view_get_respective_video_no(int nFolderItemIndex) * @return */ static char *mp_folder_view_get_label_of_folder_cb(const void *pUserData, - Evas_Object * pObject, - const char *pPart) + Evas_Object * pObject, + const char *pPart) { + stGengridItemData *item_data = (void *)pUserData; + int nFolderItemIndex = item_data->folderIndex; - int nFolderItemIndex = (int) pUserData; - - if (!g_strcmp0(pPart, "elm.text.main.left.top")) { - char *szTitle = NULL; - szTitle = mp_util_svc_get_video_folder_name(nFolderItemIndex); - - char *szTitleUtf8 = elm_entry_utf8_to_markup(szTitle); - - MP_FREE_STRING(szTitle); - return szTitleUtf8; - } else if (!g_strcmp0(pPart, "elm.text.sub.left.bottom")) { - char *szFolderPath = NULL; - szFolderPath = mp_util_svc_get_video_folder_url(nFolderItemIndex); - char *pDes_path = mp_util_get_dir_by_path(szFolderPath); - MP_FREE_STRING(szFolderPath); - char *szFolderUtf8 = elm_entry_utf8_to_markup(pDes_path); - MP_FREE_STRING(pDes_path); - return szFolderUtf8; - - } else if (!strcmp(pPart, "elm.text")) { + if (!strcmp(pPart, "elm.text")) { char *szTitle1 = NULL; szTitle1 = mp_util_svc_get_video_folder_name(nFolderItemIndex); char *szTitleUtf8 = elm_entry_utf8_to_markup(szTitle1); + int nVideoListSize = mp_folder_view_get_respective_video_no(nFolderItemIndex); + // 10 is for number and bracker e.g. (10) + // To DO make it dynamic + int len = strlen(szTitleUtf8) + 10; + char *folder_title = malloc(strlen(szTitleUtf8)+10); + snprintf(folder_title, len, "%s(%d)", szTitleUtf8, nVideoListSize); MP_FREE_STRING(szTitle1); + MP_FREE_STRING(szTitleUtf8); + VideoLogInfo("Setting Label: %s", folder_title); - return szTitleUtf8; - } else if (!strcmp(pPart, "elm.text.number")) { - char szTitle2[10] = { 0, }; - int nVideoListSize = - mp_folder_view_get_respective_video_no(nFolderItemIndex); - snprintf(szTitle2, 10, "(%d)", nVideoListSize); - char *szTitleUtf8 = elm_entry_utf8_to_markup(szTitle2); - - return szTitleUtf8; + return folder_title; } return NULL; @@ -295,140 +261,32 @@ static char *mp_folder_view_get_label_of_folder_cb(const void *pUserData, * @param pPart * @return */ -static Evas_Object *mp_folder_view_get_icon_of_folder_cb(const void - *pUserData, - Evas_Object * - pObject, - const char - *pPart) +static Evas_Object *mp_folder_view_get_icon_of_folder_cb(const void *pUserData, + Evas_Object *pObject, + const char *pPart) { - int nFolderItemIndex = (int) pUserData; - VideoLogInfo("Index : %d", nFolderItemIndex); - char edj_path[1024] = { 0 }; - - char *path = app_get_resource_path(); - snprintf(edj_path, 1024, "%s%s/%s", path, "edje", VIDEO_CUSTOM_THEME); - free(path); - if (!g_strcmp0(pPart, "elm.icon.1")) { - VideoLogInfo("pPart: elm.icon.1 - thumbnail"); - - Evas_Object *pLayout = NULL; - Evas_Object *pBg = NULL; - char *pThumbIconUri = - mp_util_get_folder_thumbnail(nFolderItemIndex, - mp_sort_ctrl_get_sort_state()); - - pLayout = elm_layout_add(pObject); - elm_layout_file_set(pLayout, edj_path, - "listview.thumbnail.layout"); - - if (!pThumbIconUri || !vp_file_exists(pThumbIconUri)) { - MP_FREE_STRING(pThumbIconUri); - } - - pBg = - mp_util_create_preload_image(pLayout, pThumbIconUri, - VIDEO_ICON_WIDTH); - elm_layout_content_set(pLayout, "elm.thumbnail.icon", pBg); - if (pBg) - evas_object_show(pBg); - - if (!mp_util_create_folder_sub_icon(pLayout, nFolderItemIndex)) { - VideoLogWarning - ("Create sub icon is failed. nFolderItemIndex: %d", - nFolderItemIndex); - } - - MP_FREE_STRING(pThumbIconUri); - - evas_object_show(pLayout); - - return pLayout; - } else if (!strcmp(pPart, "elm.swallow.icon")) { - char *pThumbIconUri = - mp_util_get_folder_thumbnail(nFolderItemIndex, - mp_sort_ctrl_get_sort_state()); - Evas_Object *thumb = NULL; - int nWidth = 0; - int nHeight = 0; - - thumb = elm_image_add(pObject); - - elm_image_preload_disabled_set(thumb, EINA_FALSE); - elm_image_smooth_set(thumb, EINA_FALSE); - elm_image_prescale_set(thumb, 50 * MP_SCALE); - elm_image_file_set(thumb, pThumbIconUri, NULL); - elm_image_object_size_get(thumb, &nWidth, &nHeight); + stGengridItemData *item_data = pUserData; + int nFolderItemIndex = item_data->folderIndex; - if (nWidth > nHeight) { - elm_image_aspect_fixed_set(thumb, EINA_FALSE); - } - if (thumb) - evas_object_show(thumb); - MP_FREE_STRING(pThumbIconUri); - - return thumb; - } else if (!strcmp(pPart, "elm.sdcard.icon")) { - MpMediaStorageType StorageType = MP_MEDIA_TYPE_STORAGE_UNKNOWN; - StorageType = mp_util_svc_get_folder_storage(nFolderItemIndex); - if (StorageType == MP_MEDIA_TYPE_STORAGE_EXTERNAL) { - Evas_Object *pSdcardIcon = elm_image_add(pObject); - elm_image_file_set(pSdcardIcon, edj_path, - VIDEO_LIST_VIEW_ICON_FOLDER_SDCARD); - evas_object_size_hint_align_set(pSdcardIcon, EVAS_HINT_FILL, - EVAS_HINT_FILL); - evas_object_size_hint_weight_set(pSdcardIcon, - EVAS_HINT_EXPAND, - EVAS_HINT_EXPAND); - evas_object_show(pSdcardIcon); - return pSdcardIcon; - } else { + if (!strcmp(pPart, "elm.icon")) { + char *pThumbIconUri = mp_util_get_folder_thumbnail(nFolderItemIndex, mp_sort_ctrl_get_sort_state()); + if(pThumbIconUri == NULL) + { + VideoLogError("thumbnail url is invalid"); return NULL; } - } - - return NULL; -} + Evas_Object *img = elm_image_add(pObject); + elm_image_file_set(img, pThumbIconUri, NULL); + elm_image_aspect_fixed_set(img, EINA_FALSE); + elm_image_preload_disabled_set(img, EINA_FALSE); + evas_object_size_hint_weight_set(img, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); + evas_object_size_hint_align_set(img, EVAS_HINT_FILL, EVAS_HINT_FILL); -/** - * - * @param pUserData - * @param pObject - * @param pPart - * @return - */ -Evas_Object *mp_folder_view_get_icon_of_no_folder_item_cb(const void - *pUserData, - Evas_Object * - pObject, - const char - *pPart) -{ - VideoSecureLogInfo(""); + item_data->icon = img; + VideoLogInfo("Setting ICON: %p", img); - if (!strcmp(pPart, "elm.icon")) { - int width = NO_ITEM_GENLIST_WIDTH * elm_config_scale_get(); - int height = NO_ITEM_GENLIST_HEIGHT * elm_config_scale_get(); - char edj_path[1024] = { 0 }; - - char *path = app_get_resource_path(); - snprintf(edj_path, 1024, "%s%s/%s", path, "edje", - VIDEO_PLAYER_NO_ITEM_EDJ); - free(path); - Evas_Object *pNoItemLayout = NULL; - pNoItemLayout = elm_layout_add(pObject); - elm_layout_file_set(pNoItemLayout, edj_path, - GENLIST_NOITEM_EDJ_GROUP); - evas_object_size_hint_min_set(pNoItemLayout, width, height); - - elm_object_part_text_set(pNoItemLayout, - SWALLOW_LISTVIEW_NO_ITEM_TEXT, - VIDEOS_NOCONTENT_MSG_NO_VIDEOS_DESC); - - evas_object_show(pNoItemLayout); - return pNoItemLayout; + return img; } - return NULL; } @@ -470,11 +328,10 @@ static void mp_folder_view_gen_select_video_folder_cb(void *pUserData, ("[WARNING] Main handles of list view are not existed."); return; } - Elm_Object_Item *pSelectedItem = - elm_genlist_selected_item_get(pObject); + Elm_Object_Item *pSelectedItem = elm_gengrid_selected_item_get(pObject); if (pSelectedItem) { VideoLogInfo("pSelectedItem is NULL"); - elm_genlist_item_selected_set(pSelectedItem, EINA_FALSE); + elm_gengrid_item_selected_set(pSelectedItem, EINA_FALSE); } Evas_Object *pPopup = evas_object_data_get(pObject, "popup"); /* Get popup */ if (pPopup) { @@ -497,225 +354,79 @@ static void mp_folder_view_gen_select_video_folder_cb(void *pUserData, VideoLogInfo("[ERR]Error item number."); return; } - nFolderItemIndex = (int) elm_object_item_data_get(pItem); + stGengridItemData *item_data = elm_object_item_data_get(pItem); + nFolderItemIndex = item_data->folderIndex; g_pFolderView->bItemSelected = true; VideoLogInfo("nFolderItemIndex:%d", nFolderItemIndex); - mp_folder_item_view_push((void *) mp_mgr_get_library_naviframe(), - nFolderItemIndex, - (UpdateListItemsCbFunc) - g_pFolderView->fUpdateListItemUserCb); + st_VideoListViewMainViewHandle *handle = g_pFolderView->pMainHandle; + + mp_folder_item_view_push(g_pFolderView->pMainHandle, + g_pFolderView->pMainWidget, + nFolderItemIndex, + (UpdateListItemsCbFunc)g_pFolderView->fUpdateListItemUserCb); } #ifdef VS_FEATURE_THUMBNAIL_VIEW -/** - * - * @param pObjVideosList - * @param nGenItemIndex - */ -static void __mp_folder_view_append_gengrid_items(void *pObjVideosList, - int nGenItemIndex) -{ - if (!g_pFolderView) { - VideoLogInfo("invalid handle"); - return; - } - - MP_DEL_GRID_ITC(g_pFolderView->pGenGridItc); - g_pFolderView->pGenGridItc = elm_gengrid_item_class_new(); - g_pFolderView->pGenGridItc->item_style = "video/folder_grid"; - g_pFolderView->pGenGridItc->func.text_get = - (void *) mp_folder_view_get_label_of_folder_cb; - g_pFolderView->pGenGridItc->func.content_get = - (void *) mp_folder_view_get_icon_of_folder_cb; - g_pFolderView->pGenGridItc->func.state_get = NULL; - g_pFolderView->pGenGridItc->func.del = NULL; - - int nCount = - (mp_rotate_ctrl_check_landspace() ? - VP_GENLIST_THUMB_LANDSPACE_COUNT : - VP_GENLIST_THUMB_PORTRAIT_COUNT); - int nIndex = nGenItemIndex * nCount; - int nMaxIndex = nIndex + nCount; - int nVideoListSize = mp_util_svc_get_video_folder_size(); - Elm_Object_Item *gridItem = NULL; - for (; (nIndex < nMaxIndex) && (nIndex < nVideoListSize); nIndex++) { - elm_gengrid_item_append(pObjVideosList, - g_pFolderView->pGenGridItc, - (void *) nIndex, - mp_folder_view_gen_select_video_folder_cb, - NULL); - elm_object_item_data_set(gridItem, (void *) nIndex); - } -} - -/** - * - * @param parent - * @param nWidth - * @param nHeight - * @return - */ -static Evas_Object *__mp_folder_view_create_gengrid(Evas_Object * parent, - int nWidth, - int nHeight) +static void __mp_folder_view_grid_item_del_cb(void *pUserdata, + Evas_Object * obj, + void *event_info) { - Evas_Object *pGengrid; - pGengrid = elm_gengrid_add(parent); - if (!pGengrid) { - VideoLogError("pVideoGrid is not existed."); - return NULL; - } - evas_object_size_hint_weight_set(pGengrid, EVAS_HINT_EXPAND, - EVAS_HINT_EXPAND); - evas_object_size_hint_align_set(pGengrid, EVAS_HINT_FILL, - EVAS_HINT_FILL); - elm_gengrid_item_size_set(pGengrid, nWidth, nHeight); - elm_gengrid_align_set(pGengrid, 0.0, 0.0); - elm_gengrid_horizontal_set(pGengrid, EINA_TRUE); - - return pGengrid; -} - -/** - * - * @param height - * @param width - */ -static void mp_folder_view_get_icon_dimensions(int *height, int *width) -{ - int winHeight = 0; - int winWidth = 0; - elm_win_screen_size_get(mp_util_get_main_window_handle(), NULL, NULL, - &winWidth, &winHeight); - - bool bLandscape = - mp_rotate_ctrl_check_landspace_by_win((Evas_Object *) - mp_util_get_main_window_handle - ()); - if (bLandscape) { - *width = winHeight / VP_GENLIST_THUMB_LANDSPACE_COUNT; - } else { - *width = winWidth / VP_GENLIST_THUMB_PORTRAIT_COUNT; + if(g_pFolderView == NULL) + { + VideoLogError("g_pFolderView is invalid"); + return; } - *height = VP_ALBUM_THUMB_ICON_HEIGHT * MP_SCALE; + stGengridItemData *item_data = pUserdata; + elm_object_item_data_set(item_data->item, NULL); + free(item_data); } /** * - * @param pUserData - * @param pObject - * @param pPart - * @return + * @param pObjVideosList + * @param nGenItemIndex */ -static Evas_Object *__mp_folder_view_get_icon_of_grid_cb(const void - *pUserData, - Evas_Object * - pObject, - const char - *pPart) +static void __mp_folder_view_append_gengrid_items(void *pObjVideosList) { - VideoLogInfo("in __mp_folder_view_get_icon_of_grid_cb"); - if (!g_pFolderView || !pObject) { - VideoLogError("g_pMainViewWidgetOfFolderList is NULL"); - return NULL; + if (!g_pFolderView) { + VideoLogInfo("invalid handle"); + return; } - int nGenItemIndex = (int) pUserData; - int nHeight = 0; - int nWidth = 0; - mp_folder_view_get_icon_dimensions(&nHeight, &nWidth); - - Evas_Object *pGengrid = - __mp_folder_view_create_gengrid(pObject, nWidth, nHeight); - __mp_folder_view_append_gengrid_items(pGengrid, nGenItemIndex); - - return pGengrid; -} - -/** - * - * @param nVideoItemIndex - * @return - */ -int mp_folder_view_thumbnail_to_genlist_index(int nVideoItemIndex) -{ - if (nVideoItemIndex < 0) { - VideoLogDebug("invalid nVideoItemIndex"); - return 0; - } - int nItemCount = VP_GENLIST_THUMB_PORTRAIT_COUNT; - int nGenlistIndex = 0; - if (g_pFolderView->bLandscape) { - nItemCount = VP_GENLIST_THUMB_LANDSPACE_COUNT; + if(g_pFolderView->pFolderlistGIC == NULL) + { + g_pFolderView->pFolderlistGIC = elm_gengrid_item_class_new(); + g_pFolderView->pFolderlistGIC->item_style = "videolist"; + g_pFolderView->pFolderlistGIC->func.text_get = + (void *) mp_folder_view_get_label_of_folder_cb; + g_pFolderView->pFolderlistGIC->func.content_get = + (void *) mp_folder_view_get_icon_of_folder_cb; + g_pFolderView->pFolderlistGIC->func.state_get = NULL; + g_pFolderView->pFolderlistGIC->func.del = NULL; } - nGenlistIndex = nVideoItemIndex / nItemCount; - return nGenlistIndex; -} -/** - * - * @param pGenlist - * @return - */ -static bool __mp_folder_view_append_grid_layout(void *pGenlist) -{ - if (!pGenlist || !g_pFolderView) { - VideoLogError("error handle."); - return FALSE; - } - int nIndex = 0; int nVideoListSize = mp_util_svc_get_video_folder_size(); - if (nVideoListSize <= 0) { - VideoLogWarning("nVideoListSize = %d", nVideoListSize); - return FALSE; - } + VideoLogInfo("Folder size: %d", nVideoListSize); - MP_DEL_ITC(g_pFolderView->pGenGridItc); - g_pFolderView->pFolderList_Itc = elm_genlist_item_class_new(); - - g_pFolderView->pFolderList_Itc->item_style = "video/1icon.thumbnail"; - g_pFolderView->pFolderList_Itc->func.text_get = NULL; - g_pFolderView->pFolderList_Itc->func.content_get = - (void *) __mp_folder_view_get_icon_of_grid_cb; - g_pFolderView->pFolderList_Itc->func.state_get = NULL; - g_pFolderView->pFolderList_Itc->func.del = NULL; - g_pFolderView->pFolderList_Itc->decorate_item_style = NULL; - - MP_DEL_ITC(g_pFolderView->pFolderListLandscape_Itc); - g_pFolderView->pFolderListLandscape_Itc = elm_genlist_item_class_new(); - g_pFolderView->pFolderListLandscape_Itc->item_style = - "video/1icon.thumbnail.landscape"; - g_pFolderView->pFolderListLandscape_Itc->func.text_get = NULL; - g_pFolderView->pFolderListLandscape_Itc->func.content_get = - (void *) __mp_folder_view_get_icon_of_grid_cb; - g_pFolderView->pFolderListLandscape_Itc->func.state_get = NULL; - g_pFolderView->pFolderListLandscape_Itc->func.del = NULL; - g_pFolderView->pFolderListLandscape_Itc->decorate_item_style = NULL; - - int nGenlistRow = 0; - nGenlistRow = - mp_folder_view_thumbnail_to_genlist_index(nVideoListSize - 1); - - if (mp_rotate_ctrl_check_landspace()) { - for (nIndex = 0; nIndex <= nGenlistRow; nIndex++) { - elm_genlist_item_append(pGenlist, - g_pFolderView->pFolderListLandscape_Itc, - (void *) nIndex, NULL, - ELM_GENLIST_ITEM_NONE, NULL, NULL); - } - } else { - for (nIndex = 0; nIndex <= nGenlistRow; nIndex++) { - elm_genlist_item_append(pGenlist, - g_pFolderView->pFolderList_Itc, - (void *) nIndex, NULL, - ELM_GENLIST_ITEM_NONE, NULL, NULL); + for (int nIndex = 0; nIndex < nVideoListSize; nIndex++) { + stGengridItemData *item_data = calloc(1, sizeof(stGengridItemData)); + if(item_data == NULL) + { + VideoLogError("failed to allocate memory for item data"); + return; } + item_data->folderIndex = nIndex; + item_data->item = elm_gengrid_item_append(pObjVideosList, + g_pFolderView->pFolderlistGIC, + (const void *) item_data, + mp_folder_view_gen_select_video_folder_cb, + item_data); + elm_object_item_del_cb_set(item_data->item, __mp_folder_view_grid_item_del_cb); } - - return TRUE; } + #endif @@ -1021,9 +732,9 @@ static void __mp_folder_view_share_via_cb(void *pUserData, LIST_TAB_TYPE_PERSONAL); Elm_Object_Item *pSelectedItem = - elm_genlist_selected_item_get(pObject); + elm_gengrid_selected_item_get(pObject); if (pSelectedItem) { - elm_genlist_item_selected_set(pSelectedItem, EINA_FALSE); + elm_gengrid_item_selected_set(pSelectedItem, EINA_FALSE); } } @@ -1033,8 +744,8 @@ static void __mp_folder_view_normal_result_popup() VideoLogError("Invalid list and object"); return; } - evas_object_data_set(g_pFolderView->pVideosGenlist, "popup", NULL); - elm_object_scroll_freeze_pop(g_pFolderView->pVideosGenlist); + evas_object_data_set(g_pFolderView->pFolderlistGengrid, "popup", NULL); + elm_object_scroll_freeze_pop(g_pFolderView->pFolderlistGengrid); } static void __mp_folder_view_long_press_item_cb(void *pUserData, @@ -1048,7 +759,7 @@ static void __mp_folder_view_long_press_item_cb(void *pUserData, } Elm_Object_Item *long_item = (Elm_Object_Item *) event_info; - int nFolderItemIndex = elm_genlist_item_index_get(long_item); + int nFolderItemIndex = elm_gengrid_item_index_get(long_item); if (nFolderItemIndex < 0) { VideoLogError("nGenlistItemIndex is invalid"); return; @@ -1073,33 +784,33 @@ static void __mp_folder_view_long_press_item_cb(void *pUserData, __mp_folder_view_normal_result_popup, NULL, MP_LIST_OPTION_DOWNLOAD_NONE); if (mp_option_ctrl_get_handle()) { - evas_object_data_set(g_pFolderView->pVideosGenlist, "popup", + evas_object_data_set(g_pFolderView->pFolderlistGengrid, "popup", mp_option_ctrl_get_handle()); - elm_object_scroll_freeze_push(g_pFolderView->pVideosGenlist); + elm_object_scroll_freeze_push(g_pFolderView->pFolderlistGengrid); } MP_FREE_STRING(pRegisteCbFunc); MP_FREE_STRING(title); } -static void __mp_folder_view_del_genlist_cb(Evas_Object * pVideosGenlist) +static void __mp_folder_view_del_gengrid_cb(Evas_Object * gengrid) { - if (!pVideosGenlist) { - VideoSecureLogError("pVideosGenlist is NULL"); + if (!gengrid) { + VideoSecureLogError("gengrid is NULL"); return; } - evas_object_smart_callback_del(pVideosGenlist, "longpressed", + evas_object_smart_callback_del(gengrid, "longpressed", __mp_folder_view_long_press_item_cb); } -static void __mp_folder_view_add_genlist_cb(Evas_Object * pVideosGenlist) +static void __mp_folder_view_add_gengrid_cb(Evas_Object * gengrid) { - if (!pVideosGenlist) { - VideoSecureLogError("pVideosGenlist is NULL"); + if (!gengrid) { + VideoSecureLogError("gengrid is NULL"); return; } - evas_object_smart_callback_add(pVideosGenlist, "longpressed", + evas_object_smart_callback_add(gengrid, "longpressed", __mp_folder_view_long_press_item_cb, NULL); @@ -1132,19 +843,41 @@ static void __mp_folder_view_rotate_cb(void *data, Evas_Object * obj, } else { g_pFolderView->bLandscape = false; } - elm_genlist_clear(g_pFolderView->pVideosGenlist); - __mp_folder_view_append_grid_layout(g_pFolderView->pVideosGenlist); + elm_gengrid_clear(g_pFolderView->pFolderlistGengrid); + __mp_folder_view_append_gengrid_items(g_pFolderView->pFolderlistGengrid); } +static Evas_Object* _create_gengrid(Evas_Object *parent) +{ + if(parent == NULL) + { + VideoLogError("gengrid parent is invalid"); + return NULL; + } + Evas_Object *gengrid = elm_gengrid_add(parent); + evas_object_size_hint_weight_set(gengrid, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); + evas_object_size_hint_align_set(gengrid, EVAS_HINT_FILL, EVAS_HINT_FILL); + elm_gengrid_item_size_set(gengrid, GENGRID_ITEM_WIDTH, GENGRID_ITEM_HEIGHT); +#ifdef ENABLE_LONGPRESS + __mp_folder_view_add_gengrid_cb(g_pFolderView->pFolderlistGengrid); +#endif + return gengrid; +} + +void mp_folder_view_update_base_layout_content(Evas_Object* content) +{ + mp_list_view_view_type_set(MP_LIST_VIEW_AS_FOLDER_LIST); + Evas_Object* old_content = mp_list_view_base_layout_content_set(content); + if(old_content == g_pFolderView->pNocontentlayout) + { + MP_DEL_OBJ(g_pFolderView->pNocontentlayout); + g_pFolderView->pNocontentlayout = NULL; + } + mp_list_view_update_naviframe_title(NULL, NULL); + mp_list_view_check_more_button_of_toolbar(); +} -/** - * @brief set the folder list on toolbar item select callback - * @param pMainViewHandle - * @param pMainViewWidget - * @param eUpdateType - * @param pUpdateVideoListUserCb - */ void mp_folder_view_folder_list_set(void *pMainHandle, void *pMainViewWidget, MpListUpdateType eUpdateType, UpdateListItemsCbFunc pUpdateVideoListUserCb) { @@ -1153,15 +886,22 @@ void mp_folder_view_folder_list_set(void *pMainHandle, void *pMainViewWidget, { mp_folder_view_arrange_folder_list(pMainHandle, pMainViewWidget, eUpdateType, pUpdateVideoListUserCb); } else { - Evas_Object *curr_content = elm_object_part_content_get(g_pFolderView->pMainWidget->pListViewBaselayout, SWALLOW_LISTVIEW_CONTENT); - if(curr_content != g_pFolderView->pCurrentLayout) - { - curr_content = elm_object_part_content_unset(g_pFolderView->pMainWidget->pListViewBaselayout, SWALLOW_LISTVIEW_CONTENT); - evas_object_hide(curr_content); - elm_object_part_content_set(g_pFolderView->pMainWidget->pListViewBaselayout, SWALLOW_LISTVIEW_CONTENT, g_pFolderView->pCurrentLayout); - } + mp_folder_view_update_base_layout_content(g_pFolderView->pCurrentLayout); } } + +void mp_folder_view_add_folder_view_to_naviframe() +{ + if(g_pFolderView == NULL) + { + VideoLogError("g_pFolderView is invalid"); + return; + } + void *mainHandle = g_pFolderView->pMainHandle; + void *mainWidget = g_pFolderView->pMainWidget; + UpdateListItemsCbFunc func = g_pFolderView->fUpdateListItemUserCb; + mp_folder_view_arrange_folder_list(mainHandle, mainWidget,LIST_UPDATE_TYPE_ALL, func); +} /** * * @param pMainViewHandle @@ -1220,58 +960,31 @@ void mp_folder_view_arrange_folder_list(void *pMainViewHandle, VideoLogInfo("nVideoListSize : %d", nFolderListSize); if (nFolderListSize > 0) { - if (g_pFolderView->pNocontentlayout) { - elm_object_part_content_unset(g_pFolderView->pMainWidget->pListViewBaselayout, - SWALLOW_LISTVIEW_CONTENT); - MP_DEL_OBJ(g_pFolderView->pNocontentlayout); + if (g_pFolderView->pFolderlistGengrid == NULL) { + g_pFolderView->pFolderlistGengrid = _create_gengrid(g_pFolderView->pMainWidget->pListViewBaselayout); } - if (!g_pFolderView->pVideosGenlist) { - g_pFolderView->pVideosGenlist = - elm_genlist_add(g_pFolderView-> - pMainHandle->pNaviFrameHandle); - elm_scroller_bounce_set(g_pFolderView->pVideosGenlist, - EINA_FALSE, EINA_TRUE); - evas_object_size_hint_weight_set(g_pFolderView->pVideosGenlist, - EVAS_HINT_EXPAND, - EVAS_HINT_EXPAND); - evas_object_size_hint_align_set(g_pFolderView->pVideosGenlist, - EVAS_HINT_FILL, - EVAS_HINT_FILL); - elm_genlist_mode_set(g_pFolderView->pVideosGenlist, - ELM_LIST_COMPRESS); - elm_genlist_homogeneous_set(g_pFolderView->pVideosGenlist, - EINA_TRUE); - - elm_genlist_block_count_set(g_pFolderView->pVideosGenlist, - VIDEO_MAIN_LIST_BLOCK_COUNT); - elm_scroller_single_direction_set - (g_pFolderView->pVideosGenlist, - ELM_SCROLLER_SINGLE_DIRECTION_HARD); -#ifdef ENABLE_LONGPRESS - __mp_folder_view_del_genlist_cb(g_pFolderView->pVideosGenlist); - __mp_folder_view_add_genlist_cb(g_pFolderView->pVideosGenlist); -#endif - } - Evas_Object *old_content = elm_object_part_content_unset(g_pFolderView->pMainWidget->pListViewBaselayout, SWALLOW_LISTVIEW_CONTENT); - evas_object_hide(old_content); - elm_object_part_content_set(g_pFolderView-> - pMainWidget->pListViewBaselayout, - SWALLOW_LISTVIEW_CONTENT, - g_pFolderView->pVideosGenlist); - __mp_folder_view_append_grid_layout(g_pFolderView->pVideosGenlist); - evas_object_smart_callback_add((Evas_Object *) - mp_util_get_main_window_handle(), - "wm,rotation,changed", - __mp_folder_view_rotate_cb, NULL); - evas_object_show(g_pFolderView->pVideosGenlist); - g_pFolderView->pCurrentLayout = g_pFolderView->pVideosGenlist; + evas_object_smart_callback_add((Evas_Object *)mp_util_get_main_window_handle(), + "wm,rotation,changed", + __mp_folder_view_rotate_cb, + NULL); + evas_object_show(g_pFolderView->pFolderlistGengrid); + __mp_folder_view_append_gengrid_items(g_pFolderView->pFolderlistGengrid); + g_pFolderView->pCurrentLayout = g_pFolderView->pFolderlistGengrid; } else { - __mp_folder_view_create_no_content(); + if(g_pFolderView->pNocontentlayout == NULL) + { + g_pFolderView->pNocontentlayout = mp_create_nocontent_layout(g_pFolderView->pMainWidget->pListViewBaselayout, + VIDEOS_NOCONTENT_MSG_NO_VIDEOS_IDS, + VIDEOS_NOCONTENT_MSG_NO_VIDEOS_DESC_IDS); + } + //hide folder list; + evas_object_hide(g_pFolderView->pFolderlistGengrid); + //show no content layout + evas_object_show(g_pFolderView->pNocontentlayout); g_pFolderView->pCurrentLayout = g_pFolderView->pNocontentlayout; } - + mp_folder_view_update_base_layout_content(g_pFolderView->pCurrentLayout); mp_list_view_update_count_layout(); - } /** @@ -1279,7 +992,7 @@ void mp_folder_view_arrange_folder_list(void *pMainViewHandle, */ void mp_folder_view_update_video_items(void) { - if (!g_pFolderView->pVideosGenlist) { + if ( !g_pFolderView && !g_pFolderView->pFolderlistGengrid) { VideoLogWarning ("[WARNING] g_pFolderView->pFolderItemList is not existed."); return; @@ -1288,16 +1001,9 @@ void mp_folder_view_update_video_items(void) VideoLogInfo(""); int nFolderListSize = mp_util_svc_get_video_folder_size(); - Elm_Object_Item *pTmpVideoGenlistItem = NULL; if (nFolderListSize > 0) { - pTmpVideoGenlistItem = - elm_genlist_first_item_get(g_pFolderView->pVideosGenlist); - while (pTmpVideoGenlistItem) { - elm_genlist_item_update(pTmpVideoGenlistItem); - pTmpVideoGenlistItem = - elm_genlist_item_next_get(pTmpVideoGenlistItem); - } + elm_gengrid_realized_items_update(g_pFolderView->pFolderlistGengrid); } } diff --git a/src/view/mp-video-list-view-item-of-folder.c b/src/view/mp-video-list-view-item-of-folder.c index 5dc2bf8..20cd04e 100755 --- a/src/view/mp-video-list-view-item-of-folder.c +++ b/src/view/mp-video-list-view-item-of-folder.c @@ -42,6 +42,7 @@ #include "mp-video-list-option-ctrl.h" #include "mp-video-list-share-via-view.h" +#include "mp-video-list-view-main.h" #include "mp-video-list-personal-view.h" #include "mp-video-rename-ctrl.h" #include "mp-video-info-ctrl.h" @@ -55,17 +56,30 @@ #define NO_CONTENTS_W 720 #define NO_CONTENTS_H 897 +// Width is ICON(280) + LEFT_PADDING(12) RIGHT_PADDING(12) +#define GENGRID_ITEM_WIDTH 304 +//Height is ICON(160) + TEXT_PART(56) + Bottom_PADDING(40) +#define GENGRID_ITEM_HEIGHT 256 /****************************folder view***************************/ +typedef struct _stGengridItemData{ + Elm_Object_Item *item; + Evas_Object *icon; + Evas_Object *progress_layout; + int videoIndex; +}stGengridItemData; + typedef struct { + st_VideoListViewMainViewHandle *pMainHandle; + st_VideoListViewMainViewWidget *pMainWidget; void *pNaviFrameHandle; - void *pNaviFrameItem; + void *pNaviframeItem; void *pVideosGenlist; - Elm_Genlist_Item_Class *pGenGridItc; - Elm_Genlist_Item_Class *pGenGridLandscapeItc; - Elm_Gengrid_Item_Class *pGenGridItc_l; + Evas_Object *pFolderItemGengrid; + Elm_Gengrid_Item_Class *pFolderItemGIC; + Evas_Object *pCurrentLayout; int nFolder_index; int currentItemCount; @@ -79,15 +93,9 @@ typedef struct { } st_VideoFolderViewHandle; typedef struct { - Evas_Object *pFolderViewBox; - Evas_Object *pFolderViewCountlayout; - Evas_Object *pFolderViewBaselayout; - Evas_Object *pNocontentsLayout; - Evas_Object *pViewButton; - - Evas_Object *pFolderViewGenlistTitle; - Elm_Genlist_Item_Class *pFolderViewGenlistTitleItc; - Elm_Object_Item *pFolderViewGenlistItemForTitle; + Evas_Object *pNocontentLayout; + Evas_Object *pBackButton; + Eina_List *pVideolistItemList; } st_VideoFolderViewWidget; @@ -109,251 +117,9 @@ static void __mp_folder_item_view_result_view_update_cb(void); static void __mp_folder_item_view_rotate_cb(void *data, Evas_Object * obj, void *event_info); static void mp_folder_view_cancel_thumbnail_update(int nIndexGenlist); -static int mp_folder_item_view_thumbnail_to_genlist_index(int - nVideoItemIndex); static int __mp_folder_item_view_get_sort_type(void); - -/** - * - * @return - */ -static bool __mp_folder_item_view_free_video_genlistItem(void) -{ - if (!g_pFolderViewWidget || !g_pFolderViewWidget->pVideolistItemList) { - VideoLogError - ("g_pMainViewWidget->pVideoGenlistItemList is already empty."); - return FALSE; - } - - VideoLogInfo(""); - - Elm_Object_Item *pTmpVideoGenlistItem = NULL; - EINA_LIST_FREE(g_pFolderViewWidget->pVideolistItemList, - pTmpVideoGenlistItem) { - if (pTmpVideoGenlistItem) { - int nIndex = - (int) elm_object_item_data_get(pTmpVideoGenlistItem); - - mp_folder_view_cancel_thumbnail_update(nIndex); - pTmpVideoGenlistItem = NULL; - } - } - - g_pFolderViewWidget->pVideolistItemList = NULL; - - return TRUE; -} - -/** - * - * @param pVideosGenlist - */ -static void __mp_folder_item_view_clear_genlist(void *pVideosGenlist) -{ - VideoLogInfo(""); - if (pVideosGenlist && g_pFolderViewWidget) { - __mp_folder_item_view_free_video_genlistItem(); - elm_genlist_clear(pVideosGenlist); - } -} - -/** - * - */ -static void __mp_folder_item_view_destroy(void) -{ - VideoLogInfo(""); - if (g_pFolderViewHandle) { - g_pFolderViewHandle->nFolder_index = 0; - __mp_folder_item_view_clear_genlist(g_pFolderViewHandle-> - pVideosGenlist); - MP_DEL_OBJ(g_pFolderViewHandle->pVideosGenlist); - - g_pFolderViewHandle->nPlayVideoIndex = -1; - MP_FREE_STRING(g_pFolderViewHandle->pFolderUrl); - - free(g_pFolderViewHandle); - g_pFolderViewHandle = NULL; - } - - if (g_pFolderViewWidget) { - MP_DEL_ITC(g_pFolderViewWidget->pFolderViewGenlistTitleItc); - MP_DEL_OBJ(g_pFolderViewWidget->pViewButton); - MP_DEL_OBJ(g_pFolderViewWidget->pNocontentsLayout); - MP_DEL_OBJ(g_pFolderViewWidget->pFolderViewBaselayout); - MP_DEL_OBJ(g_pFolderViewWidget->pFolderViewCountlayout); - MP_DEL_OBJ(g_pFolderViewWidget->pFolderViewBox); - - free(g_pFolderViewWidget); - g_pFolderViewWidget = NULL; - } - evas_object_smart_callback_del((Evas_Object *) - mp_util_get_main_window_handle(), - "wm,rotation,changed", - __mp_folder_item_view_rotate_cb); -} - -/** - * - */ -static void __mp_folder_item_view_reset(void) -{ - VideoLogInfo(""); - if (g_pFolderViewHandle) { - mp_util_db_set_update_fun(g_pFolderViewHandle->euLev, NULL); - g_pFolderViewHandle->nFolder_index = 0; - __mp_folder_item_view_clear_genlist(g_pFolderViewHandle-> - pVideosGenlist); - g_pFolderViewHandle->pVideosGenlist = NULL; - - MP_FREE_STRING(g_pFolderViewHandle->pFolderUrl); - - g_pFolderViewHandle->nPlayVideoIndex = -1; - - free(g_pFolderViewHandle); - g_pFolderViewHandle = NULL; - } - - if (g_pFolderViewWidget) { - MP_DEL_ITC(g_pFolderViewWidget->pFolderViewGenlistTitleItc); - g_pFolderViewWidget->pFolderViewBaselayout = NULL; - g_pFolderViewWidget->pNocontentsLayout = NULL; - g_pFolderViewWidget->pViewButton = NULL; - - free(g_pFolderViewWidget); - g_pFolderViewWidget = NULL; - } - evas_object_smart_callback_del((Evas_Object *) - mp_util_get_main_window_handle(), - "wm,rotation,changed", - __mp_folder_item_view_rotate_cb); -} - -/** - * - * @param pParent - * @return - */ -static Evas_Object *__mp_folder_item_view_init_base_layout(void *pParent) -{ - if (!pParent) { - VideoLogError("[ERR]"); - return NULL; - } - - VideoLogInfo(""); - - MP_DEL_OBJ(g_pFolderViewWidget->pFolderViewBaselayout); - char edj_path[1024] = { 0 }; - - char *path = app_get_resource_path(); - snprintf(edj_path, 1024, "%s%s/%s", path, "edje", - VIDEO_PLAYER_LISTVIEW_EDJ); - free(path); - // Create folder view base layout. - g_pFolderViewWidget->pFolderViewBaselayout = elm_layout_add(pParent); - elm_layout_file_set(g_pFolderViewWidget->pFolderViewBaselayout, - edj_path, LISTVIEW_EDJ_GROUP); - evas_object_size_hint_weight_set(g_pFolderViewWidget-> - pFolderViewBaselayout, - EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); - evas_object_size_hint_align_set(g_pFolderViewWidget-> - pFolderViewBaselayout, EVAS_HINT_FILL, - EVAS_HINT_FILL); - return g_pFolderViewWidget->pFolderViewBaselayout; -} - -/** - * - * @param pNaviFrame - * @param pUserData - */ -static void __mp_folder_item_view_pop(void *pNaviFrame, void *pUserData) -{ - if (!g_pFolderViewHandle) { - VideoLogInfo("[ERR] g_pFolderViewHandle"); - return; - } - mp_ft_ctrl_destroy(); - - if (g_pFolderViewHandle && g_pFolderViewHandle->pUpdateListUserCbFunc) { - g_pFolderViewHandle->pUpdateListUserCbFunc(LIST_UPDATE_TYPE_ALL); - - VideoLogInfo(""); - } - -} - -/** - * - * @param pUserData - * @param obj - * @param event_info - */ -static void __mp_folder_item_view_trans_finished_cb(void *pUserData, - Evas_Object * obj, - void *event_info) -{ - if (!obj) { - VideoLogError("[ERR] g_pAsfDeviceListViewHandle is NULL."); - return; - } - - mp_widget_ctrl_enable_navi_handle_focus(obj); - - evas_object_smart_callback_del(obj, "transition,finished", - __mp_folder_item_view_trans_finished_cb); -} - -// Back button -/** - * - * @param pUserData - * @param pItem - * @return - */ -static Eina_Bool __mp_folder_item_view_back_btn_cb(void *pUserData, - Elm_Object_Item * pItem) -{ - if (!g_pFolderViewHandle) { - VideoLogInfo("[ERR] g_pListRemoveViewHandle is NULL."); - return EINA_TRUE; - } - VideoLogInfo(""); - g_pFolderViewHandle->bExist = true; - mp_widget_ctrl_disable_navi_handle_focus_except_item - (g_pFolderViewHandle->pNaviFrameHandle, - g_pFolderViewHandle->pNaviFrameItem); - evas_object_smart_callback_add(g_pFolderViewHandle->pNaviFrameHandle, - "transition,finished", - __mp_folder_item_view_trans_finished_cb, - NULL); - __mp_folder_item_view_pop(g_pFolderViewHandle->pNaviFrameHandle, NULL); - mp_folder_view_set_is_item_view(false); - - return EINA_TRUE; -} - -/** - * - * @param nVideoItemIndex - * @return - */ -static char *__mp_folder_item_view_get_guration_time(int nVideoItemIndex) -{ - VideoLogInfo(""); - - char szTmpStr[STR_LEN_MAX] = { 0, }; - char szTmpStrDurationTime[STR_LEN_MAX] = { 0, }; - - unsigned int nVideoInfoDuration = - mp_util_svc_get_video_duration_time(nVideoItemIndex); - - mp_util_convert_time(nVideoInfoDuration, szTmpStrDurationTime, FALSE); - snprintf(szTmpStr, STR_LEN_MAX, "%s", szTmpStrDurationTime); - - return strdup(szTmpStr); -} +void mp_folder_item_view_check_more_button_of_toolbar(void); +static void __mp_folder_soft_back_button_cb(void *data, Evas_Object * obj, void *event_info); /** * @@ -370,42 +136,27 @@ static char *__mp_folder_item_view_get_label_of_video_item_cb(void *pPart) { - int nVideoItemIndex = (int) pUserData; + stGengridItemData *item_data = pUserData; + int nVideoItemIndex = item_data->videoIndex; mp_util_svc_destory_video_item_list(); - mp_util_svc_extract_video_list_from_folder(g_pFolderViewHandle-> - pFolderUrl, - __mp_folder_item_view_get_sort_type - (), MP_LIST_VIEW_ALL); - if (!strcmp(pPart, "elm.text.main.left.top")) { - char *szTitle; - szTitle = mp_util_svc_get_video_title(nVideoItemIndex); - char *szTitleUtf8 = elm_entry_utf8_to_markup(szTitle); - VideoLogWarning("testestesteste = %d, %s", nVideoItemIndex, - szTitleUtf8); + mp_util_svc_extract_video_list_from_folder(g_pFolderViewHandle->pFolderUrl, + __mp_folder_item_view_get_sort_type(), + MP_LIST_VIEW_ALL); - if (szTitle) { - free(szTitle); - szTitle = NULL; - } - - return szTitleUtf8; - } else if (!strcmp(pPart, "elm.text.sub.left.bottom")) { - return __mp_folder_item_view_get_guration_time(nVideoItemIndex); - } else if (!strcmp(pPart, "elm.text")) { + if (!strcmp(pPart, "elm.text")) { char *szTitle; szTitle = mp_util_svc_get_video_title(nVideoItemIndex); char *szTitleUtf8 = elm_entry_utf8_to_markup(szTitle); - VideoLogInfo("%s", szTitle); + if (szTitle) { free(szTitle); szTitle = NULL; } return szTitleUtf8; - } else if (!strcmp(pPart, "elm.text.2")) { - return __mp_folder_item_view_get_guration_time(nVideoItemIndex); + } else if (!strcmp(pPart, "elm.sub.text")) { + return mp_util_svc_get_duration_str_time(nVideoItemIndex); } - return NULL; } @@ -514,87 +265,54 @@ Evas_Object *__mp_folder_item_view_get_icon_of_video_item_cb(void const char *pPart) { - - Evas_Object *pLayout = NULL; - - int nVideoItemIndex = (int) pUserData; + stGengridItemData *item_data = (void*)pUserData; + int nVideoItemIndex = item_data->videoIndex; if (!pPart || !pObject) { return NULL; } mp_util_svc_destory_video_item_list(); - mp_util_svc_extract_video_list_from_folder(g_pFolderViewHandle-> - pFolderUrl, - __mp_folder_item_view_get_sort_type - (), MP_LIST_VIEW_ALL); - if (!strcmp(pPart, "elm.icon.1")) { - VideoLogInfo("pPart: elm.icon.1 - thumbnail"); - - char *pThumbIconUri = - mp_util_svc_get_video_thumbnail(nVideoItemIndex); - Evas_Object *pBg = NULL; - char edj_path[1024] = { 0 }; - - char *path = app_get_resource_path(); - snprintf(edj_path, 1024, "%s%s/%s", path, "edje", - VIDEO_CUSTOM_THEME); - free(path); - pLayout = elm_layout_add(pObject); - elm_layout_file_set(pLayout, edj_path, - "listview.thumbnail.layout"); - - if (!pThumbIconUri || !vp_file_exists(pThumbIconUri)) { - MP_FREE_STRING(pThumbIconUri); - } - - pBg = - mp_util_create_preload_image(pLayout, pThumbIconUri, - VIDEO_ICON_WIDTH); - elm_layout_content_set(pLayout, "elm.thumbnail.icon", pBg); - - if (pBg) - evas_object_show(pBg); - - MP_FREE_STRING(pThumbIconUri); - - if (!mp_util_create_video_sub_icon(pLayout, nVideoItemIndex)) { - VideoLogWarning("Local File or Create sub icon is failed.", - nVideoItemIndex); - } + mp_util_svc_extract_video_list_from_folder(g_pFolderViewHandle->pFolderUrl, + __mp_folder_item_view_get_sort_type(), + MP_LIST_VIEW_ALL); - if (pLayout) { - evas_object_show(pLayout); - } + char edj_path[1024] = { 0 }; + char *path = app_get_resource_path(); + snprintf(edj_path, 1024, "%s%s/%s", path, "edje", VIDEO_CUSTOM_THEME); + free(path); - return pLayout; - } else if (!strcmp(pPart, "elm.swallow.icon")) { - char *pThumbIconUri = - mp_util_svc_get_video_thumbnail(nVideoItemIndex); - Evas_Object *thumb = NULL; - int nWidth = 0; - int nHeight = 0; - - thumb = elm_image_add(pObject); - elm_image_preload_disabled_set(thumb, EINA_FALSE); - elm_image_smooth_set(thumb, EINA_FALSE); - elm_image_prescale_set(thumb, 50 * MP_SCALE); - elm_image_file_set(thumb, pThumbIconUri, NULL); - elm_image_object_size_get(thumb, &nWidth, &nHeight); - - if (nWidth > nHeight) { - elm_image_aspect_fixed_set(thumb, EINA_FALSE); + if (!strcmp(pPart, "elm.icon")) { + char *pThumbIconUri = mp_util_svc_get_video_thumbnail(nVideoItemIndex); + if(pThumbIconUri == NULL) + { + VideoLogError("thumbnail url is invalid"); + return NULL; } - if (thumb) - evas_object_show(thumb); - - MP_FREE_STRING(pThumbIconUri); - - return thumb; - } else if (!strcmp(pPart, "elm.progressbar.icon")) { - return NULL; + Evas_Object *img = elm_image_add(pObject); + elm_image_file_set(img, pThumbIconUri, NULL); + elm_image_aspect_fixed_set(img, EINA_FALSE); + elm_image_preload_disabled_set(img, EINA_FALSE); + evas_object_size_hint_weight_set(img, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); + evas_object_size_hint_align_set(img, EVAS_HINT_FILL, EVAS_HINT_FILL); + + item_data->icon = img; + free(pThumbIconUri); + + return img; + } + else if(!strcmp(pPart, "elm.progress")) + { + Evas_Object *progessbar = elm_layout_add(pObject); + Eina_Bool ret = elm_layout_file_set(progessbar, edj_path, "videolist/progressbar"); + VideoLogInfo("layout file set %s %s",(ret? "Successful": "Failed"), pPart); + evas_object_size_hint_weight_set(progessbar, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); + evas_object_size_hint_align_set(progessbar, EVAS_HINT_FILL, EVAS_HINT_FILL); + // TO DO: remove this once we are able to get the elapsed time for video file. + double value = (((double) rand() ) / RAND_MAX ); + edje_object_part_drag_value_set(elm_layout_edje_get(progessbar), "elm.cur.progressbar", value, 0.0); + //__mp_thumbnail_view_get_playback_progress(nVideoItemIndex); + item_data->progress_layout = progessbar; + return progessbar; } - - MP_DEL_OBJ(pLayout); - return NULL; } @@ -651,8 +369,8 @@ static void __mp_folder_item_view_select_video_item_cb(void *pUserData, VideoLogWarning("nVideoItemIndex < 0 ===>>> RETURN"); return; } - - int nVideoItemIndex = (int) pUserData; + stGengridItemData *item_data = (stGengridItemData*)pUserData; + int nVideoItemIndex = item_data->videoIndex; int nVideoListSize = g_pFolderViewHandle->currentItemCount; VideoLogDebug("nVideoItemIndex = %d--%d", nVideoItemIndex, @@ -748,283 +466,93 @@ static void __mp_folder_item_view_video_item_del_cb(void *data, } #ifdef VS_FEATURE_THUMBNAIL_VIEW -/** - * - * @param pObjVideosList - * @param nGenItemIndex - */ -static void __mp_folder_item_view_append_gengrid_items(Evas_Object * - pObjVideosList, - int nGenItemIndex) -{ - if (!g_pFolderViewHandle) { - VideoLogInfo("invalid handle"); - return; - } - MP_DEL_GRID_ITC(g_pFolderViewHandle->pGenGridItc_l); - g_pFolderViewHandle->pGenGridItc_l = elm_gengrid_item_class_new(); - g_pFolderViewHandle->pGenGridItc_l->item_style = "video/album_grid"; - g_pFolderViewHandle->pGenGridItc_l->func.text_get = - (void *) __mp_folder_item_view_get_label_of_video_item_cb; - g_pFolderViewHandle->pGenGridItc_l->func.content_get = - (void *) __mp_folder_item_view_get_icon_of_video_item_cb; - g_pFolderViewHandle->pGenGridItc_l->func.state_get = NULL; - g_pFolderViewHandle->pGenGridItc_l->func.del = NULL; - - int nCount = - (mp_rotate_ctrl_check_landspace() ? VP_GENLIST_THUMB_LANDSPACE_COUNT - : VP_GENLIST_THUMB_PORTRAIT_COUNT); - int nIndex = nGenItemIndex * nCount; - int nMaxIndex = nIndex + nCount; - int nVideoListSize = g_pFolderViewHandle->currentItemCount; - Elm_Object_Item *gridItem = NULL; - for (; (nIndex < nMaxIndex) && (nIndex < nVideoListSize); nIndex++) { - gridItem = - elm_gengrid_item_append(pObjVideosList, - g_pFolderViewHandle->pGenGridItc_l, - (void *) nIndex, - __mp_folder_item_view_select_video_item_cb, - (void *) nIndex); - elm_gengrid_item_select_mode_set(gridItem, - ELM_OBJECT_SELECT_MODE_ALWAYS); - elm_object_item_data_set(gridItem, (void *) nIndex); - } -} -/** - * - * @param parent - * @param nWidth - * @param nHeight - * @return - */ -static Evas_Object *__mp_folder_item_view_create_gengrid(Evas_Object * - parent, - int nWidth, - int nHeight) +static void __mp_folder_item_view_gengrid_item_del_cb(void *pUserdata, + Evas_Object * obj, + void *event_info) { - Evas_Object *pGengrid; - pGengrid = elm_gengrid_add(parent); - if (!pGengrid) { - VideoLogError("pVideoGrid is not existed."); - return NULL; - } - evas_object_size_hint_weight_set(pGengrid, EVAS_HINT_EXPAND, - EVAS_HINT_EXPAND); - evas_object_size_hint_align_set(pGengrid, EVAS_HINT_FILL, - EVAS_HINT_FILL); - elm_gengrid_item_size_set(pGengrid, nWidth, nHeight); - elm_gengrid_align_set(pGengrid, 0.0, 0.0); - elm_gengrid_horizontal_set(pGengrid, EINA_TRUE); - - return pGengrid; -} - -/** - * - * @param height - * @param width - */ -static void mp_item_of_folder_view_get_icon_dimensions(int *height, - int *width) -{ - int winHeight = 0; - int winWidth = 0; - elm_win_screen_size_get(mp_util_get_main_window_handle(), NULL, NULL, - &winWidth, &winHeight); - - bool bLandscape = - mp_rotate_ctrl_check_landspace_by_win((Evas_Object *) - mp_util_get_main_window_handle - ()); - if (bLandscape) { - *width = winHeight / VP_GENLIST_THUMB_LANDSPACE_COUNT; - } else { - *width = winWidth / VP_GENLIST_THUMB_PORTRAIT_COUNT; - } - *height = VP_ALBUM_THUMB_ICON_HEIGHT * MP_SCALE; -} - -/** - * - * @param pUserData - * @param pObject - * @param pPart - * @return - */ -static Evas_Object *__mp_folder_item_view_get_icon_of_grid_cb(const void - *pUserData, - Evas_Object * - pObject, - const char - *pPart) -{ - if (!g_pFolderViewHandle || !pObject) { - VideoLogError("g_pMainViewWidgetOfFolderItemList is NULL"); - return NULL; - } - - int nGenItemIndex = (int) pUserData; - int nHeight = 0; - int nWidth = 0; - mp_item_of_folder_view_get_icon_dimensions(&nHeight, &nWidth); - - Evas_Object *pGengrid = - __mp_folder_item_view_create_gengrid(pObject, nWidth, nHeight); - __mp_folder_item_view_append_gengrid_items(pGengrid, nGenItemIndex); - - return pGengrid; -} - -/** - * - * @param nVideoItemIndex - * @return - */ -static int mp_folder_item_view_thumbnail_to_genlist_index(int - nVideoItemIndex) -{ - if (nVideoItemIndex < 0) { - VideoLogDebug("invalid nVideoItemIndex"); - return 0; - } - int nItemCount = VP_GENLIST_THUMB_PORTRAIT_COUNT; - int nGenlistIndex = 0; - if (g_pFolderViewHandle->bLandscape) { - nItemCount = VP_GENLIST_THUMB_LANDSPACE_COUNT; + if (!g_pFolderViewHandle || !event_info) { + VideoLogError("g_pMainViewWidge is NULL"); + return; } - nGenlistIndex = nVideoItemIndex / nItemCount; - return nGenlistIndex; + stGengridItemData *item_data = pUserdata; + Elm_Object_Item *item = event_info; + elm_object_item_data_set(item, NULL); + free(item_data); } /** * - * @param pGenlist + * @param pObjVideosList + * @param nGenItemIndex */ -static void __mp_folder_item_view_append_grid_layout(void *pGenlist) +static void __mp_folder_item_view_append_gengrid_items(Evas_Object *pObjVideosList) { - if (!pGenlist || !g_pFolderViewHandle) { - VideoLogError("error handle."); + if (!g_pFolderViewHandle) { + VideoLogInfo("invalid handle"); return; } - int nIndex = 0; - int nVideoListSize = g_pFolderViewHandle->currentItemCount; - if (nVideoListSize <= 0) { - VideoLogWarning("nVideoListSize = %d", nVideoListSize); - return; + VideoLogError("adding Gengrid items"); + if(g_pFolderViewHandle->pFolderItemGIC == NULL) + { + g_pFolderViewHandle->pFolderItemGIC = elm_gengrid_item_class_new(); + g_pFolderViewHandle->pFolderItemGIC->item_style = "videolist"; + g_pFolderViewHandle->pFolderItemGIC->func.text_get = + __mp_folder_item_view_get_label_of_video_item_cb; + g_pFolderViewHandle->pFolderItemGIC->func.content_get = + __mp_folder_item_view_get_icon_of_video_item_cb; + g_pFolderViewHandle->pFolderItemGIC->func.state_get = NULL; + g_pFolderViewHandle->pFolderItemGIC->func.del = NULL; } - MP_DEL_ITC(g_pFolderViewHandle->pGenGridItc); - g_pFolderViewHandle->pGenGridItc = elm_genlist_item_class_new(); - g_pFolderViewHandle->pGenGridItc->item_style = "video/1icon.thumbnail"; - g_pFolderViewHandle->pGenGridItc->func.text_get = NULL; - g_pFolderViewHandle->pGenGridItc->func.content_get = - (void *) __mp_folder_item_view_get_icon_of_grid_cb; - g_pFolderViewHandle->pGenGridItc->func.state_get = NULL; - g_pFolderViewHandle->pGenGridItc->func.del = NULL; - g_pFolderViewHandle->pGenGridItc->decorate_item_style = NULL; - - MP_DEL_ITC(g_pFolderViewHandle->pGenGridLandscapeItc); - g_pFolderViewHandle->pGenGridLandscapeItc = - elm_genlist_item_class_new(); - g_pFolderViewHandle->pGenGridLandscapeItc->item_style = - "video/1icon.thumbnail.landscape"; - g_pFolderViewHandle->pGenGridLandscapeItc->func.text_get = NULL; - g_pFolderViewHandle->pGenGridLandscapeItc->func.content_get = - (void *) __mp_folder_item_view_get_icon_of_grid_cb; - g_pFolderViewHandle->pGenGridLandscapeItc->func.state_get = NULL; - g_pFolderViewHandle->pGenGridLandscapeItc->func.del = NULL; - g_pFolderViewHandle->pGenGridLandscapeItc->decorate_item_style = NULL; - - int nGenlistRow = 0; - nGenlistRow = - mp_folder_item_view_thumbnail_to_genlist_index(nVideoListSize - 1); - Elm_Object_Item *pTmpVideoGenlistItem = NULL; - - if (mp_rotate_ctrl_check_landspace()) { - for (nIndex = 0; nIndex <= nGenlistRow; nIndex++) { - pTmpVideoGenlistItem = - elm_genlist_item_append(pGenlist, - g_pFolderViewHandle->pGenGridItc, - (void *) nIndex, NULL, - ELM_GENLIST_ITEM_NONE, NULL, NULL); - g_pFolderViewWidget->pVideolistItemList = - eina_list_append(g_pFolderViewWidget->pVideolistItemList, - pTmpVideoGenlistItem); - elm_object_item_del_cb_set(pTmpVideoGenlistItem, - __mp_folder_item_view_video_item_del_cb); - } - } else { - for (nIndex = 0; nIndex <= nGenlistRow; nIndex++) { - pTmpVideoGenlistItem = - elm_genlist_item_append(pGenlist, - g_pFolderViewHandle-> - pGenGridLandscapeItc, - (void *) nIndex, NULL, - ELM_GENLIST_ITEM_NONE, NULL, NULL); - g_pFolderViewWidget->pVideolistItemList = - eina_list_append(g_pFolderViewWidget->pVideolistItemList, - pTmpVideoGenlistItem); - elm_object_item_del_cb_set(pTmpVideoGenlistItem, - __mp_folder_item_view_video_item_del_cb); + int nVideoListSize = g_pFolderViewHandle->currentItemCount; + int nIndex = 0; + for (nIndex = 0; nIndex < nVideoListSize; nIndex++) { + stGengridItemData *item_data = calloc(1, sizeof(stGengridItemData)); + if(item_data == NULL) + { + VideoLogError("failed to allocate memory for item data"); + return; } + item_data->videoIndex = nIndex; + item_data->item = elm_gengrid_item_append(pObjVideosList, + g_pFolderViewHandle->pFolderItemGIC, + (void *) item_data, + __mp_folder_item_view_select_video_item_cb, + (void *) item_data); + elm_gengrid_item_select_mode_set(item_data->item, ELM_OBJECT_SELECT_MODE_ALWAYS); + elm_object_item_del_cb_set(item_data->item, __mp_folder_item_view_gengrid_item_del_cb); } } #endif -/** - * - */ -static void __mp_folder_item_view_hide_genlist(void) +Evas_Object* __mp_folder_item_view_create_back_button(Evas_Object *parent) { - if (!g_pFolderViewWidget || !g_pFolderViewHandle) { - VideoLogError("g_pSearchViewWidget == NULL"); - return; - } - - elm_object_part_content_unset(g_pFolderViewWidget-> - pFolderViewBaselayout, - SWALLOW_LISTVIEW_CONTENT); - if (g_pFolderViewHandle->pVideosGenlist) { - evas_object_hide(g_pFolderViewHandle->pVideosGenlist); - } + Evas_Object* button = elm_button_add(parent); + elm_object_style_set(button, "naviframe/back_btn/default"); + evas_object_smart_callback_add(button, "clicked", __mp_folder_soft_back_button_cb, NULL); + return button; } -/** - * - */ -static void __mp_folder_item_view_hide_no_layout(void) +void mp_folder_item_view_update_base_layout_content(Evas_Object* content) { - if (!g_pFolderViewWidget || !g_pFolderViewHandle) { - VideoLogError("g_pSearchViewWidget == NULL"); - return; + VideoLogError("g_pFolderViewWidget->pBackButton: %p", g_pFolderViewWidget->pBackButton); + mp_folder_view_set_is_item_view(true); + Evas_Object* old_content = mp_list_view_base_layout_content_set(content); + if(old_content == g_pFolderViewWidget->pNocontentLayout) + { + MP_DEL_OBJ(g_pFolderViewWidget->pNocontentLayout); + g_pFolderViewWidget->pNocontentLayout = NULL; } - if (g_pFolderViewWidget->pNocontentsLayout) { - elm_object_part_content_unset(g_pFolderViewWidget-> - pFolderViewBaselayout, - SWALLOW_LISTVIEW_CONTENT); - MP_DEL_OBJ(g_pFolderViewWidget->pNocontentsLayout); + char *folder_name = mp_util_svc_get_video_folder_name(g_pFolderViewHandle->nFolder_index); + if(g_pFolderViewWidget->pBackButton == NULL) + { + g_pFolderViewWidget->pBackButton = __mp_folder_item_view_create_back_button(g_pFolderViewHandle->pNaviframeItem); } -} - -/** - * - * @return - */ -static Evas_Object *__mp_folder_item_view_add_no_contents_layout() -{ - if (!g_pFolderViewWidget) { - VideoLogError("g_pFolderViewWidget is not existed."); - return NULL; - } - VideoLogInfo(""); - MP_DEL_OBJ(g_pFolderViewWidget->pNocontentsLayout); - g_pFolderViewWidget->pNocontentsLayout = - mp_create_nocontent_layout(g_pFolderViewWidget-> - pFolderViewBaselayout, - VIDEOS_NOCONTENT_MSG_NO_VIDEOS_IDS, - NULL); - return g_pFolderViewWidget->pNocontentsLayout; + evas_object_show(g_pFolderViewWidget->pBackButton); + mp_list_view_update_naviframe_title(folder_name, g_pFolderViewWidget->pBackButton); + mp_folder_item_view_check_more_button_of_toolbar(); + MP_FREE_STRING(folder_name); } /** @@ -1035,15 +563,14 @@ static Evas_Object *__mp_folder_item_view_add_no_contents_layout() * @return */ static bool __mp_folder_item_view_arrange_video_list(int nItemSortType, - MpListUpdateType - eUpdateType, - void *pVideosGenlist) + MpListUpdateType eUpdateType, + Evas_Object *pFolderItemGengrid) { if (!g_pFolderViewWidget || !g_pFolderViewHandle) { - VideoLogError("No exist g_pSearchViewWidget."); + VideoLogError("No exist g_pFolderViewWidget."); return false; } - + VideoLogError(""); int nVideoListSize = 0; bool bUnset = FALSE; if (eUpdateType == LIST_UPDATE_TYPE_ALL @@ -1058,32 +585,27 @@ static bool __mp_folder_item_view_arrange_video_list(int nItemSortType, nVideoListSize = mp_util_svc_get_number_of_video_item_by_type(); g_pFolderViewHandle->currentItemCount = nVideoListSize; - elm_genlist_clear(pVideosGenlist); - + elm_gengrid_clear(pFolderItemGengrid); if (nVideoListSize > 0) { - __mp_folder_item_view_free_video_genlistItem(); - if (g_pFolderViewWidget->pNocontentsLayout) { - __mp_folder_item_view_hide_no_layout(); - bUnset = TRUE; - } - __mp_folder_item_view_append_grid_layout(pVideosGenlist); - if (bUnset) { - elm_object_part_content_set(g_pFolderViewWidget-> - pFolderViewBaselayout, - SWALLOW_LISTVIEW_CONTENT, - pVideosGenlist); - evas_object_show(pVideosGenlist); - } + VideoLogError("Video Count: %d", nVideoListSize); + __mp_folder_item_view_append_gengrid_items(pFolderItemGengrid); + evas_object_show(pFolderItemGengrid); + g_pFolderViewHandle->pCurrentLayout = pFolderItemGengrid; } else { - __mp_folder_item_view_hide_genlist(); - __mp_folder_item_view_add_no_contents_layout(); - elm_object_part_content_set(g_pFolderViewWidget-> - pFolderViewBaselayout, - SWALLOW_LISTVIEW_CONTENT, - g_pFolderViewWidget-> - pNocontentsLayout); - evas_object_show(g_pFolderViewWidget->pNocontentsLayout); + VideoLogError("Adding no content layout"); + if(g_pFolderViewWidget->pNocontentLayout == NULL) + { + g_pFolderViewWidget->pNocontentLayout = mp_create_nocontent_layout(g_pFolderViewHandle->pMainWidget->pListViewBaselayout, + VIDEOS_NOCONTENT_MSG_NO_VIDEOS_IDS, + NULL); + } + //hide gengrid + evas_object_hide(pFolderItemGengrid); + //show no content layout + evas_object_show(g_pFolderViewWidget->pNocontentLayout); + g_pFolderViewHandle->pCurrentLayout = g_pFolderViewWidget->pNocontentLayout; } + mp_folder_item_view_update_base_layout_content(g_pFolderViewHandle->pCurrentLayout); return true; } @@ -1163,10 +685,9 @@ Evas_Object *__mp_folder_item_view_create_title_btn(Evas_Object * pParent, * @param pObject * @param pEventInfo */ -static void __mp_folder_item_view_realize_genlist_item_cb(void *pUserData, - Evas_Object * - pObject, - void *pEventInfo) +static void __mp_folder_item_view_realize_gengrid_item_cb(void *pUserData, + Evas_Object *pObject, + void *pEventInfo) { if (!pEventInfo) { VideoLogError("invalid pEveninfo"); @@ -1413,7 +934,7 @@ void __mp_folder_item_view_rename_cb(void *pUserData, mp_util_svc_get_video_folder_url(g_pFolderViewHandle-> nFolder_index); mp_select_view_push((void *) mp_mgr_get_library_naviframe(), - g_pFolderViewHandle->pNaviFrameItem, + g_pFolderViewHandle->pNaviframeItem, __mp_folder_item_view_result_user_cb, szFolderPath, SELECT_TYPE_RENAME, LIST_TAB_TYPE_PERSONAL); MP_FREE_STRING(szFolderPath); @@ -1426,26 +947,6 @@ void __mp_folder_item_view_rename_cb(void *pUserData, * @param pObject * @param pEventInfo */ -static void __mp_folder_item_view_download_cb(void *pUserData, - Evas_Object * pObject, - void *pEventInfo) -{ - if (!g_pFolderViewHandle) { - VideoLogError("g_pFolderViewHandle == NULL"); - return; - } - - VideoLogInfo(""); - - mp_ft_ctrl_hide_more_popup(); -} - -/** - * - * @param pUserData - * @param pObject - * @param pEventInfo - */ static void __mp_folder_item_view_share_cb(void *pUserData, Evas_Object * pObject, void *pEventInfo) @@ -1566,7 +1067,6 @@ static void __mp_folder_item_view_add_to_home_cb(void *pUserData, VideoLogInfo("nVideoItemIndex : %d", nVideoItemIndex); - char *pVideo_id = mp_util_svc_get_video_id_by_index(nVideoItemIndex); char *pVideo_thumbnail = mp_util_svc_get_video_thumbnail(nVideoItemIndex); @@ -1653,14 +1153,14 @@ static void __mp_folder_item_view_normal_result_popup() VideoLogError("Invalid list and object"); return; } - evas_object_data_set(g_pFolderViewHandle->pVideosGenlist, "popup", + evas_object_data_set(g_pFolderViewHandle->pFolderItemGengrid, "popup", NULL); - elm_object_scroll_freeze_pop(g_pFolderViewHandle->pVideosGenlist); + elm_object_scroll_freeze_pop(g_pFolderViewHandle->pFolderItemGengrid); } static void __mp_folder_item_view_long_press_item_cb(void *data, - Evas_Object * obj, - void *pEventInfo) + Evas_Object * obj, + void *pEventInfo) { if (!g_pFolderViewHandle || !pEventInfo) { VideoLogError("Invalid list"); @@ -1668,19 +1168,19 @@ static void __mp_folder_item_view_long_press_item_cb(void *data, } Elm_Object_Item *long_item = (Elm_Object_Item *) pEventInfo; + stGengridItemData *item_data = elm_object_item_data_get(long_item); - int nIndexGenlist = elm_genlist_item_index_get(long_item); - VideoLogDebug("nIndexGenlist : %d", nIndexGenlist); + int nIndexGengrid = item_data->videoIndex; + VideoLogDebug("nIndexGengrid : %d", nIndexGengrid); - if (nIndexGenlist < 0 - || nIndexGenlist >= + if (nIndexGengrid < 0 + || nIndexGengrid >= mp_util_svc_get_video_list_size_for_checking_index()) { VideoSecureLogError("nVideoItemIndex is invalid"); return; } st_RegisteOptionCbFunc *pRegisteCbFunc = - (st_RegisteOptionCbFunc *) calloc(1, - sizeof(st_RegisteOptionCbFunc)); + (st_RegisteOptionCbFunc *) calloc(1, sizeof(st_RegisteOptionCbFunc)); if (pRegisteCbFunc) { pRegisteCbFunc->ShareViaItemCb = (void *) __mp_folder_item_view_share_via_cb; @@ -1690,16 +1190,16 @@ static void __mp_folder_item_view_long_press_item_cb(void *data, (void *) __mp_folder_item_view_delete_btn_cb; } - char *title = mp_util_svc_get_video_title(nIndexGenlist); + char *title = mp_util_svc_get_video_title(nIndexGengrid); mp_option_ctrl_show(g_pFolderViewHandle->pNaviFrameHandle, - (const char *) title, nIndexGenlist, + (const char *) title, nIndexGengrid, pRegisteCbFunc, __mp_folder_item_view_normal_result_popup, NULL, 0); if (mp_option_ctrl_get_handle()) { - evas_object_data_set(g_pFolderViewHandle->pVideosGenlist, "popup", + evas_object_data_set(g_pFolderViewHandle->pFolderItemGengrid, "popup", mp_option_ctrl_get_handle()); - elm_object_scroll_freeze_push(g_pFolderViewHandle->pVideosGenlist); + elm_object_scroll_freeze_push(g_pFolderViewHandle->pFolderItemGengrid); } MP_FREE_STRING(pRegisteCbFunc); MP_FREE_STRING(title); @@ -1721,61 +1221,36 @@ void __mp_folder_item_view_language_changed(void *pUserData, if (!pObject) { VideoSecureLogError("error genlist handle"); } - elm_genlist_realized_items_update(pObject); + elm_gengrid_realized_items_update(pObject); } /*internal*/ /** * + * @param pFolderItemGengrid */ -static void __mp_folder_item_view_del_genlist_cb(void) +static void __mp_folder_item_view_add_gengrid_cb(Evas_Object *pFolderItemGengrid) { - if (!g_pFolderViewHandle || !g_pFolderViewHandle->pVideosGenlist) { - VideoSecureLogError - ("g_pFolderViewHandle or pVideosGenlist is NULL"); + if (pFolderItemGengrid == NULL) { + VideoSecureLogError("pFolderItemGengrid is NULL"); return; } VideoLogInfo(""); - evas_object_smart_callback_del(g_pFolderViewHandle->pVideosGenlist, - "language,changed", - __mp_folder_item_view_language_changed); - evas_object_smart_callback_del(g_pFolderViewHandle->pVideosGenlist, - "realized", - __mp_folder_item_view_realize_genlist_item_cb); -#ifdef ENABLE_LONGPRESS - evas_object_smart_callback_del(g_pFolderViewHandle->pVideosGenlist, - "longpressed", - __mp_folder_item_view_long_press_item_cb); -#endif -} -/*internal*/ -/** - * - * @param pVideosGenlist - */ -static void __mp_folder_item_view_add_genlist_cb(void *pVideosGenlist) -{ - if (!g_pFolderViewHandle || !g_pFolderViewHandle->pVideosGenlist) { - VideoSecureLogError("g_pFolderViewHandle is NULL"); - return; - } - VideoLogInfo(""); - - evas_object_smart_callback_add(g_pFolderViewHandle->pVideosGenlist, - "language,changed", - __mp_folder_item_view_language_changed, - NULL); - evas_object_smart_callback_add(g_pFolderViewHandle->pVideosGenlist, - "realized", - __mp_folder_item_view_realize_genlist_item_cb, - NULL); + evas_object_smart_callback_add(pFolderItemGengrid, + "language,changed", + __mp_folder_item_view_language_changed, + NULL); + evas_object_smart_callback_add(pFolderItemGengrid, + "realized", + __mp_folder_item_view_realize_gengrid_item_cb, + NULL); #ifdef ENABLE_LONGPRESS - evas_object_smart_callback_add(g_pFolderViewHandle->pVideosGenlist, - "longpressed", - __mp_folder_item_view_long_press_item_cb, - NULL); + evas_object_smart_callback_add(pFolderItemGengrid, + "longpressed", + __mp_folder_item_view_long_press_item_cb, + NULL); #endif } @@ -1784,34 +1259,17 @@ static void __mp_folder_item_view_add_genlist_cb(void *pVideosGenlist) * @param eUpdateType * @return */ -static bool __mp_folder_item_view_update_video_list(MpListUpdateType - eUpdateType) +static bool __mp_folder_item_view_update_video_list(MpListUpdateType eUpdateType) { if (!g_pFolderViewHandle || !g_pFolderViewWidget - || !g_pFolderViewHandle->pVideosGenlist) { + || !g_pFolderViewHandle->pFolderItemGengrid) { VideoLogError("handles of list view are not existed."); return false; } - - __mp_folder_item_view_del_genlist_cb(); - - bool bRet = - __mp_folder_item_view_arrange_video_list - (__mp_folder_item_view_get_sort_type(), eUpdateType, - g_pFolderViewHandle->pVideosGenlist); - int nVideoListSize = 0; - if (bRet) { - nVideoListSize = mp_util_svc_get_number_of_video_item_by_type(); - - if (nVideoListSize > 0) { - VideoLogInfo("listsize:%d", nVideoListSize); - g_pFolderViewHandle->currentItemCount = nVideoListSize; - __mp_folder_item_view_add_genlist_cb(g_pFolderViewHandle-> - pVideosGenlist); - } - } - - return bRet; + VideoLogError(""); + return __mp_folder_item_view_arrange_video_list(__mp_folder_item_view_get_sort_type(), + eUpdateType, + g_pFolderViewHandle->pFolderItemGengrid); } /** @@ -1867,7 +1325,7 @@ static void __mp_folder_item_view_delete_video_items(int nVideoItemIndex) Elm_Object_Item *pNextGenlistItem = NULL; Elm_Object_Item *pCurrGenlistItem = - elm_genlist_item_next_get(pTmpVideoGenlistItem); + elm_genlist_item_next_get(pTmpVideoGenlistItem); g_pFolderViewWidget->pVideolistItemList = eina_list_remove(g_pFolderViewWidget->pVideolistItemList, @@ -1907,22 +1365,6 @@ static void __mp_folder_item_view_delete_video_items(int nVideoItemIndex) /** * - * @param pUserData - * @param e - * @param pObject - * @param pEventInfo - */ -static void -__mp_folder_item_view_base_layout_del_cb(void *pUserData, Evas * e, - Evas_Object * pObject, - void *pEventInfo) -{ - VideoLogInfo(""); - __mp_folder_item_view_reset(); -} - -/** - * * @param data * @param obj * @param event_info @@ -1943,9 +1385,37 @@ static void __mp_folder_item_view_rotate_cb(void *data, Evas_Object * obj, } else { g_pFolderViewHandle->bLandscape = false; } - elm_genlist_clear(g_pFolderViewHandle->pVideosGenlist); - __mp_folder_item_view_append_grid_layout(g_pFolderViewHandle-> - pVideosGenlist); + elm_gengrid_clear(g_pFolderViewHandle->pFolderItemGengrid); + __mp_folder_item_view_append_gengrid_items(g_pFolderViewHandle->pFolderItemGengrid); +} + +static Eina_Bool delete_folder_item_view_idler_cb(void *data) +{ + VideoLogError(""); + if(g_pFolderViewHandle == NULL) + { + VideoLogError("g_pFolderViewHandle is invalid"); + return ECORE_CALLBACK_CANCEL; + } + elm_gengrid_clear(g_pFolderViewHandle->pFolderItemGengrid); + MP_DEL_GRID_ITC(g_pFolderViewHandle->pFolderItemGIC); + MP_DEL_OBJ(g_pFolderViewHandle->pFolderItemGengrid); + g_pFolderViewHandle->nPlayVideoIndex = -1; + MP_FREE_STRING(g_pFolderViewHandle->pFolderUrl); + + if (g_pFolderViewWidget) { + MP_DEL_OBJ(g_pFolderViewWidget->pNocontentLayout); + MP_DEL_OBJ(g_pFolderViewWidget->pBackButton); + + free(g_pFolderViewWidget); + g_pFolderViewWidget = NULL; + } + evas_object_smart_callback_del((Evas_Object *)mp_util_get_main_window_handle(), + "wm,rotation,changed", + __mp_folder_item_view_rotate_cb); + free(g_pFolderViewHandle); + g_pFolderViewHandle = NULL; + return ECORE_CALLBACK_CANCEL; } /** @@ -1954,14 +1424,39 @@ static void __mp_folder_item_view_rotate_cb(void *data, Evas_Object * obj, * @param obj * @param event_info */ -void __mp_folder_soft_back_button_cb(void *data, Evas_Object * obj, - void *event_info) +void __mp_folder_soft_back_button_cb(void *data, Evas_Object * obj, void *event_info) { VideoLogInfo(" "); - Evas_Object *pTopNaviFrame = NULL; - pTopNaviFrame = - elm_naviframe_item_pop(g_pFolderViewHandle->pNaviFrameHandle); - evas_object_del(pTopNaviFrame); + if(g_pFolderViewHandle == NULL) + { + VideoLogError("g_pFolderViewHandle is invalid"); + return; + } + + //mp_folder_view_add_folder_view_to_naviframe(); + g_pFolderViewHandle->bExist = true; + mp_list_view_view_type_set(MP_LIST_VIEW_AS_FOLDER_LIST); + mp_folder_view_set_is_item_view(false); + g_pFolderViewHandle->pUpdateListUserCbFunc(LIST_UPDATE_TYPE_ALL); + //deleting the folder view in idler callback, as this callback object will also be deleted. + ecore_idler_add(delete_folder_item_view_idler_cb, NULL); +} + +static Evas_Object* _create_gengrid(Evas_Object *parent) +{ + if(parent == NULL) + { + VideoLogError("gengrid parent is invalid"); + return NULL; + } + Evas_Object *gengrid = elm_gengrid_add(parent); + evas_object_size_hint_weight_set(gengrid, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); + evas_object_size_hint_align_set(gengrid, EVAS_HINT_FILL, EVAS_HINT_FILL); + elm_gengrid_item_size_set(gengrid, GENGRID_ITEM_WIDTH, GENGRID_ITEM_HEIGHT); + + __mp_folder_item_view_add_gengrid_cb(gengrid); + + return gengrid; } /** @@ -1977,82 +1472,18 @@ static void __mp_folder_item_view_init(void *pParent) VideoLogInfo(""); - g_pFolderViewWidget->pFolderViewBox = - elm_box_add((Evas_Object *) pParent); - elm_box_horizontal_set(g_pFolderViewWidget->pFolderViewBox, - EINA_FALSE); - evas_object_show(g_pFolderViewWidget->pFolderViewBox); - - g_pFolderViewWidget->pFolderViewBaselayout = - __mp_folder_item_view_init_base_layout(g_pFolderViewWidget-> - pFolderViewBox); - evas_object_show(g_pFolderViewWidget->pFolderViewBaselayout); - - elm_box_pack_end(g_pFolderViewWidget->pFolderViewBox, - g_pFolderViewWidget->pFolderViewBaselayout); - - evas_object_event_callback_add(g_pFolderViewWidget-> - pFolderViewBaselayout, - EVAS_CALLBACK_DEL, - __mp_folder_item_view_base_layout_del_cb, - NULL); - - g_pFolderViewHandle->pVideosGenlist = - elm_genlist_add(g_pFolderViewWidget->pFolderViewBaselayout); - elm_scroller_bounce_set(g_pFolderViewHandle->pVideosGenlist, - EINA_FALSE, EINA_TRUE); - evas_object_size_hint_weight_set(g_pFolderViewHandle->pVideosGenlist, - EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); - evas_object_size_hint_align_set(g_pFolderViewHandle->pVideosGenlist, - EVAS_HINT_FILL, EVAS_HINT_FILL); - elm_genlist_block_count_set(g_pFolderViewHandle->pVideosGenlist, - VIDEO_GENLIST_BLOCK_COUNT); - elm_scroller_single_direction_set(g_pFolderViewHandle->pVideosGenlist, - ELM_SCROLLER_SINGLE_DIRECTION_HARD); - elm_genlist_mode_set(g_pFolderViewHandle->pVideosGenlist, - ELM_LIST_COMPRESS); - elm_object_part_content_set(g_pFolderViewWidget->pFolderViewBaselayout, - SWALLOW_LISTVIEW_CONTENT, - g_pFolderViewHandle->pVideosGenlist); + g_pFolderViewHandle->pFolderItemGengrid = _create_gengrid(pParent); + if(g_pFolderViewHandle->pFolderItemGengrid == NULL) + { + VideoLogError("Faied to create folder item gengrid"); + return; + } + __mp_folder_item_view_update_video_list(LIST_UPDATE_TYPE_ALL); - evas_object_show(g_pFolderViewHandle->pVideosGenlist); g_pFolderViewHandle->bLandscape = false; - evas_object_smart_callback_add((Evas_Object *) - mp_util_get_main_window_handle(), + evas_object_smart_callback_add((Evas_Object *)mp_util_get_main_window_handle(), "wm,rotation,changed", __mp_folder_item_view_rotate_cb, NULL); - - Evas_Object *pLeftbtn = - elm_button_add(g_pFolderViewHandle->pNaviFrameHandle); - elm_object_style_set(pLeftbtn, "naviframe/end_btn/default"); - evas_object_smart_callback_add(pLeftbtn, "clicked", - __mp_folder_soft_back_button_cb, NULL); - - char *folder_name = - mp_util_svc_get_video_folder_name(g_pFolderViewHandle-> - nFolder_index); - - g_pFolderViewHandle->pNaviFrameItem = - elm_naviframe_item_push(g_pFolderViewHandle->pNaviFrameHandle, - (const char *) folder_name, pLeftbtn, NULL, - g_pFolderViewWidget->pFolderViewBox, NULL); - - elm_naviframe_item_pop_cb_set(g_pFolderViewHandle->pNaviFrameItem, - __mp_folder_item_view_back_btn_cb, - g_pFolderViewHandle); - - MP_FREE_STRING(folder_name); - - mp_folder_item_view_check_more_button_of_toolbar(); - - elm_naviframe_item_title_enabled_set(g_pFolderViewHandle-> - pNaviFrameItem, TRUE, EINA_FALSE); - - mp_util_db_set_update_fun(g_pFolderViewHandle->euLev, - __mp_folder_item_view_db_changed_cb); - - mp_util_hide_indicator(); - } /** @@ -2081,10 +1512,6 @@ void mp_folder_item_view_check_more_button_of_toolbar(void) return; } - pRegisteCbFunc->DownloadCb = - (void *) __mp_folder_item_view_download_cb; - pRegisteCbFunc->SearchCb = - (void *) __mp_folder_item_view_search_item_cb; pRegisteCbFunc->ShareViaCb = (void *) __mp_folder_item_view_share_cb; pRegisteCbFunc->DeleteCb = (void *) __mp_folder_item_view_delete_cb; pRegisteCbFunc->SortItemCb = @@ -2098,14 +1525,13 @@ void mp_folder_item_view_check_more_button_of_toolbar(void) pRegisteCbFunc->RemoveFromPersonalCB = (void *) __mp_folder_item_view_remove_personal_cb; #endif + Evas_Object* more_button = mp_list_view_more_button_get(g_pFolderViewHandle->pNaviframeItem); mp_ft_ctrl_create(g_pFolderViewHandle->pNaviFrameHandle, - g_pFolderViewHandle->pNaviFrameItem, + g_pFolderViewHandle->pNaviframeItem, + more_button, FOOTER_TAB_TYPE_PERSONAL, pRegisteCbFunc); free(pRegisteCbFunc); - elm_naviframe_item_title_enabled_set(g_pFolderViewHandle-> - pNaviFrameItem, EINA_TRUE, - EINA_FALSE); mp_util_db_set_update_fun(g_pFolderViewHandle->euLev, __mp_folder_item_view_db_changed_cb); @@ -2148,43 +1574,44 @@ char *__mp_folder_item_view_text_get_video_number_cb(void *pUserData, return NULL; } - /** * * @param pNaviFrame * @param folder_index * @param pChangeViewCb */ -void mp_folder_item_view_push(void *pNaviFrame, int folder_index, - UpdateListItemsCbFunc pChangeViewCb) -{ - if (!pNaviFrame) { - VideoLogError("[ERR] pNaviFrame"); +void mp_folder_item_view_push(void *main_handle, void *main_widget, int folder_index, + UpdateListItemsCbFunc change_view_cb) +{ + if (main_handle == NULL || main_widget == NULL || change_view_cb == NULL) { + VideoLogError("parameter maybe invalid [main_handle : %p] [main_widget: %p] [change_view_cb: %p]", + main_handle, + main_widget, + change_view_cb); return; } VideoLogInfo(""); - __mp_folder_item_view_destroy(); + g_pFolderViewHandle = - (st_VideoFolderViewHandle *) calloc(1, - sizeof - (st_VideoFolderViewHandle)); + (st_VideoFolderViewHandle *) calloc(1,sizeof(st_VideoFolderViewHandle)); g_pFolderViewWidget = - (st_VideoFolderViewWidget *) calloc(1, - sizeof - (st_VideoFolderViewWidget)); + (st_VideoFolderViewWidget *) calloc(1, sizeof(st_VideoFolderViewWidget)); memset(g_pFolderViewHandle, 0, sizeof(st_VideoFolderViewHandle)); memset(g_pFolderViewWidget, 0, sizeof(st_VideoFolderViewWidget)); - g_pFolderViewHandle->pNaviFrameHandle = pNaviFrame; - g_pFolderViewHandle->pUpdateListUserCbFunc = pChangeViewCb; + g_pFolderViewHandle->pMainHandle = main_handle; + g_pFolderViewHandle->pMainWidget = main_widget; + g_pFolderViewHandle->pNaviFrameHandle = g_pFolderViewHandle->pMainHandle->pNaviFrameHandle; + g_pFolderViewHandle->pNaviframeItem = g_pFolderViewHandle->pMainHandle->pNaviFrameItem; + g_pFolderViewHandle->pUpdateListUserCbFunc = change_view_cb; g_pFolderViewHandle->nFolder_index = folder_index; g_pFolderViewHandle->bExist = false; g_pFolderViewHandle->bLandscape = - mp_rotate_ctrl_check_landspace_by_win((Evas_Object *) - mp_util_get_main_window_handle - ()); + mp_rotate_ctrl_check_landspace_by_win((Evas_Object *)mp_util_get_main_window_handle()); + + // TO DO check this why it is null char *szPath = mp_util_svc_get_video_folder_url(folder_index); g_pFolderViewHandle->pFolderUrl = g_strdup(szPath); VideoSecureLogInfo("folder path = %s", szPath); @@ -2192,9 +1619,13 @@ void mp_folder_item_view_push(void *pNaviFrame, int folder_index, g_pFolderViewHandle->euLev = MP_DB_UPDATE_LEV_1; - __mp_folder_item_view_init(g_pFolderViewHandle->pNaviFrameHandle); + __mp_folder_item_view_init(g_pFolderViewHandle->pMainWidget->pListViewBaselayout); g_pFolderViewHandle->nPlayVideoIndex = -1; + mp_util_db_set_update_fun(g_pFolderViewHandle->euLev, __mp_folder_item_view_db_changed_cb); + + mp_util_hide_indicator(); + } /** diff --git a/src/view/mp-video-list-view-main.c b/src/view/mp-video-list-view-main.c index 76a3fa0..bdf1e25 100755 --- a/src/view/mp-video-list-view-main.c +++ b/src/view/mp-video-list-view-main.c @@ -83,10 +83,7 @@ static toolbar_item_data g_pToolbarItemData = {NULL, NULL}; /*///////////////////////////////////////////////////*/ /* Pre-define function for building.*/ -static void __mp_list_view_update_list(int nListTabType, - MpListUpdateType eUpdateType); -/*static void mp_list_view_check_center_button_of_toolbar(void);*/ -static void mp_list_view_check_more_button_of_toolbar(void); +static void __mp_list_view_update_list(int nListTabType, MpListUpdateType eUpdateType); static bool __mp_list_view_is_top_view(void); @@ -105,6 +102,27 @@ static void __mp_list_view_result_media_data_update_cb(void); static char *__mp_list_view_count_layout_tts_cb(void *data, Evas_Object * obj); +void mp_list_view_view_type_set(int viewType) +{ + MpListViewAsType type = (MpListViewAsType)viewType; + if(g_pMainViewHandle == NULL || type < MP_LIST_VIEW_AS_NONE || type >= MP_LIST_VIEW_AS_MAX) + { + VideoLogError("parameter maybe invalid [ g_pMainViewHandle: %p] [type: %d]", g_pMainViewHandle, type); + return; + } + g_pMainViewHandle->nCurrentViewType = type; +} + +int mp_list_view_view_type_get() +{ + if(g_pMainViewHandle == NULL) + { + VideoLogError("g_pMainViewHandle is invalid"); + return 0; + } + return (int)g_pMainViewHandle->nCurrentViewType; +} + /** * * @param key @@ -366,7 +384,7 @@ void mp_list_view_share_via_cb(void *pUserData, Evas_Object * pObject, mp_ft_ctrl_hide_more_popup(); - if (mp_view_as_ctrl_get_type() == MP_LIST_VIEW_AS_FOLDER_LIST) { + if (g_pMainViewHandle->nCurrentViewType == MP_LIST_VIEW_AS_FOLDER_LIST) { VideoLogWarning("Select folder for sharing."); mp_folder_share_view_push((void *) mp_mgr_get_library_naviframe(), (void *) @@ -423,6 +441,24 @@ void mp_list_view_remove_personal_cb(void *pUserData, } + +Evas_Object* mp_list_view_more_button_get(Elm_Object_Item *naviframe_item) +{ + if(naviframe_item == NULL) + { + VideoLogInfo("Naviframe item is invalid, can't get more button"); + return NULL; + } + Evas_Object* title_content = elm_object_item_part_content_get(naviframe_item, "title_content"); + if(title_content == NULL) + { + VideoLogInfo("title content is invalid, can't get more button"); + return NULL; + } + Evas_Object* more_button = elm_object_part_content_get(title_content, "more.icon.swallow"); + return more_button; +} + /**/ /*//////////////////////////////////////////////////*/ /*//////////////////////////////////////////////////*/ @@ -452,19 +488,12 @@ void mp_list_view_check_more_button_of_toolbar(void) return; } - pRegisteCbFunc->SearchCb = - (void *) mp_list_view_search_item_cb; pRegisteCbFunc->DeleteCb = (void *) mp_list_view_delete_cb; - pRegisteCbFunc->ViewAsCb = (void *) mp_list_view_view_as_cb; - if (mp_view_as_ctrl_get_type() != MP_LIST_VIEW_AS_FOLDER_LIST) { - pRegisteCbFunc->SortItemCb = - (void *) mp_list_view_sort_item_cb; + if (g_pMainViewHandle->nCurrentViewType != MP_LIST_VIEW_AS_FOLDER_LIST) { + pRegisteCbFunc->SortItemCb =(void *) mp_list_view_sort_item_cb; pRegisteCbFunc->RenameCb = (void *) mp_list_view_rename_cb; - /*pRegisteCbFunc->DetailsCb= (void*)mp_list_view_details_cb; */ - pRegisteCbFunc->ShareViaCb = - (void *) mp_list_view_share_via_cb; - pRegisteCbFunc->AutoPlayCb = - (void *) mp_list_view_auto_play_cb; + pRegisteCbFunc->ShareViaCb = (void *) mp_list_view_share_via_cb; + pRegisteCbFunc->AutoPlayCb = (void *) mp_list_view_auto_play_cb; } pRegisteCbFunc->SignInCb = (void *) mp_list_view_sign_in_cb; @@ -476,8 +505,10 @@ void mp_list_view_check_more_button_of_toolbar(void) #endif bool bShowFT = mp_ft_ctrl_is_show(); if (bShowFT == FALSE) { + Evas_Object* more_button = mp_list_view_more_button_get(g_pMainViewHandle->pNaviFrameItem); mp_ft_ctrl_create(g_pMainViewHandle->pNaviFrameHandle, g_pMainViewHandle->pNaviFrameItem, + more_button, g_pMainViewHandle->nListTabType, pRegisteCbFunc); } @@ -508,10 +539,8 @@ void mp_list_view_show_search_view(void) mp_search_view_push((void *) mp_mgr_get_library_naviframe(), NULL); - mp_search_view_register_update_list_func((void *) - __mp_list_view_result_user_cb, - (void *) - __mp_list_view_result_view_update_cb); + mp_search_view_register_update_list_func((void *)__mp_list_view_result_user_cb, + (void *)__mp_list_view_result_view_update_cb); } /**/ @@ -520,40 +549,6 @@ void mp_list_view_show_search_view(void) /* Callback function of base widget in main list view.*/ /** * - * @param pUserData - * @param pObject - * @param pEventInfo - */ -void mp_list_view_naviframe_transition_effect_cb(void *pUserData, - Evas_Object * pObject, - void *pEventInfo) -{ - if (!g_pMainViewHandle) { - VideoLogInfo("Main handles of list view are not existed."); - return; - } - - VideoLogInfo(""); - - Evas_Object *pTmpContents = NULL; - Elm_Object_Item *pTmpItem = NULL; - - if (!g_pMainViewHandle->pNaviFrameHandle) { - VideoLogInfo("[ERR] No exist naviframe handle."); - return; - } - - pTmpItem = - elm_naviframe_top_item_get(g_pMainViewHandle->pNaviFrameHandle); - pTmpContents = elm_object_item_content_get(pTmpItem); - if (pTmpContents) { - } else { - VideoLogInfo("[ERR] No exist naviframe top item."); - } -} - -/** - * */ void mp_list_view_double_tap_sensor_cb(void) { @@ -587,7 +582,7 @@ static void __mp_list_view_result_media_data_update_cb(void) mp_util_svc_extract_video_list_by_item_type (mp_sort_ctrl_get_sort_state(), mp_view_ctrl_get_list_type()); - int nViewType = mp_view_as_ctrl_get_type(); + int nViewType = g_pMainViewHandle->nCurrentViewType; #ifdef VS_FEATURE_LIST_VIEW if (nViewType == MP_LIST_VIEW_AS_NORMAL_LIST) { mp_normal_view_update_video_list(); @@ -602,7 +597,6 @@ static void __mp_list_view_result_media_data_update_cb(void) } mp_list_view_check_more_button_of_toolbar(); - /*mp_list_view_check_center_button_of_toolbar(); */ } /** @@ -617,8 +611,6 @@ static void __mp_list_view_result_user_cb(MpListUpdateType eUpdateType) } VideoLogInfo(""); - elm_object_item_part_text_set(g_pMainViewHandle->pNaviFrameItem, - "elm.text.title", VIDEOS_TITLE_VIDEO); __mp_list_view_update_list(g_pMainViewHandle->nListTabType, eUpdateType); @@ -638,7 +630,7 @@ static void __mp_list_view_result_data_update_cb(void) VideoLogInfo(""); - int nViewType = mp_view_as_ctrl_get_type(); + int nViewType = g_pMainViewHandle->nCurrentViewType; #ifdef VS_FEATURE_LIST_VIEW if (nViewType == MP_LIST_VIEW_AS_NORMAL_LIST) { mp_util_svc_destory_video_item_list(); @@ -675,7 +667,7 @@ static void __mp_list_view_result_view_update_cb(void) return; } VideoLogInfo(""); - int nViewType = mp_view_as_ctrl_get_type(); + int nViewType = g_pMainViewHandle->nCurrentViewType; mp_util_svc_destory_video_list(); mp_util_svc_extract_video_list_by_item_type (mp_sort_ctrl_get_sort_state(), mp_view_ctrl_get_list_type()); @@ -839,7 +831,7 @@ void mp_list_view_launching_video_player_cb(void *pUserData, mp_option_ctrl_delete_handle(); mp_util_delete_popup_handle(); - int nViewType = mp_view_as_ctrl_get_type(); + int nViewType = g_pMainViewHandle->nCurrentViewType; #ifdef VS_FEATURE_LIST_VIEW if (nViewType == MP_LIST_VIEW_AS_NORMAL_LIST) { mp_normal_view_arrange_list_item(g_pMainViewHandle, @@ -891,7 +883,7 @@ char *__mp_list_view_text_get_video_number_cb(void *pUserData, if (!strcmp(part, "elm.text.sub")) { unsigned int nCount = 0; - int nViewType = mp_view_as_ctrl_get_type(); + int nViewType = g_pMainViewHandle->nCurrentViewType; if (nViewType == MP_LIST_VIEW_AS_FOLDER_LIST) { nCount = mp_util_svc_get_video_folder_size(); @@ -939,7 +931,7 @@ void mp_list_view_update_whole_genlist(MpListUpdateType eUpdateType) VideoLogInfo(""); if (g_pMainViewHandle->nListTabType == LIST_TAB_TYPE_PERSONAL) { - int nViewType = mp_view_as_ctrl_get_type(); + int nViewType = g_pMainViewHandle->nCurrentViewType; #ifdef VS_FEATURE_LIST_VIEW if (nViewType == MP_LIST_VIEW_AS_NORMAL_LIST) { mp_normal_view_arrange_list_item(g_pMainViewHandle, @@ -1025,7 +1017,6 @@ static void __mp_main_video_index_item_del_cb(void *data, void mp_list_view_update_count_layout() { unsigned int nCount = 0; - int nViewType = mp_view_as_ctrl_get_type(); if (g_pMainViewHandle == NULL) { VideoLogError("g_pMainViewHandle == NUL!!!"); @@ -1041,6 +1032,8 @@ void mp_list_view_update_count_layout() return; } + int nViewType = g_pMainViewHandle->nCurrentViewType; + if (nViewType == MP_LIST_VIEW_AS_FOLDER_LIST) { nCount = mp_util_svc_get_video_folder_size(); } else { @@ -1159,20 +1152,14 @@ Evas_Object *mp_list_view_create_base_layout(void *pParent) g_pMainViewWidget->pListViewBaselayout = NULL; } char edj_path[1024] = { 0 }; - char *path = app_get_resource_path(); - snprintf(edj_path, 1024, "%s%s/%s", path, "edje", - VIDEO_PLAYER_LISTVIEW_EDJ); + snprintf(edj_path, 1024, "%s%s/%s", path, "edje", VIDEO_CUSTOM_THEME); + free(path); g_pMainViewWidget->pListViewBaselayout = elm_layout_add(pParent); - elm_layout_file_set(g_pMainViewWidget->pListViewBaselayout, - edj_path, LISTVIEW_EDJ_GROUP); - evas_object_size_hint_weight_set - (g_pMainViewWidget->pListViewBaselayout, EVAS_HINT_EXPAND, - EVAS_HINT_EXPAND); + elm_layout_file_set(g_pMainViewWidget->pListViewBaselayout, edj_path, "gengrid/layout"); evas_object_size_hint_weight_set(g_pMainViewWidget->pListViewBaselayout, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); - evas_object_size_hint_align_set(g_pMainViewWidget->pListViewBaselayout, - EVAS_HINT_FILL, EVAS_HINT_FILL); + evas_object_size_hint_align_set(g_pMainViewWidget->pListViewBaselayout, EVAS_HINT_FILL, EVAS_HINT_FILL); return g_pMainViewWidget->pListViewBaselayout; } @@ -1204,7 +1191,7 @@ static void toolbar_videos_item_cb(void *data, Evas_Object *obj, void *event_info) { VideoLogInfo("Called"); - mp_thumbnail_view_list_content_set(g_pMainViewHandle, g_pMainViewWidget, + mp_thumbnail_view_arrange_list_item(g_pMainViewHandle, g_pMainViewWidget, LIST_UPDATE_TYPE_ALL, (void *)__mp_list_view_result_user_cb); } @@ -1212,7 +1199,7 @@ static void toolbar_folders_item_cb(void *data, Evas_Object *obj, void *event_info) { VideoLogInfo("Called"); - mp_folder_view_folder_list_set(g_pMainViewHandle, g_pMainViewWidget, + mp_folder_view_arrange_folder_list(g_pMainViewHandle, g_pMainViewWidget, LIST_UPDATE_TYPE_ALL, (void *)__mp_list_view_result_user_cb); } @@ -1234,29 +1221,72 @@ Evas_Object* mp_list_view_create_toolbar(Evas_Object* naviframe) return toolbar; } + +static void __mp_list_view_search_view_launch(void *data, Evas_Object *o, const char *emission, const char *source) +{ + VideoLogError("Launching search view"); + mp_list_view_show_search_view(); +} + + Evas_Object* mp_list_view_create_title_content(Evas_Object* naviframe) { Evas_Object* layout = elm_layout_add(naviframe); char path[1024] = {0, }; char *res_path = app_get_resource_path(); snprintf(path, 1024, "%s%s/%s", res_path, "edje", "vp-searchbar.edj"); + free(res_path); elm_layout_file_set(layout, path, "homepage/searchbar"); Evas_Object* more_button = elm_button_add(layout); elm_object_style_set(more_button, "naviframe/more"); elm_object_part_content_set(layout, "more.icon.swallow", more_button); - Evas_Object *entry = elm_entry_add(layout); - elm_entry_single_line_set(entry, EINA_TRUE); - elm_entry_scrollable_set(entry, EINA_TRUE); - eext_entry_selection_back_event_allow_set(entry, EINA_TRUE); - evas_object_size_hint_weight_set(entry, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); - evas_object_size_hint_align_set(entry, EVAS_HINT_FILL, EVAS_HINT_FILL); - elm_object_part_content_set(layout, "search.inputfiled.swallow", entry); + elm_object_signal_callback_add(layout, "searchbar,clicked", "vp", __mp_list_view_search_view_launch, NULL); return layout; } +Evas_Object* mp_list_view_base_layout_content_set(Evas_Object* content) +{ + if(g_pMainViewWidget == NULL || g_pMainViewWidget->pListViewBaselayout == NULL || content == NULL) + { + VideoLogError("g_pMainViewWidget [%p] , pListViewBaselayout [%p], content [%p] maybe invalid, can't set content", + g_pMainViewWidget, g_pMainViewWidget->pListViewBaselayout, content); + return NULL; + } + Evas_Object* old_content = elm_object_part_content_unset(g_pMainViewWidget->pListViewBaselayout, "elm.content.swallow"); + evas_object_hide(old_content); + elm_object_part_content_set(g_pMainViewWidget->pListViewBaselayout, "elm.content.swallow", content); + evas_object_show(content); + return old_content; +} + +void mp_list_view_update_naviframe_title(const char *title, Evas_Object* prev_btn) +{ + if(g_pMainViewHandle == NULL || g_pMainViewHandle->pNaviFrameItem == NULL) + { + VideoLogError("g_pMainViewHandle [%p] pNaviFrameItem [%p] maybe invalid, can't update naviframe title", + g_pMainViewHandle, g_pMainViewHandle->pNaviFrameItem); + return; + } + const char* text = (title ? title: ""); + elm_object_item_part_text_set(g_pMainViewHandle->pNaviFrameItem, "elm.text.title", text); + + Evas_Object* old_content = elm_object_item_part_content_unset(g_pMainViewHandle->pNaviFrameItem, "elm.swallow.prev_btn"); + evas_object_hide(old_content); + if(prev_btn) + { + evas_object_show(prev_btn); + elm_object_item_part_content_set(g_pMainViewHandle->pNaviFrameItem, "elm.swallow.prev_btn", prev_btn); + elm_object_item_signal_emit(g_pMainViewHandle->pNaviFrameItem, "elm,state,prev_btn,show", "elm"); + VideoLogError("Adding back button"); + } else { + elm_object_item_signal_emit(g_pMainViewHandle->pNaviFrameItem, "elm,state,prev_btn,hide", "elm"); + VideoLogError("Removing back button"); + } +} + /** * * @param pNaviFrameHandle @@ -1282,6 +1312,7 @@ void mp_list_view_init_widget(void *pNaviFrameHandle) } g_pMainViewHandle->pNaviFrameHandle = pNaviFrameHandle; + mp_list_view_view_type_set(mp_view_as_ctrl_get_type()); if (g_pMainViewWidget->pListViewBaselayout == NULL) { g_pMainViewWidget->pListViewBaselayout = @@ -1297,6 +1328,8 @@ void mp_list_view_init_widget(void *pNaviFrameHandle) elm_object_item_part_content_set(g_pMainViewHandle->pNaviFrameItem, "toolbar", toolbar); elm_object_item_signal_emit(g_pMainViewHandle->pNaviFrameItem, "elm,state,toolbar,show", "elm"); + elm_naviframe_item_title_enabled_set(g_pMainViewHandle->pNaviFrameItem, EINA_TRUE, EINA_FALSE); + Evas_Object* title_content = mp_list_view_create_title_content(g_pMainViewHandle->pNaviFrameHandle); elm_object_item_part_content_set(g_pMainViewHandle->pNaviFrameItem, "title_content", title_content); elm_object_item_signal_emit(g_pMainViewHandle->pNaviFrameItem, "elm,state,title_content,show", "elm"); @@ -1304,15 +1337,9 @@ void mp_list_view_init_widget(void *pNaviFrameHandle) elm_naviframe_item_pop_cb_set(g_pMainViewHandle->pNaviFrameItem, mp_list_view_back_btn_cb, g_pMainViewHandle); - //elm_naviframe_item_title_enabled_set(g_pMainViewHandle->pNaviFrameItem, EINA_FALSE, EINA_FALSE); - evas_object_smart_callback_add(g_pMainViewHandle->pNaviFrameHandle, - "transition,finished", - mp_list_view_naviframe_transition_effect_cb, - NULL); __mp_list_view_register_recently_config(); - mp_util_svc_set_update_db_cb_func((UpdateDatabaseCbFunc) - __mp_list_view_db_change_cb); + mp_util_svc_set_update_db_cb_func((UpdateDatabaseCbFunc) __mp_list_view_db_change_cb); mp_util_hide_indicator(); g_pMainViewHandle->nListTabType = mp_util_get_main_tab_type(); @@ -1385,7 +1412,6 @@ void mp_list_view_destroy(void) mp_util_db_reset_all_backup_fun(); mp_ft_ctrl_destroy(); - mp_ft_ctrl_delete_center_toolbar(); mp_list_view_free_main_view_widget(); mp_util_svc_unset_update_db_cb_func(); @@ -1489,7 +1515,7 @@ void mp_list_view_update_widget(void) return; } - int nViewType = mp_view_as_ctrl_get_type(); + int nViewType = g_pMainViewHandle->nCurrentViewType; int nVideoCount = mp_util_svc_get_number_of_video_item_by_type(); if (nViewType == MP_LIST_VIEW_AS_FOLDER_LIST) { nVideoCount = mp_util_svc_get_video_folder_size(); @@ -1518,7 +1544,7 @@ void mp_list_view_update_widget(void) if (nViewType == MP_LIST_VIEW_AS_FOLDER_LIST) { VideoLogInfo("MP_LIST_VIEW_AS_FOLDER_LIST"); mp_folder_item_view_update_played_item(); - mp_search_view_update_genlist(); + mp_search_view_update_gengrid(); } else if (nViewType == MP_LIST_VIEW_AS_THUMBNAIL_LIST) { VideoLogInfo("MP_LIST_VIEW_AS_THUMBNAIL_LIST"); mp_thumbnail_view_update_played_item(); @@ -1541,12 +1567,12 @@ void mp_list_view_update_widget_resume(void) } __mp_list_view_result_view_update_cb(); - int nViewType = mp_view_as_ctrl_get_type(); + int nViewType = g_pMainViewHandle->nCurrentViewType; mp_search_view_update_played_item(-1); if (nViewType == MP_LIST_VIEW_AS_FOLDER_LIST) { VideoLogInfo("MP_LIST_VIEW_AS_FOLDER_LIST"); mp_folder_item_view_update_played_item(); - mp_search_view_update_genlist(); + mp_search_view_update_gengrid(); } else if (nViewType == MP_LIST_VIEW_AS_THUMBNAIL_LIST) { VideoLogInfo("MP_LIST_VIEW_AS_THUMBNAIL_LIST"); mp_thumbnail_view_update_played_item(); diff --git a/src/view/mp-video-list-view-thumbnail.c b/src/view/mp-video-list-view-thumbnail.c index 3eaab08..4727948 100755 --- a/src/view/mp-video-list-view-thumbnail.c +++ b/src/view/mp-video-list-view-thumbnail.c @@ -83,7 +83,6 @@ typedef struct { Evas_Object *pCurrentLayout; Evas_Object *pVideolistGengrid; - Evas_Object *pGengridContainer; Elm_Gengrid_Item_Class *pVideolistGIC; Ecore_Idler *pPlayIdler; MpListUpdateType eUpdateType; @@ -96,22 +95,10 @@ typedef struct { static stThumbnailView *g_pThumbnailView = NULL; -static void __mp_thumbnail_view_update_cb(int nError, const char *szPath, - void *pUserData); -static void __mp_thumbnail_view_language_changed_genlist_cb(void - *pUserData, - Evas_Object * - pObject, void - *pEventInfo); -static void __mp_thumbnail_view_realize_genlist_item_cb(void *pUserData, - Evas_Object * - pObject, - void *pEventInfo); +static void __mp_thumbnail_view_update_cb(int nError, const char *szPath, void *pUserData); static void __mp_thumbnail_view_append_gengrid_items(Evas_Object *pGengrid); static void __mp_thumbnail_view_reset(MpListUpdateType eUpdateType); -static void __mp_thumbnail_view_gengrid_realize_cb(void *pUserData, - Evas_Object *pObject, - void *pEventInfo); +static void __mp_thumbnail_view_gengrid_realize_cb(void *pUserData, Evas_Object *pObject, void *pEventInfo); /** * @@ -246,7 +233,7 @@ int _grid_view_zoom_in(void *data, Evas_Object * view) return 0; } -Evas_Object* _create_gengrid(Evas_Object *parent) +static Evas_Object* _create_gengrid(Evas_Object *parent) { if(parent == NULL) { @@ -269,39 +256,19 @@ Evas_Object* _create_gengrid(Evas_Object *parent) return gengrid; } -Evas_Object* _create_gengrid_container_layout(Evas_Object *parent) +void mp_thumbnail_view_update_base_layout_content(Evas_Object* content) { - if(parent == NULL) - { - VideoLogError("parent layout is invalid"); - return NULL; - } - char edj_path[1024] = { 0 }; - char *path = app_get_resource_path(); - snprintf(edj_path, 1024, "%s%s/%s", path, "edje", VIDEO_CUSTOM_THEME); - free(path); - - Evas_Object* layout = elm_layout_add(parent); - elm_layout_file_set(layout, edj_path, "gengrid/layout"); - evas_object_size_hint_weight_set(layout, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); - evas_object_size_hint_align_set(layout, EVAS_HINT_FILL, EVAS_HINT_FILL); - - if(layout == NULL) + mp_list_view_view_type_set(MP_LIST_VIEW_AS_THUMBNAIL_LIST); + Evas_Object* old_content = mp_list_view_base_layout_content_set(g_pThumbnailView->pCurrentLayout); + if(old_content == g_pThumbnailView->pNocontentlayout) { - VideoLogError("Failed to create gengrid contaienr layout"); - return NULL; - } - - Evas_Object* gengrid = _create_gengrid(layout); - if( gengrid ) - { - elm_object_part_content_set(layout, "elm.content.swallow", gengrid); - g_pThumbnailView->pVideolistGengrid = gengrid; + MP_DEL_OBJ(g_pThumbnailView->pNocontentlayout); + g_pThumbnailView->pNocontentlayout = NULL; } - return layout; + mp_list_view_update_naviframe_title(NULL, NULL); + mp_list_view_check_more_button_of_toolbar(); } - bool mp_thumbnail_view_list_content_set(void *pMainViewHandle, void *pMainViewWidget, MpListUpdateType eUpdateType, UpdateListItemsCbFunc pUpdateVideoListUserCb) { @@ -310,16 +277,9 @@ bool mp_thumbnail_view_list_content_set(void *pMainViewHandle, void *pMainViewWi { return mp_thumbnail_view_arrange_list_item(pMainViewHandle, pMainViewWidget, eUpdateType, pUpdateVideoListUserCb); } else { - Evas_Object *curr_content = elm_object_part_content_get(g_pThumbnailView->pMainWidget->pListViewBaselayout, SWALLOW_LISTVIEW_CONTENT); - if(curr_content != g_pThumbnailView->pCurrentLayout) - { - curr_content = elm_object_part_content_unset(g_pThumbnailView->pMainWidget->pListViewBaselayout, SWALLOW_LISTVIEW_CONTENT); - evas_object_hide(curr_content); - elm_object_part_content_set(g_pThumbnailView->pMainWidget->pListViewBaselayout, SWALLOW_LISTVIEW_CONTENT, g_pThumbnailView->pCurrentLayout); - return TRUE; - } + mp_thumbnail_view_update_base_layout_content(g_pThumbnailView->pCurrentLayout); } - return FALSE; + return TRUE; } /** @@ -366,9 +326,6 @@ bool mp_thumbnail_view_arrange_list_item(void *pMainViewHandle, g_pThumbnailView->zoom_level = VP_ZOOM_IN_DEFAULT; g_pThumbnailView->bLandscape = mp_rotate_ctrl_check_landspace_by_win((Evas_Object *)mp_util_get_main_window_handle()); - st_VideoListViewMainViewHandle *pMainHandle = g_pThumbnailView->pMainHandle; - // To do what is this used for ? - //g_pThumbnailView->pVideosGenlist = pMainHandle->pVideosGenlist; int nVideoListSize = 0; @@ -388,21 +345,15 @@ bool mp_thumbnail_view_arrange_list_item(void *pMainViewHandle, } if (nVideoListSize > 0) { - Evas_Object *old_content = elm_object_part_content_unset(g_pThumbnailView->pMainWidget->pListViewBaselayout, SWALLOW_LISTVIEW_CONTENT); - if (g_pThumbnailView->pNocontentlayout && old_content == g_pThumbnailView->pNocontentlayout ) { - MP_DEL_OBJ(g_pThumbnailView->pNocontentlayout); - } else { - evas_object_hide(old_content); - } - if(g_pThumbnailView->pGengridContainer == NULL) + if(g_pThumbnailView->pVideolistGengrid == NULL) { - g_pThumbnailView->pGengridContainer = _create_gengrid_container_layout(g_pThumbnailView->pMainWidget->pListViewBaselayout); + g_pThumbnailView->pVideolistGengrid = _create_gengrid(g_pThumbnailView->pMainWidget->pListViewBaselayout); } + evas_object_show(g_pThumbnailView->pVideolistGengrid); + // To Do Add gesture layer to the layout _vp_pinch_add_event(g_pThumbnailView->pMainWidget, g_pThumbnailView->pMainWidget->pListViewBaselayout); - __mp_thumbnail_view_append_gengrid_items(g_pThumbnailView->pVideolistGengrid); - // Keep track of the current layout to set content - g_pThumbnailView->pCurrentLayout = g_pThumbnailView->pGengridContainer; + g_pThumbnailView->pCurrentLayout = g_pThumbnailView->pVideolistGengrid; } else { if(g_pThumbnailView->pNocontentlayout == NULL) @@ -412,29 +363,19 @@ bool mp_thumbnail_view_arrange_list_item(void *pMainViewHandle, VIDEOS_NOCONTENT_MSG_NO_VIDEOS_IDS, VIDEOS_NOCONTENT_MSG_NO_VIDEOS_DESC_IDS); } - elm_object_part_content_unset(g_pThumbnailView->pMainWidget->pListViewBaselayout, SWALLOW_LISTVIEW_CONTENT); - if (g_pThumbnailView->pGengridContainer) { - evas_object_hide(g_pThumbnailView->pGengridContainer); - } - evas_object_show(g_pThumbnailView->pMainWidget->pListViewBaselayout); - elm_object_part_content_set(g_pThumbnailView->pMainWidget->pListViewBaselayout, - SWALLOW_LISTVIEW_CONTENT, - g_pThumbnailView->pNocontentlayout); + evas_object_show(g_pThumbnailView->pNocontentlayout); + //hide gengrid + evas_object_hide(g_pThumbnailView->pVideolistGengrid); // Keep track of the current layout to set content g_pThumbnailView->pCurrentLayout = g_pThumbnailView->pNocontentlayout; } - evas_object_smart_callback_add((Evas_Object *) - mp_util_get_main_window_handle(), - "wm,rotation,changed", - __mp_thumbnail_view_rotate_cb, NULL); - // mp_list_common_set_callabcks(g_pThumbnailView->pMainHandle, - // __mp_thumbnail_view_language_changed_genlist_cb, - // __mp_thumbnail_view_realize_genlist_item_cb, - // NULL, NULL); - - evas_object_show(g_pThumbnailView->pGengridContainer); + mp_thumbnail_view_update_base_layout_content(g_pThumbnailView->pCurrentLayout); + evas_object_smart_callback_add((Evas_Object *)mp_util_get_main_window_handle(), + "wm,rotation,changed", + __mp_thumbnail_view_rotate_cb, + NULL); return TRUE; } @@ -767,25 +708,6 @@ static void __mp_thumbnail_view_update_empty_cb(int nError, /** * - * @param pUserData - * @param pObject - * @param pEventInfo - */ -static void __mp_thumbnail_view_language_changed_genlist_cb(void - *pUserData, - Evas_Object * - pObject, void - *pEventInfo) -{ - VideoLogInfo(""); - if (!pObject) { - VideoLogError("pObject is NULL"); - return; - } -} - -/** - * */ void mp_thumbnail_view_change_language(void) { @@ -938,6 +860,18 @@ static char *__mp_thumbnail_view_get_label_of_grid_item_cb(const void return NULL; } +// static double __mp_thumbnail_view_get_playback_progress(int videoIndex) +// { + // char *path = mp_util_svc_get_video_url(videoIndex); + // int width = 0, height = 0; + // unsigned int duration = 0, playedtime = 0; + // char *title = NULL; + // mp_util_svc_get_video_detail_by_video_url((const char*)path, &width, &height, &title, &duration, &playedtime); + // VideoLogInfo(" =====> VideoURL : %s", path); + // VideoLogInfo(" =====> [W: %d] [H: %d] [Title: %s]", width, height, title); + // VideoLogInfo(" =====> [Dur: %u] [ELA: %U] ", duration, playedtime); +// } + /** * * @param pUserData @@ -959,6 +893,11 @@ static Evas_Object *__mp_thumbnail_view_get_grid_icon_cb(const void *pUserData, if (!strcmp(pPart, "elm.icon")) { char *pThumbIconUri = mp_util_svc_get_video_thumbnail(nVideoItemIndex); + if(pThumbIconUri == NULL) + { + VideoLogError("thumbnail url is invalid"); + return NULL; + } Evas_Object *img = elm_image_add(pObject); elm_image_file_set(img, pThumbIconUri, NULL); elm_image_aspect_fixed_set(img, EINA_FALSE); @@ -967,11 +906,15 @@ static Evas_Object *__mp_thumbnail_view_get_grid_icon_cb(const void *pUserData, evas_object_size_hint_align_set(img, EVAS_HINT_FILL, EVAS_HINT_FILL); item_data->icon = img; + free(pThumbIconUri); return img; } else if(!strcmp(pPart, "elm.progress")) { + //enable progess for video items + elm_object_item_signal_emit(item_data->item, "elm,state,progess,show", "elm"); + // Add progess bar Evas_Object *progessbar = elm_layout_add(pObject); Eina_Bool ret = elm_layout_file_set(progessbar, edj_path, "videolist/progressbar"); VideoLogInfo("layout file set %s %s",(ret? "Successful": "Failed"), pPart); @@ -979,7 +922,7 @@ static Evas_Object *__mp_thumbnail_view_get_grid_icon_cb(const void *pUserData, evas_object_size_hint_align_set(progessbar, EVAS_HINT_FILL, EVAS_HINT_FILL); double value = (((double) rand() ) / RAND_MAX ); edje_object_part_drag_value_set(elm_layout_edje_get(progessbar), "elm.cur.progressbar", value, 0.0); - + //__mp_thumbnail_view_get_playback_progress(nVideoItemIndex); item_data->progress_layout = progessbar; return progessbar; } @@ -1088,18 +1031,22 @@ static void __mp_thumbnail_view_append_gengrid_items(Evas_Object *pGengrid) } int nVideoListSize = mp_util_svc_get_number_of_video_item_by_type(); - Elm_Object_Item *gridItem = NULL; int nIndex = 0; for (nIndex = 0; nIndex < nVideoListSize; nIndex++) { stGengridItemData *item_data = calloc(1, sizeof(stGengridItemData)); + if(item_data == NULL) + { + VideoLogError("failed to allocate memory for item data"); + return; + } item_data->videoIndex = nIndex; item_data->item = elm_gengrid_item_append(pGengrid, g_pThumbnailView->pVideolistGIC, (void *) item_data, __mp_thumbnail_view_select_grid_item_cb, (void *) item_data); - elm_gengrid_item_select_mode_set(gridItem, ELM_OBJECT_SELECT_MODE_ALWAYS); - elm_object_item_del_cb_set(gridItem, __mp_thumbnail_view_grid_item_del_cb); + elm_gengrid_item_select_mode_set(item_data->item, ELM_OBJECT_SELECT_MODE_ALWAYS); + elm_object_item_del_cb_set(item_data->item, __mp_thumbnail_view_grid_item_del_cb); } } @@ -1116,7 +1063,6 @@ void mp_thumbnail_view_destroy(void) MP_DEL_IDLER(g_pThumbnailView->pPlayIdler); MP_DEL_OBJ(g_pThumbnailView->pVideolistGengrid); MP_DEL_GRID_ITC(g_pThumbnailView->pVideolistGIC); - MP_DEL_OBJ(g_pThumbnailView->pGengridContainer); g_pThumbnailView->pCurrentLayout = NULL; free(g_pThumbnailView); diff --git a/src/view/mp-video-search-view.c b/src/view/mp-video-search-view.c index 8fec1e8..e3335c2 100755 --- a/src/view/mp-video-search-view.c +++ b/src/view/mp-video-search-view.c @@ -41,21 +41,33 @@ #include "mp-external-ug.h" #include "mp-video-nocontent-layout.h" #include "mp-rotate-ctrl.h" +#include "mp-video-list-view-main.h" #define DEF_BUF_STR_LEN 512 #define DEF_BUF_STR_LEN_MAX 4096 #define SEARCH_CHAR_LEN (VIDEO_FILE_SEARCH_CHAR_LEN_MAX*4+1) +#define BASE_LAYOUT_SWALLOW "elm.content.swallow" #define PREEDIT_START "<preedit>" #define PREEDIT_END "</preedit>" +#define GENGRID_ITEM_WIDTH 304 // Width is ICON(280) + LEFT_PADDING(12) RIGHT_PADDING(12) +#define GENGRID_ITEM_HEIGHT 256 //Height is ICON(160) + TEXT_PART(56) + Bottom_PADDING(40) + +typedef struct _stGengridItemData{ + Elm_Object_Item *item; + Evas_Object *icon; + int videoIndex; +}stGengridItemData; + typedef struct { void *pNaviFrameHandle; void *pNaviFrameItem; - void *pVideosGenlist; + + Evas_Object* pSearchListGengrid; + Elm_Gengrid_Item_Class *pSearchViewGIC; char szSearchWord[SEARCH_CHAR_LEN]; - char *szMediaUrl; Eina_List *SearchedIndexList; int nPlayVideoIndex; bool bShowNormalLayout; @@ -70,13 +82,10 @@ typedef struct { } st_VideoSearchViewHandle; typedef struct { - //Evas_Object *pDimminglayout; Evas_Object *pSearchViewBaselayout; - Evas_Object *pSearchBarlayout; Evas_Object *pSearchBarEntry; - Evas_Object *pCancelButton; - Evas_Object *pClearButton; Evas_Object *pNocontentsLayout; + Evas_Object *pTitleContent; } st_VideoSearchViewWidget; @@ -84,128 +93,51 @@ st_VideoSearchViewHandle *g_pSearchViewHandle = NULL; st_VideoSearchViewWidget *g_pSearchViewWidget = NULL; -Elm_Genlist_Item_Class VideoSearch_Itc; - - - // Pre-define function for building. -static void __mp_search_view_naviframe_transition_effect_cb(void - *pUserData, - Evas_Object * - pObject, - void - *pEventInfo); -static void __mp_search_view_append_video_items(void *pVideosGenlist, - bool bSearchedView); +static void __mp_search_view_append_video_items(Evas_Object *pSearchListGengrid, bool bSearchedView); static int __mp_search_view_get_sort_type(void); -static void __mp_search_view_arrange_video_list(int nItemSortType, - void *pVideosGenlist); -static void __mp_search_view_base_layout_del_cb(void *data, Evas * e, - Evas_Object * obj, - void *event_info); +static void __mp_search_view_arrange_video_list(int nItemSortType, Evas_Object *pSearchListGengrid); static void __mp_search_view_pop(void *pNaviFrame); static void __mp_search_view_db_changed_cb(void *pUserData); -static void __mp_search_view_reset(void); -static void __mp_search_view_update_video_items(Evas_Object * pGenlist, - int nGenItemIndex, - int nPlayVideoIndex); +static void __mp_search_view_update_video_items(Evas_Object * pGenlist, int nGenItemIndex, int nPlayVideoIndex); +static void __mp_search_view_trans_finished_cb(void *pUserData, Evas_Object * obj, void *event_info); /** * */ -static void __mp_search_view_reset(void) +void mp_search_view_destroy(void) { - if (g_pSearchViewHandle) { - mp_util_db_set_update_fun(g_pSearchViewHandle->euLev, NULL); - g_pSearchViewHandle->nPlayVideoIndex = -1; - evas_object_smart_callback_del(g_pSearchViewHandle-> - pNaviFrameHandle, - "transition,finished", - __mp_search_view_naviframe_transition_effect_cb); - - MP_DEL_OBJ(g_pSearchViewHandle->pVideosGenlist); - - MP_FREE_STRING(g_pSearchViewHandle->szMediaUrl); - MP_FREE_STRING(g_pSearchViewHandle->pFolderPath); - - if (g_pSearchViewHandle->SearchedIndexList) { - eina_list_free(g_pSearchViewHandle->SearchedIndexList); - g_pSearchViewHandle->SearchedIndexList = NULL; - } - g_pSearchViewHandle->pNaviFrameHandle = NULL; - g_pSearchViewHandle->pNaviFrameItem = NULL; - g_pSearchViewHandle->pChangeViewUserCbFunc = NULL; - g_pSearchViewHandle->pChangeViewUpdateFunc = NULL; - - free(g_pSearchViewHandle); - g_pSearchViewHandle = NULL; - } - if (g_pSearchViewWidget) { - - g_pSearchViewWidget->pSearchViewBaselayout = NULL; - - g_pSearchViewWidget->pSearchBarlayout = NULL; - - g_pSearchViewWidget->pSearchBarEntry = NULL; - - g_pSearchViewWidget->pCancelButton = NULL; - - g_pSearchViewWidget->pNocontentsLayout = NULL; - - - free(g_pSearchViewWidget); - g_pSearchViewWidget = NULL; + MP_DEL_OBJ(g_pSearchViewWidget->pNocontentsLayout); + MP_DEL_OBJ(g_pSearchViewWidget->pSearchViewBaselayout); + MP_DEL_OBJ(g_pSearchViewWidget->pSearchBarEntry); + MP_DEL_OBJ(g_pSearchViewWidget->pTitleContent); } - -} - -/** - * - */ -void mp_search_view_destroy(void) -{ - if (g_pSearchViewHandle) { mp_util_db_set_update_fun(g_pSearchViewHandle->euLev, NULL); mp_util_db_set_backup_fun(g_pSearchViewHandle->euLev, NULL); g_pSearchViewHandle->nPlayVideoIndex = -1; - evas_object_smart_callback_del(g_pSearchViewHandle-> - pNaviFrameHandle, - "transition,finished", - __mp_search_view_naviframe_transition_effect_cb); - MP_DEL_OBJ(g_pSearchViewHandle->pVideosGenlist); - MP_FREE_STRING(g_pSearchViewHandle->szMediaUrl); + elm_object_item_signal_emit(g_pSearchViewHandle->pNaviFrameItem, "elm,state,prev_btn,hide", "elm"); + Evas_Object *button = elm_object_item_part_content_unset(g_pSearchViewHandle->pNaviFrameItem, "elm.swallow.prev_btn"); + MP_DEL_OBJ(button); + eext_object_event_callback_del(g_pSearchViewHandle->pNaviFrameHandle, EEXT_CALLBACK_BACK, eext_naviframe_back_cb); + + elm_gengrid_item_class_free(g_pSearchViewHandle->pSearchViewGIC); + MP_DEL_OBJ(g_pSearchViewHandle->pSearchListGengrid); + elm_object_item_del((Elm_Object_Item*)(g_pSearchViewHandle->pNaviFrameItem)); + MP_FREE_STRING(g_pSearchViewHandle->pFolderPath); if (g_pSearchViewHandle->SearchedIndexList) { eina_list_free(g_pSearchViewHandle->SearchedIndexList); g_pSearchViewHandle->SearchedIndexList = NULL; } - - free(g_pSearchViewHandle); - g_pSearchViewHandle = NULL; - } - - if (g_pSearchViewWidget) { - - MP_DEL_OBJ(g_pSearchViewWidget->pCancelButton); - MP_DEL_OBJ(g_pSearchViewWidget->pSearchBarEntry); - MP_DEL_OBJ(g_pSearchViewWidget->pSearchBarlayout); - MP_DEL_OBJ(g_pSearchViewWidget->pNocontentsLayout); - - if (g_pSearchViewWidget->pSearchViewBaselayout != NULL) { - evas_object_event_callback_del(g_pSearchViewWidget-> - pSearchViewBaselayout, - EVAS_CALLBACK_DEL, - __mp_search_view_base_layout_del_cb); - MP_DEL_OBJ(g_pSearchViewWidget->pSearchViewBaselayout); - } - - free(g_pSearchViewWidget); - g_pSearchViewWidget = NULL; } + free(g_pSearchViewWidget); + g_pSearchViewWidget = NULL; + free(g_pSearchViewHandle); + g_pSearchViewHandle = NULL; } /** @@ -215,9 +147,8 @@ void mp_search_view_destroy(void) * @param bResult * @return */ -char *mp_search_view_search_markup_keyword(char *szOriginStr, - char *szSearchWord, - bool * bResult) + // TO DO use this function to change color the matched text. +char *mp_search_view_search_markup_keyword(char *szOriginStr, char *szSearchWord, bool * bResult) { if (!szOriginStr) { VideoLogError("[ERR] szOriginStr is NULL."); @@ -347,17 +278,17 @@ char *mp_search_view_search_markup_keyword(char *szOriginStr, * @param obj * @param event_info */ -static void __mp_search_view_trans_finished_cb(void *pUserData, - Evas_Object * obj, - void *event_info) +static void __mp_search_view_trans_finished_cb(void *pUserData, Evas_Object * obj, void *event_info) { if (!obj) { VideoLogError("[ERR] g_pListRemoveViewHandle is NULL."); return; } - + VideoLogInfo(""); mp_widget_ctrl_enable_navi_handle_focus(obj); + mp_search_view_destroy(); + evas_object_smart_callback_del(obj, "transition,finished", __mp_search_view_trans_finished_cb); } @@ -375,6 +306,7 @@ static Eina_Bool mp_search_view_back_btn_cb(void *pUserData, VideoLogInfo("[ERR] g_pListRemoveViewHandle is NULL."); return EINA_TRUE; } + VideoLogError(""); // Register transition finished callback. mp_widget_ctrl_disable_navi_handle_focus_except_item (g_pSearchViewHandle->pNaviFrameHandle, @@ -390,74 +322,47 @@ static Eina_Bool mp_search_view_back_btn_cb(void *pUserData, return EINA_TRUE; } -//////////////////////////////////////////////// -// Genlist callback -/** - * - * @param pUserData - * @param pObject - * @param pEventInfo - */ -void __mp_search_view_naviframe_transition_effect_cb(void *pUserData, - Evas_Object * pObject, - void *pEventInfo) +static void __mp_search_view_softk_back_btn_cb(void *data, Evas_Object * obj, void *event_info) { - if (!g_pSearchViewHandle) { - VideoLogError("[ERR] No exist g_pSearchViewHandle."); - return; - } - VideoLogInfo(""); - - if (!g_pSearchViewHandle->pNaviFrameHandle) { - VideoLogInfo("[ERR] No exist naviframe handle."); + st_VideoSearchViewHandle *handle = (st_VideoSearchViewHandle*)data; + if(handle == NULL) + { + VideoLogError("handle is invalid"); return; } - - elm_object_focus_set(g_pSearchViewWidget->pSearchBarEntry, EINA_TRUE); + elm_naviframe_item_pop(handle->pNaviFrameHandle); } - -// Genlist item callback. - /** * * @param pUserData * @param pObject * @param pEventInfo */ -static void __mp_search_view_select_video_item_cb(void *pUserData, - Evas_Object * pObject, - void *pEventInfo) +static void __mp_search_view_select_video_item_cb(void *pUserData, Evas_Object * pObject, void *pEventInfo) { if (!g_pSearchViewHandle) { VideoLogError("g_pSearchViewHandle is not exist."); return; } - int nVideoItemIndex = 0; - Elm_Object_Item *pItem = (Elm_Object_Item *) pEventInfo; - Elm_Object_Item *pSelectedItem = - elm_genlist_selected_item_get(pObject); - - if (pItem) { - nVideoItemIndex = (int) elm_object_item_data_get(pItem); - } else { - - if (pSelectedItem) { - elm_genlist_item_selected_set(pSelectedItem, EINA_FALSE); - } + stGengridItemData *item_data = (stGengridItemData *)pUserData; - return; + int nVideoItemIndex = item_data->videoIndex; + Elm_Object_Item *pItem = (Elm_Object_Item *) pEventInfo; + if(pItem != item_data->item) + { + VideoLogError("Something is really wrong with gengrid, selected item different is different from item data"); } - VideoLogInfo("nVideoItemIndex : %d", nVideoItemIndex); - - if (!pSelectedItem) { - VideoLogError("pSelectedItem is NULL"); + VideoLogInfo("Selected item video indexr: %d", nVideoItemIndex); + if (nVideoItemIndex < 0) { + VideoLogWarning("nVideoItemIndex < 0 ===>>> RETURN"); return; } - elm_genlist_item_selected_set(pSelectedItem, EINA_FALSE); + + elm_gengrid_item_selected_set(pItem, EINA_FALSE); Evas_Object *pPopup = evas_object_data_get(pObject, "popup"); // Get popup if (pPopup) { @@ -469,11 +374,6 @@ static void __mp_search_view_select_video_item_cb(void *pUserData, return; } - if (nVideoItemIndex < 0) { - VideoLogWarning("nVideoItemIndex < 0 ===>>> RETURN"); - return; - } - if (!mp_util_call_off()) { mp_util_ticker_toast_popup (VIDEOS_NOTIPOP_MSG_UNABLE_TO_PLAY_VIDEO_DURING_CALL, false, @@ -483,25 +383,14 @@ static void __mp_search_view_select_video_item_cb(void *pUserData, g_pSearchViewHandle->nPlayVideoIndex = nVideoItemIndex; - if (g_pSearchViewHandle->szMediaUrl) { - free(g_pSearchViewHandle->szMediaUrl); - g_pSearchViewHandle->szMediaUrl = NULL; - } - - g_pSearchViewHandle->szMediaUrl = - mp_util_svc_get_video_url(nVideoItemIndex); + char *szMediaUrl = mp_util_svc_get_video_url(nVideoItemIndex); - if (g_pSearchViewHandle->szMediaUrl) { - elm_object_focus_allow_set(g_pSearchViewWidget->pSearchBarlayout, - EINA_FALSE); - elm_object_focus_allow_set(g_pSearchViewWidget->pSearchBarEntry, - EINA_FALSE); + if (szMediaUrl) { + elm_object_focus_allow_set(g_pSearchViewWidget->pSearchBarEntry, EINA_FALSE); elm_object_focus_set(pObject, EINA_TRUE); - mp_launch_video_play(g_pSearchViewHandle->szMediaUrl, - MP_PLAYER_TYPE_VIDEO, NULL); + mp_launch_video_play(szMediaUrl,MP_PLAYER_TYPE_VIDEO, NULL); - free(g_pSearchViewHandle->szMediaUrl); - g_pSearchViewHandle->szMediaUrl = NULL; + free(szMediaUrl); } else { VideoLogError("[Err] Fail to get video uri from media service."); } @@ -539,44 +428,15 @@ char *mp_search_view_get_duration_time(int nVideoItemIndex) * @param pPart * @return */ -char *mp_search_view_get_label_of_video_item_cb(const void *pUserData, - Evas_Object * pObject, - const char *pPart) +char *mp_search_view_get_label_of_video_item_cb(void *pUserData, Evas_Object * pObject, const char *pPart) { - - int nVideoItemIndex = (int) pUserData; + stGengridItemData *item_data = (stGengridItemData*)pUserData; + int nVideoItemIndex = item_data->videoIndex; if (!strcmp(pPart, "elm.text")) { - char *szTitle = NULL; - char *szTitleUtf8 = NULL; - char *szTitleWithSearchWordColor = NULL; - bool bResult = FALSE; - + char *szTitle; szTitle = mp_util_svc_get_video_title(nVideoItemIndex); - - if (strlen(g_pSearchViewHandle->szSearchWord) > 0) { - szTitleWithSearchWordColor = - mp_search_view_search_markup_keyword(szTitle, - (char *) - g_pSearchViewHandle-> - szSearchWord, - &bResult); - if (bResult) { - if (szTitle) { - free(szTitle); - szTitle = NULL; - } - - if (szTitleWithSearchWordColor) { - VideoLogInfo("szTitleWithSearchWordColor : %s", - szTitleWithSearchWordColor); - return strdup(szTitleWithSearchWordColor); - } else { - return NULL; - } - } - } - szTitleUtf8 = elm_entry_utf8_to_markup(szTitle); + char *szTitleUtf8 = elm_entry_utf8_to_markup(szTitle); if (szTitle) { free(szTitle); @@ -584,10 +444,9 @@ char *mp_search_view_get_label_of_video_item_cb(const void *pUserData, } return szTitleUtf8; - } else if (!strcmp(pPart, "elm.text.sub")) { + } else if (!strcmp(pPart, "elm.sub.text")) { return mp_util_svc_get_duration_str_time(nVideoItemIndex); } - return NULL; } @@ -598,59 +457,30 @@ char *mp_search_view_get_label_of_video_item_cb(const void *pUserData, * @param pPart * @return */ -Evas_Object *mp_search_view_get_icon_of_video_item_cb(const void - *pUserData, - Evas_Object * - pObject, - const char *pPart) +Evas_Object *mp_search_view_get_icon_of_video_item_cb(void *pUserData, Evas_Object *pObject, const char *pPart) { - if (!strcmp(pPart, "elm.swallow.icon")) { - VideoLogError("pPart: elm.icon.1 - thumbnail"); - - int nVideoItemIndex = (int) pUserData; - Evas_Object *pLayout = elm_layout_add(pObject); - - char *pThumbIconUri = - mp_util_svc_get_video_thumbnail(nVideoItemIndex); - Evas_Object *pBg = NULL; - char edj_path[1024] = { 0 }; - - char *path = app_get_resource_path(); - snprintf(edj_path, 1024, "%s%s/%s", path, "edje", - VIDEO_CUSTOM_THEME); - free(path); - pLayout = elm_layout_add(pObject); - elm_layout_file_set(pLayout, edj_path, - "listview.thumbnail.layout"); - - if (!pThumbIconUri || !vp_file_exists(pThumbIconUri)) { - MP_FREE_STRING(pThumbIconUri); + stGengridItemData *item_data = (void*)pUserData; + int nVideoItemIndex = item_data->videoIndex; + + if (!strcmp(pPart, "elm.icon")) { + char *pThumbIconUri = mp_util_svc_get_video_thumbnail(nVideoItemIndex); + if(pThumbIconUri == NULL) + { + VideoLogError("thumbnail url is invalid"); + return NULL; } + Evas_Object *img = elm_image_add(pObject); + elm_image_file_set(img, pThumbIconUri, NULL); + elm_image_aspect_fixed_set(img, EINA_FALSE); + elm_image_preload_disabled_set(img, EINA_FALSE); + evas_object_size_hint_weight_set(img, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); + evas_object_size_hint_align_set(img, EVAS_HINT_FILL, EVAS_HINT_FILL); - pBg = - mp_util_create_preload_image(pLayout, pThumbIconUri, - VIDEO_ICON_WIDTH); - - if (!elm_layout_content_set(pLayout, "elm.thumbnail.icon", pBg)) - VideoLogError("elm_layout_content_set() is failed."); - - if (pBg) - evas_object_show(pBg); - - MP_FREE_STRING(pThumbIconUri); + item_data->icon = img; + free(pThumbIconUri); - if (!mp_util_create_video_sub_icon(pLayout, nVideoItemIndex)) { - VideoLogWarning("Local File or Create sub icon is failed.", - nVideoItemIndex); - } - - if (pLayout) { - evas_object_show(pLayout); - } - - return pLayout; + return img; } - return NULL; } @@ -673,93 +503,44 @@ static void __mp_search_view_del_no_contents_layout(void) } } -/** - * - * @param pParent - */ -static void *__mp_search_view_add_no_contents_layout(void *pParent) +static void __mp_search_view_base_layout_content_set(Evas_Object* base_layout, Evas_Object* content) { - if (!g_pSearchViewWidget) { - VideoLogError("g_pSearchViewWidget == NULL"); - return NULL; - } - VideoLogInfo(""); - - __mp_search_view_del_no_contents_layout(); - - if (elm_entry_is_empty(g_pSearchViewWidget->pSearchBarEntry)) { - VideoLogInfo("entry is empty, no need append no search view"); - return NULL; - } - - mp_util_virtual_keypad_disabled_set(EINA_FALSE); - g_pSearchViewWidget->pNocontentsLayout = - mp_create_nocontent_layout(pParent, - VIDEOS_SEARCHVIEW_MSG_NO_SEARCH_RESULTS, - NULL); - - evas_object_show(g_pSearchViewWidget->pNocontentsLayout); - - return g_pSearchViewWidget->pNocontentsLayout; -} - -/** - * - */ -static void __mp_search_view_is_existed_no_content_layout(void) -{ - if (!g_pSearchViewWidget) { - VideoLogError("g_pSearchViewWidget == NULL"); + if(g_pSearchViewWidget == NULL || content == NULL || base_layout == NULL) + { + VideoLogError("Parameter g_pSearchViewWidget [%p], content [%p], base_layout [%p] maybe invalid", + g_pSearchViewWidget, + content, + base_layout); return; } - VideoLogInfo(""); - - if (g_pSearchViewWidget->pNocontentsLayout) { - elm_object_part_content_unset(g_pSearchViewWidget-> - pSearchViewBaselayout, - "elm.swallow.content"); - __mp_search_view_del_no_contents_layout(); - elm_object_part_content_set(g_pSearchViewWidget-> - pSearchViewBaselayout, - "elm.swallow.content", - g_pSearchViewHandle->pVideosGenlist); - if (g_pSearchViewHandle->pVideosGenlist) - evas_object_show(g_pSearchViewHandle->pVideosGenlist); - } -} - -/** - * - */ -static void __mp_search_view_is_existed_genlist(void) -{ - if (!g_pSearchViewWidget) { - VideoLogError("g_pSearchViewWidget == NULL"); + Evas_Object* old_content = elm_object_part_content_get(base_layout, BASE_LAYOUT_SWALLOW); + if(old_content == content) + { + VideoLogInfo("Content is already set"); return; } - - - if (!g_pSearchViewWidget->pNocontentsLayout) { - elm_object_part_content_unset(g_pSearchViewWidget-> - pSearchViewBaselayout, - "elm.swallow.content"); - if (g_pSearchViewHandle->pVideosGenlist) - evas_object_hide(g_pSearchViewHandle->pVideosGenlist); + old_content = elm_object_part_content_unset(base_layout, BASE_LAYOUT_SWALLOW); + if(g_pSearchViewWidget->pNocontentsLayout && old_content == g_pSearchViewWidget->pNocontentsLayout) + { + __mp_search_view_del_no_contents_layout(); } else { - VideoLogError - ("g_pSearchViewWidget->pNocontentsLayout is existed."); + evas_object_hide(old_content); } + elm_object_part_content_set(base_layout, BASE_LAYOUT_SWALLOW, content); + evas_object_show(content); } /** * * @param szSearchWord */ -void mp_search_view_search_genlist_item(const char *szSearchWord) +void mp_search_view_search_gengrid_item(const char *szSearchWord) { - if (!g_pSearchViewHandle) { - VideoLogError("g_pSearchViewHandle == NULL"); + if (!g_pSearchViewHandle || !g_pSearchViewWidget) { + VideoLogError("g_pSearchViewHandle [%p] or g_pSearchViewWidget [%p] maybe invalid", + g_pSearchViewHandle, + g_pSearchViewWidget); return; } @@ -774,29 +555,27 @@ void mp_search_view_search_genlist_item(const char *szSearchWord) eina_list_free(g_pSearchViewHandle->SearchedIndexList); g_pSearchViewHandle->SearchedIndexList = NULL; } - mp_util_svc_index_list_for_search_view(szSearchWord, - (void **) &g_pSearchViewHandle-> - SearchedIndexList); + mp_util_svc_index_list_for_search_view(szSearchWord, (void **) &g_pSearchViewHandle->SearchedIndexList); + Evas_Object *current_layout = g_pSearchViewHandle->pSearchListGengrid; if (g_pSearchViewHandle->SearchedIndexList) { - memset(g_pSearchViewHandle->szSearchWord, 0, - sizeof(char) * SEARCH_CHAR_LEN); - strncpy(g_pSearchViewHandle->szSearchWord, szSearchWord, - SEARCH_CHAR_LEN - 1); - __mp_search_view_is_existed_no_content_layout(); - elm_genlist_clear(g_pSearchViewHandle->pVideosGenlist); - __mp_search_view_append_video_items(g_pSearchViewHandle-> - pVideosGenlist, true); + VideoLogError("Searching Index List"); + memset(g_pSearchViewHandle->szSearchWord, 0, sizeof(char) * SEARCH_CHAR_LEN); + strncpy(g_pSearchViewHandle->szSearchWord, szSearchWord, SEARCH_CHAR_LEN - 1); + elm_gengrid_clear(g_pSearchViewHandle->pSearchListGengrid); + __mp_search_view_append_video_items(g_pSearchViewHandle->pSearchListGengrid, true); + current_layout = g_pSearchViewHandle->pSearchListGengrid; } else { - __mp_search_view_is_existed_genlist(); - void *pNoContentLayout = - __mp_search_view_add_no_contents_layout(g_pSearchViewWidget-> - pSearchViewBaselayout); - elm_object_part_content_set(g_pSearchViewWidget-> - pSearchViewBaselayout, - "elm.swallow.content", - pNoContentLayout); + VideoLogError("Setting no content layout"); + if(g_pSearchViewWidget->pNocontentsLayout == NULL) + { + g_pSearchViewWidget->pNocontentsLayout = mp_create_nocontent_layout(g_pSearchViewWidget->pSearchViewBaselayout, + VIDEOS_SEARCHVIEW_MSG_NO_SEARCH_RESULTS, + NULL); + } + current_layout = g_pSearchViewWidget->pNocontentsLayout; } + __mp_search_view_base_layout_content_set(g_pSearchViewWidget->pSearchViewBaselayout, current_layout); } /** @@ -850,34 +629,6 @@ static void mp_search_view_check_landscape() return; } bool bLandscape = mp_rotate_ctrl_check_landspace(); - - const char *temp = - elm_object_text_get(g_pSearchViewWidget->pSearchBarEntry); - char *TempUtf8 = elm_entry_markup_to_utf8(temp); - char *szChangedStr = mp_search_view_get_fact_str(TempUtf8); - - if (bLandscape) { - elm_object_signal_emit(g_pSearchViewWidget->pSearchBarlayout, - "elm,state,show,landscape", "elm"); - - if (szChangedStr != NULL && strlen(szChangedStr) > 0) { - elm_object_signal_emit(g_pSearchViewWidget->pSearchBarlayout, - "elm,state,show,clear_button,landscape", - "elm"); - } - } else { - elm_object_signal_emit(g_pSearchViewWidget->pSearchBarlayout, - "elm,state,show,portrait", "elm"); - - if (szChangedStr != NULL && strlen(szChangedStr) > 0) { - elm_object_signal_emit(g_pSearchViewWidget->pSearchBarlayout, - "elm,state,show,clear_button,portrait", - "elm"); - } - } - - MP_FREE_STRING(szChangedStr); - MP_FREE_STRING(TempUtf8); } /** @@ -886,7 +637,7 @@ static void mp_search_view_check_landscape() * @param pObject * @param pEventInfo */ -static void __mp_search_view_genlist_scroll_cb(void *pUserData, +static void __mp_search_view_gengrid_scroll_cb(void *pUserData, Evas_Object * pObject, void *pEventInfo) { @@ -900,47 +651,33 @@ static void __mp_search_view_genlist_scroll_cb(void *pUserData, * @param pObject * @param pEventInfo */ -static void __mp_search_view_entry_changed_cb(void *pUserData, - Evas_Object * pObject, - void *pEventInfo) +static void __mp_search_view_entry_changed_cb(void *pUserData, Evas_Object * pObject, void *pEventInfo) { VideoLogInfo(""); - if (!g_pSearchViewHandle || !pUserData || !pObject) { - VideoLogError("g_pSearchViewHandle == NULL"); + if (!g_pSearchViewHandle || !pUserData || !pObject || !g_pSearchViewWidget) { + VideoLogError("handle or parameter maybe invalid"); return; } + Evas_Object* searchbar_layout = (Evas_Object*)pUserData; char *szChangedStr = NULL; if (elm_entry_is_empty(pObject)) { - elm_object_signal_emit(pUserData, "elm,state,eraser,hide", "elm"); - elm_object_disabled_set(g_pSearchViewWidget->pClearButton, - EINA_TRUE); - elm_object_style_set(g_pSearchViewWidget->pClearButton, - "clear_dim"); + elm_object_signal_emit(searchbar_layout, "searchbar,clear_button,hide", "vp"); } else { - elm_object_signal_emit(pUserData, "elm,state,eraser,show", "elm"); - elm_object_disabled_set(g_pSearchViewWidget->pClearButton, - EINA_FALSE); - elm_object_style_set(g_pSearchViewWidget->pClearButton, "clear"); - } - - if (!elm_entry_is_empty(pObject)) { - elm_object_signal_emit(pUserData, "elm,state,guidetext,hide", - "elm"); + elm_object_signal_emit(searchbar_layout, "searchbar,clear_button,show", "vp"); } if (mp_util_svc_get_number_of_video_item_by_type() < 1) { VideoLogWarning("There don't have any videos."); - __mp_search_view_is_existed_genlist(); - void *pNoContentLayout = - __mp_search_view_add_no_contents_layout(g_pSearchViewWidget-> - pSearchViewBaselayout); - elm_object_part_content_set(g_pSearchViewWidget-> - pSearchViewBaselayout, - "elm.swallow.content", - pNoContentLayout); + if(g_pSearchViewWidget->pNocontentsLayout == NULL) + { + g_pSearchViewWidget->pNocontentsLayout = mp_create_nocontent_layout(g_pSearchViewWidget->pSearchViewBaselayout, + VIDEOS_SEARCHVIEW_MSG_NO_SEARCH_RESULTS, + NULL); + } + __mp_search_view_base_layout_content_set(g_pSearchViewWidget->pSearchViewBaselayout, g_pSearchViewWidget->pNocontentsLayout); return; } @@ -952,26 +689,14 @@ static void __mp_search_view_entry_changed_cb(void *pUserData, VideoSecureLogInfo("Changed word in entry widget : %s", szChangedStr); if (szChangedStr != NULL && strlen(szChangedStr) > 0) { - elm_object_part_content_set(g_pSearchViewWidget->pSearchBarlayout, - "searchbar_clear_btn", - g_pSearchViewWidget->pClearButton); mp_search_view_check_landscape(); - mp_search_view_search_genlist_item(szChangedStr); + mp_search_view_search_gengrid_item(szChangedStr); } else { - elm_object_part_content_unset(g_pSearchViewWidget-> - pSearchBarlayout, - "searchbar_clear_btn"); - evas_object_hide(g_pSearchViewWidget->pClearButton); - memset(g_pSearchViewHandle->szSearchWord, 0, - sizeof(char) * SEARCH_CHAR_LEN); - __mp_search_view_is_existed_no_content_layout(); - __mp_search_view_arrange_video_list(__mp_search_view_get_sort_type - (), - g_pSearchViewHandle-> - pVideosGenlist); + memset(g_pSearchViewHandle->szSearchWord, 0, sizeof(char) * SEARCH_CHAR_LEN); + __mp_search_view_base_layout_content_set(g_pSearchViewWidget->pSearchViewBaselayout, g_pSearchViewHandle->pSearchListGengrid); + __mp_search_view_arrange_video_list(__mp_search_view_get_sort_type(), g_pSearchViewHandle->pSearchListGengrid); } MP_FREE_STRING(szChangedStr); - } /** @@ -992,14 +717,10 @@ static void __mp_search_view_focused_cb(void *pUserData, } if (elm_entry_is_empty(pObject)) { - elm_object_signal_emit(pUserData, "elm,state,eraser,hide", "elm"); + elm_object_signal_emit(pUserData, "searchbar,clear_button,hide", "vp"); } else { - elm_object_signal_emit(pUserData, "elm,state,eraser,show", "elm"); + elm_object_signal_emit(pUserData, "searchbar,clear_button,show", "vp"); } - - elm_object_signal_emit(pUserData, "elm,state,guidetext,hide", "elm"); - elm_object_signal_emit(pUserData, "cancel,in", ""); - elm_object_focus_allow_set(pObject, EINA_TRUE); } /** @@ -1018,12 +739,6 @@ static void __mp_search_view_unfocused_cb(void *pUserData, VideoLogError("[ERR]No have pUserData"); return; } - - if (elm_entry_is_empty(pObject)) { - elm_object_signal_emit(pUserData, "elm,state,guidetext,show", - "elm"); - } - elm_object_signal_emit(pUserData, "elm,state,eraser,hide", "elm"); } @@ -1045,6 +760,7 @@ static void __mp_search_view_activated_cb(void *pUserData, } elm_object_focus_set(pObject, FALSE); + VideoLogError("entry activated"); } /** @@ -1063,71 +779,6 @@ static void __mp_search_view_entry_max_len_cb(void *pUserData, false, false); } -/** - * - * @param pUserData - * @param pObject - * @param pEventInfo - */ -static void __mp_search_view_eraser_clicked_cb(void *pUserData, - Evas_Object * pObject, - void *pEventInfo) -{ - VideoLogInfo(""); - if (!pUserData) { - VideoLogError("error userdata"); - return; - } - elm_object_part_content_unset(g_pSearchViewWidget->pSearchBarlayout, - "searchbar_clear_btn"); - evas_object_hide(g_pSearchViewWidget->pClearButton); - Evas_Object *pEntry = (Evas_Object *) pUserData; - elm_entry_entry_set(pEntry, ""); - elm_object_focus_allow_set(pObject, EINA_TRUE); - elm_object_focus_set(pObject, EINA_TRUE); -} - -/** - * - * @param pUserData - * @param pObject - * @param emission - * @param source - */ -static void __mp_search_view_bg_clicked_cb(void *pUserData, - Evas_Object * pObject, - const char *emission, - const char *source) -{ - VideoLogInfo(""); - if (!pUserData) { - VideoLogError("error userdata"); - return; - } - - elm_object_tree_focus_allow_set(pUserData, EINA_TRUE); -} - -/** - * - * @param pUserData - * @param pObject - * @param emission - * @param source - */ -static void __mp_search_view_search_symbol_clicked_cb(void *pUserData, - Evas_Object * - pObject, - const char *emission, - const char *source) -{ - VideoLogInfo(""); - if (!pUserData) { - VideoLogError("error userdata"); - return; - } - elm_object_focus_set(pUserData, EINA_TRUE); -} // //////////////////////////////////////////////// @@ -1156,53 +807,78 @@ int __mp_search_view_get_sort_type(void) return nSortType; } +static void __mp_search_view_grid_item_del_cb(void *pUserdata, Evas_Object * obj, void *event_info) +{ + if(g_pSearchViewHandle == NULL) + { + VideoLogError("g_pSearchViewHandle is invalid"); + return; + } + stGengridItemData *item_data = (stGengridItemData*)pUserdata; + elm_object_item_data_set(item_data->item, NULL); + free(item_data); +} + /** * - * @param pVideosGenlist + * @param pSearchListGengrid * @param bSearchedView */ -void __mp_search_view_append_video_items(void *pVideosGenlist, - bool bSearchedView) +void __mp_search_view_append_video_items(Evas_Object *pSearchListGengrid, bool bSearchedView) { VideoLogInfo(""); - if (!pVideosGenlist) { - VideoLogInfo("No exist genlist object."); + if (!pSearchListGengrid) { + VideoLogInfo("gengrid object is invalid."); return; } int nIndex = 0; int nVideoListSize = mp_util_svc_get_number_of_video_item_by_type(); - VideoSearch_Itc.item_style = "type1"; - VideoSearch_Itc.func.text_get = - (void *) mp_search_view_get_label_of_video_item_cb; - VideoSearch_Itc.func.content_get = - (void *) mp_search_view_get_icon_of_video_item_cb; - VideoSearch_Itc.func.state_get = NULL; - VideoSearch_Itc.func.del = NULL; + if(g_pSearchViewHandle->pSearchViewGIC == NULL) + { + g_pSearchViewHandle->pSearchViewGIC = elm_gengrid_item_class_new(); + g_pSearchViewHandle->pSearchViewGIC->item_style = "videolist"; + g_pSearchViewHandle->pSearchViewGIC->func.text_get = mp_search_view_get_label_of_video_item_cb;; + g_pSearchViewHandle->pSearchViewGIC->func.content_get = mp_search_view_get_icon_of_video_item_cb; + g_pSearchViewHandle->pSearchViewGIC->func.state_get = NULL; + g_pSearchViewHandle->pSearchViewGIC->func.del = NULL; + } + if (bSearchedView) { Eina_List *pIterateList = NULL; void *nTempIndex = (void *) 0; EINA_LIST_FOREACH(g_pSearchViewHandle->SearchedIndexList, pIterateList, nTempIndex) { + stGengridItemData *item_data = (stGengridItemData*)malloc(sizeof(stGengridItemData)); + if(item_data == NULL) + { + VideoLogError("Failed to allocate memory for item data"); + return; + } nIndex = (int) nTempIndex; + item_data->videoIndex = nIndex; VideoLogInfo("searched nIndex : %d", nIndex); - elm_genlist_item_append(pVideosGenlist, &VideoSearch_Itc, - (void *) nIndex, NULL, - ELM_GENLIST_ITEM_NONE, + item_data->item = elm_gengrid_item_append(pSearchListGengrid, + g_pSearchViewHandle->pSearchViewGIC, + (void *)item_data, __mp_search_view_select_video_item_cb, - NULL); + (void *)item_data); + elm_object_item_del_cb_set(item_data->item, __mp_search_view_grid_item_del_cb); } } else { for (nIndex = 0; nIndex < nVideoListSize; nIndex++) { - VideoLogInfo("nIndex : %d", nIndex); - elm_genlist_item_append(pVideosGenlist, &VideoSearch_Itc, - (void *) nIndex, NULL, - ELM_GENLIST_ITEM_NONE, + stGengridItemData *item_data = (stGengridItemData*)malloc(sizeof(stGengridItemData)); + item_data->videoIndex = nIndex; + VideoLogInfo("searched nIndex : %d", nIndex); + item_data->item = elm_gengrid_item_append(pSearchListGengrid, + g_pSearchViewHandle->pSearchViewGIC, + (void *)item_data, __mp_search_view_select_video_item_cb, - NULL); + (void *)item_data); + elm_object_item_del_cb_set(item_data->item, __mp_search_view_grid_item_del_cb); } } } @@ -1210,15 +886,14 @@ void __mp_search_view_append_video_items(void *pVideosGenlist, /** * * @param nItemSortType - * @param pVideosGenlist + * @param pSearchListGengrid */ -void __mp_search_view_arrange_video_list(int nItemSortType, - void *pVideosGenlist) +void __mp_search_view_arrange_video_list(int nItemSortType, Evas_Object *pSearchListGengrid) { VideoLogInfo(""); - if (!pVideosGenlist) { - VideoLogInfo("No exist genlist object."); + if (pSearchListGengrid == NULL) { + VideoLogInfo("gengrid object is invalid."); return; } @@ -1237,20 +912,18 @@ void __mp_search_view_arrange_video_list(int nItemSortType, if (g_pSearchViewHandle->nViewType == MP_LIST_VIEW_AS_FOLDER_LIST && !mp_folder_view_is_item_view()) { mp_util_svc_destory_video_list(); - mp_util_svc_extract_video_list_by_item_type(nItemSortType, - mp_view_ctrl_get_list_type - ()); + mp_util_svc_extract_video_list_by_item_type(nItemSortType, mp_view_ctrl_get_list_type()); } nVideoListSize = mp_util_svc_get_number_of_video_item_by_type(); VideoLogInfo("nVideoListSize : %d", nVideoListSize); - elm_genlist_clear(pVideosGenlist); + elm_gengrid_clear(pSearchListGengrid); if (nVideoListSize > 0) { - __mp_search_view_append_video_items(pVideosGenlist, false); + __mp_search_view_append_video_items(pSearchListGengrid, false); } - evas_object_show(pVideosGenlist); + evas_object_show(pSearchListGengrid); } /** @@ -1274,26 +947,7 @@ static void __mp_search_view_clicked_cb(void *pUserData, /** * - * @param data - * @param obj - * @param emission - * @param source - */ -static void __mp_search_view_soft_back_button_cb(void *data, - Evas_Object * obj, - const char *emission, - const char *source) -{ - VideoLogInfo(" "); - Evas_Object *pTopNaviFrame = NULL; - pTopNaviFrame = - elm_naviframe_item_pop(g_pSearchViewHandle->pNaviFrameHandle); - evas_object_del(pTopNaviFrame); -} - -/** - * - * @param data + * @param datadest * @param obj * @param event_info */ @@ -1305,177 +959,114 @@ static void __mp_search_view_rotate_cb(void *data, Evas_Object * obj, return; } bool bLandscape = mp_rotate_ctrl_check_landspace(); +} - const char *temp = - elm_object_text_get(g_pSearchViewWidget->pSearchBarEntry); - char *TempUtf8 = elm_entry_markup_to_utf8(temp); - char *szChangedStr = mp_search_view_get_fact_str(TempUtf8); +Evas_Object* mp_search_view_create_base_layout(void *parent) +{ + if (!parent) { + VideoLogInfo("parent object for base layout is invalid"); + return NULL; + } - if (bLandscape) { - elm_object_signal_emit(g_pSearchViewWidget->pSearchBarlayout, - "elm,state,show,portrait", "elm"); + VideoLogInfo(""); - if (szChangedStr != NULL && strlen(szChangedStr) > 0) { - elm_object_signal_emit(g_pSearchViewWidget->pSearchBarlayout, - "elm,state,show,clear_button,portrait", - "elm"); - } - } else { - elm_object_signal_emit(g_pSearchViewWidget->pSearchBarlayout, - "elm,state,show,landscape", "elm"); + char edj_path[1024] = { 0 }; + char *path = app_get_resource_path(); + snprintf(edj_path, 1024, "%s%s/%s", path, "edje", VIDEO_CUSTOM_THEME); + free(path); - if (szChangedStr != NULL && strlen(szChangedStr) > 0) { - elm_object_signal_emit(g_pSearchViewWidget->pSearchBarlayout, - "elm,state,show,clear_button,landscape", - "elm"); - } - } + Evas_Object* layout = elm_layout_add(parent); + elm_layout_file_set(layout, edj_path, "gengrid/layout"); + evas_object_size_hint_weight_set(layout, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); + evas_object_size_hint_align_set(layout, EVAS_HINT_FILL, EVAS_HINT_FILL); - MP_FREE_STRING(szChangedStr); - MP_FREE_STRING(TempUtf8); + return layout; } -/** - * - * @param pParent - * @return - */ -static Evas_Object *__mp_search_view_init_internal_layout(void *pParent) +static void __mp_search_view_entry_clear(void *data, Evas_Object *o, const char *emission, const char *source) { - VideoLogInfo(""); - - if (!pParent) { - VideoLogError("[ERR]"); - return NULL; - } - - if (g_pSearchViewWidget->pSearchViewBaselayout) { - evas_object_del(g_pSearchViewWidget->pSearchViewBaselayout); - g_pSearchViewWidget->pSearchViewBaselayout = NULL; + if(g_pSearchViewWidget == NULL || g_pSearchViewWidget->pSearchBarEntry == NULL) + { + VideoLogError("widget handle[%p] or entry [%p] maybe invalid", g_pSearchViewWidget, + g_pSearchViewWidget->pSearchBarEntry); + return; } - char edj_path[1024] = { 0 }; + elm_entry_entry_set(g_pSearchViewWidget->pSearchBarEntry, ""); +} - char *path = app_get_resource_path(); - snprintf(edj_path, 1024, "%s%s/%s", path, "edje", - VIDEO_BASIC_NAVIFRAME_EDJ); - free(path); - // Create search view base layout. - g_pSearchViewWidget->pSearchViewBaselayout = elm_layout_add(pParent); - elm_layout_file_set(g_pSearchViewWidget->pSearchViewBaselayout, - edj_path, "search_view_layout"); - - // Create search bar layout. - g_pSearchViewWidget->pSearchBarlayout = - elm_layout_add(g_pSearchViewWidget->pSearchViewBaselayout); - elm_layout_file_set(g_pSearchViewWidget->pSearchBarlayout, edj_path, - "searchbar_video"); - elm_object_part_content_set(g_pSearchViewWidget->pSearchViewBaselayout, - "search_bar", - g_pSearchViewWidget->pSearchBarlayout); - elm_object_signal_callback_add(g_pSearchViewWidget->pSearchBarlayout, - "elm,action,click", - "back_button_callback", - __mp_search_view_soft_back_button_cb, - NULL); - elm_object_signal_emit(g_pSearchViewWidget->pSearchBarlayout, - "elm,state,show,searchbar", "elm"); - - // Create entry. - g_pSearchViewWidget->pSearchBarEntry = - elm_entry_add(g_pSearchViewWidget->pSearchBarlayout); - elm_entry_single_line_set(g_pSearchViewWidget->pSearchBarEntry, - EINA_TRUE); - elm_entry_scrollable_set(g_pSearchViewWidget->pSearchBarEntry, - EINA_TRUE); - elm_object_domain_translatable_part_text_set(g_pSearchViewWidget-> - pSearchBarEntry, - "elm.guide", - VIDEOS_STRING, - VIDEOS_CTXPOP_MENU_SEARCH_IDS); - elm_object_domain_part_text_translatable_set(g_pSearchViewWidget-> - pSearchBarEntry, - "elm.guide", - VIDEOS_STRING, EINA_TRUE); - - elm_entry_scrollable_set(g_pSearchViewWidget->pSearchBarEntry, - EINA_TRUE); - elm_entry_single_line_set(g_pSearchViewWidget->pSearchBarEntry, - EINA_TRUE); - elm_entry_cnp_mode_set(g_pSearchViewWidget->pSearchBarEntry, - ELM_CNP_MODE_PLAINTEXT); - elm_entry_prediction_allow_set(g_pSearchViewWidget->pSearchBarEntry, - EINA_TRUE); +static Evas_Object* mp_search_view_create_title_content(Evas_Object* naviframe) +{ + Evas_Object* layout = elm_layout_add(naviframe); + char path[1024] = {0, }; + char *res_path = app_get_resource_path(); + snprintf(path, 1024, "%s%s/%s", res_path, "edje", "vp-searchbar.edj"); + free(res_path); + elm_layout_file_set(layout, path, "homepage/searchbar"); + + //Register clear button click signal + elm_object_signal_callback_add(layout, "clear_button,clicked", "vp", __mp_search_view_entry_clear, NULL); + + Evas_Object* more_button = elm_button_add(layout); + elm_object_style_set(more_button, "naviframe/more"); + elm_object_part_content_set(layout, "more.icon.swallow", more_button); + + elm_object_signal_emit(layout, "searchbar,show", "vp"); + + g_pSearchViewWidget->pSearchBarEntry = elm_entry_add(layout); + elm_entry_single_line_set(g_pSearchViewWidget->pSearchBarEntry, EINA_TRUE); + elm_entry_scrollable_set(g_pSearchViewWidget->pSearchBarEntry, EINA_TRUE); + eext_entry_selection_back_event_allow_set(g_pSearchViewWidget->pSearchBarEntry, EINA_TRUE); + elm_entry_cnp_mode_set(g_pSearchViewWidget->pSearchBarEntry, ELM_CNP_MODE_PLAINTEXT); + elm_entry_prediction_allow_set(g_pSearchViewWidget->pSearchBarEntry, EINA_TRUE); + elm_object_domain_translatable_part_text_set(g_pSearchViewWidget->pSearchBarEntry, + "elm.guide", + VIDEOS_STRING, + VIDEOS_CTXPOP_MENU_SEARCH_IDS); + elm_object_domain_part_text_translatable_set(g_pSearchViewWidget->pSearchBarEntry, + "elm.guide", + VIDEOS_STRING, + EINA_TRUE); evas_object_smart_callback_add(g_pSearchViewWidget->pSearchBarEntry, - "changed", + "changed", __mp_search_view_entry_changed_cb, - g_pSearchViewWidget->pSearchBarlayout); + layout); evas_object_smart_callback_add(g_pSearchViewWidget->pSearchBarEntry, "focused", __mp_search_view_focused_cb, - g_pSearchViewWidget->pSearchBarlayout); + layout); evas_object_smart_callback_add(g_pSearchViewWidget->pSearchBarEntry, "unfocused", __mp_search_view_unfocused_cb, - g_pSearchViewWidget->pSearchBarlayout); + layout); evas_object_smart_callback_add(g_pSearchViewWidget->pSearchBarEntry, "preedit,changed", __mp_search_view_entry_changed_cb, - g_pSearchViewWidget->pSearchBarlayout); + layout); evas_object_smart_callback_add(g_pSearchViewWidget->pSearchBarEntry, "activated", __mp_search_view_activated_cb, - g_pSearchViewWidget->pSearchBarlayout); + layout); evas_object_smart_callback_add(g_pSearchViewWidget->pSearchBarEntry, "clicked", __mp_search_view_clicked_cb, - g_pSearchViewWidget->pSearchBarlayout); - - g_pSearchViewWidget->pClearButton = - elm_button_add(g_pSearchViewWidget->pSearchBarlayout); - elm_object_style_set(g_pSearchViewWidget->pClearButton, "clear_dim"); - elm_object_disabled_set(g_pSearchViewWidget->pClearButton, EINA_TRUE); - evas_object_smart_callback_add(g_pSearchViewWidget->pClearButton, - "clicked", - __mp_search_view_eraser_clicked_cb, - g_pSearchViewWidget->pSearchBarEntry); - + layout); static Elm_Entry_Filter_Limit_Size limit_filter_data; limit_filter_data.max_char_count = VIDEO_FILE_SEARCH_CHAR_LEN_MAX; limit_filter_data.max_byte_count = 0; elm_entry_markup_filter_append(g_pSearchViewWidget->pSearchBarEntry, - elm_entry_filter_limit_size, - &limit_filter_data); + elm_entry_filter_limit_size, + &limit_filter_data); evas_object_smart_callback_add(g_pSearchViewWidget->pSearchBarEntry, - "maxlength,reached", - __mp_search_view_entry_max_len_cb, - NULL); - - elm_object_part_content_set(g_pSearchViewWidget->pSearchBarlayout, - "searchbar", - g_pSearchViewWidget->pSearchBarEntry); - elm_object_part_content_set(g_pSearchViewWidget->pSearchViewBaselayout, - "search_bar", - g_pSearchViewWidget->pSearchBarlayout); - elm_object_signal_callback_add(g_pSearchViewWidget-> - pSearchViewBaselayout, "elm,bg,clicked", - "elm", __mp_search_view_bg_clicked_cb, - g_pSearchViewWidget->pSearchBarEntry); - elm_entry_input_panel_layout_set(g_pSearchViewWidget->pSearchBarEntry, - ELM_INPUT_PANEL_LAYOUT_NORMAL); - elm_entry_input_panel_return_key_type_set(g_pSearchViewWidget-> - pSearchBarEntry, - ELM_INPUT_PANEL_RETURN_KEY_TYPE_SEARCH); - evas_object_size_hint_weight_set(g_pSearchViewWidget-> - pSearchViewBaselayout, - EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); - evas_object_size_hint_align_set(g_pSearchViewWidget-> - pSearchViewBaselayout, EVAS_HINT_FILL, - EVAS_HINT_FILL); - elm_object_signal_callback_add(g_pSearchViewWidget-> - pSearchViewBaselayout, - "elm,action,click", "", - __mp_search_view_search_symbol_clicked_cb, - g_pSearchViewWidget->pSearchBarEntry); - - return g_pSearchViewWidget->pSearchViewBaselayout; + "maxlength,reached", + __mp_search_view_entry_max_len_cb, + NULL); + elm_entry_input_panel_layout_set(g_pSearchViewWidget->pSearchBarEntry, ELM_INPUT_PANEL_LAYOUT_NORMAL); + elm_entry_input_panel_return_key_type_set(g_pSearchViewWidget->pSearchBarEntry, ELM_INPUT_PANEL_RETURN_KEY_TYPE_SEARCH); + + evas_object_size_hint_weight_set(g_pSearchViewWidget->pSearchBarEntry, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); + evas_object_size_hint_align_set(g_pSearchViewWidget->pSearchBarEntry, EVAS_HINT_FILL, EVAS_HINT_FILL); + + elm_object_part_content_set(layout, "search.inputfiled.swallow", g_pSearchViewWidget->pSearchBarEntry); + + return layout; } /** @@ -1500,60 +1091,38 @@ static void __mp_search_view_update_genlist_item(const char *szSearchWord) eina_list_free(g_pSearchViewHandle->SearchedIndexList); g_pSearchViewHandle->SearchedIndexList = NULL; } - mp_util_svc_index_list_for_search_view(szSearchWord, - (void **) &g_pSearchViewHandle-> - SearchedIndexList); + mp_util_svc_index_list_for_search_view(szSearchWord, (void **) &g_pSearchViewHandle->SearchedIndexList); - if (g_pSearchViewHandle->pVideosGenlist) - elm_genlist_clear(g_pSearchViewHandle->pVideosGenlist); + if (g_pSearchViewHandle->pSearchListGengrid) + elm_gengrid_clear(g_pSearchViewHandle->pSearchListGengrid); + Evas_Object* current_layout = g_pSearchViewHandle->pSearchListGengrid; if (g_pSearchViewHandle->SearchedIndexList) { - memset(g_pSearchViewHandle->szSearchWord, 0, - sizeof(char) * SEARCH_CHAR_LEN); - strncpy(g_pSearchViewHandle->szSearchWord, szSearchWord, - SEARCH_CHAR_LEN - 1); - __mp_search_view_is_existed_no_content_layout(); - __mp_search_view_append_video_items(g_pSearchViewHandle-> - pVideosGenlist, true); + memset(g_pSearchViewHandle->szSearchWord, 0, sizeof(char) * SEARCH_CHAR_LEN); + strncpy(g_pSearchViewHandle->szSearchWord, szSearchWord, SEARCH_CHAR_LEN - 1); + __mp_search_view_append_video_items(g_pSearchViewHandle->pSearchListGengrid, true); + current_layout = g_pSearchViewHandle->pSearchListGengrid; } else { - __mp_search_view_is_existed_genlist(); - void *pNoContentLayout = - __mp_search_view_add_no_contents_layout(g_pSearchViewWidget-> - pSearchViewBaselayout); - elm_object_part_content_set(g_pSearchViewWidget-> - pSearchViewBaselayout, - "elm.swallow.content", - pNoContentLayout); + if(g_pSearchViewWidget->pNocontentsLayout == NULL) + { + g_pSearchViewWidget->pNocontentsLayout = mp_create_nocontent_layout(g_pSearchViewWidget->pSearchViewBaselayout, + VIDEOS_SEARCHVIEW_MSG_NO_SEARCH_RESULTS, + NULL); + } + current_layout = g_pSearchViewWidget->pNocontentsLayout; } + __mp_search_view_base_layout_content_set(g_pSearchViewWidget->pSearchViewBaselayout, current_layout); } /** * */ -void mp_search_view_update_genlist() +void mp_search_view_update_gengrid() { - if (g_pSearchViewHandle && g_pSearchViewHandle->pVideosGenlist) { + if (g_pSearchViewHandle && g_pSearchViewHandle->pSearchListGengrid) { if (g_pSearchViewHandle->nViewType == MP_LIST_VIEW_AS_FOLDER_LIST && mp_folder_view_is_item_view()) { - Elm_Object_Item *currItem = NULL; - Elm_Object_Item *nextItem = NULL; - currItem = - elm_genlist_first_item_get(g_pSearchViewHandle-> - pVideosGenlist); - int index = 0; - while (currItem) { - nextItem = elm_genlist_item_next_get(currItem); - elm_genlist_item_update(currItem); - mp_util_svc_update_thumbnail_info(g_pSearchViewHandle-> - nPlayVideoIndex); - __mp_search_view_update_video_items((Evas_Object *) - g_pSearchViewHandle-> - pVideosGenlist, index, - g_pSearchViewHandle-> - nPlayVideoIndex); - currItem = nextItem; - index++; - } + elm_gengrid_realized_items_update(g_pSearchViewHandle->pSearchListGengrid); } } } @@ -1563,13 +1132,12 @@ void mp_search_view_update_genlist() * @param pUserData * @param pObject */ -static void __mp_search_view_db_data_changed(void *pUserData, - Evas_Object * pObject) +static void __mp_search_view_db_data_changed(Evas_Object * pObject) { VideoLogInfo(""); - if (!g_pSearchViewHandle || !pUserData || !pObject) { - VideoLogError("g_pSearchViewHandle == NULL"); + if (!g_pSearchViewHandle || !pObject || !g_pSearchViewWidget) { + VideoLogError("handle or parameter may be null"); return; } @@ -1585,15 +1153,10 @@ static void __mp_search_view_db_data_changed(void *pUserData, if (szChangedStr != NULL && strlen(szChangedStr) > 0) { __mp_search_view_update_genlist_item(szChangedStr); } else { - memset(g_pSearchViewHandle->szSearchWord, 0, - sizeof(char) * SEARCH_CHAR_LEN); - __mp_search_view_is_existed_no_content_layout(); - __mp_search_view_arrange_video_list(__mp_search_view_get_sort_type - (), - g_pSearchViewHandle-> - pVideosGenlist); - elm_object_focus_set(g_pSearchViewWidget->pSearchBarEntry, - EINA_TRUE); + memset(g_pSearchViewHandle->szSearchWord, 0, sizeof(char) * SEARCH_CHAR_LEN); + __mp_search_view_base_layout_content_set(g_pSearchViewWidget->pSearchViewBaselayout, g_pSearchViewHandle->pSearchListGengrid); + __mp_search_view_arrange_video_list(__mp_search_view_get_sort_type(), g_pSearchViewHandle->pSearchListGengrid); + elm_object_focus_set(g_pSearchViewWidget->pSearchBarEntry, EINA_TRUE); } MP_FREE_STRING(szChangedStr); @@ -1619,48 +1182,33 @@ static void __mp_search_view_db_changed_cb(void *pUserData) if (vp_file_exists(g_pSearchViewHandle->pFolderPath)) { //update video-list mp_util_svc_destory_video_item_list(); - mp_util_svc_extract_video_list_from_folder - (g_pSearchViewHandle->pFolderPath, nSortType, - MP_LIST_VIEW_ALL); - int nVideoListSize = - mp_util_svc_get_number_of_video_item_by_type(); + mp_util_svc_extract_video_list_from_folder(g_pSearchViewHandle->pFolderPath, nSortType, MP_LIST_VIEW_ALL); + int nVideoListSize = mp_util_svc_get_number_of_video_item_by_type(); VideoLogInfo("nVideoListSize : %d", nVideoListSize); if (nVideoListSize > 0) { - __mp_search_view_db_data_changed(g_pSearchViewWidget-> - pSearchBarlayout, - g_pSearchViewWidget-> - pSearchBarEntry); + __mp_search_view_db_data_changed(g_pSearchViewWidget->pSearchBarEntry); } else { - elm_naviframe_item_pop(g_pSearchViewHandle-> - pNaviFrameHandle); + elm_naviframe_item_pop(g_pSearchViewHandle->pNaviFrameHandle); } } else { - elm_naviframe_item_pop(g_pSearchViewHandle-> - pNaviFrameHandle); + elm_naviframe_item_pop(g_pSearchViewHandle->pNaviFrameHandle); } } } else { mp_util_svc_destory_video_list(); - mp_util_svc_extract_video_list_by_item_type(nSortType, - mp_view_ctrl_get_list_type - ()); + mp_util_svc_extract_video_list_by_item_type(nSortType, mp_view_ctrl_get_list_type()); - int nVideoListSize = - mp_util_svc_get_number_of_video_item_by_type(); + int nVideoListSize = mp_util_svc_get_number_of_video_item_by_type(); VideoLogInfo("nVideoListSize : %d", nVideoListSize); if (nVideoListSize > 0) { - __mp_search_view_db_data_changed(g_pSearchViewWidget-> - pSearchBarlayout, - g_pSearchViewWidget-> - pSearchBarEntry); + __mp_search_view_db_data_changed(g_pSearchViewWidget->pSearchBarEntry); } else { elm_naviframe_item_pop(g_pSearchViewHandle->pNaviFrameHandle); } } - Elm_Object_Item *pItem = - elm_genlist_first_item_get(g_pSearchViewHandle->pVideosGenlist); + Elm_Object_Item *pItem = elm_gengrid_first_item_get(g_pSearchViewHandle->pSearchListGengrid); if (pItem) { - elm_genlist_item_bring_in(pItem, ELM_GENLIST_ITEM_SCROLLTO_IN); + elm_gengrid_item_bring_in(pItem, ELM_GENGRID_ITEM_SCROLLTO_IN); } } @@ -1676,6 +1224,25 @@ bool mp_search_view_get_active_view() return g_pSearchViewHandle->isViewActive; } +static Evas_Object* _create_gengrid(Evas_Object *parent) +{ + if(g_pSearchViewWidget == NULL || parent == NULL) + { + VideoLogError("gengrid parent [%p] or widget handle [%p] maybe be invalid", g_pSearchViewWidget, parent); + return NULL; + } + Evas_Object *gengrid = elm_gengrid_add(parent); + evas_object_size_hint_weight_set(gengrid, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); + evas_object_size_hint_align_set(gengrid, EVAS_HINT_FILL, EVAS_HINT_FILL); + elm_gengrid_item_size_set(gengrid, GENGRID_ITEM_WIDTH, GENGRID_ITEM_HEIGHT); + evas_object_smart_callback_add(gengrid, "scroll,anim,start", + __mp_search_view_gengrid_scroll_cb, + (void *) g_pSearchViewWidget); + + return gengrid; +} + + /** * * @param pParent @@ -1689,78 +1256,61 @@ void mp_search_view_init(void *pParent) return; } g_pSearchViewHandle->bShowNormalLayout = TRUE; - g_pSearchViewWidget->pSearchViewBaselayout = - __mp_search_view_init_internal_layout(pParent); + g_pSearchViewWidget->pSearchViewBaselayout = mp_search_view_create_base_layout(g_pSearchViewHandle->pNaviFrameHandle); + evas_object_smart_callback_add((Evas_Object *) mp_util_get_main_window_handle(), "wm,rotation,changed", __mp_search_view_rotate_cb, NULL); mp_search_view_check_landscape(); - g_pSearchViewHandle->pVideosGenlist = - elm_genlist_add(g_pSearchViewWidget->pSearchViewBaselayout); - evas_object_size_hint_weight_set(g_pSearchViewHandle->pVideosGenlist, - EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); - evas_object_size_hint_align_set(g_pSearchViewHandle->pVideosGenlist, - EVAS_HINT_FILL, EVAS_HINT_FILL); - elm_genlist_block_count_set(g_pSearchViewHandle->pVideosGenlist, - VIDEO_GENLIST_BLOCK_COUNT); - elm_genlist_mode_set(g_pSearchViewHandle->pVideosGenlist, - ELM_LIST_COMPRESS); - elm_genlist_homogeneous_set(g_pSearchViewHandle->pVideosGenlist, - EINA_TRUE); - evas_object_smart_callback_add(g_pSearchViewHandle->pVideosGenlist, - "scroll,anim,start", - __mp_search_view_genlist_scroll_cb, - (void *) g_pSearchViewWidget); + g_pSearchViewHandle->pSearchListGengrid = _create_gengrid(g_pSearchViewWidget->pSearchViewBaselayout); + if(g_pSearchViewHandle->pSearchListGengrid == NULL) + { + VideoLogError("failed to create gengrid"); + } + + // Setting search view activated. g_pSearchViewHandle->isViewActive = true; - __mp_search_view_arrange_video_list(__mp_search_view_get_sort_type(), - g_pSearchViewHandle-> - pVideosGenlist); - elm_object_part_content_set(g_pSearchViewWidget->pSearchViewBaselayout, - "elm.swallow.content", - g_pSearchViewHandle->pVideosGenlist); - evas_object_event_callback_add(g_pSearchViewWidget-> - pSearchViewBaselayout, - EVAS_CALLBACK_DEL, - __mp_search_view_base_layout_del_cb, - NULL); + __mp_search_view_arrange_video_list(__mp_search_view_get_sort_type(), g_pSearchViewHandle->pSearchListGengrid); g_pSearchViewHandle->pNaviFrameItem = elm_naviframe_item_push(g_pSearchViewHandle->pNaviFrameHandle, NULL, NULL, NULL, g_pSearchViewWidget->pSearchViewBaselayout, NULL); + + Evas_Object* button = elm_button_add(g_pSearchViewHandle->pNaviFrameItem); + elm_object_style_set(button, "naviframe/back_btn/default"); + evas_object_smart_callback_add(button, "clicked", __mp_search_view_softk_back_btn_cb, g_pSearchViewHandle); + elm_object_item_part_content_set(g_pSearchViewHandle->pNaviFrameItem, "elm.swallow.prev_btn", button); + elm_object_item_signal_emit(g_pSearchViewHandle->pNaviFrameItem, "elm,state,prev_btn,show", "elm"); + + eext_object_event_callback_add(g_pSearchViewHandle->pNaviFrameHandle, EEXT_CALLBACK_BACK, eext_naviframe_back_cb, NULL); + g_pSearchViewWidget->pTitleContent = mp_search_view_create_title_content(g_pSearchViewHandle->pNaviFrameItem); + elm_object_item_part_content_set(g_pSearchViewHandle->pNaviFrameItem, "title_content", g_pSearchViewWidget->pTitleContent); + elm_object_item_signal_emit(g_pSearchViewHandle->pNaviFrameItem, "elm,state,title_content,show", "elm"); + elm_naviframe_item_pop_cb_set(g_pSearchViewHandle->pNaviFrameItem, mp_search_view_back_btn_cb, g_pSearchViewHandle); - evas_object_smart_callback_add(g_pSearchViewHandle->pNaviFrameHandle, - "transition,finished", - __mp_search_view_naviframe_transition_effect_cb, - NULL); - elm_naviframe_item_title_enabled_set(g_pSearchViewHandle-> - pNaviFrameItem, EINA_FALSE, - EINA_FALSE); + Evas_Object* current_layout = g_pSearchViewHandle->pSearchListGengrid; if (mp_util_svc_get_number_of_video_item_by_type() < 1) { - __mp_search_view_is_existed_genlist(); - void *pNoContentLayout = - __mp_search_view_add_no_contents_layout(g_pSearchViewWidget-> - pSearchViewBaselayout); - elm_object_part_content_set(g_pSearchViewWidget-> - pSearchViewBaselayout, - "elm.swallow.content", - pNoContentLayout); + if(g_pSearchViewWidget->pNocontentsLayout == NULL) + { + g_pSearchViewWidget->pNocontentsLayout = mp_create_nocontent_layout(g_pSearchViewWidget->pSearchViewBaselayout, + VIDEOS_SEARCHVIEW_MSG_NO_SEARCH_RESULTS, + NULL); + } + current_layout = g_pSearchViewWidget->pNocontentsLayout; } + __mp_search_view_base_layout_content_set(g_pSearchViewWidget->pSearchViewBaselayout, current_layout); mp_util_virtual_keypad_disabled_set(EINA_TRUE); - mp_util_db_set_update_fun(g_pSearchViewHandle->euLev, - __mp_search_view_db_changed_cb); + mp_util_db_set_update_fun(g_pSearchViewHandle->euLev, __mp_search_view_db_changed_cb); mp_util_hide_indicator(); - - elm_object_signal_emit(g_pSearchViewWidget->pSearchBarlayout, - "elm,state,eraser,hide", "elm"); } /** @@ -1776,7 +1326,7 @@ void mp_search_view_push(void *pNaviFrame, char *pFolderPath) } VideoLogInfo(""); - mp_search_view_destroy(); + //mp_search_view_destroy(); g_pSearchViewHandle = (st_VideoSearchViewHandle *) calloc(1, @@ -1796,7 +1346,7 @@ void mp_search_view_push(void *pNaviFrame, char *pFolderPath) g_pSearchViewHandle->nPlayVideoIndex = -1; - int nViewType = mp_view_as_ctrl_get_type(); + int nViewType = mp_list_view_view_type_get(); g_pSearchViewHandle->nViewType = nViewType; g_pSearchViewHandle->euLev = MP_DB_UPDATE_LEV_1; if (nViewType == MP_LIST_VIEW_AS_FOLDER_LIST @@ -1826,8 +1376,7 @@ static void __mp_search_view_pop(void *pNaviFrame) if (g_pSearchViewHandle->bUpdateList) { if (g_pSearchViewHandle->pChangeViewUpdateFunc) { bUpdateList = TRUE; - g_pSearchViewHandle-> - pChangeViewUpdateFunc(LIST_UPDATE_TYPE_ALL); + g_pSearchViewHandle->pChangeViewUpdateFunc(LIST_UPDATE_TYPE_ALL); } } @@ -1870,41 +1419,19 @@ void mp_search_view_register_update_list_func(ViewUpdateListItemCbFunc * @param nGenItemIndex * @param nPlayVideoIndex */ -static void __mp_search_view_update_video_items(Evas_Object * pGenlist, - int nGenItemIndex, - int nPlayVideoIndex) +static void __mp_search_view_update_video_items(Evas_Object * pGengrid, int nGenItemIndex, int nPlayVideoIndex) { - if (!pGenlist) { + if (!pGengrid) { VideoLogWarning("[WARNING] pNormalVideoItemList is not existed."); return; } VideoLogInfo("%d", nGenItemIndex); - Elm_Object_Item *pTmpVideoGenlistItem = - elm_genlist_nth_item_get((const Evas_Object *) pGenlist, - nGenItemIndex); - if (pTmpVideoGenlistItem) { - elm_genlist_item_selected_set(pTmpVideoGenlistItem, EINA_FALSE); - Evas_Object *pIconContent = - elm_object_item_part_content_get(pTmpVideoGenlistItem, - "elm.swallow.icon"); - if (!pIconContent) { - VideoLogError(""); - return; - } - Evas_Object *pProgressbar = - elm_layout_content_get(pIconContent, "elm.progressbar.icon"); - - if (pProgressbar) { - elm_layout_content_unset(pIconContent, - "elm.progressbar.icon"); - MP_DEL_OBJ(pProgressbar); - } - - elm_genlist_item_fields_update(pTmpVideoGenlistItem, - "elm.text.sub", - ELM_GENLIST_ITEM_FIELD_TEXT); + Elm_Object_Item *item = elm_gengrid_nth_item_get((const Evas_Object *) pGengrid, nGenItemIndex); + if (item) { + elm_gengrid_item_selected_set(item, EINA_FALSE); + elm_gengrid_item_update(item); } } @@ -1925,7 +1452,7 @@ void mp_search_view_update_played_item(int nIndex) } VideoLogInfo(""); - if (g_pSearchViewHandle->pVideosGenlist) { + if (g_pSearchViewHandle->pSearchListGengrid) { int nGenItemIndex = g_pSearchViewHandle->nPlayVideoIndex; if (g_pSearchViewHandle->SearchedIndexList) { Eina_List *pIterateList = NULL; @@ -1935,21 +1462,17 @@ void mp_search_view_update_played_item(int nIndex) pIterateList, nTempIndex) { VideoLogInfo("nTempIndex:index==%d:%d:%d", (int) nTempIndex, nIndex, nGenItemIndex); - if (g_pSearchViewHandle->nPlayVideoIndex == - (int) nTempIndex) { + if (g_pSearchViewHandle->nPlayVideoIndex == (int) nTempIndex) { nGenItemIndex = nIndex; break; } nIndex++; } } - mp_util_svc_update_thumbnail_info(g_pSearchViewHandle-> - nPlayVideoIndex); - __mp_search_view_update_video_items((Evas_Object *) - g_pSearchViewHandle-> - pVideosGenlist, nGenItemIndex, - g_pSearchViewHandle-> - nPlayVideoIndex); + mp_util_svc_update_thumbnail_info(g_pSearchViewHandle->nPlayVideoIndex); + __mp_search_view_update_video_items((Evas_Object *)g_pSearchViewHandle->pSearchListGengrid, + nGenItemIndex, + g_pSearchViewHandle->nPlayVideoIndex); } } @@ -1965,24 +1488,8 @@ void mp_search_view_change_language(void) return; } - elm_object_domain_translatable_part_text_set(g_pSearchViewWidget-> - pSearchBarlayout, - "elm.guidetext", - VIDEOS_STRING, - VIDEOS_CTXPOP_MENU_SEARCH); -} - - -/** - * - * @param data - * @param e - * @param obj - * @param event_info - */ -static void -__mp_search_view_base_layout_del_cb(void *data, Evas * e, - Evas_Object * obj, void *event_info) -{ - __mp_search_view_reset(); + // elm_object_domain_translatable_part_text_set(g_pSearchViewWidget->pSearchBarlayout, + // "elm.guidetext", + // VIDEOS_STRING, + // VIDEOS_CTXPOP_MENU_SEARCH); } diff --git a/src/viewMgr/videos-view-mgr.c b/src/viewMgr/videos-view-mgr.c index 9bc717d..16624b8 100755 --- a/src/viewMgr/videos-view-mgr.c +++ b/src/viewMgr/videos-view-mgr.c @@ -142,8 +142,9 @@ static Evas_Object *__mp_mgr_create_bg(Evas_Object * pWin) char path[1024] = {0, }; char *res_path = app_get_resource_path(); - snprintf(path, 1024, "%s%s\%s", res_path, "images", "app_main_bg.png"); + snprintf(path, 1024, "%s%s/%s", res_path, "images", "app_main_bg.png"); VideoLogInfo("Main BG Path: %s", path); + free(res_path); bg = elm_bg_add(pWin); Eina_Bool ret = elm_bg_file_set(bg, path, NULL); diff --git a/src/widget/mp-footer-toolbar.c b/src/widget/mp-footer-toolbar.c index 11fd2cb..879bd04 100755 --- a/src/widget/mp-footer-toolbar.c +++ b/src/widget/mp-footer-toolbar.c @@ -37,14 +37,8 @@ typedef struct { MpFooterLibraryMainListTabType nFooterListTabType; - Evas_Object *pSortToolbarButton; - Evas_Object *pSearchToolbarButton; - Evas_Object *pSettingToolbarButton; Evas_Object *pMoreToolbarButton; Evas_Object *pMoreCtxPopup; - Evas_Object *pDeleteButton; - Evas_Object *pDeleteCancelButton; - Evas_Object *pViewButton; st_RegisteCbFunc ToolbarCbFunc; } st_ToolbarWidget; @@ -52,70 +46,33 @@ typedef struct { st_ToolbarWidget *g_pToolbarWidget = NULL; +static void mp_ft_ctrl_more_btn_cb(void *pUserData, Evas_Object * pObject, void *pEventInfo); + /** * */ -void mp_ft_ctrl_free_toolbar_btn(void) +void mp_ft_ctrl_reset_toolbar_btn(void) { VideoLogInfo(""); if (g_pToolbarWidget) { - if (g_pToolbarWidget->pNaviFrameItem) { - elm_object_item_part_content_unset - (g_pToolbarWidget->pNaviFrameItem, "toolbar_button2"); - - g_pToolbarWidget->pNaviFrameItem = NULL; - } - g_pToolbarWidget->pNaviFrameHandle = NULL; - - if (g_pToolbarWidget->pViewButton) { - evas_object_del(g_pToolbarWidget->pViewButton); - g_pToolbarWidget->pViewButton = NULL; - } if (g_pToolbarWidget->pMoreToolbarButton) { - evas_object_del(g_pToolbarWidget->pMoreToolbarButton); + evas_object_smart_callback_del(g_pToolbarWidget->pMoreToolbarButton, "clicked", mp_ft_ctrl_more_btn_cb); g_pToolbarWidget->pMoreToolbarButton = NULL; } - if (g_pToolbarWidget->pSortToolbarButton) { - evas_object_del(g_pToolbarWidget->pSortToolbarButton); - g_pToolbarWidget->pSortToolbarButton = NULL; - } - - if (g_pToolbarWidget->pSearchToolbarButton) { - evas_object_del(g_pToolbarWidget->pSearchToolbarButton); - g_pToolbarWidget->pSearchToolbarButton = NULL; - } - - if (g_pToolbarWidget->pSettingToolbarButton) { - evas_object_del(g_pToolbarWidget->pSettingToolbarButton); - g_pToolbarWidget->pSettingToolbarButton = NULL; - } - if (g_pToolbarWidget->pMoreCtxPopup) { evas_object_del(g_pToolbarWidget->pMoreCtxPopup); g_pToolbarWidget->pMoreCtxPopup = NULL; } - if (g_pToolbarWidget->pDeleteButton) { - evas_object_del(g_pToolbarWidget->pDeleteButton); - g_pToolbarWidget->pDeleteButton = NULL; - } - - if (g_pToolbarWidget->pDeleteCancelButton) { - evas_object_del(g_pToolbarWidget->pDeleteCancelButton); - g_pToolbarWidget->pDeleteCancelButton = NULL; - } - g_pToolbarWidget->nFooterListTabType = FOOTER_TAB_TYPE_PERSONAL; g_pToolbarWidget->pNaviFrameItem = NULL; + g_pToolbarWidget->pNaviFrameHandle = NULL; memset((void *) &g_pToolbarWidget->ToolbarCbFunc, 0, sizeof(st_RegisteCbFunc)); - - free(g_pToolbarWidget); - g_pToolbarWidget = NULL; } } @@ -184,53 +141,9 @@ void mp_ft_ctrl_more_popup_dismissed_cb(void *pUserData, * @param pCtxPopup * @param pTargetObject */ -void mp_ft_ctrl_move_more_popup(Evas_Object * pCtxPopup, - Evas_Object * pTargetObject) +void mp_ft_ctrl_move_more_popup(Evas_Object * pCtxPopup) { - Evas_Coord_Rectangle rect = { 0, }; - int nRotate = elm_win_rotation_get(mp_util_get_main_window_handle()); - - elm_win_screen_size_get(mp_util_get_main_window_handle(), &rect.x, - &rect.y, &rect.w, &rect.h); - - VideoLogInfo("nRotate : [%d], rect.w : [%d], rect.h : [%d]", nRotate, - rect.w, rect.h); - - int nW = 0; - int nH = 0; - - switch (nRotate) { - case 0: - case 180: - { - nW = rect.w / 2; - nH = rect.h; - } - break; - - case 90: - { - nW = rect.h / 2; - nH = rect.w; - } - break; - - case 270: - { - nW = rect.h / 2; - nH = rect.w; - } - break; - - default: - { - VideoLogError("not handled nRotate : [%d]!!!", nRotate); - } - break; - } - - evas_object_move(g_pToolbarWidget->pMoreCtxPopup, nW, nH); - + evas_object_move(g_pToolbarWidget->pMoreCtxPopup, 1280, 64); } /** @@ -256,8 +169,7 @@ static void __mp_ft_ctrl_more_popup_del_cb(void *data, Evas * e, * @param pUserData * @param pTargetObject */ -void mp_ft_ctrl_create_more_btn_of_personal(void *pUserData, - Evas_Object * pTargetObject) +void mp_ft_ctrl_create_more_btn_of_personal(void *pUserData, Evas_Object * pTargetObject) { VideoLogInfo(""); @@ -295,17 +207,6 @@ void mp_ft_ctrl_create_more_btn_of_personal(void *pUserData, mp_ft_ctrl_more_popup_dismissed_cb, NULL); - if (nVideoListSize > 0 && g_pToolbarWidget->ToolbarCbFunc.SearchCb) { - item = - elm_ctxpopup_item_append(g_pToolbarWidget->pMoreCtxPopup, - VIDEOS_CTXPOP_MENU_SEARCH_IDS, NULL, - g_pToolbarWidget-> - ToolbarCbFunc.SearchCb, - (void *) FOOTER_TAB_TYPE_PERSONAL); - elm_object_item_domain_text_translatable_set(item, VIDEOS_STRING, - EINA_TRUE); - nItemCount++; - } if (nVideoListSize > 0 && g_pToolbarWidget->ToolbarCbFunc.DeleteCb) { item = elm_ctxpopup_item_append(g_pToolbarWidget->pMoreCtxPopup, @@ -313,8 +214,8 @@ void mp_ft_ctrl_create_more_btn_of_personal(void *pUserData, g_pToolbarWidget-> ToolbarCbFunc.DeleteCb, (void *) FOOTER_TAB_TYPE_PERSONAL); - elm_object_item_domain_text_translatable_set(item, VIDEOS_STRING, - EINA_TRUE); + elm_object_item_domain_text_translatable_set(item, VIDEOS_STRING, EINA_TRUE); + elm_object_item_style_set(item, "more/default"); nItemCount++; } if (g_pToolbarWidget->ToolbarCbFunc.ShareViaCb) { @@ -323,19 +224,8 @@ void mp_ft_ctrl_create_more_btn_of_personal(void *pUserData, VIDEOS_CTXPOP_MENU_SHARE_IDS, NULL, g_pToolbarWidget-> ToolbarCbFunc.ShareViaCb, NULL); - elm_object_item_domain_text_translatable_set(item, VIDEOS_STRING, - EINA_TRUE); - nItemCount++; - } - if (nVideoListSize > 0 && g_pToolbarWidget->ToolbarCbFunc.ViewAsCb) { - item = - elm_ctxpopup_item_append(g_pToolbarWidget->pMoreCtxPopup, - VIDEOS_CTXPOP_MENU_VIEW_AS_IDS, NULL, - g_pToolbarWidget-> - ToolbarCbFunc.ViewAsCb, - (void *) FOOTER_TAB_TYPE_PERSONAL); - elm_object_item_domain_text_translatable_set(item, VIDEOS_STRING, - EINA_TRUE); + elm_object_item_domain_text_translatable_set(item, VIDEOS_STRING, EINA_TRUE); + elm_object_item_style_set(item, "more/default"); nItemCount++; } if (nVideoListSize > 0 && g_pToolbarWidget->ToolbarCbFunc.SortItemCb) { @@ -345,8 +235,8 @@ void mp_ft_ctrl_create_more_btn_of_personal(void *pUserData, g_pToolbarWidget-> ToolbarCbFunc.SortItemCb, (void *) FOOTER_TAB_TYPE_PERSONAL); - elm_object_item_domain_text_translatable_set(item, VIDEOS_STRING, - EINA_TRUE); + elm_object_item_domain_text_translatable_set(item, VIDEOS_STRING, EINA_TRUE); + elm_object_item_style_set(item, "more/default"); nItemCount++; } if (nVideoListSize > 0 && g_pToolbarWidget->ToolbarCbFunc.AutoPlayCb) { @@ -357,8 +247,8 @@ void mp_ft_ctrl_create_more_btn_of_personal(void *pUserData, g_pToolbarWidget-> ToolbarCbFunc.AutoPlayCb, (void *) FOOTER_TAB_TYPE_PERSONAL); - elm_object_item_domain_text_translatable_set(item, VIDEOS_STRING, - EINA_TRUE); + elm_object_item_domain_text_translatable_set(item, VIDEOS_STRING, EINA_TRUE); + elm_object_item_style_set(item, "more/default"); nItemCount++; } @@ -369,28 +259,17 @@ void mp_ft_ctrl_create_more_btn_of_personal(void *pUserData, g_pToolbarWidget-> ToolbarCbFunc.RenameCb, (void *) FOOTER_TAB_TYPE_PERSONAL); - elm_object_item_domain_text_translatable_set(item, VIDEOS_STRING, - EINA_TRUE); - nItemCount++; - } - if (nVideoListSize > 0 && g_pToolbarWidget->ToolbarCbFunc.DetailsCb) { - item = - elm_ctxpopup_item_append(g_pToolbarWidget->pMoreCtxPopup, - VIDEOS_CTXPOP_MENU_DETAILS_IDS, NULL, - g_pToolbarWidget-> - ToolbarCbFunc.DetailsCb, - (void *) FOOTER_TAB_TYPE_PERSONAL); - elm_object_item_domain_text_translatable_set(item, VIDEOS_STRING, - EINA_TRUE); + elm_object_item_domain_text_translatable_set(item, VIDEOS_STRING, EINA_TRUE); + elm_object_item_style_set(item, "more/default"); nItemCount++; } if (nItemCount > 0) { - mp_ft_ctrl_move_more_popup(g_pToolbarWidget->pMoreCtxPopup, - pTargetObject); + elm_ctxpopup_direction_priority_set(g_pToolbarWidget->pMoreCtxPopup, ELM_CTXPOPUP_DIRECTION_UP, ELM_CTXPOPUP_DIRECTION_UNKNOWN, ELM_CTXPOPUP_DIRECTION_UNKNOWN, ELM_CTXPOPUP_DIRECTION_UNKNOWN); + mp_ft_ctrl_move_more_popup(g_pToolbarWidget->pMoreCtxPopup); evas_object_show(g_pToolbarWidget->pMoreCtxPopup); } else { - mp_ft_ctrl_free_toolbar_btn(); + mp_ft_ctrl_reset_toolbar_btn(); } } @@ -433,101 +312,6 @@ void mp_ft_ctrl_more_btn_cb(void *pUserData, Evas_Object * pObject, /** * - * @param pUserData - * @param pToolbarCenterButtonCb - */ -void mp_ft_ctrl_create_center_button(void *pUserData, - void *pToolbarCenterButtonCb) -{ - if (!g_pToolbarWidget) { - VideoLogError("g_pToolbarWidget is NULL."); - return; - } - - if (g_pToolbarWidget->pViewButton) { - evas_object_del(g_pToolbarWidget->pViewButton); - g_pToolbarWidget->pViewButton = NULL; - } - - g_pToolbarWidget->pViewButton = - mp_ft_ctrl_create_toolbar_btn(g_pToolbarWidget->pNaviFrameHandle, - MP_VPL_LIST_TAB_VIEW, - pToolbarCenterButtonCb, pUserData); - elm_object_item_part_content_set(g_pToolbarWidget->pNaviFrameItem, - "toolbar_button1", - g_pToolbarWidget->pViewButton); -} - -/** - * - * @param pParent - * @param pToolbarCenterButtonCb - */ -void mp_ft_ctrl_create_center_toolbar(void *pParent, - void *pToolbarCenterButtonCb) -{ - if (!g_pToolbarWidget || !pParent) { - VideoLogError("g_pToolbarWidget or pParent is NULL."); - return; - } - - Evas_Object *toolbar = elm_toolbar_add(pParent); - if (!toolbar) - return; - elm_object_style_set(toolbar, "default"); - elm_toolbar_shrink_mode_set(toolbar, ELM_TOOLBAR_SHRINK_EXPAND); - elm_toolbar_transverse_expanded_set(toolbar, EINA_TRUE); - elm_toolbar_select_mode_set(toolbar, ELM_OBJECT_SELECT_MODE_NONE); - elm_toolbar_item_append(toolbar, NULL, MP_VPL_LIST_TAB_VIEW, - pToolbarCenterButtonCb, NULL); - - if (g_pToolbarWidget->pNaviFrameItem) { - elm_object_item_part_content_set(g_pToolbarWidget->pNaviFrameItem, - "toolbar", toolbar); - } -} - -/** - * - */ -void mp_ft_ctrl_delete_center_toolbar() -{ - - Evas_Object *toolbar = NULL; - if (!g_pToolbarWidget) - return; - - if (g_pToolbarWidget->pNaviFrameItem) { - toolbar = - elm_object_item_part_content_unset - (g_pToolbarWidget->pNaviFrameItem, "toolbar"); - MP_DEL_OBJ(toolbar); - } -} - -/** - * - */ -void mp_ft_ctrl_delete_center_button(void) -{ - if (!g_pToolbarWidget) { - VideoLogError("g_pToolbarWidget is NULL."); - return; - } - - if (g_pToolbarWidget->pNaviFrameItem) { - elm_object_item_part_content_unset - (g_pToolbarWidget->pNaviFrameItem, "toolbar_button1"); - } - - if (g_pToolbarWidget->pViewButton) { - evas_object_del(g_pToolbarWidget->pViewButton); - g_pToolbarWidget->pViewButton = NULL; - } -} - -/** - * */ void mp_ft_ctrl_disable(void) { @@ -535,16 +319,7 @@ void mp_ft_ctrl_disable(void) VideoLogError("g_pToolbarWidget is NULL."); return; } - - if (g_pToolbarWidget->pNaviFrameItem) { - elm_object_item_part_content_unset - (g_pToolbarWidget->pNaviFrameItem, "toolbar_more_btn"); - } - - if (g_pToolbarWidget->pMoreToolbarButton) { - evas_object_del(g_pToolbarWidget->pMoreToolbarButton); - g_pToolbarWidget->pMoreToolbarButton = NULL; - } + evas_object_smart_callback_del(g_pToolbarWidget->pMoreToolbarButton, "clicked", mp_ft_ctrl_more_btn_cb); } /** @@ -632,7 +407,7 @@ void mp_ft_ctrl_registe_cb_func(st_RegisteCbFunc * pCallbackFunc) * @param nFooterListTabType * @param pRegisteCbFunc */ -void mp_ft_ctrl_create(void *pNaviFrameHandle, void *pNaviFrameItem, +void mp_ft_ctrl_create(void *pNaviFrameHandle, void *pNaviFrameItem, void *more_button, MpFooterLibraryMainListTabType nFooterListTabType, st_RegisteCbFunc * pRegisteCbFunc) { @@ -641,7 +416,7 @@ void mp_ft_ctrl_create(void *pNaviFrameHandle, void *pNaviFrameItem, return; } - mp_ft_ctrl_free_toolbar_btn(); + mp_ft_ctrl_reset_toolbar_btn(); g_pToolbarWidget = (st_ToolbarWidget *) calloc(1, sizeof(st_ToolbarWidget)); @@ -654,13 +429,11 @@ void mp_ft_ctrl_create(void *pNaviFrameHandle, void *pNaviFrameItem, if (pRegisteCbFunc) { mp_ft_ctrl_registe_cb_func(pRegisteCbFunc); } - - g_pToolbarWidget->pMoreToolbarButton = - mp_ft_ctrl_create_more_style_btn - (g_pToolbarWidget->pNaviFrameHandle, mp_ft_ctrl_more_btn_cb, NULL); - elm_object_item_part_content_set(g_pToolbarWidget->pNaviFrameItem, - "toolbar_more_btn", - g_pToolbarWidget->pMoreToolbarButton); + if(more_button) + { + g_pToolbarWidget->pMoreToolbarButton = more_button; + evas_object_smart_callback_add(g_pToolbarWidget->pMoreToolbarButton, "clicked", mp_ft_ctrl_more_btn_cb, NULL); + } } /** @@ -668,7 +441,9 @@ void mp_ft_ctrl_create(void *pNaviFrameHandle, void *pNaviFrameItem, */ void mp_ft_ctrl_destroy(void) { - mp_ft_ctrl_free_toolbar_btn(); + mp_ft_ctrl_reset_toolbar_btn(); + free(g_pToolbarWidget); + g_pToolbarWidget = NULL; } /** @@ -723,7 +498,7 @@ void mp_ft_ctrl_rotate_update() VideoLogInfo(""); if (g_pToolbarWidget != NULL && g_pToolbarWidget->pMoreCtxPopup != NULL) { - mp_ft_ctrl_move_more_popup(g_pToolbarWidget->pMoreCtxPopup, NULL); + mp_ft_ctrl_move_more_popup(g_pToolbarWidget->pMoreCtxPopup); evas_object_show(g_pToolbarWidget->pMoreCtxPopup); } } |