UX changes in Searchbar
authorAyush <ayush.sriv@samsung.com>
Thu, 20 Jun 2013 03:58:00 +0000 (09:28 +0530)
committerAyush <ayush.sriv@samsung.com>
Thu, 20 Jun 2013 10:53:05 +0000 (16:23 +0530)
Change-Id: I6864dbb8dd63c48e2018a0ca64b5743b66158596
Signed-off-by: Ayush <ayush.sriv@samsung.com>
13 files changed:
res/common/usr/share/osp/bitmaps/480x800/00_search_bg.#.png [new file with mode: 0644]
res/common/usr/share/osp/bitmaps/480x800/black/00_search_bg_ef.#.png [new file with mode: 0644]
res/common/usr/share/osp/bitmaps/480x800/default/00_search_bg_ef.#.png [new file with mode: 0644]
res/common/usr/share/osp/bitmaps/480x800/white/00_search_bg_ef.#.png [new file with mode: 0644]
res/common/usr/share/osp/bitmaps/720x1280/00_search_bg.#.png [new file with mode: 0644]
res/common/usr/share/osp/bitmaps/720x1280/black/00_search_bg_ef.#.png [new file with mode: 0644]
res/common/usr/share/osp/bitmaps/720x1280/default/00_search_bg_ef.#.png [new file with mode: 0644]
res/common/usr/share/osp/bitmaps/720x1280/white/00_search_bg_ef.#.png [new file with mode: 0644]
src/ui/controls/FUiCtrl_SearchBar.cpp
src/ui/controls/FUiCtrl_SearchBarPresenter.cpp
src/ui/inc/FUiCtrl_SearchBarPresenter.h
src/ui/inc/FUi_ResourceSearchBarConfig.h
src/ui/resource/FUi_ResourceSearchBarConfig.cpp

diff --git a/res/common/usr/share/osp/bitmaps/480x800/00_search_bg.#.png b/res/common/usr/share/osp/bitmaps/480x800/00_search_bg.#.png
new file mode 100644 (file)
index 0000000..7781aa0
Binary files /dev/null and b/res/common/usr/share/osp/bitmaps/480x800/00_search_bg.#.png differ
diff --git a/res/common/usr/share/osp/bitmaps/480x800/black/00_search_bg_ef.#.png b/res/common/usr/share/osp/bitmaps/480x800/black/00_search_bg_ef.#.png
new file mode 100644 (file)
index 0000000..aea105f
Binary files /dev/null and b/res/common/usr/share/osp/bitmaps/480x800/black/00_search_bg_ef.#.png differ
diff --git a/res/common/usr/share/osp/bitmaps/480x800/default/00_search_bg_ef.#.png b/res/common/usr/share/osp/bitmaps/480x800/default/00_search_bg_ef.#.png
new file mode 100644 (file)
index 0000000..aea105f
Binary files /dev/null and b/res/common/usr/share/osp/bitmaps/480x800/default/00_search_bg_ef.#.png differ
diff --git a/res/common/usr/share/osp/bitmaps/480x800/white/00_search_bg_ef.#.png b/res/common/usr/share/osp/bitmaps/480x800/white/00_search_bg_ef.#.png
new file mode 100644 (file)
index 0000000..aea105f
Binary files /dev/null and b/res/common/usr/share/osp/bitmaps/480x800/white/00_search_bg_ef.#.png differ
diff --git a/res/common/usr/share/osp/bitmaps/720x1280/00_search_bg.#.png b/res/common/usr/share/osp/bitmaps/720x1280/00_search_bg.#.png
new file mode 100644 (file)
index 0000000..7781aa0
Binary files /dev/null and b/res/common/usr/share/osp/bitmaps/720x1280/00_search_bg.#.png differ
diff --git a/res/common/usr/share/osp/bitmaps/720x1280/black/00_search_bg_ef.#.png b/res/common/usr/share/osp/bitmaps/720x1280/black/00_search_bg_ef.#.png
new file mode 100644 (file)
index 0000000..aea105f
Binary files /dev/null and b/res/common/usr/share/osp/bitmaps/720x1280/black/00_search_bg_ef.#.png differ
diff --git a/res/common/usr/share/osp/bitmaps/720x1280/default/00_search_bg_ef.#.png b/res/common/usr/share/osp/bitmaps/720x1280/default/00_search_bg_ef.#.png
new file mode 100644 (file)
index 0000000..aea105f
Binary files /dev/null and b/res/common/usr/share/osp/bitmaps/720x1280/default/00_search_bg_ef.#.png differ
diff --git a/res/common/usr/share/osp/bitmaps/720x1280/white/00_search_bg_ef.#.png b/res/common/usr/share/osp/bitmaps/720x1280/white/00_search_bg_ef.#.png
new file mode 100644 (file)
index 0000000..aea105f
Binary files /dev/null and b/res/common/usr/share/osp/bitmaps/720x1280/white/00_search_bg_ef.#.png differ
index 8e1af24..288af81 100644 (file)
@@ -231,6 +231,8 @@ _SearchBar::Initialize(bool enableSearchBarButton, CoreKeypadAction keypadAction
                }
        }
 
+       GET_COLOR_CONFIG(SEARCHBAR::SEARCHBAR_BG, __backgroundColor);
+
        __isUsableCancelButton = enableSearchBarButton;
        __keypadAction = keypadAction;
 
@@ -1867,6 +1869,7 @@ _SearchBar::OnKeyPressed(const _Control& source, const _KeyInfo& keyInfo)
                case _KEY_RIGHT:
                        if (&source == this)
                        {
+                               SetContentAreaVisible(__contentVisibilitySetByApp);
                                SetFocusCallbackParameter(true);
                                SetMode(SEARCH_BAR_MODE_INPUT);
                                __pEdit->SetFocused();
index 72d62ab..9302e88 100644 (file)
@@ -50,7 +50,11 @@ _SearchBarPresenter::_SearchBarPresenter(void)
        , __pIconElement(null)
        , __pReplacedSearchFieldNormalBitmap(null)
        , __pReplacedSearchFieldDisabledBitmap(null)
+       , __pReplacedSearchBarBitmap(null)
+       , __pSearchBarBitmap(null)
        , __pSearchFieldEffectBitmap(null)
+       , __pSearchBarEffectBitmap(null)
+       , __currentBgColor(Color())
        , __lazyDecode(false)
 {
 }
@@ -72,11 +76,29 @@ _SearchBarPresenter::~_SearchBarPresenter(void)
                __pReplacedSearchFieldDisabledBitmap = null;
        }
 
+       if (__pReplacedSearchBarBitmap)
+       {
+               delete __pReplacedSearchBarBitmap;
+               __pReplacedSearchBarBitmap = null;
+       }
+
+       if (__pSearchBarBitmap)
+       {
+               delete __pSearchBarBitmap;
+               __pSearchBarBitmap = null;
+       }
+
        if (__pSearchFieldEffectBitmap)
        {
                delete __pSearchFieldEffectBitmap;
                __pSearchFieldEffectBitmap = null;
        }
+
+       if (__pSearchBarEffectBitmap)
+       {
+               delete __pSearchBarEffectBitmap;
+               __pSearchBarEffectBitmap = null;
+       }
 }
 
 result
@@ -101,7 +123,7 @@ _SearchBarPresenter::Construct(const _SearchBar& searchBar)
        SysTryReturn(NID_UI_CTRL, __pContainer, E_SYSTEM, E_SYSTEM,
                     " [E_SYSTEM] A system error has occurred. Failed to get the content.");
 
-       r = LoadSearchFieldIcon();
+       r = LoadSearchBarBitmaps();
        SysTryReturn(NID_UI_CTRL, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r));
 
        _VisualElement* pEditElement = __pEdit->GetVisualElement();
@@ -142,15 +164,26 @@ CATCH:
 }
 
 result
-_SearchBarPresenter::LoadSearchFieldIcon()
+_SearchBarPresenter::LoadSearchBarBitmaps()
 {
        result r = E_SUCCESS;
        Color searchFieldIconColor;
        Bitmap* pSearchFieldBitmap;
 
+       r = GET_BITMAP_CONFIG_N(SEARCHBAR::SEARCHBAR_BG, BITMAP_PIXEL_FORMAT_ARGB8888, __pSearchBarBitmap);
+       SysTryReturnResult(NID_UI_CTRL, (r == E_SUCCESS), r, "[%s] Propagating.", GetErrorMessage(r));
+
+       r = GET_BITMAP_CONFIG_N(SEARCHBAR::SEARCHBAR_BG_EFFECT, BITMAP_PIXEL_FORMAT_ARGB8888, __pSearchBarEffectBitmap);
+       SysTryCatch(NID_UI_CTRL, (r == E_SUCCESS), , r,"[%s] Propagating.", GetErrorMessage(r));
+
+       __currentBgColor = __pSearchBar->GetColor();
+
+       __pReplacedSearchBarBitmap = _BitmapImpl::GetColorReplacedBitmapN(*__pSearchBarBitmap, Color::GetColor(COLOR_ID_MAGENTA), __currentBgColor);
+       SysTryCatch(NID_UI_CTRL, __pReplacedSearchBarBitmap != null, r = GetLastResult(), GetLastResult(),"[%s] Propagating.",
+               GetErrorMessage(GetLastResult()));
 
        r = GET_BITMAP_CONFIG_N(SEARCHBAR::ICON_NORMAL, BITMAP_PIXEL_FORMAT_ARGB8888, pSearchFieldBitmap);
-       SysTryReturnResult(NID_UI_CTRL, (r == E_SUCCESS), r, "Propagating.");
+       SysTryCatch(NID_UI_CTRL, (r == E_SUCCESS), , r, "[%s] Propagating.", GetErrorMessage(r));
 
        r = GET_BITMAP_CONFIG_N(SEARCHBAR::ICON_EFFECT_NORMAL, BITMAP_PIXEL_FORMAT_ARGB8888, __pSearchFieldEffectBitmap);
        SysTryCatch(NID_UI_CTRL, (r == E_SUCCESS), , r,"[%s] Propagating.", GetErrorMessage(r));
@@ -179,6 +212,15 @@ _SearchBarPresenter::LoadSearchFieldIcon()
        return r;
 
 CATCH:
+       delete __pSearchBarBitmap;
+       __pSearchBarBitmap = null;
+
+       delete __pSearchBarEffectBitmap;
+       __pSearchBarEffectBitmap = null;
+
+       delete __pReplacedSearchBarBitmap;
+       __pReplacedSearchBarBitmap = null;
+
        delete pSearchFieldBitmap;
        pSearchFieldBitmap = null;
 
@@ -285,7 +327,12 @@ _SearchBarPresenter::Draw(void)
 
        Bitmap* pBackgroundBitmap = __pSearchBar->GetBackgroundBitmap();
 
-       if (pBackgroundBitmap)
+       if (!pBackgroundBitmap)
+       {
+               r = DrawSearchBarDefaultBitmap();
+               SysTryReturn(NID_UI_CTRL, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r));
+       }
+       else
        {
                String imagePath = L"";
 
@@ -323,14 +370,65 @@ _SearchBarPresenter::Draw(void)
                        delete pCanvas;
                }
        }
+
+       r = DrawIcon();
+       SysTryReturn(NID_UI_CTRL, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r));
+
+       return r;
+}
+
+result
+_SearchBarPresenter::DrawSearchBarDefaultBitmap(void)
+{
+       result r = E_SUCCESS;
+       Canvas* pCanvas = null;
+       bool isCustomBitmap = false;
+       FloatRectangle bounds = __pSearchBar->GetBoundsF();
+
+       Color bgColor = __pSearchBar->GetColor();
+
+       if (bgColor != __currentBgColor)
+       {
+               delete __pReplacedSearchBarBitmap;
+               __pReplacedSearchBarBitmap = null;
+
+               __pReplacedSearchBarBitmap = _BitmapImpl::GetColorReplacedBitmapN(*__pSearchBarBitmap, Color::GetColor(COLOR_ID_MAGENTA), bgColor);
+               r = GetLastResult();
+               SysTryReturn(NID_UI_CTRL, (__pReplacedSearchBarBitmap != null), r, r, "[%s] Propagating.", GetErrorMessage(r));
+               __currentBgColor = bgColor;
+       }
+
+       isCustomBitmap = IS_CUSTOM_BITMAP(SEARCHBAR::SEARCHBAR_BG);
+
+       pCanvas = __pSearchBar->GetCanvasN();
+       r = GetLastResult();
+       SysTryReturn(NID_UI_CTRL, (pCanvas != null), r, r, "[%s] Propagating.", GetErrorMessage(r));
+
+       pCanvas->SetBackgroundColor(Color(0));
+       pCanvas->Clear();
+
+       if (_BitmapImpl::CheckNinePatchedBitmapStrictly(*__pReplacedSearchBarBitmap))
+       {
+               pCanvas->DrawNinePatchedBitmap(FloatRectangle(0.0f, 0.0f, bounds.width, bounds.height), *__pReplacedSearchBarBitmap);
+       }
        else
        {
-               __pSearchBar->SetBackgroundColor(bgColor);
+               pCanvas->DrawBitmap(FloatRectangle(0.0f, 0.0f, bounds.width, bounds.height), *__pReplacedSearchBarBitmap);
        }
 
-       r = DrawIcon();
-       SysTryReturn(NID_UI_CTRL, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r));
+       if (!isCustomBitmap && __pSearchBarEffectBitmap != null)
+       {
+               if (_BitmapImpl::CheckNinePatchedBitmapStrictly(*__pSearchBarEffectBitmap))
+               {
+                       pCanvas->DrawNinePatchedBitmap(FloatRectangle(0, 0, bounds.width, bounds.height), *__pSearchBarEffectBitmap);
+               }
+               else
+               {
+                       pCanvas->DrawBitmap(FloatRectangle(0, 0, bounds.width, bounds.height), *__pSearchBarEffectBitmap);
+               }
+       }
 
+       delete pCanvas;
        return r;
 }
 
index 5dfb565..3cca0c9 100644 (file)
@@ -174,11 +174,12 @@ private:
        void SetCancelButtonVisible(bool visible);
        void SetContainerVisible(bool visible);
        result DrawIcon(void);
+       result DrawSearchBarDefaultBitmap(void);
 
        result ChangeMode(SearchBarMode mode);
        void InitializeInputModeLayout(void);
        void InitializeViewModeLayout(void);
-       result LoadSearchFieldIcon(void);
+       result LoadSearchBarBitmaps(void);
 
        _SearchBar* __pSearchBar;
        _SearchBarModel* __pSearchBarModel;
@@ -193,9 +194,13 @@ private:
 
        Tizen::Graphics::Bitmap* __pReplacedSearchFieldNormalBitmap;
        Tizen::Graphics::Bitmap* __pReplacedSearchFieldDisabledBitmap;
+       Tizen::Graphics::Bitmap* __pReplacedSearchBarBitmap;
+       Tizen::Graphics::Bitmap* __pSearchBarBitmap;
        Tizen::Graphics::Bitmap* __pSearchFieldEffectBitmap;
-       bool __lazyDecode;
+       Tizen::Graphics::Bitmap* __pSearchBarEffectBitmap;
+       Tizen::Graphics::Color __currentBgColor;
 
+       bool __lazyDecode;
 
 }; // _SearchBarPresenter
 
index 0591c92..da6c20d 100644 (file)
@@ -47,6 +47,7 @@ DECLARE_UI_CONFIG(SEARCHBAR);
        DECLARE_COLOR_CONFIG(EDIT_BG_FOCUS, 20);
        DECLARE_COLOR_CONFIG(EDIT_BG_PRESSED, 21);
        DECLARE_COLOR_CONFIG(EDIT_BG_HIGHLIGHTED, 22);
+       DECLARE_COLOR_CONFIG(SEARCHBAR_BG, 23);
        DECLARE_IMAGE_CONFIG(EDIT_BG_NORMAL, 1);
        DECLARE_IMAGE_CONFIG(EDIT_BG_DISABLED, 2);
        DECLARE_IMAGE_CONFIG(EDIT_BG_HIGHLIGHTED, 3);
@@ -56,6 +57,8 @@ DECLARE_UI_CONFIG(SEARCHBAR);
        DECLARE_IMAGE_CONFIG(ICON_NORMAL, 7);
        DECLARE_IMAGE_CONFIG(ICON_EFFECT_NORMAL, 8);
        DECLARE_IMAGE_CONFIG(ICON_DISABLED, 9);
+       DECLARE_IMAGE_CONFIG(SEARCHBAR_BG, 10);
+       DECLARE_IMAGE_CONFIG(SEARCHBAR_BG_EFFECT, 11);
        DECLARE_SHAPE_CONFIG(HORIZONTAL_MARGIN, 1);
        DECLARE_SHAPE_CONFIG(VERTICAL_MARGIN, 2);
        DECLARE_SHAPE_CONFIG(TEXT_HORIZONTAL_MARGIN, 3);
index 1954166..f02f94a 100644 (file)
@@ -33,11 +33,11 @@ START_UI_CONFIG(SEARCHBAR);
        ADD_COLOR_CONFIG(BUTTON_TEXT_DISABLED, $B052L4D);
        ADD_COLOR_CONFIG(BUTTON_TEXT_HIGHLIGHTED, $B052L4);
 
-       ADD_COLOR_CONFIG(EDIT_BG_NORMAL, $W031);
+       ADD_COLOR_CONFIG(EDIT_BG_NORMAL, $W031L1);
        ADD_COLOR_CONFIG(EDIT_BG_PRESSED, $B0217);
-       ADD_COLOR_CONFIG(EDIT_BG_HIGHLIGHTED, $W031);
-       ADD_COLOR_CONFIG(EDIT_BG_DISABLED, $W031D);
-       ADD_COLOR_CONFIG(EDIT_BG_FOCUS, $W161);
+       ADD_COLOR_CONFIG(EDIT_BG_HIGHLIGHTED, $W031L1);
+       ADD_COLOR_CONFIG(EDIT_BG_DISABLED, $W031L1D);
+       ADD_COLOR_CONFIG(EDIT_BG_FOCUS, $F055);
        ADD_COLOR_CONFIG(GUIDE_TEXT_NORMAL, $W032);
        ADD_COLOR_CONFIG(GUIDE_TEXT_DISABLED, $W032D);
        ADD_COLOR_CONFIG(GUIDE_TEXT_HIGHLIGHTED, $W032);
@@ -47,6 +47,7 @@ START_UI_CONFIG(SEARCHBAR);
        ADD_COLOR_CONFIG(ICON_BG_NORMAL, $F041i);
        ADD_COLOR_CONFIG(ICON_BG_DISABLED, $F041iD);
        ADD_COLOR_CONFIG(CONTENT_AREA_BG_NORMAL, $B013);
+       ADD_COLOR_CONFIG(SEARCHBAR_BG, $B0215);
 
        ADD_IMAGE_CONFIG(EDIT_BG_NORMAL, #00_search_edit_field_bg.#.png);
        ADD_IMAGE_CONFIG(EDIT_BG_DISABLED, #00_search_edit_field_bg.#.png);
@@ -59,6 +60,8 @@ START_UI_CONFIG(SEARCHBAR);
        ADD_IMAGE_CONFIG(ICON_DISABLED, #00_search_icon.png);
        ADD_IMAGE_CONFIG(ICON_EFFECT_NORMAL, #00_search_icon_ef.png);
 
+       ADD_IMAGE_CONFIG(SEARCHBAR_BG, #00_search_bg.#.png);
+       ADD_IMAGE_CONFIG(SEARCHBAR_BG_EFFECT, #00_search_bg_ef.#.png);
 
        START_UI_CONFIG_MODE(720x1280);
        {