Add Gradation Background Color Feature 21/84521/2
authorJeong Seong-moon <salt.jeong@samsung.com>
Thu, 18 Aug 2016 08:35:36 +0000 (17:35 +0900)
committerJeong Seong-moon <salt.jeong@samsung.com>
Mon, 22 Aug 2016 08:19:10 +0000 (17:19 +0900)
Change-Id: I043f79f280fc17f55f00dd25f587f37e412fb726

inc/noti_listbox.h
res/edje/quickpanel_listitem_noti.edc
res/edje/quickpanel_listitem_ongoing.edc
src/notifications/noti_listbox.c

index 608213f..eb31c7e 100755 (executable)
@@ -36,5 +36,5 @@ extern int quickpanel_noti_listbox_get_item_count(Evas_Object *listbox);
 extern void quickpanel_noti_listbox_items_visibility_set(Evas_Object *listbox, int is_visible);
 extern int quickpanel_noti_listbox_get_geometry(Evas_Object *listbox, int *limit_h, int *limit_partial_h, int *limit_partial_w);
 extern void quickpanel_noti_listbox_closing_trigger_set(Evas_Object *listbox);
-
+extern void quickpanel_noti_listbox_update_item_background_color(void);
 #endif
index fa6cde5..0c581cd 100755 (executable)
@@ -67,7 +67,7 @@
                                        state: "default" 0.0;
                                        rel1.to:"base";
                                        rel2.to:"base";
-                                       color_class: QP_THEME_BANDED_COLOR;
+                                       color: 61 185 204 11;
                                        visible: 1;
                                }
                                description {
                                        color_class: QP_THEME_BG_COLOR;
                                        color: 255 255 255 128;
                                }
-                       }
+                               #define BGCOLOR_DESC(NAME, COLOR) \
+                               description {\
+                                       state: NAME 0.0;\
+                                       inherit: "default" 0.0;\
+                                       color:  COLOR;\
+                               }
 
+                               BGCOLOR_DESC("bgcolor.step1", 61 185 204 11);
+                               BGCOLOR_DESC("bgcolor.step2", 61 185 204 21);
+                               BGCOLOR_DESC("bgcolor.step3", 61 185 204 31);
+                               BGCOLOR_DESC("bgcolor.step4", 61 185 204 41);
+                               BGCOLOR_DESC("bgcolor.step5", 61 185 204 51);
+                               BGCOLOR_DESC("bgcolor.step6", 61 185 204 62);
+                               BGCOLOR_DESC("bgcolor.step7", 61 185 204 72);
+                               BGCOLOR_DESC("bgcolor.step8", 61 185 204 82);
+                               BGCOLOR_DESC("bgcolor.step9", 61 185 204 92);
+                               BGCOLOR_DESC("bgcolor.step10", 61 185 204 102);
+                       }
                        part {
                                name: "elm.padding.right";
                                type: SPACER;
                }
 
                programs {
+                       script{
+                               public current_background;
+                       }
                        program{
                                name: "listbox.touch.down";
                                signal: "mouse,clicked,1";
                                name: "effect,mouse,up";
                                signal: "mouse,up,1";
                                source: "object.layer.touch.background";
-                               action: STATE_SET "default" 0.0;
+                               script {
+                                       new tmp[64];
+                                       get_str(current_background, tmp, 64);
+                                       set_state(PART:"bgcolor", tmp, 0.0);
+                               }
                                transition: ACCELERATE 0.20;
-                               target: "bgcolor";
                        }
+
+#define BGCOLOR_PROG(NAME, SIG) \
+                       program{\
+                               name: NAME;\
+                               signal: SIG;\
+                               source: "bgcolor";\
+                               transition: ACCELERATE 0.20;\
+                               script {\
+                                       set_str(current_background, SIG);\
+                                       set_state(PART:"bgcolor", SIG, 0.0);\
+                               }\
+                       }
+
+                       BGCOLOR_PROG("bgcolor.step1", "bgcolor.step1");
+                       BGCOLOR_PROG("bgcolor.step2", "bgcolor.step2");
+                       BGCOLOR_PROG("bgcolor.step3", "bgcolor.step3");
+                       BGCOLOR_PROG("bgcolor.step4", "bgcolor.step4");
+                       BGCOLOR_PROG("bgcolor.step5", "bgcolor.step5");
+                       BGCOLOR_PROG("bgcolor.step6", "bgcolor.step6");
+                       BGCOLOR_PROG("bgcolor.step7", "bgcolor.step7");
+                       BGCOLOR_PROG("bgcolor.step8", "bgcolor.step8");
+                       BGCOLOR_PROG("bgcolor.step9", "bgcolor.step9");
+
                        program{
                                name: "title.long";
                                signal: "title.long";
index 0474b9e..e8b7b14 100755 (executable)
                                        state: "default" 0.0;
                                        rel1.to:"base";
                                        rel2.to:"base";
-                                       color_class: QP_THEME_BANDED_COLOR;
+                                       color: 61 185 204 11;
                                        visible: 1;
                                }
                                description {
                                        color: 255 255 255 128;
                                        visible:1;
                                }
+#define BGCOLOR_DESC(NAME, COLOR) \
+                               description {\
+                                       state: NAME 0.0;\
+                                       inherit: "default" 0.0;\
+                                       color:  COLOR;\
+                               }
+
+                               BGCOLOR_DESC("bgcolor.step1", 61 185 204 11);
+                               BGCOLOR_DESC("bgcolor.step2", 61 185 204 21);
+                               BGCOLOR_DESC("bgcolor.step3", 61 185 204 31);
+                               BGCOLOR_DESC("bgcolor.step4", 61 185 204 41);
+                               BGCOLOR_DESC("bgcolor.step5", 61 185 204 51);
+                               BGCOLOR_DESC("bgcolor.step6", 61 185 204 62);
+                               BGCOLOR_DESC("bgcolor.step7", 61 185 204 72);
+                               BGCOLOR_DESC("bgcolor.step8", 61 185 204 82);
+                               BGCOLOR_DESC("bgcolor.step9", 61 185 204 92);
+                               BGCOLOR_DESC("bgcolor.step10", 61 185 204 102);
                        }
 
                        part {
                }
 
                programs {
+                       script{
+                               public current_background;
+                       }
                        program{
                                name: "effect,mouse,down";
                                signal: "mouse,down,1";
                                name: "effect,mouse,up";
                                signal: "mouse,up,1";
                                source: "object.layer.touch.background";
-                               action: STATE_SET "default" 0.0;
+                               script {
+                                       new tmp[64];
+                                       get_str(current_background, tmp, 64);
+                                       set_state(PART:"bgcolor", tmp, 0.0);
+                               }
                                transition: ACCELERATE 0.20;
-                               target: "bgcolor";
                        }
+#define BGCOLOR_PROG(NAME, SIG) \
+                       program{\
+                               name: NAME;\
+                               signal: SIG;\
+                               source: "bgcolor";\
+                               transition: ACCELERATE 0.20;\
+                               script {\
+                                       set_str(current_background, SIG);\
+                                       set_state(PART:"bgcolor", SIG, 0.0);\
+                               }\
+                       }
+
+                       BGCOLOR_PROG("bgcolor.step1", "bgcolor.step1");
+                       BGCOLOR_PROG("bgcolor.step2", "bgcolor.step2");
+                       BGCOLOR_PROG("bgcolor.step3", "bgcolor.step3");
+                       BGCOLOR_PROG("bgcolor.step4", "bgcolor.step4");
+                       BGCOLOR_PROG("bgcolor.step5", "bgcolor.step5");
+                       BGCOLOR_PROG("bgcolor.step6", "bgcolor.step6");
+                       BGCOLOR_PROG("bgcolor.step7", "bgcolor.step7");
+                       BGCOLOR_PROG("bgcolor.step8", "bgcolor.step8");
+                       BGCOLOR_PROG("bgcolor.step9", "bgcolor.step9");
+                       BGCOLOR_PROG("bgcolor.step10", "bgcolor.step10");
 #ifdef TBD
                        program{
                                name: "listbox.touch.down";
                                        max: -1 QP_THEME_LIST_ITEM_ONGOING_EVENT_LINE3_HEIGHT;
                                }
                        }
-
                        part {
                                name: "bgcolor";
                                type: "RECT";
                                        state: "default" 0.0;
                                        rel1.to:"base";
                                        rel2.to:"base";
-                                       color_class: QP_THEME_BANDED_COLOR;
+                                       color: 61 185 204 11;
                                        visible: 1;
                                }
                                description {
                                        color_class: QP_THEME_BG_COLOR;
                                        color: 255 255 255 128;
                                }
+#define BGCOLOR_DESC(NAME, COLOR) \
+                               description {\
+                                       state: NAME 0.0;\
+                                       inherit: "default" 0.0;\
+                                       color:  COLOR;\
+                               }
+
+                               BGCOLOR_DESC("bgcolor.step1", 61 185 204 11);
+                               BGCOLOR_DESC("bgcolor.step2", 61 185 204 21);
+                               BGCOLOR_DESC("bgcolor.step3", 61 185 204 31);
+                               BGCOLOR_DESC("bgcolor.step4", 61 185 204 41);
+                               BGCOLOR_DESC("bgcolor.step5", 61 185 204 51);
+                               BGCOLOR_DESC("bgcolor.step6", 61 185 204 62);
+                               BGCOLOR_DESC("bgcolor.step7", 61 185 204 72);
+                               BGCOLOR_DESC("bgcolor.step8", 61 185 204 82);
+                               BGCOLOR_DESC("bgcolor.step9", 61 185 204 92);
+                               BGCOLOR_DESC("bgcolor.step10", 61 185 204 102);
                        }
 
                        part {
                }
 
                programs {
+                       script{
+                               public current_background;
+                       }
                        program{
                                name: "listbox.touch.down";
                                signal: "mouse,clicked,1";
                                name: "effect,mouse,up";
                                signal: "mouse,up,1";
                                source: "object.layer.touch.background";
-                               action: STATE_SET "default" 0.0;
+                               script {
+                                       new tmp[64];
+                                       get_str(current_background, tmp, 64);
+                                       set_state(PART:"bgcolor", tmp, 0.0);
+                               }
                                transition: ACCELERATE 0.20;
-                               target: "bgcolor";
                        }
+#define BGCOLOR_PROG(NAME, SIG) \
+                       program{\
+                               name: NAME;\
+                               signal: SIG;\
+                               source: "bgcolor";\
+                               transition: ACCELERATE 0.20;\
+                               script {\
+                                       set_str(current_background, SIG);\
+                                       set_state(PART:"bgcolor", SIG, 0.0);\
+                               }\
+                       }
+
+                       BGCOLOR_PROG("bgcolor.step1", "bgcolor.step1");
+                       BGCOLOR_PROG("bgcolor.step2", "bgcolor.step2");
+                       BGCOLOR_PROG("bgcolor.step3", "bgcolor.step3");
+                       BGCOLOR_PROG("bgcolor.step4", "bgcolor.step4");
+                       BGCOLOR_PROG("bgcolor.step5", "bgcolor.step5");
+                       BGCOLOR_PROG("bgcolor.step6", "bgcolor.step6");
+                       BGCOLOR_PROG("bgcolor.step7", "bgcolor.step7");
+                       BGCOLOR_PROG("bgcolor.step8", "bgcolor.step8");
+                       BGCOLOR_PROG("bgcolor.step9", "bgcolor.step9");
+                       BGCOLOR_PROG("bgcolor.step10", "bgcolor.step10");
+
                        program{
                                name: "line1.set";
                                signal: "line1.set";
index 9c9fdee..3a13c4f 100755 (executable)
@@ -79,7 +79,6 @@ static int _listbox_layout_item_valid(Evas_Object *container, Evas_Object *item)
 
        return ret;
 }
-
 static void _listbox_layout_get_coord(Evas_Object *container, int insert_position, int *coord_x, int *coord_y, Evas_Object *noti_section)
 {
        int x, y, h;
@@ -349,6 +348,8 @@ static void _anim_done_delete_all(void *data)
        if (item_list != NULL) {
                eina_list_free(item_list);
        }
+
+       quickpanel_noti_listbox_update_item_background_color();
 }
 
 HAPI void quickpanel_noti_listbox_remove_all_item(Evas_Object *listbox, int with_animation)
@@ -402,6 +403,40 @@ HAPI void quickpanel_noti_listbox_update_item(Evas_Object *listbox, Evas_Object
        }
 }
 
+HAPI void quickpanel_noti_listbox_update_item_background_color(void)
+{
+       struct appdata *ad = quickpanel_get_app_data();
+       int i = 0;
+
+       DBG("quickpanel_noti_listbox_update_item_background_color");
+
+       retif(ad == NULL, , "invalid data.");
+
+       Eina_List *l;
+       Eina_List *l_next;
+       Evas_Object *obj = NULL;
+       Eina_List *item_list = elm_box_children_get(ad->list);
+
+       EINA_LIST_FOREACH_SAFE(item_list, l, l_next, obj) {
+               char signal[64] = {0, };
+               if (i == 0) { //1st item is clear all section. It should not be changed.
+                       i++;
+                       continue;
+               } else if (i < 10) {
+                       snprintf(signal, sizeof(signal), "%s%d", "bgcolor.step", i);
+               } else {
+                       snprintf(signal, sizeof(signal), "%s", "bgcolor.step10");
+               }
+
+               elm_object_signal_emit(obj, signal, "bgcolor");
+               i++;
+       }
+
+       if (item_list != NULL) {
+               eina_list_free(item_list);
+       }
+}
+
 HAPI void quickpanel_noti_listbox_rotation(Evas_Object *listbox, int angle)
 {
        int h = 0;
@@ -666,6 +701,8 @@ static void _anim_done_insert(void *data)
                        elm_box_pack_after(container, item, before);
                }
        }
+
+       quickpanel_noti_listbox_update_item_background_color();
 }
 
 static void _anim_job_delete(void *data)
@@ -773,6 +810,8 @@ static void _anim_done_delete(void *data)
                _listbox_layout_size_get(container, &w, &h);
                evas_object_resize(container, w, h);
        }
+
+       quickpanel_noti_listbox_update_item_background_color();
 }
 
 static Eina_Bool _anim_init_cb(void *data)