Fix for issue Force close occurs if image is added in Button of InputPad from UICusto...
authorShiv Pratap Singh <shivp.singh@samsung.com>
Wed, 30 Oct 2013 08:50:26 +0000 (14:20 +0530)
committerShiv Pratap Singh <shivp.singh@samsung.com>
Wed, 30 Oct 2013 08:50:26 +0000 (14:20 +0530)
Change-Id: I04243dd41dc3984d59d668f6b356681b58313092
Signed-off-by: Shiv Pratap Singh <shivp.singh@samsung.com>
src/ui/controls/FUiCtrl_InputPadPresenter.cpp

index afd7460..7cb809b 100644 (file)
@@ -124,13 +124,11 @@ _InputPadPresenter::LoadResource(void)
        Color buttonColor[DATETIME_STATUS_MAX];
        Color replacementColor = Color::GetColor(COLOR_ID_MAGENTA);
 
-       Bitmap* pButtonBgNormalBitmap[DATETIME_STATUS_MAX];
        bool isCustomBitmap[DATETIME_STATUS_MAX];
 
        for (int i = 0; i < DATETIME_STATUS_MAX; i++)
        {
                buttonColor[i] = Color();
-               pButtonBgNormalBitmap[i] = null;
                isCustomBitmap[i] = false;
        }
 
@@ -142,63 +140,58 @@ _InputPadPresenter::LoadResource(void)
        r = GET_BITMAP_CONFIG_N(INPUTPAD::BG_NORMAL, BITMAP_PIXEL_FORMAT_ARGB8888, __pKeypadBackgroundBitmap);
        SysTryReturnResult(NID_UI_CTRL, (r == E_SUCCESS), r, "Propagating.");
 
-       r = GET_BITMAP_CONFIG_N(INPUTPAD::BUTTON_BG_NORMAL, BITMAP_PIXEL_FORMAT_ARGB8888, pButtonBgNormalBitmap[DATETIME_STATUS_NORMAL]);
-       SysTryCatch(NID_UI_CTRL, (r == E_SUCCESS), , r, "[%s] Propagating.", GetErrorMessage(r));
-
-       r = GET_BITMAP_CONFIG_N(INPUTPAD::BUTTON_BG_PRESSED, BITMAP_PIXEL_FORMAT_ARGB8888, pButtonBgNormalBitmap[DATETIME_STATUS_SELECTED]);
-       SysTryCatch(NID_UI_CTRL, (r == E_SUCCESS), , r, "[%s] Propagating.", GetErrorMessage(r));
-
-       r = GET_BITMAP_CONFIG_N(INPUTPAD::BUTTON_BG_HIGHLIGHTED, BITMAP_PIXEL_FORMAT_ARGB8888, pButtonBgNormalBitmap[DATETIME_STATUS_HIGHLIGHTED]);
-       SysTryCatch(NID_UI_CTRL, (r == E_SUCCESS), , r, "[%s] Propagating.", GetErrorMessage(r));
-
-       r = GET_BITMAP_CONFIG_N(INPUTPAD::BUTTON_BG_DISABLED, BITMAP_PIXEL_FORMAT_ARGB8888, pButtonBgNormalBitmap[DATETIME_STATUS_DISABLED]);
-       SysTryCatch(NID_UI_CTRL, (r == E_SUCCESS), , r, "[%s] Propagating.", GetErrorMessage(r));
-
        isCustomBitmap[DATETIME_STATUS_NORMAL] = IS_CUSTOM_BITMAP(INPUTPAD::BUTTON_BG_NORMAL);
        isCustomBitmap[DATETIME_STATUS_SELECTED] = IS_CUSTOM_BITMAP(INPUTPAD::BUTTON_BG_PRESSED);
        isCustomBitmap[DATETIME_STATUS_HIGHLIGHTED] = IS_CUSTOM_BITMAP(INPUTPAD::BUTTON_BG_HIGHLIGHTED);
        isCustomBitmap[DATETIME_STATUS_DISABLED] = IS_CUSTOM_BITMAP(INPUTPAD::BUTTON_BG_DISABLED);
 
-       for (int i = 0; i < DATETIME_STATUS_MAX; i++)
+       if (isCustomBitmap[DATETIME_STATUS_NORMAL])
        {
-               if (isCustomBitmap[i])
-               {
-                       __pKeypadButtonNormalBitmap[i] = pButtonBgNormalBitmap[i];
-               }
-               else
-               {
-                       __pKeypadButtonNormalBitmap[i] = _BitmapImpl::GetColorReplacedBitmapN(*pButtonBgNormalBitmap[i], replacementColor, buttonColor[i]);
-                       SysTryCatch(NID_UI_CTRL, (__pKeypadButtonNormalBitmap[i] != null), , r, "[%s] Propagating.", GetErrorMessage(r));
-               }
+               r = GET_BITMAP_CONFIG_N(INPUTPAD::BUTTON_BG_NORMAL, BITMAP_PIXEL_FORMAT_ARGB8888, __pKeypadButtonNormalBitmap[DATETIME_STATUS_NORMAL]);
+               SysTryCatch(NID_UI_CTRL, (r == E_SUCCESS), , r, "[%s] Propagating.", GetErrorMessage(r));
        }
-
-       if (!isCustomBitmap[DATETIME_STATUS_NORMAL])
+       else
        {
+               r = GET_REPLACED_BITMAP_CONFIG_N(INPUTPAD::BUTTON_BG_NORMAL, BITMAP_PIXEL_FORMAT_ARGB8888, buttonColor[DATETIME_STATUS_NORMAL], __pKeypadButtonNormalBitmap[DATETIME_STATUS_NORMAL]);
+               SysTryCatch(NID_UI_CTRL, (r == E_SUCCESS), , r, "[%s] Propagating.", GetErrorMessage(r));
                r = GET_BITMAP_CONFIG_N(INPUTPAD::BUTTON_BG_EFFECT_NORMAL, BITMAP_PIXEL_FORMAT_ARGB8888, __pKeypadButtonEffectBitmap[DATETIME_STATUS_NORMAL]);
                SysTryCatch(NID_UI_CTRL, (r == E_SUCCESS), , r, "[%s] Propagating.", GetErrorMessage(r));
        }
-
-       if (!isCustomBitmap[DATETIME_STATUS_SELECTED])
+       if (isCustomBitmap[DATETIME_STATUS_SELECTED])
+       {
+               r = GET_BITMAP_CONFIG_N(INPUTPAD::BUTTON_BG_PRESSED, BITMAP_PIXEL_FORMAT_ARGB8888, __pKeypadButtonNormalBitmap[DATETIME_STATUS_SELECTED]);
+               SysTryCatch(NID_UI_CTRL, (r == E_SUCCESS), , r, "[%s] Propagating.", GetErrorMessage(r));
+       }
+       else
        {
+               r = GET_REPLACED_BITMAP_CONFIG_N(INPUTPAD::BUTTON_BG_PRESSED, BITMAP_PIXEL_FORMAT_ARGB8888, buttonColor[DATETIME_STATUS_SELECTED], __pKeypadButtonNormalBitmap[DATETIME_STATUS_SELECTED]);
+               SysTryCatch(NID_UI_CTRL, (r == E_SUCCESS), , r, "[%s] Propagating.", GetErrorMessage(r));
                r = GET_BITMAP_CONFIG_N(INPUTPAD::BUTTON_BG_EFFECT_PRESSED, BITMAP_PIXEL_FORMAT_ARGB8888, __pKeypadButtonEffectBitmap[DATETIME_STATUS_SELECTED]);
                SysTryCatch(NID_UI_CTRL, (r == E_SUCCESS), , r, "[%s] Propagating.", GetErrorMessage(r));
        }
-
-       if (!isCustomBitmap[DATETIME_STATUS_HIGHLIGHTED])
+       if (isCustomBitmap[DATETIME_STATUS_HIGHLIGHTED])
        {
+               r = GET_BITMAP_CONFIG_N(INPUTPAD::BUTTON_BG_HIGHLIGHTED, BITMAP_PIXEL_FORMAT_ARGB8888, __pKeypadButtonNormalBitmap[DATETIME_STATUS_HIGHLIGHTED]);
+               SysTryCatch(NID_UI_CTRL, (r == E_SUCCESS), , r, "[%s] Propagating.", GetErrorMessage(r));
+       }
+       else
+       {
+               r = GET_REPLACED_BITMAP_CONFIG_N(INPUTPAD::BUTTON_BG_HIGHLIGHTED, BITMAP_PIXEL_FORMAT_ARGB8888, buttonColor[DATETIME_STATUS_HIGHLIGHTED], __pKeypadButtonNormalBitmap[DATETIME_STATUS_HIGHLIGHTED]);
+               SysTryCatch(NID_UI_CTRL, (r == E_SUCCESS), , r, "[%s] Propagating.", GetErrorMessage(r));
                r = GET_BITMAP_CONFIG_N(INPUTPAD::BUTTON_BG_EFFECT_HIGHLIGHTED, BITMAP_PIXEL_FORMAT_ARGB8888, __pKeypadButtonEffectBitmap[DATETIME_STATUS_HIGHLIGHTED]);
                SysTryCatch(NID_UI_CTRL, (r == E_SUCCESS), , r, "[%s] Propagating.", GetErrorMessage(r));
        }
-
-       if (!isCustomBitmap[DATETIME_STATUS_DISABLED])
+       if (isCustomBitmap[DATETIME_STATUS_DISABLED])
        {
-               r = GET_BITMAP_CONFIG_N(INPUTPAD::BUTTON_BG_EFFECT_DISABLED, BITMAP_PIXEL_FORMAT_ARGB8888, __pKeypadButtonEffectBitmap[DATETIME_STATUS_DISABLED]);
+               r = GET_BITMAP_CONFIG_N(INPUTPAD::BUTTON_BG_DISABLED, BITMAP_PIXEL_FORMAT_ARGB8888, __pKeypadButtonNormalBitmap[DATETIME_STATUS_DISABLED]);
                SysTryCatch(NID_UI_CTRL, (r == E_SUCCESS), , r, "[%s] Propagating.", GetErrorMessage(r));
        }
-
-       for (int i = 0; i < DATETIME_STATUS_MAX; i++)
+       else
        {
-               delete pButtonBgNormalBitmap[i];
+               r = GET_REPLACED_BITMAP_CONFIG_N(INPUTPAD::BUTTON_BG_DISABLED, BITMAP_PIXEL_FORMAT_ARGB8888, buttonColor[DATETIME_STATUS_DISABLED], __pKeypadButtonNormalBitmap[DATETIME_STATUS_DISABLED]);
+               SysTryCatch(NID_UI_CTRL, (r == E_SUCCESS), , r, "[%s] Propagating.", GetErrorMessage(r));
+               r = GET_BITMAP_CONFIG_N(INPUTPAD::BUTTON_BG_EFFECT_DISABLED, BITMAP_PIXEL_FORMAT_ARGB8888, __pKeypadButtonEffectBitmap[DATETIME_STATUS_DISABLED]);
+               SysTryCatch(NID_UI_CTRL, (r == E_SUCCESS), , r, "[%s] Propagating.", GetErrorMessage(r));
        }
 
        return r;
@@ -209,7 +202,6 @@ CATCH:
 
        for (int i = 0; i < DATETIME_STATUS_MAX; i++)
        {
-               delete pButtonBgNormalBitmap[i];
 
                delete __pKeypadButtonNormalBitmap[i];
                __pKeypadButtonNormalBitmap[i] = null;