#define BUBBLE_THEME_EDJ_PATH EDJ_PATH"/bubble_theme.edj"
#define MSG_INPUT_PANEL_EDJ_PATH EDJ_PATH"/msg_input_panel.edj"
#define RECIPIENT_PANEL_EDJ_PATH EDJ_PATH"/recipient_panel.edj"
-#define CONV_LAYOUT_EDJ_PATH EDJ_PATH"/conv_layout.edj"
+
#define MSG_THREAD_EDJ_PATH EDJ_PATH"/msg_thread.edj"
#define CONTACTS_SEARCH_EDJ_PATH EDJ_PATH"/contact_search.edj"
#define MSG_BODY_EDJ_PATH EDJ_PATH"/msg_body.edj"
#define THUMBNAIL_EDJ_PATH EDJ_PATH"/msg_thumbnail.edj"
#define MSG_TITLE_EDJ_PATH EDJ_PATH"/msg_title.edj"
-#define CONV_LIST_EDJ_PATH EDJ_PATH"/conv_list.edj"
#define SELECT_ALL_EDJ_PATH EDJ_PATH"/select_all.edj"
#define VIEWER_LAYOUT_EDJ_PATH EDJ_PATH"/viewer_layout.edj"
#define VIEWER_PALYER_EDJ_PATH EDJ_PATH"/viewer_player.edj"
#define VIEWER_SUBJECT_LAYOUT_EDJ_PATH EDJ_PATH"/viewer_subject_layout.edj"
#define SMIL_ITEM_EDJ_PATH EDJ_PATH"/smil_item.edj"
+#define CONV_LIST_EDJ_PATH EDJ_PATH"/conv_list.edj"
+#define CONV_LAYOUT_EDJ_PATH EDJ_PATH"/conv_layout.edj"
+#define CONV_CONTACT_LIST_LAYOUT EDJ_PATH"/conv_contact_list_layout.edj"
+
// Images(res):
#define THUMB_CONTACT_IMG_PATH IMAGE_PATH"/list_ic_contacts.png"
#define THUMB_GROUP_IMG_PATH IMAGE_PATH"/list_ic_group.png"
--- /dev/null
+collections {
+
+ base_scale: 1.8;
+
+ group
+ {
+ name: "conv_contact_list_layout";
+ parts {
+ part {
+ name: "swl.rect";
+ type: SWALLOW;
+ scale: 1;
+ repeat_events: 1;
+ description {
+ state: "default" 0.0;
+ rel1 {relative: 0.0 0.0;}
+ rel2 {relative: 1.0 1.0;}
+ align: 0 0.0;
+ visible: 1;
+ fixed: 1 1;
+ }
+ }
+ part {
+ name: "bg_rect";
+ type: RECT;
+ scale: 1;
+ description {
+ state: "default" 0.0;
+ color: 255 255 255 255;
+ rel1 {to: "swl.contact_list"; relative: 0.0 0.0;}
+ rel2 {to: "swl.contact_list"; relative: 1.0 1.0;}
+ visible: 1;
+ align: 0 0.0;
+ fixed: 1 1;
+ }
+ }
+ part {
+ name: "swl.contact_list";
+ type: SWALLOW;
+ scale: 1;
+ description {
+ state: "default" 0.0;
+ visible: 1;
+ align: 0 0;
+ fixed: 1 1;
+ }
+ }
+ }
+ }
+}
state: "default" 0.0;
fixed: 1 1;
rel1 {to: "swl.recipient.rect"; relative: 0.0 1.0;}
- rel2 {to: "swl.bubble"; relative: 1.0 1.0;}
+ rel2 {to_x: "swl.recipient.rect"; to_y: "swl.msg_input_panel"; relative: 1.0 1.0;}
align: 0.5 0.0;
- visible: 1;
+ visible: 0;
}
description {
- state: "hide" 0.0;
+ state: "show" 0.0;
inherit: "default" 0.0;
- visible: 0;
+ visible: 1;
}
}
programs {
name: "hide.predictsearch";
signal: "hide.predictsearch";
source: "*";
- action: STATE_SET "hide" 0.0;
+ action: STATE_SET "default" 0.0;
target: "swl.predictsearch";
}
program {
name: "show.predictsearch";
signal: "show.predictsearch";
source: "*";
- action: STATE_SET "default" 0.0;
+ action: STATE_SET "show" 0.0;
target: "swl.predictsearch";
- target: "swl.recipient.rect";
}
program {
name: "bubble_layout_clicked";
void setMode(Elm_List_Mode mode);
void setHomogeneous(bool isHomogeneous);
ListItem *getSelectedItem() const;
+ unsigned getItemsCount() const;
void setCheckMode(bool check);
bool getCheckMode() const;
static void expand(Evas_Object *obj);
void setSizeHintMin(Evas_Coord w, Evas_Coord h);
void setSizeHintMax(Evas_Coord w, Evas_Coord h);
+ void getSizeHintMin(Evas_Coord *w, Evas_Coord *h) const;
+ void getSizeHintMax(Evas_Coord *w, Evas_Coord *h) const;
Evas_Object *setContent(Evas_Object *content, const char *part = nullptr, bool saveOldContent = false);
Evas_Object *unsetContent(const char *part = nullptr);
Evas_Object* getContent(const char *part = nullptr) const;
evas_object_size_hint_max_set(m_pEo, w, h);
}
+ inline void View::getSizeHintMin(Evas_Coord *w, Evas_Coord *h) const
+ {
+ evas_object_size_hint_min_get(m_pEo, w, h);
+ };
+
+ inline void View::getSizeHintMax(Evas_Coord *w, Evas_Coord *h) const
+ {
+ evas_object_size_hint_max_get(m_pEo, w, h);
+ }
+
inline void View::move(Evas_Coord x, Evas_Coord y)
{
evas_object_move(m_pEo, x, y);
return ListItem::staticCast<ListItem*>(elmItem);
}
+unsigned ListView::getItemsCount() const
+{
+ return elm_genlist_items_count(getEo());
+}
+
void ListView::notifyListener(void *data, Evas_Object *obj, void *event_info, ListenerMethod method)
{
ListItem *item = ListItem::staticCast<ListItem*>(event_info);
#ifndef ConvContactList_h_
#define ConvContactList_h_
-#include "ListView.h"
+#include "ConvContactListView.h"
#include "App.h"
#include "ContactListItem.h"
class IConvContactListListener;
class ConvContactList
- : public ListView
+ : public ConvContactListView
, private IListViewListener
{
public:
void setListener(IConvContactListListener *l);
void setSearchWorld(const std::string &searchWord);
void requestSearch();
+ void clear();
+ bool isEmpty() const;
private:
// IListViewListener:
virtual ~IConvContactListListener() {}
virtual void onContactSelected(ContactListItem &item) {};
+ virtual void onContactListChanged() {};
};
}
}
ConvContactList::ConvContactList(Evas_Object *parent, App &app)
- : ListView(parent)
+ : ConvContactListView(parent)
, m_pListener(nullptr)
, m_pPredictSearchIdler(nullptr)
, m_App(app)
{
- ListView::setListener(this);
- ListView::setMultiSelection(true);
- ListView::setMode(ELM_LIST_COMPRESS);
- ListView::setFocusAllow(false);
+ getList().setListener(this);
}
ConvContactList::~ConvContactList()
m_pListener = l;
}
+void ConvContactList::clear()
+{
+ getList().clear();
+
+ if(m_pListener)
+ m_pListener->onContactListChanged();
+}
+
+bool ConvContactList::isEmpty() const
+{
+ return getList().isEmpty();
+}
+
void ConvContactList::setSearchWorld(const std::string &searchWord)
{
m_SearchWord = searchWord;
void ConvContactList::search()
{
- ListView::clear();
+ getList().clear();
if(!m_SearchWord.empty())
{
search<ContactPersonNumber>();
search<ContactPersonEmail>();
search<ContactPersonPhoneLog>();
}
+ if(m_pListener)
+ m_pListener->onContactListChanged();
}
template<typename ContactRecord>
if(isValid(rec))
{
ContactListItem *item = new ContactListItem(rec, m_App, m_SearchWord);
- ListView::appendItem(*item);
+ getList().appendItem(*item);
}
else
{
--- /dev/null
+/*
+ * Copyright (c) 2009-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 ConvContactListView_h_
+#define ConvContactListView_h_
+
+#include "ListView.h"
+
+namespace Msg
+{
+ class ConvContactListView
+ : public View
+ {
+ public:
+ ConvContactListView(Evas_Object *parent);
+ virtual ~ConvContactListView();
+
+ ListView &getList();
+ const ListView &getList() const;
+
+ private:
+ int getItemHeight() const;
+ void recalcGeometry();
+ Evas_Object *createRect(Evas_Object *parent);
+ void onGometryChanged(Evas_Object *obj, void *eventInfo);
+
+ private:
+ Evas_Object *m_pRect;
+ Evas_Object *m_pBox;
+ ListView *m_pList;
+ };
+}
+
+#endif /* ConvContactListView_h_ */
--- /dev/null
+/*
+ * Copyright (c) 2009-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 "ConvContactListView.h"
+#include "Resource.h"
+
+using namespace Msg;
+
+ConvContactListView::ConvContactListView(Evas_Object *parent)
+ : m_pRect(nullptr)
+ , m_pBox(nullptr)
+ , m_pList(nullptr)
+{
+ setEo(addLayout(parent, CONV_CONTACT_LIST_LAYOUT, "conv_contact_list_layout"));
+ setFocusAllow(false);
+
+ m_pList = new ListView(getEo());
+ m_pList->setMultiSelection(true);
+ m_pList->setMode(ELM_LIST_COMPRESS);
+ m_pList->setHomogeneous(true);
+ m_pList->setFocusAllow(false);
+ m_pList->addSmartCb("realized", SMART_CALLBACK(ConvContactListView, onGometryChanged), this);
+ m_pList->addSmartCb("unrealized", SMART_CALLBACK(ConvContactListView, onGometryChanged), this);
+ m_pList->expand();
+ m_pList->show();
+
+ m_pBox = elm_box_add(getEo());
+ evas_object_show(m_pBox);
+ elm_box_pack_end(m_pBox, *m_pList);
+
+ setContent(m_pBox, "swl.contact_list");
+ setContent(createRect(getEo()), "swl.rect");
+}
+
+ConvContactListView::~ConvContactListView()
+{
+
+}
+
+ListView &ConvContactListView::getList()
+{
+ return *m_pList;
+}
+
+const ListView &ConvContactListView::getList() const
+{
+ return *m_pList;
+}
+
+void ConvContactListView::recalcGeometry()
+{
+ int itemHeight = getItemHeight();
+
+ int h = itemHeight * m_pList->getItemsCount();
+
+ int maxListHeight = 0;
+ evas_object_geometry_get(m_pRect, nullptr, nullptr, nullptr, &maxListHeight);
+
+ if(h > maxListHeight)
+ h = maxListHeight;
+
+ evas_object_size_hint_min_set(m_pBox, 0, h);
+ evas_object_size_hint_max_set(m_pBox, -1, h);
+}
+
+int ConvContactListView::getItemHeight() const
+{
+ int res = 0;
+ Evas_Object *track = nullptr;
+ Elm_Object_Item *item = elm_genlist_first_item_get(*m_pList);
+
+ for(; item ;)
+ {
+ track = elm_object_item_track(item);
+ if(track)
+ break;
+ item = elm_genlist_item_next_get(item);
+ }
+
+ if(track)
+ {
+ evas_object_geometry_get(track, nullptr, nullptr, nullptr, &res);
+ elm_object_item_untrack(track);
+ }
+
+ return res;
+}
+
+Evas_Object *ConvContactListView::createRect(Evas_Object *parent)
+{
+ m_pRect = evas_object_rectangle_add(evas_object_evas_get(parent));
+ evas_object_show(m_pRect);
+ evas_object_color_set(m_pRect, 0, 0, 0, 0);
+ evas_object_event_callback_add(m_pRect, EVAS_CALLBACK_MOVE, EVAS_EVENT_CALLBACK(ConvContactListView, onGometryChanged), this);
+ evas_object_event_callback_add(m_pRect, EVAS_CALLBACK_RESIZE, EVAS_EVENT_CALLBACK(ConvContactListView, onGometryChanged), this);
+ evas_object_event_callback_add(m_pRect, EVAS_CALLBACK_CHANGED_SIZE_HINTS, EVAS_EVENT_CALLBACK(ConvContactListView, onGometryChanged), this);
+ return m_pRect;
+}
+
+void ConvContactListView::onGometryChanged(Evas_Object *obj, void *eventInfo)
+{
+ recalcGeometry();
+}
+
// IConvContactListListener:
virtual void onContactSelected(ContactListItem &item);
+ virtual void onContactListChanged();
// Popup callbacks:
void onPopupDel(Evas_Object *popup, void *eventInfo);
m_pContactsList->setListener(this);
m_pContactsList->show();
m_pLayout->setContactList(*m_pContactsList);
- m_pLayout->showContactList(true);
}
}
m_pContactsList->clear();
}
+void Conversation::onContactListChanged()
+{
+ if(m_pContactsList)
+ m_pLayout->showContactList(!m_pContactsList->isEmpty());
+}
+
void Conversation::onAttached(ViewItem &item)
{
FrameController::onAttached(item);