diff options
author | Hyunho Kang <hhstark.kang@samsung.com> | 2019-11-28 10:23:26 +0000 |
---|---|---|
committer | Gerrit Code Review <gerrit@review.ap-northeast-2.compute.internal> | 2019-11-28 10:23:26 +0000 |
commit | 0b391c153bde6bf9cf7849e7b4b36c1f3c6b2ceb (patch) | |
tree | 583ecfc95d7c29376a5b8b2ba9a5e0932a761291 /notification-ex | |
parent | 55de19384d7f0009c519ea5a4ae1c50a06387953 (diff) | |
parent | bf1a00e6e889df86d47968ba714aec5524373e8f (diff) | |
download | notification-0b391c153bde6bf9cf7849e7b4b36c1f3c6b2ceb.tar.gz notification-0b391c153bde6bf9cf7849e7b4b36c1f3c6b2ceb.tar.bz2 notification-0b391c153bde6bf9cf7849e7b4b36c1f3c6b2ceb.zip |
Merge "Add internal api to support C#" into tizen
Diffstat (limited to 'notification-ex')
-rw-r--r-- | notification-ex/abstract_item.h | 4 | ||||
-rw-r--r-- | notification-ex/api/notification_ex_internal.h | 43 | ||||
-rw-r--r-- | notification-ex/group_item.cc | 6 | ||||
-rw-r--r-- | notification-ex/group_item.h | 6 | ||||
-rw-r--r-- | notification-ex/stub.cc | 130 | ||||
-rw-r--r-- | notification-ex/time_item.cc | 4 | ||||
-rw-r--r-- | notification-ex/time_item.h | 1 |
7 files changed, 194 insertions, 0 deletions
diff --git a/notification-ex/abstract_item.h b/notification-ex/abstract_item.h index a5cef50..83bddb1 100644 --- a/notification-ex/abstract_item.h +++ b/notification-ex/abstract_item.h @@ -694,6 +694,10 @@ class EXPORT_API LEDInfo { return color_; } + void SetColor(std::shared_ptr<Color> color) { + color_ = std::move(color); + } + private: std::shared_ptr<Color> color_; int on_period_ = 0; diff --git a/notification-ex/api/notification_ex_internal.h b/notification-ex/api/notification_ex_internal.h new file mode 100644 index 0000000..eda78a1 --- /dev/null +++ b/notification-ex/api/notification_ex_internal.h @@ -0,0 +1,43 @@ +/* + * Copyright (c) 2019 Samsung Electronics Co., Ltd. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#ifndef __TIZEN_APPFW_NOTIFICATION_EX_INTERNAL_H__ +#define __TIZEN_APPFW_NOTIFICATION_EX_INTERNAL_H__ + +#ifdef __cplusplus +extern "C" { +#endif + +int noti_ex_item_free_string_list(char** list, int count); +int noti_ex_item_group_remove_children(noti_ex_item_h handle); +int noti_ex_item_time_set_time(noti_ex_item_h handle, + time_t time); + +int noti_ex_style_set_geometry( + noti_ex_style_h handle, noti_ex_geometry_h geometry); +int noti_ex_style_set_color( + noti_ex_style_h handle, noti_ex_color_h color); +int noti_ex_style_set_padding(noti_ex_style_h handle, + noti_ex_padding_h padding); + +int noti_ex_led_info_set_color( + noti_ex_led_info_h handle, noti_ex_color_h color); + + +#ifdef __cplusplus +} +#endif +#endif /* __TIZEN_APPFW_NOTIFICATION_EX_INTERNAL_H__ */
\ No newline at end of file diff --git a/notification-ex/group_item.cc b/notification-ex/group_item.cc index cd2569e..965e6c8 100644 --- a/notification-ex/group_item.cc +++ b/notification-ex/group_item.cc @@ -192,6 +192,12 @@ void GroupItem::RemoveChild(string itemId) { } } +void GroupItem::RemoveChildren() { + for (auto& i : impl_->children_list_) { + impl_->children_list_.remove(i); + } +} + list<shared_ptr<AbstractItem>> GroupItem::GetChildren() { return impl_->children_list_; } diff --git a/notification-ex/group_item.h b/notification-ex/group_item.h index dd29fbb..29d38ba 100644 --- a/notification-ex/group_item.h +++ b/notification-ex/group_item.h @@ -167,6 +167,12 @@ class EXPORT_API GroupItem : public AbstractItem { void RemoveChild(std::string itemId); /** + * @brief Removes children. + * @since_tizen 5.5 + */ + void RemoveChildren(); + + /** * @brief Gets the list of children item of GroupItem. * @since_tizen 5.5 * @return The list of AbstractItem diff --git a/notification-ex/stub.cc b/notification-ex/stub.cc index b890482..3cf1b29 100644 --- a/notification-ex/stub.cc +++ b/notification-ex/stub.cc @@ -38,6 +38,8 @@ #include "api/notification_ex_text.h" #include "api/notification_ex_time.h" #include "api/notification_ex_visibility_action.h" +#include "api/notification_ex_visibility_action.h" +#include "api/notification_ex_internal.h" #include "notification-ex/reporter.h" #include "notification-ex/app_control_action.h" #include "notification-ex/button_item.h" @@ -1464,6 +1466,26 @@ extern "C" EXPORT_API int noti_ex_style_get_padding(noti_ex_style_h handle, return NOTI_EX_ERROR_NONE; } + +extern "C" EXPORT_API int noti_ex_style_set_padding(noti_ex_style_h handle, + noti_ex_padding_h padding) { + if (handle == nullptr) { + LOGE("Invalid parameter"); + return NOTI_EX_ERROR_INVALID_PARAMETER; + } + + shared_ptr<Style>* p = static_cast<shared_ptr<Style>*>(handle); + if (padding == nullptr) { + (*p)->SetPadding(nullptr); + return NOTI_EX_ERROR_NONE; + } + + shared_ptr<Padding>* padd = static_cast<shared_ptr<Padding>*>(padding); + (*p)->SetPadding(*padd); + + return NOTI_EX_ERROR_NONE; +} + extern "C" EXPORT_API int noti_ex_style_get_color(noti_ex_style_h handle, noti_ex_color_h *color) { if (handle == nullptr || color == nullptr) { @@ -1489,6 +1511,25 @@ extern "C" EXPORT_API int noti_ex_style_get_color(noti_ex_style_h handle, return NOTI_EX_ERROR_NONE; } +extern "C" EXPORT_API int noti_ex_style_set_color( + noti_ex_style_h handle, noti_ex_color_h color) { + if (handle == nullptr) { + LOGE("Invalid parameter"); + return NOTI_EX_ERROR_INVALID_PARAMETER; + } + + shared_ptr<Style>* p = static_cast<shared_ptr<Style>*>(handle); + if (color == nullptr) { + (*p)->SetColor(nullptr); + return NOTI_EX_ERROR_NONE; + } + + shared_ptr<Color>* col = static_cast<shared_ptr<Color>*>(color); + (*p)->SetColor(*col); + + return NOTI_EX_ERROR_NONE; +} + extern "C" EXPORT_API int noti_ex_style_get_geometry(noti_ex_style_h handle, noti_ex_geometry_h *geometry) { if (handle == nullptr || geometry == nullptr) { @@ -1514,6 +1555,25 @@ extern "C" EXPORT_API int noti_ex_style_get_geometry(noti_ex_style_h handle, return NOTI_EX_ERROR_NONE; } +extern "C" EXPORT_API int noti_ex_style_set_geometry( + noti_ex_style_h handle, noti_ex_geometry_h geometry) { + if (handle == nullptr) { + LOGE("Invalid parameter"); + return NOTI_EX_ERROR_INVALID_PARAMETER; + } + + shared_ptr<Style>* p = static_cast<shared_ptr<Style>*>(handle); + if (geometry == nullptr) { + (*p)->SetGeometry(nullptr); + return NOTI_EX_ERROR_NONE; + } + + shared_ptr<Geometry>* geo = static_cast<shared_ptr<Geometry>*>(geometry); + (*p)->SetGeometry(*geo); + + return NOTI_EX_ERROR_NONE; +} + extern "C" EXPORT_API int noti_ex_style_get_background_image( noti_ex_style_h handle, char** background_image) { if (handle == nullptr || background_image == nullptr) { @@ -1693,6 +1753,25 @@ extern "C" EXPORT_API int noti_ex_led_info_get_color( return NOTI_EX_ERROR_NONE; } +extern "C" EXPORT_API int noti_ex_led_info_set_color( + noti_ex_led_info_h handle, noti_ex_color_h color) { + if (handle == nullptr) { + LOGE("Invalid parameter"); + return NOTI_EX_ERROR_INVALID_PARAMETER; + } + + shared_ptr<LEDInfo>* p = static_cast<shared_ptr<LEDInfo>*>(handle); + if (color == nullptr) { + (*p)->SetColor(nullptr); + return NOTI_EX_ERROR_NONE; + } + + shared_ptr<Color>* col = static_cast<shared_ptr<Color>*>(color); + (*p)->SetColor(*col); + + return NOTI_EX_ERROR_NONE; +} + extern "C" EXPORT_API int noti_ex_action_destroy(noti_ex_action_h handle) { if (handle == nullptr) { LOGE("Invalid parameter"); @@ -2146,6 +2225,10 @@ extern "C" EXPORT_API int noti_ex_item_set_led_info(noti_ex_item_h handle, } Handle* p = static_cast<Handle*>(handle); + if (led == nullptr) { + p->Get()->SetLEDInfo(nullptr); + return NOTI_EX_ERROR_NONE; + } shared_ptr<LEDInfo>* led_ptr = reinterpret_cast<shared_ptr<LEDInfo>*>(led); p->Get()->SetLEDInfo(*led_ptr); @@ -3087,6 +3170,23 @@ extern "C" EXPORT_API int noti_ex_item_time_get_time(noti_ex_item_h handle, return NOTI_EX_ERROR_NONE; } +extern "C" EXPORT_API int noti_ex_item_time_set_time(noti_ex_item_h handle, + time_t time) { + if (handle == nullptr) { + LOGE("Invalid parameter"); + return NOTI_EX_ERROR_INVALID_PARAMETER; + } + Handle* h = static_cast<Handle*>(handle); + if (!h->IsValidType(AbstractItem::Time)) { + LOGE("Invalid handle type"); + return NOTI_EX_ERROR_INVALID_PARAMETER; + } + TimeItem* p = static_cast<TimeItem*>(h->Get()); + p->SetTime(time); + + return NOTI_EX_ERROR_NONE; +} + extern "C" EXPORT_API int noti_ex_action_visibility_create( noti_ex_action_h *handle, const char *extra) { if (handle == nullptr) { @@ -3211,3 +3311,33 @@ extern "C" EXPORT_API int noti_ex_item_set_private_id( return NOTI_EX_ERROR_NONE; } + +extern "C" EXPORT_API int noti_ex_item_free_string_list(char** list, int count) { + if (list == nullptr) { + LOGE("Invalid parameter"); + return NOTI_EX_ERROR_INVALID_PARAMETER; + } + + LOGI("Free strings (%d)", count); + for (int i = 0; i < count; i++) + free(list[i]); + free(list); + + return NOTI_EX_ERROR_NONE; +} + +extern "C" EXPORT_API int noti_ex_item_group_remove_children(noti_ex_item_h handle) { + if (handle == nullptr) { + LOGE("Invalid parameter"); + return NOTI_EX_ERROR_INVALID_PARAMETER; + } + Handle* h = static_cast<Handle*>(handle); + if (!h->IsValidType(AbstractItem::Group)) { + LOGE("Invalid handle type"); + return NOTI_EX_ERROR_INVALID_PARAMETER; + } + GroupItem* p = static_cast<GroupItem*>(h->Get()); + p->RemoveChildren(); + + return NOTI_EX_ERROR_NONE; +} diff --git a/notification-ex/time_item.cc b/notification-ex/time_item.cc index 8bac87c..9047e52 100644 --- a/notification-ex/time_item.cc +++ b/notification-ex/time_item.cc @@ -98,6 +98,10 @@ time_t TimeItem::GetTime() const { return impl_->time_; } +void TimeItem::SetTime(time_t time) { + impl_->time_ = time; +} + TimeItem::~TimeItem() = default; TimeItem::Impl::~Impl() = default; diff --git a/notification-ex/time_item.h b/notification-ex/time_item.h index bc76b75..9816e38 100644 --- a/notification-ex/time_item.h +++ b/notification-ex/time_item.h @@ -103,6 +103,7 @@ class EXPORT_API TimeItem : public AbstractItem { * @return The time state of TimeItem. */ time_t GetTime() const; + void SetTime(time_t time); private: class Impl; |