[Implementation] Updated EDC names. Replaced custom item style with type1.
Replace "Add" button with icon. Fixed gradient background issue.
Added autofocus on NameItem and SIP "Done" button.
Updated RingtoneItem behavior according to Contact InputView.
Change-Id: I94d9eb0fea84459fdd1623c136c600eabd455591
Signed-off-by: Eugene Kurzberg <i.kurtsberg@samsung.com>
virtual char *getText(Evas_Object *parent, const char *part) override;
virtual Evas_Object *getContent(Evas_Object *parent, const char *part) override;
virtual void onInserted() override;
+ virtual void onFocused() override;
void onChanged(Evas_Object *entry, void *eventInfo);
+ void onActivated(Evas_Object *entry, void *eventInfo);
Model::Group &m_Group;
FilledCallback m_OnFilled;
virtual Elm_Genlist_Item_Class *getItemClass() const override;
virtual char *getText(Evas_Object *parent, const char *part) override;
virtual void onSelected() override;
-
- char *getRingtonePath() const;
- void pickRingtone();
void onPickResult(app_control_h request, app_control_h reply,
app_control_result_e result);
#include "GroupPath.h"
-#define GROUP_NAME_ITEM_STYLE "group_name"
-#define GROUP_ADD_MEMBERS_ITEM_STYLE "group_add_members"
+#define STYLE_ITEM_GROUP_NAME "grp_name" /* Styles starting with "group" are colored differently by Elementary */
+#define LAYOUT_ICON_ADD "icon_add"
-#define PART_GROUP_NAME_LABEL "text.label"
-#define PART_GROUP_NAME_VALUE "swallow.value"
+#define PART_NAME_LABEL "text.label"
+#define PART_NAME_VALUE "swallow.value"
-#define PART_GROUP_ADD_MEMBERS_LABEL "text.label"
-#define PART_GROUP_ADD_MEMBERS_COUNTER "text.counter"
-#define PART_GROUP_ADD_MEMBERS_BUTTON "swallow.button"
+#define ICON_ADD_WH 80
#endif /* GROUP_ITEM_LAYOUT_H */
+++ /dev/null
-/*
- * Copyright (c) 2015-2016 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 GROUP_ITEM_LAYOUT_METRICS_H
-#define GROUP_ITEM_LAYOUT_METRICS_H
-
-#define ITEM_H 120
-
-#define LABEL_L 32
-#define LABEL_W 230
-
-#define VALUE_R 32
-
-#define PLUS_L 17
-#define PLUS_R 32
-#define PLUS_W 80
-
-#define COUNTER_LR 32
-#define COUNTER_W 121
-
-
-#endif /* GROUP_ITEM_LAYOUT_METRICS_H */
#ifndef GROUP_PATH_H
#define GROUP_PATH_H
+#define GROUP_IMG_DIR "groups/images/"
#define GROUP_EDJ_DIR "groups/edje/"
#define GROUP_ITEM_LAYOUT_EDJ GROUP_EDJ_DIR"group-item-layout.edj"
+#define GROUP_ICON_ADD GROUP_IMG_DIR"core_button_add.png"
#endif /* GROUP_PATH_H */
*/
#include "GroupItemLayout.h"
-#include "GroupItemLayoutMetrics.h"
+#include "../../../../lib-apps-common/res/apps-common/edje/apps-common-utils.edc"
+
+#define LABEL_L 32
+#define LABEL_W 230
styles {
style {
name: "name_style";
base: "font=Tizen:style=Light font_size=40 align=left wrap=mixed color=#666666 ellipsis=1.0";
}
- style {
- name: "add_member_style";
- base: "font=Tizen:style=Regular font_size=40 align=left wrap=mixed color=#000000 ellipsis=1.0";
- }
- style {
- name: "add_member_counter_style";
- base: "font=Tizen:style=Regular font_size=30 align=right wrap=mixed color=#737373 ellipsis=1.0";
+}
+
+color_classes {
+ color_class {
+ name: "icon_add";
+ color: 61 185 204 255;
}
}
{
base_scale: 2.6;
+ IMAGE_WITH_COLOR(LAYOUT_ICON_ADD, GROUP_ICON_ADD, "icon_add");
+
group {
- name: "elm/genlist/item/"GROUP_NAME_ITEM_STYLE"/default";
- alias: "elm/genlist/item_compress/"GROUP_NAME_ITEM_STYLE"/default";
+ name: "elm/genlist/item/"STYLE_ITEM_GROUP_NAME"/default";
+ alias: "elm/genlist/item_compress/"STYLE_ITEM_GROUP_NAME"/default";
data.item: "banded_bg_area" "swallow.bg";
- data.item: "contents" PART_GROUP_NAME_VALUE;
- data.item: "texts" PART_GROUP_NAME_LABEL;
+ data.item: "contents" PART_NAME_VALUE;
+ data.item: "texts" PART_NAME_LABEL;
parts {
swallow { "swallow.bg"; }
spacer { "spacer.left"; scale;
desc { "default";
- min: LABEL_L ITEM_H;
+ min: LABEL_L 0;
align: 0.0 0.5;
rel1.relative: 0.0 0.0;
rel2.relative: 0.0 1.0;
}
}
- textblock { PART_GROUP_NAME_LABEL; scale;
+ textblock { PART_NAME_LABEL; scale;
desc { "default";
- min: LABEL_W ITEM_H;
+ min: LABEL_W 0;
align: 0.0 0.5;
rel1 { relative: 1.0 0.0; to_x: "spacer.left"; }
rel2 { relative: 1.0 1.0; to_x: "spacer.left"; }
text.style: "name_style";
}
}
- swallow { PART_GROUP_NAME_VALUE; scale;
- desc { "default";
- align: 0.0 0.5;
- rel1 { relative: 1.0 0.0; to_x: PART_GROUP_NAME_LABEL; }
- rel2 { relative: 1.0 1.0; }
- }
- }
- }
- }
-
- group {
- name: "elm/genlist/item/"GROUP_ADD_MEMBERS_ITEM_STYLE"/default";
- alias: "elm/genlist/item_compress/"GROUP_ADD_MEMBERS_ITEM_STYLE"/default";
-
- data.item: "banded_bg_area" "swallow.bg";
- data.item: "contents" PART_GROUP_ADD_MEMBERS_BUTTON;
- data.item: "texts" PART_GROUP_ADD_MEMBERS_LABEL" "PART_GROUP_ADD_MEMBERS_COUNTER;
-
- parts {
- swallow { "swallow.bg"; }
- spacer { "spacer.plus_left"; scale;
+ swallow { PART_NAME_VALUE;
desc { "default";
- min: PLUS_L ITEM_H;
align: 0.0 0.5;
- rel1.relative: 0.0 0.0;
- rel2.relative: 0.0 1.0;
- }
- }
- swallow { PART_GROUP_ADD_MEMBERS_BUTTON; scale;
- desc { "default";
- min: PLUS_W 0;
- align: 0.0 0.5;
- rel1 { relative: 1.0 0.0; to_x: "spacer.plus_left"; }
- rel2 { relative: 1.0 1.0; to_x: "spacer.plus_left"; }
- }
- }
- spacer { "spacer.plus_right"; scale;
- desc { "default";
- min: PLUS_R 0;
- align: 0.0 0.5;
- rel1 { relative: 1.0 0.0; to_x: PART_GROUP_ADD_MEMBERS_BUTTON; }
- rel2 { relative: 1.0 1.0; to_x: PART_GROUP_ADD_MEMBERS_BUTTON; }
- }
- }
- textblock { PART_GROUP_ADD_MEMBERS_LABEL; scale;
- desc { "default";
- align: 0.0 0.5;
- rel1 { relative: 1.0 0.0; to_x: "spacer.plus_right"; }
- rel2 { relative: 0.0 1.0; to_x: "spacer.counter_left"; }
- text.style: "add_member_style";
- }
- }
- spacer { "spacer.counter_left"; scale;
- desc { "default";
- min: COUNTER_LR 0;
- align: 1.0 0.5;
- rel1 { relative: 0.0 0.0; to_x: PART_GROUP_ADD_MEMBERS_COUNTER; }
- rel2 { relative: 0.0 1.0; to_x: PART_GROUP_ADD_MEMBERS_COUNTER; }
- }
- }
- textblock { PART_GROUP_ADD_MEMBERS_COUNTER; scale;
- desc { "default";
- min: COUNTER_W ITEM_H;
- align: 1.0 0.5;
- rel1 { relative: 0.0 0.0; to_x: "spacer.counter_right"; }
- rel2 { relative: 0.0 1.0; to_x: "spacer.counter_right"; }
- text.style: "add_member_counter_style";
- }
- }
- spacer { "spacer.counter_right"; scale;
- desc { "default";
- min: COUNTER_LR ITEM_H;
- align: 1.0 0.5;
- rel1.relative: 1.0 0.0;
- rel2.relative: 1.0 1.0;
+ rel1 { relative: 1.0 0.0; to_x: PART_NAME_LABEL; }
}
}
}
#include "Contacts/List/ListView.h"
#include "Contacts/List/Model/Person.h"
#include "Contacts/List/PersonItem.h"
-#include "GroupItemLayout.h"
-
#include "Common/Database/RecordUtils.h"
+
+#include "App/Path.h"
#include "Ui/Navigator.h"
#include "Ui/ProcessPopup.h"
#include "Utils/Thread.h"
+#include "GroupItemLayout.h"
+
#include <algorithm>
#include <app_i18n.h>
+#define PART_ICON "elm.swallow.icon"
+#define PART_LABEL "elm.text"
+#define PART_COUNTER "elm.text.end"
+
#define BUFFER_SIZE 32
using namespace Common::Database;
Elm_Genlist_Item_Class *AddMembersItem::getItemClass() const
{
- static Elm_Genlist_Item_Class itc = createItemClass(GROUP_ADD_MEMBERS_ITEM_STYLE);
+ static Elm_Genlist_Item_Class itc = createItemClass("type1");
return &itc;
}
char *AddMembersItem::getText(Evas_Object *parent, const char *part)
{
- if (strcmp(part, PART_GROUP_ADD_MEMBERS_LABEL) == 0) {
+ if (strcmp(part, PART_LABEL) == 0) {
return strdup(_("IDS_PB_MBODY_ADD_MEMBERS_ABB"));
- } else if (strcmp(part, PART_GROUP_ADD_MEMBERS_COUNTER) == 0) {
- char counter[BUFFER_SIZE] = { 0, };
- snprintf(counter, sizeof(counter), "(%d)", m_Count);
- return strdup(counter);
+ } else if (strcmp(part, PART_COUNTER) == 0) {
+ char buffer[BUFFER_SIZE] = { 0, };
+ snprintf(buffer, sizeof(buffer), "(%d)", m_Count);
+ return strdup(buffer);
}
return nullptr;
}
Evas_Object *AddMembersItem::getContent(Evas_Object *parent, const char *part)
{
- if (strcmp(part, PART_GROUP_ADD_MEMBERS_BUTTON) == 0) {
- Evas_Object *button = elm_button_add(parent);
- elm_object_style_set(button, "icon_expand_add");
- elm_object_focus_allow_set(button, EINA_FALSE);
- return button;
+ if (strcmp(part, PART_ICON) == 0) {
+ Evas_Object *image = elm_image_add(parent);
+ elm_image_file_set(image, App::getResourcePath(GROUP_ITEM_LAYOUT_EDJ).c_str(), LAYOUT_ICON_ADD);
+ evas_object_size_hint_min_set(image, ICON_ADD_WH, ICON_ADD_WH);
+ return image;
}
return nullptr;
}
{
popup->close();
view->getPage()->close();
- elm_genlist_item_fields_update(getObjectItem(),
- PART_GROUP_ADD_MEMBERS_COUNTER, ELM_GENLIST_ITEM_FIELD_TEXT);
+ elm_genlist_item_fields_update(getObjectItem(), PART_COUNTER, ELM_GENLIST_ITEM_FIELD_TEXT);
}
#include "Contacts/Groups/Model/Queries.h"
#include "Contacts/Groups/NameItem.h"
#include "Contacts/Groups/RingtoneItem.h"
-#include "GroupItemLayout.h"
-#include "App/Path.h"
#include "Common/Database/Queries.h"
#include "Common/Database/RecordIterator.h"
#include "Common/Database/RecordUtils.h"
+
+#include "App/Path.h"
#include "Ui/Genlist.h"
#include "Ui/Popup.h"
#include "Utils/Callback.h"
+#include "GroupItemLayout.h"
+
#include <algorithm>
#include <app_i18n.h>
#include <notification.h>
getGroupMembers();
m_AddMembersItem = new AddMembersItem(m_GroupMembers);
m_Genlist->insert(m_AddMembersItem);
-
m_Genlist->insert(new RingtoneItem(m_Group));
+ if (m_Group.getId() == 0) {
+ nameItem->focus();
+ }
+
return m_Genlist->getEvasObject();
}
makeCallback(&InputView::onDonePressed), this);
elm_object_disabled_set(m_DoneButton, EINA_TRUE);
- page->setTitle("IDS_PB_HEADER_CREATE");
+ page->setTitle(m_Group.getId() == 0 ? "IDS_PB_HEADER_CREATE" : "IDS_PB_HEADER_EDIT");
}
bool InputView::onBackPressed()
*/
#include "Contacts/Groups/NameItem.h"
-
#include "Contacts/Groups/Model/Group.h"
-#include "GroupItemLayout.h"
-
-#include "Common/Strings.h"
#include "Common/Database/RecordUtils.h"
+#include "Common/Strings.h"
+
#include "Ui/Editfield.h"
#include "Utils/Callback.h"
+#include "GroupItemLayout.h"
+
#include <app_i18n.h>
using namespace Common;
Elm_Genlist_Item_Class *NameItem::getItemClass() const
{
- static Elm_Genlist_Item_Class itc = createItemClass(GROUP_NAME_ITEM_STYLE);
+ static Elm_Genlist_Item_Class itc = createItemClass(STYLE_ITEM_GROUP_NAME);
return &itc;
}
char *NameItem::getText(Evas_Object *parent, const char *part)
{
- if (strcmp(part, PART_GROUP_NAME_LABEL) == 0) {
+ if (strcmp(part, PART_NAME_LABEL) == 0) {
return strdup(_("IDS_PB_MBODY_GROUP_NAME_ABB"));
}
+
return nullptr;
}
Evas_Object *NameItem::getContent(Evas_Object *parent, const char *part)
{
- if (strcmp(part, PART_GROUP_NAME_VALUE) == 0) {
- Ui::Editfield *edit = Ui::Editfield::create(parent, "IDS_PB_MBODY_GROUP_NAME_ABB");
+ if (strcmp(part, PART_NAME_VALUE) == 0) {
+ Ui::Editfield *editfield = Ui::Editfield::create(parent, "IDS_PB_MBODY_GROUP_NAME_ABB");
if (m_Group.getType() != GroupCustom) {
- edit->setEnabled(false);
+ editfield->setEnabled(false);
}
- char *markupName = elm_entry_utf8_to_markup(getGroupName(m_Group.getName()));
- elm_entry_entry_set(edit->getEntry(), markupName);
- free(markupName);
+ char *text = elm_entry_utf8_to_markup(getGroupName(m_Group.getName()));
+ Evas_Object *entry = editfield->getEntry();
+ elm_entry_input_panel_return_key_type_set(entry, ELM_INPUT_PANEL_RETURN_KEY_TYPE_DONE);
+ elm_entry_entry_set(editfield->getEntry(), text);
- evas_object_smart_callback_add(edit->getEntry(), "changed",
+ evas_object_smart_callback_add(entry, "activated",
+ makeCallback(&NameItem::onActivated), this);
+ evas_object_smart_callback_add(entry, "changed",
makeCallback(&NameItem::onChanged), this);
- return edit->getEvasObject();
+
+ free(text);
+ return editfield->getEvasObject();
}
+
return nullptr;
}
elm_genlist_item_select_mode_set(getObjectItem(), ELM_OBJECT_SELECT_MODE_NONE);
}
+void NameItem::onFocused()
+{
+ Evas_Object *obj = elm_object_item_part_content_get(getObjectItem(), PART_NAME_VALUE);
+ elm_object_focus_set(obj, EINA_TRUE);
+}
+
void NameItem::onChanged(Evas_Object *entry, void *eventInfo)
{
if (m_Group.getType() == GroupCustom) {
}
m_OnFilled(!elm_entry_is_empty(entry));
}
+
+void NameItem::onActivated(Evas_Object *entry, void *eventInfo)
+{
+ elm_object_focus_set(entry, EINA_FALSE);
+}
*/
#include "Contacts/Groups/RingtoneItem.h"
-
#include "Contacts/Groups/Model/Group.h"
#include "App/AppControlRequest.h"
-#include "Common/Database/RecordUtils.h"
#include "Utils/Callback.h"
-#include "Utils/Logger.h"
#include <app_i18n.h>
#include <system_settings.h>
-using namespace Common::Database;
using namespace Contacts::Groups;
RingtoneItem::RingtoneItem(Model::Group &group)
char *RingtoneItem::getText(Evas_Object *parent, const char *part)
{
if (strcmp(part, "elm.text") == 0) {
- char *value = getRingtonePath();
- char *substr = strdup(basename(value));
- free(value);
- return substr;
+ const char *value = m_Group.getRingtone();
+ if (value) {
+ std::string path = value;
+ return strdup(basename(&path[0]));
+ }
+
+ return strdup(_("IDS_PB_BODY_DEFAULT"));
} else if (strcmp(part, "elm.text.sub") == 0) {
return strdup(_("IDS_PB_OPT_RINGTONE"));
}
void RingtoneItem::onSelected()
{
- pickRingtone();
-}
-
-char *RingtoneItem::getRingtonePath() const
-{
- char *value = nullptr;
- const char *path = m_Group.getRingtone();
- if (path) {
- value = strdup(path);
- } else {
- char *defaultValue = nullptr;
- system_settings_get_value_string(SYSTEM_SETTINGS_KEY_INCOMING_CALL_RINGTONE, &defaultValue);
- value = defaultValue;
- }
-
- return value;
-}
-
-void RingtoneItem::pickRingtone()
-{
- char *value = getRingtonePath();
+ const char *value = m_Group.getRingtone();
m_AppControl = App::requestPickRingtone(value);
m_AppControl.launch(makeCallbackWithLastParam(&RingtoneItem::onPickResult), this);
- free(value);
}
void RingtoneItem::onPickResult(app_control_h request, app_control_h reply,
app_control_result_e result)
{
- char *path = nullptr;
- int err = app_control_get_extra_data(reply, "result", &path);
- WARN_IF_ERR(err, "app_control_get_extra_data() failed.");
- contacts_record_set_str(m_Group.getRecord(), _contacts_group.ringtone_path, path ? path : "");
- free(path);
+ std::string path = App::getSingleExtraData(reply, APP_CONTROL_DATA_SELECTED);
+ if (!path.empty()) {
+ contacts_record_set_str(m_Group.getRecord(), _contacts_group.ringtone_path, path.c_str());
+ update("elm.text", ELM_GENLIST_ITEM_FIELD_TEXT);
+ }
}