From: Michal Skorupinski Date: Mon, 25 May 2020 16:30:38 +0000 (+0200) Subject: [OAPSAN-5017] Button style changed in the running apps view X-Git-Tag: submit/tizen/20200528.023732~2^2 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=f9bdd5d49148b3f9753531617606836c5d217aba;p=profile%2Fcommon%2Fapps%2Fnative%2Fsettings.git [OAPSAN-5017] Button style changed in the running apps view Change-Id: I2c24ff63bd2fba9c0035971e87255ec52a232fc9 Signed-off-by: Michal Skorupinski --- diff --git a/setting-appmgr/include/setting-appmgr-utils.h b/setting-appmgr/include/setting-appmgr-utils.h index 2c79e43..518e8f5 100644 --- a/setting-appmgr/include/setting-appmgr-utils.h +++ b/setting-appmgr/include/setting-appmgr-utils.h @@ -64,4 +64,8 @@ bool appmgr_utils_SD_card_in_internal_mode(bool *in_internal_mode); */ bool appmgr_utils_get_pkg_storage_type(const char *pkg_id, bool *internal); +Evas_Object *add_no_bg_button(Evas_Object *parent_box, char *txt, void *cb_data, Evas_Smart_Cb btn_click_cb, Eina_Bool disabled); +void add_spacer(Evas_Object *parent_box); +void no_bg_button_set_disabled(Evas_Object *button, char *text, Eina_Bool disabled); + #endif /*__SETTING_APPMGR_UTILS_H__ */ diff --git a/setting-appmgr/src/setting-appmgr-pkginfo.c b/setting-appmgr/src/setting-appmgr-pkginfo.c index 60779ec..e63fed5 100755 --- a/setting-appmgr/src/setting-appmgr-pkginfo.c +++ b/setting-appmgr/src/setting-appmgr-pkginfo.c @@ -28,9 +28,6 @@ #include "setting-appmgr-pkginfo-utils.h" #include "setting-appmgr-pkginfo.h" -#define CLOSE_UNINSTALL_BUTTON_FORMAT_ENABLED "%s" -#define CLOSE_UNINSTALL_BUTTON_FORMAT_DISABLED "%s" - setting_view setting_view_appmgr_pkginfo; typedef struct { @@ -942,44 +939,6 @@ static int __package_move_finished2(uid_t target_uid, int req_id, } /* Genlist item classes: */ - -static Evas_Object *_add_no_bg_button(Evas_Object *parent_box, char *txt, SettingAppMgr_PkgInfo *pkg, Evas_Smart_Cb btn_click_cb) -{ - /* Force close button */ - char buf[1024]; - snprintf(buf, 1024, CLOSE_UNINSTALL_BUTTON_FORMAT_DISABLED, txt); - Evas_Object *button = setting_create_button(parent_box, buf, "textbutton", btn_click_cb, pkg); - evas_object_size_hint_min_set(button, 179, 50); - evas_object_size_hint_max_set(button, 179, 50); - elm_object_text_set(button, buf); - elm_box_pack_end(parent_box, button); - return button; -} - -static void _add_spacer(Evas_Object *parent_box) -{ - Evas_Object *spacer = evas_object_rectangle_add(evas_object_evas_get(parent_box)); - evas_object_color_set(spacer, 255, 0, 0, 255); - evas_object_size_hint_min_set(spacer, 1280 - 40 * 2 - 29 - 179 * 2, 50); // screen width - margins - distance between buttons - button width - elm_box_pack_end(parent_box, spacer); -} - -static void _no_bg_button_set_disabled(Evas_Object *button, char *text, Eina_Bool disabled) -{ - elm_object_disabled_set(button, disabled); - SETTING_TRACE_WARNING("TEXT: %s", text); - - char buf[1024]; - if (disabled) { - snprintf(buf, 1024, CLOSE_UNINSTALL_BUTTON_FORMAT_DISABLED, text); - } else { - snprintf(buf, 1024, CLOSE_UNINSTALL_BUTTON_FORMAT_ENABLED, text); - } - - SETTING_TRACE_WARNING("BUTTON: %s", buf); - elm_object_text_set(button, buf); -} - Evas_Object *pkginfo_force_close_dis_uninst_content_get( void *data, Evas_Object *genlist, const char *part) { @@ -987,7 +946,6 @@ Evas_Object *pkginfo_force_close_dis_uninst_content_get( SettingAppMgr_PkgInfo *pkg = NULL; int h = 0; Evas_Object *box = NULL; - char buf[1024] = {0,}; setting_retvm_if(ad == NULL, NULL, "Data parameter is NULL"); pkg = &ad->selected_pkg; @@ -998,9 +956,9 @@ Evas_Object *pkginfo_force_close_dis_uninst_content_get( elm_box_horizontal_set(box, EINA_TRUE); elm_box_padding_set(box, 0, 0); - _add_spacer(box); - ad->force_close_button = _add_no_bg_button(box, _("Force close"), pkg, _force_close_cb); - ad->uninstall_button = _add_no_bg_button(box, _("IDS_ST_BUTTON_DISABLE_ABB"), pkg, NULL); + add_spacer(box); + ad->force_close_button = add_no_bg_button(box, _("Force close"), pkg, _force_close_cb, EINA_FALSE); + ad->uninstall_button = add_no_bg_button(box, _("IDS_ST_BUTTON_DISABLE_ABB"), pkg, NULL, EINA_FALSE); _setup_force_close_uninstall_buttons(ad); @@ -1076,23 +1034,23 @@ static void _setup_force_close_uninstall_buttons(SettingAppMgr *ad) } } - _no_bg_button_set_disabled(ad->force_close_button, _("Force close"), !running_flag); + no_bg_button_set_disabled(ad->force_close_button, _("Force close"), !running_flag); if (pkg->is_disable_supported) { if (pkg->is_disabled) { evas_object_smart_callback_add(ad->uninstall_button, "clicked", _enable_cb, pkg); - _no_bg_button_set_disabled(ad->uninstall_button, _("IDS_ST_BUTTON_ENABLE_ABB3"), EINA_FALSE); + no_bg_button_set_disabled(ad->uninstall_button, _("IDS_ST_BUTTON_ENABLE_ABB3"), EINA_FALSE); } else { evas_object_smart_callback_add(ad->uninstall_button, "clicked", _disable_cb, pkg); - _no_bg_button_set_disabled(ad->uninstall_button, _("IDS_ST_BUTTON_DISABLE_ABB"), EINA_FALSE); + no_bg_button_set_disabled(ad->uninstall_button, _("IDS_ST_BUTTON_DISABLE_ABB"), EINA_FALSE); } } else if (pkg->is_removable) { evas_object_smart_callback_add(ad->uninstall_button, "clicked", _uninstall_cb, ad); - _no_bg_button_set_disabled(ad->uninstall_button, _("IDS_ST_BUTTON_UNINSTALL"), EINA_FALSE); + no_bg_button_set_disabled(ad->uninstall_button, _("IDS_ST_BUTTON_UNINSTALL"), EINA_FALSE); } else { - _no_bg_button_set_disabled(ad->uninstall_button, _("IDS_ST_BUTTON_DISABLE_ABB"), EINA_TRUE); + no_bg_button_set_disabled(ad->uninstall_button, _("IDS_ST_BUTTON_DISABLE_ABB"), EINA_TRUE); } } diff --git a/setting-appmgr/src/setting-appmgr-runinfo.c b/setting-appmgr/src/setting-appmgr-runinfo.c index a2f1a64..557b873 100755 --- a/setting-appmgr/src/setting-appmgr-runinfo.c +++ b/setting-appmgr/src/setting-appmgr-runinfo.c @@ -24,7 +24,6 @@ #include #include - setting_view setting_view_appmgr_runinfo; typedef struct { @@ -401,12 +400,8 @@ Evas_Object *appmgr_run_gl_stop_btn_content_get(void *data, Evas_Object *obj, elm_box_align_set(box, 0.0, 0.5); elm_box_padding_set(box, 10, 0); - btn = setting_create_button(box, MGRAPP_STR_STOP, NULL, - appmgr_run_stop_click, ad); - evas_object_size_hint_expand_set(btn, EVAS_HINT_EXPAND, - EVAS_HINT_EXPAND); - - elm_box_pack_end(box, btn); + add_spacer(box); + btn = add_no_bg_button(box, _(MGRAPP_STR_STOP), ad, appmgr_run_stop_click, EINA_FALSE); /* Check if have running app */ EINA_LIST_FOREACH(ad->selected_running_app.apps_in_package, cur, @@ -458,7 +453,7 @@ Evas_Object *appmgr_run_gl_stop_btn_content_get(void *data, Evas_Object *obj, } if (!running_flag) { - elm_object_disabled_set(btn, EINA_TRUE); + no_bg_button_set_disabled(btn, _(MGRAPP_STR_STOP), EINA_TRUE); elm_object_disabled_set(obj, EINA_TRUE); } diff --git a/setting-appmgr/src/setting-appmgr-utils.c b/setting-appmgr/src/setting-appmgr-utils.c index 0a53b3a..31bd3ef 100755 --- a/setting-appmgr/src/setting-appmgr-utils.c +++ b/setting-appmgr/src/setting-appmgr-utils.c @@ -29,6 +29,11 @@ #include +#define CLOSE_UNINSTALL_BUTTON_FORMAT_ENABLED "%s" +#define CLOSE_UNINSTALL_BUTTON_FORMAT_DISABLED "%s" + + + void appmgr_size_to_str(int size, char *desc, int desc_size) { double tmp_size = 0.0; @@ -530,3 +535,38 @@ bool appmgr_utils_get_pkg_storage_type(const char *pkg_id, bool *internal) return true; } + +Evas_Object *add_no_bg_button(Evas_Object *parent_box, char *txt, void *cb_data, Evas_Smart_Cb btn_click_cb, Eina_Bool disabled) +{ + Evas_Object *button = setting_create_button(parent_box, txt, "textbutton", btn_click_cb, cb_data); + evas_object_size_hint_min_set(button, 179, 50); + evas_object_size_hint_max_set(button, 179, 50); + elm_box_pack_end(parent_box, button); + + no_bg_button_set_disabled(button, txt, disabled); + return button; +} + +void add_spacer(Evas_Object *parent_box) +{ + Evas_Object *spacer = evas_object_rectangle_add(evas_object_evas_get(parent_box)); + evas_object_color_set(spacer, 255, 0, 0, 255); + evas_object_size_hint_min_set(spacer, 1280 - 40 * 2 - 29 - 179 * 2, 50); // screen width - margins - distance between buttons - button width + elm_box_pack_end(parent_box, spacer); +} + +void no_bg_button_set_disabled(Evas_Object *button, char *text, Eina_Bool disabled) +{ + elm_object_disabled_set(button, disabled); + SETTING_TRACE_WARNING("TEXT: %s", text); + + char buf[1024]; + if (disabled) { + snprintf(buf, 1024, CLOSE_UNINSTALL_BUTTON_FORMAT_DISABLED, text); + } else { + snprintf(buf, 1024, CLOSE_UNINSTALL_BUTTON_FORMAT_ENABLED, text); + } + + SETTING_TRACE_WARNING("BUTTON: %s", buf); + elm_object_text_set(button, buf); +}