From 95274c3cdd201294c5b7f7de7c89cd26fcc4171f Mon Sep 17 00:00:00 2001 From: Amritanshu Date: Wed, 23 Sep 2020 17:19:09 +0530 Subject: [PATCH] [TIZENIOT-1995]Makes the popup bg disappear, [TIZENIOT-1996]Makes popup not disappear on back button press Change-Id: I48ef7f3f70ecbacda13a88a73b0ba27e934d76d8 Signed-off-by: Amritanshu --- src/interaction.c | 21 ++++++----- src/local-recovery-ui.c | 78 ++++++++++++++++------------------------- tizen-manifest.xml | 2 +- 3 files changed, 43 insertions(+), 58 deletions(-) diff --git a/src/interaction.c b/src/interaction.c index a61a428..0388468 100755 --- a/src/interaction.c +++ b/src/interaction.c @@ -21,21 +21,16 @@ static char path[PATH_MAX]; static void _popup_block_clicked_cb(void *data, Evas_Object *obj, void *event_info) { - //elm_popup_dismiss(obj); - evas_object_del(obj); } static void _popup_hide_cb(void *data, Evas_Object *obj, void *event_info) { - //elm_popup_dismiss(obj); - evas_object_del(obj); } static void _popup_hide_finished_cb(void *data, Evas_Object *obj, void *event_info) { - evas_object_del(obj); } static void @@ -70,7 +65,8 @@ void recovery_failed_show_popup(Evas_Object *nf, int error) LOGI("Inside fota_show_result_popup"); char title[PATH_MAX], text[PATH_MAX]; Evas_Object *popup = elm_popup_add(nf); - elm_popup_align_set(popup, ELM_NOTIFY_ALIGN_FILL, 1.0); + elm_object_style_set(popup, "transparent"); + elm_popup_align_set(popup, ELM_NOTIFY_ALIGN_FILL, 0.5); evas_object_size_hint_weight_set(popup, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); snprintf(title, sizeof(title), "%s Failed",RECOVERY_TITLE); @@ -123,21 +119,26 @@ _local_recovery_device_reboot_cb(void *data, Evas_Object *obj, void *event_info) { LOGI("Inside _local_recovery_device_reboot_cb"); Evas_Object *nf = data; + Evas_Object *prev_popup = evas_object_data_get(obj, "recovery-popup"); char title[PATH_MAX]; snprintf(title, sizeof(title), "Recovering. Don't turn off your device"); Evas_Object *popup = elm_popup_add(nf); - elm_popup_align_set(popup, ELM_NOTIFY_ALIGN_FILL, 1.0); + elm_object_style_set(popup, "transparent"); + elm_popup_align_set(popup, ELM_NOTIFY_ALIGN_FILL, 0.5); evas_object_size_hint_weight_set(popup, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); elm_object_part_text_set(popup, "title,text", title); eext_object_event_callback_add(popup, EEXT_CALLBACK_BACK, _popup_hide_cb, NULL); evas_object_smart_callback_add(popup, "dismissed", _popup_hide_finished_cb, NULL); evas_object_smart_callback_add(popup, "block,clicked", _popup_block_clicked_cb, NULL); - evas_object_show(popup); + if (prev_popup) { + evas_object_del(prev_popup); + } + /* Reboot device to start recovery */ int ret = device_power_reboot("recovery"); LOGI("device_power_reboot API return : %d", ret); @@ -155,7 +156,8 @@ void recovery_show_popup(Evas_Object *nf, char *title, char *image_path) snprintf(path, sizeof(path), "%s", image_path); Evas_Object *popup = elm_popup_add(nf); - elm_popup_align_set(popup, ELM_NOTIFY_ALIGN_FILL, 1.0); + elm_object_style_set(popup, "transparent"); + elm_popup_align_set(popup, ELM_NOTIFY_ALIGN_FILL, 0.5); evas_object_size_hint_weight_set(popup, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); elm_object_part_text_set(popup, "title,text", title); elm_object_text_set(popup,buf); @@ -176,6 +178,7 @@ void recovery_show_popup(Evas_Object *nf, char *title, char *image_path) //elm_object_style_set(btn2, "popup"); elm_object_text_set(btn2, "Recover"); elm_object_part_content_set(popup, "button2", btn2); + evas_object_data_set(btn2, "recovery-popup", popup); evas_object_smart_callback_add(btn2, "clicked", _local_recovery_device_reboot_cb, nf); evas_object_show(popup); diff --git a/src/local-recovery-ui.c b/src/local-recovery-ui.c index 1b84b89..cf777b6 100755 --- a/src/local-recovery-ui.c +++ b/src/local-recovery-ui.c @@ -33,54 +33,36 @@ win_back_cb(void *data, Evas_Object *obj, void *event_info) static void create_base_gui(appdata_s *ad) { - ad->win = elm_win_util_standard_add(PACKAGE, PACKAGE); - elm_win_autodel_set(ad->win, EINA_TRUE); - - if (elm_win_wm_rotation_supported_get(ad->win)) { - int rots[4] = {0, 90, 180, 270}; - elm_win_wm_rotation_available_rotations_set(ad->win, (const int *)(&rots), 4); - } - - evas_object_smart_callback_add(ad->win, "delete,request", win_delete_request_cb, NULL); - eext_object_event_callback_add(ad->win, EEXT_CALLBACK_BACK, win_back_cb, ad); - - /* Conformant */ - /* Create and initialize elm_conformant, - which is mandatory for the base UI to have a proper size - when an indicator or virtual keypad is visible - */ - ad->conform = elm_conformant_add(ad->win); - elm_win_indicator_mode_set(ad->win, ELM_WIN_INDICATOR_HIDE); - evas_object_size_hint_weight_set(ad->conform, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); - elm_win_resize_object_add(ad->win, ad->conform); - evas_object_show(ad->conform); - - /* Naviframe */ - ad->nf = elm_naviframe_add(ad->conform); - evas_object_show(ad->nf); - // elm_naviframe_prev_btn_auto_pushed_set(ad->nf, EINA_TRUE); - elm_object_content_set(ad->conform, ad->nf); - - Evas_Object *bg; - char buf[PATH_MAX]; - char *res_path = app_get_resource_path(); - snprintf(buf, sizeof(buf), "%simages/LocalRecovery_BG.png", res_path); - LOGI("Bg Image path : %s", buf); - if(res_path) free(res_path); - - bg = elm_bg_add(ad->nf); - elm_bg_option_set(bg, ELM_BG_OPTION_CENTER); - elm_bg_file_set(bg, buf, NULL); - Elm_Object_Item *nf_it = elm_naviframe_item_push(ad->nf, NULL, NULL, NULL, bg, "tabbar/notitle"); - //elm_naviframe_item_pop_cb_set(nf_it, naviframe_pop_cb, ad->nf); - - Evas_Object * toolbar = elm_bg_add(ad->nf); - toolbar = elm_bg_add(ad->nf); - elm_bg_option_set(toolbar, ELM_BG_OPTION_STRETCH); - elm_bg_file_set(toolbar, buf, NULL); - elm_object_item_part_content_set(nf_it, "tabbar", toolbar); - - evas_object_show(ad->win); + ad->win = elm_win_add(NULL, PACKAGE, ELM_WIN_BASIC); + elm_win_autodel_set(ad->win, EINA_TRUE); + elm_win_alpha_set(ad->win, EINA_TRUE); + + if (elm_win_wm_rotation_supported_get(ad->win)) { + int rots[4] = {0, 90, 180, 270}; + elm_win_wm_rotation_available_rotations_set(ad->win, (const int *)(&rots), 4); + } + + evas_object_smart_callback_add(ad->win, "delete,request", win_delete_request_cb, NULL); + eext_object_event_callback_add(ad->win, EEXT_CALLBACK_BACK, win_back_cb, ad); + + /* Conformant */ + /* Create and initialize elm_conformant, + which is mandatory for the base UI to have a proper size + when an indicator or virtual keypad is visible + */ + ad->conform = elm_conformant_add(ad->win); + elm_win_indicator_mode_set(ad->win, ELM_WIN_INDICATOR_HIDE); + evas_object_size_hint_weight_set(ad->conform, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); + elm_win_resize_object_add(ad->win, ad->conform); + evas_object_show(ad->conform); + + /* Naviframe */ + ad->nf = elm_naviframe_add(ad->conform); + evas_object_show(ad->nf); + // elm_naviframe_prev_btn_auto_pushed_set(ad->nf, EINA_TRUE); + elm_object_content_set(ad->conform, ad->nf); + + evas_object_show(ad->win); } static bool diff --git a/tizen-manifest.xml b/tizen-manifest.xml index 1ba45ed..dcb9819 100755 --- a/tizen-manifest.xml +++ b/tizen-manifest.xml @@ -1,7 +1,7 @@ - + -- 2.34.1