Apply new transparent theme & fixed Svace 45/64245/4 accepted/tizen/common/20160331.051411 submit/tizen_common/20160331.024904
authorjunkyu Han <junkyu.han@samsung.com>
Thu, 31 Mar 2016 01:18:31 +0000 (10:18 +0900)
committerjunkyu Han <junkyu.han@samsung.com>
Thu, 31 Mar 2016 02:45:54 +0000 (11:45 +0900)
Change-Id: I08a7908daa47565ed6a9c55c86b22589f3674a87

data/edje/index.edc
src/all_apps/layout.c
src/all_apps/list.c
src/index.c
src/item.c
src/key.c
src/page.c
src/page_scroller.c

index 50d1906..39c18ac 100644 (file)
@@ -183,4 +183,87 @@ collections {
          }
       }
    }
+   group { name: "elm/button/base/transparent";
+      data {
+         item: "focus_highlight" "on";
+      }
+      images {
+         image: image_normal COMP;
+      }
+      script {
+         public mouse_down = 0;
+         public multi_down = 0;
+      }
+      parts {
+         part { name: "elm.swallow.content";
+            type: SWALLOW;
+            scale: 1;
+            description { state: "default" 0.0;
+            }
+         }
+         part { name: "over2";
+            type: RECT;
+            repeat_events: 1;
+            ignore_flags: ON_HOLD;
+            description { state: "default" 0.0;
+               color: 0 0 0 0;
+           }
+         }
+         part { name: "over3";
+            type: RECT;
+            repeat_events: 1;
+            description { state: "default" 0.0;
+               color: 0 0 0 0;
+            }
+         }
+      }
+      programs {
+         program { name: "button_press";
+            signal: "mouse,down,1*";
+            source: "over2";
+            script {
+               if ((get_int(multi_down) == 0) && (get_int(mouse_down) == 0))
+               {
+                  set_int(mouse_down, 1);
+                  emit("elm,action,press", "");
+               }
+            }
+         }
+         program { name: "button_unpress";
+            signal: "mouse,up,1*";
+            source: "over3";
+            script {
+               if (get_int(mouse_down) == 1)
+               {
+                  set_int(mouse_down, 0);
+                  emit("elm,action,unpress", "");
+               }
+            }
+         }
+         program { name: "button_click";
+            signal: "mouse,clicked,1";
+            source: "over2";
+            script {
+               if (get_int(multi_down) == 0) {
+                  emit("elm,action,click", "");
+               }
+            }
+         }
+         program { name: "multi_down";
+            signal: "elm,action,multi,down";
+            source: "elm";
+            script {
+               set_int(multi_down, 1);
+            }
+         }
+         program {
+            name: "multi_up";
+            signal: "elm,action,multi,up";
+            source: "elm";
+            script {
+               set_int(multi_down, 0);
+            }
+        }
+   }
+}
 }
index 03bc04f..990df28 100644 (file)
@@ -186,7 +186,8 @@ static Evas_Object *_add_edit_button(Evas_Object *parent, Evas_Object *scroller)
                focus = elm_button_add(button);
                retv_if(NULL == focus, NULL);
 
-               elm_object_style_set(focus, "focus");
+               elm_object_theme_set(focus, menu_screen_get_theme());
+               elm_object_style_set(focus, "transparent");
                elm_object_part_content_set(button, "focus", focus);
                elm_access_info_cb_set(focus, ELM_ACCESS_INFO, _access_info_cb, scroller);
                evas_object_smart_callback_add(focus, "clicked", _focus_clicked_cb, scroller);
index 9b72d12..08476e8 100644 (file)
@@ -227,10 +227,13 @@ HAPI app_list *all_apps_list_create(void)
 
                for(i = (MAX_PAGE_NO * PAGE_MAX_APP); i<count; i++) {
                        app_list_item *item = list_nth(list, (MAX_PAGE_NO * PAGE_MAX_APP));
-                       if(!item)
-                       _E("Cannot remove an item(%s)", item->package);
 
-                       _D("%d: %s is removed", i, item->package);
+                       if (!item) {
+                               _E("There's something wrong, can't remove the item");
+                               continue;
+                       } else if (item->package) {
+                               _D("%d: %s is removed", i, item->package);
+                       }
 
                        retv_if(MENU_SCREEN_ERROR_FAIL == list_remove_item(list, item), NULL);
                }
index d01b84a..41676b6 100644 (file)
@@ -78,7 +78,7 @@ HAPI Evas_Object *index_create(Evas_Object *tab, unsigned int count, unsigned in
        retv_if(NULL == number, NULL);
 
        for (i = 0; i < count; i++) {
-               sprintf(number, "%d", i + 1);
+               snprintf(number, ((size_t) log10((double) MAX_PAGE_NO)) + 2, "%d", i + 1);
                elm_index_item_append(index, number, NULL, (void *) i);
        }
        elm_index_level_go(index, 0);
index cb5a7de..09448a4 100644 (file)
@@ -340,7 +340,7 @@ HAPI void item_show_badge(Evas_Object *obj, int value)
        ret_if(NULL == obj);
        ret_if(value <= 0);
 
-       sprintf(str, "%d", value);
+       snprintf(str, sizeof(str), "%d", value);
        if (edje_object_part_text_set(_EDJ(obj), "badge,txt", str) == EINA_FALSE) {
                _E("Failed to set text on the part, edje:%p, part:%s, text:%s", _EDJ(obj), "badge,txt", str);
        }
@@ -739,7 +739,8 @@ HAPI Evas_Object *item_create(Evas_Object *scroller, app_info_t* ai)
                item_focus = elm_button_add(item);
                retv_if(NULL == item_focus, NULL);
 
-               elm_object_style_set(item_focus, "focus");
+               elm_object_theme_set(item_focus, menu_screen_get_theme());
+               elm_object_style_set(item_focus, "transparent");
                elm_object_part_content_set(item, "focus", item_focus);
                elm_access_info_cb_set(item_focus, ELM_ACCESS_INFO, _access_info_cb, item);
                evas_object_smart_callback_add(item_focus, "clicked", _focus_clicked_cb, item);
@@ -749,7 +750,8 @@ HAPI Evas_Object *item_create(Evas_Object *scroller, app_info_t* ai)
                focus = elm_button_add(item);
                retv_if(NULL == focus, NULL);
 
-               elm_object_style_set(focus, "focus");
+               elm_object_theme_set(focus, menu_screen_get_theme());
+               elm_object_style_set(focus, "transparent");
                elm_object_part_content_set(item, "uninstall_focus", focus);
                elm_access_info_cb_set(focus, ELM_ACCESS_INFO, _access_uninstall_cb, item);
                evas_object_smart_callback_add(focus, "clicked", _uninstall_focus_clicked_cb, item);
index f1eb244..006bedc 100644 (file)
--- a/src/key.c
+++ b/src/key.c
@@ -100,8 +100,9 @@ static Eina_Bool _key_release_cb(void *data, int type, void *event)
                        int cur_idx = page_scroller_get_current_page_no(scroller);
                        int idx = 0, x = 0, w = 0;
                        elm_scroller_region_get(scroller, &x, NULL, &w, NULL);
+                       break_if(w == 0);
 
-                       if (w) idx = x / w;
+                       idx = x / w;
                        if (cur_idx != idx) {
                                page_scroller_bring_in(scroller, idx);
                                break;
@@ -109,6 +110,7 @@ static Eina_Bool _key_release_cb(void *data, int type, void *event)
 
                        /* If there are no items to be focused after pressing keys,
                           Menu-screen forces to focus the first item of the other page */
+
                        int rest = x % w;
                        if (rest) {
                                page_scroller_focus_into_vector(scroller, rest > w / 2 ? -1 : 1);
index 1791481..c379d3d 100644 (file)
@@ -337,7 +337,7 @@ HAPI menu_screen_error_e page_unpack_item(Evas_Object *page, Evas_Object *item)
        }
 
        retv_if(pending_idx == -1, MENU_SCREEN_ERROR_FAIL);
-       sprintf(tmp, "menu_swallow_%d", pending_idx);
+       snprintf(tmp, sizeof(tmp), "menu_swallow_%d", pending_idx);
 
        check_item = edje_object_part_swallow_get(_EDJ(page), tmp);
        retv_if(check_item != item, MENU_SCREEN_ERROR_FAIL);
@@ -380,7 +380,7 @@ HAPI Evas_Object *page_unpack_item_at(Evas_Object *page, int idx)
        object = page_get_item_at(page, idx);
        if (object) {
                Evas_Object *check_object;
-               sprintf(tmp, "menu_swallow_%d", idx);
+               snprintf(tmp, sizeof(tmp), "menu_swallow_%d", idx);
 
                check_object = elm_object_part_content_unset(page, tmp);
                if (check_object != object) {
index f7c1413..71739ba 100644 (file)
@@ -933,6 +933,8 @@ HAPI void page_scroller_trim_items(Evas_Object *scroller)
        Eina_List *list = NULL;
 
        page_max_app = (int) evas_object_data_get(scroller, "page_max_app");
+       ret_if (page_max_app == 0);
+
        for (i = 0; i < MAX_PAGE_NO; i ++) {
                page = page_scroller_get_page_at(scroller, i);
                if (!page) break;