diff options
author | Jihoon Jung <jh8801.jung@samsung.com> | 2016-06-28 21:18:21 +0900 |
---|---|---|
committer | Jihoon Jung <jh8801.jung@samsung.com> | 2016-06-28 21:19:45 +0900 |
commit | 5ecc89f0baed31d452e402d08225254960ef08fa (patch) | |
tree | 37a6a2ab0ae3a1b8f277dd0775faaf3fdbf2dcf0 | |
parent | b28ed53738836a809d9404a3a468e8cf040da70f (diff) | |
download | ug-nfc-efl-5ecc89f0baed31d452e402d08225254960ef08fa.tar.gz ug-nfc-efl-5ecc89f0baed31d452e402d08225254960ef08fa.tar.bz2 ug-nfc-efl-5ecc89f0baed31d452e402d08225254960ef08fa.zip |
[TSAM-5643] Refactoring structure for NFC viewsubmit/tizen/20160628.234119accepted/tizen/wearable/20160629.021639accepted/tizen/mobile/20160629.021656accepted/tizen/common/20160629.222749
Signed-off-by: Jihoon Jung <jh8801.jung@samsung.com>
Change-Id: I4cb01af41978c6e32062c024b306a8316cbd8160
-rw-r--r-- | packaging/ug-nfc-efl.spec | 2 | ||||
-rwxr-xr-x | wearable/app/include/nsa-main.h | 52 | ||||
-rwxr-xr-x | wearable/app/include/nsa-string.h | 2 | ||||
-rwxr-xr-x[-rw-r--r--] | wearable/app/include/nsa-ui-widget.h | 6 | ||||
-rwxr-xr-x | wearable/app/include/nsa-view.h | 7 | ||||
-rwxr-xr-x | wearable/app/src/nsa-main.c | 375 | ||||
-rwxr-xr-x[-rw-r--r--] | wearable/app/src/nsa-ui-widget.c | 75 | ||||
-rwxr-xr-x | wearable/app/src/nsa-view-main.c | 482 | ||||
-rwxr-xr-x | wearable/app/src/nsa-view-tap-n-pay.c | 765 |
9 files changed, 381 insertions, 1385 deletions
diff --git a/packaging/ug-nfc-efl.spec b/packaging/ug-nfc-efl.spec index c872856..0b9b484 100644 --- a/packaging/ug-nfc-efl.spec +++ b/packaging/ug-nfc-efl.spec @@ -16,7 +16,7 @@ ExcludeArch: %{arm} %ix86 x86_64 Name: ug-nfc-efl Summary: NFC Setting UI -Version: 3.1.0 +Version: 3.1.1 Release: 0 Group: App/Network License: Flora-1.1 diff --git a/wearable/app/include/nsa-main.h b/wearable/app/include/nsa-main.h index ed13912..f1b70ae 100755 --- a/wearable/app/include/nsa-main.h +++ b/wearable/app/include/nsa-main.h @@ -43,42 +43,36 @@ extern "C" #define TABLE_PATH TABLEDIR #define EDJ_FILE EDJDIR"/"APPNAME".edj" -typedef enum { - NSA_ERROR = -1, - NSA_OK = 0 -} nsa_result_e; +enum { + V_MAIN = 0, + V_TAP_N_PAY +}; -typedef enum { - NSA_OP_NONE = -1, - NSA_OP_NFC = 0, - NSA_OP_NFC_HELP = 1, - NSA_OP_SBEAM = 2, - NSA_OP_SBEAM_HELP = 3, - NSA_OP_TAP_N_PAY = 4 -} nsa_operation_type; +typedef struct { + char *appid; + int aid_count; +} wallet_info_t; -struct appdata { - Evas_Object *win_main; - Evas_Object *ly_main; - Evas_Object *bg; +typedef struct { + Evas_Object *main_win; + Evas_Object *main_layout; + Evas_Object *main_bg; Evas_Object *conform; Eext_Circle_Surface *circle_surface; - Evas_Object *navi_frame; - Evas_Object *popup; - Elm_Object_Item *base_navi_it; - GArray *circle_obj_list; - int circle_obj_list_idx; - - nsa_operation_type op_type; - /* changeable UI */ - Eina_List *color_table; - Eina_List *font_table; + Evas_Object *popup; + Evas_Object *navi_frame; + int current_view; - app_control_h caller_appctrl; -}; + char *payment_handler; + Elm_Object_Item *on_off; + Elm_Object_Item *tap_n_pay; + Evas_Object *main_genlist; -inline Evas_Object *nsa_get_main_window(void); + int payment_wallet_cnt; + GArray *payment_wallet_list; + Evas_Object *radio_main; +} appdata; #ifdef __cplusplus } diff --git a/wearable/app/include/nsa-string.h b/wearable/app/include/nsa-string.h index 479959a..3db18df 100755 --- a/wearable/app/include/nsa-string.h +++ b/wearable/app/include/nsa-string.h @@ -30,8 +30,6 @@ extern "C" #define POPUP_TEXT_SIZE 1024 #define LABEL_TEXT_SIZE 1024 -#define _(s) gettext(s) - ///////////////////////////////////////////////////////////////////////////// // NFC SETTING START ++++++++++++++++++++++++++++++++++++++++++++++++++++++++ ///////////////////////////////////////////////////////////////////////////// diff --git a/wearable/app/include/nsa-ui-widget.h b/wearable/app/include/nsa-ui-widget.h index 14761d0..47e0154 100644..100755 --- a/wearable/app/include/nsa-ui-widget.h +++ b/wearable/app/include/nsa-ui-widget.h @@ -30,13 +30,11 @@ extern "C" #endif /* __cplusplus */ /************************** API **************************/ +Evas_Object* nsa_create_main_win(const char *name); Evas_Object *nsa_create_main_layout(Evas_Object *parent); -Evas_Object *nsa_create_theme_layout(Evas_Object *parent, - const char *clas, const char *group, const char *style); Evas_Object *nsa_create_bg(Evas_Object *parent); Evas_Object* nsa_create_conformant(Evas_Object *parent); -Evas_Object* nsa_create_edj_layout(Evas_Object* parent, - char *edc_path); +Evas_Object* nsa_create_edj_layout(Evas_Object* parent, char *edc_path); #ifdef __cplusplus } diff --git a/wearable/app/include/nsa-view.h b/wearable/app/include/nsa-view.h index 410e0a0..2e2069f 100755 --- a/wearable/app/include/nsa-view.h +++ b/wearable/app/include/nsa-view.h @@ -31,11 +31,8 @@ extern "C" { #endif /* __cplusplus */ -int _nsa_view_main_create(void *data); -void _nsa_view_main_destroy(void *data); - -int _nsa_view_tap_n_pay_create(void *data); -void _nsa_view_tap_n_pay_destroy(void *data); +bool _nsa_view_main_create(void *data); +bool _nsa_view_tap_n_pay_create(void *data); #ifdef __cplusplus } diff --git a/wearable/app/src/nsa-main.c b/wearable/app/src/nsa-main.c index d6f229e..95416ef 100755 --- a/wearable/app/src/nsa-main.c +++ b/wearable/app/src/nsa-main.c @@ -27,230 +27,53 @@ #include "nsa-ui-widget.h" #include "nsa-popup.h" -#define UG_NFC_APPCONTROL_TIZEN \ - "http://tizen.org/appcontrol/operation/setting/nfc" -#define SETTING_TYPE_NFC "nfc" -#define SETTING_TYPE_TAP_N_PAY "tap_n_pay" - -#define NFC_SETTING_APP_ID \ - "org.tizen.nfc-setting-app" - -static struct appdata ad; - - -static void __tts_vconf_key_changed (keynode_t *key, - void *data) -{ - int boolval = 0; - - NSA_DEBUG("__tts_vconf_key_changed"); - - - if(VCONF_OK != vconf_get_bool(VCONFKEY_SETAPPL_ACCESSIBILITY_TTS, - &boolval)) { - NSA_DEBUG_ERR("vconf_get_bool failed"); - } else { - NSA_DEBUG("boolval[%d]", boolval); - - if (boolval) - elm_exit(); - } -} - -static void __win_del(void *data, Evas_Object *obj, void *event) -{ - elm_exit(); -} - -static Evas_Object* __nsa_main_create_win(const char *name) -{ - Evas_Object *eo; - int w, h; - - retv_if(name == NULL, NULL); - - NSA_BEGIN(); - -#if defined(PROCESS_POOL) - eo = (Evas_Object *)app_get_preinitialized_window(name); - if (eo == NULL) { - NSA_DEBUG_ERR("get window fail"); - eo = elm_win_add(NULL, name, ELM_WIN_BASIC); - } -#else - eo = elm_win_add(NULL, name, ELM_WIN_BASIC); -#endif - retv_if(eo == NULL, NULL); - - if (eo) { - elm_win_title_set(eo, name); - evas_object_smart_callback_add(eo, "delete,request", __win_del, - NULL); - elm_win_screen_size_get(eo, NULL, NULL, &w, &h); - evas_object_resize(eo, w, h); - } - - NSA_END(); - return eo; -} - -static int __parse_service(app_control_h service, void *data) +static Eina_Bool __back_clicked_cb(void *data, Evas *evas, Evas_Object *obj, void *event_info) { - struct appdata *ad = (struct appdata *)data; - char *operation = NULL; - char *app_id = NULL; - char *ex_data = NULL; - - retv_if(ad == NULL, NSA_ERROR); + appdata *ad = data; + NSA_DEBUG_ERR("back click cb : view depth is %d", ad->current_view); - app_control_get_operation(service, &operation); - app_control_get_app_id(service, &app_id); - app_control_get_extra_data(service, "type", &ex_data); - - NSA_DEBUG("operation [%s] >>>>> ", GET_SAFE_STRING(operation)); - NSA_DEBUG("app_id [%s] >>>>> ", GET_SAFE_STRING(app_id)); - NSA_DEBUG("extra data [%s] >>>>> ", GET_SAFE_STRING(ex_data)); - - ad->op_type = NSA_OP_NONE; - if (!ex_data) { - NSA_DEBUG_ERR("extra data is NULL"); - goto end; - } + elm_naviframe_item_pop(ad->navi_frame); - if (strncmp(operation, UG_NFC_APPCONTROL_TIZEN, - strlen(UG_NFC_APPCONTROL_TIZEN)) == 0) { + if (ad->current_view == V_TAP_N_PAY) { + Evas_Object *circle_obj; - /* launched by app-control */ - if (strncmp(ex_data, SETTING_TYPE_NFC, - strlen(SETTING_TYPE_NFC)) == 0) { - ad->op_type = NSA_OP_NFC; - } else if (strncmp(ex_data, SETTING_TYPE_TAP_N_PAY, - strlen(SETTING_TYPE_TAP_N_PAY)) == 0) { - ad->op_type = NSA_OP_TAP_N_PAY; - } - } else if (strncmp(operation, APP_CONTROL_OPERATION_DEFAULT, - strlen(APP_CONTROL_OPERATION_DEFAULT)) == 0) { + /* release Tap & Pay view */ + if (ad->payment_wallet_list != NULL) { + int i; + NSA_DEBUG_ERR("wallet count is %d", ad->payment_wallet_cnt); + for (i = 0; i < ad->payment_wallet_cnt; i++) { + wallet_info_t *winfo = NULL; - if (!app_id) { - NSA_DEBUG_ERR("app_id is NULL"); - goto end; - } + winfo = g_array_index(ad->payment_wallet_list, wallet_info_t *, i); + NSA_MEM_FREE(winfo->appid); + NSA_MEM_FREE(winfo); + } - if (strncmp(app_id, NFC_SETTING_APP_ID, - strlen(NFC_SETTING_APP_ID)) != 0) { - NSA_DEBUG_ERR("app_id is wrong"); - goto end; + g_array_free(ad->payment_wallet_list, FALSE); + ad->payment_wallet_list = NULL; } - if (strncmp(ex_data, SETTING_TYPE_NFC, - strlen(SETTING_TYPE_NFC)) == 0) { - ad->op_type = NSA_OP_NFC; - } else if (strncmp(ex_data, SETTING_TYPE_TAP_N_PAY, - strlen(SETTING_TYPE_TAP_N_PAY)) == 0) { - ad->op_type = NSA_OP_TAP_N_PAY; - } - } - -end: - NSA_MEM_FREE(operation); - NSA_MEM_FREE(app_id); - NSA_MEM_FREE(ex_data); - - if (ad->op_type == NSA_OP_NONE) - return NSA_ERROR; - else - return NSA_OK; -} - -static int __launch_nfc_setting(void *data) -{ - if (NFC_ERROR_NONE != nfc_manager_initialize()) - NSA_DEBUG_ERR("nfc_manager_initialize FAIL!!!!"); - - return _nsa_view_main_create(data); -} - -static int __launch_tap_n_pay_setting(void *data) -{ - if (NFC_ERROR_NONE != nfc_manager_initialize()) - NSA_DEBUG_ERR("nfc_manager_initialize FAIL!!!!"); - - return _nsa_view_tap_n_pay_create(data); -} - - -static void __rot_changed_cb(void *data, Evas_Object *obj, void *event) -{ - struct appdata *ad = (struct appdata *)data; - int angle; - - ret_if(ad == NULL); - - angle = elm_win_rotation_get(ad->win_main); - elm_win_rotation_with_resize_set(ad->win_main, angle); - - NSA_DEBUG("angle[%d]", angle); -} - -static int __transient_app_cb(void *data) -{ - NSA_DEBUG("__transient_app_cb"); - - return 0; -} - -static void __reply_svc_requests(app_control_h src_svc) -{ - app_control_h service; - int ret; - - app_control_create(&service); - ret_if(service == NULL); - - ret = app_control_reply_to_launch_request(service, src_svc, - APP_CONTROL_RESULT_SUCCEEDED); - if (ret != APP_CONTROL_ERROR_NONE) - NSA_DEBUG_ERR("app_control_reply_to_launch_request failed"); - - app_control_destroy(service); -} - -void _nsa_main_lang_changed(void *data) -{ - struct appdata *ad = (struct appdata *)data; - ret_if(ad == NULL); - - NSA_BEGIN(); - - /* To do */ - - NSA_END(); -} - -void _nsa_main_region_changed(void* data) -{ - NSA_BEGIN(); - NSA_END(); -} - -int _nsa_main_keydown_cb(void *data, int type, void *event) -{ - struct appdata *ad = (struct appdata *)data; - Ecore_Event_Key *ev = (Ecore_Event_Key *)event; - - retv_if(ad == NULL, NSA_ERROR); - retv_if(ev == NULL, NSA_ERROR); + ad->payment_wallet_cnt = 0; + ad->radio_main = NULL; + ad->current_view = V_MAIN; - NSA_BEGIN(); + circle_obj = eext_circle_object_genlist_add(ad->main_genlist, ad->circle_surface); + eext_circle_object_genlist_scroller_policy_set(circle_obj, + ELM_SCROLLER_POLICY_OFF, ELM_SCROLLER_POLICY_AUTO); + eext_rotary_object_event_activated_set(circle_obj, EINA_TRUE); + } else if (ad->current_view == V_MAIN) { + /* release Main view and exit application */ + NSA_MEM_FREE(ad->payment_handler); - NSA_END(); + ui_app_exit(); + } - return EXIT_FAILURE; + return EINA_FALSE; } bool _nsa_main_app_create(void *user_data) { - struct appdata *ad = (struct appdata *)user_data; + appdata *ad = user_data; NSA_DEBUG("_nsa_main_app_create start"); @@ -259,50 +82,36 @@ bool _nsa_main_app_create(void *user_data) bindtextdomain("setting-nfc-efl", "/usr/apps/org.tizen.nfc-setting-app/res/locale"); textdomain("setting-nfc-efl"); - /* set scale */ - elm_app_base_scale_set(1.3); + if (nfc_manager_initialize() != NFC_ERROR_NONE) + NSA_DEBUG_ERR("nfc_manager_initialize failed"); /* create window */ - ad->win_main = __nsa_main_create_win(APPNAME); - retv_if(ad->win_main == NULL, false); - evas_object_show(ad->win_main); + ad->main_win = nsa_create_main_win(APPNAME); + retv_if(ad->main_win == NULL, false); /* create conformant */ - ad->conform = nsa_create_conformant(ad->win_main); + ad->conform = nsa_create_conformant(ad->main_win); retv_if(ad->conform == NULL, false); + + /* create circle surface */ ad->circle_surface = eext_circle_surface_conformant_add(ad->conform); + retv_if(ad->circle_surface == NULL, false); /* create bg */ - ad->bg = nsa_create_bg(ad->conform); - retv_if(ad->bg == NULL, false); + ad->main_bg = nsa_create_bg(ad->conform); + retv_if(ad->main_bg == NULL, false); /* create base layout */ - ad->ly_main = nsa_create_main_layout(ad->conform); - retv_if(ad->ly_main == NULL, false); - elm_object_content_set(ad->conform, ad->ly_main); - elm_win_conformant_set(ad->win_main, EINA_TRUE); + ad->main_layout = nsa_create_main_layout(ad->conform); + retv_if(ad->main_layout == NULL, false); /* create naviframe */ - ad->navi_frame = elm_naviframe_add(ad->ly_main); + ad->navi_frame = elm_naviframe_add(ad->main_layout); retv_if(ad->navi_frame == NULL, false); - elm_object_part_content_set(ad->ly_main, "elm.swallow.content", - ad->navi_frame); - evas_object_show(ad->navi_frame); - /* enable rotation */ - if (elm_win_wm_rotation_supported_get(ad->win_main)) { - int rots[4] = { 0, 90, 180, 270 }; - elm_win_wm_rotation_available_rotations_set(ad->win_main, - (const int *)&rots, 4); - evas_object_smart_callback_add(ad->win_main, - "wm,rotation,changed", __rot_changed_cb, ad); - } else { - NSA_DEBUG_ERR("elm_win_wm_rotation_supported_get failed"); - } - - /* create circle_obj_list */ - ad->circle_obj_list = g_array_new(FALSE, FALSE, sizeof(Evas_Object *)); - ad->circle_obj_list_idx = -1; + elm_object_part_content_set(ad->main_layout, "elm.swallow.content", ad->navi_frame); + evas_object_show(ad->navi_frame); + eext_object_event_callback_add(ad->navi_frame, EEXT_CALLBACK_BACK, __back_clicked_cb, ad); NSA_DEBUG("_nsa_main_app_create end"); @@ -311,108 +120,46 @@ bool _nsa_main_app_create(void *user_data) void _nsa_main_app_terminate(void *user_data) { - struct appdata *ad = (struct appdata *)user_data; - ret_if(ad == NULL); + appdata *ad = user_data; NSA_DEBUG("_nsa_main_app_terminate start"); - /* The request from setting team */ - __reply_svc_requests(ad->caller_appctrl); + ret_if(ad == NULL); - /* unset nfc client + */ if (nfc_manager_deinitialize() != NFC_ERROR_NONE) NSA_DEBUG_ERR("nfc_manager_deinitialize failed"); - /* unset nfc client - */ - - if (VCONF_OK != vconf_ignore_key_changed(VCONFKEY_SETAPPL_ACCESSIBILITY_TTS, - __tts_vconf_key_changed)) { - NSA_DEBUG_ERR("vconf_ignore_key_changed error"); - } - - g_array_free(ad->circle_obj_list, FALSE); NSA_DEBUG("_nsa_main_app_terminate end"); } -void _nsa_main_app_pause(void *user_data) -{ - struct appdata *ad = (struct appdata *)user_data; - ret_if(ad == NULL); - - NSA_DEBUG("_nsa_main_app_pause start"); - - NSA_DEBUG("_nsa_main_app_pause end"); -} - -void _nsa_main_app_resume(void *user_data) -{ - struct appdata *ad = (struct appdata *)user_data; - ret_if(ad == NULL); - - NSA_DEBUG("_nsa_main_app_resume start"); - - NSA_DEBUG("_nsa_main_app_resume end"); -} - void _nsa_main_app_service(app_control_h service, void *user_data) { - struct appdata *ad = (struct appdata *)user_data; - int result = NSA_ERROR; + appdata *ad = user_data; NSA_DEBUG("_nsa_main_app_service start"); ret_if(ad == NULL); - /* parse service data */ - /* - result = __parse_service(service, ad); - if (result != NSA_OK) { - NSA_DEBUG_ERR("__parse_service failed[%d]", result); - - elm_exit(); - return; - } - */ - ad->op_type = NSA_OP_NFC; - - /* launch nss */ - if (ad->op_type == NSA_OP_NFC){ - result = __launch_nfc_setting(ad); - } else { - result = __launch_tap_n_pay_setting(ad); - } - if (result != NSA_OK) { - NSA_DEBUG_ERR("__launch_nfc_setting failed[%d]", result); - - elm_exit(); - return; - } + _nsa_view_main_create(ad); + elm_win_activate(ad->main_win); - elm_win_activate(ad->win_main); - - /* the service will be used when app is terminated */ - app_control_clone(&(ad->caller_appctrl), service); - - NSA_DEBUG("_nss_main_app_service end"); + NSA_DEBUG("_nsa_main_app_service end"); } int main(int argc, char* argv[]) { - NSA_DEBUG("main start"); - + appdata ad; ui_app_lifecycle_callback_s event_callback = {0,}; + NSA_DEBUG("app start"); + event_callback.create = _nsa_main_app_create; event_callback.terminate = _nsa_main_app_terminate; - event_callback.pause = _nsa_main_app_pause; - event_callback.resume = _nsa_main_app_resume; event_callback.app_control = _nsa_main_app_service; - return ui_app_main(argc, argv, &event_callback, &ad); -} + NSA_DEBUG("app end"); -inline Evas_Object *nsa_get_main_window(void) -{ - return ad.win_main; -} + memset(&ad, 0x0, sizeof(appdata)); + return ui_app_main(argc, argv, &event_callback, &ad); +} diff --git a/wearable/app/src/nsa-ui-widget.c b/wearable/app/src/nsa-ui-widget.c index b110401..1e8e677 100644..100755 --- a/wearable/app/src/nsa-ui-widget.c +++ b/wearable/app/src/nsa-ui-widget.c @@ -24,32 +24,37 @@ #include "nsa-debug.h" #include "nsa-util.h" +static void __win_del(void *data, Evas_Object *obj, void *event) +{ + elm_exit(); +} -Evas_Object *nsa_create_main_layout(Evas_Object *parent) +Evas_Object* nsa_create_main_win(const char *name) { - Evas_Object *layout; + Evas_Object *eo; + int w, h; - retv_if(parent == NULL, NULL); + retv_if(name == NULL, NULL); NSA_BEGIN(); - layout = elm_layout_add(parent); - retv_if(layout == NULL, NULL); + eo = elm_win_add(NULL, name, ELM_WIN_BASIC); + retv_if(eo == NULL, NULL); - elm_object_focus_set(layout, EINA_FALSE); - elm_layout_theme_set(layout, "layout", "application", "default"); - evas_object_size_hint_weight_set(layout, EVAS_HINT_EXPAND, - EVAS_HINT_EXPAND); + if (eo) { + elm_win_title_set(eo, name); + evas_object_smart_callback_add(eo, "delete,request", __win_del, NULL); + elm_win_screen_size_get(eo, NULL, NULL, &w, &h); + evas_object_resize(eo, w, h); + } - evas_object_show(layout); + evas_object_show(eo); NSA_END(); - - return layout; + return eo; } -Evas_Object *nsa_create_theme_layout(Evas_Object *parent, - const char *clas, const char *group, const char *style) +Evas_Object *nsa_create_main_layout(Evas_Object *parent) { Evas_Object *layout; @@ -61,12 +66,15 @@ Evas_Object *nsa_create_theme_layout(Evas_Object *parent, retv_if(layout == NULL, NULL); elm_object_focus_set(layout, EINA_FALSE); - elm_layout_theme_set(layout, clas, group, style); + elm_layout_theme_set(layout, "layout", "application", "default"); evas_object_size_hint_weight_set(layout, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); evas_object_show(layout); + elm_object_content_set(parent, layout); + elm_win_conformant_set(layout, EINA_TRUE); + NSA_END(); return layout; @@ -75,29 +83,12 @@ Evas_Object *nsa_create_theme_layout(Evas_Object *parent, Evas_Object *nsa_create_bg(Evas_Object *parent) { Evas_Object *bg; -#if defined(PROCESS_POOL) - Evas_Object *win; -#endif - retv_if(parent == NULL, NULL); NSA_BEGIN(); -#if defined(PROCESS_POOL) - win = (Evas_Object *)app_get_preinitialized_window(PACKAGE); - if (win == parent) { - bg = app_get_preinitialized_background(); - if (bg == NULL) { - NSA_DEBUG_ERR("get bg fail"); - bg = elm_bg_add(parent); - } - } else { - NSA_DEBUG_ERR("win is different"); - bg = elm_bg_add(parent); - } -#else bg = elm_bg_add(parent); -#endif + retv_if(bg == NULL, NULL); evas_object_size_hint_weight_set(bg, EVAS_HINT_EXPAND, @@ -114,29 +105,13 @@ Evas_Object *nsa_create_bg(Evas_Object *parent) Evas_Object *nsa_create_conformant(Evas_Object *parent) { Evas_Object *conform; -#if defined(PROCESS_POOL) - Evas_Object *win; -#endif retv_if(parent == NULL, NULL); NSA_BEGIN(); -#if defined(PROCESS_POOL) - win = (Evas_Object *)app_get_preinitialized_window(PACKAGE); - if (win == parent) { - conform = (Evas_Object *)app_get_preinitialized_conformant(); - if (conform == NULL) { - NSA_DEBUG_ERR("get conform fail"); - conform = elm_conformant_add(parent); - } - } else { - NSA_DEBUG_ERR("win is different"); - conform = elm_conformant_add(parent); - } -#else conform = elm_conformant_add(parent); -#endif + retv_if(conform == NULL, NULL); evas_object_size_hint_weight_set(conform, EVAS_HINT_EXPAND, diff --git a/wearable/app/src/nsa-view-main.c b/wearable/app/src/nsa-view-main.c index 9764176..80523a1 100755 --- a/wearable/app/src/nsa-view-main.c +++ b/wearable/app/src/nsa-view-main.c @@ -30,75 +30,6 @@ #include "nsa-popup.h" #include "nsa-string.h" - -typedef enum { - T_NFC = 0, - T_TAP_N_PAY, - - T_MAX -} nfc_setting_type_e; - -typedef struct { - Elm_Object_Item *obj_item[T_MAX]; - Evas_Object *nf; - bool isProgressing; - - struct appdata *ad; -} main_view_data_t; - -static main_view_data_t *view_data; -static char *payment_handler; - -/////////////////////////////////////////////////////////////////////////////// - -static Eina_Bool __back_clicked_cb(void *data, Elm_Object_Item *it) -{ - main_view_data_t *vd = (main_view_data_t *)data; - - NSA_DEBUG("__back_clicked_cb"); - - if (vd != NULL) { - struct appdata *ad = vd->ad; - - _nsa_view_main_destroy(ad); - } - - ui_app_exit(); - - return EINA_FALSE; -} - -#if 0 -static void __MDM_restriced_popup_response_cb(void *data, - Evas_Object *obj, void *event_info) -{ - main_view_data_t *vd = (main_view_data_t *)data; - struct appdata *ad; - - ret_if(vd == NULL); - - ad = (struct appdata *)vd->ad; - ret_if(ad == NULL); - - ret_if(ad == NULL); - ret_if(ad->popup == NULL); - - NSA_DEBUG("__MDM_restriced_popup_response_cb"); - - elm_popup_dismiss(ad->popup); -} -#endif - -static main_view_data_t *__get_view_data() -{ - return view_data; -} - -static void __set_view_data(main_view_data_t *data) -{ - view_data = data; -} - static void __get_payment_handler(char **handler) { char *appid; @@ -133,249 +64,103 @@ static void __get_payment_handler(char **handler) static void __update_onoff_obj(void *data) { - main_view_data_t *vd = (main_view_data_t *)data; - Elm_Object_Item *it; - - ret_if(vd == NULL); - - it = vd->obj_item[T_NFC]; - ret_if(it == NULL); + appdata *ad = data; + ret_if(ad == NULL); NSA_DEBUG("__update_onoff_obj"); - /* V1.9 : instead of toast popup, disable item during operation */ - elm_object_item_disabled_set(it, false); - elm_genlist_item_fields_update(it, "*", - ELM_GENLIST_ITEM_FIELD_CONTENT); + elm_object_item_disabled_set(ad->on_off, false); + elm_genlist_item_fields_update(ad->on_off, "*", ELM_GENLIST_ITEM_FIELD_CONTENT); } -static void __update_tap_and_pay_obj(bool activated, void *data) +static void __update_tap_and_pay_obj(void *data) { - main_view_data_t *vd = (main_view_data_t *)data; - Elm_Object_Item *it; - - ret_if(vd == NULL); - - it = vd->obj_item[T_TAP_N_PAY]; - ret_if(it == NULL); - - /* V2.1 */ - if (activated) { - elm_object_item_disabled_set(it, false); - } else { - elm_object_item_disabled_set(it, true); - } - elm_genlist_item_fields_update(it, "*", - ELM_GENLIST_ITEM_FIELD_TEXT); -} - -static void __handle_nfc_activation_completed_event(bool activated, - main_view_data_t *data) -{ - main_view_data_t *vd = (main_view_data_t *)data; - - ret_if(vd == NULL); - - - NSA_DEBUG("activated [%d]", activated); - - /* update ui */ - __update_onoff_obj(vd); - __update_tap_and_pay_obj(activated, vd); -} - -static void __nfc_vconf_key_changed (keynode_t *key, void *data) -{ - main_view_data_t *vd = (main_view_data_t *)data; - int boolval = 0; - bool activated; - - g_assert(vd != NULL); - - if (VCONF_OK != vconf_get_bool(VCONFKEY_NFC_STATE, &boolval)) { - activated = false; - } else { - if (boolval) { - activated = true; - } else { - activated = false; - } - } - - NSA_DEBUG("boolval %d", boolval); - NSA_DEBUG("nfc mode %s ", activated ? "ON" : "OFF"); - - if (!vd->isProgressing) { - __handle_nfc_activation_completed_event(activated, vd); - } -} - -static void __payment_handler_vconf_key_changed (keynode_t *key, - void *data) -{ - main_view_data_t *vd = (main_view_data_t *)data; - - NSA_DEBUG("__payment_handler_vconf_key_changed"); + appdata *ad = data; - /* Get changed payment handler */ - __get_payment_handler(&payment_handler); + ret_if(ad == NULL); + NSA_DEBUG("__update_tap_and_pay_obj"); - /* update tap and pay */ - if (nfc_manager_is_activated()) { - __update_tap_and_pay_obj(true, vd); - } else { - __update_tap_and_pay_obj(false, vd); -} + elm_object_item_disabled_set(ad->tap_n_pay, !nfc_manager_is_activated()); + elm_genlist_item_fields_update(ad->tap_n_pay, "*", ELM_GENLIST_ITEM_FIELD_TEXT); } -/* called when ifself performs activation */ -/* vd->isProgressing is set by itself */ static void __nfc_activation_completed_cb(nfc_error_e error, void *user_data) { - main_view_data_t *vd = (main_view_data_t *)user_data;; - bool activated; + appdata *ad = user_data; - g_assert(vd != NULL); + g_assert(ad != NULL); /* handle error cases */ - if (error != NFC_ERROR_NONE) { + if (error != NFC_ERROR_NONE) NSA_DEBUG_ERR("__nfc_activation_completed_cb failed"); - } /* update ui after activation is completed */ - if (vd->isProgressing) { - vd->isProgressing = false; - activated = nfc_manager_is_activated(); - - __handle_nfc_activation_completed_event(activated, vd); - } -} - -/* called when someone performs activation except for itself */ -static void __nfc_activation_changed_cb(bool activated , void *user_data) -{ - main_view_data_t *vd = (main_view_data_t *)user_data; - - g_assert(vd != NULL); - - NSA_DEBUG("nfc mode %s ", activated ? "ON" : "OFF"); - - if (!vd->isProgressing) { - __handle_nfc_activation_completed_event(activated, vd); - } + __update_onoff_obj(ad); + __update_tap_and_pay_obj(ad); } static void __change_nfc_onoff_setting(void *data) { - main_view_data_t *vd = (main_view_data_t *)data; + appdata *ad = data; int result; - bool activated; - Elm_Object_Item *it; - ret_if(vd == NULL); + ret_if(ad == NULL); NSA_BEGIN(); /* V1.9 : instead of toast popup, disable item during operation */ - it = vd->obj_item[T_NFC]; - if(it != NULL) - elm_object_item_disabled_set(it, true); + if(ad->on_off != NULL) + elm_object_item_disabled_set(ad->on_off, true); - activated = nfc_manager_is_activated(); + result = nfc_manager_set_activation(!nfc_manager_is_activated(), + __nfc_activation_completed_cb, ad); - result = nfc_manager_set_activation(!activated, - __nfc_activation_completed_cb, vd); ret_if(result != NFC_ERROR_NONE); - vd->isProgressing = true; - NSA_END(); } -static void __gl_list_clicked_cb(void *data, Evas_Object *obj, - void *event_info) +static void __gl_on_off_clicked_cb(void *data, Evas_Object *obj, void *event_info) { + appdata *ad = data; Elm_Object_Item* it = (Elm_Object_Item *)event_info; - struct appdata *ad; - main_view_data_t *vd; - int index; - index = (int) data; + elm_genlist_item_selected_set(it, EINA_FALSE); - vd = __get_view_data(); - ret_if(vd == NULL); + NSA_DEBUG("__gl_on_off_clicked_cb"); - ad = vd->ad; - ret_if(ad == NULL); + __change_nfc_onoff_setting(ad); +} - elm_genlist_item_selected_set(it, EINA_FALSE); +static void __gl_tap_n_pay_clicked_cb(void *data, Evas_Object *obj, void *event_info) +{ + appdata *ad = data; - NSA_DEBUG("__gl_list_clicked_cb"); - -#ifdef MDM_PHASE_2 - if(!__is_nfc_allowed(ad)) { - __update_onoff_obj(vd); - - /* show popup */ -#if 0 - ad->popup = nsa_create_popup_text_1button( - ad->ly_main, - IDS_SECURITY_POLICY_PREVENTS_USE_OF_NFC_ABB, - IMAGES_PATH"/tw_ic_popup_btn_check.png", - __MDM_restriced_popup_response_cb, - (void *)vd); -#else - nsa_create_toast_popup(ad->ly_main, - IDS_SECURITY_POLICY_PREVENTS_USE_OF_NFC_ABB); -#endif - return; - } -#endif + NSA_DEBUG("__gl_tap_n_pay_clicked_cb"); - if (index == T_NFC) { - __change_nfc_onoff_setting(vd); - } else if (index == T_TAP_N_PAY){ - _nsa_view_tap_n_pay_create(ad); - } else { - return ; - } + _nsa_view_tap_n_pay_create(ad); } +/* for item class */ static Evas_Object *__gl_content_get_on_off(void *data, Evas_Object *obj, const char *part) { - main_view_data_t *vd; - Evas_Object *check; - int boolval = 0; - int index; - - index = (int) data; - - vd = __get_view_data(); - retv_if(vd == NULL, NULL); - if (!strcmp(part, "elm.icon")) { + Evas_Object *check; + check = elm_check_add(obj); retv_if(check == NULL, NULL); elm_access_object_unregister(check); elm_object_style_set(check, "on&off/list"); - if (index == T_NFC) { - if (VCONF_OK != vconf_get_bool(VCONFKEY_NFC_STATE, &boolval)) { - elm_check_state_set(check, EINA_FALSE); - } else { - if (boolval) { - elm_check_state_set(check, EINA_TRUE); - } else { - elm_check_state_set(check, EINA_FALSE); - } - } - } - evas_object_size_hint_align_set(check, EVAS_HINT_FILL, - EVAS_HINT_FILL); - evas_object_size_hint_weight_set(check, EVAS_HINT_EXPAND, - EVAS_HINT_EXPAND); + if (nfc_manager_is_activated()) + elm_check_state_set(check, EINA_TRUE); + else + elm_check_state_set(check, EINA_FALSE); + + evas_object_size_hint_align_set(check, EVAS_HINT_FILL, EVAS_HINT_FILL); + evas_object_size_hint_weight_set(check, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); evas_object_propagate_events_set(check, EINA_FALSE); evas_object_repeat_events_set(check, EINA_TRUE); @@ -385,11 +170,9 @@ static Evas_Object *__gl_content_get_on_off(void *data, Evas_Object *obj, } } -static char *__gl_text_get_title(void *data, Evas_Object *obj, +static char *__gl_text_get_nfc(void *data, Evas_Object *obj, const char *part) { - //NSA_DEBUG("part:%s", part); - if (!strcmp(part, "elm.text")) { return strdup(IDS_NFC_NFC); } else { @@ -397,31 +180,20 @@ static char *__gl_text_get_title(void *data, Evas_Object *obj, } } -static char *__gl_text_get(void *data, Evas_Object *obj, +static char *__gl_text_get_tap_n_pay(void *data, Evas_Object *obj, const char *part) { - int index = (int)data; - - //NSA_DEBUG("index:%d", index); - //NSA_DEBUG("part:%s", part); - + appdata *ad = data; + NSA_DEBUG("part : %s", part); if (!strcmp(part, "elm.text")) { - if (index == T_NFC) { - return strdup(IDS_NFC_NFC); - } else if (index == T_TAP_N_PAY){ - return strdup(IDS_TAP_AND_PAY); - } else { - return NULL; - } // elm.text.2 + return strdup(IDS_TAP_AND_PAY); } else if (!strcmp(part, "elm.text.1")) { - if (index == T_TAP_N_PAY) { - if (payment_handler != NULL) - return strdup(payment_handler); - else - return NULL; - } else { - return NULL; + if (ad->payment_handler != NULL) { + NSA_DEBUG("ad->payment_handler : %s", ad->payment_handler); + return strdup(ad->payment_handler); } + else + return NULL; } else { return NULL; } @@ -429,168 +201,106 @@ static char *__gl_text_get(void *data, Evas_Object *obj, static Evas_Object *__create_nfc_setting_list(void *data) { - main_view_data_t *vd = (main_view_data_t *)data; - struct appdata *ad; + appdata *ad = data; + Evas_Object *genlist; - Elm_Genlist_Item_Class *itc_title, *itc_on_off, *itc_list; Evas_Object *circle_obj; - int i; - - retv_if(vd == NULL, NULL); + Elm_Genlist_Item_Class *itc_title, *itc_on_off, *itc_list, *itc_padding; - ad = vd->ad; retv_if(ad == NULL, NULL); + __get_payment_handler(&ad->payment_handler); + /* make genlist */ - genlist = elm_genlist_add(vd->nf); + genlist = elm_genlist_add(ad->navi_frame); retv_if(genlist == NULL, NULL); /* set genlist property */ elm_genlist_mode_set(genlist, ELM_LIST_COMPRESS); -// elm_genlist_homogeneous_set(genlist, EINA_TRUE); -// uxt_genlist_set_bottom_margin_enabled(genlist, EINA_TRUE); - circle_obj = eext_circle_object_genlist_add(genlist, - ad->circle_surface); + circle_obj = eext_circle_object_genlist_add(genlist, ad->circle_surface); eext_circle_object_genlist_scroller_policy_set(circle_obj, ELM_SCROLLER_POLICY_OFF, ELM_SCROLLER_POLICY_AUTO); eext_rotary_object_event_activated_set(circle_obj, EINA_TRUE); - g_array_append_val(ad->circle_obj_list, circle_obj); - ad->circle_obj_list_idx ++; - NSA_DEBUG("ad->circle_obj_list_idx %d", ad->circle_obj_list_idx); - NSA_DEBUG("circle_obj 0x%p", circle_obj); /* create genlist class + */ itc_title = elm_genlist_item_class_new(); itc_title->item_style = "title"; - itc_title->func.text_get = __gl_text_get_title; - itc_title->func.content_get = NULL; - itc_title->func.del = NULL; + itc_title->func.text_get = __gl_text_get_nfc; itc_on_off = elm_genlist_item_class_new(); itc_on_off->item_style = "1text.1icon.1"; - itc_on_off->func.text_get = __gl_text_get; + itc_on_off->func.text_get = __gl_text_get_nfc; itc_on_off->func.content_get = __gl_content_get_on_off; - itc_on_off->func.state_get = NULL; - itc_on_off->func.del = NULL; itc_list = elm_genlist_item_class_new(); - __get_payment_handler(&payment_handler); - if (payment_handler != NULL) + if (ad->payment_handler != NULL) itc_list->item_style = "2text"; else itc_list->item_style = "1text"; - itc_list->func.text_get = __gl_text_get; - itc_list->func.content_get = NULL; - itc_list->func.state_get = NULL; - itc_list->func.del = NULL; + itc_list->func.text_get = __gl_text_get_tap_n_pay; + + itc_padding = elm_genlist_item_class_new(); + itc_padding->item_style = "padding"; /* create genlist class - */ /* ADD: ITEM */ - elm_genlist_item_append(genlist, - itc_title, NULL, - NULL, ELM_GENLIST_ITEM_NONE, - NULL, NULL); + elm_genlist_item_append(genlist, itc_title, + NULL, NULL, ELM_GENLIST_ITEM_NONE, NULL, NULL); - for (i = 0; i < T_MAX; i++) { - Elm_Genlist_Item_Class *itc; + ad->on_off = elm_genlist_item_append(genlist, itc_on_off, + NULL, NULL, ELM_GENLIST_ITEM_NONE, __gl_on_off_clicked_cb, ad); - if (i == T_NFC) - itc = itc_on_off; - else - itc = itc_list; + ad->tap_n_pay = elm_genlist_item_append(genlist, itc_list, + ad, NULL, ELM_GENLIST_ITEM_NONE, __gl_tap_n_pay_clicked_cb, ad); - vd->obj_item[i] = elm_genlist_item_append(genlist, - itc, (void *)i, - NULL, ELM_GENLIST_ITEM_NONE, - __gl_list_clicked_cb, (void *)i); - } + elm_genlist_item_append(genlist, itc_padding, + NULL, NULL, ELM_GENLIST_ITEM_NONE, NULL, NULL); elm_genlist_item_class_free(itc_title); elm_genlist_item_class_free(itc_on_off); elm_genlist_item_class_free(itc_list); + elm_genlist_item_class_free(itc_padding); /* V2.1 */ - if (!nfc_manager_is_activated()) - __update_tap_and_pay_obj(false, vd); + __update_tap_and_pay_obj(ad); evas_object_show(genlist); return genlist; } -int _nsa_view_main_create(void *data) +static void __payment_handler_vconf_key_changed (keynode_t *key, + void *data) { - struct appdata *ad = (struct appdata *)data; - main_view_data_t *vd; - Evas_Object *list; - - /* create data */ - NSA_MEM_MALLOC(vd, 1, main_view_data_t); - retv_if(vd == NULL, NSA_ERROR); - __set_view_data(vd); - vd->ad = ad; - - /* set appdata to main view data */ - vd->nf = ad->navi_frame; + appdata *ad = data; - /* Draw UI */ - list = __create_nfc_setting_list(vd); - retv_if(list == NULL, NSA_ERROR); - - /* Push navifreme + */ - eext_object_event_callback_add(vd->nf, EEXT_CALLBACK_BACK, - eext_naviframe_back_cb, NULL); - - ad->base_navi_it = elm_naviframe_item_push( - vd->nf, - NULL, - NULL, - NULL, - list, - "empty"); - elm_naviframe_item_pop_cb_set(ad->base_navi_it, __back_clicked_cb, - vd); - /* Push navifreme - */ - - /* register nfc callback */ - nfc_manager_set_activation_changed_cb( - __nfc_activation_changed_cb, vd); - - if (VCONF_OK != vconf_notify_key_changed(VCONFKEY_NFC_STATE, - __nfc_vconf_key_changed, vd)) { - NSA_DEBUG_ERR("vconf_notify_key_changed error"); - } + NSA_DEBUG("__payment_handler_vconf_key_changed"); - if (VCONF_OK != vconf_notify_key_changed(VCONFKEY_NFC_PAYMENT_HANDLERS, - __payment_handler_vconf_key_changed, vd)) { - NSA_DEBUG_ERR("vconf_notify_key_changed error"); - } + /* Get changed payment handler */ + __get_payment_handler(&ad->payment_handler); - return NSA_OK; + /* update ui tap and pay */ + __update_tap_and_pay_obj(ad); } -void _nsa_view_main_destroy(void *data) +bool _nsa_view_main_create(void *data) { - struct appdata *ad; + appdata *ad = data; + Evas_Object *genlist; + retv_if(ad == NULL, false); - __set_view_data(NULL); + /* Draw UI */ + ad->main_genlist = __create_nfc_setting_list(ad); + retv_if(ad->main_genlist == NULL, false); - /* unregister nfc callback */ - nfc_manager_unset_activation_changed_cb(); + elm_naviframe_item_push(ad->navi_frame, NULL, NULL, NULL, ad->main_genlist, "empty"); + ad->current_view = V_MAIN; - if (VCONF_OK != vconf_ignore_key_changed(VCONFKEY_NFC_STATE, - __nfc_vconf_key_changed)) { + if (VCONF_OK != vconf_notify_key_changed(VCONFKEY_NFC_PAYMENT_HANDLERS, + __payment_handler_vconf_key_changed, ad)) { NSA_DEBUG_ERR("vconf_notify_key_changed error"); } - if (VCONF_OK != vconf_ignore_key_changed(VCONFKEY_NFC_PAYMENT_HANDLERS, - __payment_handler_vconf_key_changed)) { - NSA_DEBUG_ERR("vconf_ignore_key_changed error"); - } - - ad = (struct appdata *)data; - ret_if(ad == NULL); + return true; } - - diff --git a/wearable/app/src/nsa-view-tap-n-pay.c b/wearable/app/src/nsa-view-tap-n-pay.c index bb03ddd..ac6c46e 100755 --- a/wearable/app/src/nsa-view-tap-n-pay.c +++ b/wearable/app/src/nsa-view-tap-n-pay.c @@ -37,95 +37,107 @@ #define MAX_AIDS_COUNT 50 typedef struct { - Evas_Object *nf; - Evas_Object *genlist; - Evas_Object *radio_main; - struct appdata *ad; -} tap_and_pay_view_data_t; - -typedef struct { - GArray *list; int index; + appdata *ad; Elm_Object_Item *it; - void *data; } item_data_t; -typedef struct { - char *appid; - int aid_count; -} wallet_info_t; +static void __add_item_to_wallet_list(const char *handler, int count, void *data) +{ + appdata *ad = data; + wallet_info_t *winfo; -typedef enum { - T_PAYMENT = 0, - T_OTHERS, + NSA_MEM_MALLOC(winfo, 1, wallet_info_t); + ret_if(winfo == NULL); + NSA_MEM_STRDUP(winfo->appid, handler); + winfo->aid_count = count; - T_MAX -} tap_and_pay_wallet_type_e; + g_array_append_val(ad->payment_wallet_list, winfo); + ad->payment_wallet_cnt++; +} +static bool __registered_handler_cb(const char *handler, int count, void *user_data) +{ + appdata *ad = user_data; -static int payment_wallet_cnt; -static int other_wallet_cnt; + retv_if(ad == NULL, false); + retv_if(ad->payment_wallet_list == NULL, false); -static GArray *payment_wallet_list; -static GArray *other_wallet_list; + NSA_DEBUG("package name: [%s]", handler); + NSA_DEBUG("AID number: [%d]", count); -static Eina_Bool __back_clicked_cb(void *data, Elm_Object_Item *it) + __add_item_to_wallet_list(handler, count, ad); + + return true; +} + +static void __get_wallet_info(void *ad) { - tap_and_pay_view_data_t *vd = (tap_and_pay_view_data_t *)data; + NSA_DEBUG("__get_wallet_info"); - NSA_DEBUG("__back_clicked_cb"); + nfc_se_foreach_registered_handlers(NFC_CARD_EMULATION_CATEGORY_PAYMENT, + __registered_handler_cb, ad); +} - if (vd != NULL) { - struct appdata *ad = vd->ad; +static Evas_Object *__create_no_contents_ly(void *data) +{ + appdata *ad = data; + Evas_Object *sc, *ly, *image, *circle_obj; - _nsa_view_tap_n_pay_destroy(ad); + retv_if(ad == NULL, NULL); - if (ad->circle_obj_list_idx < 0) { - ui_app_exit(); + /* create scroller */ + sc = elm_scroller_add(ad->navi_frame); + evas_object_size_hint_weight_set(sc, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); + evas_object_size_hint_align_set(sc, EVAS_HINT_FILL, EVAS_HINT_FILL); + elm_scroller_single_direction_set(sc, ELM_SCROLLER_SINGLE_DIRECTION_HARD); + elm_object_style_set(sc, "effect"); + evas_object_show(sc); - return EINA_FALSE; - } - } + circle_obj = eext_circle_object_scroller_add(sc, ad->circle_surface); + eext_circle_object_genlist_scroller_policy_set(circle_obj, + ELM_SCROLLER_POLICY_OFF, ELM_SCROLLER_POLICY_AUTO); + eext_rotary_object_event_activated_set(circle_obj, EINA_TRUE); - return EINA_TRUE; + /* create layout */ + ly = nsa_create_edj_layout(sc, "tap_n_pay/nocontents"); + retv_if(ly == NULL, NULL); + + image = elm_image_add(ly); + retv_if(image == NULL, NULL); + elm_image_file_set(image, IMAGES_PATH"/b_setting_payment_help_image.png", NULL); + elm_object_part_content_set(ly, "elm.swallow.icon", image); + + elm_object_part_text_set(ly, "elm.text", IDS_NO_INSTALLED_PAYMENT_APPS); + evas_object_show(ly); + + /* content set */ + elm_object_content_set(sc, ly); + + return sc; } + static void __max_AID_popup_response_cb(void *data, Evas_Object *obj, void *event_info) { item_data_t *item = (item_data_t *)data; - tap_and_pay_view_data_t *vd; - struct appdata *ad; - const char *vconf_key; + appdata *ad = item->ad; char *wallet_handler; - vd = (tap_and_pay_view_data_t *)item->data; - ret_if(vd == NULL); - - ad = (struct appdata *)vd->ad; - ret_if(ad == NULL); - ret_if(ad == NULL); ret_if(ad->popup == NULL); NSA_DEBUG("__max_AID_popup_response_cb"); - /* restore default handler */ - if (item->list == payment_wallet_list) { - vconf_key = VCONFKEY_NFC_PAYMENT_HANDLERS; - } else { - vconf_key = VCONFKEY_NFC_OTHER_HANDLERS; - } - wallet_handler = vconf_get_str(vconf_key); - if (wallet_handler == NULL || payment_wallet_list == NULL) { - NSA_DEBUG_ERR("vconf_get_str error"); - } else { + wallet_handler = vconf_get_str(VCONFKEY_NFC_PAYMENT_HANDLERS); + if (wallet_handler != NULL) { int i; - for (i = 0; i < payment_wallet_cnt; i++) { + for (i = 0; i < ad->payment_wallet_cnt; i++) { wallet_info_t *winfo; - winfo = g_array_index(item->list, wallet_info_t *, i); + winfo = g_array_index(ad->payment_wallet_list, wallet_info_t *, i); if (!winfo) continue; @@ -133,236 +145,17 @@ static void __max_AID_popup_response_cb(void *data, strcmp(winfo->appid, wallet_handler) == 0) { NSA_DEBUG("matched, [%s]", winfo->appid); - if (vd->radio_main != NULL) - elm_radio_value_set(vd->radio_main, i); + if (ad->radio_main != NULL) + elm_radio_value_set(ad->radio_main, i); } } - } - NSA_MEM_FREE(wallet_handler); - - elm_popup_dismiss(ad->popup); - - if (ad->circle_obj_list_idx >= 0) { - Evas_Object *circle_obj; - - circle_obj = g_array_index(ad->circle_obj_list, Evas_Object *, - ad->circle_obj_list_idx); - eext_rotary_object_event_activated_set(circle_obj, EINA_TRUE); - NSA_DEBUG("restore circle object 0x%p", circle_obj); - } -} -static void __add_item_to_wallet_list(const char *item, int aid_count, - int *wallet_count, GArray **list) -{ - int wcount; - GArray *wlist; - wallet_info_t *winfo; - - wcount = *wallet_count; - wlist = *list; - - if (wlist == NULL) { - wlist = g_array_new(FALSE, FALSE, sizeof(wallet_info_t *)); - *list = wlist; - } - - NSA_MEM_MALLOC(winfo, 1, wallet_info_t); - ret_if(winfo == NULL); - NSA_MEM_STRDUP(winfo->appid, item); - winfo->aid_count = aid_count; - - g_array_append_val(wlist, winfo); - - wcount++; - *wallet_count = wcount; - - NSA_DEBUG("Done"); -} - -static bool __registered_handler_cb(const char *handler, int count, - void *user_data) -{ - if (handler) { - int type = (int)user_data; - - NSA_DEBUG("package name: [%s]", handler); - NSA_DEBUG("AID number: [%d]", count); - - if (type == T_PAYMENT) { - __add_item_to_wallet_list(handler, count, - &payment_wallet_cnt, &payment_wallet_list); - } else if (type == T_OTHERS) { - __add_item_to_wallet_list(handler, count, - &other_wallet_cnt, &other_wallet_list); - } else { - NSA_DEBUG_ERR("wallet type error"); - return true; - } + NSA_MEM_FREE(wallet_handler); } - return true; -} - -static void __get_wallet_info(void) -{ - NSA_DEBUG("__get_wallet_info"); - - nfc_se_foreach_registered_handlers(NFC_CARD_EMULATION_CATEGORY_PAYMENT, - __registered_handler_cb, (void *)T_PAYMENT); - - /* To Do */ -#if 0 - nfc_se_foreach_registered_handlers(NFC_CARD_EMULATION_CATEGORY_OTHER, - __registered_handler_cb, (void *)T_OTHERS); -#endif -} - -static int __get_payment_wallet_list_cnt(void) -{ - NSA_DEBUG("__get_payment_wallet_list_cnt [%d]", payment_wallet_cnt); - - return payment_wallet_cnt; -} - -static int __get_other_wallet_list_cnt(void) -{ - NSA_DEBUG("__get_other_wallet_list_cnt [%d]", other_wallet_cnt); - - return other_wallet_cnt; -} - -static char* __decorated_text_effect_get(int size, - const char* color_code, const char* text, const char* align) -{ - char* decorated = NULL; - Eina_Strbuf* buf = NULL; - int r = 0; - int g = 0; - int b = 0; - int a = 0; - - if(color_code == NULL) - return NULL; - - if(text == NULL) - return g_strdup(""); - -// uxt_theme_get_color(color_code, &r, &g, &b, &a, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL); - - buf = eina_strbuf_new(); - - if(align == NULL) { - eina_strbuf_append_printf(buf, - "<font_size=%d><color=#%02x%02x%02x%02x>%s</color></font_size>", - size, r, g, b, a, text); - } else { - eina_strbuf_append_printf(buf, - "<font_size=%d align=%s><color=#%02x%02x%02x%02x>%s</color></font_size>", - size, align, r, g, b, a, text); - } - - decorated = eina_strbuf_string_steal(buf); - eina_strbuf_free(buf); - - return decorated; + elm_popup_dismiss(ad->popup); } -static Evas_Object *__create_no_contents_ly(void *data) -{ - tap_and_pay_view_data_t *vd = (tap_and_pay_view_data_t *)data; - struct appdata *ad; - Evas_Object *sc; - Evas_Object *ly; - Evas_Object *image; - Evas_Object *circle_obj; - Evas_Object *label; - char *title_markup; - char *title; - - retv_if(vd == NULL, NULL); - retv_if(vd->nf == NULL, NULL); - - ad = vd->ad; - retv_if(ad == NULL, NULL); - - sc = elm_scroller_add(vd->nf); - evas_object_size_hint_weight_set(sc, EVAS_HINT_EXPAND, - EVAS_HINT_EXPAND); - evas_object_size_hint_align_set(sc, EVAS_HINT_FILL, - EVAS_HINT_FILL); - elm_scroller_single_direction_set(sc, ELM_SCROLLER_SINGLE_DIRECTION_HARD); - elm_object_style_set(sc, "effect"); - evas_object_show(sc); - - /* create layout */ - ly = nsa_create_edj_layout(sc, "tap_n_pay/nocontents"); - retv_if(ly == NULL, NULL); - - /* create image object */ - image = elm_image_add(ly); - retv_if(image == NULL, NULL); - elm_image_file_set(image, - IMAGES_PATH"/b_setting_payment_help_image.png", NULL); -// uxt_theme_object_set_color(image, "AO018"); - elm_object_part_content_set(ly, "elm.swallow.icon", image); - - /* set help text */ - elm_object_part_text_set(ly, "elm.text", - IDS_NO_INSTALLED_PAYMENT_APPS); - - /* get title text */ - title_markup = elm_entry_utf8_to_markup(IDS_TAP_AND_PAY); - title = __decorated_text_effect_get(30, "T012", title_markup, "center"); - NSA_MEM_FREE(title_markup); - - /* make title label */ - label = elm_label_add(ly); - evas_object_size_hint_weight_set(label, EVAS_HINT_EXPAND, - EVAS_HINT_EXPAND); - evas_object_size_hint_align_set(label, EVAS_HINT_FILL, - EVAS_HINT_FILL); - elm_object_style_set(label, "slide_roll"); - elm_label_wrap_width_set(label, 226); - elm_label_slide_duration_set(label, 3); - elm_label_slide_mode_set(label, ELM_LABEL_SLIDE_MODE_AUTO); - elm_label_ellipsis_set(label, EINA_TRUE); - - /* set title text */ - elm_object_text_set(label, title); - - /* start title sliding */ - elm_label_slide_go(label); - - /* set title label to layout */ - elm_object_part_content_set(ly, "elm.text.title", label); - evas_object_show(label); - NSA_MEM_FREE(title); - - evas_object_show(ly); - - elm_object_content_set(sc, ly); - - /* disable old circle object */ - if (ad->circle_obj_list_idx >= 0) { - circle_obj = g_array_index(ad->circle_obj_list, Evas_Object *, - ad->circle_obj_list_idx); - NSA_DEBUG("old circle_obj 0x%p", circle_obj); - } - - /* enable new circle object */ - circle_obj = eext_circle_object_scroller_add(sc, - ad->circle_surface); - eext_circle_object_scroller_policy_set(circle_obj, - ELM_SCROLLER_POLICY_OFF, ELM_SCROLLER_POLICY_AUTO); - eext_rotary_object_event_activated_set(circle_obj, EINA_TRUE); - g_array_append_val(ad->circle_obj_list, circle_obj); - ad->circle_obj_list_idx ++; - NSA_DEBUG("new circle_obj 0x%p", circle_obj); - NSA_DEBUG("ad->circle_obj_list_idx %d", ad->circle_obj_list_idx); - - return sc; -} static char *__get_launch_app_id(char *pkgid) { @@ -426,28 +219,16 @@ static bool __set_default_wallet(item_data_t *item) char *new_wallet = NULL; char *old_wallet = NULL; wallet_info_t *winfo; - const char *vconf_key; bool duplicate = false; + appdata *ad = item->ad; - retv_if(item == NULL, false); - retv_if(item->list == NULL, false); - + winfo = g_array_index(ad->payment_wallet_list, wallet_info_t *, item->index); - winfo = g_array_index(item->list, wallet_info_t *, item->index); - retv_if(winfo == NULL, false); new_wallet = winfo->appid; + old_wallet = vconf_get_str(VCONFKEY_NFC_PAYMENT_HANDLERS); - if (item->list == payment_wallet_list) { - vconf_key = VCONFKEY_NFC_PAYMENT_HANDLERS; - } else { - vconf_key = VCONFKEY_NFC_OTHER_HANDLERS; - } - NSA_DEBUG("vconf_key [%s]", vconf_key); - - old_wallet = vconf_get_str(vconf_key); if (old_wallet != NULL) { - if (strlen(new_wallet) > 0 && - strcmp(old_wallet, new_wallet) == 0) { + if (strlen(new_wallet) > 0 && strcmp(old_wallet, new_wallet) == 0) { duplicate = true; NSA_DEBUG("Same wallet is selected!"); } @@ -458,24 +239,12 @@ static bool __set_default_wallet(item_data_t *item) int ret; char *launch_app_id = NULL; - /* check if there are more than 50 AIDs */ if (winfo->aid_count > MAX_AIDS_COUNT) { - tap_and_pay_view_data_t *vd; - struct appdata *ad; - - vd = (tap_and_pay_view_data_t *)item->data; - retv_if(vd == NULL, false); + if (ad->radio_main != NULL) + elm_radio_value_set(ad->radio_main, -1); - ad = (struct appdata *)vd->ad; - retv_if(ad == NULL, false); - - /* initialize radio button */ - if (vd->radio_main != NULL) - elm_radio_value_set(vd->radio_main, -1); - - /* show max popup */ ad->popup = nsa_create_popup_text_1button( - ad->ly_main, + ad->main_layout, IDS_UNABLE_TO_SELECT_PAYMENT_APP_WITH_MORE_THAN_50_REGISTERED_CARDS, IMAGES_PATH"/tw_ic_popup_btn_check.png", __max_AID_popup_response_cb, @@ -484,18 +253,15 @@ static bool __set_default_wallet(item_data_t *item) return false; } - - ret = vconf_set_str(vconf_key, new_wallet); + ret = vconf_set_str(VCONFKEY_NFC_PAYMENT_HANDLERS, new_wallet); if (ret != VCONF_OK) { - NSA_DEBUG_ERR("error vconf_set_str"); + NSA_DEBUG_ERR("error vconf_set_str : %d", ret); return false; } - /* get launch app id */ launch_app_id = __get_launch_app_id(new_wallet); - /* launch app */ __launch_application(launch_app_id); return true; @@ -504,34 +270,27 @@ static bool __set_default_wallet(item_data_t *item) return false; } -static void __radio_clicked_cb(void *data, Evas_Object *obj, - void *event_info) -{ - int index = 0; - - index = elm_radio_value_get(obj); - NSA_DEBUG("selected value for the group:%d", index); - - /* When radio is clicked, we don't need to call __set_default_wallet */ - /* Because __gl_list_clicked_cb is called, too */ -} - static void __gl_list_clicked_cb(void *data, Evas_Object *obj, void *event_info) { Elm_Object_Item* it = (Elm_Object_Item *)event_info; item_data_t *item = (item_data_t *)data; - Evas_Object *radio_main = evas_object_data_get(obj, "payment_rdg"); + appdata *ad; elm_genlist_item_selected_set(it, EINA_FALSE); ret_if(item == NULL); - ret_if(radio_main == NULL); + ret_if(item->ad == NULL); + + ad = item->ad; + + ret_if(ad->payment_wallet_list == NULL); NSA_DEBUG("selected value for the group:%d", item->index); if (__set_default_wallet(item)) { - elm_radio_value_set(radio_main, item->index); + elm_radio_value_set(ad->radio_main, item->index); + elm_genlist_item_bring_in(item->it, ELM_GENLIST_ITEM_SCROLLTO_MIDDLE); NSA_DEBUG("__set_default_wallet success"); } else { @@ -539,69 +298,9 @@ static void __gl_list_clicked_cb(void *data, Evas_Object *obj, } } -static Evas_Object *__gl_content_get(void *data, Evas_Object *obj, - const char *part) -{ - if (!strcmp(part, "elm.icon")) { - item_data_t *item = (item_data_t *) data; - char *wallet_handler; - Evas_Object *radio_main; - Evas_Object *radio; - - retv_if(item == NULL, NULL); - - radio_main = evas_object_data_get(obj, "payment_rdg"); - retv_if(radio_main == NULL, NULL); - - radio = elm_radio_add(obj); - retv_if(radio == NULL, NULL); - - NSA_DEBUG("item->index [%d]", item->index); - - elm_object_style_set(radio, "list"); - elm_radio_state_value_set(radio, item->index); - elm_radio_group_add(radio, radio_main); - evas_object_smart_callback_add(radio, "changed", - __radio_clicked_cb, (void *)item); - - if (item->list == payment_wallet_list) { - wallet_handler = vconf_get_str(VCONFKEY_NFC_PAYMENT_HANDLERS); - } else { - wallet_handler = vconf_get_str(VCONFKEY_NFC_OTHER_HANDLERS); - } - - if (wallet_handler == NULL) { - NSA_DEBUG_ERR("vconf_get_str error"); - } else { - wallet_info_t *winfo; - char *appid; - - winfo = g_array_index(item->list, wallet_info_t *, - item->index); - retv_if(winfo == NULL, NULL); - appid = winfo->appid; - if (strlen(wallet_handler) > 0 && - strcmp(appid, wallet_handler) == 0) { - NSA_DEBUG("matched, [%s]", appid); - - elm_radio_value_set(radio_main, item->index); - elm_genlist_item_bring_in(item->it, - ELM_GENLIST_ITEM_SCROLLTO_MIDDLE); - } - NSA_MEM_FREE(wallet_handler); - } - - return radio; - } else { - return NULL; - } -} - static char *__gl_text_get_title(void *data, Evas_Object *obj, const char *part) { - //NSA_DEBUG("part:%s", part); - if (!strcmp(part, "elm.text")) { return strdup(IDS_TAP_AND_PAY); } else { @@ -609,41 +308,18 @@ static char *__gl_text_get_title(void *data, Evas_Object *obj, } } -static char *__gl_text_get_group(void *data, Evas_Object *obj, - const char *part) -{ - int index = (int) data; - - NSA_DEBUG("part: %s", part); - NSA_DEBUG("index: %d", index); - - if (!strcmp(part, "elm.text")) { - if (index == T_PAYMENT) - return strdup("Payment"); - else if (index == T_OTHERS) - return strdup("Others"); - else - return NULL; - } else { - return NULL; - } -} - - static char *__gl_text_get(void *data, Evas_Object *obj, const char *part) { - NSA_DEBUG("part: %s", part); - if (!strcmp(part, "elm.text")) { - item_data_t *item = (item_data_t *) data; + item_data_t *item = data; + appdata *ad = item->ad; wallet_info_t *winfo; char *appid; - retv_if(item == NULL, NULL); - - winfo = g_array_index(item->list, wallet_info_t *, - item->index); + retv_if(ad == NULL, NULL); + /* How to get index? */ + winfo = g_array_index(ad->payment_wallet_list, wallet_info_t *, item->index); retv_if(winfo == NULL, NULL); appid = winfo->appid; if (appid != NULL) { @@ -681,239 +357,140 @@ static char *__gl_text_get(void *data, Evas_Object *obj, } } -static void __add_group_n_list_to_genlist(Evas_Object *genlist, - Elm_Genlist_Item_Class *itc_group, - Elm_Genlist_Item_Class *itc_list, - tap_and_pay_wallet_type_e type, int count, void *data) +static Evas_Object *__gl_content_get(void *data, Evas_Object *obj, + const char *part) { - int index; - GArray *list; + if (!strcmp(part, "elm.icon")) { + item_data_t *item = (item_data_t *) data; + appdata *ad = item->ad; + char *wallet_handler; + Evas_Object *radio_main; + Evas_Object *radio; -#if 0 - Elm_Object_Item *parent; + retv_if(item == NULL, NULL); - /* add payment group */ - parent = elm_genlist_item_append(genlist, - itc_group, (void *)type, - NULL, ELM_GENLIST_ITEM_GROUP, - NULL, NULL); + radio_main = evas_object_data_get(obj, "payment_rdg"); + retv_if(radio_main == NULL, NULL); - elm_genlist_item_select_mode_set(parent, - ELM_OBJECT_SELECT_MODE_DISPLAY_ONLY); -#endif + radio = elm_radio_add(obj); + retv_if(radio == NULL, NULL); - if (type == T_PAYMENT) { - NSA_DEBUG("T_PAYMENT"); - list = payment_wallet_list; - } else { - NSA_DEBUG("T_OTHERS"); - list = other_wallet_list; - } + NSA_DEBUG("item->index [%d]", item->index); - /* add payment wallet list */ - for (index = 0; index < count; index++) { - item_data_t *item; + elm_object_style_set(radio, "list"); + elm_radio_state_value_set(radio, item->index); + elm_radio_group_add(radio, radio_main); - NSA_MEM_MALLOC(item, 1, item_data_t); + wallet_handler = vconf_get_str(VCONFKEY_NFC_PAYMENT_HANDLERS); + + if (wallet_handler == NULL) { + NSA_DEBUG_ERR("vconf_get_str error"); + } else { + wallet_info_t *winfo; + char *appid; + + winfo = g_array_index(ad->payment_wallet_list, wallet_info_t *, item->index); + retv_if(winfo == NULL, NULL); + appid = winfo->appid; + if (strlen(wallet_handler) > 0 && strcmp(appid, wallet_handler) == 0) { + NSA_DEBUG("matched, [%s]", appid); + + elm_radio_value_set(radio_main, item->index); + elm_genlist_item_bring_in(item->it, ELM_GENLIST_ITEM_SCROLLTO_MIDDLE); + } + NSA_MEM_FREE(wallet_handler); + } - item->list = list; - item->index = index; - item->it = elm_genlist_item_append(genlist, - itc_list, (void *)item, - NULL, ELM_GENLIST_ITEM_NONE, - __gl_list_clicked_cb, (void *)item); - item->data = data; + return radio; + } else { + return NULL; } } static Evas_Object *__create_tap_and_pay_list(void *data) { - tap_and_pay_view_data_t *vd = (tap_and_pay_view_data_t *)data; - struct appdata *ad; + int i; + appdata *ad = data; Evas_Object *genlist; - Elm_Genlist_Item_Class *itc_title, *itc_group, *itc_list; + Elm_Genlist_Item_Class *itc_title, *itc_list, *itc_padding; Evas_Object *circle_obj; - int count; - - retv_if(vd == NULL, NULL); - - ad = vd->ad; - retv_if(ad == NULL, NULL); - /* make genlist */ - genlist = elm_genlist_add(vd->nf); + genlist = elm_genlist_add(ad->navi_frame); retv_if(genlist == NULL, NULL); - /* set genlist property */ elm_genlist_mode_set(genlist, ELM_LIST_COMPRESS); -// uxt_genlist_set_bottom_margin_enabled(genlist, EINA_TRUE); - - /* disable old circle object */ - if (ad->circle_obj_list_idx >= 0) { - circle_obj = g_array_index(ad->circle_obj_list, Evas_Object *, - ad->circle_obj_list_idx); - NSA_DEBUG("old circle_obj 0x%p", circle_obj); - } - /* enable new circle object */ - circle_obj = eext_circle_object_genlist_add(genlist, - ad->circle_surface); - eext_circle_object_genlist_scroller_policy_set(circle_obj, - ELM_SCROLLER_POLICY_OFF, ELM_SCROLLER_POLICY_AUTO); - eext_rotary_object_event_activated_set(circle_obj, EINA_TRUE); - g_array_append_val(ad->circle_obj_list, circle_obj); - ad->circle_obj_list_idx ++; - NSA_DEBUG("new circle_obj 0x%p", circle_obj); - NSA_DEBUG("ad->circle_obj_list_idx %d", ad->circle_obj_list_idx); - - /* create genlist class + */ itc_title = elm_genlist_item_class_new(); itc_title->item_style = "title"; itc_title->func.text_get = __gl_text_get_title; itc_title->func.content_get = NULL; itc_title->func.del = NULL; - itc_group = elm_genlist_item_class_new(); - itc_group->item_style = "groupindex"; - itc_group->func.text_get = __gl_text_get_group; - itc_group->func.content_get = NULL; - itc_group->func.del = NULL; - itc_list = elm_genlist_item_class_new(); itc_list->item_style = "1text.1icon.1"; itc_list->func.text_get = __gl_text_get; itc_list->func.content_get = __gl_content_get; itc_list->func.state_get = NULL; itc_list->func.del = NULL; - /* create genlist class - */ - /* ADD: ITEM */ - elm_genlist_item_append(genlist, - itc_title, NULL, - NULL, ELM_GENLIST_ITEM_NONE, - NULL, NULL); + itc_padding = elm_genlist_item_class_new(); + itc_padding->item_style = "padding"; - if ((count = __get_payment_wallet_list_cnt())) { - Evas_Object *radio_main; + elm_genlist_item_append(genlist, itc_title, NULL, NULL, ELM_GENLIST_ITEM_NONE, NULL, NULL); - __add_group_n_list_to_genlist(genlist, itc_group, - itc_list, T_PAYMENT, count, vd); + for (i = 0; i < ad->payment_wallet_cnt; i++) { + item_data_t *item; - /*make radio group */ - radio_main = elm_radio_add(genlist); - elm_radio_state_value_set(radio_main, -1); - elm_radio_value_set(radio_main, -1); - evas_object_data_set(genlist, "payment_rdg", radio_main); - vd->radio_main = radio_main; - } + NSA_MEM_MALLOC(item, 1, item_data_t); - if ((count = __get_other_wallet_list_cnt())) { - __add_group_n_list_to_genlist(genlist, itc_group, - itc_list, T_OTHERS, count, vd); + item->index = i; + item->ad = ad; + item->it = elm_genlist_item_append(genlist, itc_list, item, NULL, ELM_GENLIST_ITEM_NONE, __gl_list_clicked_cb, item); } + elm_genlist_item_append(genlist, itc_padding, + NULL, NULL, ELM_GENLIST_ITEM_NONE, NULL, NULL); - /* TO DO: get wallet lists*/ + ad->radio_main = elm_radio_add(genlist); + elm_radio_state_value_set(ad->radio_main, -1); + elm_radio_value_set(ad->radio_main, -1); + evas_object_data_set(genlist, "payment_rdg", ad->radio_main); elm_genlist_item_class_free(itc_title); - elm_genlist_item_class_free(itc_group); elm_genlist_item_class_free(itc_list); + elm_genlist_item_class_free(itc_padding); - evas_object_show(genlist); + circle_obj = eext_circle_object_genlist_add(genlist, ad->circle_surface); + eext_circle_object_genlist_scroller_policy_set(circle_obj, + ELM_SCROLLER_POLICY_OFF, ELM_SCROLLER_POLICY_AUTO); + eext_rotary_object_event_activated_set(circle_obj, EINA_TRUE); - vd->genlist = genlist; + evas_object_show(genlist);
return genlist; } - -int _nsa_view_tap_n_pay_create(void *data) +bool _nsa_view_tap_n_pay_create(void *data) { - struct appdata *ad = (struct appdata *)data; - tap_and_pay_view_data_t *vd; - Evas_Object *layout; - int count; + appdata *ad = data; + Evas_Object *layout = NULL; - /* create data */ - NSA_MEM_MALLOC(vd, 1, tap_and_pay_view_data_t); - retv_if(vd == NULL, NSA_ERROR); - vd->ad = ad; - - /* set appdata to main view data */ - vd->nf = ad->navi_frame; + ad->payment_wallet_list = g_array_new(FALSE, FALSE, sizeof(wallet_info_t *)); + ad->payment_wallet_cnt = 0; /* get wallet info */ - __get_wallet_info(); + __get_wallet_info(ad); /* Draw UI */ - count = (__get_payment_wallet_list_cnt() + - __get_other_wallet_list_cnt()); - if (count == 0) { - layout = __create_no_contents_ly(vd); - retv_if(layout == NULL, NSA_ERROR); - } else { - layout = __create_tap_and_pay_list(vd); - retv_if(layout == NULL, NSA_ERROR); - } - - /* Push navifreme + */ - eext_object_event_callback_add(vd->nf, EEXT_CALLBACK_BACK, - eext_naviframe_back_cb, NULL); - - ad->base_navi_it = elm_naviframe_item_push( - vd->nf, - NULL, - NULL, - NULL, - layout, - "empty"); - elm_naviframe_item_pop_cb_set(ad->base_navi_it, __back_clicked_cb, - vd); - /* Push navifreme - */ - - return NSA_OK; -} - -void _nsa_view_tap_n_pay_destroy(void *data) -{ - struct appdata *ad = (struct appdata *)data; - Evas_Object *circle_obj; - - ret_if(ad == NULL); - - /* remove current circle object */ - circle_obj = g_array_index(ad->circle_obj_list, Evas_Object *, - ad->circle_obj_list_idx); - NSA_DEBUG("current view circle_obj 0x%p", circle_obj); - g_array_remove_index(ad->circle_obj_list, ad->circle_obj_list_idx--); - - /* restore circle object */ - if (ad->circle_obj_list_idx >= 0) { - circle_obj = g_array_index(ad->circle_obj_list, Evas_Object *, - ad->circle_obj_list_idx); - eext_rotary_object_event_activated_set(circle_obj, EINA_TRUE); - NSA_DEBUG("restored view circle_obj 0x%p", circle_obj); - } + if (ad->payment_wallet_cnt == 0) + layout = __create_no_contents_ly(ad); + else + layout = __create_tap_and_pay_list(ad); - /* free wallet list info */ - if (payment_wallet_list != NULL) { - int i; + retv_if(layout == NULL, false); - for (i = 0; i < payment_wallet_cnt; i++) { - wallet_info_t *winfo = NULL; + elm_naviframe_item_push(ad->navi_frame, NULL, NULL, NULL, layout, "empty"); + ad->current_view = V_TAP_N_PAY; - winfo = g_array_index(payment_wallet_list, - wallet_info_t *, i); - NSA_MEM_FREE(winfo->appid); - NSA_MEM_FREE(winfo); - } - - g_array_free(payment_wallet_list, FALSE); - payment_wallet_list = NULL; - payment_wallet_cnt = 0; - } - - NSA_DEBUG("ad->circle_obj_list_idx %d", ad->circle_obj_list_idx); + return true; } - - |