#ifndef _LIVEBOX_VIEWER_MAIN_FORM_H_
#define _LIVEBOX_VIEWER_MAIN_FORM_H_
+#include <FApp.h>
#include <FBase.h>
#include <FUi.h>
+#include <FShellLiveboxProviderInfo.h>
class LiveboxViewerMainForm
: public Tizen::Ui::Controls::Form
, public Tizen::Ui::Scenes::ISceneEventListener
, public Tizen::Ui::Controls::IListViewItemEventListener
, public Tizen::Ui::Controls::IListViewItemProvider
+ , public Tizen::App::IAppControlResponseListener
{
public:
LiveboxViewerMainForm(void);
virtual Tizen::Ui::Controls::ListItemBase* CreateItem (int index, int itemWidth);
virtual bool DeleteItem(int index, Tizen::Ui::Controls::ListItemBase *pItem, int itemWidth);
+ virtual void OnAppControlCompleteResponseReceived(const Tizen::App::AppId& appId, const Tizen::Base::String& operationId, Tizen::App::AppCtrlResult appControlResult, const Tizen::Base::Collection::IMap* pExtraData);
+ void StartConfigurationAppControl(const Tizen::Base::String& appId, const Tizen::Base::String& providerName);
+ void GoLiveboxViewScene(const Tizen::Base::String& appId, const Tizen::Base::String& providerName, const Tizen::Base::String& userInfo);
+
private:
static const int ID_FORMAT_STRING = 500;
+ static const int ID_FORMAT_BITMAP = 501;
+
Tizen::Ui::Controls::ListView* __pList;
Tizen::Base::Collection::IList* __pLiveboxProviderList;
+ Tizen::Base::Collection::ArrayList* __pLiveboxIconList;
+ Tizen::Shell::LiveboxProviderInfo* __pSelectedProviderInfo;
}; // LiveboxViewerMainForm
#endif // _LIVEBOX_VIEWER_MAIN_FORM_H_
//
#include <FApp.h>
+#include <FMedia.h>
#include <FShellLiveboxProviderInfo.h>
#include <FShellLiveboxManager.h>
#include <FShellLiveboxSizeInfo.h>
using namespace Tizen::Ui::Scenes;
using namespace Tizen::Shell;
+const int LIST_ITEM_ICON = 72;
const int LIST_ITEM_HEIGHT = 112;
const int LIST_ITEM_MARGIN_LEFT = 26;
const int LIST_ITEM_MARGIN_TOP = 32;
__pLiveboxProviderList = LiveboxManager::GetInstance()->GetLiveboxProviderInfoListN();
TryReturnVoid(__pLiveboxProviderList, "GetLiveboxListN returns null!!" );
- AppLog("All livebox count (%d)", __pLiveboxProviderList->GetCount() );
+ __pLiveboxIconList = new ArrayList(SingleObjectDeleter);
+ __pLiveboxIconList->Construct();
+ for( int i = 0; i < __pLiveboxProviderList->GetCount(); i++)
+ {
+ LiveboxProviderInfo* pLiveboxProviderInfo = dynamic_cast<LiveboxProviderInfo*>(__pLiveboxProviderList->GetAt(i) );
+
+ Tizen::Media::Image image;
+ result r = image.Construct();
+ Bitmap* pBmp = image.DecodeN(pLiveboxProviderInfo->GetIconPath(), BITMAP_PIXEL_FORMAT_ARGB8888);
+
+ __pLiveboxIconList->Add(pBmp);
+ }
}
LiveboxViewerMainForm::~LiveboxViewerMainForm(void)
delete __pLiveboxProviderList;
}
+ if (__pLiveboxIconList)
+ {
+ __pLiveboxIconList->RemoveAll();
+ delete __pLiveboxIconList;
+ }
+
return r;
}
void
LiveboxViewerMainForm::OnListViewItemStateChanged(Tizen::Ui::Controls::ListView &listView, int index, int elementId, Tizen::Ui::Controls::ListItemStatus status)
{
- SceneManager* pSceneManager = SceneManager::GetInstance();
- AppAssert(pSceneManager);
-
if(status == LIST_ITEM_STATUS_SELECTED)
{
- ArrayList* pList = new (std::nothrow) ArrayList;
- AppAssert(pList);
- pList->Construct();
+ __pSelectedProviderInfo = dynamic_cast<LiveboxProviderInfo*>(__pLiveboxProviderList->GetAt(index));
+ AppAssert(__pSelectedProviderInfo);
- LiveboxProviderInfo* pProviderInfo = dynamic_cast<LiveboxProviderInfo*>(__pLiveboxProviderList->GetAt(index));
- AppAssert(pProviderInfo);
+ String configurationAppControlAppId = __pSelectedProviderInfo->GetConfigurationAppControlAppId();
+ if(!configurationAppControlAppId.IsEmpty())
+ {
+ StartConfigurationAppControl(__pSelectedProviderInfo->GetConfigurationAppControlAppId(), __pSelectedProviderInfo->GetName());
+ }
+ else
+ {
+ AppLog("%ls", __pSelectedProviderInfo->GetDisplayName().GetPointer());
+ GoLiveboxViewScene(__pSelectedProviderInfo->GetAppId(), __pSelectedProviderInfo->GetName(), L"");
+ }
+ }
+}
- AppLog("Display name (%ls)", pProviderInfo->GetDisplayName().GetPointer());
- AppLog("AppId (%ls)", pProviderInfo->GetAppId().GetPointer());
- AppLog("Name (%ls)", pProviderInfo->GetName().GetPointer());
+void
+LiveboxViewerMainForm::StartConfigurationAppControl(const Tizen::Base::String& appId, const Tizen::Base::String& providerName)
+{
+ AppControl* pAc = AppManager::FindAppControlN( appId, L"http://tizen.org/appcontrol/operation/livebox/configuration");
+ HashMap extra;
+ extra.Construct();
+ String key = L"ProviderName";
+ String value = providerName;
+ extra.Add(&key, &value);
+
+ pAc->Start(null, null, &extra, this);
+ delete pAc;
+}
- pList->Add(*(new (std::nothrow) String( pProviderInfo->GetDisplayName())));
- pList->Add(*(new (std::nothrow) String( pProviderInfo->GetAppId()) ));
- pList->Add(*(new (std::nothrow) String( pProviderInfo->GetName()) ));
+void
+LiveboxViewerMainForm::GoLiveboxViewScene(const String& appId, const String& providerName, const String& userInfo)
+{
+ ArrayList* pList = new (std::nothrow) ArrayList;
+ AppAssert(pList);
+ pList->Construct();
- pSceneManager->GoForward(ForwardSceneTransition(VIEW_SCENE, SCENE_TRANSITION_ANIMATION_TYPE_LEFT), pList);
- }
+ pList->Add(*(new (std::nothrow) String(appId) ));
+ pList->Add(*(new (std::nothrow) String(providerName) ));
+ pList->Add(*(new (std::nothrow) String(userInfo )) );
+
+ SceneManager* pSceneManager = SceneManager::GetInstance();
+ AppAssert(pSceneManager);
+
+ pSceneManager->GoForward(ForwardSceneTransition(VIEW_SCENE, SCENE_TRANSITION_ANIMATION_TYPE_LEFT), pList);
+ __pSelectedProviderInfo = null;
}
void
Tizen::Ui::Controls::ListItemBase*
LiveboxViewerMainForm::CreateItem (int index, int itemWidth)
{
- ListAnnexStyle style = LIST_ANNEX_STYLE_NORMAL;
-
CustomItem* pItem = new (std::nothrow) CustomItem();
- pItem->Construct(Tizen::Graphics::Dimension(itemWidth, LIST_ITEM_HEIGHT), style);
+ pItem->Construct(Tizen::Graphics::Dimension(itemWidth, LIST_ITEM_HEIGHT), LIST_ANNEX_STYLE_NORMAL);
- Rectangle itemRect(LIST_ITEM_MARGIN_LEFT, LIST_ITEM_MARGIN_TOP, GetClientAreaBounds().width - (LIST_ITEM_MARGIN_LEFT * 2), LIST_ITEM_TEXT_HEIGHT);
+ Rectangle iconRect(LIST_ITEM_MARGIN_LEFT, LIST_ITEM_MARGIN_TOP/2, LIST_ITEM_ICON, LIST_ITEM_ICON);
+ int text_x = LIST_ITEM_ICON + LIST_ITEM_MARGIN_LEFT + 20;
+ Rectangle textRect(text_x, LIST_ITEM_MARGIN_TOP, GetClientAreaBounds().width - LIST_ITEM_MARGIN_LEFT - text_x, LIST_ITEM_TEXT_HEIGHT);
LiveboxProviderInfo* pProviderInfo = dynamic_cast<LiveboxProviderInfo*>(__pLiveboxProviderList->GetAt(index));
+
if (pProviderInfo)
{
- String itemTitle(pProviderInfo->GetDisplayName());
-
- AppLog("Item title (%ls)", itemTitle.GetPointer());
+ Bitmap* pBmp = dynamic_cast<Bitmap*>(__pLiveboxIconList->GetAt(index));
- pItem->AddElement(itemRect, ID_FORMAT_STRING, itemTitle, true);
+ pItem->AddElement(iconRect, ID_FORMAT_BITMAP, *pBmp, null, null);
+ pItem->AddElement(textRect, ID_FORMAT_STRING, pProviderInfo->GetDisplayName()+" ("+pProviderInfo->GetAppId()+")", true);
}
return pItem;
delete pItem;
return true;
}
+
+
+void
+LiveboxViewerMainForm::OnAppControlCompleteResponseReceived(const AppId& appId, const Tizen::Base::String& operationId, AppCtrlResult appControlResult, const Tizen::Base::Collection::IMap* pExtraData)
+{
+ String temp;
+ TryReturnVoid(__pSelectedProviderInfo, "__pSelectedProviderInfo should not be null!");
+
+ if(pExtraData)
+ {
+ String userInfokey(L"UserInfo");
+ const String* pUserInfoValue = dynamic_cast<const String*>(pExtraData->GetValue(userInfokey) );
+ AppLog("%ls, %ls, %ls", appId.GetPointer(), operationId.GetPointer(), pUserInfoValue->GetPointer() );
+
+ GoLiveboxViewScene(__pSelectedProviderInfo->GetAppId(), __pSelectedProviderInfo->GetName(), *pUserInfoValue);
+ }
+}
//
#include <unique_ptr.h>
+#include <FApp.h>
+#include <FMedia.h>
#include <FShellLiveboxView.h>
#include <FShellLiveboxManager.h>
#include <FShellLiveboxProviderInfo.h>
using namespace Tizen::Ui::Controls;
using namespace Tizen::Ui::Scenes;
using namespace Tizen::Shell;
+using namespace Tizen::Media;
const int CONTEXT_MENU_X = 100;
const int CONTEXT_MENU_Y = 200;
}
void
-ViewForm::CreateLiveboxView(const Tizen::Base::String& appId, const Tizen::Base::String& providerName)
+ViewForm::CreateLiveboxView(const Tizen::Base::String& appId, const Tizen::Base::String& providerName, const Tizen::Base::String& userInfo)
{
unique_ptr<LiveboxView> pLiveboxView(new LiveboxView());
if (pLiveboxView)
{
- result r = pLiveboxView->Construct(appId, providerName, Rectangle(VIEW_X, VIEW_Y, VIEW_WIDTH, VIEW_HEIGHT));
+ result r = pLiveboxView->Construct(appId, providerName, Rectangle(VIEW_X, VIEW_Y, VIEW_WIDTH, VIEW_HEIGHT), userInfo);
TryReturnVoid(r == E_SUCCESS, "[%s] Propagating.", GetErrorMessage(r));
AddControl(*pLiveboxView);
String size;
size.Format(255, L"%dx%d", pSizeInfo->GetSize().width, pSizeInfo->GetSize().height);
- __pContextMenu->AddItem(size, i);
+ Image image;
+ result r = image.Construct();
+// Bitmap* pBmp = image.DecodeN(L"/opt/apps/yPpyL2WVNQ/shared/res/screen-density-xhigh/2x2.png", BITMAP_PIXEL_FORMAT_ARGB8888);
+ Bitmap* pBmp = image.DecodeN(pSizeInfo->GetPreviewImagePath(), BITMAP_PIXEL_FORMAT_ARGB8888);
+
+
+ if( pBmp)
+ {
+// __pContextMenu->AddItem(size, i, *pBmp );
+ __pContextMenu->AddItem(size, i, *pBmp );
+ }
+ else
+ {
+ __pContextMenu->AddItem(size, i);
+ }
}
}
{
if (pArgs && (pArgs->GetCount() > 0))
{
- String* pDisplayName = dynamic_cast<String*>(pArgs->GetAt(0));
- String* pAppId = dynamic_cast<String*>(pArgs->GetAt(1));
- String* pLiveboxProviderName = dynamic_cast<String*>(pArgs->GetAt(2));
+ String* pAppId = dynamic_cast<String*>(pArgs->GetAt(0));
+ String* pLiveboxProviderName = dynamic_cast<String*>(pArgs->GetAt(1));
+ String* pUserInfo = dynamic_cast<String*>(pArgs->GetAt(2));
if (pAppId != null && pLiveboxProviderName != null)
{
- AppLog("%ls", pDisplayName->GetPointer());
AppLog("%ls", pAppId->GetPointer());
- AppLog("%ls", pLiveboxProviderName->GetPointer());
Header* pHeader = GetHeader();
- pHeader->SetTitleText(*pDisplayName);
+ pHeader->SetTitleText(*pAppId);
- CreateLiveboxView(*pAppId, *pLiveboxProviderName);
+ CreateLiveboxView(*pAppId, *pLiveboxProviderName, *pUserInfo);
}
pArgs->RemoveAll(true);