name: "icon_expand";
color: 61 185 204 255;
}
+ color_class { //W0113 (Input Color 1)
+ name: "touch_icon_normal";
+ color: 61 185 204 255;
+ }
+ color_class { //W0113P
+ name: "touch_icon_pressed";
+ color: 34 104 115 255;
+ }
}
} \
} \
}
+
+#define IMAGE_WITH_PRESSED_COLOR(GROUP_NAME, IMAGE_PATH, COLOR_CLASS, PRESSED_COLOR_CLASS) \
+ group { \
+ name: GROUP_NAME; \
+ images.image: IMAGE_PATH COMP; \
+ parts { \
+ part { name: "image"; \
+ description { \
+ state: "default" 0.0; \
+ image.normal: IMAGE_PATH; \
+ color_class: COLOR_CLASS; \
+ aspect: 1 1; \
+ aspect_preference: SOURCE; \
+ } \
+ description { \
+ state: "pressed" 0.0; \
+ inherit: "default" 0.0; \
+ color_class: PRESSED_COLOR_CLASS; \
+ } \
+ } \
+ } \
+ programs { \
+ program { \
+ name: "pressed"; \
+ signal: "mouse,down,*"; \
+ source: "*"; \
+ action: STATE_SET "pressed" 0.0; \
+ target: "image"; \
+ } \
+ program { \
+ name: "unpressed"; \
+ signal: "mouse,up,*"; \
+ source: "*"; \
+ action: STATE_SET "default" 0.0; \
+ target: "image"; \
+ } \
+ } \
+ }
--- /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_INPUT_CONTACT_RELATIONSHIP_FIELD_ITEM_H
+#define CONTACTS_INPUT_CONTACT_RELATIONSHIP_FIELD_ITEM_H
+
+#include "App/AppControl.h"
+#include "Contacts/Input/ContactTypedFieldItem.h"
+
+namespace Contacts
+{
+ namespace Input
+ {
+ /**
+ * @brief Genlist item representing FieldRelationship field.
+ */
+ class ContactRelationshipFieldItem : public ContactTypedFieldItem
+ {
+ public:
+ using ContactTypedFieldItem::ContactTypedFieldItem;
+
+ private:
+ virtual Elm_Genlist_Item_Class *getItemClass() const override;
+ virtual Evas_Object *getContent(Evas_Object *parent, const char *part) override;
+
+ void onPickPressed(Evas_Object *button, void *eventInfo);
+ void onPickResult(app_control_h request, app_control_h reply,
+ app_control_result_e result);
+
+ App::AppControl m_AppControl;
+ };
+ }
+}
+
+#endif /* CONTACTS_INPUT_CONTACT_RELATIONSHIP_FIELD_ITEM_H */
#define INPUT_ITEM_STYLE "input_item"
#define INPUT_IMAGE_ITEM_STYLE "input_image_item"
+#define INPUT_REL_ITEM_STYLE "input_rel_item"
#define INPUT_BUTTONS_ITEM_STYLE "input_buttons_item"
#define PART_LEFT "swallow.left"
#define PART_MIDDLE "swallow.middle"
#define PART_RIGHT "swallow.right"
+#define PART_REL_ICON "swallow.rel_icon"
#define GROUP_ICON_EXPAND "icon_expand"
#define GROUP_ICON_CONTRACT "icon_contract"
+#define GROUP_ICON_RELATIONSHIP "icon_relationship"
#endif /* INPUT_ITEM_LAYOUT_H */
#define IMAGE_ITEM_PADDING_Y 44
#define IMAGE_ITEM_H (IMAGE_SIZE+IMAGE_ITEM_PADDING_Y*2)
+#define RELATIONSHIP_ICON_SIZE 80 80
+
#define BUTTONS_ITEM_H 247
#define BUTTONS_ITEM_PADDING_Y 22
#define INPUT_ICON_ADD_NOTE INPUT_IMG_DIR"contacts_circle_btn_ic_note.png"
#define INPUT_ICON_ADD_MORE INPUT_IMG_DIR"contacts_circle_btn_ic_more.png"
+#define INPUT_ICON_RELATIONSHIP INPUT_IMG_DIR"contacts_btn_ic_multiple.png"
+
#define INPUT_ICON_EXPAND INPUT_IMG_DIR"core_icon_expand_close.png"
#define INPUT_ICON_CONTRACT INPUT_IMG_DIR"core_icon_expand_open.png"
IMAGE_WITH_COLOR(GROUP_ICON_EXPAND, INPUT_ICON_EXPAND, "icon_expand")
IMAGE_WITH_COLOR(GROUP_ICON_CONTRACT, INPUT_ICON_CONTRACT, "icon_expand")
+ IMAGE_WITH_PRESSED_COLOR(GROUP_ICON_RELATIONSHIP, INPUT_ICON_RELATIONSHIP,
+ "touch_icon_normal", "touch_icon_pressed");
group {
name: "elm/genlist/item/"INPUT_ITEM_STYLE"/default";
}
}
+ group {
+ name: "elm/genlist/item/"INPUT_REL_ITEM_STYLE"/default";
+ alias: "elm/genlist/item_compress/"INPUT_REL_ITEM_STYLE"/default";
+ alias: "elm/genlist/tree/"INPUT_REL_ITEM_STYLE"/default";
+ alias: "elm/genlist/tree_compress/"INPUT_REL_ITEM_STYLE"/default";
+ inherit: "elm/genlist/item/"INPUT_ITEM_STYLE"/default";
+
+ data.item: "contents" PART_LEFT" "PART_MIDDLE" "PART_RIGHT" "PART_REL_ICON;
+
+ parts {
+ swallow { PART_MIDDLE;
+ desc { "default";
+ rel2 {
+ relative: 0.0 1.0;
+ to_x: PART_REL_ICON;
+ }
+ }
+ }
+ swallow { PART_REL_ICON; scale;
+ desc { "default";
+ min: RELATIONSHIP_ICON_SIZE;
+ max: RELATIONSHIP_ICON_SIZE;
+ align: 1.0 0.5;
+ rel2 {
+ relative: 0.0 1.0;
+ to_x: PART_RIGHT;
+ }
+ }
+ }
+ }
+ }
+
group {
name: "elm/genlist/item/"INPUT_IMAGE_ITEM_STYLE"/default";
alias: "elm/genlist/item_compress/"INPUT_IMAGE_ITEM_STYLE"/default";
--- /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/Input/ContactRelationshipFieldItem.h"
+#include "Contacts/Model/ContactTextField.h"
+
+#include "App/Path.h"
+#include "App/AppControlRequest.h"
+#include "Utils/Callback.h"
+#include "Utils/Logger.h"
+
+#include "InputItemLayout.h"
+
+using namespace Contacts::Input;
+using namespace Contacts::Model;
+
+namespace
+{
+ const std::string layoutPath = App::getResourcePath(INPUT_ITEM_LAYOUT_EDJ);
+}
+
+Elm_Genlist_Item_Class *ContactRelationshipFieldItem::getItemClass() const
+{
+ static Elm_Genlist_Item_Class itc = createItemClass(INPUT_REL_ITEM_STYLE);
+ return &itc;
+}
+
+Evas_Object *ContactRelationshipFieldItem::getContent(Evas_Object *parent, const char *part)
+{
+ if (strcmp(part, PART_REL_ICON) == 0) {
+ Evas_Object *button = elm_image_add(parent);
+ elm_image_file_set(button, layoutPath.c_str(), GROUP_ICON_RELATIONSHIP);
+ evas_object_smart_callback_add(button, "clicked",
+ makeCallback(&ContactRelationshipFieldItem::onPickPressed), this);
+ return button;
+ }
+
+ return ContactTypedFieldItem::getContent(parent, part);
+}
+
+void ContactRelationshipFieldItem::onPickPressed(Evas_Object *button, void *eventInfo)
+{
+ m_AppControl = App::requestContactPick(APP_CONTROL_SELECT_SINGLE, APP_CONTROL_RESULT_ID);
+ m_AppControl.launch(makeCallbackWithLastParam(&ContactRelationshipFieldItem::onPickResult), this);
+}
+
+void ContactRelationshipFieldItem::onPickResult(app_control_h request, app_control_h reply,
+ app_control_result_e result)
+{
+ int personId = atoi(App::getSingleExtraData(reply, APP_CONTROL_DATA_SELECTED).c_str());
+ RETM_IF(personId < 1, "Invalid person ID.");
+
+ char *name = nullptr;
+ contacts_record_h record = nullptr;
+ contacts_db_get_record(_contacts_person._uri, personId, &record);
+ contacts_record_get_str_p(record, _contacts_person.display_name, &name);
+
+ getField().cast<ContactTextField>().setValue(name);
+ elm_genlist_item_fields_update(getObjectItem(), PART_MIDDLE, ELM_GENLIST_ITEM_FIELD_CONTENT);
+
+ contacts_record_destroy(record, true);
+}
#include "Contacts/Input/AddFieldsItem.h"
#include "Contacts/Input/ContactCompoundFieldItem.h"
#include "Contacts/Input/ContactImageFieldItem.h"
+#include "Contacts/Input/ContactRelationshipFieldItem.h"
#include "Contacts/Input/ContactTypedFieldItem.h"
#include "Contacts/Model/ContactArray.h"
ContactFieldItem *item = nullptr;
if (field->getId() == FieldImage) {
item = new ContactImageFieldItem(std::move(field));
+ } else if (field->getId() == FieldRelationship) {
+ item = new ContactRelationshipFieldItem(std::move(field));
} else if (field->getSubType() & ObjectTyped) {
item = new ContactTypedFieldItem(std::move(field));
} else if (field->getSubType() & ObjectCompound) {