apply title slide effect
authorMyung Jin Kim <critical.kim@samsung.com>
Thu, 4 Jul 2013 07:58:22 +0000 (16:58 +0900)
committerMyung Jin Kim <critical.kim@samsung.com>
Thu, 4 Jul 2013 07:58:22 +0000 (16:58 +0900)
Change-Id: I53c63a3c571abb0634cc22db1471045cbafb2187

src/ui/controls/FUiCtrl_ToolbarPresenter.cpp
src/ui/inc/FUiCtrl_ToolbarPresenter.h
src/ui/inc/FUi_ResourceHeaderConfig.h
src/ui/resource/FUi_ResourceHeaderConfig.cpp

index 920d7a9..26559e9 100644 (file)
@@ -971,6 +971,8 @@ _ToolbarPresenter::DrawTitleText(Canvas* pCanvas)
        {
                __pTitleTextObject->DrawWithOffset(*_CanvasImpl::GetInstance(*pCanvas));
 
+               DrawTitleTextDimBitmap();
+
                TimerForTitleSlideStart();
        }
        else
@@ -1983,7 +1985,12 @@ _ToolbarPresenter::TimerForTitleSlideTimeout(void)
        {
                __pTitleTextObject->DrawWithOffset(*_CanvasImpl::GetInstance(*pCanvas));
 
-               TimerForTitleSlideStart();
+               DrawTitleTextDimBitmap();
+
+               if (__pTitleTextObject->GetRepeatCount() < 3)
+               {
+                       TimerForTitleSlideStart();
+               }
        }
        else
        {
@@ -1995,6 +2002,107 @@ _ToolbarPresenter::TimerForTitleSlideTimeout(void)
        return E_SUCCESS;
 }
 
+void
+_ToolbarPresenter::DrawTitleTextDimBitmap(void)
+{
+       if (__pToolbar->IsUserBackgroundBitmap())
+       {
+               return;
+       }
+
+       float textDimWidth = 0.0f;
+       float textDimHeight = 0.0f;
+
+       GET_SHAPE_CONFIG(HEADER::TAB_TEXT_DIM_WIDTH, __pToolbar->GetOrientation(), textDimWidth);
+
+       ToolbarStyle style = __pToolbar->GetStyle();
+
+       if (style == TOOLBAR_HEADER_SEGMENTED_WITH_TITLE || style == TOOLBAR_TAB_WITH_TITLE)
+       {
+               GET_SHAPE_CONFIG(HEADER::TITLE_HEIGHT_WITH_SEGMENTED_ITEM, __pToolbar->GetOrientation(), textDimHeight);
+       }
+       else
+       {
+               if (__pToolbar->GetDescriptionText() != L"")
+               {
+                       textDimHeight = __titleRect.height;
+               }
+               else
+               {
+                       textDimHeight = __pToolbar->GetBoundsF().height;
+               }
+       }
+
+       Color titleTextDimColor;
+       GET_COLOR_CONFIG(HEADER::TITLE_TEXT_DIM_NORMAL, titleTextDimColor);
+
+       Bitmap* pTitleTextDimLeftBitmap = null;
+       GET_BITMAP_CONFIG_N(HEADER::TITLE_TEXT_DIM_EFFECT_LEFT, BITMAP_PIXEL_FORMAT_ARGB8888, pTitleTextDimLeftBitmap);
+
+       Bitmap* pReColorTitleTextDimLeftBitmap = _BitmapImpl::GetColorReplacedBitmapN(*pTitleTextDimLeftBitmap,
+                       Color::GetColor(COLOR_ID_MAGENTA), titleTextDimColor);
+
+       if (pReColorTitleTextDimLeftBitmap)
+       {
+               Canvas* pCanvas = __pToolbar->GetCanvasN();
+               FloatRectangle bounds = FloatRectangle(0.0f, 0.0f, textDimWidth, textDimHeight);
+
+               if (pCanvas == null)
+               {
+                       SysLog(NID_UI_CTRL, "Cannot get a canvas.");
+                       return;
+               }
+
+               if (_BitmapImpl::CheckNinePatchedBitmapStrictly(*pReColorTitleTextDimLeftBitmap))
+               {
+                       pCanvas->DrawNinePatchedBitmap(bounds, *pReColorTitleTextDimLeftBitmap);
+               }
+               else
+               {
+                       pCanvas->DrawBitmap(bounds, *pReColorTitleTextDimLeftBitmap,
+                                       FloatRectangle(0.0f, 0.0f, pReColorTitleTextDimLeftBitmap->GetWidthF(), pReColorTitleTextDimLeftBitmap->GetHeightF()));
+               }
+
+               delete pTitleTextDimLeftBitmap;
+               delete pReColorTitleTextDimLeftBitmap;
+               delete pCanvas;
+       }
+
+       Bitmap* pTitleTextDimRightBitmap = null;
+       GET_BITMAP_CONFIG_N(HEADER::TITLE_TEXT_DIM_EFFECT_RIGHT, BITMAP_PIXEL_FORMAT_ARGB8888, pTitleTextDimRightBitmap);
+
+       Bitmap* pReColorTitleTextDimRightBitmap = _BitmapImpl::GetColorReplacedBitmapN(*pTitleTextDimRightBitmap,
+                       Color::GetColor(COLOR_ID_MAGENTA), titleTextDimColor);
+
+       if (pReColorTitleTextDimRightBitmap)
+       {
+               Canvas* pCanvas = __pToolbar->GetCanvasN();
+               FloatRectangle bounds = FloatRectangle(__titleRect.width, 0.0f, textDimWidth, textDimHeight);
+
+               if (pCanvas == null)
+               {
+                       SysLog(NID_UI_CTRL, "Cannot get a canvas.");
+                       return;
+               }
+
+               if (_BitmapImpl::CheckNinePatchedBitmapStrictly(*pReColorTitleTextDimRightBitmap))
+               {
+                       pCanvas->DrawNinePatchedBitmap(bounds, *pReColorTitleTextDimRightBitmap);
+               }
+               else
+               {
+                       pCanvas->DrawBitmap(bounds, *pReColorTitleTextDimRightBitmap,
+                                       FloatRectangle(0.0f, 0.0f, pReColorTitleTextDimRightBitmap->GetWidthF(), pReColorTitleTextDimRightBitmap->GetHeightF()));
+               }
+
+               delete pTitleTextDimRightBitmap;
+               delete pReColorTitleTextDimRightBitmap;
+               delete pCanvas;
+       }
+
+       return;
+}
+
 result
 _ToolbarPresenter::AdjustItemPositionX(float distance)
 {
index 28e4392..fc381cb 100644 (file)
@@ -16,7 +16,7 @@
 //
 /**
  * @file               FUiCtrl_ToolbarPresenter.h
- * @brief              This is the header file for the _ToolbarPresenter class.
+ * @brief              This is the header file fo  r the _ToolbarPresenter class.
  *
  * This header file contains the declarations of the %_ToolbarPresenter class.
  */
@@ -157,6 +157,8 @@ private:
 
        float CalculateProgress(float timeProgress) const;
 
+       void DrawTitleTextDimBitmap(void);
+
        virtual void OnVisualElementAnimationStarted(const Tizen::Ui::Animations::VisualElementAnimation& animation, const Tizen::Base::String& keyName, Tizen::Ui::Animations::VisualElement& target);
        virtual void OnVisualElementAnimationRepeated(const Tizen::Ui::Animations::VisualElementAnimation& animation, const Tizen::Base::String& keyName, Tizen::Ui::Animations::VisualElement& target, long currentRepeatCount);
        virtual void OnVisualElementAnimationFinished(const Tizen::Ui::Animations::VisualElementAnimation& animation, const Tizen::Base::String& keyName, Tizen::Ui::Animations::VisualElement& target, bool completedNormally);
index 2115906..14d019e 100644 (file)
@@ -121,6 +121,8 @@ DECLARE_UI_CONFIG(HEADER);
        DECLARE_COLOR_CONFIG(TAB_TEXT_DIM_NORMAL, 94);
        DECLARE_COLOR_CONFIG(TAB_TEXT_DIM_TRANSLUCENT_NORMAL, 95);
        DECLARE_COLOR_CONFIG(SUB_TITLE_EFFECT_NORMAL, 96);
+       DECLARE_COLOR_CONFIG(TITLE_TEXT_DIM_NORMAL, 97);
+       DECLARE_COLOR_CONFIG(TITLE_TEXT_DIM_TRANSLUCENT_NORMAL, 98);
 
        // BITMAP
        DECLARE_IMAGE_CONFIG(BG_NORMAL, 1);
@@ -291,6 +293,7 @@ DECLARE_UI_CONFIG(HEADER);
        DECLARE_SHAPE_CONFIG(TAB_LARGE_DIVIDER_HEIGHT, 75);
        DECLARE_SHAPE_CONFIG(BUTTON_ITEM_MARGIN_WITH_TEXT, 76);
        DECLARE_SHAPE_CONFIG(TAB_TEXT_DIM_WIDTH, 77);
+       DECLARE_SHAPE_CONFIG(TITLE_TEXT_DIM_WIDTH, 78);
 
 
 DECLARE_END_UI_CONFIG(HEADER);
index 60c9509..b7cd2c3 100644 (file)
@@ -139,6 +139,9 @@ START_UI_CONFIG(HEADER);
        ADD_COLOR_CONFIG(TAB_TEXT_DIM_NORMAL, $B0514);
        ADD_COLOR_CONFIG(TAB_TEXT_DIM_TRANSLUCENT_NORMAL, $B013);
 
+       ADD_COLOR_CONFIG(TITLE_TEXT_DIM_NORMAL, $B0511);
+       ADD_COLOR_CONFIG(TITLE_TEXT_DIM_TRANSLUCENT_NORMAL, $B013);
+
        ADD_COLOR_CONFIG(SUB_TITLE_EFFECT_NORMAL, $B0511);
 
        // BITMAP
@@ -366,6 +369,7 @@ START_UI_CONFIG(HEADER);
                ADD_SHAPE_CONFIG(TAB_LARGE_DIVIDER_HEIGHT, 88);
 
                ADD_SHAPE_CONFIG(TAB_TEXT_DIM_WIDTH, 45);
+               ADD_SHAPE_CONFIG(TITLE_TEXT_DIM_WIDTH, 63);
 
        END_UI_CONFIG_MODE(720x1280);
 
@@ -463,6 +467,7 @@ START_UI_CONFIG(HEADER);
                ADD_SHAPE_CONFIG(TAB_LARGE_DIVIDER_HEIGHT, 88);
 
                ADD_SHAPE_CONFIG(TAB_TEXT_DIM_WIDTH, 45);
+               ADD_SHAPE_CONFIG(TITLE_TEXT_DIM_WIDTH, 63);
 
        END_UI_CONFIG_MODE(1280x720);
 }