* @file FWebCtrl_WebNotification.cpp
* @brief The file contains the definition of _WebNotification class.
*/
-
#include <FBaseRtTimer.h>
#include <FBaseSysLog.h>
+#include <FSysVibrator.h>
+#include <FSys_VibratorImpl.h>
#include <FUiAnimControlAnimator.h>
#include <FUiAnimPointAnimation.h>
#include <FUiAnimFloatAnimation.h>
#include <FUiAnimAnimationTransaction.h>
+#include <FUiAnimVisualElementPropertyAnimation.h>
#include <FUiCtrlButton.h>
+#include "FWebCtrl_WebImpl.h"
#include "FWebCtrl_WebNotificationHandler.h"
#include "FWebCtrl_WebNotification.h"
using namespace Tizen::Ui::Animations;
using namespace Tizen::Ui::Controls;
+
namespace Tizen { namespace Web { namespace Controls
{
+
_WebNotification::_WebNotification(void)
: __pNotificationHandler(null)
, __pContext(null)
, __notificationId(0)
, __pTimer(null)
+ , __pWebImpl(null)
{
}
{
}
+
result
-_WebNotification::Construct(Ewk_Context *pContext, uint64_t notificationId)
+_WebNotification::Construct(Ewk_Context *pContext, uint64_t notificationId, Tizen::Web::Controls::_WebImpl* pImpl)
{
-
-// _ControlOrientation orientation = _ControlManager::GetInstance()->GetOrientation();
-// Dimension screenRect = _ControlManager::GetInstance()->GetScreenSize();
-
Rectangle rect(NOTIFCATION_RECT_AREA);
result r = E_SUCCESS;
SysTryReturn(NID_WEB_CTRL, r == E_SUCCESS, r, r, "[%s] Error Propogating.", GetErrorMessage(r));
SetBounds(rect);
+ Window::SetOwner(&pImpl->GetPublic());
__pNotificationHandler = std::unique_ptr<_WebNotificationHandler>(new (std::nothrow) _WebNotificationHandler());
SysTryReturnResult(NID_WEB_CTRL, __pNotificationHandler.get(), E_OUT_OF_MEMORY, "Memory allocation failed.");
r = __pTimer->Construct(*this);
SysTryReturn(NID_WEB_CTRL, r == E_SUCCESS, r, r, "[%s] Error Propogating.", GetErrorMessage(r));
+ __pWebImpl = pImpl;
+
return r;
}
__pNotificationHandler->SetText(text);
}
+
String
_WebNotification::GetText(void) const
{
ewk_notification_clicked(__pContext,__notificationId);
}
+
+void
+_WebNotification::OnChangeLayout(void)
+{
+ SetShowState(false);
+ SetShowState(true);
+ Window::Show();
+}
+
+
result
_WebNotification::LaunchNotification()
{
r = pButton->Construct(Rectangle(NOTIFCATION_BUTTON_AREA));
SysTryReturn(NID_WEB_CTRL, r == E_SUCCESS, r, r, "[%s] Error Propogating.", GetErrorMessage(r));
- pButton->SetText(L"x"); //Need to add bit map
+ pButton->SetText(L"x"); //Need to add bitmap
pButton->AddActionEventListener(*this);
r = AddControl(pButton.get());
+ SysTryReturn(NID_WEB_CTRL, r == E_SUCCESS, r, r, "[%s] Error Propogating.", GetErrorMessage(r));
pButton.release();
SetShowState(true);
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;
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();
- delete this;
+ pAnimation->SetPropertyName(L"opacity");
+ pAnimation->SetStartValue(Variant(start));
+ pAnimation->SetEndValue(Variant(end));
+ pAnimation->SetDuration(2000);
+ this->GetVisualElement()->AddAnimation(L"opacity", *pAnimation);
}
+
void
_WebNotification::OnActionPerformed(const Tizen::Ui::Control& source, int actionId)
{
SetShowState(false);
+ __pWebImpl->ClearWebNotification(this);
+
delete this;
}
+
}}}