diff options
author | Maciej Skrzypkowski <m.skrzypkows@samsung.com> | 2015-11-06 10:03:07 +0100 |
---|---|---|
committer | Hye Kyoung Hwang <cookie@samsung.com> | 2015-11-08 20:45:56 -0800 |
commit | 1f03aa44ca63ec6eadcb7b5abbf3447d1e2a52da (patch) | |
tree | 5f91cec8ec0e1e643ceac66ebe898b09834a00fe /services/QuickAccess | |
parent | bf372964ba19d06c3fa4bb37d9de1ac479eb0ead (diff) | |
download | browser-1f03aa44ca63ec6eadcb7b5abbf3447d1e2a52da.tar.gz browser-1f03aa44ca63ec6eadcb7b5abbf3447d1e2a52da.tar.bz2 browser-1f03aa44ca63ec6eadcb7b5abbf3447d1e2a52da.zip |
Scroller for QuickAccess mobile view
[Issue#] https://bugs.tizen.org/jira/browse/TM-34
[Problem] N/A
[Cause] N/A
[Solution] Added scroller and compilation flag for mobile view.
[Verify] Open QuickAccess view on mobile, open few pages, check
if scroller works on QA.
Change-Id: I1f08a38efc057a02f8a7afa1f8effb9b38307dec
Signed-off-by: Maciej Skrzypkowski <m.skrzypkows@samsung.com>
Diffstat (limited to 'services/QuickAccess')
-rw-r--r-- | services/QuickAccess/QuickAccess.cpp | 49 | ||||
-rw-r--r-- | services/QuickAccess/QuickAccess.h | 10 | ||||
-rw-r--r-- | services/QuickAccess/edc/QuickAccess_mob.edc | 246 |
3 files changed, 179 insertions, 126 deletions
diff --git a/services/QuickAccess/QuickAccess.cpp b/services/QuickAccess/QuickAccess.cpp index 8288e9b5..0bdec977 100644 --- a/services/QuickAccess/QuickAccess.cpp +++ b/services/QuickAccess/QuickAccess.cpp @@ -73,6 +73,10 @@ QuickAccess::QuickAccess() , m_parentFocusChain(nullptr) , m_bookmark_item_class(nullptr) , m_detailPopup(this) +#if PROFILE_MOBILE + , m_scroller(nullptr) + , m_centerLayout(nullptr) +#endif { BROWSER_LOGD("%s:%d %s", __FILE__, __LINE__, __func__); edjFilePath = EDJE_DIR; @@ -146,7 +150,7 @@ Evas_Object* QuickAccess::createQuickAccessLayout(Evas_Object* parent) return layout; } -Evas_Object* QuickAccess::createMostVisitedView (Evas_Object * parent) +Evas_Object* QuickAccess::createMostVisitedView(Evas_Object * parent) { BROWSER_LOGD("%s:%d %s", __FILE__, __LINE__, __func__); @@ -158,6 +162,23 @@ Evas_Object* QuickAccess::createMostVisitedView (Evas_Object * parent) Evas_Object* topButtons = createTopButtons(mostVisitedLayout); elm_object_part_content_set(mostVisitedLayout, "elm.swallow.layoutTop", topButtons); +#if PROFILE_MOBILE + m_scroller = elm_scroller_add(mostVisitedLayout); + evas_object_size_hint_weight_set(m_scroller, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); + evas_object_size_hint_align_set (m_scroller, EVAS_HINT_FILL, EVAS_HINT_FILL); + elm_scroller_policy_set(m_scroller, ELM_SCROLLER_POLICY_OFF, ELM_SCROLLER_POLICY_OFF); + elm_scroller_bounce_set(m_scroller, EINA_FALSE, EINA_FALSE); + elm_object_part_content_set(mostVisitedLayout, "center_swallow", m_scroller); + evas_object_show(m_scroller); + + m_centerLayout = elm_layout_add(m_scroller); + elm_layout_file_set(m_centerLayout, edjFilePath.c_str(), "center_layout"); + evas_object_size_hint_weight_set(m_centerLayout, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); + evas_object_size_hint_align_set (m_centerLayout, EVAS_HINT_FILL, EVAS_HINT_FILL); + elm_object_content_set(m_scroller, m_centerLayout); + evas_object_show(m_centerLayout); +#endif + return mostVisitedLayout; } @@ -280,7 +301,11 @@ void QuickAccess::addHistoryItem(std::shared_ptr<services::HistoryItem> hi) itemData->item = hi; itemData->quickAccess = std::shared_ptr<QuickAccess>(this); +#if PROFILE_MOBILE + Evas_Object* tile = elm_button_add(m_centerLayout); +#else Evas_Object* tile = elm_button_add(m_mostVisitedView); +#endif if (tileNumber == BIG_TILE_INDEX) elm_object_style_set(tile, "big_tile"); else @@ -288,14 +313,18 @@ void QuickAccess::addHistoryItem(std::shared_ptr<services::HistoryItem> hi) evas_object_size_hint_weight_set(tile, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); evas_object_size_hint_align_set (tile, EVAS_HINT_FILL, EVAS_HINT_FILL); evas_object_show(tile); +#if PROFILE_MOBILE + elm_object_part_content_set(m_centerLayout, TILES_NAMES[tileNumber].c_str(), tile); +#else elm_object_part_content_set(m_mostVisitedView, TILES_NAMES[tileNumber].c_str(), tile); +#endif m_tiles.push_back(tile); elm_layout_text_set(tile, "page_title", hi->getTitle().c_str()); elm_layout_text_set(tile, "page_url", hi->getUrl().c_str()); Evas_Object * thumb = tizen_browser::tools::EflTools::getEvasImage(hi->getThumbnail(), m_parent); elm_object_part_content_set(tile, "elm.thumbnail", thumb); - evas_object_smart_callback_add(tile, "clicked", _thumbHistoryClicked, itemData); + evas_object_smart_callback_add(tile, "clicked", _thumbMostVisitedClicked, itemData); m_historyItems.push_back(hi); } @@ -313,6 +342,14 @@ void QuickAccess::addHistoryItems(std::shared_ptr<services::HistoryItemVector> i } if (i>0) setEmptyView(false); + +#if PROFILE_MOBILE + if (items->size() > FIXED_SIZE_TILES_NUMBER) { + elm_object_signal_emit(m_centerLayout, "set_fixed_size", "ui"); + } else { + elm_object_signal_emit(m_centerLayout, "set_dynamic_size", "ui"); + } +#endif } void QuickAccess::addBookmarkItem(std::shared_ptr<tizen_browser::services::BookmarkItem> bi) @@ -371,12 +408,16 @@ void QuickAccess::_thumbBookmarkClicked(void * data, Evas_Object * , void *) itemData->quickAccess->m_after_history_thumb = false; } -void QuickAccess::_thumbHistoryClicked(void* data, Evas_Object*, void*) +void QuickAccess::_thumbMostVisitedClicked(void* data, Evas_Object*, void*) { BROWSER_LOGD("%s:%d %s", __FILE__, __LINE__, __func__); HistoryItemData * itemData = reinterpret_cast<HistoryItemData *>(data); +#if PROFILE_MOBILE + itemData->quickAccess->openURLInNewTab(itemData->item, false); +#else itemData->quickAccess->mostVisitedTileClicked(itemData->item, DetailPopup::HISTORY_ITEMS_NO); itemData->quickAccess->m_after_history_thumb = true; +#endif } void QuickAccess::clearHistoryGenlist() @@ -384,7 +425,7 @@ void QuickAccess::clearHistoryGenlist() BROWSER_LOGD("%s:%d %s", __FILE__, __LINE__, __func__); for (auto it = m_tiles.begin(); it != m_tiles.end(); ++it) { - evas_object_smart_callback_del(*it, "clicked", _thumbHistoryClicked); + evas_object_smart_callback_del(*it, "clicked", _thumbMostVisitedClicked); evas_object_del(*it); } diff --git a/services/QuickAccess/QuickAccess.h b/services/QuickAccess/QuickAccess.h index d89d4e9c..19a92b3a 100644 --- a/services/QuickAccess/QuickAccess.h +++ b/services/QuickAccess/QuickAccess.h @@ -31,8 +31,6 @@ namespace tizen_browser{ namespace base_ui{ -//TODO: This class name is not revelant to what this class actually does. -//Rename this class and file to "QuickAccessUI". class BROWSER_EXPORT QuickAccess : public tizen_browser::core::AbstractService { @@ -85,7 +83,7 @@ private: static char* _grid_bookmark_text_get(void *data, Evas_Object *obj, const char *part); static Evas_Object * _grid_bookmark_content_get(void *data, Evas_Object *obj, const char *part); static void _thumbBookmarkClicked(void * data, Evas_Object * obj, void * event_info); - static void _thumbHistoryClicked(void * data, Evas_Object * obj, void * event_info); + static void _thumbMostVisitedClicked(void * data, Evas_Object * obj, void * event_info); void setEmptyView(bool empty); void showNoHistoryLabel(); @@ -117,6 +115,12 @@ private: static const int TOP_RIGHT_TILE_INDEX; static const int BOTTOM_RIGHT_TILE_INDEX; static const std::vector<std::string> TILES_NAMES; + +#if PROFILE_MOBILE + Evas_Object *m_scroller; + Evas_Object *m_centerLayout; + static const int FIXED_SIZE_TILES_NUMBER = 3; +#endif }; } diff --git a/services/QuickAccess/edc/QuickAccess_mob.edc b/services/QuickAccess/edc/QuickAccess_mob.edc index 02a3b807..c99f6097 100644 --- a/services/QuickAccess/edc/QuickAccess_mob.edc +++ b/services/QuickAccess/edc/QuickAccess_mob.edc @@ -13,8 +13,9 @@ collections { #define BIG_TILE_HEIGHT 450 #define SMALL_TILE_WIDTH 319 #define SMALL_TILE_HEIGHT 361 -#define TILE_SEPARATOR 18 +#define TILE_SEPARATOR 36 #define TILE_LABEL_BG_HEIGHT 100 +#define TOTAL_TILES_HEIGHT 1264 group { name: "elm/button/base/thumbButton"; @@ -175,6 +176,101 @@ group { name: "mv_bookmarks"; } } + part { name: "center_swallow"; + type: SWALLOW; + scale: 1; + description { state: "default" 0.0; + align: 0 0; + visible: 1; + rel1 { + to: "center_rect"; + relative: 0 0; + } + rel2 { + to: "center_rect"; + relative: 1 1; + } + } + description { state: "empty" 0.0; + inherit: "default" 0.0; + visible: 0; + } + } + + part { name: "elm.text.empty"; + type: TEXT; + scale: 1; + description { state: "default" 0.0; + visible: 0; + align: 0.5 0.5; + color: 0 0 0 179; + text { + text: "empty"; + font: "Sans"; + size: 32; + align: 0.5 0.5; + } + rel1 { + to: "bg"; + relative: 0.0 0.0; + } + rel2 { + to: "bg"; + relative: 1 1; + } + } + description { state: "empty" 0.0; + inherit: "default" 0.0; + visible: 1; + } + } + } + + programs { + program { name: "empty"; + signal: "empty,view"; + source: "quickaccess"; + action: STATE_SET "empty" 0.0; + target: "elm.text.empty"; + target: "center_rect"; + target: "center_swallow"; + } + program { name: "not_empty"; + signal: "not,empty,view"; + source: "quickaccess"; + action: STATE_SET "default" 0.0; + target: "elm.text.empty"; + target: "center_rect"; + target: "center_swallow"; + } + } +} + + +group { name: "center_layout"; + parts { + part { name: "bg"; + type: RECT; + scale: 1; + description { state: "default" 0.0; + color: 0 0 0 0; + align: 0 0; + visible: 0; + rel1 { + relative: 0 0; + } + rel2 { + relative: 1 1; + } + } + description { + state: "fixed_size" 0.0; + color: 0 0 0 0; + min: 0 TOTAL_TILES_HEIGHT; + max: -1 TOTAL_TILES_HEIGHT; + } + } + part { name: "elm.swallow.big"; type: SWALLOW; scale: 1; @@ -185,13 +281,12 @@ group { name: "mv_bookmarks"; fixed: 1 1; visible: 1; rel1 { - to: "center_rect"; + to: "bg"; relative: 0 0; - offset: TILE_SEPARATOR 0; + offset: 0 76; } rel2 { relative: 1 1; - offset: 0 0; } } description { state: "empty" 0.0; @@ -215,9 +310,8 @@ group { name: "mv_bookmarks"; offset: 0 TILE_SEPARATOR; } rel2{ - to: "center_rect"; + to: "bg"; relative: 1 1; - offset: 0 0; } } description { state: "empty" 0.0; @@ -241,9 +335,8 @@ group { name: "mv_bookmarks"; offset: TILE_SEPARATOR 0; } rel2{ - to: "center_rect"; + to: "bg"; relative: 1 1; - offset: 0 0; } } description { state: "empty" 0.0; @@ -267,9 +360,8 @@ group { name: "mv_bookmarks"; offset: 0 TILE_SEPARATOR; } rel2 { - to: "center_rect"; + to: "bg"; relative: 1 1; - offset: 0 0; } } description { state: "empty" 0.0; @@ -293,70 +385,31 @@ group { name: "mv_bookmarks"; offset: TILE_SEPARATOR 0; } rel2 { - to: "center_rect"; - relative: 1 1; - offset: 0 0; - } - } - description { state: "empty" 0.0; - inherit: "default" 0.0; - visible: 0; - } - } - - part { name: "elm.text.empty"; - type: TEXT; - scale: 1; - description { state: "default" 0.0; - visible: 0; - align: 0.5 0.5; - color: 0 0 0 179; - text { - text: "empty"; - font: "Sans"; - size: 32; - align: 0.5 0.5; - } - rel1 { - to: "bg"; - relative: 0.0 0.0; - } - rel2 { to: "bg"; relative: 1 1; } } description { state: "empty" 0.0; inherit: "default" 0.0; - visible: 1; + visible: 0; } } } programs { - program { name: "empty"; - signal: "empty,view"; - source: "quickaccess"; - action: STATE_SET "empty" 0.0; - target: "elm.swallow.big"; - target: "elm.swallow.small_first"; - target: "elm.swallow.small_second"; - target: "elm.swallow.small_third"; - target: "elm.swallow.small_fourth"; - target: "elm.text.empty"; - target: "center_rect"; - } - program { name: "not_empty"; - signal: "not,empty,view"; - source: "quickaccess"; + program { + name: "set_dynamic_size"; + signal: "set_dynamic_size"; + source: "ui"; action: STATE_SET "default" 0.0; - target: "elm.text.empty"; - target: "center_rect"; - target: "elm.swallow.big"; - target: "elm.swallow.small_first"; - target: "elm.swallow.small_second"; - target: "elm.swallow.small_third"; - target: "elm.swallow.small_fourth"; + target: "bg"; + } + program { + name: "set_fixed_size"; + signal: "set_fixed_size"; + source: "ui"; + action: STATE_SET "fixed_size" 0.0; + target: "bg"; } } } @@ -364,10 +417,6 @@ group { name: "mv_bookmarks"; group { name: "elm/button/base/big_tile"; data.item: "texts" "page_title page_url"; data.item: "contents" "elm.thumbnail"; - images { - image: "web_frame_selected.png" COMP; - image: "ico_bg_round_shape_37x37.png" COMP; - } parts { part { name: "bg"; type: RECT; @@ -582,36 +631,22 @@ group { name: "elm/button/base/big_tile"; group { name: "elm/button/base/small_tile"; data.item: "texts" "page_title page_url"; data.item: "contents" "elm.thumbnail"; - images { - image: "web_frame_selected.png" COMP; - image: "ico_bg_round_shape_37x37.png" COMP; - } parts { - part { name: "container"; - type: RECT; - scale: 1; - description { state: "default" 0.0; - min: 378 320; - max: 378 320; - visible: 0; - } - } - part { name: "bg"; type: RECT; scale: 1; mouse_events: 0; description { state: "default" 0.0; - min: 378 294; - max: 378 294; + min: SMALL_TILE_WIDTH SMALL_TILE_HEIGHT; + max: SMALL_TILE_WIDTH SMALL_TILE_HEIGHT; visible: 1; color: 231 231 231 255; align: 0.0 0.0; rel1 { - relative: 0.0 0.0; to: "container"; + relative: 0.0 0.0; } rel2 { - relative: 1.0 1.0; to: "container"; + relative: 1.0 1.0; } } } @@ -623,8 +658,8 @@ group { name: "elm/button/base/small_tile"; fixed: 1 0; align: 0.0 0.0; color : 231 231 231 255; - min: 378 292; // size adjusted to max thubnail with and height - max: 378 292; + min: SMALL_TILE_WIDTH 261; // size adjusted to max thubnail with and height + max: SMALL_TILE_WIDTH 261; rel1 { relative: 0.0 0.0; to: "bg"; } @@ -713,8 +748,8 @@ group { name: "elm/button/base/small_tile"; type: RECT; scale: 1; description { state: "default" 0.0; - min: 378 96; - max: 378 96; + min: SMALL_TILE_WIDTH 100; + max: SMALL_TILE_WIDTH 100; align: 0.0 1.0; color: 113 128 147 255; visible: 1; @@ -736,14 +771,14 @@ group { name: "elm/button/base/small_tile"; type: TEXT; scale: 1; description { state: "default" 0.0; - min: 314 28; - max: 314 28; + min: 314 34; + max: 314 34; align: 0.0 0.0; color: 255 255 255 255; rel1 { to: "lb_bg"; relative: 0.0 0.0; - offset: 32 18; + offset: 33 36; } rel2 { to: "lb_bg"; @@ -758,32 +793,6 @@ group { name: "elm/button/base/small_tile"; } } - part { name: "page_url"; - type: TEXT; - scale: 1; - description { state: "default" 0.0; - min: 314 24; - max: 314 24; - align: 0 0.0; - color: 255 255 255 255; - rel1 { - to: "page_title"; - relative: 0.0 1.0; - offset: 0 8; - } - rel2 { - to: "lb_bg"; - relative: 1.0 1.0; - } - text { - text: "Web page url"; - font: "Sans"; - size: 24; - align: 0 0.5; - } - } - } - part { name: "over"; type: RECT; scale: 1; @@ -832,8 +841,7 @@ group { name: "elm/gengrid/item/grid_item/default"; data.item: "contents" "elm.thumbnail elm.thumbButton"; images { image: "web_frame_selected.png" COMP; - image: "ico_bg_round_shape_37x37.png" COMP; - image: "ic_thumbnail_favorite_01.png" COMP; + image: "ic_thumbnail_favorite_01.png" COMP; } parts { part { name: "bg"; |