From cc0c28ffdf78ffe3c34c1ac5c3ff22bfae68c9b3 Mon Sep 17 00:00:00 2001 From: Adam Skobodzinski Date: Tue, 27 Oct 2015 13:16:36 +0100 Subject: [PATCH] UrlHistoryList: adjusting height to the items number. [Issue] https://bugs.tizen.org/jira/browse/TT-161 [Problem] When displayed small number of items in a list, fragment of list widget was stopping cursor focus events. [Cause] Widget size was bigger then sum of items height for small amount of items. [Solution] Resizing list depending on the number of added items. [Verify] Area under list should not block cursor focus events. E.g. in QuickAcces 'Most visited' button should be cursor-focusable for one item on a UrlHistoryList. Change-Id: Ie9a0898e78cd42de8df2b97ca88321ed0361ac99 Signed-off-by: Adam Skobodzinski --- services/WebPageUI/UrlHistoryList/GenlistManager.cpp | 19 +++++++++++++++++++ services/WebPageUI/UrlHistoryList/GenlistManager.h | 4 ++++ services/WebPageUI/edc/UrlHistoryList.edc | 7 +------ 3 files changed, 24 insertions(+), 6 deletions(-) diff --git a/services/WebPageUI/UrlHistoryList/GenlistManager.cpp b/services/WebPageUI/UrlHistoryList/GenlistManager.cpp index 2b17152..8561de5 100644 --- a/services/WebPageUI/UrlHistoryList/GenlistManager.cpp +++ b/services/WebPageUI/UrlHistoryList/GenlistManager.cpp @@ -134,6 +134,8 @@ void GenlistManager::showWidget(const string& editedUrl, } m_itemsManager->setItems( { GenlistItemType::ITEM_LAST }, itemAppended); + adjustWidgetHeight(); + if (getWidgetPreviouslyHidden()) { setWidgetPreviouslyHidden(false); startScrollIn(); @@ -193,6 +195,23 @@ void GenlistManager::onMouseClick() } } +void GenlistManager::adjustWidgetHeight() +{ + const int ITEMS_NUMBER = elm_genlist_items_count(m_genlist); + if (ITEMS_NUMBER == 0) + return; + + int itemsVisibleNumber = HISTORY_ITEMS_VISIBLE_MAX; + if (ITEMS_NUMBER < itemsVisibleNumber) + itemsVisibleNumber = ITEMS_NUMBER; + + Evas_Coord w, h; + evas_object_geometry_get(m_genlist, nullptr, nullptr, &w, nullptr); + h = HISTORY_ITEM_H * itemsVisibleNumber; + + evas_object_resize(m_genlist, w, h); +} + void GenlistManager::startScrollIn() { if (m_itemsManager->getItem(GenlistItemType::ITEM_FIRST)) { diff --git a/services/WebPageUI/UrlHistoryList/GenlistManager.h b/services/WebPageUI/UrlHistoryList/GenlistManager.h index bec4f4c..48ed3bd 100644 --- a/services/WebPageUI/UrlHistoryList/GenlistManager.h +++ b/services/WebPageUI/UrlHistoryList/GenlistManager.h @@ -105,6 +105,10 @@ private: void onMouseFocusChange(bool mouseInsideWidget); + /** + * Adjust widget's height to item's number. + */ + void adjustWidgetHeight(); void startScrollIn(); void startScrollOut(); diff --git a/services/WebPageUI/edc/UrlHistoryList.edc b/services/WebPageUI/edc/UrlHistoryList.edc index 156ad2e..febb024 100644 --- a/services/WebPageUI/edc/UrlHistoryList.edc +++ b/services/WebPageUI/edc/UrlHistoryList.edc @@ -4,11 +4,6 @@ #define URI_INPUTBOX_LENGTH_SHORT 1460 #define HISTORY_ITEM_W URI_INPUTBOX_LENGTH #define HISTORY_ITEM_H 82 -#define HISTORY_ITEMS_VISIBLE_MAX 5 -/* - has to be a multiple of item's height. -*/ -#define LIST_MAX_H HISTORY_ITEM_H*HISTORY_ITEMS_VISIBLE_MAX collections { group { @@ -20,7 +15,7 @@ collections { type: SWALLOW; description { color: 255 0 0 150; - min: URI_INPUTBOX_LENGTH_SHORT LIST_MAX_H; + min: URI_INPUTBOX_LENGTH_SHORT 0; max: -1 -1; visible: 1; align: 0.0 0.0; -- 2.7.4