#define _EDJ(o) elm_layout_edje_get(o)
#define BT_ICON_EDJ BT_EDJ_PATH"/bluetooth_images.edj"
#define BT_GENLIST_EDJ BT_EDJ_PATH"/bluetooth_genlist.edj"
+#define BT_COMMON_MAIN_LAYOUT_EDJ BT_EDJ_PATH"/main_layout.edj"
#ifdef _
#undef _
#include "bt-util.h"
typedef enum {
+ BT_GENLIST_GROUP_SINGLE = 0,
+ BT_GENLIST_GROUP_TOP,
+ BT_GENLIST_GROUP_MIDDLE,
+ BT_GENLIST_GROUP_BOTTOM,
+} bt_genlist_group_style_t;
+
+typedef enum {
BT_GENLIST_1LINE = 0,
- BT_GENLIST_2LINE,
- BT_GENLIST_MULTILINE,
+ BT_GENLIST_2LINE_TOP,
+ BT_GENLIST_2LINE_BOTTOM,
} bt_genlist_type_t;
static inline char* get_genlist_style(bt_genlist_type_t type)
{
- if (type == BT_GENLIST_MULTILINE)
- return TIZEN_COMMON ? "2line" : "multiline";
- else if (type == BT_GENLIST_2LINE)
+ if (type == BT_GENLIST_2LINE_BOTTOM)
return TIZEN_COMMON ? "2line" : "type2";
+ else if (type == BT_GENLIST_2LINE_TOP)
+ return TIZEN_COMMON ? "2line" : "type1";
else
return TIZEN_COMMON ? "1line" : "type1";
}
#define BT_GENLIST_1LINE_TEXT_STYLE get_genlist_style(BT_GENLIST_1LINE)
#define BT_GENLIST_1LINE_TEXT_ICON_STYLE get_genlist_style(BT_GENLIST_1LINE)
-#define BT_GENLIST_2LINE_TOP_TEXT_STYLE get_genlist_style(BT_GENLIST_1LINE)
-#define BT_GENLIST_2LINE_TOP_TEXT_ICON_STYLE get_genlist_style(BT_GENLIST_1LINE)
-#define BT_GENLIST_2LINE_BOTTOM_TEXT_STYLE get_genlist_style(BT_GENLIST_2LINE)
-#define BT_GENLIST_2LINE_BOTTOM_TEXT_ICON_STYLE get_genlist_style(BT_GENLIST_2LINE)
-#define BT_GENLIST_MULTILINE_TEXT_STYLE get_genlist_style(BT_GENLIST_MULTILINE)
+#define BT_GENLIST_2LINE_TOP_TEXT_STYLE get_genlist_style(BT_GENLIST_2LINE_TOP)
+#define BT_GENLIST_2LINE_TOP_TEXT_ICON_STYLE get_genlist_style(BT_GENLIST_2LINE_TOP)
+#define BT_GENLIST_2LINE_BOTTOM_TEXT_STYLE get_genlist_style(BT_GENLIST_2LINE_BOTTOM)
+#define BT_GENLIST_2LINE_BOTTOM_TEXT_ICON_STYLE get_genlist_style(BT_GENLIST_2LINE_BOTTOM)
+#define BT_GENLIST_MULTILINE_TEXT_STYLE "multiline"
#define BT_GENLIST_GROUP_INDEX_STYLE "group_index"
#define BT_GENLIST_FULL_CONTENT_STYLE "full"
FN_END;
}
+static void __bt_main_gl_realized(void *data, Evas_Object *obj, void *event_info)
+{
+ if (!data || !obj || !event_info)
+ return;
+
+ int group_type = BT_GENLIST_GROUP_MIDDLE;
+ Elm_Object_Item *item = (Elm_Object_Item *)event_info;
+ Elm_Object_Item *prev_item = elm_genlist_item_prev_get(item);
+ Elm_Object_Item *next_item = elm_genlist_item_next_get(item);
+ bt_ug_data *ugd = (bt_ug_data *)data;
+
+ /* onoff / device name item style */
+ if (item == ugd->onoff_item) {
+ group_type = BT_GENLIST_GROUP_TOP;
+ } else if (item == ugd->device_name_item) {
+ group_type = BT_GENLIST_GROUP_BOTTOM;
+ } else {
+ if (prev_item == ugd->paired_title) {
+ /* The first paired item */
+ if (next_item == ugd->searched_title)
+ group_type = BT_GENLIST_GROUP_SINGLE;
+ else
+ group_type = BT_GENLIST_GROUP_TOP;
+ } else if (prev_item == ugd->searched_title) {
+ /* The first searched item */
+ if (next_item == NULL)
+ group_type = BT_GENLIST_GROUP_SINGLE;
+ else
+ group_type = BT_GENLIST_GROUP_TOP;
+ } else if (next_item == ugd->searched_title || next_item == ugd->no_device_item || next_item == NULL) {
+ group_type = BT_GENLIST_GROUP_BOTTOM;
+ }
+ }
+
+ if (group_type == BT_GENLIST_GROUP_SINGLE)
+ elm_object_item_signal_emit(item, "elm,state,group,single", "elm");
+ else if (group_type == BT_GENLIST_GROUP_TOP)
+ elm_object_item_signal_emit(item, "elm,state,group,top", "elm");
+ else if (group_type == BT_GENLIST_GROUP_BOTTOM)
+ elm_object_item_signal_emit(item, "elm,state,group,bottom", "elm");
+ else
+ elm_object_item_signal_emit(item, "elm,state,group,middle", "elm");
+}
+
static Evas_Object *__bt_main_add_genlist_dialogue(Evas_Object *parent,
bt_ug_data *ugd)
{
evas_object_smart_callback_add(genlist, "unhighlighted",
__bt_main_gl_unhighlighted, ugd);
+ if (TIZEN_COMMON)
+ evas_object_smart_callback_add(genlist, "realized", __bt_main_gl_realized, ugd);
+
ugd->on_itc = elm_genlist_item_class_new();
retv_if(ugd->on_itc == NULL, NULL);
bt_dev_t *item_dev = NULL;
Elm_Object_Item *item = NULL;
Elm_Object_Item *next = NULL;
+ Elm_Object_Item *prev = NULL;
item = elm_genlist_item_next_get(ugd->searched_title);
retv_if(item_dev == NULL, NULL);
if (item_dev->rssi > dev->rssi) {
+ prev = elm_genlist_item_prev_get(item);
next = elm_genlist_item_next_get(item);
if (next == NULL) {
git =
ELM_GENLIST_ITEM_NONE,
__bt_main_searched_item_sel_cb,
ugd);
+
+ if (TIZEN_COMMON && prev == ugd->searched_title)
+ elm_object_item_signal_emit(item, "elm,state,group,top", "elm");
+
break;
}
item = next;
} else {
+ next = elm_genlist_item_next_get(item);
+
git =
elm_genlist_item_insert_before
(ugd->main_genlist, ugd->searched_device_itc, dev,
NULL, item, ELM_GENLIST_ITEM_NONE,
__bt_main_searched_item_sel_cb, ugd);
+
+ if (TIZEN_COMMON) {
+ if (next == NULL)
+ elm_object_item_signal_emit(item, "elm,state,group,bottom", "elm");
+ else
+ elm_object_item_signal_emit(item, "elm,state,group,middle", "elm");
+ }
+
break;
}
}
return BT_ITEM_NONE;
}
+static void __bt_profile_common_gl_realized(void *data, Evas_Object *obj, void *event_info)
+{
+ if (!data || !obj || !event_info)
+ return;
+
+ int group_type = BT_GENLIST_GROUP_MIDDLE;
+ Elm_Object_Item *item = (Elm_Object_Item *)event_info;
+ Elm_Object_Item *prev_item = elm_genlist_item_prev_get(item);
+ Elm_Object_Item *next_item = elm_genlist_item_next_get(item);
+ bt_ug_data *ugd = (bt_ug_data *)data;
+ bt_profile_view_data *vd;
+
+ vd = ugd->profile_vd;
+ ret_if(vd == NULL);
+
+ /* device name / unpair item style */
+ if (item == vd->name_item) {
+ group_type = BT_GENLIST_GROUP_TOP;
+ } else if (item == vd->unpair_item) {
+ group_type = BT_GENLIST_GROUP_BOTTOM;
+ } else {
+ if (prev_item == vd->title_item) {
+ /* The first connection option */
+ if (next_item == NULL)
+ group_type = BT_GENLIST_GROUP_SINGLE;
+ else
+ group_type = BT_GENLIST_GROUP_TOP;
+ } else if (next_item == NULL) {
+ group_type = BT_GENLIST_GROUP_BOTTOM;
+ }
+ }
+
+ if (group_type == BT_GENLIST_GROUP_SINGLE)
+ elm_object_item_signal_emit(item, "elm,state,group,single", "elm");
+ else if (group_type == BT_GENLIST_GROUP_TOP)
+ elm_object_item_signal_emit(item, "elm,state,group,top", "elm");
+ else if (group_type == BT_GENLIST_GROUP_BOTTOM)
+ elm_object_item_signal_emit(item, "elm,state,group,bottom", "elm");
+ else
+ elm_object_item_signal_emit(item, "elm,state,group,middle", "elm");
+}
+
static void __bt_profile_gl_realized(void *data, Evas_Object *obj, void *event_info)
{
FN_START;
bt_dev_t *dev_info;
#endif
+ if (TIZEN_COMMON)
+ return __bt_profile_common_gl_realized(data, obj, event_info);
+
ret_if(data == NULL);
ret_if(item == NULL);
layout = elm_layout_add(parent);
retv_if(!layout, NULL);
- elm_layout_theme_set(layout, "layout", "application", "default");
+ if (TIZEN_COMMON) {
+ elm_layout_file_set(layout, BT_COMMON_MAIN_LAYOUT_EDJ, "main_layout");
+ } else {
+ Evas_Object *bg = NULL;
- Evas_Object *bg = __bt_create_bg(layout, "default");
- elm_object_part_content_set(layout, "elm.swallow.bg", bg);
- evas_object_show(layout);
+ elm_layout_theme_set(layout, "layout", "application", "default");
+
+ bg = __bt_create_bg(layout, "default");
+ elm_object_part_content_set(layout, "elm.swallow.bg", bg);
+ evas_object_show(layout);
+ }
FN_END;
return layout;
${CMAKE_CURRENT_SOURCE_DIR}/${TARGET}/bluetooth_genlist.edc
)
+ADD_CUSTOM_TARGET(main_layout.edj
+ COMMAND edje_cc -id ${CMAKE_CURRENT_SOURCE_DIR}/images/WVGA
+ ${CMAKE_CURRENT_SOURCE_DIR}/${TARGET}/main_layout.edc
+ ${CMAKE_CURRENT_SOURCE_DIR}/${TARGET}/main_layout.edj
+ DEPENDS
+ ${CMAKE_CURRENT_SOURCE_DIR}/${TARGET}/main_layout.edc
+ )
+
ADD_DEPENDENCIES(${PROJECT_NAME} bluetooth_images.edj)
ADD_DEPENDENCIES(${PROJECT_NAME} bluetooth_genlist.edj)
+ADD_DEPENDENCIES(${PROJECT_NAME} main_layout.edj)
INSTALL(FILES ${CMAKE_CURRENT_SOURCE_DIR}/${TARGET}/bluetooth_images.edj DESTINATION ${EDJDIR})
INSTALL(FILES ${CMAKE_CURRENT_SOURCE_DIR}/${TARGET}/bluetooth_genlist.edj DESTINATION ${EDJDIR})
+INSTALL(FILES ${CMAKE_CURRENT_SOURCE_DIR}/${TARGET}/main_layout.edj DESTINATION ${EDJDIR})
--- /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 { "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 0.0;
+ to_x: "padding.right";
+ to_y: "padding.bottom";
+ }
+ }
+ }
+ spacer { "padding.bottom"; scale;
+ desc { "default";
+ min: 0 PADDING_SIZE;
+ max: -1 PADDING_SIZE;
+ fixed: 0 1;
+ align: 0.0 1.0;
+ rel.to: "base";
+ }
+ }
+ }
+ }
+}