Fix for N_SE-34577
authorAyush <ayush.sriv@samsung.com>
Tue, 16 Apr 2013 12:23:39 +0000 (17:53 +0530)
committerAyush <ayush.sriv@samsung.com>
Wed, 17 Apr 2013 13:38:31 +0000 (19:08 +0530)
Change-Id: Ie569f4861aad5d526df1fbd524fdcce04d535ac6
Signed-off-by: Ayush <ayush.sriv@samsung.com>
src/ui/controls/FUiCtrl_SearchBar.cpp
src/ui/controls/FUiCtrl_SearchBarPresenter.cpp
src/ui/inc/FUi_ResourceSearchBarConfig.h
src/ui/resource/FUi_ResourceSearchBarConfig.cpp

index d8ea2d1..38685c5 100644 (file)
@@ -284,8 +284,8 @@ _SearchBar::CreateSearchField(void)
        float textHorizontalMargin = 0.0f;
        float iconWidth = 0.0f;
        float textSize = 0.0f;
-       float searchFieldMinWidth = 0.0f;
        float searchBarMinHeight = 0.0f;
+       float searchBarMinWidthModeNormal = 0.0f;
 
        FloatRectangle searchBarBounds = GetBoundsF();
        _ControlOrientation orientation = _ControlManager::GetInstance()->GetOrientation();
@@ -296,17 +296,28 @@ _SearchBar::CreateSearchField(void)
        GET_SHAPE_CONFIG(SEARCHBAR::ICON_HORIZONTAL_MARGIN, orientation, iconHorizontalMargin);
        GET_SHAPE_CONFIG(SEARCHBAR::ICON_WIDTH, orientation, iconWidth);
        GET_SHAPE_CONFIG(SEARCHBAR::TEXT_HORIZONTAL_MARGIN, orientation, textHorizontalMargin);
-       GET_SHAPE_CONFIG(SEARCHBAR::SEARCH_FIELD_MIN_WIDTH, orientation, searchFieldMinWidth);
+       GET_SHAPE_CONFIG(SEARCHBAR::SEARCH_FIELD_MIN_WIDTH_NORMAL_MODE, orientation, searchBarMinWidthModeNormal);
        GET_SHAPE_CONFIG(SEARCHBAR::MIN_HEIGHT, orientation, searchBarMinHeight);
 
        float searchFieldMinHeight = searchBarMinHeight - (verticalMargin * 2.0f);
 
        editBounds.x = horizontalMargin;
+
+       if (searchBarBounds.height < searchBarMinHeight)
+       {
+               verticalMargin = (searchBarBounds.height - searchFieldMinHeight)/2.0f;
+               if (verticalMargin < 0.0f)
+               {
+                       verticalMargin = 0.0f;
+               }
+       }
+
        editBounds.y = verticalMargin;
+
        editBounds.width = searchBarBounds.width - (editBounds.x * 2.0f);
        editBounds.height = searchBarBounds.height - (editBounds.y * 2.0f);
 
-       editBounds.width = (editBounds.width > searchFieldMinWidth) ? editBounds.width : searchFieldMinWidth;
+       editBounds.width = (editBounds.width > searchBarMinWidthModeNormal) ? editBounds.width : searchBarMinWidthModeNormal;
        editBounds.height = (editBounds.height > searchFieldMinHeight) ? editBounds.height : searchFieldMinHeight;
 
        __pEdit = _Edit::CreateEditN();
@@ -2530,10 +2541,7 @@ _SearchBar::ResizeCancelButton(void)
        cancelButtonBounds.x = searchBarBounds.width - cancelButtonBounds.width - buttonRightMargin;
        cancelButtonBounds.y = (searchBarBounds.height - cancelButtonBounds.height)/2.0f;
 
-       if (searchBarBounds.height < searchBarMinHeight)
-       {
-               cancelButtonBounds.y = buttonVerticalMargin;
-       }
+       cancelButtonBounds.y = cancelButtonBounds.y < 0.0f ? 0.0f:cancelButtonBounds.y;
 
        if (cancelButtonBounds.width < buttonMinWidth)
        {
@@ -2562,8 +2570,10 @@ _SearchBar::RecalculateButtonBounds(void)
        float searchBarMinHeight = 0.0f;
        float buttonWidth = 0.0f;
        float buttonHeight = 0.0f;
+       float cancelButtonWidth = 0.0f;
 
        FloatRectangle cancelButtonBounds;
+       FloatRectangle editBounds;
        FloatRectangle searchBarBounds = GetBoundsF();
 
        _ControlOrientation orientation = _ControlManager::GetInstance()->GetOrientation();
@@ -2581,16 +2591,22 @@ _SearchBar::RecalculateButtonBounds(void)
 
        cancelButtonBounds.height = buttonHeight;
 
-       FloatRectangle editBounds;
-
-       float cancelButtonWidth = 0;
+       float searchFieldMinHeight = searchBarMinHeight - (verticalMargin * 2.0f);
        cancelButtonWidth = __pCancelButton->GetTextExtentSizeF() + __pCancelButton->GetRightTouchMarginF() + __pCancelButton->GetLeftTouchMarginF() + __pCancelButton->GetRightMarginF() + __pCancelButton->GetLeftMarginF();
        editBounds.x = horizontalMargin;
-       editBounds.y = verticalMargin;
 
+       if (searchBarBounds.height < searchBarMinHeight)
+       {
+               verticalMargin = (searchBarBounds.height - searchFieldMinHeight)/2.0f;
+               if (verticalMargin < 0.0f)
+               {
+                       verticalMargin = 0.0f;
+               }
+       }
+
+       editBounds.y = verticalMargin;
        editBounds.height = searchBarBounds.height - (editBounds.y * 2.0f);
 
-       float searchFieldMinHeight = searchBarMinHeight - (verticalMargin * 2.0f);
        editBounds.height = (editBounds.height > searchFieldMinHeight) ? editBounds.height : searchFieldMinHeight;
 
        editBounds.width = searchBarBounds.width - cancelButtonWidth - horizontalMargin - buttonLeftMargin - buttonRightMargin;
@@ -2603,10 +2619,7 @@ _SearchBar::RecalculateButtonBounds(void)
        cancelButtonBounds.x = editBounds.width + horizontalMargin + buttonLeftMargin;
        cancelButtonBounds.y = (searchBarBounds.height - cancelButtonBounds.height)/2.0f;
 
-       if (searchBarBounds.height < searchBarMinHeight)
-       {
-               cancelButtonBounds.y = buttonVerticalMargin;
-       }
+       cancelButtonBounds.y = cancelButtonBounds.y < 0.0f ? 0.0f:cancelButtonBounds.y;
 
        float remainingWidth = searchBarBounds.width - editBounds.width - horizontalMargin - buttonLeftMargin - buttonRightMargin;
 
index 1695ca4..15378bf 100755 (executable)
@@ -558,23 +558,31 @@ _SearchBarPresenter::InitializeViewModeLayout(void)
 {
        float horizontalMargin = 0.0f;
        float verticalMargin = 0.0f;
-       float searchFieldMinWidth = 0.0f;
+       float searchBarMinWidthModeNormal = 0.0f;
        float searchBarMinHeight = 0.0f;
        _ControlOrientation orientation = _ControlManager::GetInstance()->GetOrientation();
 
        GET_SHAPE_CONFIG(SEARCHBAR::HORIZONTAL_MARGIN, orientation, horizontalMargin);
        GET_SHAPE_CONFIG(SEARCHBAR::VERTICAL_MARGIN, orientation, verticalMargin);
-       GET_SHAPE_CONFIG(SEARCHBAR::SEARCH_FIELD_MIN_WIDTH, orientation, searchFieldMinWidth);
+       GET_SHAPE_CONFIG(SEARCHBAR::SEARCH_FIELD_MIN_WIDTH_NORMAL_MODE, orientation, searchBarMinWidthModeNormal);
        GET_SHAPE_CONFIG(SEARCHBAR::MIN_HEIGHT, orientation, searchBarMinHeight);
 
        float searchFieldMinHeight = searchBarMinHeight - (verticalMargin * 2.0f);
 
        __searchFieldBounds.x = horizontalMargin;
+       if (__pSearchBar->GetBoundsF().height < searchBarMinHeight)
+       {
+               verticalMargin = (__pSearchBar->GetBoundsF().height - searchFieldMinHeight)/2.0f;
+               if (verticalMargin < 0.0f)
+               {
+                       verticalMargin = 0.0f;
+               }
+       }
        __searchFieldBounds.y = verticalMargin;
        __searchFieldBounds.width = __pSearchBar->GetBoundsF().width - (horizontalMargin * 2.0f);
        __searchFieldBounds.height = __pSearchBar->GetBoundsF().height - (verticalMargin * 2.0f);
 
-       __searchFieldBounds.width = (__searchFieldBounds.width > searchFieldMinWidth) ? __searchFieldBounds.width : searchFieldMinWidth;
+       __searchFieldBounds.width = (__searchFieldBounds.width > searchBarMinWidthModeNormal) ? __searchFieldBounds.width : searchBarMinWidthModeNormal;
        __searchFieldBounds.height = (__searchFieldBounds.height > searchFieldMinHeight) ? __searchFieldBounds.height : searchFieldMinHeight;
 
        return;
index 1169e83..414d2aa 100755 (executable)
@@ -67,6 +67,7 @@ DECLARE_UI_CONFIG(SEARCHBAR);
        DECLARE_SHAPE_CONFIG(BUTTON_RIGHT_MARGIN, 13);
        DECLARE_SHAPE_CONFIG(EDIT_TEXT_SIZE, 14);
        DECLARE_SHAPE_CONFIG(BUTTON_TEXT_SIZE, 15);
+       DECLARE_SHAPE_CONFIG(SEARCH_FIELD_MIN_WIDTH_NORMAL_MODE, 16);
 DECLARE_END_UI_CONFIG(SEARCHBAR);
 
 #endif //_FUI_RESOURCE_SEARCH_BAR_CONFIG_H_
index a84ed03..276f246 100755 (executable)
@@ -66,6 +66,7 @@ START_UI_CONFIG(SEARCHBAR);
                ADD_SHAPE_CONFIG(ICON_HEIGHT, 45);
                ADD_SHAPE_CONFIG(MIN_HEIGHT, 86);
                ADD_SHAPE_CONFIG(SEARCH_FIELD_MIN_WIDTH, 218);
+               ADD_SHAPE_CONFIG(SEARCH_FIELD_MIN_WIDTH_NORMAL_MODE, 310);
                ADD_SHAPE_CONFIG(BUTTON_WIDTH, 136);
                ADD_SHAPE_CONFIG(BUTTON_MIN_WIDTH, 74);
                ADD_SHAPE_CONFIG(BUTTON_HEIGHT, 66);