Init Tizen 2.2.1
[framework/osp/web.git] / src / controls / FWebCtrl_WebNotification.cpp
index f46f224..98f3fad 100755 (executable)
@@ -27,6 +27,7 @@
 #include <FUiAnimPointAnimation.h>
 #include <FUiAnimFloatAnimation.h>
 #include <FUiAnimAnimationTransaction.h>
+#include <FUiAnimVisualElementPropertyAnimation.h>
 #include <FUiCtrlButton.h>
 #include "FWebCtrl_WebImpl.h"
 #include "FWebCtrl_WebNotificationHandler.h"
@@ -160,19 +161,19 @@ _WebNotification::LaunchNotification()
        r = Window::Show();
        SysTryReturn(NID_WEB_CTRL, r == E_SUCCESS, r, r, "[%s] Error Propogating.", GetErrorMessage(r));
 
-       Point start(0,-200),end;
-       PointAnimation pointAnimation(Point(0, 0), Point(0, 0), 0, ANIMATION_INTERPOLATOR_LINEAR);
+       FloatRectangle rect(static_cast< float >(NOTIFCATION_RECT_AREA.x),static_cast< float >(NOTIFCATION_RECT_AREA.y),static_cast< float >(NOTIFCATION_RECT_AREA.width),static_cast< float >(NOTIFCATION_RECT_AREA.height));
 
-       end = Point(0,0);
+       FloatRectangle __endRect = rect;
+       FloatRectangle __startRect = FloatRectangle(rect.x, rect.height - 200, rect.width, rect.height);
 
-       pointAnimation.SetStartValue(start);
-       pointAnimation.SetEndValue(end);
-       pointAnimation.SetDuration(2000);
-       pointAnimation.SetAutoReverseEnabled(false);
+       std::unique_ptr<VisualElementPropertyAnimation> pAnimation(new (std::nothrow) VisualElementPropertyAnimation());
+       SysTryReturnResult(NID_WEB_CTRL, pAnimation.get(), E_OUT_OF_MEMORY, "Memory allocation failed.");
 
-       ControlAnimator *pAnimator = this->GetControlAnimator();
-       r = pAnimator->StartUserAnimation(ANIMATION_TARGET_POSITION, pointAnimation);
-       SysTryReturnResult(NID_WEB_CTRL, r == E_SUCCESS, r, "[%s] Error Propagated.", GetErrorMessage(r));
+       pAnimation->SetPropertyName(L"bounds");
+       pAnimation->SetStartValue(Variant(__startRect));
+       pAnimation->SetEndValue(Variant(__endRect));
+       pAnimation->SetDuration(2000);
+       this->GetVisualElement()->AddAnimation(L"bounds", *pAnimation);
 
        __pTimer->Start(15000);
        return E_SUCCESS;
@@ -182,25 +183,17 @@ _WebNotification::LaunchNotification()
 void
 _WebNotification::OnTimerExpired(Timer& timer)
 {
-       int transactionId = 0;
-       int duration = 1000;
        float start = 1.0f;
        float end = 0.0f;
 
-       ParallelAnimationGroup showAnim;
-       FloatAnimation floatAnim(start, end, duration, ANIMATION_INTERPOLATOR_LINEAR);
-       showAnim.AddAnimation(ANIMATION_TARGET_ALPHA, floatAnim);
+       std::unique_ptr<VisualElementPropertyAnimation> pAnimation(new (std::nothrow) VisualElementPropertyAnimation());
+       SysTryReturnVoidResult(NID_WEB_CTRL, pAnimation.get(), E_OUT_OF_MEMORY, "Memory allocation failed.");
 
-       AnimationTransaction::Begin(transactionId);
-
-       ControlAnimator *pAnimator = this->GetControlAnimator();
-       pAnimator->SetAnimation(ANIMATION_TRIGGER_SHOW_STATE_CHANGE, &showAnim);
-       pAnimator->SetShowState(static_cast< int >(start));
-
-       AnimationTransaction::Commit();
-       __pWebImpl->ClearWebNotification(this);
-
-       delete this;
+       pAnimation->SetPropertyName(L"opacity");
+       pAnimation->SetStartValue(Variant(start));
+       pAnimation->SetEndValue(Variant(end));
+       pAnimation->SetDuration(2000);
+       this->GetVisualElement()->AddAnimation(L"opacity", *pAnimation);
 }