[OAPSAN-5017] Button style changed in the running apps view 42/234342/1
authorMichal Skorupinski <m.skorupinsk@samsung.com>
Mon, 25 May 2020 16:30:38 +0000 (18:30 +0200)
committerMichal Skorupinski <m.skorupinsk@samsung.com>
Mon, 25 May 2020 16:30:38 +0000 (18:30 +0200)
Change-Id: I2c24ff63bd2fba9c0035971e87255ec52a232fc9
Signed-off-by: Michal Skorupinski <m.skorupinsk@samsung.com>
setting-appmgr/include/setting-appmgr-utils.h
setting-appmgr/src/setting-appmgr-pkginfo.c
setting-appmgr/src/setting-appmgr-runinfo.c
setting-appmgr/src/setting-appmgr-utils.c

index 2c79e431b95c132833a0a6893c7a9c76ec8058da..518e8f5690ed50904496ec66274b7255ef6eec9e 100644 (file)
@@ -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__ */
index 60779eca3e0c4ec7bf14bf4d1558217d0712003b..e63fed51b63e31787bd420409c4faab3c157f962 100755 (executable)
@@ -28,9 +28,6 @@
 #include "setting-appmgr-pkginfo-utils.h"
 #include "setting-appmgr-pkginfo.h"
 
-#define CLOSE_UNINSTALL_BUTTON_FORMAT_ENABLED  "<underline=single underline_color=#0A0E4AFF color=#0A0E4A>%s</underline>"
-#define CLOSE_UNINSTALL_BUTTON_FORMAT_DISABLED "<underline=single underline_color=#C3CAD2FF color=#C3CAD2>%s</underline>"
-
 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);
        }
 }
 
index a2f1a640f02832072228716ce5bf6c11ff094a5c..557b873d2321baec5742d367db3095a399c85e44 100755 (executable)
@@ -24,7 +24,6 @@
 #include <aul.h>
 #include <app_manager_extension.h>
 
-
 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);
        }
 
index 0a53b3a0b9ce3c8ec51c6477781c92561da2e03e..31bd3ef6b5e6c538ff3fbe51a2a98533d13ad485 100755 (executable)
 
 #include <aul.h>
 
+#define CLOSE_UNINSTALL_BUTTON_FORMAT_ENABLED  "<underline=single underline_color=#0A0E4AFF color=#0A0E4A>%s</underline>"
+#define CLOSE_UNINSTALL_BUTTON_FORMAT_DISABLED "<underline=single underline_color=#C3CAD2FF color=#C3CAD2>%s</underline>"
+
+
+
 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);
+}