summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
author“vijay.tiwari” <vijay.tiwari@samsung.com>2016-11-03 17:06:20 +0530
committer“vijay.tiwari” <vijay.tiwari@samsung.com>2016-11-03 17:06:20 +0530
commita20324a28e698582de1af2e94f0ba003310ef8b6 (patch)
tree3fc473fafe7e09e999c73ad17268c9191b065604
parente689cfa4fb10f9cafa1281526d1682461a8d424a (diff)
parent7382e837d182e68c5dcddb3f9ffb8100425a35be (diff)
downloadalarm-a20324a28e698582de1af2e94f0ba003310ef8b6.tar.gz
alarm-a20324a28e698582de1af2e94f0ba003310ef8b6.tar.bz2
alarm-a20324a28e698582de1af2e94f0ba003310ef8b6.zip
Merge branch 'tizen' into tizen_3.0
Change-Id: I1dad999781418b9e671af020e8486dc11ba85979
-rwxr-xr-xalarm_alert/src/ring.c43
-rwxr-xr-xinc/alarm.h2
-rwxr-xr-xinc/data.h2
-rwxr-xr-xinc/view.h2
-rwxr-xr-xsrc/data.c170
-rwxr-xr-xsrc/main.c18
-rwxr-xr-xsrc/view.c62
-rwxr-xr-xtizen-manifest.xml1
8 files changed, 247 insertions, 53 deletions
diff --git a/alarm_alert/src/ring.c b/alarm_alert/src/ring.c
index c5ee1db..2e3119c 100755
--- a/alarm_alert/src/ring.c
+++ b/alarm_alert/src/ring.c
@@ -20,6 +20,10 @@
#include "alarm_db.h"
#include "log.h"
#include "alarm_alert_string.h"
+#include <feedback.h>
+
+#define KEY_POWER "XF86PowerOff"
+#define KEY_BACK "XF86Back"
typedef struct appdata{
Evas_Object* win;
@@ -38,9 +42,11 @@ int delay_count = 0;
alarm_details* alm_details=NULL;
Ecore_Timer *timer = NULL;
+Ecore_Timer *feedbacktimer = NULL;
bool ignore_multiple_calls = false;
+
void dismiss_or_snooze()
{
ALM_INFO("dismiss_or_snooze");
@@ -62,6 +68,23 @@ void dismiss_or_snooze()
ui_app_exit();
}
+static Eina_Bool _key_pressed(void *data, Evas_Object *obj, Evas_Object *src, Evas_Callback_Type type, void *event_info)
+{
+ _ALM_ENTER_;
+ _D("_key_pressed");
+ Evas_Event_Key_Down *ev = event_info;
+ _D("type:%d, key: %s ,powerkey:%s",type, ev->key, KEY_POWER);
+ if (type == EVAS_CALLBACK_KEY_DOWN && ( strncmp(KEY_POWER, ev->key, strlen(KEY_POWER)) == 0 || strncmp(KEY_BACK, ev->key, strlen(KEY_BACK)) == 0) ) {
+ _D("KEY PRESSED: %s", ev->key);
+
+ dismiss_or_snooze();
+
+ return EINA_TRUE;
+ } else {
+ return EINA_FALSE;
+ }
+}
+
void data_get_resource_path(const char *file_in, char *file_path_out, int file_path_max)
{
char *res_path = app_get_resource_path();
@@ -115,6 +138,7 @@ create_base_gui(appdata_s *ad)
elm_win_indicator_opacity_set(ad->win, ELM_WIN_INDICATOR_OPAQUE);
evas_object_size_hint_weight_set(ad->conform, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
elm_win_resize_object_add(ad->win, ad->conform);
+ elm_object_event_callback_add(ad->win, _key_pressed, NULL);
evas_object_show(ad->conform);
/* Base Layout */
@@ -234,6 +258,13 @@ static Eina_Bool _update_ring_view_by_timer_cb(void *data)
}
+static Eina_Bool _feedback_timer_cb(void *data)
+{
+ int ret = feedback_play(FEEDBACK_PATTERN_TAP);
+ _D("feedback play ret:%d", ret);
+ return ECORE_CALLBACK_RENEW;
+}
+
void ring_view_add_by_timer(Evas_Object *parent)
{
ALM_INFO("_create_layout_ring_alarm >>");
@@ -366,6 +397,8 @@ static void _create_layout_ring_alarm(Evas_Object *parent)
ECORE_TIMER_DELIF(timer);
timer = ecore_timer_add(60.0, _update_ring_view_by_timer_cb, layout);
+ ECORE_TIMER_DELIF(feedbacktimer);
+ feedbacktimer = ecore_timer_add(1.0, _feedback_timer_cb, layout);
}
@@ -383,7 +416,8 @@ app_create(void *data)
snprintf(locale_path,sizeof(locale_path),"%s/locale",respath);
bindtextdomain(PACKAGE,locale_path);
create_base_gui(ad);
-
+ int ret = feedback_initialize();
+ _D("Feeback init: %d", ret);
return true;
}
@@ -414,8 +448,6 @@ static void
app_pause(void *data)
{
/* Take necessary actions when application becomes invisible. */
- dismiss_or_snooze();
- ui_app_exit();
}
@@ -430,9 +462,14 @@ app_terminate(void *data)
{
/* Release all resources. */
ECORE_TIMER_DELIF(timer);
+ ECORE_TIMER_DELIF(feedbacktimer);
FREEIF(tatime);
FREEIF(tid);
FREEIF(alm_details);
+ int ret = feedback_stop();
+ _D("feedback stop ret:%d", ret);
+ ret = feedback_deinitialize();
+ _D("feedback deinit ret:%d", ret);
}
static void
diff --git a/inc/alarm.h b/inc/alarm.h
index 53c453f..01bcea1 100755
--- a/inc/alarm.h
+++ b/inc/alarm.h
@@ -58,7 +58,7 @@ typedef enum {
NORMAL_MODE ,
EDIT_MODE,
} mode_type;
-void update_genlist(int last_alarm_id, int edit_mode, int type);
+void update_genlist(mode_type e, int type);
void update_genlist_first();
void populate_genlist();
void end_genlist();
diff --git a/inc/data.h b/inc/data.h
index a8b8a9e..c7d8837 100755
--- a/inc/data.h
+++ b/inc/data.h
@@ -66,5 +66,5 @@ void data_alarm_destroy_genlist_item_data(struct genlist_item_data *gendata);
char *data_get_popup_text(struct tm *saved_time);
char *data_get_popup_text_new(int diffinsec);
-int find_diff(struct tm *current_time, struct tm *saved_time);
+int find_diff(struct tm *current_time, struct tm *saved_time, int weekly);
#endif
diff --git a/inc/view.h b/inc/view.h
index 523615a..6c8c62a 100755
--- a/inc/view.h
+++ b/inc/view.h
@@ -46,6 +46,8 @@ Evas_Object *view_create_datetime(Evas_Object *parent, const char *style ,Eext_C
struct tm *view_get_datetime();
Eina_Bool view_get_is_select_mode(void);
void view_set_is_select_mode( Eina_Bool is_edit_mode);
+Evas_Object *view_get_circle_genlist(void);
+void view_set_circle_genlist(Evas_Object *circle_genlist);
void go_to_normal();
void view_destroy(void);
void view_alarm_destroy(void);
diff --git a/src/data.c b/src/data.c
index d8067c2..06ea96e 100755
--- a/src/data.c
+++ b/src/data.c
@@ -405,8 +405,39 @@ void data_alarm_destroy_genlist_item_data(struct genlist_item_data *gendata)
_ALM_ENTER_;
free(gendata);
}
+int find_day_diff(int present_day, int weekly, int saved, int cur, struct tm *current_time)
+{
+ _ALM_ENTER_;
+ ALM_INFO(" present day %d ", present_day);
+ Eina_Bool is_selected[7];
+ int ans = 0;
+ for (int i = 0; i < 7; i++) {
+ if (weekly & (1 << i))
+ is_selected[i] = 1;
+ else
+ is_selected[i] = 0;
+ }
-int find_diff(struct tm *current_time, struct tm *saved_time)
+ for (int i = 0; i < 7; i++)
+ ALM_INFO("days %d ", is_selected[i]);
+ int flag = 0;
+ while (1) {
+ if (is_selected[present_day]) {
+ ALM_INFO("in %d ", present_day);
+ if ((saved == cur) && (present_day == current_time->tm_wday) && (flag == 0)) {
+ flag = 1;
+ ALM_INFO("Same time same day weekly");
+ } else
+ break;
+ }
+ ans++;
+ present_day = (present_day+1)%7;
+ }
+ return ans;
+}
+
+
+int find_diff(struct tm *current_time, struct tm *saved_time, int weekly)
{
_ALM_ENTER_;
int diffinsec = 0;
@@ -418,17 +449,36 @@ int find_diff(struct tm *current_time, struct tm *saved_time)
int savetimesec = (saved_time->tm_hour * MINS_AN_HOUR * MINS_AN_HOUR) + (saved_time->tm_min * MINS_AN_HOUR);
int currtimesec = (current_time->tm_hour * MINS_AN_HOUR * MINS_AN_HOUR) + (current_time->tm_min * MINS_AN_HOUR);
ALM_INFO("savetimesec=%d, currtimesec=%d", savetimesec, currtimesec);
+ int day_diff;
+ if (weekly == 0)
+ day_diff = 0;
+ else
+ day_diff = find_day_diff(current_time->tm_wday, weekly, savetimesec, currtimesec, current_time);
+ ALM_INFO("day_diff is %d ", day_diff);
if (savetimesec == currtimesec) {
ALM_INFO("savetimesec == currtimesec");
- diffinsec = 0;
+ if (day_diff == 0)
+ diffinsec = 86400 ;
+ else
+ diffinsec = day_diff * 86400;
} else if (savetimesec < currtimesec) {
//if currenttime is less than savetime, then alarm should set for next day. (dayend time 24:00 - currenttime hh:mm+ savetime hh:mm)
ALM_INFO("savetimesec < currtimesec");
- diffinsec = ((HOURS_A_DAY * MINS_AN_HOUR * MINS_AN_HOUR) - currtimesec) + savetimesec;
+ if (day_diff == 1)
+ diffinsec = ((HOURS_A_DAY * MINS_AN_HOUR * MINS_AN_HOUR) - currtimesec) + savetimesec;
+ else if (day_diff == 0) {
+ if (weekly)
+ diffinsec = ((HOURS_A_DAY * MINS_AN_HOUR * MINS_AN_HOUR) - currtimesec) + savetimesec + (6 * 86400) ;
+ else
+ diffinsec = ((HOURS_A_DAY * MINS_AN_HOUR * MINS_AN_HOUR) - currtimesec) + savetimesec;
+ }
+
+ else
+ diffinsec = ((HOURS_A_DAY * MINS_AN_HOUR * MINS_AN_HOUR) - currtimesec) + savetimesec + ((day_diff -1) * 86400) ;
} else {
//if currenttime is greater than savetime, then alarm should set for same day. (savetime hh:mm- currenttime hh:mm)
ALM_INFO("savetimesec > currtimesec");
- diffinsec = (savetimesec - currtimesec);
+ diffinsec = (savetimesec - currtimesec) + (day_diff * 86400) ;
}
return diffinsec;
}
@@ -520,35 +570,91 @@ char *data_get_popup_text_new(int diffinsec)
{
_ALM_ENTER_;
int diffinmin = diffinsec/60;
+ int days_f = diffinmin/1440;
+ int hours_f = (diffinmin%1440)/60;
+ int mins_f = diffinmin - ((days_f * 1440) + (hours_f * 60));
+ ALM_INFO("NEW TEXT is %d days, %d hours , %d mins", days_f, hours_f, mins_f);
char time_text[BUF_LEN] = {0, };
- char hour_text[BUF_LEN] = {0, };
- char min_text[BUF_LEN] = {0, };
- if (diffinmin == 0) {
- snprintf(time_text, sizeof(time_text), S_(STRING_ALM_TIME_IS_NOW));
- } else if (diffinmin < 60) {
- if(diffinmin > 1)
- snprintf(time_text, sizeof(time_text), S_(STRING_ALM_SET_FOR_PD_MINS_FROM_NOW), diffinmin);
- else
- snprintf(time_text, sizeof(time_text), S_(STRING_ALM_SET_FOR_1_MIN_FROM_NOW));
- } else {
- int hours = diffinmin/60;
- int mins = diffinmin%60;
- if(hours>1) {
- if (mins>1)
- snprintf(time_text, sizeof(time_text), S_(STRING_ALM_SET_FOR_PD_HOURS_AND_PD_MINUTES_FROM_NOW), hours, mins);
- else if(mins == 1)
- snprintf(time_text, sizeof(time_text), S_(STRING_ALM_SET_FOR_PD_HOURS_AND_1_MINUTE_FROM_NOW), hours);
- else
- snprintf(time_text, sizeof(time_text), S_(STRING_ALM_SET_FOR_PD_HOURS_FROM_NOW), hours);
- }
- else {
- if (mins>1)
- snprintf(time_text, sizeof(time_text), S_(STRING_ALM_SET_FOR_1_HOUR_AND_PD_MINUTES_FROM_NOW), mins);
- else if(mins == 1)
- snprintf(time_text, sizeof(time_text), S_(STRING_ALM_SET_FOR_1_HOUR_AND_1_MINUTE_FROM_NOW));
- else
- snprintf(time_text, sizeof(time_text), S_(STRING_ALM_SET_FOR_1_HOUR_FROM_NOW));
- }
+ if (days_f == 0 && hours_f == 0 && mins_f == 1) {
+ ALM_INFO("Alarm set for 0 days 0 hours 1 min from now");
+ snprintf(time_text, sizeof(time_text), S_(STRING_ALM_SET_FOR_1_MIN_FROM_NOW));
+ } else if (days_f == 0 && hours_f == 0 && mins_f > 1) {
+ ALM_INFO("Alarm set for 0 days 0 hours %d mins from now", mins_f);
+ snprintf(time_text, sizeof(time_text), S_(STRING_ALM_SET_FOR_PD_MINS_FROM_NOW), mins_f);
+ } else if (days_f == 0 && hours_f == 1 && mins_f == 0) {
+ ALM_INFO("Alarm set for 0 days 1 hour 0 mins from now");
+ snprintf(time_text, sizeof(time_text), S_(STRING_ALM_SET_FOR_1_HOUR_FROM_NOW));
+ } else if (days_f == 0 && hours_f > 1 && mins_f == 0) {
+ ALM_INFO("Alarm set for 0 days %d hours 0 mins from now", hours_f);
+ snprintf(time_text, sizeof(time_text), S_(STRING_ALM_SET_FOR_PD_HOURS_FROM_NOW), hours_f);
+ } else if ((days_f == 1 && hours_f == 0 && mins_f == 0)
+ || (days_f == 0 && hours_f == 23 && mins_f == 60)
+ || (days_f == 0 && hours_f == 24 && mins_f == 0)) {
+ ALM_INFO("Alarm set for 1 day 0 hours 0 min from now");
+ snprintf(time_text, sizeof(time_text), "Alarm set for 1 day from now");
+ } else if (days_f > 1 && hours_f == 0 && mins_f == 0) {
+ ALM_INFO("Alarm set for %d days 0 hours 0 min from now", days_f);
+ snprintf(time_text, sizeof(time_text), "Alarm set for %d days from now", days_f);
+ } else if (days_f == 0 && hours_f == 1 && mins_f == 1) {
+ ALM_INFO("Alarm set for 0 days 1 hour 1 min from now");
+ snprintf(time_text, sizeof(time_text), S_(STRING_ALM_SET_FOR_1_HOUR_AND_1_MINUTE_FROM_NOW));
+ } else if (days_f == 0 && hours_f == 1 && mins_f > 1) {
+ ALM_INFO("Alarm set for 0 days 1 hour %d mins from now", mins_f);
+ snprintf(time_text, sizeof(time_text), S_(STRING_ALM_SET_FOR_1_HOUR_AND_PD_MINUTES_FROM_NOW), mins_f);
+ } else if (days_f == 0 && hours_f > 1 && mins_f == 1) {
+ ALM_INFO("Alarm set for 0 days %d hours 1 min from now", hours_f);
+ snprintf(time_text, sizeof(time_text), S_(STRING_ALM_SET_FOR_PD_HOURS_AND_1_MINUTE_FROM_NOW), hours_f);
+ } else if (days_f == 0 && hours_f > 1 && mins_f > 1) {
+ ALM_INFO("Alarm set for 0 days %d hours %d mins from now", hours_f, mins_f);
+ snprintf(time_text, sizeof(time_text), S_(STRING_ALM_SET_FOR_PD_HOURS_AND_PD_MINUTES_FROM_NOW), hours_f, mins_f);
+ } else if (days_f == 1 && hours_f == 0 && mins_f == 1) {
+ ALM_INFO("Alarm set for 1 day 0 hours 1 min from now");
+ snprintf(time_text, sizeof(time_text), "Alarm set for 1 day 1 min from now");
+ } else if (days_f == 1 && hours_f == 0 && mins_f > 1) {
+ ALM_INFO("Alarm set for 1 day 0 hours %d mins from now", mins_f);
+ snprintf(time_text, sizeof(time_text), "Alarm set for 1 day %d mins from now", mins_f);
+ } else if (days_f > 1 && hours_f == 0 && mins_f == 1) {
+ ALM_INFO("Alarm set for %d days 0 hours 1 min from now", days_f);
+ snprintf(time_text, sizeof(time_text), "Alarm set for %d days 1 min from now", days_f);
+ } else if (days_f > 1 && hours_f == 0 && mins_f > 1) {
+ ALM_INFO("Alarm set for %d days 0 hours %d mins from now", days_f, mins_f);
+ snprintf(time_text, sizeof(time_text), "Alarm set for %d days %d mins from now", days_f, mins_f);
+ } else if (days_f == 1 && hours_f == 1 && mins_f == 0) {
+ ALM_INFO("Alarm set for 1 day %1 hour 0 min from now");
+ snprintf(time_text, sizeof(time_text), "Alarm set for 1 day 1 hour from now");
+ } else if (days_f == 1 && hours_f > 1 && mins_f == 0) {
+ ALM_INFO("Alarm set for 1 day %d hours 0 min from now", hours_f);
+ snprintf(time_text, sizeof(time_text), "Alarm set for 1 day %d hours from now", hours_f);
+ } else if (days_f > 1 && hours_f == 1 && mins_f == 0) {
+ ALM_INFO("Alarm set for %d days 1 hours 0 min from now", days_f);
+ snprintf(time_text, sizeof(time_text), "Alarm set for %d days 1 hour from now", days_f);
+ } else if (days_f > 1 && hours_f > 1 && mins_f == 0) {
+ ALM_INFO("Alarm set for %d days %d hours 0 min from now", days_f, hours_f);
+ snprintf(time_text, sizeof(time_text), "Alarm set for %d days %d hours from now", days_f, hours_f);
+ } else if (days_f == 1 && hours_f == 1 && mins_f == 1) {
+ ALM_INFO("Alarm set for 1 day 1 hour 1 min from now");
+ snprintf(time_text, sizeof(time_text), "Alarm set for 1 day 1 hour 1 min from now");
+ } else if (days_f == 1 && hours_f == 1 && mins_f > 1) {
+ ALM_INFO("Alarm set for 1 day 1 hour %d mins from now", mins_f);
+ snprintf(time_text, sizeof(time_text), "Alarm set for 1 day 1 hour %d mins from now", mins_f);
+ } else if (days_f == 1 && hours_f > 1 && mins_f == 1) {
+ ALM_INFO("Alarm set for 1 day %d hours 1 min from now", hours_f);
+ snprintf(time_text, sizeof(time_text), "Alarm set for 1 day %d hours 1 min from now", hours_f);
+ } else if (days_f > 1 && hours_f == 1 && mins_f == 1) {
+ ALM_INFO("Alarm set for %d days 1 hour 1 min from now", days_f);
+ snprintf(time_text, sizeof(time_text), "Alarm set for %d days 1 hour 1 min from now", days_f);
+ } else if (days_f == 1 && hours_f > 1 && mins_f > 1) {
+ ALM_INFO("Alarm set for 1 day %d hours %d mins from now", hours_f, mins_f);
+ snprintf(time_text, sizeof(time_text), "Alarm set for 1 day %d hour %d mins from now", hours_f, mins_f);
+ } else if (days_f > 1 && hours_f == 1 && mins_f > 1) {
+ ALM_INFO("Alarm set for %d days 1 hour %d mins from now", days_f, mins_f);
+ snprintf(time_text, sizeof(time_text), "Alarm set for %d days 1 hour %d mins from now", days_f, mins_f);
+ } else if (days_f > 1 && hours_f > 1 && mins_f == 1) {
+ ALM_INFO("Alarm set for %d days %d hours 1 min from now", days_f, hours_f);
+ snprintf(time_text, sizeof(time_text), "Alarm set for %d days %d hours 1 min from now", days_f, hours_f);
+ } else if (days_f > 1 && hours_f > 1 && mins_f > 1) {
+ ALM_INFO("Alarm set for %d days %d hours %d mins from now", days_f, hours_f, mins_f);
+ snprintf(time_text, sizeof(time_text), "Alarm set for %d days %d hours %d mins from now", days_f, hours_f, mins_f);
}
return strdup(time_text);
}
diff --git a/src/main.c b/src/main.c
index f38a536..1ceb1e8 100755
--- a/src/main.c
+++ b/src/main.c
@@ -760,7 +760,7 @@ static void _save_button_pressed_edit(void *data, Evas_Object *obj, void *event_
Evas_Object *layout2 = view_get_base_layout();
ALM_INFO("saved time (%d:%d) %d %d %d", saved_time->tm_hour, saved_time->tm_min, saved_time->tm_mday, saved_time->tm_mon, saved_time->tm_year);
ALM_INFO("current_time time (%d:%d) %d %d %d", current_time->tm_hour, current_time->tm_min, current_time->tm_mday, current_time->tm_mon, current_time->tm_year);
- int diff = find_diff(current_time, saved_time);
+ int diff = find_diff(current_time, saved_time, weekly);
if (diff != -1) {
ALM_INFO("time differnce is [%d]", diff);
time_t newt = t+diff;
@@ -1000,6 +1000,7 @@ void update_genlist_first()
_ALM_ENTER_;
Evas_Object *genlist = NULL;
Evas_Object *nf = NULL;
+ Evas_Object *circle_genlist = NULL;
Evas_Object *layout = view_get_base_layout();
Eina_List *local_data = view_get_local_data();
genlist = view_get_genlist();
@@ -1025,6 +1026,8 @@ void update_genlist_first()
populate_genlist();
end_genlist();
//ALM_INFO("local data count after %d ",loc_count);
+ circle_genlist = view_get_circle_genlist();
+ eext_rotary_object_event_activated_set(circle_genlist, EINA_TRUE);
view_send_signal_to_edje(layout, "genlist.show", "alarm");
local_data = view_get_local_data();
loc_count = eina_list_count(local_data);
@@ -1054,11 +1057,13 @@ void update_genlist_first()
}
-void update_genlist(int last_alarm_id, int edit_mode, int type)
+void update_genlist(mode_type e, int type)
{
_ALM_ENTER_;
+ int last_alarm_id = 0;
Evas_Object *genlist = NULL;
Evas_Object *nf = NULL;
+ Evas_Object *circle_genlist = NULL;
Evas_Object *layout = view_get_base_layout();
Eina_List *local_data = view_get_local_data();
genlist = view_get_genlist();
@@ -1066,6 +1071,7 @@ void update_genlist(int last_alarm_id, int edit_mode, int type)
if (genlist)
elm_genlist_clear(genlist);
ALM_INFO("reached 1");
+ ALM_INFO("mode type e is %d", e);
local_data = eina_list_free(local_data);
view_set_local_data(local_data);
@@ -1084,12 +1090,14 @@ void update_genlist(int last_alarm_id, int edit_mode, int type)
populate_genlist();
end_genlist();
//ALM_INFO("local data count after %d ",loc_count);
+ circle_genlist = view_get_circle_genlist();
+ eext_rotary_object_event_activated_set(circle_genlist, EINA_TRUE);
view_send_signal_to_edje(layout, "genlist.show", "alarm");
local_data = view_get_local_data();
loc_count = eina_list_count(local_data);
Elm_Object_Item *it = NULL;
struct genlist_item_data *gendata = NULL;
- if (edit_mode == 1) {
+ if (e == EDIT_MODE) {
if (type) //update
last_alarm_id = global_latest_alarm_id;
else {
@@ -1098,7 +1106,7 @@ void update_genlist(int last_alarm_id, int edit_mode, int type)
last_alarm_id = gendata->alarm_id;
}
- } else {
+ } else if (e == NORMAL_MODE) {
//add
last_alarm_id = global_latest_alarm_id;
}
@@ -1170,7 +1178,7 @@ static void _save_button_pressed(void *data, Evas_Object *obj, void *event_info)
Evas_Object *layout2 = view_get_base_layout();
ALM_INFO("saved time (%d:%d) %d %d %d", saved_time->tm_hour, saved_time->tm_min, saved_time->tm_mday, saved_time->tm_mon, saved_time->tm_year);
ALM_INFO("current_time time (%d:%d) %d %d %d", current_time->tm_hour, current_time->tm_min, current_time->tm_mday, current_time->tm_mon, current_time->tm_year);
- int diff = find_diff(current_time, saved_time);
+ int diff = find_diff(current_time, saved_time, weekly);
if (diff != -1) {
ALM_INFO("time differnce is [%d]", diff);
time_t newt = t+diff;
diff --git a/src/view.c b/src/view.c
index 9d8f205..5e02886 100755
--- a/src/view.c
+++ b/src/view.c
@@ -48,7 +48,7 @@ static struct view_info {
Evas_Object *edit_button;
Evas_Object *edit_ctxpopup;
Evas_Object *delete_button;
-
+ Evas_Object *circle_genlist;
} s_info = {
.win = NULL,
.conform = NULL,
@@ -64,6 +64,7 @@ static struct view_info {
.edit_button = NULL,
.edit_ctxpopup = NULL,
.delete_button = NULL,
+ .circle_genlist = NULL,
};
static Elm_Genlist_Item_Class *_set_genlist_item_class(const char *style);
@@ -75,13 +76,25 @@ static void _popup_hide_cb(void *data, Evas_Object *obj, void *event_info);
static void _block_clicked_cb(void *data, Evas_Object *obj, void *event_info);
static void go_to_normal_mode_cb(void *data EINA_UNUSED, Evas_Object *obj, void *event_info EINA_UNUSED);
//static void _timeout_cb(void *data, Evas_Object *obj, void *event_info);
-
+mode_type f = EDIT_MODE;
Evas_Object *view_get_timepicker(void)
{
_ALM_ENTER_;
return s_info.datetime;
}
+Evas_Object *view_get_circle_genlist(void)
+{
+ _ALM_ENTER_;
+ return s_info.circle_genlist;
+}
+
+void view_set_circle_genlist(Evas_Object *circle_genlist)
+{
+ _ALM_ENTER_;
+ s_info.circle_genlist = circle_genlist;
+}
+
void view_free_s_info()
{
_ALM_ENTER_;
@@ -733,6 +746,17 @@ void view_set_text(Evas_Object *parent, const char *part_name, const char *text)
* @param[parent]: Object to which you want to set naviframe
* @Add callback function will be operated when back key is pressed.
*/
+static void
+eext_naviframe_back_cb1(void *data EINA_UNUSED, Evas_Object *obj, void *event_info EINA_UNUSED)
+{
+ _ALM_ENTER_;
+ ALM_INFO(" Circular genlist active ");
+ Evas_Object *circle_genlist = NULL;
+ circle_genlist = view_get_circle_genlist();
+ eext_rotary_object_event_activated_set(circle_genlist, EINA_TRUE);
+ elm_naviframe_item_pop(obj);
+
+}
Evas_Object *view_create_naviframe(Evas_Object *parent)
{
_ALM_ENTER_;
@@ -753,7 +777,7 @@ Evas_Object *view_create_naviframe(Evas_Object *parent)
nf = elm_naviframe_add(parent);
elm_object_part_content_set(parent, "elm.swallow.content", nf);
- eext_object_event_callback_add(nf, EEXT_CALLBACK_BACK, eext_naviframe_back_cb, NULL);
+ eext_object_event_callback_add(nf, EEXT_CALLBACK_BACK, eext_naviframe_back_cb1, NULL);
eext_object_event_callback_add(nf, EEXT_CALLBACK_MORE, eext_naviframe_more_cb, NULL);
evas_object_show(nf);
@@ -974,7 +998,7 @@ void go_to_normal()
eext_object_event_callback_del(layout, EEXT_CALLBACK_BACK, go_to_normal_mode_cb);
Evas_Object *nf = NULL;
nf = view_get_naviframe();
- eext_object_event_callback_add(nf, EEXT_CALLBACK_BACK, eext_naviframe_back_cb, NULL);
+ eext_object_event_callback_add(nf, EEXT_CALLBACK_BACK, eext_naviframe_back_cb1, NULL);
}
static void go_to_normal_mode_cb(void *data EINA_UNUSED, Evas_Object *obj, void *event_info EINA_UNUSED)
@@ -1010,7 +1034,7 @@ static void go_to_normal_mode_cb(void *data EINA_UNUSED, Evas_Object *obj, void
eext_object_event_callback_del(obj, EEXT_CALLBACK_BACK, go_to_normal_mode_cb);
Evas_Object *nf = NULL;
nf = view_get_naviframe();
- eext_object_event_callback_add(nf, EEXT_CALLBACK_BACK, eext_naviframe_back_cb, NULL);
+ eext_object_event_callback_add(nf, EEXT_CALLBACK_BACK, eext_naviframe_back_cb1, NULL);
//view_send_signal_to_edje(obj, "genlist.show", "alarm");
}
@@ -1041,7 +1065,7 @@ static void _gl_longpress_cb(void *data, Evas_Object *obj, void *event_info)
_ALM_ENTER_;
Evas_Object *nf = NULL;
nf = view_get_naviframe();
- eext_object_event_callback_del(nf, EEXT_CALLBACK_BACK, eext_naviframe_back_cb);
+ eext_object_event_callback_del(nf, EEXT_CALLBACK_BACK, eext_naviframe_back_cb1);
ALM_ERR("_gl_longpress_cb");
Elm_Object_Item *it = (Elm_Object_Item *)event_info;
@@ -1157,7 +1181,12 @@ Evas_Object *view_create_circle_genlist(Evas_Object *parent)
circle_genlist = eext_circle_object_genlist_add(genlist, s_info.circle_surface);
eext_circle_object_genlist_scroller_policy_set(circle_genlist, ELM_SCROLLER_POLICY_OFF, ELM_SCROLLER_POLICY_AUTO);
eext_rotary_object_event_activated_set(circle_genlist, EINA_TRUE);
-
+ view_set_circle_genlist(circle_genlist);
+#if 0
+ circle_genlist = view_get_circle_genlist();
+ eext_rotary_object_event_activated_set(circle_genlist, EINA_TRUE);
+ //evas_object_show(circle_genlist);
+#endif
evas_object_show(genlist);
return genlist;
@@ -1299,6 +1328,7 @@ Evas_Object *view_set_button(Evas_Object *parent, const char *part_name, const c
void view_create_text_popup(Evas_Object *parent, double timeout, const char *text, int id , mode_type e)
{
_ALM_ENTER_;
+ ALM_INFO("view_create_text_popup mode_type e is %d ", e);
Evas_Object *popup = NULL;
Evas_Object *nf = view_get_naviframe();
int e_m = view_get_is_select_mode();
@@ -1320,8 +1350,8 @@ void view_create_text_popup(Evas_Object *parent, double timeout, const char *tex
elm_image_file_set(img, file_path, NULL);
elm_object_part_content_set(popup, "toast,icon", img);
}
-
- evas_object_smart_callback_add(popup, "block,clicked", _block_clicked_cb, NULL);
+ f = e;
+ evas_object_smart_callback_add(popup, "block,clicked", _block_clicked_cb, &f);
if (!e_m) {
if (e != NO_CALLBACK_MODE) {
if (e != EDIT_MODE)
@@ -1605,6 +1635,16 @@ static void _block_clicked_cb(void *data, Evas_Object *obj, void *event_info)
_ALM_ENTER_;
if (!obj) return;
elm_popup_dismiss(obj);
+ mode_type e = *((mode_type *)data);
+ if (e == EDIT_MODE)
+ ALM_INFO("edit mode");
+ else if (e == NORMAL_MODE)
+ ALM_INFO("normal mode");
+ ALM_INFO(" _block_clicked_cbmode type e is %d", e);
+ update_genlist(e, 0);
+ Evas_Object *nf = NULL;
+ nf = view_get_naviframe();
+ eext_object_event_callback_add(nf, EEXT_CALLBACK_BACK, eext_naviframe_back_cb1, NULL);
}
void _timeout_del_cb(void *data, Evas_Object *obj, void *event_info)
@@ -1614,7 +1654,7 @@ void _timeout_del_cb(void *data, Evas_Object *obj, void *event_info)
int last_alarm_id = (int)data;
ALM_INFO(" _timeout_del_cb last_alarm_id temp %ld ", last_alarm_id);
elm_popup_dismiss(obj);
- update_genlist(last_alarm_id , 1, 0);
+ update_genlist(EDIT_MODE, 0);
}
void _timeout_cb(void *data, Evas_Object *obj, void *event_info)
@@ -1624,7 +1664,7 @@ void _timeout_cb(void *data, Evas_Object *obj, void *event_info)
int last_alarm_id = (int)data;
ALM_INFO(" _timeout_cb last_alarm_id temp %ld ", last_alarm_id);
elm_popup_dismiss(obj);
- update_genlist(last_alarm_id , 0, 0);
+ update_genlist(NORMAL_MODE, 0);
}
/*
diff --git a/tizen-manifest.xml b/tizen-manifest.xml
index 1e332fb..6cf1857 100755
--- a/tizen-manifest.xml
+++ b/tizen-manifest.xml
@@ -55,6 +55,7 @@
<icon>org.tizen.alarm.png</icon>
</ui-application>
<privileges>
+ <privilege>http://tizen.org/privilege/haptic</privilege>
<privilege>http://tizen.org/privilege/appmanager.launch</privilege>
<privilege>http://tizen.org/privilege/alarm.get</privilege>
<privilege>http://tizen.org/privilege/alarm.set</privilege>