From: nazib.ullah Date: Thu, 22 Dec 2016 10:29:30 +0000 (+0600) Subject: [TBT][tizen_3.0_mobile][ui-viewmgrtest app updated, instruction for ui-vewmgr menu... X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=refs%2Fchanges%2F69%2F106669%2F1;p=test%2Ftct%2Fnative%2Fbehavior.git [TBT][tizen_3.0_mobile][ui-viewmgrtest app updated, instruction for ui-vewmgr menu and push test moudle updated] Change-Id: I690c361be2bac2bddd70b8244c6ef643d86764e0 Signed-off-by: nazib.ullah --- diff --git a/tbt_ui_viewmgr/.sdk_delta.info b/tbt_ui_viewmgr/.sdk_delta.info index 513834e..175c80c 100644 Binary files a/tbt_ui_viewmgr/.sdk_delta.info and b/tbt_ui_viewmgr/.sdk_delta.info differ diff --git a/tbt_ui_viewmgr/src/view1.c b/tbt_ui_viewmgr/src/view1.c index dfcc9bc..fb6ff4e 100644 --- a/tbt_ui_viewmgr/src/view1.c +++ b/tbt_ui_viewmgr/src/view1.c @@ -1,5 +1,10 @@ #include "tbt_ui_viewmgr.h" static Eo *content = NULL; +static bool is_change_ctxpopup; +static char* get_viewmgr_error(ui_viewmgr_error_e err); +Evas_Object* label; +Elm_Layout *layout; + static bool view1_back(ui_view *view, void *user_data) { @@ -11,12 +16,51 @@ view1_back(ui_view *view, void *user_data) static void ctxpopup_item_select_cb(void *data, Eo *obj, void *event_info) { + ui_view* view = (ui_view*)data; + ui_menu *menu = ui_view_get_menu(view); + ui_view* menu_view = ui_menu_get_view(menu); Elm_Object_Item *it = (Elm_Object_Item *) event_info; DBG("Item (%s) is selected", elm_object_item_text_get(it)); char str[256]; snprintf(str,256,"%s",elm_object_item_text_get(it)); - elm_object_text_set(content,str); + elm_object_text_set(layout,str); + int ret = ui_menu_deactivate(menu); + RETM_IF(ret != UI_VIEWMGR_ERROR_NONE, "ui_menu_deactivate error %s", get_viewmgr_error(ret)); elm_ctxpopup_dismiss(obj); + +} + +static Elm_Ctxpopup* create_ctx_popup(Eo *base, void* data) +{ + ui_view* view = (ui_view*)data; + Elm_Ctxpopup *ctxpopup = NULL; + ctxpopup = elm_ctxpopup_add(base); + if (!ctxpopup) + { + DBG("failed to create a ctxpopup."); + return false; + } + + if(!is_change_ctxpopup) + { + elm_ctxpopup_item_append(ctxpopup, "Phone calls", NULL, ctxpopup_item_select_cb, view); + elm_ctxpopup_item_append(ctxpopup, "Favorites", NULL, ctxpopup_item_select_cb, view); + elm_ctxpopup_item_append(ctxpopup, "Search", NULL, ctxpopup_item_select_cb, view); + elm_ctxpopup_item_append(ctxpopup, "Dialer", NULL, ctxpopup_item_select_cb, view); + elm_ctxpopup_item_append(ctxpopup, "Add contact", NULL, ctxpopup_item_select_cb, view); + elm_ctxpopup_item_append(ctxpopup, "Phone calls", NULL, ctxpopup_item_select_cb, view); + elm_ctxpopup_item_append(ctxpopup, "Favorites", NULL, ctxpopup_item_select_cb, view); + elm_ctxpopup_item_append(ctxpopup, "Search", NULL, ctxpopup_item_select_cb, view); + elm_ctxpopup_item_append(ctxpopup, "Dialer", NULL, ctxpopup_item_select_cb, view); + } + else + { + elm_ctxpopup_item_append(ctxpopup, "Chnaged Item 1", NULL, ctxpopup_item_select_cb, view); + elm_ctxpopup_item_append(ctxpopup, "Chnaged Item 2", NULL, ctxpopup_item_select_cb, view); + elm_ctxpopup_item_append(ctxpopup, "Chnaged Item 3", NULL, ctxpopup_item_select_cb, view); + } + + return ctxpopup; } static bool @@ -29,6 +73,7 @@ view1_menu(ui_view *view, void *user_data) Elm_Ctxpopup *ctxpopup = NULL; ui_menu *menu = ui_view_get_menu(view); + //Get a base object from menu. base = ui_menu_get_base(menu); if (!base) { @@ -36,22 +81,14 @@ view1_menu(ui_view *view, void *user_data) return false; } -//Create and set a ctxpopup as a menu. - ctxpopup = elm_ctxpopup_add(base); - if (!ctxpopup) { - DBG("failed to create a ctxpopup."); - return false; - } + ctxpopup = create_ctx_popup(base, view); - elm_ctxpopup_item_append(ctxpopup, "Phone calls", NULL, ctxpopup_item_select_cb, NULL); - elm_ctxpopup_item_append(ctxpopup, "Favorites", NULL, ctxpopup_item_select_cb, NULL); - elm_ctxpopup_item_append(ctxpopup, "Search", NULL, ctxpopup_item_select_cb, NULL); - elm_ctxpopup_item_append(ctxpopup, "Dialer", NULL, ctxpopup_item_select_cb, NULL); - elm_ctxpopup_item_append(ctxpopup, "Add contact", NULL, ctxpopup_item_select_cb, NULL); - elm_ctxpopup_item_append(ctxpopup, "Phone calls", NULL, ctxpopup_item_select_cb, NULL); - elm_ctxpopup_item_append(ctxpopup, "Favorites", NULL, ctxpopup_item_select_cb, NULL); - elm_ctxpopup_item_append(ctxpopup, "Search", NULL, ctxpopup_item_select_cb, NULL); - elm_ctxpopup_item_append(ctxpopup, "Dialer", NULL, ctxpopup_item_select_cb, NULL); + Elm_Ctxpopup* exist_ctxpopup = ui_menu_get_content(menu); + if(exist_ctxpopup) + { + Elm_Ctxpopup *ctx = ui_menu_unset_content(menu); + RETVM_IF(NULL==ctx, false, "ui_menu_unset_content return NULL") + } ret = ui_menu_set_content(menu, ctxpopup); if (ret != UI_VIEWMGR_ERROR_NONE) @@ -68,16 +105,24 @@ static bool view1_rotate(ui_view *view, void *user_data) { /* Page is rotated. */ + ui_menu *menu = ui_view_get_menu(view); + int rotation; if (ui_view_get_orientation_mode(view) == UI_VIEW_ORIENTATION_MODE_PORTRAIT) { /* Portrait mode. */ + rotation = ui_menu_get_degree(menu); } else { /* Landscape mode. */ + rotation = ui_menu_get_degree(menu); } + DBG("rotation %d", rotation); + char str[256]; + snprintf(str, 256, "Rotation: %d",rotation); + elm_object_text_set(label, str); return true; } @@ -97,25 +142,109 @@ view1_unload(ui_view *view, void *user_data) return true; } +static void +prev_btn_clicked_cb(void *data, Eo *obj, void *event_info) +{ + int ret; + DBG("prev_btn_clicked_cb"); + ui_view* view = (ui_view*) data; + ui_menu *menu = ui_view_get_menu(view); + if(!ui_menu_get_activated(menu)) + { + ret = ui_menu_activate(menu); + RETM_IF(ret != UI_VIEWMGR_ERROR_NONE, "ui_menu_activate err %s", get_viewmgr_error(ret)); + } +} + +static void +next_btn_clicked_cb(void *data, Eo *obj, void *event_info) +{ + DBG("next_btn_clicked_cb"); + + is_change_ctxpopup ^= 1; +} + +Eo* +create_content(ui_view* view, const char *text, Evas_Smart_Cb prev_btn_clicked_cb, Evas_Smart_Cb next_btn_clicked_cb) +{ + Elm_Grid *grid; + Elm_Box *box; + Elm_Scroller *scroller; + Elm_Button *btn; + + Eo *parent = NULL; + //Get a base object from view. + parent = ui_view_get_base(view); + + /* Scroller */ + scroller = elm_scroller_add(parent); + elm_scroller_bounce_set(scroller, EINA_FALSE, EINA_TRUE); + elm_scroller_policy_set(scroller, ELM_SCROLLER_POLICY_OFF, ELM_SCROLLER_POLICY_AUTO); + + /* Grid */ + grid = elm_grid_add(scroller); + evas_object_size_hint_weight_set(grid, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); + evas_object_size_hint_align_set(grid, EVAS_HINT_FILL, EVAS_HINT_FILL); + evas_object_show(grid); + + /* NoContent Layout */ + layout = elm_layout_add(grid); + elm_layout_theme_set(layout, "layout", "nocontents", "default"); + elm_object_part_text_set(layout, "elm.text", text); + evas_object_show(layout); + elm_grid_pack(grid, layout, 0, 0, 100, 100); + + label = elm_label_add(grid); + evas_object_size_hint_weight_set(label, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); + evas_object_size_hint_align_set(label, EVAS_HINT_FILL, 1.0); + elm_object_text_set(label, "Rotation"); + evas_object_show(label); + elm_grid_pack(grid, label, 0, 0, 100, 100); + + + /* Box */ + box = elm_box_add(grid); + elm_box_horizontal_set(box, EINA_TRUE); + evas_object_size_hint_weight_set(box, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); + evas_object_size_hint_align_set(box, EVAS_HINT_FILL, EVAS_HINT_FILL); + elm_box_padding_set(box, ELM_SCALE_SIZE(50), 0); + evas_object_show(box); + elm_grid_pack(grid, box, 0, 0, 100, 100); + + /* Previous Page Button */ + btn = elm_button_add(grid); + evas_object_size_hint_weight_set(btn, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); + evas_object_size_hint_align_set(btn, EVAS_HINT_FILL, 1.0); + elm_object_text_set(btn, "Show Menu"); + evas_object_smart_callback_add(btn, "clicked", prev_btn_clicked_cb, view); + evas_object_show(btn); + elm_box_pack_end(box, btn); + + /* Next Page Button */ + btn = elm_button_add(grid); + evas_object_size_hint_weight_set(btn, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); + evas_object_size_hint_align_set(btn, EVAS_HINT_FILL, 1.0); + elm_object_text_set(btn, "Toggle Menu"); + evas_object_smart_callback_add(btn, "clicked", next_btn_clicked_cb, view); + evas_object_show(btn); + elm_box_pack_end(box, btn); + + + + elm_object_content_set(scroller, grid); + + return scroller; +} + static bool view1_load(ui_view *view, void *user_data) { /* Hook to take necessary actions when page is loaded. Create page contents here. */ - - - Eo *base = NULL; int ret; - //Get a base object from view. - base = ui_view_get_base(view); - - //Create and set a main content. - content = elm_label_add(base); - if (!content) return false; - elm_object_text_set(content, "UI Viewmgr App"); - evas_object_size_hint_weight_set(content, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); + content = create_content(view, "ViewMgr Test", prev_btn_clicked_cb, next_btn_clicked_cb); //Set Main Content ret = ui_view_set_content(view, content); @@ -154,6 +283,7 @@ create_view1() view1_back }; + is_change_ctxpopup = false; //Create a view. view = ui_view_create("view1"); if (!view) @@ -183,3 +313,36 @@ create_view1() ui_view_destroy(view); } } + +static char* get_viewmgr_error(ui_viewmgr_error_e err) +{ + char* err_msg = NULL; + switch(err) + { + case UI_VIEWMGR_ERROR_NONE: + err_msg = "UI_VIEWMGR_ERROR_NONE"; + break; + case UI_VIEWMGR_ERROR_NOT_PERMITTED: + err_msg = "UI_VIEWMGR_ERROR_NOT_PERMITTED"; + break; + case UI_VIEWMGR_ERROR_OUT_OF_MEMORY: + err_msg = "UI_VIEWMGR_ERROR_OUT_OF_MEMORY"; + break; + case UI_VIEWMGR_ERROR_INVALID_PARAMETER: + err_msg = "UI_VIEWMGR_ERROR_INVALID_PARAMETER"; + break; + case UI_VIEWMGR_ERROR_RESULT_OUT_OF_RANGE: + err_msg = "UI_VIEWMGR_ERROR_RESULT_OUT_OF_RANGE"; + break; + case UI_VIEWMGR_ERROR_ALREADY_IN_PROGRESS: + err_msg = "UI_VIEWMGR_ERROR_ALREADY_IN_PROGRESS"; + break; + case UI_VIEWMGR_ERROR_UNKNOWN: + err_msg = "UI_VIEWMGR_ERROR_UNKNOWN"; + break; + default: + err_msg = "UNKNOWN"; + break; + } + return err_msg; +} diff --git a/tbtcoreapp/src/model/tbt-list.c b/tbtcoreapp/src/model/tbt-list.c index cbee885..7f3e725 100755 --- a/tbtcoreapp/src/model/tbt-list.c +++ b/tbtcoreapp/src/model/tbt-list.c @@ -1752,7 +1752,7 @@ static tbt_info tbtapps[] = .parent = "Push Service", .apptype = TBT_APP_PUSH_SERVICE, .icon_name = "dummy", - .info = "1. Make sure a) Internet is connected. b) kill app instance of tbt_pushtestapp from background and c) tbt_push_auth.xml file in /home//media/Others directory.
" + .info = "1. Make sure a) Internet is connected. b) fillup the \"tbt_push_auth.xml\" fileand c) push tbt_push_auth.xml file in /home//media/Others directory d) run tbt_pushtestapp e) kill app instance of tbt_pushtestapp from background
" "2. Press Start button to start the push service and a successful response will be displayed.
" "3. Press Normal button, a Normal push message will be shown in list.
" "4. Press Delay button and then press Normal button a Normal push message followed by a delay push message will be shown in list.
" @@ -2471,7 +2471,10 @@ static tbt_info tbtapps[] = .info = "1. Press Run Launch UI Viewmgr button, UI viewmgr app will be opened.
" "2. After ui viewmgr app opened press H/W Menu button, then a popup Menu will be shown.
" "3. Select each list item and corresponding text will be shown in ui viewmgr app.
" + "4. Press Toggle Menu button then press H/W menu button, menu will changed.
" + "5. Press Show Menu button then Menu will be shown.
" "4. Press back button to exit from ui viewmgr app.
" + "5. Press H/W menu button to launch menu again, then rotate device, rotation angle will be shown in label at top.
" "5. If everything works as above then Pass, Otherwise Fail. ", .result = 0, .required_features_count = 0,