#include "FUi_CoordinateSystemUtils.h"
#include "FUi_AccessibilityContainer.h"
#include "FUi_AccessibilityElement.h"
+#include "FUiAnim_VisualElementImpl.h"
using namespace Tizen::Base;
using namespace Tizen::Base::Runtime;
pTokenElement->SetAnimationProvider(null);
if (pToken->isImplicitAnimation)
{
- VisualElementAnimation* pAnimation = CreateAnimationN(*pTokenElement, true);
+ VisualElementAnimation* pAnimation = CreateAnimationN(*pTokenElement);
pTokenElement->AddAnimation(*pAnimation);
delete pAnimation;
pToken->isImplicitAnimation = false;
}
VisualElementAnimation*
-_TokenEditPresenter::CreateAnimationN(VisualElement& source, bool create)
+_TokenEditPresenter::CreateAnimationN(VisualElement& source)
{
VisualElementAnimation* pAnimation = null;
VisualElementAnimationGroup* pAnimationGroup = new (std::nothrow) VisualElementAnimationGroup();
SysTryReturn(NID_UI_CTRL, pOpacityAnimation, null, E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] Memory allocation failed.");
pOpacityAnimation->SetPropertyName("opacity");
- if (!create)
- {
- pOpacityAnimation->SetStartValue(Variant(1.0f));
- pOpacityAnimation->SetEndValue(Variant(0.0f));
- }
- else
- {
- pOpacityAnimation->SetStartValue(Variant(0.0f));
- pOpacityAnimation->SetEndValue(Variant(1.0f));
- }
+
+ pOpacityAnimation->SetStartValue(Variant(0.0f));
+ pOpacityAnimation->SetEndValue(Variant(1.0f));
pOpacityAnimation->SetDuration(ANIMATION_DURATION_OPACITY);
pOpacityAnimation->SetTimingFunction(__pTimingFunction);
startValue.width = startValue.width * 0.9;
startValue.height = startValue.height * 0.9;
- if (!create)
- {
- pBoundsAnimation->SetStartValue(Variant(source.GetBounds()));
- pBoundsAnimation->SetEndValue(Variant(startValue));
- pBoundsAnimation->SetVisualElementAnimationStatusEventListener(this);
- }
- else
- {
- pBoundsAnimation->SetStartValue(Variant(startValue));
- pBoundsAnimation->SetEndValue(Variant(source.GetBounds()));
- }
+ pBoundsAnimation->SetStartValue(Variant(startValue));
+ pBoundsAnimation->SetEndValue(Variant(source.GetBounds()));
pBoundsAnimation->SetDuration(ANIMATION_DURATION_BOUNDS);
pBoundsAnimation->SetTimingFunction(__pTimingFunction);
_Token* pToken = null;
_VisualElement* pTokenVisualElement = null;
+
if (__animatingIndex == (GetTokenCount() - 1))
{
pToken = static_cast< _Token* >(__pTokenList->GetAt(GetTokenCount() - 1));
{
pTokenVisualElement = pToken->GetVisualElement();
SysTryReturnVoidResult(NID_UI_CTRL, pTokenVisualElement != null, E_SYSTEM, "[E_SYSTEM] A system error has occurred. Failed to get token visual element.");
- pTokenVisualElement->RemoveAnimation(L"TokenAnimation");
+ pTokenVisualElement->RemoveAllAnimations();
}
}
+
pToken = static_cast< _Token* >(__pTokenList->GetAt(GetTokenCount() - 1));
if (pToken)
{
if (pTokenVisualElement && __animatingIndex >= 0)
{
__isAnimationInProgress = true;
- VisualElementAnimation* pAnimation = CreateAnimationN(*pTokenVisualElement, false);
- pTokenVisualElement->AddAnimation(L"TokenAnimation", *pAnimation);
- delete pAnimation;
+ PerformRemoveTokenAnimation(*pTokenVisualElement);
}
}
}
void
+_TokenEditPresenter::OnTickOccurred(const Tizen::Ui::Animations::VisualElementAnimation& animation, const Tizen::Base::String& keyName, Tizen::Ui::Animations::VisualElement& target, const Tizen::Ui::Variant& currentValue)
+{
+ VisualElementValueAnimation* pAnimation = dynamic_cast< VisualElementValueAnimation* >(const_cast< VisualElementAnimation* >(&animation));
+ VisualElement* pPresentation = const_cast< VisualElement* >(target.AcquirePresentationInstance());
+
+ if (pPresentation && pAnimation)
+ {
+ float diffX = 0.0f;
+ float diffY = 0.0f;
+
+ diffX = pPresentation->GetBounds().x;
+ diffY = pPresentation->GetBounds().y;
+
+ Variant newBounds(FloatRectangle(diffX, diffY, currentValue.ToFloatRectangle().width, currentValue.ToFloatRectangle().height));
+ _VisualElementImpl::GetInstance(*pPresentation)->SetProperty(VePropBounds, newBounds);
+ }
+ else
+ {
+ SysLogException(NID_UI_CTRL, E_SYSTEM, "[E_SYSTEM] A system error has been occurred. Failed to get presentation instance of visual element.");
+ }
+
+ target.ReleasePresentationInstance();
+}
+
+void
_TokenEditPresenter::OnTimerExpired(Timer& timer)
{
Timer* onTimer = &timer;
return;
}
+void
+_TokenEditPresenter::PerformRemoveTokenAnimation(VisualElement& source)
+{
+ if (__pTimingFunction == null)
+ {
+ __pTimingFunction = new (std::nothrow) SineTimingFunction();
+ SysTryReturnVoidResult(NID_UI_CTRL, __pTimingFunction, E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] Memory allocation failed.");
+ }
+
+ AnimationTransaction::Begin();
+
+ VisualElementPropertyAnimation* pOpacityAnimation = new (std::nothrow) VisualElementPropertyAnimation();
+ SysTryReturnVoidResult(NID_UI_CTRL, pOpacityAnimation, E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] Memory allocation failed.");
+
+ pOpacityAnimation->SetPropertyName("opacity");
+ pOpacityAnimation->SetStartValue(Variant(1.0f));
+ pOpacityAnimation->SetEndValue(Variant(0.0f));
+
+ pOpacityAnimation->SetDuration(ANIMATION_DURATION_OPACITY);
+ pOpacityAnimation->SetTimingFunction(__pTimingFunction);
+
+ source.AddAnimation("OpacityAnimation", *pOpacityAnimation);
+ delete pOpacityAnimation;
+
+ VisualElementValueAnimation* pBoundsAnimation = new (std::nothrow) VisualElementValueAnimation(); //deletion will happen in catch/ in Destroy animation
+ SysTryReturnVoidResult(NID_UI_CTRL, pBoundsAnimation, E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] Memory allocation failed.");
+
+ pBoundsAnimation->SetTimingFunction(__pTimingFunction);
+ FloatRectangle startValue = source.GetBounds();
+ startValue.x = startValue.x + startValue.width * 0.05;
+ startValue.y = startValue.y + startValue.height * 0.05;
+ startValue.width = startValue.width * 0.9;
+ startValue.height = startValue.height * 0.9;
+
+ pBoundsAnimation->SetStartValue(Variant(source.GetBounds()));
+ pBoundsAnimation->SetEndValue(Variant(startValue));
+ pBoundsAnimation->SetVisualElementAnimationStatusEventListener(this);
+ pBoundsAnimation->SetVisualElementAnimationTickEventListener(this);
+ pBoundsAnimation->SetDuration(ANIMATION_DURATION_BOUNDS);
+ source.AddAnimation(L"BoundsAnimation", *pBoundsAnimation);
+ delete pBoundsAnimation;
+
+ AnimationTransaction::Commit();
+
+ return;
+}
+
}}} //Tizen::Ui::Controls
: public Tizen::Ui::Controls::_EditPresenter
, virtual public Tizen::Base::Runtime::IEventListener
, public Tizen::Ui::Animations::IVisualElementAnimationStatusEventListener
+ , public Tizen::Ui::Animations::IVisualElementAnimationTickEventListener
{
public:
_TokenEditPresenter(void);
float GetLineSpacingF() const;
- Tizen::Ui::Animations::VisualElementAnimation* CreateAnimationN(Tizen::Ui::Animations::VisualElement& source, bool create);
+ Tizen::Ui::Animations::VisualElementAnimation* CreateAnimationN(Tizen::Ui::Animations::VisualElement& source);
virtual bool IsGuideTextActivated(void) const;
virtual void DrawText(void);
virtual void OnVisualElementAnimationFinished(const Tizen::Ui::Animations::VisualElementAnimation& animation, const Tizen::Base::String& keyName, Tizen::Ui::Animations::VisualElement& target, bool completedNormally);
virtual void OnVisualElementAnimationRepeated(const Tizen::Ui::Animations::VisualElementAnimation& animation, const Tizen::Base::String& keyName, Tizen::Ui::Animations::VisualElement& target, long currentRepeatCount){}
virtual void OnVisualElementAnimationStarted(const Tizen::Ui::Animations::VisualElementAnimation& animation, const Tizen::Base::String& keyName, Tizen::Ui::Animations::VisualElement& target){}
+ virtual void OnTickOccurred(const Tizen::Ui::Animations::VisualElementAnimation& animation, const Tizen::Base::String& keyName, Tizen::Ui::Animations::VisualElement& target, const Tizen::Ui::Variant& currentValue);
+
void OnBoundsChanged(void);
virtual void OnTimerExpired(Tizen::Base::Runtime::Timer& timer);
void SetDrawFocusState(bool focusState);
int GetFocusedTokenIndex(void) const;
void PrepareFocusUiMode(void);
+ void PerformRemoveTokenAnimation(Tizen::Ui::Animations::VisualElement& source);
private:
bool DrawToken(int count = -1);