From 9dca6cfc8913964f14eee459707332f28f4e257b Mon Sep 17 00:00:00 2001 From: Kyoungyong Lee Date: Mon, 21 Nov 2016 10:57:35 +0900 Subject: apply new UX for privacy setting Change-Id: I2402b8d9b12e6f242f7be460ee6a5fea0609af07 --- ui/include/privacy_setting.h | 3 +- ui/include/privacy_view.h | 1 + ui/src/privacy_guard_list_view.c | 2 +- ui/src/privacy_guard_package_list_view.c | 105 +++++++++++++++++-------------- ui/src/privacy_menu_view.c | 4 +- 5 files changed, 63 insertions(+), 52 deletions(-) mode change 100755 => 100644 ui/include/privacy_setting.h diff --git a/ui/include/privacy_setting.h b/ui/include/privacy_setting.h old mode 100755 new mode 100644 index 9e80536..404d148 --- a/ui/include/privacy_setting.h +++ b/ui/include/privacy_setting.h @@ -30,7 +30,8 @@ #include #define PRIVACY_MENU_SETTING "IDS_ST_HEADER_PRIVACY_SETTINGS_ABB" -#define PRIVACY_MENU_ACCESS "Privacy access" +//#define PRIVACY_MENU_MONITOR "IDS_ST_HEADER_PRIVACY_MONITOR" +#define PRIVACY_MENU_MONITOR "Privacy monitor" struct app_data_s { Evas_Object *parent_layout; diff --git a/ui/include/privacy_view.h b/ui/include/privacy_view.h index 484d571..80316ac 100644 --- a/ui/include/privacy_view.h +++ b/ui/include/privacy_view.h @@ -53,6 +53,7 @@ typedef struct item_data { typedef struct { char* pkg_id; int count; + time_t time; int monitor_policy; } pg_data_s; diff --git a/ui/src/privacy_guard_list_view.c b/ui/src/privacy_guard_list_view.c index 2a99c4b..2c3790e 100644 --- a/ui/src/privacy_guard_list_view.c +++ b/ui/src/privacy_guard_list_view.c @@ -87,7 +87,7 @@ void create_privacy_guard_list_view(struct app_data_s *ad) evas_object_show(genlist); /* Change "Privacy Setting" to proper DID : use dgettext() */ - Elm_Object_Item *nf_it = elm_naviframe_item_push(ad->nf, dgettext("privacy-setting", PRIVACY_MENU_ACCESS), common_back_btn_add(ad), NULL, genlist, NULL); + Elm_Object_Item *nf_it = elm_naviframe_item_push(ad->nf, dgettext("privacy-setting", PRIVACY_MENU_MONITOR), common_back_btn_add(ad), NULL, genlist, NULL); elm_object_item_domain_text_translatable_set(nf_it, PACKAGE, EINA_TRUE); } diff --git a/ui/src/privacy_guard_package_list_view.c b/ui/src/privacy_guard_package_list_view.c index 4af7f0f..f01ad10 100644 --- a/ui/src/privacy_guard_package_list_view.c +++ b/ui/src/privacy_guard_package_list_view.c @@ -78,11 +78,9 @@ static char* _gl_text_get_cb(void *data, Evas_Object *obj, const char *part) return strdup(id->label); } -#if 1 if (!strcmp(part, "elm.text.sub") && id->index != 0) { -#else - if (!strcmp(part, "elm.text.sub")) { -#endif + if (id->description == NULL) + return NULL; return strdup(id->description); } @@ -92,10 +90,10 @@ static char* _gl_text_get_cb(void *data, Evas_Object *obj, const char *part) static Evas_Object* _gl_content_get_cb(void *data, Evas_Object *obj, const char *part) { pg_item_data_s *id = (pg_item_data_s*)data; -#if 1 + if (id->index == 0) return NULL; -#endif + if (!strcmp("elm.swallow.icon", part)) { Evas_Object *icon; icon = elm_image_add(obj); @@ -124,11 +122,12 @@ static Evas_Object* _gl_content_get_cb(void *data, Evas_Object *obj, const char return NULL; } -static bool _privacy_package_info_cb(const char *package_id, const int count, const int monitor_policy, void *user_data) +static bool _privacy_package_info_cb(const char *package_id, const int count, time_t time, const int monitor_policy, void *user_data) { pg_data_s *data = (pg_data_s *)malloc(sizeof(pg_data_s)); data->pkg_id = strdup(package_id); data->count = count; + data->time = time; data->monitor_policy = monitor_policy; pg_data_list = g_list_append(pg_data_list, data); @@ -137,16 +136,8 @@ static bool _privacy_package_info_cb(const char *package_id, const int count, co } void create_privacy_guard_package_list_view(struct app_data_s* ad) - { - /* Add genlist */ - Evas_Object *genlist = common_genlist_add(ad->nf); - - evas_object_size_hint_weight_set(genlist, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); - evas_object_size_hint_align_set(genlist, EVAS_HINT_FILL, EVAS_HINT_FILL); - - /* Set itc */ - Elm_Genlist_Item_Class *itc = elm_genlist_item_class_new(); + Evas_Object *genlist = NULL; /* Get privacy guard data (pkg, count, policy) list by a privacy */ if (pg_data_list!= NULL) { @@ -161,57 +152,68 @@ void create_privacy_guard_package_list_view(struct app_data_s* ad) int res = privacy_guard_client_foreach_package_info_by_privacy_id(user_id, ad->privacy, _privacy_package_info_cb, NULL); log_if(res != PRIV_GUARD_ERROR_SUCCESS, 1, "privacy_guard_client_foreach_package_info_by_privacy_id() is failed. [%d]", res); - itc->item_style = "type1"; - itc->func.content_get = _gl_content_get_cb; - itc->func.text_get = _gl_text_get_cb; - itc->func.del = _gl_del_cb; - -#if 1 // no content in the genlist if (!pg_data_list) { - - - Elm_Object_Item *it = NULL; - char temp[256] = {'\0',}; char* privacy_display = NULL; - pg_item_data_s *item = calloc(sizeof(pg_item_data_s), 1); - item->index = 0; res = privilege_info_get_privacy_display(ad->privacy, &privacy_display); log_if(res != PRVMGR_ERR_NONE, 1, "privilege_info_get_privacy_display() is failed. [%d]", res); - snprintf(temp, sizeof(temp), "No app using %s privacy.", privacy_display); - item->label = strdup(temp); + genlist = elm_layout_add(ad->nf); + elm_layout_theme_set(genlist, "layout", "nocontents", "default"); + evas_object_size_hint_weight_set(genlist, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); + evas_object_size_hint_align_set(genlist, EVAS_HINT_FILL, EVAS_HINT_FILL); + + // TOBE ///////////////////////////////////////////////////////////////////////////////// + //elm_object_part_text_set(genlist, "elm.text", dgettext("privacy-setting", "IDS_ST_NPBODY_NO_APPS")); + //char* no_app_string_format = dgettext("privacy-setting", "IDS_ST_BODY_AFTER_YOU_DOWNLOAD_APPS_THAT_USE_PS_THEY_WILL_BE_SHOWN_HERE"); + //char no_app_string[256]; + //snprintf(no_app_string, sizeof(no_app_string), no_app_string_format, privacy_display); + ///////////////////////////////////////////////////////////////////////////////////////// + + // temp - SHOULD BE REPLACED TO ABOVE ONE /////////////////////////////////////////////// + elm_object_part_text_set(genlist, "elm.text", "No apps"); + char no_app_string[256]; + snprintf(no_app_string, sizeof(no_app_string), "After you download apps that use %s, they will be shown here.", privacy_display); + ///////////////////////////////////////////////////////////////////////////////////////// + + elm_object_part_text_set(genlist, "elm.help.text", no_app_string); + elm_layout_signal_emit(genlist, "align.center", "elm"); + } else { + genlist = common_genlist_add(ad->nf); + evas_object_size_hint_weight_set(genlist, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); + evas_object_size_hint_align_set(genlist, EVAS_HINT_FILL, EVAS_HINT_FILL); - // append to the genlist - it = elm_genlist_item_append(genlist, itc, item, NULL, ELM_GENLIST_ITEM_NONE, _privacy_package_selected_cb, item); - log_if(it == NULL, 1, "Error in elm_genlist_item_append"); - elm_genlist_item_select_mode_set(it, ELM_OBJECT_SELECT_MODE_DISPLAY_ONLY); + /* Set itc */ + Elm_Genlist_Item_Class *itc = elm_genlist_item_class_new(); - } else { -#endif + itc->item_style = "type1"; + itc->func.content_get = _gl_content_get_cb; + itc->func.text_get = _gl_text_get_cb; + itc->func.del = _gl_del_cb; Elm_Object_Item *it = NULL; GList* l; -#if 1 /* Append guide text to the top of genlist */ pg_item_data_s *description_item = calloc(sizeof(pg_item_data_s), 1); description_item->index = 0; + char tmp[256] = {'\0',}; - snprintf(tmp, sizeof(tmp), "The recording of privacy access will be enabled for the selected apps."); + snprintf(tmp, sizeof(tmp), "The selected apps will be monitored for any attempts to violate your privacy."); + //snprintf(tmp, sizeof(tmp), "%s", dgettext("privacy-setting", "IDS_ST_BODY_THE_SELECTED_APPS_WILL_BE_MONITORED_FOR_ANY_ATTEMPTS_TO_VIOLATE_YOUR_PRIVACY")); description_item->label = strdup(tmp); + it = elm_genlist_item_append(genlist, itc, description_item, NULL, ELM_GENLIST_ITEM_NONE, _privacy_package_selected_cb, description_item); elm_genlist_item_select_mode_set(it, ELM_OBJECT_SELECT_MODE_DISPLAY_ONLY); /* Append privacy related package as genlist item */ int i = 1; -#else - int i = 0; -#endif for (l = pg_data_list; l != NULL; l = l->next) { pg_item_data_s *item = calloc(sizeof(pg_item_data_s), 1); pg_data_s* data = (pg_data_s*)l->data; char temp[256] = {'\0',}; + char str_time[32] = {'\0',}; + struct tm *timeinfo = NULL; char *label = NULL; char* icon = NULL; pkgmgrinfo_pkginfo_h handle; @@ -241,10 +243,18 @@ void create_privacy_guard_package_list_view(struct app_data_s* ad) snprintf(temp, sizeof(temp), "%s", label); item->label = strdup(temp); - // description - snprintf(temp, sizeof(temp), "%d time(s)", data->count); - //snprintf(temp, sizeof(temp), "%d %s", data->count, dgettext("privacy-setting", "IDS_CLD_OPT_TIMES_LC")); - item->description = strdup(temp); + // description - 13/08/2010 01:30 AM 21 time(s) + if (data->time > 0) { + LOGD("time : %d", data->time); + timeinfo = localtime(&data->time); + LOGD("time : %s", asctime(timeinfo)); + strftime (str_time, 32, "%d/%m/%Y %I:%M %p", timeinfo); + snprintf(temp, sizeof(temp), "%s %d time(s)", str_time, data->count); + //snprintf(temp, sizeof(temp), "%s %d %s", str_time, data->count, dgettext("privacy-setting", "IDS_CLD_BODY_PD_TIMES")); + item->description = strdup(temp); + } else { + item->description = NULL; + } // user ID item->user_id = user_id; @@ -277,11 +287,10 @@ void create_privacy_guard_package_list_view(struct app_data_s* ad) it = elm_genlist_item_append(genlist, itc, item, NULL, ELM_GENLIST_ITEM_NONE, _privacy_package_selected_cb, item); log_if(it == NULL, 1, "Error in elm_genlist_item_append"); } -#if 1 + + elm_genlist_item_class_free(itc); } -#endif - elm_genlist_item_class_free(itc); evas_object_show(genlist); /* TODO: change nf_it_title to proper DID : use dgettext() */ diff --git a/ui/src/privacy_menu_view.c b/ui/src/privacy_menu_view.c index b49a4f5..5cc8572 100644 --- a/ui/src/privacy_menu_view.c +++ b/ui/src/privacy_menu_view.c @@ -72,7 +72,7 @@ static void menu_selected_cb(void *data, Evas_Object *obj, void *event_info) if (strstr(selected_id->menu, PRIVACY_MENU_SETTING) != NULL) { create_privacy_list_view(ad); - } else if (strstr(selected_id->menu, PRIVACY_MENU_ACCESS) != NULL) {/* privacy guard */ + } else if (strstr(selected_id->menu, PRIVACY_MENU_MONITOR) != NULL) {/* privacy guard */ create_privacy_guard_list_view(ad); } else { LOGE("selected_id->title = %s, no matching menu", selected_id->menu); @@ -90,7 +90,7 @@ void create_privacy_menu_view(struct app_data_s *ad) /* Set privacy menu list */ privacy_menu_list = NULL; privacy_menu_list = g_list_append(privacy_menu_list, PRIVACY_MENU_SETTING); - privacy_menu_list = g_list_append(privacy_menu_list, PRIVACY_MENU_ACCESS); + privacy_menu_list = g_list_append(privacy_menu_list, PRIVACY_MENU_MONITOR); Elm_Genlist_Item_Class *itc = elm_genlist_item_class_new(); itc->item_style = "default"; -- cgit v1.2.3