diff options
author | Myungki Lee <mk5004.lee@samsung.com> | 2016-11-07 19:45:05 +0900 |
---|---|---|
committer | Myungki Lee <mk5004.lee@samsung.com> | 2016-11-07 19:45:37 +0900 |
commit | ce3f3f392be0438c8acbcb56d26b68494ff9a1b3 (patch) | |
tree | 9175d64fd65e45cda580bbf7fcac31c2ae0a46aa | |
parent | 2211447391e9e5aee6261f59217c1a2b0119dfe7 (diff) | |
parent | c09c242d385164139866230ae994ed2b3bb2f154 (diff) | |
download | notification-ce3f3f392be0438c8acbcb56d26b68494ff9a1b3.tar.gz notification-ce3f3f392be0438c8acbcb56d26b68494ff9a1b3.tar.bz2 notification-ce3f3f392be0438c8acbcb56d26b68494ff9a1b3.zip |
Merge branch 'tizen' into tizen_3.0
Change-Id: I3a643ee1131d1746fb0b4db8d027659e2ba3d1d8
-rwxr-xr-x | include/notification.h | 111 | ||||
-rw-r--r-- | include/notification_setting_internal.h | 35 | ||||
-rwxr-xr-x | src/notification_setting.c | 16 |
3 files changed, 104 insertions, 58 deletions
diff --git a/include/notification.h b/include/notification.h index 0f42558..0b5b60a 100755 --- a/include/notification.h +++ b/include/notification.h @@ -1566,11 +1566,16 @@ int notification_get_noti_block_state(notification_block_state_e *state); * For setting just a text to the button, you can set the text using notification_set_text() with #NOTIFICATION_TEXT_TYPE_TEXT_INPUT_BUTTON type. * If you want to show image button, you can set an image for the button using notification_set_image() with #NOTIFICATION_IMAGE_TYPE_TEXT_INPUT_BUTTON type. * - * Note that You should set an app_control for handling the event for user input using notification_set_event_handler(). + * Note that you should set an app_control for handling the event for user input using notification_set_event_handler(). * #NOTIFICATION_EVENT_TYPE_CLICK_ON_TEXT_INPUT_BUTTON is the event type for the text input. * You can get the text the user enters in the app_control handle that is passed as a result of the event. * The app_control will contain APP_CONTROL_DATA_TEXT key, so you can get the text using app_control_get_extra_data() using APP_CONTROL_DATA_TEXT key. * The value will contain the text user enters. + * + * Note that you are able to make the switching button to the text input box. + * You have to set the app_control which you will set in a text input box to the switching button. + * Refer to the second sample code. + * @since_tizen 3.0 * @return #NOTIFICATION_ERROR_NONE on success, * otherwise any other value on failure @@ -1581,15 +1586,14 @@ int notification_get_noti_block_state(notification_block_state_e *state); #include <notification.h> ... { - notification_h noti = NULL; int noti_err = NOTIFICATION_ERROR_NONE; + notification_h noti = NULL; app_control = NULL; noti = notification_create(NOTIFICATION_TYPE_NOTI); if (noti == NULL) { return; } - ... noti_err = notification_set_text_input(noti, 160); if (noti_err != NOTIFICATION_ERROR_NONE) { @@ -1614,15 +1618,13 @@ int notification_get_noti_block_state(notification_block_state_e *state); return; } - noti_err = notification_set_image(noti, - NOTIFICATION_IMAGE_TYPE_TEXT_INPUT_BUTTON, - TEXT_INPUT_BUTTON_PATH); + noti_err = notification_set_display_applist(noti, + NOTIFICATION_DISPLAY_APP_NOTIFICATION_TRAY | NOTIFICATION_DISPLAY_APP_ACTIVE); if (noti_err != NOTIFICATION_ERROR_NONE) { return; } ... - noti_err = app_control_create(&app_control); if (noti_err != APP_CONTROL_ERROR_NONE) { return; @@ -1654,7 +1656,102 @@ int notification_get_noti_block_state(notification_block_state_e *state); if(noti_err != NOTIFICATION_ERROR_NONE) { return; } +} + +... + +{ + int noti_err = NOTIFICATION_ERROR_NONE; + notification_h noti = NULL; + app_control = NULL; + + noti = notification_create(NOTIFICATION_TYPE_NOTI); + if (noti == NULL) { + return; + } + + noti_err = notification_set_text_input(noti, 160); + if (noti_err != NOTIFICATION_ERROR_NONE) { + return; + } + noti_err = notification_set_text(noti, + NOTIFICATION_TEXT_TYPE_TEXT_INPUT_PLACEHOLDER, + "Text message", + NULL, + NOTIFICATION_VARIABLE_TYPE_NONE); + if (noti_err != NOTIFICATION_ERROR_NONE) { + return; + } + + noti_err = notification_set_text(noti, + NOTIFICATION_TEXT_TYPE_TEXT_INPUT_BUTTON, + "SEND", + NULL, + NOTIFICATION_VARIABLE_TYPE_NONE); + if (noti_err != NOTIFICATION_ERROR_NONE) { + return; + } + + noti_err = notification_add_button(notification, NOTIFICATION_BUTTON_1); + if (noti_err != NOTIFICATION_ERROR_NONE) { + return; + } + + noti_err = notification_set_text(notification, + NOTIFICATION_TEXT_TYPE_BUTTON_1, + "reply", + NULL, + NOTIFICATION_VARIABLE_TYPE_NONE); + if (noti_err != NOTIFICATION_ERROR_NONE) { + return; + } + + noti_err = notification_set_display_applist(noti, + NOTIFICATION_DISPLAY_APP_NOTIFICATION_TRAY | NOTIFICATION_DISPLAY_APP_ACTIVE); + if (noti_err != NOTIFICATION_ERROR_NONE) { + return; + } + ... + + noti_err = app_control_create(&app_control); + if (noti_err != APP_CONTROL_ERROR_NONE) { + return; + } + + noti_err = app_control_set_app_id(app_control, appid); + if (noti_err != APP_CONTROL_ERROR_NONE) { + return; + } + + noti_err = app_control_set_operation(app_control, APP_CONTROL_OPERATION_DEFAULT); + if (noti_err != APP_CONTROL_ERROR_NONE) { + return; + } + + noti_err = notification_set_event_handler(notification, + NOTIFICATION_EVENT_TYPE_CLICK_ON_BUTTON_1, + app_control); + if (noti_err != NOTIFICATION_ERROR_NONE) { + return; + } + + noti_err = notification_set_event_handler(noti, + NOTIFICATION_EVENT_TYPE_CLICK_ON_TEXT_INPUT_BUTTON, + app_control); + if (noti_err != NOTIFICATION_ERROR_NONE) { + return; + } + + noti_err = app_control_destroy(app_control); + if (noti_err != APP_CONTROL_ERROR_NONE) { + return; + } + + noti_err = notification_post(noti); + if(noti_err != NOTIFICATION_ERROR_NONE) { + return; + } } * @endcode */ diff --git a/include/notification_setting_internal.h b/include/notification_setting_internal.h index 9320bb7..f3bd201 100644 --- a/include/notification_setting_internal.h +++ b/include/notification_setting_internal.h @@ -226,41 +226,6 @@ int notification_setting_get_package_name(notification_setting_h setting, char * /* * @internal - * @brief Sets package name to notification setting handle. - * @since_tizen @if wearable 2.3.1 @elseif mobile 2.3 @endif - * @param[in] setting The notification setting handle - * @param[in] value The package name - * @return #NOTIFICATION_ERROR_NONE on success, - * otherwise any other value on failure - * @retval #NOTIFICATION_ERROR_NONE Success - * @retval #NOTIFICATION_ERROR_INVALID_PARAMETER Invalid parameter - * @par sample code: - * @code -#include <notification_setting_internal.h> -... -{ - int noti_err = 0; - char *package_name = "org.tizen.example"; - notification_setting_h setting = NULL; - - ... - - noti_err = notification_setting_set_package_name(setting, package_name); - if (noti_err != NOTIFICATION_ERROR_NONE) { - return; - } - - notification_setting_free_notification(setting); - - return 0; - -} - * @endcode - */ -int notification_setting_set_package_name(notification_setting_h setting, char *value); - -/* - * @internal * @brief Gets value which whether allow notification from individual applications. * @since_tizen @if wearable 2.3.1 @elseif mobile 2.3 @endif * @param[in] setting The notification setting handle diff --git a/src/notification_setting.c b/src/notification_setting.c index 013efdd..6116e7b 100755 --- a/src/notification_setting.c +++ b/src/notification_setting.c @@ -117,22 +117,6 @@ EXPORT_API int notification_setting_get_package_name(notification_setting_h sett return NOTIFICATION_ERROR_NONE; } -EXPORT_API int notification_setting_set_package_name(notification_setting_h setting, char *value) -{ - - if (setting == NULL || value == NULL) { - NOTIFICATION_ERR("Invalid parameter"); - return NOTIFICATION_ERROR_INVALID_PARAMETER; - } - - if (setting->package_name != NULL) - free(setting->package_name); - - setting->package_name = SAFE_STRDUP(value); - - return NOTIFICATION_ERROR_NONE; -} - EXPORT_API int notification_setting_get_allow_to_notify(notification_setting_h setting, bool *value) { if (setting == NULL || value == NULL) { |