2 * Copyright (c) 2019 Samsung Electronics Co., Ltd.
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
8 * http://www.apache.org/licenses/LICENSE-2.0
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
21 #include "notification-ex/button_item.h"
27 #define LOG_TAG "NOTIFICATION_EX"
28 #define BUTTON_TITLE_KEY "__BUTTON_TITLE_KEY__"
30 namespace notification {
33 ButtonItem::ButtonItem(string title,
34 std::shared_ptr<AbstractAction> action)
35 : AbstractItem(AbstractItem::Button, action), title_(title) {
38 ButtonItem::ButtonItem(string id, string title,
39 std::shared_ptr<AbstractAction> action)
40 : AbstractItem(id, AbstractItem::Button, action), title_(title) {
42 ButtonItem::~ButtonItem() = default;
44 Bundle ButtonItem::Serialize() {
46 b = AbstractItem::Serialize();
47 b.Add(BUTTON_TITLE_KEY, title_);
51 void ButtonItem::Deserialize(Bundle b) {
52 AbstractItem::Deserialize(b);
53 title_ = b.GetString(BUTTON_TITLE_KEY);
56 shared_ptr<AbstractItem> ButtonItem::FindByID(std::string id) {
58 return shared_ptr<AbstractItem>(this);
62 std::string ButtonItem::GetTitle() const {
67 } // namespace notification