int notification_get_noti_block_state(notification_block_state_e *state);
/**
+ * @brief Sets a text input box to reply directly on the notification.
+ * @details When you add a text input to the active notification, the notification UI will show a text input with a button.
+ * So, the user can enter any text and press the button to confirm the text as a input.
+ * You can edit some UI component that is related to the text input.
+ * First, you can add placeholder text to guide the user using notification_set_text() with #NOTIFICATION_TEXT_TYPE_TEXT_INPUT_PLACEHOLDER type.
+ * You also can edit button for the text input.
+ * 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().
+ * #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.
+ * @since_tizen 3.0
+ * @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.h>
+...
+{
+ notification_h noti = NULL;
+ int noti_err = NOTIFICATION_ERROR_NONE;
+ 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_set_image(noti,
+ NOTIFICATION_IMAGE_TYPE_TEXT_INPUT_BUTTON,
+ TEXT_INPUT_BUTTON_PATH);
+ 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_contorl, appid);
+ if (noti_err != APP_CONTROL_ERROR_NONE) {
+ return;
+ }
+
+ noti_err = app_control_set_operation(app_contorl, APP_CONTROL_OPERATION_DEFAULT);
+ if (noti_err != APP_CONTROL_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
+ */
+int notification_set_text_input(notification_h noti, int text_input_max_length);
+
+/**
* @}
*/
"flags_for_property, flag_simmode, display_applist, "
"progress_size, progress_percentage, "
"ongoing_flag, ongoing_value_type, ongoing_current, ongoing_duration, "
- "auto_remove, default_button_index, timeout, uid) values ("
+ "auto_remove, default_button_index, timeout, text_input_max_length, uid) values ("
"%d, "
"%d, "
"'%s', '%s', "
"%d, '%s', %d, '%s', %d, %d, %d, %d,"
"%d, %d, %d, "
"$progress_size, $progress_percentage, "
- "%d, %d, %d, %d, %d, %d, %d, %d)",
+ "%d, %d, %d, %d, %d, %d, %d, %d, %d)",
noti->type,
noti->layout,
NOTIFICATION_CHECK_STR(noti->caller_pkgname),
noti->auto_remove,
noti->default_button_index,
noti->timeout,
+ noti->text_input_max_length,
noti->uid);
/* Free decoded data */
"display_applist = %d, "
"progress_size = $progress_size, progress_percentage = $progress_percentage, "
"ongoing_flag = %d, ongoing_value_type = %d, ongoing_current = %d, ongoing_duration = %d, "
- "auto_remove = %d, default_button_index = %d, timeout = %d "
+ "auto_remove = %d, default_button_index = %d, timeout = %d, text_input_max_length = %d "
"where priv_id = %d ",
noti->type,
noti->layout,
noti->ongoing_flag, noti->ongoing_value_type,
noti->ongoing_current, noti->ongoing_duration,
noti->auto_remove, noti->default_button_index,
- noti->timeout, noti->priv_id);
+ noti->timeout, noti->text_input_max_length, noti->priv_id);
/* Free decoded data */
if (args)
return ret;
}
+static int _check_text_input(notification_h noti)
+{
+ int err;
+ int text_input_max_length;
+ app_control_h app_control = NULL;
+
+ err = notification_get_text_input_max_length(noti, &text_input_max_length);
+ if (err == NOTIFICATION_ERROR_NONE && text_input_max_length != 0) {
+ err = notification_get_event_handler(noti, NOTIFICATION_EVENT_TYPE_CLICK_ON_TEXT_INPUT_BUTTON, &app_control);
+ if (err != NOTIFICATION_ERROR_NONE || app_control == NULL) {
+ NOTIFICATION_ERR("Event handler for text_input is not set");
+ return -1;
+ }
+ }
+
+ return NOTIFICATION_ERROR_NONE;
+}
+
EXPORT_API int notification_noti_insert(notification_h noti)
{
int ret = 0;
NOTIFICATION_DBG("notification display applist - pkgname [%s], applist [%d]", noti->caller_pkgname, noti->display_applist);
}
+ if (_check_text_input(noti) != NOTIFICATION_ERROR_NONE)
+ return NOTIFICATION_ERROR_INVALID_PARAMETER;
+
+ //get_event_handler
+
db = notification_db_open(DBPATH);
if (!db)
return get_last_result();
"b_event_handler_click_on_icon, b_event_handler_click_on_thumbnail, "
"sound_type, sound_path, vibration_type, vibration_path, led_operation, led_argb, led_on_ms, led_off_ms, "
"flags_for_property, display_applist, progress_size, progress_percentage, ongoing_flag, ongoing_value_type, "
- "ongoing_current, ongoing_duration, auto_remove, default_button_index, timeout "
+ "ongoing_current, ongoing_duration, auto_remove, default_button_index, timeout, text_input_max_length "
"from noti_list ";
if (pkgname != NULL && strlen(pkgname) != 0)
"b_event_handler_click_on_icon, b_event_handler_click_on_thumbnail, "
"sound_type, sound_path, vibration_type, vibration_path, led_operation, led_argb, led_on_ms, led_off_ms, "
"flags_for_property, display_applist, progress_size, progress_percentage, ongoing_flag, ongoing_value_type, "
- "ongoing_current, ongoing_duration, auto_remove, default_button_index, timeout "
+ "ongoing_current, ongoing_duration, auto_remove, default_button_index, timeout, text_input_max_length "
"from noti_list where caller_pkgname = ? and tag = ? and uid = ?", -1, &stmt, NULL);
if (ret != SQLITE_OK) {
NOTIFICATION_ERR("Error: %s\n", sqlite3_errmsg(db));
"b_event_handler_click_on_icon, b_event_handler_click_on_thumbnail, "
"sound_type, sound_path, vibration_type, vibration_path, led_operation, led_argb, led_on_ms, led_off_ms, "
"flags_for_property, display_applist, progress_size, progress_percentage, ongoing_flag, ongoing_value_type, "
- "ongoing_current, ongoing_duration, auto_remove, default_button_index, timeout "
+ "ongoing_current, ongoing_duration, auto_remove, default_button_index, timeout, text_input_max_length "
"from noti_list where tag = ? and uid = ?", -1, &stmt, NULL);
if (ret != SQLITE_OK) {
NOTIFICATION_ERR("Error: %s\n", sqlite3_errmsg(db));
"b_event_handler_click_on_icon, b_event_handler_click_on_thumbnail, "
"sound_type, sound_path, vibration_type, vibration_path, led_operation, led_argb, led_on_ms, led_off_ms, "
"flags_for_property, display_applist, progress_size, progress_percentage, ongoing_flag, ongoing_value_type, "
- "ongoing_current, ongoing_duration, auto_remove, default_button_index, timeout "
+ "ongoing_current, ongoing_duration, auto_remove, default_button_index, timeout, text_input_max_length "
"from noti_list where 1 > 0 ");
if (status == VCONFKEY_TELEPHONY_SIM_INSERTED) {
"b_event_handler_click_on_icon, b_event_handler_click_on_thumbnail, "
"sound_type, sound_path, vibration_type, vibration_path, led_operation, led_argb, led_on_ms, led_off_ms, "
"flags_for_property, display_applist, progress_size, progress_percentage, ongoing_flag, ongoing_value_type, "
- "ongoing_current, ongoing_duration, auto_remove, default_button_index, timeout "
+ "ongoing_current, ongoing_duration, auto_remove, default_button_index, timeout, text_input_max_length "
"from noti_list ");
if (priv_id == NOTIFICATION_PRIV_ID_NONE && group_id == NOTIFICATION_GROUP_ID_NONE) {
"b_event_handler_click_on_icon, b_event_handler_click_on_thumbnail, "
"sound_type, sound_path, vibration_type, vibration_path, led_operation, led_argb, led_on_ms, led_off_ms, "
"flags_for_property, flag_simmode, display_applist, progress_size, progress_percentage, ongoing_flag, ongoing_value_type, "
- "ongoing_current, ongoing_duration, auto_remove, default_button_index, timeout, uid, template_name) values ("
+ "ongoing_current, ongoing_duration, auto_remove, default_button_index, timeout, text_input_max_length, uid, template_name) values ("
"%d, "
"%d, "
"'%s', '%s', "
"%d, '%s', %d, '%s', %d, %d, %d, %d, "
"%d, %d, %d, "
"$progress_size, $progress_percentage, "
- "%d, %d, %d, %d, %d, %d, %d, %d, '%s')",
+ "%d, %d, %d, %d, %d, %d, %d, %d, %d, '%s')",
noti->type,
noti->layout,
NOTIFICATION_CHECK_STR(noti->caller_pkgname),
noti->auto_remove,
noti->default_button_index,
noti->timeout,
+ noti->text_input_max_length,
noti->uid,
template_name);
"b_event_handler_click_on_icon, b_event_handler_click_on_thumbnail, "
"sound_type, sound_path, vibration_type, vibration_path, led_operation, led_argb, led_on_ms, led_off_ms, "
"flags_for_property, display_applist, progress_size, progress_percentage, ongoing_flag, ongoing_value_type, "
- "ongoing_current, ongoing_duration, auto_remove, default_button_index, timeout "
+ "ongoing_current, ongoing_duration, auto_remove, default_button_index, timeout, text_input_max_length "
"from noti_template where caller_pkgname = ? and template_name = ?", -1, &stmt, NULL);
if (ret != SQLITE_OK) {
NOTIFICATION_ERR("Error: %s\n", sqlite3_errmsg(db));