Fixed jira issues
authorajay.nayak <ajay.nayak@samsung.com>
Fri, 7 Jun 2013 14:41:32 +0000 (20:11 +0530)
committerajay.nayak <ajay.nayak@samsung.com>
Fri, 7 Jun 2013 14:41:32 +0000 (20:11 +0530)
Change-Id: Ida1dff9167e851d1cd6ffd6f11feaae8a1351723
Signed-off-by: ajay.nayak <ajay.nayak@samsung.com>
inc/MpMusicPlayerApp.h
inc/MpTypes.h
src/MpMusicPlayerApp.cpp
src/MpMusicPlayerForm.cpp
src/MpMusicPlayerPresentationModel.cpp
src/MpPlaylistDB.cpp
src/MpSearchForm.cpp

index 2033101..bc8735c 100644 (file)
@@ -58,6 +58,8 @@ public:
        void OnScreenOff(void);
 
        Tizen::Base::String GetOperationId(void);
+       RequestId GetRequestId(void);
+       void ResetRequestId(void);
 
        virtual void OnAppControlRequestReceived(RequestId reqId, const Tizen::Base::String& operationId, const Tizen::Base::String* pUriData,
                                                                                                        const Tizen::Base::String* pMimeType, const Tizen::Base::Collection::IMap* pExtraData);
index 0896291..cef3f25 100644 (file)
@@ -309,6 +309,7 @@ static const int SUB_TEXT_SIZE = 32;
 static const int SEARCH_PAGE_NO = 1;
 static const int SEARCH_COUNT_PER_PAGE = 30000;
 static const int ITEM_HEIGHT = 140;
+static const int SEARCH_ITEM_DIVIDER_HEIGHT = 2;
 static const int GROUP_ITEM_HEIGHT = 144;
 static const int STRING_LENGTH = 90;
 static const int H_NOW_PLAY_BAR = 120;
index 22fafcd..2105941 100644 (file)
@@ -297,7 +297,7 @@ MusicPlayerApp::OnAppControlRequestReceived(RequestId reqId, const Tizen::Base::
                {
        
                        Scene* pScene = pSceneManager->GetCurrentScene();
-                       PlayerForm* pPlayerForm = dynamic_cast<PlayerForm*>(pScene->GetForm());
+                       PlayerForm* pPlayerForm = static_cast<PlayerForm*>(pScene->GetForm());
                        if (currentSceneId.Equals(IDSCN_PLAYER, false))
                        {       
                                pPlayerForm->OnChangedContentListByAppControlN(__pDataList);
@@ -418,6 +418,18 @@ MusicPlayerApp::GetOperationId(void)
        return __operationId;
 }
 
+RequestId
+MusicPlayerApp::GetRequestId(void)
+{
+       return __requestId;
+}
+
+void
+MusicPlayerApp::ResetRequestId(void)
+{
+       __requestId = null;
+}
+
 void
 MusicPlayerApp::OnContentFileCreated(Tizen::Content::ContentId contentId, Tizen::Content::ContentType contentType, result r)
 {
index 28f3caa..610a403 100644 (file)
@@ -505,7 +505,7 @@ PlayerForm::OnActionPerformed(const Tizen::Ui::Control& source, int actionId)
        
                        TableView* pContentsTableView = static_cast<TableView*>(__pContentsListViewPanel->GetControl(IDC_CONTENTS_TABLEVIEW));
                        pContentsTableView->UpdateTableView();
-                       }
+               }
                break;
 
        case IDA_PLAYER_CONTROLLER_VOLUME:
@@ -929,6 +929,7 @@ PlayerForm::OnTouchCanceled(const Tizen::Ui::Control& source, const Tizen::Graph
                if (__isLongPressed == true)
                {
                        __pPlayerPresentationModel->StopForwardRewind();
+                       __isLongPressed = false;
                }
        }
 
@@ -1404,6 +1405,7 @@ PlayerForm::OnPlayStateChanged(PlayerState playerState)
 
        if (playerState == PLAYER_STATE_ERROR)
        {
+               MusicPlayerApp* pApp = static_cast<MusicPlayerApp*>(App::GetInstance());
                RemoveContextMenu();
                SetContentInfo( __pPlayerPresentationModel->GetCurrentContentIndex());
 
@@ -1416,9 +1418,15 @@ PlayerForm::OnPlayStateChanged(PlayerState playerState)
                        SetPlayerScreenState(PLAYER_SCREEN_STATE_ERROR_CONTENT);
                }
                ShowMessageBox(ResourceManager::GetString(L"IDS_MUSIC_POP_UNABLE_TO_PLAY_ERROR_OCCURRED"));
+
+               if (pApp != null && pApp->GetRequestId() != null)
+               {
+                       AppControlProviderManager::GetInstance()->SendAppControlResult(pApp->GetRequestId(),APP_CTRL_RESULT_SUCCEEDED,null);
+                       pApp->ResetRequestId();
+               }
        }
 
-       if (playerState == PLAYER_STATE_PAUSED)
+       else if (playerState == PLAYER_STATE_PAUSED)
        {
                if (__pPlayerPresentationModel->IsDuringCall() == true)
                {
@@ -1439,10 +1447,17 @@ PlayerForm::OnPlayContentChanged(int currentContentIndex)
        {
                SetPlayerScreenState(PLAYER_SCREEN_STATE_DURING_CALL);
        }
-       else
+       else if (__playerScreenState == PLAYER_SCREEN_STATE_DURING_CALL || __playerScreenState == PLAYER_SCREEN_STATE_ERROR_CONTENT)
        {
-               SetPlayerScreenState(PLAYER_SCREEN_STATE_NORMAL);
-
+               if (__isAppControlDuringCall)
+               {
+                       SetPlayerScreenState(PLAYER_SCREEN_STATE_APP_CONTROL);
+                       __isAppControlDuringCall = false;
+               }
+               else
+               {
+                       SetPlayerScreenState(PLAYER_SCREEN_STATE_NORMAL);
+               }
        }
        AppLogDebug("EXIT");
 }
@@ -1763,7 +1778,8 @@ PlayerForm::SetFileNotExistState(bool isFileExist)
        AppLogDebug("ENTER");
        RemoveContextMenu();
 
-       if(GetPlayerScreenState() != PLAYER_SCREEN_STATE_DURING_CALL)
+       if(GetPlayerScreenState() != PLAYER_SCREEN_STATE_DURING_CALL &&
+                       GetPlayerScreenState() != PLAYER_SCREEN_STATE_ERROR_CONTENT)
        {
                __pMoreContextButton->SetEnabled(isFileExist);
                __pMoreContextButton->Invalidate(true);
@@ -2138,7 +2154,7 @@ PlayerForm::UpdateItem(int itemIndex, Tizen::Ui::Controls::TableViewItem* pItem)
 void
 PlayerForm::SetPlayerScreenState(unsigned int playerScreenState)
 {
-       AppLogDebug("ENTER");
+       AppLogDebug("ENTER %d",playerScreenState);
 
        if (__playerScreenState == playerScreenState||
          (playerScreenState != PLAYER_SCREEN_STATE_NORMAL &&
@@ -2191,7 +2207,7 @@ PlayerForm::SetPlayerScreenState(unsigned int playerScreenState)
                        __pShuffleButton->SetShowState(false);
                        __pRepeatButton->SetShowState(false);
                        __prevRepeatStateRunByAppControl = __pPlayerPresentationModel->GetRepeatState();
-                       SetRepeatButtonImage(IDA_TYPE_REPEAT_A);
+//                     SetRepeatButtonImage(IDA_TYPE_REPEAT_A);
 
                        if (__pContentsListViewPanel->GetShowState() == true)
                        {
@@ -2244,9 +2260,9 @@ PlayerForm::SetPlayerScreenState(unsigned int playerScreenState)
 
        case PLAYER_SCREEN_STATE_ERROR_CONTENT:
                {
-                       if(__pPlayerPresentationModel->IsDuringCall())
+                       if (__pPlayerPresentationModel->IsDuringCall())
                        {
-                               if(__isRunByAppControl)
+                               if (__isRunByAppControl)
                                {
                                        SetPlayerScreenState(PLAYER_SCREEN_STATE_APP_CONTROL);
                                }
index c47d6e1..7fb1480 100644 (file)
@@ -987,7 +987,8 @@ PlayerPresentationModel::Pause(void)
        if (playerState == PLAYER_STATE_PLAYING)
        {
                r = __pPlayer->Pause();
-               TryCatch(r == E_SUCCESS, , "__pPlayer pause failed..\n");
+               TryCatch(r == E_SUCCESS, , "__pPlayer pause failed..%s\n",GetErrorMessage(r));
+
                if (__pPlayStateTimer != null)
                {
                        r = __pPlayStateTimer->Cancel();
@@ -1158,8 +1159,11 @@ PlayerPresentationModel::SeekToForward(void)
 {
        AppLogDebug("ENTER");
        int playDuration = __pPlayer->GetDuration();
-       __playposition = static_cast<int>(__pPlayer->GetPosition() / (playDuration / TIMER_INTERVAL));
-       Forward();
+       if(playDuration != 0)
+       {
+               __playposition = static_cast<int>(__pPlayer->GetPosition() / (playDuration / TIMER_INTERVAL));
+               Forward();
+       }
        AppLogDebug("EXIT");
 }
 
@@ -1171,6 +1175,7 @@ PlayerPresentationModel::Forward(void)
        result r = SetPlayPosition(__playposition);
        if (IsFailed(r))
        {
+               AppLogDebug("SetPlayPosition Failed %s",GetErrorMessage(r));
                StopForwardRewind();
                return;
        }
@@ -1200,16 +1205,19 @@ PlayerPresentationModel::StopForwardRewind(void)
 {
        AppLogDebug("ENTER");
        result r = E_SUCCESS;
+
        if (__pFastForwardTimer != null)
        {
                r = __pFastForwardTimer->Cancel();
                TryLog(r == E_SUCCESS, "[%s] __pFastForwardTimer cancel failed", GetErrorMessage(r));
        }
+
        if (__pFastRewindTimer != null)
        {
                r = __pFastRewindTimer->Cancel();
                TryLog(r == E_SUCCESS, "[%s] __pFastRewindTimer cancel failed", GetErrorMessage(r));
        }
+
        __xTimesValue = INIT_X_VALUE;
        __seekCompleted = true;
        AppLogDebug("EXIT");
@@ -1827,7 +1835,7 @@ PlayerPresentationModel::OnPlayerInterrupted(void)
 void
 PlayerPresentationModel::OnPlayerSeekCompleted(result r)
 {
-       AppLogDebug("ENTER");
+       AppLogDebug("ENTER %s",GetErrorMessage(r));
        if (r == E_SUCCESS)
        {
                __seekCompleted = true;
index aff5b8d..a6d7cd1 100644 (file)
@@ -46,7 +46,7 @@ PlaylistDB::CreatePlaylistDatabase(void)
 {
        AppLogDebug("ENTER");
        Tizen::Base::String dbName(App::GetInstance()->GetAppRootPath() + DATABASE_PATH);
-       Tizen::Base::String sql = null;
+       Tizen::Base::String sql;
 
        result r = E_SUCCESS;
 
@@ -59,7 +59,8 @@ PlaylistDB::CreatePlaylistDatabase(void)
        r = pDatabase->Construct(dbName, true);
        TryCatch(r == E_SUCCESS, r = E_FAILURE, "Database can not construct.[%s]", GetErrorMessage(r));
        sql.Append(L"CREATE TABLE IF NOT EXISTS playlisttable ( primaryKey INTEGER PRIMARY KEY AUTOINCREMENT, contentId TEXT, playCount INTEGER, playTime TEXT )");
-
+       r = pDatabase->BeginTransaction();
+       TryCatch(r == E_SUCCESS, r = E_FAILURE, "BeginTransaction failed.[%s]", GetErrorMessage(r));
        r = pDatabase->ExecuteSql(sql, true);
        TryCatch(r == E_SUCCESS, r = E_FAILURE, "ExecuteSql failed.[%s]", GetErrorMessage(r));
        r = pDatabase->CommitTransaction();
@@ -287,11 +288,14 @@ PlaylistDB::SearchN(int index)
 
        result r = E_SUCCESS;
 
-       Tizen::Base::String statement = null;
+       Tizen::Base::String statement;
        DbEnumerator* pEnum = null;
 
        Tizen::Io::Database* pDatabase = new (std::nothrow) Database();
        r = pDatabase->Construct(dbName, false);
+
+       TryReturn(r == E_SUCCESS,null,"pDatabase->Construct failed with error %s",GetErrorMessage(r));
+
        if (index == MOST_PLAYED_CONTENT)
        {
                statement.Append(L"SELECT contentId FROM playlisttable WHERE playCount > 0 ORDER BY playCount DESC");
index 8e7a497..4014777 100644 (file)
@@ -78,7 +78,7 @@ SearchForm::OnInitializing(void)
 
        __pSearchTableView = new (std::nothrow) TableView();
        __pSearchTableView->Construct(Rectangle(0, 0, GetClientAreaBounds().width, GetClientAreaBounds().height - __pSearchBar->GetHeight()),
-                                       true,
+                                       false,
                                        TABLE_VIEW_SCROLL_BAR_STYLE_FADE_OUT);
 
        __pSearchTableView->SetItemProvider(this);
@@ -168,7 +168,8 @@ SearchForm::OnKeypadActionPerformed(Tizen::Ui::Control& source,
        if (keypadAction == KEYPAD_ACTION_SEARCH)
        {
                __pSearchBar->HideKeypad();
-               if (__pSearchBar->GetText().GetLength() != INIT_VALUE)
+
+               if (__pSearchBar->GetTextLength() != INIT_VALUE)
                {
                        __pPresentationModel->InitializeContentList(__pSearchBar->GetText());
                }
@@ -193,6 +194,11 @@ SearchForm::OnKeypadClosed(Tizen::Ui::Control& source)
        GetFooter()->SetShowState(true);
        Rectangle clientBounds = GetClientAreaBounds();
        __pSearchTableView->SetBounds(Rectangle(0, 0, clientBounds.width, clientBounds.height - __pSearchBar->GetHeight()));
+
+       if (__pNoContentTextLabel != null && __pNoContentTextLabel->GetShowState())
+       {
+               __pNoContentTextLabel->SetBounds(X_GAP,(clientBounds.height - H_NO_CONTENT)/2,GetWidth() - (X_GAP * 2),H_NO_CONTENT);
+       }
        AppLogDebug("EXIT");
 }
 
@@ -202,6 +208,12 @@ SearchForm::OnKeypadOpened(Tizen::Ui::Control& source)
        AppLogDebug("ENTER");
        Rectangle clientBounds = GetClientAreaBounds();
        __pSearchTableView->SetBounds(Rectangle(0, 0, clientBounds.width, clientBounds.height - __pSearchBar->GetHeight()));
+
+       if (__pNoContentTextLabel != null && __pNoContentTextLabel->GetShowState())
+       {
+               //Rectangle(X_GAP, Y_GAP_NO_CONTENT, GetWidth() - (X_GAP * 2), H_NO_CONTENT)
+               __pNoContentTextLabel->SetBounds(Rectangle(X_GAP,(clientBounds.height - H_NO_CONTENT)/2,GetWidth() - (X_GAP * 2),H_NO_CONTENT));
+       }
        AppLogDebug("EXIT");
 }
 
@@ -218,6 +230,12 @@ SearchForm::OnKeypadBoundsChanged(Tizen::Ui::Control& source)
 {
        Rectangle clientBounds = GetClientAreaBounds();
        __pSearchTableView->SetBounds(Rectangle(0, 0, clientBounds.width, clientBounds.height - __pSearchBar->GetHeight()));
+
+       if (__pNoContentTextLabel != null && __pNoContentTextLabel->GetShowState())
+       {
+               //Rectangle(X_GAP, Y_GAP_NO_CONTENT, GetWidth() - (X_GAP * 2), H_NO_CONTENT)
+               __pNoContentTextLabel->SetBounds(Rectangle(X_GAP,(clientBounds.height - H_NO_CONTENT)/2,GetWidth() - (X_GAP * 2),H_NO_CONTENT));
+       }
 }
 
 int
@@ -247,6 +265,8 @@ Tizen::Ui::Controls::TableViewItem*
 SearchForm::CreateItem(const int itemIndex, int itemWidth)
 {
        AppLogDebug("ENTER");
+       Label* pDividerLabel;
+       bool addDivider = true;
        RelativeLayout layout;
        layout.Construct();
 
@@ -300,6 +320,11 @@ SearchForm::CreateItem(const int itemIndex, int itemWidth)
                pArtistNameLabel->SetTextConfig(MAIN_TEXT_SIZE, LABEL_TEXT_STYLE_NORMAL);
                pArtistNameLabel->SetTextHorizontalAlignment(ALIGNMENT_LEFT);
                pItem->AddControl(pArtistNameLabel);
+
+               if (itemIndex == __pPresentationModel->GetAlbumIndex()-1)
+               {
+                       addDivider = false;
+               }
        }
        else if (itemIndex < __pPresentationModel->GetSongIndex())
        {
@@ -317,6 +342,11 @@ SearchForm::CreateItem(const int itemIndex, int itemWidth)
 
                pItem->AddControl(pAlbumNameLabel);
                pItem->AddControl(pArtistNameLabel);
+
+               if (itemIndex == __pPresentationModel->GetSongIndex()-1)
+               {
+                       addDivider = false;
+               }
        }
        else
        {
@@ -327,9 +357,22 @@ SearchForm::CreateItem(const int itemIndex, int itemWidth)
                pSongNameLabel->SetTextHorizontalAlignment(ALIGNMENT_LEFT);
 
                pItem->AddControl(pSongNameLabel);
+
+               if (itemIndex == __pPresentationModel->GetTotalContentCount()-1)
+               {
+                       addDivider = false;
+               }
        }
        delete pContentInfo;
 
+       if (addDivider)
+       {
+               pDividerLabel = new (std::nothrow) Label();
+               pDividerLabel->Construct(FloatRectangle(0, ITEM_HEIGHT-SEARCH_ITEM_DIVIDER_HEIGHT, W_CLIENT_AREA,SEARCH_ITEM_DIVIDER_HEIGHT ), L"");
+               pDividerLabel->SetBackgroundColor(__pSearchTableView->GetItemDividerColor());
+               pItem->AddControl(pDividerLabel);
+       }
+
        AppLogDebug("EXIT");
        return pItem;