summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMyungki Lee <mk5004.lee@samsung.com>2017-03-03 11:24:11 +0900
committerMyungKi Lee <mk5004.lee@samsung.com>2017-03-13 19:27:24 -0700
commite2c886b369b6c7a6994adf5ffe6b2cecfd5c1a04 (patch)
treee7f24dc64b68e6406919bd2485f46222d034fc9b
parente764ca1e25981a72916bf89f3f1309a412dce2e4 (diff)
downloadnotification-e2c886b369b6c7a6994adf5ffe6b2cecfd5c1a04.tar.gz
notification-e2c886b369b6c7a6994adf5ffe6b2cecfd5c1a04.tar.bz2
notification-e2c886b369b6c7a6994adf5ffe6b2cecfd5c1a04.zip
Add apis for the extended notification
- api notification_set_extension_image_size notification_get_extension_image_size - enum NOTIFICATION_TEXT_TYPE_CONTENT_EXTENSION NOTIFICATION_IMAGE_TYPE_EXTENSION NOTIFICATION_LY_EXTENSION Change-Id: I681207b4f8ae3285f7a3a253bcb32d7d954fe924 Signed-off-by: Myungki Lee <mk5004.lee@samsung.com>
-rwxr-xr-xinclude/notification.h82
-rw-r--r--include/notification_private.h2
-rw-r--r--include/notification_type.h11
-rw-r--r--scripts/505.notification_upgrade.sh2
-rwxr-xr-xsrc/notification.c20
-rwxr-xr-xsrc/notification_db.c2
-rwxr-xr-xsrc/notification_ipc.c2
-rwxr-xr-xsrc/notification_noti.c27
8 files changed, 132 insertions, 16 deletions
diff --git a/include/notification.h b/include/notification.h
index e25be33..3824064 100755
--- a/include/notification.h
+++ b/include/notification.h
@@ -1775,6 +1775,88 @@ int notification_set_text_input(notification_h noti, int text_input_max_length);
/**
+ * @brief Sets the image height for the extended notification.
+ * @details The image is shown under the notification's text. The application can set the image height.
+ * The image is modified to fit into the height set by this function.
+ * The image can be scaled down and/or cropped.
+ * If @a height is 0, the default value is used. The default height depends on the screen size.
+ * @since_tizen 4.0
+ * @param[in] noti The notification handle
+ * @param[in] height The image height
+ * @return #NOTIFICATION_ERROR_NONE On success,
+ * otherwise a negative error value
+ * @retval #NOTIFICATION_ERROR_NONE Success
+ * @retval #NOTIFICATION_ERROR_INVALID_PARAMETER Invalid parameter
+ * @see notification_get_extension_image_size()
+ * @par Sample code:
+ * @code
+#include <notification.h>
+
+{
+ notification_h noti = NULL;
+ int noti_err = NOTIFICATION_ERROR_NONE;
+
+ noti = notification_create(NOTIFICATION_TYPE_NOTI);
+ if (noti == NULL)
+ return;
+
+ noti_err = notification_set_text(noti,
+ NOTIFICATION_TEXT_TYPE_CONTENT_EXTENTION,
+ "message",
+ NULL,
+ NOTIFICATION_VARIABLE_TYPE_NONE);
+ if (noti_err != NOTIFICATION_ERROR_NONE)
+ return;
+
+ noti_err = notification_set_image(noti,
+ NOTIFICATION_IMAGE_TYPE_EXTENTION,
+ image_path);
+ if (noti_err != NOTIFICATION_ERROR_NONE)
+ return;
+
+ noti_err = notification_set_layout(noti, NOTIFICATION_LY_EXTENTION);
+ if (noti_err != NOTIFICATION_ERROR_NONE)
+ return;
+
+ noti_err = notification_set_extension_image_size(noti, 20);
+ if (noti_err != NOTIFICATION_ERROR_NONE)
+ return;
+
+ // Do something
+}
+ * @endcode
+ */
+int notification_set_extension_image_size(notification_h noti, int height);
+
+
+/**
+ * @brief Gets the image height for the extended notification.
+ * @since_tizen 4.0
+ * @param[in] noti The notification handle
+ * @param[out] height The image height
+ * @return #NOTIFICATION_ERROR_NONE On success, otherwise a negative error value
+ * @retval #NOTIFICATION_ERROR_NONE Success
+ * @retval #NOTIFICATION_ERROR_INVALID_PARAMETER Invalid parameter
+ * @see notification_set_extension_image_size()
+ * @par Sample code:
+ * @code
+#include <notification.h>
+
+{
+ int noti_err = NOTIFICATION_ERROR_NONE;
+ int height;
+
+ // Do something
+
+ noti_err = notification_get_extension_image_size(noti, &height);
+ if (noti_err != NOTIFICATION_ERROR_NONE)
+ return;
+}
+ * @endcode
+ */
+int notification_get_extension_image_size(notification_h noti, int *height);
+
+/**
* @}
*/
diff --git a/include/notification_private.h b/include/notification_private.h
index 174c788..5bafb7c 100644
--- a/include/notification_private.h
+++ b/include/notification_private.h
@@ -99,6 +99,7 @@ struct _notification {
int text_input_max_length;
bool event_flag;
bool is_translation;
+ int extension_image_size;
uid_t uid;
};
@@ -162,6 +163,7 @@ typedef enum notification_data_type {
NOTIFICATION_DATA_TYPE_TEXT_INPUT_MAX_LENGTH,
NOTIFICATION_DATA_TYPE_EVENT_FLAG,
NOTIFICATION_DATA_TYPE_TRANSLATION,
+ NOTIFICATION_DATA_TYPE_EXTENSION_IMAGE_SIZE,
NOTIFICATION_DATA_TYPE_UID,
} notification_data_type_e;
diff --git a/include/notification_type.h b/include/notification_type.h
index 934afbe..48529b0 100644
--- a/include/notification_type.h
+++ b/include/notification_type.h
@@ -52,13 +52,14 @@ extern "C" {
*/
typedef enum _notification_ly_type {
NOTIFICATION_LY_NONE = 0, /**< Default */
- NOTIFICATION_LY_NOTI_EVENT_SINGLE, /**< Layout for notification. Used to inform single event*/
- NOTIFICATION_LY_NOTI_EVENT_MULTIPLE, /**< Layout for notification. Used to inform multiple event*/
- NOTIFICATION_LY_NOTI_THUMBNAIL, /**< Layout for notification. Used to display images*/
+ NOTIFICATION_LY_NOTI_EVENT_SINGLE, /**< Layout for notification. Used to inform single event */
+ NOTIFICATION_LY_NOTI_EVENT_MULTIPLE, /**< Layout for notification. Used to inform multiple event */
+ NOTIFICATION_LY_NOTI_THUMBNAIL, /**< Layout for notification. Used to display images */
NOTIFICATION_LY_ONGOING_EVENT, /**< Layout for ongoing notification. Used to display text message.
* notifications with NOTIFICATION_LY_ONGOING_EVENT can not be protected from
* removing by user since tizen @if MOBILE 2.4 @elseif WEARABLE 3.0 @endif */
- NOTIFICATION_LY_ONGOING_PROGRESS, /**< Layout for ongoing notification. Used to display progress*/
+ NOTIFICATION_LY_ONGOING_PROGRESS, /**< Layout for ongoing notification. Used to display progress */
+ NOTIFICATION_LY_EXTENSION, /**< Layout for extended notification (Since 4.0) */
NOTIFICATION_LY_MAX, /**< TBD */
} notification_ly_type_e;
@@ -182,6 +183,7 @@ typedef enum _notification_text_type {
NOTIFICATION_TEXT_TYPE_BUTTON_6, /**< Text on button 6 */
NOTIFICATION_TEXT_TYPE_TEXT_INPUT_PLACEHOLDER, /**< Guide text on the message reply box(Since 3.0) */
NOTIFICATION_TEXT_TYPE_TEXT_INPUT_BUTTON, /**< Text on button the on message reply box(Since 3.0) */
+ NOTIFICATION_TEXT_TYPE_CONTENT_EXTENSION, /**< Content for extended notification (Since 4.0) */
NOTIFICATION_TEXT_TYPE_MAX,
} notification_text_type_e;
@@ -211,6 +213,7 @@ typedef enum _notification_image_type {
NOTIFICATION_IMAGE_TYPE_BUTTON_5, /**< Image for button 5 */
NOTIFICATION_IMAGE_TYPE_BUTTON_6, /**< Image for button 6 */
NOTIFICATION_IMAGE_TYPE_TEXT_INPUT_BUTTON, /**< Image for message reply(Since 3.0) */
+ NOTIFICATION_IMAGE_TYPE_EXTENSION, /**< Image for extended notification (Since 4.0) */
NOTIFICATION_IMAGE_TYPE_MAX,
} notification_image_type_e;
diff --git a/scripts/505.notification_upgrade.sh b/scripts/505.notification_upgrade.sh
index 152e55a..d75cb2c 100644
--- a/scripts/505.notification_upgrade.sh
+++ b/scripts/505.notification_upgrade.sh
@@ -66,6 +66,7 @@ CREATE TABLE noti_list_temp (
delete_timeout INTEGER default 0,
text_input_max_length INTEGER default 0,
event_flag INTEGER default 0,
+ extension_image_size INTEGER default 0,
uid INTEGER
);
INSERT INTO noti_list_temp (type, layout, caller_pkgname, launch_pkgname, image_path, group_id, internal_group_id, priv_id, title_key, b_text, b_key, tag, b_format_args, num_format_args, text_domain, text_dir, time, insert_time, args, group_args, b_execute_option, b_service_responding, b_service_single_launch, b_service_multi_launch, b_event_handler_click_on_button_1, b_event_handler_click_on_button_2, b_event_handler_click_on_button_3, b_event_handler_click_on_button_4, b_event_handler_click_on_button_5, b_event_handler_click_on_button_6, 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, auto_remove) \
@@ -163,6 +164,7 @@ CREATE TABLE noti_template (
delete_timeout INTEGER default 0,
text_input_max_length INTEGER default 0,
event_flag INTEGER default 0,
+ extension_image_size INTEGER default 0,
uid INTEGER,
template_name TEXT,
UNIQUE (caller_pkgname, template_name)
diff --git a/src/notification.c b/src/notification.c
index a696ddb..771a619 100755
--- a/src/notification.c
+++ b/src/notification.c
@@ -1929,3 +1929,23 @@ EXPORT_API int notification_set_text_input(notification_h noti, int text_input_m
return NOTIFICATION_ERROR_NONE;
}
+
+EXPORT_API int notification_set_extension_image_size(notification_h noti, int height)
+{
+ if (noti == NULL || height <= 0)
+ return NOTIFICATION_ERROR_INVALID_PARAMETER;
+
+ noti->extension_image_size = height;
+
+ return NOTIFICATION_ERROR_NONE;
+}
+
+EXPORT_API int notification_get_extension_image_size(notification_h noti, int *height)
+{
+ if (noti == NULL || height == NULL)
+ return NOTIFICATION_ERROR_INVALID_PARAMETER;
+
+ *height = noti->extension_image_size;
+
+ return NOTIFICATION_ERROR_NONE;
+}
diff --git a/src/notification_db.c b/src/notification_db.c
index efe7d15..ef40772 100755
--- a/src/notification_db.c
+++ b/src/notification_db.c
@@ -89,6 +89,7 @@ create table if not exists noti_list ( \
delete_timeout INTEGER default 0, \
text_input_max_length INTEGER default 0, \
event_flag INTEGER default 0, \
+ extentsion_image_size INTEGER default 0, \
uid INTEGER \
); \
create table if not exists noti_group_data ( \
@@ -215,6 +216,7 @@ create table if not exists noti_list ( \
delete_timeout INTEGER default 0, \
text_input_max_length INTEGER default 0, \
event_flag INTEGER default 0, \
+ extension_image_size INTEGER default 0, \
uid INTEGER, \
template_name TEXT, \
UNIQUE (caller_pkgname, template_name) \
diff --git a/src/notification_ipc.c b/src/notification_ipc.c
index e36cdbb..ba01dcf 100755
--- a/src/notification_ipc.c
+++ b/src/notification_ipc.c
@@ -1914,6 +1914,7 @@ EXPORT_API GVariant *notification_ipc_make_gvariant_from_noti(notification_h not
g_variant_builder_add(&builder, "{iv}", NOTIFICATION_DATA_TYPE_TEXT_INPUT_MAX_LENGTH, g_variant_new_int32(noti->text_input_max_length));
g_variant_builder_add(&builder, "{iv}", NOTIFICATION_DATA_TYPE_EVENT_FLAG, g_variant_new_int32(noti->event_flag));
g_variant_builder_add(&builder, "{iv}", NOTIFICATION_DATA_TYPE_TRANSLATION, g_variant_new_int32(noti->is_translation));
+ g_variant_builder_add(&builder, "{iv}", NOTIFICATION_DATA_TYPE_EXTENSION_IMAGE_SIZE, g_variant_new_int32(noti->extension_image_size));
g_variant_builder_add(&builder, "{iv}", NOTIFICATION_DATA_TYPE_UID, g_variant_new_int32(noti->uid));
result_body = g_variant_builder_end(&builder);
@@ -2071,6 +2072,7 @@ EXPORT_API int notification_ipc_make_noti_from_gvariant(notification_h noti,
_variant_dict_lookup(dict, NOTIFICATION_DATA_TYPE_TEXT_INPUT_MAX_LENGTH, "i", &noti->text_input_max_length);
_variant_dict_lookup(dict, NOTIFICATION_DATA_TYPE_EVENT_FLAG, "i", &noti->event_flag);
_variant_dict_lookup(dict, NOTIFICATION_DATA_TYPE_TRANSLATION, "i", &noti->is_translation);
+ _variant_dict_lookup(dict, NOTIFICATION_DATA_TYPE_EXTENSION_IMAGE_SIZE, "i", &noti->extension_image_size);
_variant_dict_lookup(dict, NOTIFICATION_DATA_TYPE_UID, "i", &noti->uid);
noti->caller_pkgname = _dup_string(caller_pkgname);
diff --git a/src/notification_noti.c b/src/notification_noti.c
index e2a0481..5bce635 100755
--- a/src/notification_noti.c
+++ b/src/notification_noti.c
@@ -265,7 +265,7 @@ static int _insertion_query_create(notification_h noti, char **query)
"progress_size, progress_percentage, "
"ongoing_flag, ongoing_value_type, ongoing_current, ongoing_duration, "
"auto_remove, default_button_index, hide_timeout, delete_timeout, "
- "text_input_max_length, event_flag, uid) values ("
+ "text_input_max_length, event_flag, extension_image_size, uid) values ("
"%d, "
"%d, "
"'%s', '%s', "
@@ -285,7 +285,7 @@ static int _insertion_query_create(notification_h noti, char **query)
"%d, %d, %d, "
"$progress_size, $progress_percentage, "
"%d, %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),
@@ -329,6 +329,7 @@ static int _insertion_query_create(notification_h noti, char **query)
noti->delete_timeout,
noti->text_input_max_length,
noti->event_flag,
+ noti->extension_image_size,
noti->uid);
/* Free decoded data */
@@ -468,7 +469,7 @@ static int _update_query_create(notification_h noti, char **query)
"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, hide_timeout = %d, "
- "delete_timeout = %d, text_input_max_length = %d, event_flag = %d "
+ "delete_timeout = %d, text_input_max_length = %d, event_flag = %d, extension_image_size = %d "
"where priv_id = %d ",
noti->type,
noti->layout,
@@ -505,7 +506,7 @@ static int _update_query_create(notification_h noti, char **query)
noti->ongoing_current, noti->ongoing_duration,
noti->auto_remove, noti->default_button_index, noti->hide_timeout,
noti->delete_timeout, noti->text_input_max_length, noti->event_flag,
- noti->priv_id);
+ noti->extension_image_size, noti->priv_id);
/* Free decoded data */
if (args)
@@ -609,6 +610,7 @@ static void _notification_noti_populate_from_stmt(sqlite3_stmt *stmt, notificati
noti->delete_timeout = sqlite3_column_int(stmt, col++);
noti->text_input_max_length = sqlite3_column_int(stmt, col++);
noti->event_flag = sqlite3_column_int(stmt, col++);
+ noti->extension_image_size = sqlite3_column_int(stmt, col++);
noti->uid = sqlite3_column_int(stmt, col++);
noti->app_icon_path = NULL;
@@ -1063,7 +1065,7 @@ EXPORT_API int notification_noti_get_by_priv_id(notification_h noti, char *pkgna
"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, hide_timeout, delete_timeout, "
- "text_input_max_length, event_flag, uid "
+ "text_input_max_length, event_flag, extension_image_size, uid "
"from noti_list ";
if (pkgname != NULL && strlen(pkgname) != 0)
@@ -1135,7 +1137,7 @@ EXPORT_API int notification_noti_get_by_tag(notification_h noti, char *pkgname,
"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, hide_timeout, delete_timeout, "
- "text_input_max_length, event_flag, uid "
+ "text_input_max_length, event_flag, extension_image_size, uid "
"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));
@@ -1172,7 +1174,7 @@ EXPORT_API int notification_noti_get_by_tag(notification_h noti, char *pkgname,
"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, hide_timeout, delete_timeout, "
- "text_input_max_length, event_flag, uid "
+ "text_input_max_length, event_flag, extension_image_size, uid "
"from noti_list where tag = ? and uid = ?", -1, &stmt, NULL);
if (ret != SQLITE_OK) {
NOTIFICATION_ERR("Error: %s\n", sqlite3_errmsg(db));
@@ -1633,7 +1635,7 @@ EXPORT_API int notification_noti_get_grouping_list(notification_type_e type,
"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, hide_timeout, delete_timeout, "
- "text_input_max_length, event_flag, uid "
+ "text_input_max_length, event_flag, extension_image_size, uid "
"from noti_list where 1 > 0 ");
if (status == VCONFKEY_TELEPHONY_SIM_INSERTED) {
@@ -1736,7 +1738,7 @@ EXPORT_API int notification_noti_get_detail_list(const char *pkgname,
"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, hide_timeout, delete_timeout, "
- "text_input_max_length, event_flag, uid "
+ "text_input_max_length, event_flag, extension_image_size, uid "
"from noti_list ");
if (priv_id == NOTIFICATION_PRIV_ID_NONE && group_id == NOTIFICATION_GROUP_ID_NONE) {
@@ -1998,7 +2000,7 @@ static int _template_query_create(notification_h noti, char *template_name, char
"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, hide_timeout, delete_timeout, text_input_max_length, "
- "event_flag, uid, template_name) values ("
+ "event_flag, extension_image_size, uid, template_name) values ("
"%d, "
"%d, "
"'%s', '%s', "
@@ -2018,7 +2020,7 @@ static int _template_query_create(notification_h noti, char *template_name, char
"%d, %d, %d, $progress_size, $progress_percentage, "
"%d, %d, %d, %d, "
"%d, %d, %d, %d, %d, "
- "%d, %d, '%s')",
+ "%d, %d, %d, '%s')",
noti->type,
noti->layout,
NOTIFICATION_CHECK_STR(noti->caller_pkgname),
@@ -2062,6 +2064,7 @@ static int _template_query_create(notification_h noti, char *template_name, char
noti->delete_timeout,
noti->text_input_max_length,
noti->event_flag,
+ noti->extension_image_size,
noti->uid,
template_name);
@@ -2228,7 +2231,7 @@ EXPORT_API int notification_noti_get_package_template(notification_h noti, char
"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, hide_timeout, delete_timeout, "
- "text_input_max_length, event_flag, uid "
+ "text_input_max_length, event_flag, extension_image_size, uid "
"from noti_template where caller_pkgname = ? and template_name = ?", -1, &stmt, NULL);
if (ret != SQLITE_OK) {
NOTIFICATION_ERR("Error: %s\n", sqlite3_errmsg(db));