}
void
+_LiveboxPopupView::SetPopupBounds(const Dimension& size)
+{
+ const _Control* pParent = __pLiveboxView->GetParent();
+ result r = GetLastResult();
+ SysTryReturnVoidResult(NID_UI_CTRL, pParent, r, "[%s] Propagating.", GetErrorMessage(r));
+
+ Rectangle bounds = __pLiveboxView->GetBounds();
+ Rectangle parentClientBounds = pParent->GetClientBounds();
+ Rectangle absoluteBounds = __pLiveboxView->GetAbsoluteBounds();
+ Rectangle popupBounds(0, 0, size.width, size.height);
+
+ int remainingSpace = parentClientBounds.height - bounds.y - bounds.height;
+
+ if (size.height > remainingSpace)
+ {
+ popupBounds.y = absoluteBounds.y - size.height;
+ }
+ else
+ {
+ popupBounds.y = absoluteBounds.y + absoluteBounds.height;
+ }
+
+ SysLog(NID_UI_CTRL, "[%d %d %d %d]", parentClientBounds.height, remainingSpace, popupBounds.y, size.height);
+
+ SetBounds(popupBounds);
+
+ SysLog(NID_UI_CTRL, "[%d %d %d %d]", popupBounds.x, popupBounds.y, popupBounds.width, popupBounds.height);
+}
+
+void
_LiveboxPopupView::FireLiveboxPopupEvent(bool open)
{
if (__pLiveboxPopupViewEvent)
SysLog(NID_UI_CTRL, "(%d %d) %lld", size.width, size.height, ticks);
- SetSize(size);
+ if (size != GetSize())
+ {
+ SetPopupBounds(size);
+ }
__pBitmap.reset(const_cast<Bitmap*>(&bitmap));
_LiveboxPopupView(const _LiveboxPopupView& rhs);
_LiveboxPopupView& operator =(const _LiveboxPopupView& rhs);
+ void SetPopupBounds(const Tizen::Graphics::Dimension& size);
void FireLiveboxPopupEvent(bool open);
void GetTouchPostion(const Tizen::Graphics::Point& point, double& x, double& y);
void PlayAnimation(bool open);
_LiveboxView::OpenLiveboxPopup(void)
{
result r = E_SUCCESS;
- Dimension size = __pLiveboxViewManager->GetLiveboxPopupSize(__pLivebox);
- Rectangle trayBounds(0, 0, size.width, size.height);
- Rectangle absoluteBounds = GetAbsoluteBounds();
if (!__pLiveboxPopupView)
{
__pLiveboxPopupView = move(pLiveboxPopupView);
}
- trayBounds.y = absoluteBounds.y + absoluteBounds.height;
+ const _Control* pParent = GetParent();
+ r = GetLastResult();
+ SysTryReturn(NID_UI_CTRL, pParent, r, r, "[%s] Propagating.", GetErrorMessage(r));
+
+ Dimension size = __pLiveboxViewManager->GetLiveboxPopupSize(__pLivebox);
+ Rectangle popupBounds(0, 0, size.width, size.height);
+ Rectangle bounds = GetBounds();
+ Rectangle absoluteBounds = GetAbsoluteBounds();
- r = __pLiveboxPopupView->SetBounds(trayBounds);
+ Rectangle parentClientBounds = pParent->GetClientBounds();
+ int remainingSpace = parentClientBounds.height - bounds.y - bounds.height;
+ if (size.height > remainingSpace)
+ {
+ popupBounds.y = absoluteBounds.y - size.height;
+ }
+ else
+ {
+ popupBounds.y = absoluteBounds.y + absoluteBounds.height;
+ }
+
+ SysLog(NID_UI_CTRL, "[%d %d %d %d]", parentClientBounds.height, remainingSpace, popupBounds.y, size.height);
+
+ r = __pLiveboxPopupView->SetBounds(popupBounds);
SysTryReturn(NID_UI_CTRL, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r));
__pLiveboxPopupView->SetOwner(this);
bool
_LiveboxView::OnFlickGestureDetected(_TouchFlickGestureDetector& gesture)
{
- PlayFlickAnimation();
-
_FlickDirection direction = gesture.GetDirection();
if (direction == _FLICK_DIRECTION_DOWN)
{
+ PlayFlickAnimation();
OpenLiveboxPopup();
}
livebox* pLivebox = livebox_add_with_size(pAppId.get(), pContent.get(), pCluster, pCategory, GetLiveboxSizeType(pLiveboxView->GetSize()), 1, OnLiveboxAdded, this);
SysTryReturn(NID_UI_CTRL, pLivebox, null, E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] Memory is insufficient.");
-/*
- livebox* pLivebox = livebox_add(pAppId.get(), pContent.get(), pCluster, pCategory, 1, OnLiveboxAdded, this);
- SysTryReturn(NID_UI_CTRL, pLivebox, null, E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] Memory is insufficient.");
-*/
+
__pViewMap->Add(pLivebox, pLiveboxView);
return pLivebox;
MediaPixelFormat
_LiveboxViewManager::GetPixelFormat(BitmapPixelFormat format) const
{
- MediaPixelFormat out = MEDIA_PIXEL_FORMAT_NONE;
+ MediaPixelFormat mediaPixelFormat = MEDIA_PIXEL_FORMAT_NONE;
switch(format)
{
case BITMAP_PIXEL_FORMAT_RGB565:
- out = MEDIA_PIXEL_FORMAT_RGB565LE;
+ mediaPixelFormat = MEDIA_PIXEL_FORMAT_RGB565LE;
break;
case BITMAP_PIXEL_FORMAT_ARGB8888:
- out = MEDIA_PIXEL_FORMAT_BGRA8888;
+ mediaPixelFormat = MEDIA_PIXEL_FORMAT_BGRA8888;
break;
case BITMAP_PIXEL_FORMAT_R8G8B8A8:
- out = MEDIA_PIXEL_FORMAT_RGBA8888;
+ mediaPixelFormat = MEDIA_PIXEL_FORMAT_RGBA8888;
break;
default:
break;
}
- return out;
+ return mediaPixelFormat;
}
Bitmap*
pBitmap = __pLiveboxView->GetAppIconBitmap();
}
- SysTryReturnVoidResult(NID_UI_CTRL, pBitmap, E_SYSTEM, "Bitmap is invalid.");
+ SysTryReturnVoidResult(NID_UI_CTRL, pBitmap, E_SYSTEM, "Bitmap is invalid (%d).", updated);
Dimension liveboxSize = __pLiveboxView->GetSize();
int bitmapWidth = pBitmap->GetWidth();