#include "Ux/SelectView.h"
#include "Utils/UniString.h"
+
#include <map>
namespace Ui
{
namespace List
{
- class PersonItem;
+ class GroupItem;
+ class SearchItem;
+ class SelectAllItem;
class PersonGroupItem;
+ class PersonItem;
/**
* @brief Contacts list view
void updatePageMode();
void updateSectionsMode();
+ void createSearchItem();
+
void createAddButton();
void deleteAddButton();
Evas_Object *m_Index;
Evas_Object *m_AddButton;
+ SearchItem *m_SearchItem;
+
Ui::GenlistGroupItem *m_Sections[SectionMax];
std::map<Utils::UniString, PersonGroupItem *> m_PersonGroups;
--- /dev/null
+/*
+ * Copyright (c) 2015 Samsung Electronics Co., Ltd All Rights Reserved
+ *
+ * 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 CONTACTS_LIST_CONTACT_SEARCH_ITEM_H
+#define CONTACTS_LIST_CONTACT_SEARCH_ITEM_H
+
+#include "Ui/GenlistItem.h"
+
+namespace Contacts
+{
+ namespace List
+ {
+ /**
+ * @brief Contact search item
+ */
+ class SearchItem : public Ui::GenlistItem
+ {
+ public:
+ /**
+ * @brief Entry change callback.
+ */
+ typedef std::function<void()> ChangeCallback;
+
+ /**
+ * @brief Set entry changed callback
+ */
+ void setChangeCallback(ChangeCallback callback);
+
+ private:
+ virtual Elm_Genlist_Item_Class *getItemClass() const override;
+ virtual Evas_Object *getContent(Evas_Object *parent, const char *part) override;
+
+ void onDonePressed(Evas_Object *entry, void *eventInfo);
+ void onChanged(Evas_Object *entry, void *eventInfo);
+
+ ChangeCallback m_OnChanged;
+ };
+ }
+}
+
+#endif /* CONTACTS_LIST_CONTACT_SEARCH_ITEM_H */
*
*/
+#include "Contacts/List/SearchItem.h"
#include "Contacts/List/ListView.h"
#include "Contacts/List/GroupItem.h"
#include "Contacts/List/ManageFavoritesPopup.h"
ListView::ListView(int filterType)
: m_Box(nullptr), m_NoContent(nullptr), m_Genlist(nullptr),
m_Index(nullptr), m_AddButton(nullptr),
+ m_SearchItem(nullptr),
m_Sections{ nullptr }, m_Provider(filterType)
{
auto strings = Common::getSelectViewStrings();
m_Genlist = createGenlist(m_Box);
elm_box_pack_end(m_Box, m_Genlist->getEvasObject());
+ createSearchItem();
+
elm_object_part_content_set(layout, "elm.swallow.content", m_Box);
elm_object_part_content_set(layout, "elm.swallow.fastscroll", createIndex(layout));
void ListView::onSelectAllInsert(Ui::GenlistItem *item)
{
- m_Genlist->insert(item, nullptr, nullptr, Ui::Genlist::After);
+ m_Genlist->insert(item, nullptr, m_SearchItem, Ui::Genlist::After);
}
void ListView::onSelectModeChanged(SelectMode selectMode)
}
}
+void ListView::createSearchItem()
+{
+ m_SearchItem = new SearchItem();
+ m_Genlist->insert(m_SearchItem, nullptr, nullptr, Ui::Genlist::After);
+ elm_genlist_item_select_mode_set(m_SearchItem->getObjectItem(), ELM_OBJECT_SELECT_MODE_NONE);
+}
+
void ListView::createAddButton()
{
m_AddButton = elm_button_add(getEvasObject());
--- /dev/null
+/*
+ * Copyright (c) 2015 Samsung Electronics Co., Ltd All Rights Reserved
+ *
+ * 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.
+ *
+ */
+
+#include "Contacts/List/SearchItem.h"
+#include "Ui/Editfield.h"
+#include "Utils/Callback.h"
+#include "Utils/Logger.h"
+
+using namespace Contacts::List;
+
+Evas_Object *SearchItem::getContent(Evas_Object *parent, const char *part)
+{
+ Ui::Editfield *searchField = Ui::Editfield::create(parent, "IDS_PB_NPBODY_SEARCH");
+
+ Evas_Object *entry = searchField->getEntry();
+ elm_entry_input_panel_return_key_autoenabled_set(entry, EINA_TRUE);
+ elm_entry_input_panel_return_key_type_set(entry, ELM_INPUT_PANEL_RETURN_KEY_TYPE_DONE);
+ evas_object_smart_callback_add(entry, "changed",
+ makeCallback(&SearchItem::onChanged), this);
+ evas_object_smart_callback_add(entry, "activated",
+ makeCallback(&SearchItem::onDonePressed), this);
+ return searchField->getEvasObject();
+}
+
+Elm_Genlist_Item_Class *SearchItem::getItemClass() const
+{
+ static Elm_Genlist_Item_Class itc = createItemClass("full");
+ return &itc;
+}
+
+void SearchItem::setChangeCallback(ChangeCallback callback)
+{
+ m_OnChanged = std::move(callback);
+}
+
+void SearchItem::onDonePressed(Evas_Object *entry, void *eventInfo)
+{
+ elm_object_focus_set(entry, EINA_FALSE);
+}
+
+void SearchItem::onChanged(Evas_Object *entry, void *eventInfo)
+{
+ if (m_OnChanged) {
+ m_OnChanged();
+ }
+}