TSAM-8197 Set time screen does not open although There is animation when tapping... 79/91079/3 submit/tizen/20161006.124926
authorOleksander Kostenko <o.kostenko@samsung.com>
Wed, 5 Oct 2016 13:39:23 +0000 (16:39 +0300)
committerOleksander Kostenko <o.kostenko@samsung.com>
Thu, 6 Oct 2016 10:49:46 +0000 (13:49 +0300)
Change-Id: Icffd1ee7ededb04b58dc93138dcf805899517eb8
Signed-off-by: Oleksander Kostenko <o.kostenko@samsung.com>
inc/set-schedule-info.h
src/common-efl.c
src/set-schedule-info.c

index c73948104535c8d2f9018fcaa7eac2e97bcb1be0..3a6353c25a8ecf0758c104141f9d7dd089703be8 100644 (file)
@@ -84,5 +84,13 @@ int load_dnd_schedule_day();
  * @return true in case of success, otherwise false.
  */
 bool load_dnd_schedule_time(struct tm *start_time_out, struct tm *end_time_out);
+/**
+ * @brief Create popup to change and set start time of schedule.
+ */
+void create_start_time_popup();
+/**
+ * @brief Create popup to change and set end time of schedule.
+ */
+void create_end_time_popup();
 
 #endif //__SET_SCHEDULE_INFO_H__
index 3e3be4d4a733e3c56ebad83eb5b932859bc2a621..d8f6574e979625e6177f8e28ee137befcbca1bdf 100755 (executable)
@@ -99,33 +99,49 @@ Evas_Object *create_naviframe(Evas_Object *parent)
 
 void gl_selected_cb(void *data, Evas_Object *obj EINA_UNUSED, void *event_info)
 {
-       Elm_Object_Item *it = (Elm_Object_Item*)event_info;
-       elm_genlist_item_selected_set(it, EINA_FALSE);
-
-       void *item_data = elm_object_item_data_get(it);
-       if(item_data && data && !strcmp(data, "app-notification-details"))
-       {
-           app_details_create_view(g_ug_data, (item_info_s*)item_data);
-           return;
-       }
+    Elm_Object_Item *it = (Elm_Object_Item*) event_info;
+    elm_genlist_item_selected_set(it, EINA_FALSE);
 
-       Evas_Object *check = elm_object_item_part_content_get(it, "elm.swallow.end");
-       if (!check) {
-               check = elm_object_item_part_content_get(it, "elm.icon.right");
-       }
+    if(data)
+    {
+        void *item_data = elm_object_item_data_get(it);
+        if(item_data && !strcmp(data, "app-notification-details"))
+        {
+            app_details_create_view(g_ug_data, (item_info_s*)item_data);
+            return;
+        }
 
-       if (check) {
-               elm_check_state_set(check, !elm_check_state_get(check));
-               evas_object_smart_callback_call(check, "changed", NULL);
-       }
+        if(!strcmp(data, "set-schedule-multiline"))
+        {
+            gl_set_schedule_selected(g_ug_data);
+        }
+
+        if(!strcmp(data, "allowed-calls"))
+        {
+            gl_allowed_calls_selected();
+        }
 
-       if(data && !strcmp(data, "set-schedule-multiline")) {
-           gl_set_schedule_selected(g_ug_data);
+        if(!strcmp(data, "start-time"))
+        {
+            create_start_time_popup();
+        }
+        if(!strcmp(data, "end-time"))
+        {
+            create_end_time_popup();
+        }
     }
 
-       if(data && !strcmp(data, "allowed-calls")) {
-           gl_allowed_calls_selected();
-       }
+    Evas_Object *check = elm_object_item_part_content_get(it, "elm.swallow.end");
+    if (!check)
+    {
+        check = elm_object_item_part_content_get(it, "elm.icon.right");
+    }
+
+    if (check)
+    {
+        elm_check_state_set(check, !elm_check_state_get(check));
+        evas_object_smart_callback_call(check, "changed", NULL);
+    }
 }
 
 void gl_contracted_cb(void *data EINA_UNUSED, Evas_Object *obj EINA_UNUSED, void *event_info)
index b95d8adeaef5e442e03f5561533678ae1798f0fe..929f0b88114c19655eb808e964ca22b0af91ac15 100755 (executable)
@@ -68,12 +68,9 @@ typedef struct datetime
 
 datetime_s start_time_p, end_time_p;
 
-
 static int default_dnd_schedule_weekday = 0;
 static int new_dnd_schedule_weekday = 0;
 
-static int day = 0;
-
 static void set_set_schedule(bool state);
 static void enable_time_items(bool enable);
 static Evas_Object *create_week_repeat_layout(Evas_Object* parent);
@@ -90,6 +87,7 @@ static void close_set_schedule_cb(void *data, Evas_Object *obj, void *event_info
 static void make_color_text(int dayCode, dnd_schedule_week_flag_e week_day, const char *text, char* outBuf);
 static void save_dnd_weekday(int dayCode);
 static bool same_time(struct tm* timeA, struct tm* timeB);
+static void create_popup(datetime_s *dt);
 
 bool load_dnd_schedule_time(struct tm *start_time_out, struct tm *end_time_out)
 {
@@ -150,9 +148,9 @@ static void make_color_text(int dayCode, dnd_schedule_week_flag_e week_day, cons
 {
     char formattedDay[DAY_MAX_LENGTH] = { 0 };
     if((dayCode & week_day) == 0)
-        snprintf(formattedDay, DAY_MAX_LENGTH, GREY_TEXT_MAIN, text);
-    else
         snprintf(formattedDay, DAY_MAX_LENGTH, GREEN_TEXT_MAIN, text);
+    else
+        snprintf(formattedDay, DAY_MAX_LENGTH, GREY_TEXT_MAIN, text);
 
     strncat(outBuf, formattedDay, DAY_MAX_LENGTH);
 }
@@ -313,13 +311,13 @@ static void week_button_clicked_cb(void *data, Evas_Object *obj, void *event_inf
     if(cc->change_color)
     {
         new_dnd_schedule_weekday ^= cc->week;
-        snprintf(buf, sizeof(buf), GREY_TEXT_COLOR, cc->text);
+        snprintf(buf, sizeof(buf), GREEN_TEXT_COLOR, cc->text);
         elm_object_text_set(cc->label, buf);
     }
     else
     {
         new_dnd_schedule_weekday |= cc->week;
-        snprintf(buf, sizeof(buf), GREEN_TEXT_COLOR, cc->text);
+        snprintf(buf, sizeof(buf), GREY_TEXT_COLOR, cc->text);
         elm_object_text_set(cc->label, buf);
     }
 
@@ -340,8 +338,6 @@ static Evas_Object *create_week_button(Evas_Object *parent, const char *text, dn
     evas_object_size_hint_align_set(label, EVAS_HINT_FILL, EVAS_HINT_FILL);
     evas_object_size_hint_weight_set(label, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
 
-    notification_system_setting_dnd_schedule_get_day(get_system_setting(), &day);
-
     changecolor_s *cc = calloc(1, sizeof(changecolor_s));
     cc->week = week;
     cc->label = label;
@@ -349,12 +345,12 @@ static Evas_Object *create_week_button(Evas_Object *parent, const char *text, dn
 
     if((default_dnd_schedule_weekday & week) == 0)
     {
-        snprintf(buf, sizeof(buf), GREY_TEXT_COLOR, text);
+        snprintf(buf, sizeof(buf), GREEN_TEXT_COLOR, text);
         cc->change_color = false;
     }
     else
     {
-        snprintf(buf, sizeof(buf), GREEN_TEXT_COLOR, text);
+        snprintf(buf, sizeof(buf), GREY_TEXT_COLOR, text);
         cc->change_color = true;
     }
     elm_object_text_set(label, buf);
@@ -417,7 +413,7 @@ static void popup_set_btn_clicked_cb(void *data , Evas_Object *obj , void *event
     elm_datetime_value_get(dt->datetime, &dt->saved_time);
     format = elm_datetime_format_get(dt->datetime);
 
-    if(dt->saved_time.tm_hour == start_time_p.saved_time.tm_hour && dt->saved_time.tm_min == start_time_p.saved_time.tm_min)
+    if(dt->is_start_time)
         notification_system_setting_dnd_schedule_set_start_time(get_system_setting(), dt->saved_time.tm_hour, dt->saved_time.tm_min);
     else
         notification_system_setting_dnd_schedule_set_end_time(get_system_setting(), dt->saved_time.tm_hour, dt->saved_time.tm_min);
@@ -458,10 +454,8 @@ static void create_datetime_popup(datetime_s *dt)
     evas_object_smart_callback_add(set_btn, "clicked", popup_set_btn_clicked_cb, dt);
 }
 
-static void launch_popup_cb(void *data , Evas_Object *obj , void *event_info)
+static void create_popup(datetime_s *dt)
 {
-    char *format;
-    datetime_s *dt = data;
     create_datetime_popup(dt);
     Evas_Object *box = elm_box_add(dt->popup);
     ug_data *ug_main = get_app_ui_data();
@@ -469,7 +463,7 @@ static void launch_popup_cb(void *data , Evas_Object *obj , void *event_info)
 
     dt->datetime = elm_datetime_add(ug_main->naviframe);
 
-    format = evas_object_data_get(obj, "format");
+    char *format = get_time_format() == time_format_12H ? TIME_12_FORMAT : TIME_24_FORMAT;
     bool fmt12hours = !strcmp(format, TIME_12_FORMAT);
     const char *fmt = fmt12hours ? TIME_12_LAYOUT : TIME_24_LAYOUT;
     const char* timeMask = fmt12hours ? POPUP_TIME_12_FORMAT : POPUP_TIME_24_FORMAT;
@@ -487,9 +481,26 @@ static void launch_popup_cb(void *data , Evas_Object *obj , void *event_info)
     evas_object_show(dt->popup);
 }
 
+void create_start_time_popup()
+{
+    create_popup(&start_time_p);
+}
+
+void create_end_time_popup()
+{
+    create_popup(&end_time_p);
+}
+
+static void launch_popup_cb(void *data, Evas_Object *obj , void *event_info)
+{
+    datetime_s *dt = data;
+    create_popup(dt);
+}
+
 static Evas_Object *create_time_button(Evas_Object *parent, const char *text, const char *format, datetime_s *dt)
 {
     Evas_Object *button = elm_button_add(parent);
+    evas_object_propagate_events_set(button, EINA_FALSE);
     elm_object_text_set(button, text);
     evas_object_show(button);
     evas_object_data_set(button, "format", format);
@@ -534,28 +545,13 @@ Evas_Object* start_end_time_item(Evas_Object* parent, bool is_start_time_item)
     if(is_start_time_item)
     {
         notification_system_setting_dnd_schedule_get_start_time(get_system_setting(), &dt.saved_time.tm_hour, &dt.saved_time.tm_min);
-        if(dt.saved_time.tm_hour == 0 && dt.saved_time.tm_min == 0)
-        {
-            dt.saved_time.tm_hour = 22;
-            notification_system_setting_dnd_schedule_set_start_time(get_system_setting(), dt.saved_time.tm_hour, dt.saved_time.tm_min);
-        }
+        start_time_p = dt;
     }
     else
     {
         notification_system_setting_dnd_schedule_get_end_time(get_system_setting(), &dt.saved_time.tm_hour, &dt.saved_time.tm_min);
-        if(dt.saved_time.tm_hour == 0 && dt.saved_time.tm_min == 0)
-        {
-            dt.saved_time.tm_hour = 8;
-            notification_system_setting_dnd_schedule_set_end_time(get_system_setting(), dt.saved_time.tm_hour, dt.saved_time.tm_min);
-        }
-    }
-
-    long int curr_end_time = (long int)mktime(&end_time_p.saved_time);
-    long int curr_start_time = (long int)mktime(&start_time_p.saved_time);
-    if(dt.is_start_time && curr_start_time == -1)
-        start_time_p = dt;
-    else if(!dt.is_start_time && curr_end_time == -1)
         end_time_p = dt;
+    }
 
     char *timeFormat = get_time_format() == time_format_12H ? TIME_12_FORMAT : TIME_24_FORMAT;
     if(is_start_time_item)
@@ -613,6 +609,7 @@ void gl_set_schedule_selected(ug_data *data)
     elm_object_style_set(back_btn, "naviframe/back_btn/default");
     evas_object_smart_callback_add(back_btn, "clicked", close_set_schedule_cb, ugd);
     eext_object_event_callback_add(ugd->naviframe, EEXT_CALLBACK_BACK, close_set_schedule_cb, ugd);
+    load_dnd_schedule_day();
 
     /* Push to naviframe */
     ugd->list_sub = _create_set_schedule_disturb_gl(ugd);