From: DoHyun Pyun Date: Tue, 26 May 2020 03:49:45 +0000 (+0900) Subject: Apply new genlist style for common profile X-Git-Tag: accepted/tizen/unified/20200528.133019^0 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=14328bfc7f391933fbbd8d18326fae3ff6d81b8f;p=apps%2Fnative%2Fug-bluetooth-efl.git Apply new genlist style for common profile Change-Id: I71cd26bcf5117c51a9ee55a5c3a1c75b7736065b Signed-off-by: DoHyun Pyun --- diff --git a/common/include/bt-main-ug.h b/common/include/bt-main-ug.h index 265bb34..51a0510 100644 --- a/common/include/bt-main-ug.h +++ b/common/include/bt-main-ug.h @@ -59,6 +59,7 @@ extern "C" { #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 _ diff --git a/common/include/bt-widget.h b/common/include/bt-widget.h index 9236b70..8eff341 100644 --- a/common/include/bt-widget.h +++ b/common/include/bt-widget.h @@ -34,28 +34,35 @@ extern "C" { #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" diff --git a/common/src/ui/bt-main-view.c b/common/src/ui/bt-main-view.c index 750b32b..ce6642b 100644 --- a/common/src/ui/bt-main-view.c +++ b/common/src/ui/bt-main-view.c @@ -1780,6 +1780,50 @@ void _bt_main_add_device_name_item(bt_ug_data *ugd, Evas_Object *genlist) 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) { @@ -1803,6 +1847,9 @@ static Evas_Object *__bt_main_add_genlist_dialogue(Evas_Object *parent, 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); @@ -2727,6 +2774,7 @@ Elm_Object_Item *_bt_main_add_searched_device(bt_ug_data *ugd, bt_dev_t *dev) 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); @@ -2737,6 +2785,7 @@ Elm_Object_Item *_bt_main_add_searched_device(bt_ug_data *ugd, bt_dev_t *dev) 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 = @@ -2746,15 +2795,29 @@ Elm_Object_Item *_bt_main_add_searched_device(bt_ug_data *ugd, bt_dev_t *dev) 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; } } diff --git a/common/src/ui/bt-profile-view.c b/common/src/ui/bt-profile-view.c index e92eeec..bba884d 100644 --- a/common/src/ui/bt-profile-view.c +++ b/common/src/ui/bt-profile-view.c @@ -1491,6 +1491,48 @@ static int __bt_profile_get_item_type(bt_profile_view_data *vd, Elm_Object_Item 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; @@ -1505,6 +1547,9 @@ static void __bt_profile_gl_realized(void *data, Evas_Object *obj, void *event_i 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); diff --git a/common/src/ui/bt-widget.c b/common/src/ui/bt-widget.c index 70db696..60cd12e 100644 --- a/common/src/ui/bt-widget.c +++ b/common/src/ui/bt-widget.c @@ -133,11 +133,17 @@ Evas_Object *_bt_main_base_layout_create(Evas_Object *parent, void *data) 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; diff --git a/data/CMakeLists.txt b/data/CMakeLists.txt index 7d87b7a..afa1af8 100644 --- a/data/CMakeLists.txt +++ b/data/CMakeLists.txt @@ -15,8 +15,18 @@ ADD_CUSTOM_TARGET(bluetooth_genlist.edj ${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}) diff --git a/data/theme_2.3/main_layout.edc b/data/theme_2.3/main_layout.edc new file mode 100644 index 0000000..66df75e --- /dev/null +++ b/data/theme_2.3/main_layout.edc @@ -0,0 +1,68 @@ +/* + * 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"; + } + } + } + } +}