bool Initialize();
void CreateTableView(void);
void ConfirmPopupOn();
- result GetInfoValue(int groupIndex, int itemIndex, Tizen::Base::String& name, Tizen::Base::String& description);
+ result GetDescriptionInfo(int groupIndex, int itemIndex, Tizen::Base::String& name, Tizen::Base::String& description);
result ParsingTPK();
result ResizeSubText(int lineCount, Tizen::Ui::Controls::TableViewItem* pItem, Tizen::Ui::Controls::TextBox* pSubTextBox);
void SetInfoTextBox();
#ifndef _IST_INSTALL_EVENT_LISTENER_H_
#define _IST_INSTALL_EVENT_LISTENER_H_
-
#include <FApp.h>
class InstallEventListener
bool Initialize();
void AddFooterItem();
void InstallApplication();
- void OnPopup();
- void SetPopupValueAndOn(Tizen::Base::String title, Tizen::Base::String content);
+ void DisplayPopup();
+ void SetPopupValue(Tizen::Base::String title, Tizen::Base::String content);
void SetPopupControl();
virtual result OnInitializing(void);
private:
int __timerCounter;
bool __isInstalling;
- bool __isInstallSuccess;
Timer* __pTimer;
Tizen::Ui::Controls::Header* __pHeader;
Tizen::Base::String __packageName;
Tizen::App::AppManager* __pAppManager;
+ Tizen::Base::Collection::ArrayList* __pAnimationFrameList;
+ Tizen::Base::Collection::ArrayList* __pAnimationFrameList2;
+ Tizen::Ui::Controls::Animation* __pAnimation;
+ Tizen::Ui::Controls::Animation* __pAnimation2;
+
};
#endif
#include <FSystem.h>
#include <FUi.h>
-
-
class InstallerApp
: public Tizen::App::UiApp
, public Tizen::App::IAppControlProviderEventListener
static const int INSTALL_SUCCESS_EVENT = 2000;
static const int INSTALL_FAIL_STORAGE_FULL = 2001;
static const int INSTALL_FAIL_INVALID_PACKAGE = 2002;
+static const int INSTALL_PROGRESS_VALUE = 2003;
extern const wchar_t* HEADER_IMAGE;
extern const wchar_t* APP_NAME;
Name: apps.Installer
Summary: Installer application
-Version: 1.0.1
+Version: 1.0.2
Release: 1
Group: TO_BE/FILLED_IN
License: TO BE FILLED IN
%files
%defattr(-,root,root,-)
/usr/apps/*
-
-
This XML file was automatically generated by UiBuilder - do not modify by hand.
-->
<!DOCTYPE Scene SYSTEM "UIForm.dtd">
-<Scene Bversion="2.0.0.201302151107" Dversion="20120315">
+<Scene Bversion="2.0.0.201303182057" Dversion="20120315">
<LogicalCoordinate>720</LogicalCoordinate>
<Form id="IDL_APP_INSTALL_FORM">
- <property backgroundColor="" backgroundColorOpacity="100" orientation="Portrait" softKey0NormalIcon="" softKey0PressedIcon="" softKey0Text="" softKey1NormalIcon="" softKey1PressedIcon="" softKey1Text="" title="" titleAlign="ALIGN_CENTER" titleIcon="" translucentFooter="false" translucentHeader="false" translucentIndicator="false"/>
+ <property backgroundColor="" backgroundColorOpacity="100" notificationTrayOpenEnabled="false" orientation="Portrait" softKey0NormalIcon="" softKey0PressedIcon="" softKey0Text="" softKey1NormalIcon="" softKey1PressedIcon="" softKey1Text="" title="" titleAlign="ALIGN_CENTER" titleIcon="" translucentFooter="false" translucentHeader="false" translucentIndicator="false"/>
<layout mode="Portrait" style="FORM_STYLE_INDICATOR|FORM_STYLE_HEADER|FORM_STYLE_FOOTER" type="NONE"/>
<layout mode="Landscape" style="FORM_STYLE_INDICATOR|FORM_STYLE_HEADER|FORM_STYLE_FOOTER" type="NONE"/>
</Form>
<itemSet/>
</Footer>
<Header>
- <property backgroundBitmapPath="" color="" colorOpacity="100" descriptionText="" descriptionTextColor="" disabledButtonColor="" disabledButtonColorOpacity="100" disabledButtonTextColor="" disabledItemColor="" disabledItemColorOpacity="100" disabledItemTextColor="" headerStyle="HEADER_STYLE_TITLE" highlightedButtonColor="" highlightedButtonColorOpacity="100" highlightedButtonTextColor="" highlightedItemColor="" highlightedItemColorOpacity="100" highlightedItemTextColor="" normalButtonColor="" normalButtonColorOpacity="100" normalButtonTextColor="" normalItemColor="" normalItemColorOpacity="100" normalItemTextColor="" pressedButtonColor="" pressedButtonColorOpacity="100" pressedButtonTextColor="" pressedItemColor="" pressedItemColorOpacity="100" pressedItemTextColor="" selectedItemColor="" selectedItemColorOpacity="100" selectedItemTextColor="" titleIconPath="" titleText="AppName INSTALL" titleTextColor=""/>
+ <property accessibilityHint="" backgroundBitmapPath="" color="" colorOpacity="100" descriptionText="" descriptionTextColor="" disabledButtonColor="" disabledButtonColorOpacity="100" disabledButtonTextColor="" disabledItemColor="" disabledItemColorOpacity="100" disabledItemTextColor="" headerStyle="HEADER_STYLE_TITLE" highlightedButtonColor="" highlightedButtonColorOpacity="100" highlightedButtonTextColor="" highlightedItemColor="" highlightedItemColorOpacity="100" highlightedItemTextColor="" normalButtonColor="" normalButtonColorOpacity="100" normalButtonTextColor="" normalItemColor="" normalItemColorOpacity="100" normalItemTextColor="" pressedButtonColor="" pressedButtonColorOpacity="100" pressedButtonTextColor="" pressedItemColor="" pressedItemColorOpacity="100" pressedItemTextColor="" selectedItemColor="" selectedItemColorOpacity="100" selectedItemTextColor="" titleIconPath="" titleText="AppName INSTALL" titleTextColor=""/>
<itemSet/>
</Header>
- <Progress id="IDF_PROGRESS" parent="IDL_APP_INSTALL_FORM">
- <property backgroundColor="" barColor="" leftText="" max="20" min="0" rightText="" showValueState="true" value="0"/>
- <layout height="93" mode="Portrait" style="PROGRESS_STYLE_NONE" width="650" x="36" y="463"/>
- <layout height="52" mode="Landscape" style="PROGRESS_STYLE_NONE" width="533" x="280" y="48"/>
- </Progress>
<Label id="IDC_PROGRESS_LABEL" parent="IDL_APP_INSTALL_FORM">
- <property backgroundBitmapPath="" backgroundColor="" backgroundColorOpacity="0" horizontalAlign="ALIGN_LEFT" text="Installing..." textColor="" textSize="33" textStyle="LABEL_TEXT_STYLE_NORMAL" verticalAlign="ALIGN_MIDDLE"/>
- <layout height="46" mode="Portrait" width="444" x="46" y="436"/>
- <layout height="52" mode="Landscape" width="533" x="94" y="21"/>
+ <property accessibilityHint="" backgroundBitmapPath="" backgroundColor="" backgroundColorOpacity="0" horizontalAlign="ALIGN_LEFT" leftMargin="16" text="Installing..." textColor="" textSize="33.0" textStyle="LABEL_TEXT_STYLE_NORMAL" topMargin="0" verticalAlign="ALIGN_MIDDLE"/>
+ <layout height="46.0" mode="Portrait" width="444.0" x="46.0" y="436.0"/>
+ <layout height="52.0" mode="Landscape" width="533.0" x="94.0" y="21.0"/>
</Label>
+ <Progress id="IDF_PROGRESS" parent="IDL_APP_INSTALL_FORM">
+ <property accessibilityHint="" backgroundColor="" barBGColor="" barColor="" leftText="" max="100" min="0" rightText="" showValueState="true" value="0"/>
+ <layout height="56.0" mode="Portrait" style="" width="575.0" x="73.0" y="498.0"/>
+ <layout height="68.0" mode="Landscape" style="" width="1022.0" x="128.0" y="231.0"/>
+ </Progress>
</Scene>
using namespace Tizen::Base;
using namespace Tizen::App;
using namespace Tizen::App::Package;
+using namespace Tizen::App::Package;
using namespace Tizen::Base::Collection;
using namespace Tizen::Graphics;
+using namespace Tizen::Security;
+using namespace Tizen::System;
using namespace Tizen::Ui;
using namespace Tizen::Ui::Controls;
using namespace Tizen::Ui::Scenes;
-using namespace Tizen::Security;
-using namespace Tizen::App::Package;
+
static const int IDA_INSTALL_BTN = 101;
}
result
-DetailForm::GetInfoValue(int groupIndex, int itemIndex, String& name, String& description)
+DetailForm::GetDescriptionInfo(int groupIndex, int itemIndex, String& name, String& description)
{
String value;
PrivilegeInfo* pPrivilege = null;
TryReturn(groupIndex == 0, E_FAILURE, "Group Index Error");
pPrivilege = dynamic_cast <PrivilegeInfo*>(__pPrivilegeList->GetAt(itemIndex));
- if (pPrivilege != null)
- {
- name = pPrivilege->GetDisplayName();
- description = pPrivilege->GetDescription();
+ if (pPrivilege != null){
+ pPrivilege->GetDisplayName().IsEmpty() == false ? name = pPrivilege->GetDisplayName() : name = "";
+ pPrivilege->GetDescription().IsEmpty() == false ? description = pPrivilege->GetDescription() : description = "";
}
return E_SUCCESS;
TryReturn(packageId.IsEmpty() == false, E_FAILURE, "pakcageId is Empty!!!");
pLocalPackageInfo = pMgr->GetPackageInfoN(packageId);
+ //Todo: Get Main Menu Icon of Application ================================================
+ if (__pTargetPackageInfo->GetId().IsEmpty()){
+ AppLog("AppId Is Empty");
+ }
+ else{
+ AppLog("AppId : %ls", __pTargetPackageInfo->GetId().GetPointer());
+ AppLog("AppId : %ls", __pTargetPackageInfo->GetDisplayName().GetPointer());
+ AppLog("AppId : %ls", __pTargetPackageInfo->GetMainAppId().GetPointer());
+ PackageAppInfo* packageAppInfo = __pTargetPackageInfo->GetPackageAppInfoN(__pTargetPackageInfo->GetMainAppId());
+ if (packageAppInfo == null){
+ AppLog("package app info is empty");
+ }
+ else if (packageAppInfo->GetAppMenuIconN() == null){
+ AppLog("App Main Icon is empty");
+ }
+ else{
+ __pHeader->SetTitleIcon(packageAppInfo->GetAppMenuIconN());
+ }
+ }
+ // ===================================================================================
// is the package already installed on local
if (pMgr->IsPackageInstalled(packageId))
// In case of package update, previous running app has to be closed(killed)
AppManager* pAppManager = AppManager::GetInstance();
String pakcageId = __pTargetPackageInfo->GetId() + L"." + __pTargetPackageInfo->GetDisplayName();
- AppLog("target package id : %ls" ,pakcageId.GetPointer());
if (pAppManager->IsRunning(pakcageId)){
- AppLog("App is Running!!");
//TODO: is this check necessary?
pAppManager->TerminateApplication(pakcageId);
}
return pItem;
}
-
-
-
Tizen::Ui::Controls::TableViewItem*
DetailForm::CreateItem(int groupIndex, int itemIndex, int itemWidth)
{
Rectangle rect = GetClientAreaBounds();
// Get Title and Description
- GetInfoValue(groupIndex, itemIndex, name, description);
+ GetDescriptionInfo(groupIndex, itemIndex, name, description);
pItem->Construct(Tizen::Graphics::Dimension(rect.width, H_TABLE_VIEW_LIST_LINE), TABLE_VIEW_ANNEX_STYLE_NORMAL);
TryReturn(groupIndex == 0, null, "");
+
if (itemIndex < GetItemCount(groupIndex))
{
Label* pMainTextLable = null;
pSubTextBox->SetColor(TEXT_BOX_STATUS_HIGHLIGHTED, UI_COLOR_WHITE2);
pSubTextBox->SetColor(TEXT_BOX_STATUS_DISABLED, UI_COLOR_WHITE2);
ResizeSubText(pSubTextBox->GetLineCount(), pItem, pSubTextBox);
+
pItem->AddControl(*pMainTextLable);
pItem->AddControl(*pImageLable);
pItem->AddControl(*pSubTextBox);
+
+ return pItem;
+ }
+ else{
+ return null;
}
- return pItem;
}
bool
void
InstallEventListener::OnPackageInstallationInProgressResponseReceived(const PackageId& packageId, int progress)
{
+ IList* pArgs = null;
+ String data = Integer::ToString(progress);
+
+ pArgs = new (std::nothrow) ArrayList();
+ pArgs->Add(*(new (std::nothrow) String(data)));
+ UiApp::GetInstance()->GetFrame(APP_NAME)->GetCurrentForm()->SendUserEvent(INSTALL_PROGRESS_VALUE, pArgs);
}
using namespace Tizen::Base;
using namespace Tizen::App;
+using namespace Tizen::App::Package;
+using namespace Tizen::Base::Collection;
using namespace Tizen::Graphics;
using namespace Tizen::Ui;
using namespace Tizen::Ui::Controls;
using namespace Tizen::Ui::Scenes;
-using namespace Tizen::App::Package;
static const int ID_FOOTER_OPEN = 101;
static const int ID_BUTTON_CLOSE_POPUP = 103;
static const wchar_t* POPUP_MSESSAGE_SUCCESS = L"Installation success";
static const wchar_t* POPUP_MSESSAGE_FAIL = L"Installation fail";
-static const int TIME_COUNT = 40;
InstallForm::InstallForm(void)
{
}
// init variable
__timerCounter = 0;
__isInstalling = true;
- __isInstallSuccess = false;
// Timer
__pTimer = new (std::nothrow) Timer();
__pTimer->Construct(*this);
- __pTimer->StartAsRepeatable(500);
// progress test image
__pProgressEfImage = pAppResource->GetBitmapN(PROGRESS_EF_IMAGE);
AddControl(*__progressImageLabel);
- InstallApplication();
-
return true;
}
footerItem1.SetText(L"Open");
pFooter->AddItem(footerItem1);
-
pFooter->AddActionEventListener(*this);
}
if (packagePath.IsEmpty()){
AppLogException("No Tpk File Path");
- SetPopupValueAndOn(L"Installation Fail", L"No Tpk File Path");
- OnPopup();
+ SetPopupValue(L"Installation Fail", L"No Tpk File Path");
+ DisplayPopup();
return;
}
TryLog(res != E_PRIVILEGE_DENIED, "E_PRIVILEGE_DENIED");
}
else{
- AppLog("INSTALLTAION SUCCESS");
+ AppLog("INSTALLTAION CALL SUCCESS");
}
}
void
-InstallForm::SetPopupValueAndOn(String title, String content)
+InstallForm::SetPopupValue(String title, String content)
{
__pPopup->SetTitleText(title);
__pPopupTextBox->SetText(content);
}
void
-InstallForm::OnPopup()
+InstallForm::DisplayPopup()
{
__pPopup->SetShowState(true);
__pPopup->Show();
__pProgress = static_cast<Progress*>(GetControl(L"IDF_PROGRESS", true));
__pProgressLabel = static_cast<Label*>(GetControl(L"IDC_PROGRESS_LABEL", true));
+
// Install Confirmation Popup
SetPopupControl();
+ InstallApplication();
+
return r;
}
}
return;
}
+}
- if (__timerCounter >= TIME_COUNT)
+void
+InstallForm::OnUserEventReceivedN (RequestId requestId, Tizen::Base::Collection::IList *pArgs)
+{
+ if (requestId == INSTALL_SUCCESS_EVENT)
{
- if (__isInstallSuccess){
- __pProgressLabel->SetText(POPUP_MSESSAGE_SUCCESS);
- __pTimer->Cancel();
- __isInstalling = false;
- }
- else{
- __pProgressLabel->SetText(POPUP_MSESSAGE_FAIL);
- __pTimer->Cancel();
- __isInstalling = false;
- }
+ __isInstalling = false;
+ String *packageId = (String*)pArgs->GetAt(0);
+
+ PackageInfo* pLocalPackageInfo;
+ PackageManager* pMgr = PackageManager::GetInstance();
+ pLocalPackageInfo = pMgr->GetPackageInfoN(*packageId);
+
+ __packageOperationId = *packageId + L"." + pLocalPackageInfo->GetDisplayName();
+
+ AddFooterItem();
+ __pProgressLabel->SetText(POPUP_MSESSAGE_SUCCESS);
+
}
- else
+ else if (requestId == INSTALL_PROGRESS_VALUE)
{
- if (__timerCounter % 2 == 0){
- __progressImageLabel->SetBackgroundBitmap(*__pProgressImage);
- }
- else{
- __progressImageLabel->SetBackgroundBitmap(*__pProgressEfImage);
- }
+ String *str_progress_value = (String*)pArgs->GetAt(0);
+ TryReturnVoid(!(str_progress_value->IsEmpty()), "Progress Value Receiving Error" );
- }
- __pProgress->SetValue(__timerCounter);
- __pProgress->Invalidate(false);
- __pProgressLabel->Invalidate(false);
-}
+ int percentValue = 0;
+ TryReturnVoid(Integer::Parse(*str_progress_value, percentValue) == E_SUCCESS, "Progress Value Parsing Error");
-void
-InstallForm::OnUserEventReceivedN (RequestId requestId, Tizen::Base::Collection::IList *pArgs)
-{
- switch(requestId)
+ __pProgress->SetValue(percentValue);
+ }
+ else
{
- case INSTALL_SUCCESS_EVENT:
- {
- __isInstallSuccess = true;
- AppLog("Install Success Event is Received");
- __timerCounter = TIME_COUNT;
- String *packageId = (String*)pArgs->GetAt(0);
-// AppLog("packageId : %ls", packageId->GetPointer());
-
- PackageInfo* pLocalPackageInfo;
- PackageManager* pMgr = PackageManager::GetInstance();
- pLocalPackageInfo = pMgr->GetPackageInfoN(*packageId);
-
- __packageOperationId = *packageId + L"." + pLocalPackageInfo->GetDisplayName();
-// AppLog("packageName : %ls", __packageOperationId.GetPointer());
- AddFooterItem();
+ __isInstalling = false;
+ if (requestId == INSTALL_FAIL_INVALID_PACKAGE){
+ SetPopupValue(POPUP_MSESSAGE_FAIL, L"Invalid Package Install Error");
}
- break;
- case INSTALL_FAIL_INVALID_PACKAGE:
- {
- SetPopupValueAndOn(L"Installation Fail", L"Invalid Package Install Error");
- OnPopup();
- }
- break;
- case INSTALL_FAIL_STORAGE_FULL:
- {
- SetPopupValueAndOn(L"Installation Fail", L"Storage Full Install Error");
- OnPopup();
+ else if (requestId == INSTALL_FAIL_STORAGE_FULL){
+ SetPopupValue(POPUP_MSESSAGE_FAIL, L"Storage Full Install Error");
}
- break;
- default:
- {
- AppLogException("error event request ID sended by EndpointThread");
+ else {
+ AppLogException("error event request ID sent by EndpointThread");
+ SetPopupValue(POPUP_MSESSAGE_FAIL, L"Return Value is Error");
}
- break;
+ DisplayPopup();
}
+ Invalidate(true);
}
{
AppManager* pAppManager = AppManager::GetInstance();
- // init timer
- __timerCounter = 0;
-
pAppManager->LaunchApplication(__packageOperationId);
+ // set timer for smooth view change
__pTimer->StartAsRepeatable(500);
}
break;