This commit should change style of Genlist.
Each element of genlist should have additional spaces at right
and left side. Also this commit should make verticles round.
Change-Id: I1c58f5fecc70db97c9586472dde099cd248479fc
accessibility-smart-switch-accessory-popup;
genlist;
spinner-layout;
- spinner-layout-toggle;)
+ spinner-layout-toggle;
+ main-layout;)
FOREACH(F ${EDC_LIST})
ADD_CUSTOM_TARGET(${F}.edj
--- /dev/null
+/*
+ * Copyright (c) 2020 Samsung Electronics Co., Ltd.
+ *
+ * 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.
+ */
+
+#define PADDING_SIZE 40
+
+collections
+{
+ base_scale: 1.8;
+
+ group { "settings/main_layout";
+ parts {
+ rect { "base";
+ desc { "default";
+ color: 238 239 241 255;
+ }
+ }
+ spacer { "padding.left"; scale;
+ desc { "default";
+ min: PADDING_SIZE 0;
+ max: PADDING_SIZE -1;
+ fixed: 1 0;
+ align: 0.0 0.0;
+ rel.to: "base";
+ }
+ }
+ spacer { "padding.right"; scale;
+ desc { "default";
+ min: PADDING_SIZE 0;
+ max: PADDING_SIZE -1;
+ fixed: 1 0;
+ align: 1.0 0.0;
+ rel.to: "base";
+ }
+ }
+ swallow { "elm.swallow.content";
+ desc { "default";
+ rel1 { relative: 1.0 0.0; to: "padding.left"; }
+ rel2 { relative: 0.0 1.0; to: "padding.right"; }
+ }
+ }
+ }
+ }
+}
const std::string &style)
{
naviframeStack_.push(std::make_pair(content, prevBtn));
+
+ auto layout = Widget::make<Layout>(this, "edje/main-layout.edj", "settings/main_layout");
+ layout->setContent("elm.swallow.content", content);
+
auto top = elm_naviframe_item_push(uniqueObj_.get(),
title.c_str(),
prevBtn ? prevBtn->getObject() : nullptr,
nullptr,
- content->getObject(),
+ layout->getObject(),
style.c_str());
if (onPopCb) {
naviframeCallbacks_.insert_or_assign(top, std::move(onPopCb));
--- /dev/null
+#include <Elementary.h>
+
+#include "GenlistItemStyle.hpp"
+
+namespace {
+
+const char * const GROUP_STYLE = "group_index";
+
+const char * const GENLIST_ITEM_STYLE_SINGLE = "elm,state,group,single";
+const char * const GENLIST_ITEM_STYLE_TOP = "elm,state,group,top";
+const char * const GENLIST_ITEM_STYLE_BOTTOM = "elm,state,group,bottom";
+const char * const GENLIST_ITEM_STYLE_MIDDLE = "elm,state,group,middle";
+
+bool itemHaveStyle(Elm_Object_Item *item, const char *style) {
+ if (!item)
+ return false;
+
+ const Elm_Genlist_Item_Class *itc = elm_genlist_item_item_class_get(item);
+
+ if (!itc || !itc->item_style || strcmp(itc->item_style, style))
+ return false;
+
+ return true;
+}
+
+} // anonymous namespace
+
+namespace Style {
+
+void setGenlistItemStyle(void *eventInfo) {
+ if (!eventInfo)
+ return;
+
+ Elm_Object_Item *item = static_cast<Elm_Object_Item*>(eventInfo);
+ Elm_Object_Item *prev = elm_genlist_item_prev_get(item);
+ Elm_Object_Item *next = elm_genlist_item_next_get(item);
+
+ bool first = true;
+ bool last = true;
+
+ if (prev)
+ first = itemHaveStyle(prev, GROUP_STYLE);
+
+ if (next)
+ last = itemHaveStyle(next, GROUP_STYLE);
+
+ if (first && last) {
+ elm_object_item_signal_emit(item, GENLIST_ITEM_STYLE_SINGLE, "elm");
+ } else if (first) {
+ elm_object_item_signal_emit(item, GENLIST_ITEM_STYLE_TOP, "elm");
+ } else if (last) {
+ elm_object_item_signal_emit(item, GENLIST_ITEM_STYLE_BOTTOM, "elm");
+ } else {
+ elm_object_item_signal_emit(item, GENLIST_ITEM_STYLE_MIDDLE, "elm");
+ }
+}
+
+} // namespace Style
+
--- /dev/null
+#ifndef GENLIST_ITEM_STYLE_HPP
+#define GENLIST_ITEM_STYLE_HPP
+
+namespace Style {
+
+void setGenlistItemStyle(void *eventInfo);
+
+} //namespace Style
+
+#endif
#include "ListPresenter.hpp"
#include "NavigationContext.hpp"
#include "Singleton.hpp"
+#include "GenlistItemStyle.hpp"
ListView::ListView(const NavigationContext &context, Presenter *presenter)
: NaviframeView(context), listPresenter_(dynamic_cast<ListPresenter *>(presenter))
genlist_ = Widget::make<Genlist>(naviframe_);
genlist_->setMode(ELM_LIST_COMPRESS);
genlist_->setStyle("dialogue");
+ genlist_->setEvasSmartCallback("realized", [](void *infoEvent) {Style::setGenlistItemStyle(infoEvent);});
addItemsToGenlist();
listPresenter_->setOnListUpdateCallback([this]() {