Add clipboard & keypad simultaneously hiding logic
authorTaejun <tj.twt.park@samsung.com>
Thu, 11 Apr 2013 16:05:47 +0000 (01:05 +0900)
committerTaejun <tj.twt.park@samsung.com>
Thu, 11 Apr 2013 16:05:47 +0000 (01:05 +0900)
Change-Id: I813a86801735ce21bc46f9b6b83acfcd18285740

src/ui/controls/FUiCtrl_EditPresenter.cpp
src/ui/controls/FUiCtrl_Form.cpp
src/ui/controls/FUiCtrl_Keypad.cpp
src/ui/inc/FUiCtrl_Form.h

index bfcc9a5..82d96f5 100755 (executable)
@@ -238,10 +238,10 @@ _EditPresenter::OnInputConnectionPanelShowStateChanged(InputConnection& source,
                __isKeypadShowing = false;
                __isKeypadExist = true;
 
-               SysLog(NID_UI_CTRL, "[EDIT] INPUT_PANEL_SHOW_STATE_SHOW");
-
                CheckUSBKeyboardStatus();
 
+               SysLog(NID_UI_CTRL, "[EDIT] INPUT_PANEL_SHOW_STATE_SHOW[Target:%x][Bound:%d][Usb mode:%d]", this, __isInputConnectionBound, __isUSBKeyboardConnected);
+
                if (__isInputConnectionBound)
                {
                        if (__isKeypadCommandButtonVisible)
@@ -288,9 +288,9 @@ _EditPresenter::OnInputConnectionPanelShowStateChanged(InputConnection& source,
        else if (showState == INPUT_PANEL_SHOW_STATE_HIDE)// 1.unbound  2.bounded&usb off -> usb on 3.Flick keypad hide
        {
                __isKeypadHiding = false;
-               SysLog(NID_UI_CTRL, "[EDIT] INPUT_PANEL_SHOW_STATE_HIDE");
 
                CheckUSBKeyboardStatus();
+               SysLog(NID_UI_CTRL, "[EDIT] INPUT_PANEL_SHOW_STATE_HIDE[Target:%x][Bound:%d][Usb mode:%d]", this, __isInputConnectionBound, __isUSBKeyboardConnected);
 
                __isKeypadExist = false;
 
@@ -354,6 +354,7 @@ _EditPresenter::OnInputConnectionPanelShowStateChanged(InputConnection& source,
 
                                if (__pParentForm)
                                {
+                                       SysLog(NID_UI_CTRL, "[EDIT] Form deflate RESET!!!!!!!!!!");
                                        __pParentForm->DeflateClientRectHeight(0.0f);
                                }
                        }
@@ -372,10 +373,14 @@ _EditPresenter::OnInputConnectionPanelShowStateChanged(InputConnection& source,
                        }
                }
 
-               if (__isUSBKeyboardConnected && __isKeypadCommandButtonVisible)
+               if (__isKeypadCommandButtonVisible && __isInputConnectionBound)
                {
                        __pEdit->SendKeypadEvent(GetKeypadAction(), CORE_KEYPAD_EVENT_STATUS_BOUNDS_CHANGED);
                }
+               else if(__isUSBKeyboardConnected && __isKeypadCommandButtonVisible && !__isInputConnectionBound)
+               {
+                       //do nothing
+               }
                else
                {
                        __pEdit->SendScrollPanelEvent(CORE_OVERLAY_CONTROL_CLOSED);
@@ -810,11 +815,19 @@ _EditPresenter::OnClipboardPopupOpened(Tizen::Graphics::Dimension& clipboardPopu
                                {
                                        ScrollPanelToExposedRegion(true);
                                        ScrollPanelToCursorPosition();
+                                       __pParentForm->SetClipboardShowState(true);
                                        __pParentForm->Draw();
                                }
 
                                __pEdit->SendKeypadEvent(GetKeypadAction(), CORE_KEYPAD_EVENT_STATUS_BOUNDS_CHANGED);
                        }
+                       else
+                       {
+                               if (__pParentForm)
+                               {
+                                       __pParentForm->SetClipboardShowState(true);
+                               }
+                       }
                }
                else
                {
@@ -827,6 +840,7 @@ _EditPresenter::OnClipboardPopupOpened(Tizen::Graphics::Dimension& clipboardPopu
                        {
                                ScrollPanelToExposedRegion(true);
                                ScrollPanelToCursorPosition();
+                               __pParentForm->SetClipboardShowState(true);
                                __pParentForm->Draw();
                        }
 
@@ -913,6 +927,7 @@ _EditPresenter::OnClipboardPopupClosed(void)
 
                        if (__pParentForm)
                        {
+                               __pParentForm->SetClipboardShowState(false);
                                __pParentForm->Draw();
                        }
 
@@ -923,7 +938,9 @@ _EditPresenter::OnClipboardPopupClosed(void)
                        AdjustParentPanelHeight(true);
                        if (__pParentForm)
                        {
-                               __pParentForm->DeflateClientRectHeight(0);
+                               SysLog(NID_UI_CTRL, "[EDIT] Form deflate RESET!!!!!!!!!!");
+                               __pParentForm->DeflateClientRectHeight(0.0f);
+                               __pParentForm->SetClipboardShowState(false);
                                __pParentForm->Draw();
                        }
 
@@ -950,22 +967,23 @@ _EditPresenter::Dispose(void)
                __pCurrentFrame = null;
        }
 
-       if (__pCommandButton && __isKeypadCommandButtonVisible)
+       CheckUSBKeyboardStatus();
+
+       if (__isInputConnectionBound || __isKeypadHiding)
        {
-               __pCommandButton->SetVisibleState(false);
-               if (__isKeypadCommandButtonVisible  && !__isUSBKeyboardConnected)
+               if (__pCommandButton && __isKeypadCommandButtonVisible)
                {
+                       __pCommandButton->SetVisibleState(false);
+
                        SetFooterVisible(true);
-               }
 
-               delete __pCommandButton;
-               __pCommandButton = null;
-       }
+                       delete __pCommandButton;
+                       __pCommandButton = null;
+               }
 
-       if (__isInputConnectionBound || __isKeypadHiding)
-       {
                if (__pParentForm)
                {
+                       SysLog(NID_UI_CTRL, "[EDIT] Form deflate RESET!!!!!!!!!!");
                        __pParentForm->DeflateClientRectHeight(0.0f);
                        __pParentForm->SetKeypadShowState(false);
 
@@ -992,6 +1010,7 @@ _EditPresenter::Dispose(void)
                }
 
                __isKeypadExist = false;
+               __initialFooterVisibleStatus = EDIT_FOOTER_VISIBLE_STATUS_NONE;
        }
 
        if (__clipboardConnected)
@@ -5062,6 +5081,7 @@ _EditPresenter::SetKeypadEnabled(bool enable)
 {
        if (!enable && IsKeypadEnabled())
        {
+               CheckUSBKeyboardStatus();
                //hide keypad
                if (!__isUSBKeyboardConnected && __isInputConnectionBound)
                {
@@ -5554,7 +5574,6 @@ _EditPresenter::OnFocusLost(void)
                __isCursorOpaque = false;
                __isTouchMoving = false;
                __isTouchReleaseSkipped = false;
-               __isUSBKeyboardConnected = false;
 
                HideKeypad();
        }
@@ -5940,7 +5959,7 @@ _EditPresenter::SetKeypadCommandButton(const FloatRectangle& bounds)
        {
                __pCommandButton->SetResizable(true);
                __pCommandButton->SetMovable(true);
-
+               SysLog(NID_UI_CTRL, "[EDIT]Command position changed!!!! bounds(%f, %f, %f, %f)", bounds.x, bounds.y, bounds.width, bounds.height);
                r = __pCommandButton->SetBounds(bounds);
 
                __pCommandButton->SetResizable(false);
@@ -5983,7 +6002,7 @@ _EditPresenter::SetKeypadCommandButton(const FloatRectangle& bounds)
 
        __pCommandButton->SetResizable(true);
        __pCommandButton->SetMovable(true);
-
+       SysLog(NID_UI_CTRL, "[EDIT]Command created!!!! bounds(%f, %f, %f, %f)", bounds.x, bounds.y, bounds.width, bounds.height);
        r = __pCommandButton->SetBounds(bounds);
        SysTryCatch(NID_UI_CTRL, r == E_SUCCESS, , r, "[%s] Propagating.", GetErrorMessage(r));
 
@@ -6043,15 +6062,18 @@ _EditPresenter::CheckInitialFooterVisibleState(void)
                if (pFooter->GetVisibleState() == false)
                {
                        __initialFooterVisibleStatus = EDIT_FOOTER_VISIBLE_STATUS_HIDE;
+                       SysLog(NID_UI_CTRL, "[EDIT] CheckInitialFooterVisibleState - EDIT_FOOTER_VISIBLE_STATUS_HIDE");
                }
                else
                {
                        __initialFooterVisibleStatus = EDIT_FOOTER_VISIBLE_STATUS_SHOW;
+                       SysLog(NID_UI_CTRL, "[EDIT] CheckInitialFooterVisibleState - EDIT_FOOTER_VISIBLE_STATUS_SHOW");
                }
        }
        else
        {
                __initialFooterVisibleStatus = EDIT_FOOTER_VISIBLE_STATUS_NONE;
+               SysLog(NID_UI_CTRL, "[EDIT] CheckInitialFooterVisibleState - EDIT_FOOTER_VISIBLE_STATUS_NONE");
        }
 
        return;
@@ -6071,6 +6093,15 @@ _EditPresenter::SetFooterVisible(bool isVisible)
                if ((isVisible == true && pFooter->GetVisibleState() == false) ||
                        (isVisible == false && pFooter->GetVisibleState() == true))
                {
+                       if (isVisible)
+                       {
+                               SysLog(NID_UI_CTRL, "[EDIT] SetFooterVisible TRUE!!!!!");
+                       }
+                       else
+                       {
+                               SysLog(NID_UI_CTRL, "[EDIT] SetFooterVisible FALSE!!!!!");
+                       }
+
                        pFooter->SetVisibleState(isVisible);
                        pFooter->Invalidate();
 
@@ -6227,15 +6258,14 @@ _EditPresenter::CheckKeypadExist(_ControlOrientation orientation)
                screenSize.width = pControlManager->GetScreenSizeF().height;
        }
 
-       SysLog(NID_UI_CTRL, "[EDIT] CheckKeypadExist:ScreenSize(w: %f, h: %f)", screenSize.width, screenSize.height);
-       SysLog(NID_UI_CTRL, "[EDIT] CheckKeypadExist:absKeypadBounds(%f, %f, %f, %f)", absKeypadBounds.x, absKeypadBounds.y, absKeypadBounds.width, absKeypadBounds.height);
-
        if ((absKeypadBounds.y != screenSize.height) && (absKeypadBounds.width == screenSize.width))
        {
+               SysLog(NID_UI_CTRL, "[EDIT] CheckKeypadExist: KEYPAD EXIST!!!!Keypad(y: %f, h: %f)", absKeypadBounds.y, absKeypadBounds.height);
                return true;
        }
        else
        {
+               SysLog(NID_UI_CTRL, "[EDIT] CheckKeypadExist: NO KEYPAD!!!!Keypad(y: %f, h: %f)", absKeypadBounds.y, absKeypadBounds.height);
                return false;
        }
 }
@@ -6295,12 +6325,12 @@ _EditPresenter::ShowKeypad(bool focus)
        {
                SetCurrentLanguage(initialKeypadLanguage);
        }
-
        //layout rearrange
        if (IsKeypadEnabled())
        {
                if (__isUSBKeyboardConnected)
                {
+                       SysLog(NID_UI_CTRL, "[EDIT]ShowKeypad called in USB ON mode!!!!");
                        if (__initialFooterVisibleStatus == EDIT_FOOTER_VISIBLE_STATUS_NONE)
                        {
                                CheckInitialFooterVisibleState();
@@ -6325,9 +6355,9 @@ _EditPresenter::ShowKeypad(bool focus)
                }
                else
                {
-                       __isKeypadExist = CheckKeypadExist(__pEdit->GetOrientation()); //call once only from here.
+                       SysLog(NID_UI_CTRL, "[EDIT]ShowKeypad called in USB OFF mode!!!!");
 
-                       __pInputConnection->ShowInputPanel();
+                       __isKeypadExist = CheckKeypadExist(__pEdit->GetOrientation()); //call once only from here.
 
                        if (!__isKeypadExist)
                        {
@@ -6335,7 +6365,10 @@ _EditPresenter::ShowKeypad(bool focus)
                                __pEdit->AttachScrollPanelEvent();
                                __pEdit->SendScrollPanelEvent(CORE_OVERLAY_CONTROL_CREATED);
 
-                               CheckInitialFooterVisibleState();
+                               if (__initialFooterVisibleStatus == EDIT_FOOTER_VISIBLE_STATUS_NONE)
+                               {
+                                       CheckInitialFooterVisibleState();
+                               }
                        }
 
                        if (__isKeypadCommandButtonVisible)
@@ -6361,6 +6394,8 @@ _EditPresenter::ShowKeypad(bool focus)
                                ScrollPanelToExposedRegion(true);
                                ScrollPanelToCursorPosition();
                        }
+
+                       __pInputConnection->ShowInputPanel();
                }
        }
 
@@ -6387,6 +6422,7 @@ _EditPresenter::ChangeLayout(_ControlOrientation orientation)
 
                if (__pParentForm)
                {
+                       SysLog(NID_UI_CTRL, "[EDIT] Form deflate RESET!!!!!!!!!!");
                        __pParentForm->DeflateClientRectHeight(0.0f);
                }
 
@@ -6545,7 +6581,7 @@ _EditPresenter::ChangeLayoutInternal(_ControlOrientation orientation, bool defla
 
        if (__pParentForm && deflateForm)
        {
-               SysLog(NID_UI_CTRL, "ChangeLayoutInternal: formDeflateHeight:%f, KeypadExist(%d), ClipboardExist(%d), CommandButtonVisible(%d)",
+               SysLog(NID_UI_CTRL, "[EDIT]ChangeLayoutInternal: formDeflateHeight:%f, KeypadExist(%d), ClipboardExist(%d), CommandButtonVisible(%d)",
                        formDeflateHeight, __isKeypadExist, __isClipboardExist, __isKeypadCommandButtonVisible);
                __pParentForm->DeflateClientRectHeight(formDeflateHeight);
        }
@@ -6709,8 +6745,11 @@ _EditPresenter::HideKeypad(bool focus)
                return E_SUCCESS;
        }
 
+       CheckUSBKeyboardStatus();
+
        if (__isUSBKeyboardConnected)
        {
+               SysLog(NID_UI_CTRL, "[EDIT]HideKeypad called in USB ON mode!!!!");
                SetFooterVisible(true);
                if (__pCommandButton && __isKeypadCommandButtonVisible)
                {
@@ -6718,6 +6757,7 @@ _EditPresenter::HideKeypad(bool focus)
 
                        if (__pParentForm)
                        {
+                               SysLog(NID_UI_CTRL, "[EDIT] Form deflate RESET!!!!!!!!!!");
                                __pParentForm->DeflateClientRectHeight(0.0f);
                        }
 
@@ -6728,6 +6768,7 @@ _EditPresenter::HideKeypad(bool focus)
        }
        else
        {
+               SysLog(NID_UI_CTRL, "[EDIT]HideKeypad called in USB OFF mode!!!!");
                if (__pCommandButton && __isKeypadCommandButtonVisible)
                {
                        if (!__isKeypadExist)
@@ -6735,8 +6776,10 @@ _EditPresenter::HideKeypad(bool focus)
                                SetFooterVisible(true);//must be called ahead of DeflateClientRectHeights
                                if (__pParentForm)
                                {
+                                       SysLog(NID_UI_CTRL, "[EDIT] Form deflate RESET!!!!!!!!!!");
                                        __pParentForm->DeflateClientRectHeight(0.0f);
                                }
+                               __pEdit->SendKeypadEvent(GetKeypadAction(), CORE_KEYPAD_EVENT_STATUS_CLOSE);
                        }
                        __pCommandButton->SetVisibleState(false);
                }
@@ -6748,7 +6791,7 @@ _EditPresenter::HideKeypad(bool focus)
        __isTextComposing = false;
        __composingTextLength = 0;
 
-       if (__isKeypadExist)
+       if (__isKeypadExist && focus)
        {
                __isKeypadHiding = true;
        }
index a5a8799..cc9c67a 100644 (file)
@@ -81,6 +81,7 @@ _Form::_Form(void)
        , __softkeyCount(SOFTKEY_COUNT + 1)
        , __updatedSoftkeyCount(0)
        , __keypadShowstate(false)
+       , __clipboardShowstate(false)
 {
        Color color;
        result r = GET_COLOR_CONFIG(FORM::BG_NORMAL,color);
@@ -2332,16 +2333,24 @@ _Form::OnActionPerformed(const _Control& source, int actionId)
        switch (actionId)
        {
        case ID_BACK_BUTTON:
-               if (__keypadShowstate)
+               if (!__keypadShowstate && !__clipboardShowstate)
                {
-                       _SystemUtilImpl::GenerateKeyEvent(KEY_EVENT_TYPE_PRESSED, _KEY_STOP);
-                       _SystemUtilImpl::GenerateKeyEvent(KEY_EVENT_TYPE_RELEASED, _KEY_STOP);
+                       if (__pFormBackEventListener)
+                       {
+                               __pFormBackEventListener->OnFormBackRequested(*this);
+                       }
                }
                else
                {
-                       if (__pFormBackEventListener)
+                       if (__keypadShowstate)
                        {
-                               __pFormBackEventListener->OnFormBackRequested(*this);
+                               _SystemUtilImpl::GenerateKeyEvent(KEY_EVENT_TYPE_PRESSED, _KEY_STOP);
+                               _SystemUtilImpl::GenerateKeyEvent(KEY_EVENT_TYPE_RELEASED, _KEY_STOP);
+                       }
+
+                       if (__clipboardShowstate)
+                       {
+                               _SystemUtilImpl::SendKeyStopMessage();
                        }
                }
                break;
@@ -2575,6 +2584,12 @@ void
 _Form::SetKeypadShowState(bool state)
 {
        __keypadShowstate = state;
+
+       if (__clipboardShowstate)
+       {
+               return;
+       }
+
        if (state)
        {
                if (__pHeader)
@@ -2597,7 +2612,40 @@ _Form::SetKeypadShowState(bool state)
                        __pFooter->SetHideButton(false);
                }
        }
+}
+
+void
+_Form::SetClipboardShowState(bool state)
+{
+       __clipboardShowstate = state;
+
+       if (__keypadShowstate)
+       {
+               return;
+       }
 
+       if (state)
+       {
+               if (__pHeader)
+               {
+                       __pHeader->SetHideButton(true);
+               }
+               if (__pFooter)
+               {
+                       __pFooter->SetHideButton(true);
+               }
+       }
+       else
+       {
+               if (__pHeader)
+               {
+                       __pHeader->SetHideButton(false);
+               }
+               if (__pFooter)
+               {
+                       __pFooter->SetHideButton(false);
+               }
+       }
 }
 
 result
index f06b896..7ba5fdf 100644 (file)
@@ -551,7 +551,7 @@ _Keypad::ChangeLayoutInternal(LayoutChangeState layoutChangeState)
 
                if (!__isPredictionWindowOpendInUSBMode)
                {
-                       if (isKeypadExist)
+                       if (isKeypadExist || isClipboardExist)
                        {
                                __pFooter->SetHideButton(true);
                        }
@@ -773,11 +773,19 @@ _Keypad::OnActionPerformed(const _Control& source, int actionId)
 
        if (actionId == FOOTER_BACK_BUTTON_ID)
        {
-               if (__pChildEdit->IsKeypadExist() && __isPredictionWindowOpendInUSBMode == false)
+               if (__isPredictionWindowOpendInUSBMode == false)
                {
-                       _SystemUtilImpl::GenerateKeyEvent(KEY_EVENT_TYPE_PRESSED, _KEY_STOP);
-                       _SystemUtilImpl::GenerateKeyEvent(KEY_EVENT_TYPE_RELEASED, _KEY_STOP);
-                       return;
+                       if (__pChildEdit->IsKeypadExist())
+                       {
+                               _SystemUtilImpl::GenerateKeyEvent(KEY_EVENT_TYPE_PRESSED, _KEY_STOP);
+                               _SystemUtilImpl::GenerateKeyEvent(KEY_EVENT_TYPE_RELEASED, _KEY_STOP);
+                               return;
+                       }
+                       if (__pChildEdit->IsClipboardExist())
+                       {
+                               _SystemUtilImpl::SendKeyStopMessage();
+                               return;
+                       }
                }
        }
 
index e61761b..985b4e8 100644 (file)
@@ -187,6 +187,7 @@ public:
        result DeleteIndicatorObject(void);
 
        void SetKeypadShowState(bool state);
+       void SetClipboardShowState(bool state);
 
        Tizen::Graphics::FloatDimension TranslateSize(Tizen::Graphics::FloatDimension size) const;
 
@@ -249,6 +250,7 @@ private:
        bool __enableSoftkey[_SOFTKEY_COUNT + 1];
        bool __showSoftkey[_SOFTKEY_COUNT + 1];
        bool __keypadShowstate;
+       bool __clipboardShowstate;
 
        Tizen::Base::String __softkeyText[_SOFTKEY_COUNT + 1];