Fixed jira issues:N_SE-46569,N_SE-46541, N_SE-46483 etc
[apps/osp/MusicPlayer.git] / src / MpMusicPlayerForm.cpp
1 //
2 // Copyright (c) 2012 Samsung Electronics Co., Ltd.
3 //
4 // Licensed under the Flora License, Version 1.1 (the License);
5 // you may not use this file except in compliance with the License.
6 // You may obtain a copy of the License at
7 //
8 //     http://floralicense.org/license/
9 //
10 // Unless required by applicable law or agreed to in writing, software
11 // distributed under the License is distributed on an AS IS BASIS,
12 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 // See the License for the specific language governing permissions and
14 // limitations under the License.
15 //
16
17 /**
18  * @file                MpMusicPlayerForm.h
19  * @brief               This is the implementation file for MusicPlayerForm class.
20  */
21
22 #include <FApp.h>
23 #include <FBase.h>
24 #include <FIo.h>
25 #include <FMedia.h>
26 #include <FUi.h>
27 #include <FUiScenes.h>
28 #include "MpAllListPresentationModel.h"
29 #include "MpCommonUtil.h"
30 #include "MpMusicPlayerApp.h"
31 #include "MpMusicPlayerForm.h"
32 #include "MpMusicPlayerPresentationModel.h"
33 #include "MpPlaylistPickerPopup.h"
34 #include "MpResourceManager.h"
35 #include "MpSceneRegister.h"
36 #include "MpSetAsPopup.h"
37 #include "MpSettingPresentationModel.h"
38 #include "MpSharePopup.h"
39 #include "MpSoundPathPopup.h"
40 #include "MpThumbnailInfo.h"
41
42 using namespace Tizen::App;
43 using namespace Tizen::Base;
44 using namespace Tizen::Base::Collection;
45 using namespace Tizen::Graphics;
46 using namespace Tizen::Io;
47 using namespace Tizen::Media;
48 using namespace Tizen::System;
49 using namespace Tizen::Ui;
50 using namespace Tizen::Ui::Animations;
51 using namespace Tizen::Ui::Controls;
52 using namespace Tizen::Ui::Scenes;
53
54 static const int H_CONTROLLER_PANEL = 288;
55 static const int W_HORIZONTAL_PLAYER = 720;
56 static const int H_HORIZONTAL_CONTROLLER_PANEL = 300;
57 static const int H_VOLUME_PANEL = 112;
58
59 static const int TRANSPARENT_COLOR = 0x00000000;
60
61 static const int MIN_VOLUME_SLIDER_COUNT = 0;
62 static const int MAX_VOLUME_SLIDER_COUNT = 15;
63
64 static const int IDA_BUTTON_CONTENTS_LIST_VIEW = 200;
65 static const int IDA_BUTTON_CONTENTS_ALBUM_VIEW = 201;
66
67 static const Tizen::Base::String INVALID_VALUE_OF_CONTENT_ID = L"00000000-0000-0000-0000-000000000000";
68
69 static const wchar_t* IDB_PLAY_BUTTON_ICON_NORMAL = L"T02_control_circle_icon_play.png";
70 static const wchar_t* IDB_PLAY_BUTTON_ICON_PRESSED = L"T02_control_circle_icon_play_press.png";
71 static const wchar_t* IDB_PLAY_BUTTON_ICON_DISABLED = L"T02_control_circle_icon_play_dim.png";
72 static const wchar_t* IDB_PAUSE_BUTTON_ICON_NORMAL = L"T02_control_circle_icon_pause.png";
73 static const wchar_t* IDB_PAUSE_BUTTON_ICON_PRESSED = L"T02_control_circle_icon_pause_press.png";
74 static const wchar_t* IDB_PAUSE_BUTTON_ICON_DISABLED = L"T02_control_circle_icon_pause_dim.png";
75
76 FloatRectangle rectanglePreviousElement;
77 FloatRectangle rectangleCurrentElement;
78 FloatRectangle rectangleNextElement;
79
80 enum RepeatType
81 {
82         IDA_TYPE_REPEAT_A = 0,          /**< The repeat type is OFF */
83         IDA_TYPE_REPEAT_ONE,            /**< The repeat type is ONE */
84         IDA_TYPE_REPEAT_ALL             /**< The repeat type is ALL */
85 };
86
87 enum PlayerScreenState
88 {
89         PLAYER_SCREEN_STATE_BASE = 0,
90         PLAYER_SCREEN_STATE_NORMAL = PLAYER_SCREEN_STATE_BASE,
91         PLAYER_SCREEN_STATE_NO_CONTENT_LIST,
92         PLAYER_SCREEN_STATE_APP_CONTROL,
93         PLAYER_SCREEN_STATE_INVALID_CONTENT_ID,
94         PLAYER_SCREEN_STATE_ERROR_CONTENT,
95         PLAYER_SCREEN_STATE_DURING_CALL,
96         PLAYER_SCREEN_STATE_MAX
97 };
98
99 enum IDAPlayerController
100 {
101         IDA_PLAYER_CONTROLLER_BASE = 100,
102         IDA_PLAYER_CONTROLLER_REWIND = IDA_PLAYER_CONTROLLER_BASE,
103         IDA_PLAYER_CONTROLLER_PLAY,
104         IDA_PLAYER_CONTROLLER_PAUSE,
105         IDA_PLAYER_CONTROLLER_FORWARD,
106         IDA_PLAYER_CONTROLLER_VOLUME,
107         IDA_PLAYER_CONTROLLER_REPEAT,
108         IDA_PLAYER_CONTROLLER_SHUFFLE,
109         IDA_PLAYER_CONTROLLER_BACK,
110         IDA_PLAYER_CONTROLLER_MORE,
111         IDA_PLAYER_CONTROLLER_MAX
112 };
113
114 PlayerForm::PlayerForm(void)
115         : __pPlayerPresentationModel(null)
116         , __pAlbumArtElements(null)
117         , __pVolumePanel(null)
118         , __pControllerPanel(null)
119         , __pPanelRegisterBar(null)
120         , __pContentsAlbumViewPanel(null)
121         , __pContentsListViewPanel(null)
122         , __pCurrentTimeLabel(null)
123         , __pTotalTimeLabel(null)
124         , __pTitleName(null)
125         , __pArtistName(null)
126         , __pRewindButton(null)
127         , __pForwardButton(null)
128         , __pVolumeButton(null)
129         , __pPlayPauseButton(null)
130         , __pRepeatButton(null)
131         , __pShuffleButton(null)
132         , __pContentsViewToggleButton(null)
133         , __pPlayStateSlider(null)
134         , __pVolumeSlider(null)
135         , __pThumbnail(null)
136         , __pPlayListPicker(null)
137         , __pSharePicker(null)
138         , __pSetAsPicker(null)
139         , __pSoundPathPopup(null)
140         , __isLongPressed(false)
141         , __flickDirection(FLICK_DIRECTION_NONE)
142         , __transactionID(ANIMATION_TRANSACTION_STATUS_STOPPED)
143         , __playerScreenState(PLAYER_SCREEN_STATE_NORMAL)
144         , __playerScreenStateBeforeCall(PLAYER_SCREEN_STATE_NORMAL)
145         , __isAnimationPerformed(false)
146         , __isRunByAppControl(false)
147         , __isContentMoveCompleted(false)
148         , __prevRepeatStateRunByAppControl(0)
149         , __playPosition(-1)
150         , __pAnimationFinishedTimer(null)
151         , __pContentPlayTimer(null)
152         , __pMsgShowTimer(null)
153         , __pSeekTimer(null)
154         , __pPreviousSceneId(null)
155         , __pPath(null)
156         , __pOptionMenu(null)
157         , __itemHeight(ITEM_HEIGHT_MAIN_TEXT_NORMAL)
158 {
159         AppLogDebug("ENTER");
160         AppLogDebug("EXIT");
161 }
162
163 PlayerForm::~PlayerForm(void)
164 {
165         AppLogDebug("ENTER");
166         AppLogDebug("EXIT");
167 }
168
169 result
170 PlayerForm::Initialize(void)
171 {
172         AppLogDebug("ENTER");
173         if (IsFailed(Form::Construct(IDL_MUSIC_PLAYER_FORM)))
174         {
175                 AppLogDebug("Form::Construct(IDL_MUSIC_PLAYER_FORM) failed(%s)", GetErrorMessage(GetLastResult()));
176                 return E_FAILURE;
177         }
178         AppLogDebug("EXIT");
179         return E_SUCCESS;
180 }
181
182 result
183 PlayerForm::OnInitializing(void)
184 {
185         AppLogDebug("ENTER");
186
187         __fontSizeValue = CommonUtil::GetFontSizeValue();
188         __itemHeight = CommonUtil::GetItemHeight(__fontSizeValue);
189
190         __pControllerPanel = static_cast<Panel*>(GetControl(IDC_PLAYER_CONTROL_BAR));
191         __pTitleName = static_cast<Label*>(GetControl(IDC_CONTENTS_TITLE_NAME));
192         __pArtistName = static_cast<Label*>(GetControl(IDC_CONTENTS_ARTIST_NAME));
193
194         __pContentsViewToggleButton = static_cast<Button*>(GetControl(IDC_CONTENTS_VIEW_TOGGLE_BUTTON));
195         __pContentsViewToggleButton->SetActionId(IDA_BUTTON_CONTENTS_LIST_VIEW);
196         Bitmap* pButtonBackgroundBitmap = ResourceManager::GetBitmapN(L"blank_normal_background.png");
197
198         if (pButtonBackgroundBitmap != null)
199         {
200                 //blank_normal_background.png
201                 Canvas* pCanvas = new (std::nothrow) Canvas();
202                 pCanvas->Construct(__pContentsViewToggleButton->GetBoundsF());
203                 pCanvas->DrawNinePatchedBitmap(pCanvas->GetBoundsF(),*pButtonBackgroundBitmap);
204
205                 Bitmap* pFinalBackBitmap = new Bitmap();
206                 pFinalBackBitmap->Construct(*pCanvas,pCanvas->GetBoundsF());
207                 __pContentsViewToggleButton->SetNormalBackgroundBitmap(*pFinalBackBitmap);
208                 __pContentsViewToggleButton->SetPressedBackgroundBitmap(*pFinalBackBitmap);
209                 __pContentsViewToggleButton->SetDisabledBackgroundBitmap(*pFinalBackBitmap);
210
211                 delete pFinalBackBitmap;
212                 delete pCanvas;
213                 delete pButtonBackgroundBitmap;
214         }
215
216         __pContentsViewToggleButton->AddActionEventListener(*this);
217
218         __pVolumeButton = static_cast<Button*>(__pControllerPanel->GetControl(L"IDC_OPTION_VOLUMN"));
219         __pVolumeButton->SetActionId(IDA_PLAYER_CONTROLLER_VOLUME);
220         __pVolumeButton->AddActionEventListener(*this);
221         __pShuffleButton = static_cast<Button*>(__pControllerPanel->GetControl(IDC_OPTION_SHUFFLE));
222         __pShuffleButton->SetActionId(IDA_PLAYER_CONTROLLER_SHUFFLE);
223         __pShuffleButton->AddActionEventListener(*this);
224         __pRepeatButton = static_cast<Button*>(__pControllerPanel->GetControl(IDC_OPTION_REPEAT));
225         __pRepeatButton->SetActionId(IDA_PLAYER_CONTROLLER_REPEAT);
226         __pRepeatButton->AddActionEventListener(*this);
227
228         Button* pButton = static_cast<Button*>(__pControllerPanel->GetControl(IDC_OPTION_PLAY_LIST_ADD));
229         pButton->SetShowState(false);
230
231         __pRewindButton = static_cast<Button*>(__pControllerPanel->GetControl(IDC_PREVIOUS_CONTROL_BUTTON));
232         __pRewindButton->SetActionId(IDA_PLAYER_CONTROLLER_REWIND);
233         __pRewindButton->AddTouchEventListener(*this);
234         __pRewindButton->AddKeyEventListener(*this);
235
236         __pPlayPauseButton = static_cast<Button*>(__pControllerPanel->GetControl(IDC_PALY_TOGGLE_CONTROL_BUTTON));
237         __pPlayPauseButton->SetActionId(IDA_PLAYER_CONTROLLER_PLAY);
238         __pPlayPauseButton->AddActionEventListener(*this);
239
240         __pForwardButton = static_cast<Button*>(__pControllerPanel->GetControl(IDC_NEXT_CONTROL_BUTTON));
241         __pForwardButton->SetActionId(IDA_PLAYER_CONTROLLER_FORWARD);
242         __pForwardButton->AddTouchEventListener(*this);
243         __pForwardButton->AddKeyEventListener(*this);
244
245         __pCurrentTimeLabel = static_cast<Label*>(__pControllerPanel->GetControl(IDC_CURRENT_PLAYING_TIME));
246         __pTotalTimeLabel = static_cast<Label*>(__pControllerPanel->GetControl(IDC_CONTENT_TOTAL_TIME));
247         __pPlayStateSlider = static_cast<Slider*>(__pControllerPanel->GetControl(IDC_SLIDER_BAR));
248         __pPlayStateSlider->AddSliderEventListener(*this);
249
250         __pPlayStateSlider->SetThumbTextColor(SLIDER_THUMB_STATUS_NORMAL, Color(255, 255, 255, 0));
251         __pPlayStateSlider->SetThumbTextColor(SLIDER_THUMB_STATUS_PRESSED, Color(255, 255, 255, 0));
252         __pPlayStateSlider->SetThumbTextColor(SLIDER_THUMB_STATUS_DISABLED, Color(255, 255, 255, 0));
253
254         SetFormMenuEventListener(this);
255         SetFormBackEventListener(this);
256
257         __pAnimationFinishedTimer = new (std::nothrow) Tizen::Base::Runtime::Timer();
258         __pAnimationFinishedTimer->Construct(*this);
259         __pContentPlayTimer = new (std::nothrow) Tizen::Base::Runtime::Timer();
260         __pContentPlayTimer->Construct(*this);
261         __pMsgShowTimer= new (std::nothrow) Tizen::Base::Runtime::Timer();
262         __pMsgShowTimer->Construct(*this);
263         __pSeekTimer = new (std::nothrow) Tizen::Base::Runtime::Timer();
264         __pSeekTimer->Construct(*this);
265         __pPlayerPresentationModel = PlayerPresentationModel::GetInstance();
266
267         __pContentsListViewPanel = new (std::nothrow) Panel();
268         if (IsFailed(__pContentsListViewPanel->Construct(IDL_MUSIC_PLAYER_CONTENTS_LIST_VIEW_PANEL)))
269         {
270                 AppLogDebug("Construct(IDL_MUSIC_PLAYER_CONTENTS_LIST_VIEW_PANEL) failed(%s)", GetErrorMessage(GetLastResult()));
271                 delete __pContentsListViewPanel;
272                 return E_FAILURE;
273         }
274
275         __pPanelRegisterBar = static_cast<Panel*>(GetControl(IDC_PANEL_REGISTER_BAR));
276         __pPanelRegisterBar->AddControl(__pContentsListViewPanel);
277         __pContentsListViewPanel->SetShowState(false);
278         __pContentsListViewPanel->SetEnabled(false);
279
280         CommonUtil::SetLayoutFitToContainer(*__pPanelRegisterBar, *__pContentsListViewPanel);
281         TableView* pContentsTableView = static_cast<TableView*>(__pContentsListViewPanel->GetControl(IDC_CONTENTS_TABLEVIEW));
282         pContentsTableView->AddTableViewItemEventListener(*this);
283         pContentsTableView->SetItemProvider(this);
284
285         __pContentsAlbumViewPanel = new (std::nothrow) Panel();
286         if (IsFailed(__pContentsAlbumViewPanel->Construct(IDL_MUSIC_PLAYER_CONTENTS_ALBUM_VIEW_PANEL)))
287         {
288                 AppLogDebug("Construct(IDL_MUSIC_PLAYER_CONTENTS_ALBUM_VIEW_PANEL) failed(%s)", GetErrorMessage(GetLastResult()));
289                 delete __pContentsAlbumViewPanel;
290                 return E_FAILURE;
291         }
292         __pPanelRegisterBar->AddControl(__pContentsAlbumViewPanel);
293         CommonUtil::SetLayoutFitToContainer(*__pPanelRegisterBar, *__pContentsAlbumViewPanel);
294
295         Label* pAlbumThumbnailLabel = static_cast<Label*>(__pContentsAlbumViewPanel->GetControl(IDC_CONTENTS_THUMBNAIL));
296         __pContentsAlbumViewPanel->SetControlAlwaysOnTop(*pAlbumThumbnailLabel, true);
297         pAlbumThumbnailLabel->AddTouchEventListener(*this);
298
299         FloatDimension floatDimension = pAlbumThumbnailLabel->GetSizeF();
300         __pAlbumArtElements = new (std::nothrow) VisualElement();
301         __pAlbumArtElements->Construct();
302         __pAlbumArtElements->SetName(L"VisualElement");
303         __pAlbumArtElements->SetBounds(FloatRectangle(0.0f, 0.0f, floatDimension.width, floatDimension.height));
304         __pAlbumArtElements->SetClipChildrenEnabled(false);
305         __pAlbumArtElements->SetShowState(true);
306         pAlbumThumbnailLabel->GetVisualElement()->AttachChild(*__pAlbumArtElements);
307
308         __pAlbumArtElement[ALBUM_ART_IMAGE_CURRENT] = new (std::nothrow) VisualElement();
309         __pAlbumArtElement[ALBUM_ART_IMAGE_CURRENT]->Construct();
310         __pAlbumArtElement[ALBUM_ART_IMAGE_CURRENT]->SetBounds(FloatRectangle(0.0f, 0.0f, floatDimension.width, floatDimension.height));
311         __pAlbumArtElement[ALBUM_ART_IMAGE_CURRENT]->SetShowState(true);
312         __pAlbumArtElements->AttachChild(*__pAlbumArtElement[ALBUM_ART_IMAGE_CURRENT]);
313
314         __pAlbumArtElement[ALBUM_ART_IMAGE_PREVIOUS] = new (std::nothrow) VisualElement();
315         __pAlbumArtElement[ALBUM_ART_IMAGE_PREVIOUS]->Construct();
316         __pAlbumArtElement[ALBUM_ART_IMAGE_PREVIOUS]->SetBounds(FloatRectangle(-604.0, 0.0f, floatDimension.width, floatDimension.height));
317         __pAlbumArtElement[ALBUM_ART_IMAGE_PREVIOUS]->SetShowState(true);
318         __pAlbumArtElements->AttachChild(*__pAlbumArtElement[ALBUM_ART_IMAGE_PREVIOUS]);
319
320         __pAlbumArtElement[ALBUM_ART_IMAGE_NEXT] = new (std::nothrow) VisualElement();
321         __pAlbumArtElement[ALBUM_ART_IMAGE_NEXT]->Construct();
322         __pAlbumArtElement[ALBUM_ART_IMAGE_NEXT]->SetName(L"Rect3");
323         __pAlbumArtElement[ALBUM_ART_IMAGE_NEXT]->SetBounds(FloatRectangle(836.0, 0.0f, floatDimension.width, floatDimension.height));
324
325         __pAlbumArtElement[ALBUM_ART_IMAGE_NEXT]->SetShowState(true);
326         __pAlbumArtElements->AttachChild(*__pAlbumArtElement[ALBUM_ART_IMAGE_NEXT]);
327
328         rectanglePreviousElement = __pAlbumArtElement[ALBUM_ART_IMAGE_PREVIOUS]->GetBounds();
329         rectangleCurrentElement = __pAlbumArtElement[ALBUM_ART_IMAGE_CURRENT]->GetBounds();
330         rectangleNextElement = __pAlbumArtElement[ALBUM_ART_IMAGE_NEXT]->GetBounds();
331
332         AddOrientationEventListener(*this);
333         //AddKeyEventListener(*this);
334
335         UpdateSplitBarState();
336         TogglePlayPauseImage(PLAYER_STATE_CLOSED);
337         SetRepeatButtonImage(__pPlayerPresentationModel->GetRepeatState());
338
339         AppLogDebug("EXIT");
340         return ThumbnailBase::Construct();
341 }
342
343 void
344 PlayerForm::OnOrientationChanged(const Tizen::Ui::Control& source, Tizen::Ui::OrientationStatus orientationStatus)
345 {
346         AppLogDebug("ENTER");
347         FloatDimension floatDimension = static_cast<Label*>(__pContentsAlbumViewPanel->GetControl(IDC_CONTENTS_THUMBNAIL))->GetSizeF();
348
349         __pAlbumArtElement[ALBUM_ART_IMAGE_CURRENT]->SetImplicitAnimationEnabled(false);
350         __pAlbumArtElement[ALBUM_ART_IMAGE_CURRENT]->SetBounds(FloatRectangle(0.0f, 0.0f, floatDimension.width, floatDimension.height));
351         __pAlbumArtElement[ALBUM_ART_IMAGE_PREVIOUS]->SetBounds(FloatRectangle(-604.0, 0.0f, floatDimension.width, floatDimension.height));
352         __pAlbumArtElement[ALBUM_ART_IMAGE_NEXT]->SetBounds(FloatRectangle(836.0, 0.0f, floatDimension.width, floatDimension.height));
353         __pAlbumArtElement[ALBUM_ART_IMAGE_CURRENT]->SetImplicitAnimationEnabled(true);
354
355         rectanglePreviousElement = __pAlbumArtElement[ALBUM_ART_IMAGE_PREVIOUS]->GetBounds();
356         rectangleCurrentElement = __pAlbumArtElement[ALBUM_ART_IMAGE_CURRENT]->GetBounds();
357         rectangleNextElement = __pAlbumArtElement[ALBUM_ART_IMAGE_NEXT]->GetBounds();
358
359         UpdateSplitBarState();
360
361         Rectangle clientBounds = GetClientAreaBounds();
362         if (orientationStatus == ORIENTATION_STATUS_LANDSCAPE
363                 || orientationStatus == ORIENTATION_STATUS_LANDSCAPE_REVERSE)
364         {
365                 if (__pVolumePanel != null)
366                 {
367                         if (clientBounds.width > 1200)
368                         {
369                                 __pVolumePanel->SetPosition(clientBounds.width - W_HORIZONTAL_PLAYER , GetClientAreaBounds().height - H_HORIZONTAL_CONTROLLER_PANEL - H_VOLUME_PANEL - 50);
370                         }
371                         else
372                         {
373                                 __pVolumePanel->SetBounds(Rectangle(clientBounds.width - 670
374                                                                                                         , GetClientAreaBounds().height - H_HORIZONTAL_CONTROLLER_PANEL - H_VOLUME_PANEL - 50
375                                                                                                         , 680
376                                                                                                         , H_VOLUME_PANEL));
377                         }
378                         __pVolumePanel->Invalidate(true);
379                 }
380         }
381         else if (orientationStatus == ORIENTATION_STATUS_PORTRAIT
382                         || orientationStatus == ORIENTATION_STATUS_PORTRAIT_REVERSE)
383         {
384                 if (__pVolumePanel != null)
385                 {
386                         if (clientBounds.width > 1200)
387                         {
388                                 __pVolumePanel->SetPosition(0, clientBounds.height - H_CONTROLLER_PANEL - H_VOLUME_PANEL - 50);
389                         }
390                         else
391                         {
392                                 __pVolumePanel->SetBounds( Rectangle(0
393                                                                                                         , clientBounds.height - H_CONTROLLER_PANEL - H_VOLUME_PANEL - 50
394                                                                                                         , clientBounds.width
395                                                                                                         , H_VOLUME_PANEL));
396                         }
397                         __pVolumePanel->Invalidate(true);
398                 }
399         }
400         TogglePlayPauseImage(__pPlayerPresentationModel->GetPlayerState());
401         TableView* pContentsTableView = static_cast<TableView*>(__pContentsListViewPanel->GetControl(IDC_CONTENTS_TABLEVIEW));
402         pContentsTableView->UpdateTableView();
403         __pContentsListViewPanel->Invalidate(true);
404         AppLogDebug("EXIT");
405 }
406
407 result
408 PlayerForm::OnTerminating(void)
409 {
410         AppLogDebug("ENTER");
411         ThumbnailBase::Stop();
412         if (__pAlbumArtElements)
413         {
414                 __pAlbumArtElements->Destroy();
415                 __pAlbumArtElements = null;
416         }
417
418         if (__isRunByAppControl == true)
419         {
420                 __pPlayerPresentationModel->SetRepeatMode(__prevRepeatStateRunByAppControl);
421                 __isRunByAppControl = false;
422         }
423
424         RemoveOptionMenu();
425         RemoveSharePicker();
426         RemovePlayListPicker();
427         RemoveSetAsPicker();
428
429         RemoveOrientationEventListener(*this);
430         RemoveKeyEventListener(*this);
431
432         delete __pSoundPathPopup;
433         __pSoundPathPopup = null;
434
435         if (__pAnimationFinishedTimer != null)
436         {
437                 __pAnimationFinishedTimer->Cancel();
438                 delete __pAnimationFinishedTimer;
439         }
440
441         if (__pContentPlayTimer != null)
442         {
443                 __pContentPlayTimer->Cancel();
444                 delete __pContentPlayTimer;
445         }
446
447         if (__pMsgShowTimer != null)
448         {
449                 __pMsgShowTimer->Cancel();
450                 delete __pMsgShowTimer;
451         }
452
453         if (__pSeekTimer != null)
454         {
455                 __pSeekTimer->Cancel();
456                 delete __pSeekTimer;
457         }
458
459         if (__pPlayerPresentationModel != null)
460         {
461                 __pPlayerPresentationModel->RemoveMusicPlayerEventListener(*this);
462                 __pPlayerPresentationModel->DestroyPlayerPresentationModel();
463         }
464         SettingPresentationModel::GetInstance()->DestroySettingPresentationModel();
465         AppLogDebug("EXIT");
466         return E_SUCCESS;
467 }
468
469 void
470 PlayerForm::OnActionPerformed(const Tizen::Ui::Control& source, int actionId)
471 {
472         AppLogDebug("ENTER");
473         SceneManager* pSceneManager = SceneManager::GetInstance();
474         AppAssert(pSceneManager);
475
476         switch (actionId)
477         {
478         case IDA_BUTTON_CONTENTS_ALBUM_VIEW:
479                 {
480                         CancelAllThumbnailRequest();
481                         __pContentsListViewPanel->SetShowState(false);
482                         __pContentsViewToggleButton->SetActionId(IDA_BUTTON_CONTENTS_LIST_VIEW);
483                         __pContentsAlbumViewPanel->SetShowState(true);
484                         __pPanelRegisterBar->Invalidate(true);
485                 }
486                 break;
487
488         case IDA_BUTTON_CONTENTS_LIST_VIEW:
489                 {
490                         __pContentsAlbumViewPanel->SetShowState(false);
491                         __pContentsViewToggleButton->SetActionId(IDA_BUTTON_CONTENTS_ALBUM_VIEW);
492                         __pContentsListViewPanel->SetShowState(true);
493                         __pContentsListViewPanel->SetEnabled(true);
494                         __pPanelRegisterBar->Invalidate(true);
495                 }
496                 break;
497
498         case IDA_PLAYER_CONTROLLER_VOLUME:
499                 {
500                         if (__pVolumePanel == null)
501                         {
502                                 InitializeVolumeBar();
503                         }
504                         else
505                         {
506                                 if (__pVolumePanel->GetShowState() == true)
507                                 {
508                                         __pVolumePanel->SetShowState(false);
509                                 }
510                                 else
511                                 {
512                                         int MediaSoundVolume = 0;
513                                         SettingInfo::GetValue(MEDIA_VOLUME, MediaSoundVolume);
514                                         __pPlayerPresentationModel->SetVolume(MediaSoundVolume);
515                                         __pVolumeSlider->SetValue(__pPlayerPresentationModel->GetVolume());
516                                         __pVolumeSlider->Invalidate(true);
517                                         __pVolumePanel->SetShowState(true);
518                                 }
519                         }
520                 }
521                 break;
522
523         case IDA_PLAYER_CONTROLLER_PLAY:
524                 {
525                         String* pCurrentPlayConent = __pPlayerPresentationModel->GetPlayContentPath();
526                         String* pContentPath = __pPlayerPresentationModel->GetContentPath(__pPlayerPresentationModel->GetCurrentContentIndex());
527
528                         if (pCurrentPlayConent->Equals(*pContentPath))
529                         {
530                                 __pPlayerPresentationModel->Play(__pPlayerPresentationModel->GetCurrentContentIndex(), __pPlayStateSlider->GetValue(), true);
531                         }
532                         else
533                         {
534                                 __pPlayerPresentationModel->Play(__pPlayerPresentationModel->GetCurrentContentIndex(), __pPlayStateSlider->GetValue());
535                         }
536
537                         if (__pPlayerPresentationModel->IsFileExist(__pPlayerPresentationModel->GetCurrentContentIndex()) != true)
538                         {
539                                 SetFileNotExistState(false);
540                         }
541                 }
542                 break;
543
544         case IDA_PLAYER_CONTROLLER_PAUSE:
545                 {
546                         __pPlayerPresentationModel->Pause();
547                 }
548                 break;
549
550         case IDA_PLAYER_CONTROLLER_BACK:
551                 {
552                         result r = pSceneManager->GoBackward(BackwardSceneTransition(SCENE_TRANSITION_ANIMATION_TYPE_NONE, SCENE_DESTROY_OPTION_KEEP));
553                         if (IsFailed(r))
554                         {
555                                 UiApp* pApp = UiApp::GetInstance();
556                                 pApp->Terminate();
557                         }
558                         __isRunByAppControl = false;
559 //                      else if (__isRunByAppControl)
560 //                      {
561 //                              Tizen::App::UiApp::GetInstance()->GetFrameAt(0)->SetShowMode(FRAME_SHOW_MODE_MINIMIZED);
562 //                      }
563                 }
564                 break;
565
566         case IDA_PLAYER_CONTROLLER_REPEAT:
567                 {
568                         switch (__pPlayerPresentationModel->GetRepeatState())
569                         {
570                         case IDA_TYPE_REPEAT_A:
571                                 {
572                                         SetRepeatButtonImage(IDA_TYPE_REPEAT_ONE);
573                                 }
574                                 break;
575
576                         case IDA_TYPE_REPEAT_ONE:
577                                 {
578                                         SetRepeatButtonImage(IDA_TYPE_REPEAT_ALL);
579                                 }
580                                 break;
581
582                         case IDA_TYPE_REPEAT_ALL:
583                                 {
584                                         SetRepeatButtonImage(IDA_TYPE_REPEAT_A);
585                                 }
586                                 break;
587
588                         default:
589                                 break;
590                         }
591                 }
592                 break;
593
594         case IDA_PLAYER_CONTROLLER_SHUFFLE:
595                 {
596                         if (__pPlayerPresentationModel->IsShuffleEnable() == false)
597                         {
598                                 SetShuffleButtonImage(true);
599                         }
600                         else
601                         {
602                                 SetShuffleButtonImage(false);
603                         }
604                 }
605                 break;
606
607         case IDA_PLAYER_CONTROLLER_MORE:
608                 {
609                         if (GetPlayerScreenState() == PLAYER_SCREEN_STATE_NORMAL)
610                         {
611                                 CreateOptionMenuN(source);
612                                 SetOptionMenuItem(CONTEXT_MENU_ITEM_STYLE_SET_AS | CONTEXT_MENU_ITEM_STYLE_DETAILS | CONTEXT_MENU_ITEM_STYLE_SHARE_VIA
613                                                                                                                                                                 | CONTEXT_MENU_ITEM_STYLE_ADD_TO_PLAYLIST | CONTEXT_MENU_ITEM_STYLE_SETTINGS);
614                         }
615                         else if (GetPlayerScreenState() == PLAYER_SCREEN_STATE_APP_CONTROL || GetPlayerScreenState() == PLAYER_SCREEN_STATE_INVALID_CONTENT_ID)
616                         {
617                                 CreateOptionMenuN(source);
618                                 SetOptionMenuItem(CONTEXT_MENU_ITEM_STYLE_SET_AS | CONTEXT_MENU_ITEM_STYLE_DETAILS | CONTEXT_MENU_ITEM_STYLE_SHARE_VIA);
619                         }
620                 }
621                 break;
622
623         case IDA_CONTEXT_MENU_ITEM_SHARE_VIA:
624                 {
625                         LanucherPicker(PICKER_TYPE_SHARE_PICKER);
626                 }
627                 break;
628
629         case IDA_CONTEXT_MENU_ITEM_STYLE_ADD_TO_PLAYLIST:
630                 {
631                         LanucherPicker(PICKER_TYPE_PLAY_LIST_PICKER);
632                 }
633                 break;
634
635         case IDA_CONTEXT_MENU_ITEM_STYLE_SET_AS:
636                 {
637                         LanucherPicker(PICKER_TYPE_SET_AS_PICKER);
638                 }
639                 break;
640
641         case IDA_CONTEXT_MENU_ITEM_STYLE_SOUND_PATH:
642                 {
643                         if (__pSoundPathPopup == null)
644                         {
645                                 __pSoundPathPopup = new (std::nothrow) SoundPathPopup();
646                                 __pSoundPathPopup->Initialize();
647                         }
648                         __pSoundPathPopup->ShowPopup(true);
649                 }
650                 break;
651
652         case IDA_CONTEXT_MENU_ITEM_STYLE_DETAILS:
653                 {
654                         pSceneManager->GoForward(ForwardSceneTransition(IDSCN_CONTENT_DETAIL));
655                 }
656                 break;
657
658         case IDA_CONTEXT_MENU_ITEM_SETTINGS:
659                 {
660                         SettingPresentationModel::GetInstance()->InitializeSettingValue();
661                         pSceneManager->GoForward(ForwardSceneTransition(IDSCN_MUSIC_SETTING));
662                 }
663                 break;
664
665         default:
666                 break;
667         }
668
669         TryRemoveContextMenu(actionId);
670         AppLogDebug("EXIT");
671 }
672
673 void
674 PlayerForm::OnKeyPressed(const Tizen::Ui::Control& source, Tizen::Ui::KeyCode keyCode)
675 {
676         AppLogDebug("ENTER");
677         switch (keyCode)
678         {
679         case KEY_SIDE_UP:
680                 {
681                         if (__pVolumePanel == null)
682                         {
683                                 InitializeVolumeBar();
684                         }
685
686                         __pVolumePanel->SetShowState(true);
687                         __pPlayerPresentationModel->SetVolume(__pPlayerPresentationModel->GetVolume() + 1);
688                         __pVolumeSlider->SetValue(__pPlayerPresentationModel->GetVolume());
689                         __pVolumeSlider->Invalidate(true);
690                 }
691                 break;
692
693         case KEY_SIDE_DOWN:
694                 {
695                         if (__pVolumePanel == null)
696                         {
697                                 InitializeVolumeBar();
698                         }
699
700                         __pVolumePanel->SetShowState(true);
701                         __pPlayerPresentationModel->SetVolume(__pPlayerPresentationModel->GetVolume() - 1);
702                         __pVolumeSlider->SetValue(__pPlayerPresentationModel->GetVolume());
703                         __pVolumeSlider->Invalidate(true);
704                 }
705                 break;
706
707         case KEY_ENTER:
708                 if (source.Equals(*__pForwardButton) || source.Equals(*__pRewindButton))
709                 {
710                         __isLongPressed = false;
711                 }
712                 break;
713
714         default:
715                 break;
716         }
717         AppLogDebug("EXIT");
718 }
719
720 void
721 PlayerForm::OnKeyReleased(const Tizen::Ui::Control& source, Tizen::Ui::KeyCode keyCode)
722 {
723         AppLogDebug("ENTER");
724         switch (keyCode)
725         {
726         case KEY_ENTER:
727                 if (source.Equals(*__pForwardButton) || source.Equals(*__pRewindButton))
728                 {
729                         if (__isLongPressed == true)
730                         {
731                                 __pPlayerPresentationModel->StopForwardRewind();
732                         }
733                         else
734                         {
735                                 if (source.Equals(*__pRewindButton))
736                                 {
737                                         if (__pPlayerPresentationModel->GetContentListCount() > 1)
738                                         {
739                                                 while (__pPlayerPresentationModel->IsFileExist(__pPlayerPresentationModel->GetPreviousContentIndex()) == false
740                                                         && __pPlayerPresentationModel->GetContentListCount() > 0)
741                                                 {
742                                                         __pPlayerPresentationModel->RemoveContent(*__pPlayerPresentationModel->GetContentPath(__pPlayerPresentationModel->GetPreviousContentIndex()));
743                                                 }
744                                         }
745                                         __flickDirection = FLICK_DIRECTION_RIGHT;
746
747                                         if (__pPlayerPresentationModel->GetContentListCount() <= 1)
748                                         {
749                                                 MessageBox messageBox;
750                                                 messageBox.Construct(L"", ResourceManager::GetString(L"IDS_MUSIC_HEADER_NO_SONGS"), MSGBOX_STYLE_NONE, 1000);
751
752                                                 int modalResult = 0;
753                                                 messageBox.ShowAndWait(modalResult);
754                                         }
755                                         else
756                                         {
757                                                 __pSeekTimer->Cancel();
758                                                 __playPosition = -1;
759                                                 PlayAnimation();
760                                         }
761                                 }
762                                 else
763                                 {
764                                         if (__pPlayerPresentationModel->GetContentListCount() > 1)
765                                         {
766                                                 while (__pPlayerPresentationModel->IsFileExist(__pPlayerPresentationModel->GetNextContentIndex()) == false
767                                                         && __pPlayerPresentationModel->GetContentListCount() > 0)
768                                                 {
769                                                         __pPlayerPresentationModel->RemoveContent(*__pPlayerPresentationModel->GetContentPath(__pPlayerPresentationModel->GetNextContentIndex()));
770                                                 }
771                                         }
772                                         __flickDirection = FLICK_DIRECTION_LEFT;
773
774                                         if (__pPlayerPresentationModel->GetContentListCount() <= 1)
775                                         {
776                                                 MessageBox messageBox;
777                                                 messageBox.Construct(L"", ResourceManager::GetString(L"IDS_MUSIC_HEADER_NO_SONGS"), MSGBOX_STYLE_NONE, 1000);
778
779                                                 int modalResult = 0;
780                                                 messageBox.ShowAndWait(modalResult);
781                                         }
782                                         else
783                                         {
784                                                 __pSeekTimer->Cancel();
785                                                 __playPosition = -1;
786                                                 PlayAnimation();
787                                         }
788                                 }
789                         }
790                 }
791                 break;
792
793         default:
794                 break;
795         }
796         AppLogDebug("EXIT");
797 }
798
799 void
800 PlayerForm::OnKeyLongPressed(const Tizen::Ui::Control& source, Tizen::Ui::KeyCode keyCode)
801 {
802         AppLogDebug("ENTER");
803         AppLogDebug("keycode(%d)", keyCode);
804         switch (keyCode)
805         {
806         case KEY_ENTER:
807                         if (source.Equals(*__pForwardButton) || source.Equals(*__pRewindButton))
808                 {
809                         __isLongPressed = true;
810                         if (source.Equals(*__pRewindButton) && (__pPlayStateSlider->IsEnabled()))
811                         {
812                                 __pPlayerPresentationModel->SeekToRewind();
813                         }
814                         else if (__pPlayStateSlider->IsEnabled())
815                         {
816                                 __pPlayerPresentationModel->SeekToForward();
817                         }
818                 }
819                 break;
820
821         default:
822                 break;
823         }
824         AppLogDebug("EXIT");
825 }
826
827 void
828 PlayerForm::OnTouchLongPressed(const Control& source, const Point& currentPosition, const TouchEventInfo& touchInfo)
829 {
830         AppLogDebug("ENTER");
831         if (source.Equals(*__pForwardButton) || source.Equals(*__pRewindButton))
832         {
833                 __isLongPressed = true;
834                 if (source.Equals(*__pRewindButton) && (__pPlayStateSlider->IsEnabled()))
835                 {
836                         __pPlayerPresentationModel->SeekToRewind();
837                 }
838                 else if (__pPlayStateSlider->IsEnabled())
839                 {
840                         __pPlayerPresentationModel->SeekToForward();
841                 }
842         }
843         AppLogDebug("EXIT");
844 }
845
846 void
847 PlayerForm::OnTouchMoved(const Tizen::Ui::Control& source, const Tizen::Graphics::Point& currentPosition, const Tizen::Ui::TouchEventInfo& touchInfo)
848 {
849         AppLogDebug("ENTER");
850         Label *pAlbumLable = static_cast<Label*>(__pContentsAlbumViewPanel->GetControl(IDC_CONTENTS_THUMBNAIL));
851         if (source.Equals(*pAlbumLable) == false)
852         {
853                 return;
854         }
855
856         if (__isAnimationPerformed == true || __isContentMoveCompleted == true)
857         {
858                 return;
859         }
860
861         if (currentPosition.y < 0 || currentPosition.y > GetBounds().height - __pControllerPanel->GetBounds().height)
862         {
863                 return;
864         }
865
866         if (Tizen::Base::Utility::Math::Abs(touchInfo.GetStartPosition().y - currentPosition.y) > 100)
867         {
868                 return;
869         }
870
871         if (currentPosition.x > touchInfo.GetStartPosition().x + 100)
872         {
873                 if (__pPlayerPresentationModel->GetContentListCount() > 1)
874                 {
875                         while (__pPlayerPresentationModel->IsFileExist(__pPlayerPresentationModel->GetPreviousContentIndex()) == false
876                                 && __pPlayerPresentationModel->GetContentListCount() > 0)
877                         {
878                                 __pPlayerPresentationModel->RemoveContent(*__pPlayerPresentationModel->GetContentPath(__pPlayerPresentationModel->GetPreviousContentIndex()));
879                         }
880                 }
881                 __flickDirection = FLICK_DIRECTION_RIGHT;
882                 __isContentMoveCompleted = true;
883                 if (__pPlayerPresentationModel->GetContentListCount() <= 1)
884                 {
885                         MessageBox messageBox;
886                         messageBox.Construct(L"", ResourceManager::GetString(L"IDS_MUSIC_HEADER_NO_SONGS"), MSGBOX_STYLE_NONE, 1000);
887
888                         int modalResult = 0;
889                         messageBox.ShowAndWait(modalResult);
890                 }
891                 else
892                 {
893                         __pSeekTimer->Cancel();
894                         __playPosition = -1;
895                         PlayAnimation();
896                 }
897         }
898         else if (currentPosition.x < touchInfo.GetStartPosition().x - 100)
899         {
900                 if (__pPlayerPresentationModel->GetContentListCount() > 1)
901                 {
902                         while (__pPlayerPresentationModel->IsFileExist(__pPlayerPresentationModel->GetNextContentIndex()) == false
903                                 && __pPlayerPresentationModel->GetContentListCount() > 0)
904                         {
905                                 __pPlayerPresentationModel->RemoveContent(*__pPlayerPresentationModel->GetContentPath(__pPlayerPresentationModel->GetNextContentIndex()));
906                         }
907                 }
908                 __flickDirection = FLICK_DIRECTION_LEFT;
909                 __isContentMoveCompleted = true;
910                 if (__pPlayerPresentationModel->GetContentListCount() <= 1)
911                 {
912                         MessageBox messageBox;
913                         messageBox.Construct(L"", ResourceManager::GetString(L"IDS_MUSIC_HEADER_NO_SONGS"), MSGBOX_STYLE_NONE, 1000);
914
915                         int modalResult = 0;
916                         messageBox.ShowAndWait(modalResult);
917                 }
918                 else
919                 {
920                         __pSeekTimer->Cancel();
921                         __playPosition = -1;
922                         PlayAnimation();
923                 }
924         }
925         AppLogDebug("EXIT");
926 }
927
928 void
929 PlayerForm::OnTouchPressed(const Control& source, const Point& currentPosition, const TouchEventInfo& touchInfo)
930 {
931         AppLogDebug("ENTER");
932         if (source.Equals(*__pForwardButton) || source.Equals(*__pRewindButton))
933         {
934                 __isLongPressed = false;
935         }
936         else
937         {
938                 if (__pVolumePanel != null && __pVolumePanel->GetShowState())
939                 {
940                         __pVolumePanel->SetShowState(false);
941                 }
942         }
943         AppLogDebug("EXIT");
944 }
945
946 void
947 PlayerForm::OnTouchReleased(const Control& source, const Point& currentPosition, const TouchEventInfo& touchInfo)
948 {
949         AppLogDebug("ENTER");
950         __isContentMoveCompleted = false;
951         if (source.Equals(*__pForwardButton) || source.Equals(*__pRewindButton))
952         {
953                 if (__isLongPressed == true)
954                 {
955                         __pPlayerPresentationModel->StopForwardRewind();
956                 }
957                 else
958                 {
959                         if(0 > currentPosition.x || source.GetWidth() < currentPosition.x ||
960                                  0 > currentPosition.y || source.GetHeight() < currentPosition.y)
961                         {
962                                 return;
963                         }
964
965                         if (source.Equals(*__pRewindButton))
966                         {
967                                 if (__pPlayerPresentationModel->GetContentListCount() > 1)
968                                 {
969                                         while (__pPlayerPresentationModel->IsFileExist(__pPlayerPresentationModel->GetPreviousContentIndex()) == false
970                                                 && __pPlayerPresentationModel->GetContentListCount() > 0)
971                                         {
972                                                 __pPlayerPresentationModel->RemoveContent(*__pPlayerPresentationModel->GetContentPath(__pPlayerPresentationModel->GetPreviousContentIndex()));
973                                         }
974                                 }
975                                 __flickDirection = FLICK_DIRECTION_RIGHT;
976
977                                 if (__pPlayerPresentationModel->GetContentListCount() <= 1)
978                                 {
979                                         MessageBox messageBox;
980                                         messageBox.Construct(L"", ResourceManager::GetString(L"IDS_MUSIC_HEADER_NO_SONGS"), MSGBOX_STYLE_NONE, 1000);
981
982                                         int modalResult = 0;
983                                         messageBox.ShowAndWait(modalResult);
984                                 }
985                                 else
986                                 {
987                                         __pSeekTimer->Cancel();
988                                         __playPosition = -1;
989                                         PlayAnimation();
990                                 }
991                         }
992                         else
993                         {
994                                 if (__pPlayerPresentationModel->GetContentListCount() > 1)
995                                 {
996                                         while (__pPlayerPresentationModel->IsFileExist(__pPlayerPresentationModel->GetNextContentIndex()) == false
997                                                 && __pPlayerPresentationModel->GetContentListCount() > 0)
998                                         {
999                                                 __pPlayerPresentationModel->RemoveContent(*__pPlayerPresentationModel->GetContentPath(__pPlayerPresentationModel->GetNextContentIndex()));
1000                                         }
1001                                 }
1002                                 __flickDirection = FLICK_DIRECTION_LEFT;
1003
1004                                 if (__pPlayerPresentationModel->GetContentListCount() <= 1)
1005                                 {
1006                                         MessageBox messageBox;
1007                                         messageBox.Construct(L"", ResourceManager::GetString(L"IDS_MUSIC_HEADER_NO_SONGS"), MSGBOX_STYLE_NONE, 1000);
1008
1009                                         int modalResult = 0;
1010                                         messageBox.ShowAndWait(modalResult);
1011                                 }
1012                                 else
1013                                 {
1014                                         __pSeekTimer->Cancel();
1015                                         __playPosition = -1;
1016                                         PlayAnimation();
1017                                 }
1018                         }
1019                 }
1020         }
1021         else
1022         {
1023                 // Empty statement
1024         }
1025         AppLogDebug("EXIT");
1026 }
1027
1028 void
1029 PlayerForm::OnTouchCanceled(const Tizen::Ui::Control& source, const Tizen::Graphics::Point& currentPosition, const Tizen::Ui::TouchEventInfo& touchInfo)
1030 {
1031         AppLogDebug("ENTER");
1032         __isContentMoveCompleted = false;
1033
1034         if (source.Equals(*__pForwardButton) || source.Equals(*__pRewindButton))
1035         {
1036                 if (__isLongPressed == true)
1037                 {
1038                         __pPlayerPresentationModel->StopForwardRewind();
1039                         __isLongPressed = false;
1040                 }
1041         }
1042
1043         AppLogDebug("EXIT");
1044
1045 }
1046
1047 void
1048 PlayerForm::PlayAnimation(void)
1049 {
1050         AppLogDebug("ENTER");
1051         __isAnimationPerformed = true;
1052 //      if (AnimationTransaction::GetStatus(__transactionID) == ANIMATION_TRANSACTION_STATUS_STOPPED)
1053 //      {
1054                 if (__flickDirection == FLICK_DIRECTION_RIGHT)
1055                 {
1056                         __pAlbumArtElement[ALBUM_ART_IMAGE_PREVIOUS]->SetShowState(true);
1057
1058                         AnimationTransaction::Begin(__transactionID);
1059                         AnimationTransaction::SetVisualElementAnimationDuration(200);
1060                         AnimationTransaction::SetCurrentTransactionEventListener(this);
1061
1062                         VisualElementPropertyAnimation* pAnimation = new (std::nothrow) VisualElementPropertyAnimation();
1063                         pAnimation->SetPropertyName(L"bounds");
1064                         pAnimation->SetStartValue(Variant(rectanglePreviousElement));
1065                         pAnimation->SetEndValue(Variant(rectangleCurrentElement));
1066
1067                         __pAlbumArtElement[ALBUM_ART_IMAGE_PREVIOUS]->AddAnimation(*pAnimation);
1068                         delete pAnimation;
1069
1070                         pAnimation = new (std::nothrow) VisualElementPropertyAnimation();
1071                         pAnimation->SetPropertyName(L"bounds");
1072                         pAnimation->SetStartValue(Variant(rectangleCurrentElement));
1073                         pAnimation->SetEndValue(Variant(rectangleNextElement));
1074
1075                         __pAlbumArtElement[ALBUM_ART_IMAGE_CURRENT]->AddAnimation(*pAnimation);
1076
1077                         __pAlbumArtElement[ALBUM_ART_IMAGE_NEXT]->SetShowState(false);
1078                         delete pAnimation;
1079
1080                         AnimationTransaction::Commit();
1081                 }
1082                 else if (__flickDirection == FLICK_DIRECTION_LEFT)
1083                 {
1084                         __pAlbumArtElement[ALBUM_ART_IMAGE_NEXT]->SetShowState(true);
1085
1086                         AnimationTransaction::Begin(__transactionID);
1087                         AnimationTransaction::SetVisualElementAnimationDuration(200);
1088                         AnimationTransaction::SetCurrentTransactionEventListener(this);
1089
1090                         VisualElementPropertyAnimation* pAnimation = new (std::nothrow) VisualElementPropertyAnimation();
1091                         pAnimation->SetPropertyName(L"bounds");
1092                         pAnimation->SetStartValue(Variant(rectangleCurrentElement));
1093                         pAnimation->SetEndValue(Variant(rectanglePreviousElement));
1094
1095                         __pAlbumArtElement[ALBUM_ART_IMAGE_CURRENT]->AddAnimation(*pAnimation);
1096                         delete pAnimation;
1097
1098                         pAnimation = new (std::nothrow) VisualElementPropertyAnimation();
1099                         pAnimation->SetPropertyName(L"bounds");
1100                         pAnimation->SetStartValue(Variant(rectangleNextElement));
1101                         pAnimation->SetEndValue(Variant(rectangleCurrentElement));
1102
1103                         __pAlbumArtElement[ALBUM_ART_IMAGE_NEXT]->AddAnimation(*pAnimation);
1104                         __pAlbumArtElement[ALBUM_ART_IMAGE_PREVIOUS]->SetShowState(false);
1105                         delete pAnimation;
1106
1107                         AnimationTransaction::Commit();
1108                 }
1109                 else
1110                 {
1111                         // Empty statement
1112                 }
1113 //      }
1114         AppLogDebug("EXIT");
1115 }
1116
1117 void
1118 PlayerForm::StopAnimation(void)
1119 {
1120         AppLogDebug("ENTER");
1121         AppLogDebug("EXIT");
1122 }
1123
1124 void
1125 PlayerForm::OnAnimationTransactionStarted(int transactionId)
1126 {
1127         AppLogDebug("ENTER");
1128         __pContentPlayTimer->Cancel();
1129         AppLogDebug("EXIT");
1130 }
1131
1132 void
1133 PlayerForm::OnAnimationTransactionStopped(int transactionId)
1134 {
1135         AppLogDebug("ENTER");
1136         AppLogDebug("EXIT");
1137 }
1138
1139 void
1140 PlayerForm::OnAnimationTransactionFinished(int transactionId)
1141 {
1142         AppLogDebug("ENTER");
1143         __isAnimationPerformed = false;
1144         __pAnimationFinishedTimer->Start(1);
1145         __pContentPlayTimer->Start(700);
1146         AppLogDebug("EXIT");
1147 }
1148
1149 void
1150 PlayerForm::OnSliderBarMoved(Tizen::Ui::Controls::Slider& source, int value)
1151 {
1152         AppLogDebug("ENTER value = %d",value);
1153         if (source.Equals(*__pPlayStateSlider))
1154         {
1155                 if (value >= 100)
1156                 {
1157                         __pPlayStateSlider->SetShowState(false);//To cancel touch event.
1158                         __pSeekTimer->Cancel();
1159                         __playPosition = -1;
1160                         __pPlayerPresentationModel->SetPlayPosition(100);
1161                 }
1162                 else
1163                 {
1164                         __playPosition = value;
1165                         __pSeekTimer->Cancel();
1166                         __pSeekTimer->Start(100);
1167                 }
1168                 //__pPlayerPresentationModel->SetPlayPosition(value);
1169
1170                 __pPlayStateSlider->SetShowState(true);
1171         }
1172         else
1173         {
1174                 if (__pVolumePanel->GetShowState() == false)
1175                 {
1176                         __pVolumePanel->SetShowState(true);
1177                 }
1178                 __pPlayerPresentationModel->SetVolume(value);
1179         }
1180         AppLogDebug("EXIT");
1181 }
1182
1183 void
1184 PlayerForm::OnTimerExpired(Tizen::Base::Runtime::Timer& timer)
1185 {
1186         AppLogDebug("ENTER");
1187         if (&timer == __pAnimationFinishedTimer)
1188         {
1189                 if (__flickDirection == FLICK_DIRECTION_RIGHT)
1190                 {
1191                         Tizen::Ui::Animations::VisualElement* pTempVisualElement = __pAlbumArtElement[ALBUM_ART_IMAGE_NEXT];
1192                         pTempVisualElement->SetBounds(rectanglePreviousElement);
1193
1194                         __pAlbumArtElement[ALBUM_ART_IMAGE_NEXT] = __pAlbumArtElement[ALBUM_ART_IMAGE_CURRENT];
1195                         __pAlbumArtElement[ALBUM_ART_IMAGE_CURRENT] = __pAlbumArtElement[ALBUM_ART_IMAGE_PREVIOUS];
1196                         __pAlbumArtElement[ALBUM_ART_IMAGE_PREVIOUS] = pTempVisualElement;
1197                         __pAlbumArtElement[ALBUM_ART_IMAGE_PREVIOUS]->SetShowState(false);
1198
1199                         __pPlayerPresentationModel->MovePreviousContent(true);
1200                 }
1201                 else if (__flickDirection == FLICK_DIRECTION_LEFT)
1202                 {
1203                         Tizen::Ui::Animations::VisualElement* pTempVisualElement = __pAlbumArtElement[ALBUM_ART_IMAGE_PREVIOUS];
1204                         pTempVisualElement->SetBounds(rectangleNextElement);
1205
1206                         __pAlbumArtElement[ALBUM_ART_IMAGE_PREVIOUS] = __pAlbumArtElement[ALBUM_ART_IMAGE_CURRENT];
1207                         __pAlbumArtElement[ALBUM_ART_IMAGE_CURRENT] = __pAlbumArtElement[ALBUM_ART_IMAGE_NEXT];
1208                         __pAlbumArtElement[ALBUM_ART_IMAGE_NEXT] = pTempVisualElement;
1209                         __pAlbumArtElement[ALBUM_ART_IMAGE_NEXT]->SetShowState(false);
1210
1211                         __pPlayerPresentationModel->MoveNextContent();
1212                 }
1213                 __flickDirection = FLICK_DIRECTION_NONE;
1214                 __transactionID = ANIMATION_TRANSACTION_STATUS_STOPPED;
1215         }
1216         else if (&timer == __pMsgShowTimer)
1217         {
1218                 ShowMessageBox(ResourceManager::GetString(L"IDS_MUSIC_POP_UNABLE_TO_PLAY_ERROR_OCCURRED"));
1219         }
1220         else if (&timer == __pSeekTimer)
1221         {
1222                 int playPosition = __playPosition;
1223                 __playPosition = -1;
1224                 __pPlayerPresentationModel->SetPlayPosition(playPosition);
1225         }
1226         else
1227         {
1228                 String* currentPlayConent = __pPlayerPresentationModel->GetPlayContentPath();
1229                 String* ContentPath = __pPlayerPresentationModel->GetContentPath(__pPlayerPresentationModel->GetCurrentContentIndex());
1230
1231                 if ((__pPlayerPresentationModel->GetPlayerState() != PLAYER_STATE_PAUSED) && (__pPlayerPresentationModel->IsDuringCall() == false))
1232                 {
1233                         __pPlayStateSlider->SetShowState(false);//To cancel touch event.
1234                         __pPlayerPresentationModel->Play(__pPlayerPresentationModel->GetCurrentContentIndex(), MIN_PLAY_STATE_SLIDER_COUNT);
1235                         __pPlayStateSlider->SetShowState(true);
1236                 }
1237                 else if (!currentPlayConent->Equals(*ContentPath,true))
1238                 {
1239                         if (__pPlayerPresentationModel->GetPlayerState() != PLAYER_STATE_PAUSED &&
1240                                         __pPlayerPresentationModel->GetPlayerState() != PLAYER_STATE_PLAYING )
1241                         {
1242                                 __pPlayerPresentationModel->Play(__pPlayerPresentationModel->GetCurrentContentIndex(), MIN_PLAY_STATE_SLIDER_COUNT);
1243                                 __pPlayerPresentationModel->Pause();
1244                         }
1245                         __pPlayStateSlider->SetValue(0);
1246                         __pPlayerPresentationModel->SetPlayPosition(0);
1247                 }
1248
1249                 if (!__pPlayerPresentationModel->IsDuringCall())
1250                 {
1251                         SetFileNotExistState(__pPlayerPresentationModel->IsFileExist(__pPlayerPresentationModel->GetCurrentContentIndex()));
1252                 }
1253         }
1254         AppLogDebug("EXIT");
1255 }
1256
1257 int
1258 PlayerForm::GetItemCount(void)
1259 {
1260         AppLogDebug("ENTER");
1261         if (__pPlayerPresentationModel == null)
1262         {
1263                 return INIT_VALUE;
1264         }
1265         AppLogDebug("EXIT");
1266         return __pPlayerPresentationModel->GetContentListCount();
1267 }
1268
1269 Tizen::Ui::Controls::TableViewItem*
1270 PlayerForm::CreateItem(int index, int itemWidth)
1271 {
1272         AppLogDebug("ENTER");
1273         RelativeLayout layout;
1274         layout.Construct();
1275
1276         TableViewItem* pItem = new (std::nothrow) TableViewItem();
1277         ContentInformation* pContentInfo = __pPlayerPresentationModel->GetContentInfoN(index);
1278
1279         result r = pItem->Construct(layout, Dimension(itemWidth, __itemHeight), TABLE_VIEW_ANNEX_STYLE_NORMAL);
1280         TryCatch(r == E_SUCCESS, delete pItem, "pItem->Construct(%s)", GetErrorMessage(r));
1281         TryCatch(pContentInfo != null, delete pItem, "pContentInfo is null", GetErrorMessage(GetLastResult()));
1282
1283         r = CreateTableViewItem(*pItem, *pContentInfo);
1284         TryCatch(r == E_SUCCESS, delete pItem, "CreateTableViewItem failed(%s)", GetErrorMessage(r));
1285
1286         RequestThumbnail(pContentInfo->contentId, (new (std::nothrow) Integer(index)));
1287         delete pContentInfo;
1288
1289         AppLogDebug("EXIT");
1290         return pItem;
1291
1292 CATCH:
1293         AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult()));
1294         delete pContentInfo;
1295         return null;
1296 }
1297
1298 bool
1299 PlayerForm::DeleteItem(const int itemIndex, Tizen::Ui::Controls::TableViewItem* pItem)
1300 {
1301         AppLogDebug("ENTER");
1302         delete pItem;
1303         pItem = null;
1304         AppLogDebug("EXIT");
1305         return true;
1306 }
1307
1308 int
1309 PlayerForm::GetDefaultItemHeight(void)
1310 {
1311         AppLogDebug("ENTER");
1312         AppLogDebug("EXIT");
1313         return ITEM_HEIGHT;
1314 }
1315
1316 void
1317 PlayerForm::OnTableViewItemStateChanged(Tizen::Ui::Controls::TableView& tableView, int itemIndex, Tizen::Ui::Controls::TableViewItem* pItem, Tizen::Ui::Controls::TableViewItemStatus status)
1318 {
1319         AppLogDebug("ENTER");
1320         SceneManager* pSceneManager = SceneManager::GetInstance();
1321         AppAssert(pSceneManager);
1322
1323         if (status == TABLE_VIEW_ITEM_STATUS_SELECTED)
1324         {
1325                 __pPlayerPresentationModel->Play(itemIndex, MIN_PLAY_STATE_SLIDER_COUNT);
1326
1327                 if (__pPlayerPresentationModel->IsFileExist(__pPlayerPresentationModel->GetCurrentContentIndex()) != true)
1328                 {
1329                         SetFileNotExistState(false);
1330                 }
1331         }
1332         AppLogDebug("EXIT");
1333 }
1334
1335 void
1336 PlayerForm::OnTableViewContextItemActivationStateChanged(Tizen::Ui::Controls::TableView& tableView, int itemIndex, Tizen::Ui::Controls::TableViewContextItem* pContextItem, bool activated)
1337 {
1338         AppLogDebug("ENTER");
1339         AppLogDebug("EXIT");
1340 }
1341
1342 void
1343 PlayerForm::OnTableViewItemReordered(Tizen::Ui::Controls::TableView& tableView, int itemIndexFrom, int itemIndexTo)
1344 {
1345         AppLogDebug("ENTER");
1346         AppLogDebug("EXIT");
1347 }
1348
1349 void
1350 PlayerForm::OnFormBackRequested(Tizen::Ui::Controls::Form& source)
1351 {
1352         AppLogDebug("ENTER");
1353         SceneManager* pSceneManager = SceneManager::GetInstance();
1354         result r = pSceneManager->GoBackward(BackwardSceneTransition(SCENE_TRANSITION_ANIMATION_TYPE_NONE, SCENE_DESTROY_OPTION_KEEP));
1355         if (IsFailed(r))
1356         {
1357                 UiApp* pApp = UiApp::GetInstance();
1358                 pApp->Terminate();
1359         }
1360         __isRunByAppControl = false;
1361 //                      else if (__isRunByAppControl)
1362 //                      {
1363 //                              Tizen::App::UiApp::GetInstance()->GetFrameAt(0)->SetShowMode(FRAME_SHOW_MODE_MINIMIZED);
1364 //                      }
1365         AppLogDebug("EXIT");
1366 }
1367
1368 void
1369 PlayerForm::OnFormMenuRequested(Tizen::Ui::Controls::Form& source)
1370 {
1371         AppLogDebug("ENTER");
1372         bool isFileExist = __pPlayerPresentationModel->IsFileExist(__pPlayerPresentationModel->GetCurrentContentIndex());
1373         
1374         if (!isFileExist)
1375         {
1376                 return;
1377         }
1378
1379         if (GetPlayerScreenState() == PLAYER_SCREEN_STATE_NORMAL)
1380         {
1381                 CreateOptionMenuN(source);
1382                 SetOptionMenuItem(CONTEXT_MENU_ITEM_STYLE_SET_AS | CONTEXT_MENU_ITEM_STYLE_DETAILS | CONTEXT_MENU_ITEM_STYLE_SHARE_VIA
1383                                 | CONTEXT_MENU_ITEM_STYLE_ADD_TO_PLAYLIST | CONTEXT_MENU_ITEM_STYLE_SETTINGS);
1384         }
1385         else if ((GetPlayerScreenState() == PLAYER_SCREEN_STATE_APP_CONTROL || GetPlayerScreenState() == PLAYER_SCREEN_STATE_INVALID_CONTENT_ID))
1386         {
1387                 CreateOptionMenuN(source);
1388                 SetOptionMenuItem(CONTEXT_MENU_ITEM_STYLE_SET_AS | CONTEXT_MENU_ITEM_STYLE_DETAILS | CONTEXT_MENU_ITEM_STYLE_SHARE_VIA);
1389         }
1390
1391         AppLogDebug("EXIT");
1392 }
1393
1394 void
1395 PlayerForm::OnSceneActivatedN(const Tizen::Ui::Scenes::SceneId& previousSceneId,
1396                                         const Tizen::Ui::Scenes::SceneId& currentSceneId,
1397                                         Tizen::Base::Collection::IList* pArgs)
1398 {
1399         AppLogDebug("ENTER");
1400         MusicPlayerApp* pMusicPlayerApp = static_cast<MusicPlayerApp*>(MusicPlayerApp::GetInstance());
1401         TryReturnVoid(pMusicPlayerApp != null, "Unable to cast UiApp to MusicPlayerApp");
1402         /* Comment out this code temporarily in 2.0. This will be supported in 2.1.
1403         SetKeyCapture(KEY_SIDE_UP);
1404         SetKeyCapture(KEY_SIDE_DOWN);
1405         */
1406
1407
1408         SetFocus();
1409         __pPlayerPresentationModel->AddMusicPlayerEventListener(*this);
1410
1411         if (pArgs != null)
1412         {
1413                 if (IsFailed(__pPlayerPresentationModel->SetContentList(pArgs)))
1414                 {
1415                         AppLogDebug("__pPlayerPresentationModel->SetContentList failed(%s)", GetErrorMessage(GetLastResult()));
1416                         SetPlayerScreenState(PLAYER_SCREEN_STATE_NO_CONTENT_LIST);
1417
1418                         pArgs->RemoveAll();
1419                         delete pArgs;
1420                         return;
1421                 }
1422
1423                 if (!static_cast<String*>(pArgs->GetAt(0))->Equals(MUSIC, false))
1424                 {
1425                         SetPlayerScreenState(PLAYER_SCREEN_STATE_APP_CONTROL);
1426                 }
1427                 else
1428                 {
1429                         if (GetPlayerScreenState() == PLAYER_SCREEN_STATE_APP_CONTROL)
1430                         {
1431                                 if (__pPlayerPresentationModel->IsDuringCall())
1432                                 {
1433                                         SetPlayerScreenState(PLAYER_SCREEN_STATE_DURING_CALL);
1434                                 }
1435                                 else
1436                                 {
1437                                         SetPlayerScreenState(PLAYER_SCREEN_STATE_NORMAL);
1438                                 }
1439                         }
1440                 }
1441
1442                 __pPlayerPresentationModel->Play(static_cast<Integer*>(pArgs->GetAt(1))->ToInt(), MIN_PLAY_STATE_SLIDER_COUNT);
1443                 SetFileNotExistState(__pPlayerPresentationModel->IsFileExist(__pPlayerPresentationModel->GetCurrentContentIndex()));
1444                 SetRepeatButtonImage(__pPlayerPresentationModel->GetRepeatState());// 0 - 2 (OFF, ONE, ALL)
1445                 SetShuffleButtonImage(__pPlayerPresentationModel->IsShuffleEnable());// 0 - 1 (OFF, ON)
1446                 TogglePlayPauseImage(__pPlayerPresentationModel->GetPlayerState());
1447
1448                 if (__pContentsListViewPanel != null && __pContentsListViewPanel->GetShowState())
1449                 {
1450                         TableView* pContentsTableView = static_cast<TableView*>(__pContentsListViewPanel->GetControl(IDC_CONTENTS_TABLEVIEW));
1451
1452                         if (pContentsTableView != null)
1453                         {
1454                                 pContentsTableView->UpdateTableView();
1455                         }
1456                 }
1457
1458                 __isRunByAppControl = false;
1459
1460                         pArgs->RemoveAll(true);
1461                 delete pArgs;
1462         }
1463         else
1464         {
1465                 TableView* pContentsTableView = null;
1466                 PlayerState playerState = __pPlayerPresentationModel->GetPlayerState();
1467
1468                 if (playerState != PLAYER_STATE_PAUSED
1469                                 && playerState != PLAYER_STATE_PLAYING
1470                                 && __pPlayerPresentationModel->GetContentListCount() == INIT_VALUE)
1471                 {
1472                         playerState = PLAYER_STATE_ERROR;
1473                 }
1474
1475                 SetContentInfo( __pPlayerPresentationModel->GetCurrentContentIndex());
1476                 OnPlayTimeChanged(__pPlayerPresentationModel->GetCurrentDuration(), __pPlayerPresentationModel->GetPlayPosition());
1477                 OnPlayStateChanged(playerState);
1478
1479                 if (GetPlayerScreenState() == PLAYER_SCREEN_STATE_DURING_CALL
1480                                 && playerState != PLAYER_STATE_ERROR
1481                                 && __pPlayerPresentationModel->IsDuringCall() == false)
1482                 {
1483                         SetPlayerScreenState(__playerScreenStateBeforeCall);
1484                 }
1485                 else if (__pPlayerPresentationModel->IsDuringCall())
1486                 {
1487                         SetPlayerScreenState(PLAYER_SCREEN_STATE_DURING_CALL);
1488                 }
1489
1490                 SetFileNotExistState(__pPlayerPresentationModel->IsFileExist(__pPlayerPresentationModel->GetCurrentContentIndex()));
1491                 pContentsTableView = static_cast<TableView*>(__pContentsListViewPanel->GetControl(IDC_CONTENTS_TABLEVIEW));
1492
1493                 if (pContentsTableView != null)
1494                 {
1495                         pContentsTableView->UpdateTableView();
1496                 }
1497         }
1498
1499         Invalidate(true);
1500         AppLogDebug("EXIT");
1501 }
1502
1503 void
1504 PlayerForm::OnSceneDeactivated(const Tizen::Ui::Scenes::SceneId& currentSceneId,
1505                                                                                         const Tizen::Ui::Scenes::SceneId& nextSceneId)
1506 {
1507         AppLogDebug("ENTER");
1508         CancelAllThumbnailRequest();
1509         __pPlayerPresentationModel->RemoveMusicPlayerEventListener(*this);
1510
1511         if (__pVolumePanel != null && __pVolumePanel->GetShowState())
1512         {
1513                 __pVolumePanel->SetShowState(false);
1514         }
1515         AppLogDebug("EXIT");
1516 }
1517
1518 void
1519 PlayerForm::OnChangedContentListByAppControlN(Tizen::Base::Collection::IList* pArgs)
1520 {
1521         AppLogDebug("ENTER");
1522         MusicPlayerApp* pMusicPlayerApp = static_cast<MusicPlayerApp*>(MusicPlayerApp::GetInstance());
1523         TryReturnVoid(pMusicPlayerApp != null, "Unable to cast UiApp to MusicPlayerApp");
1524
1525         if (pArgs == null || static_cast<String*>(pArgs->GetAt(0))->Equals(MUSIC, false))
1526         {
1527                 AppLogDebug("EXIT(E_FAILURE)");
1528                 if (pArgs != null)
1529                 {
1530                         pArgs->RemoveAll();
1531                         delete pArgs;
1532                 }
1533                 return;
1534         }
1535
1536         result r = __pPlayerPresentationModel->SetContentList(pArgs);
1537         if (IsFailed(r))
1538         {
1539                 AppLogDebug("EXIT(%s)", GetErrorMessage(r));
1540                 SetPlayerScreenState(PLAYER_SCREEN_STATE_NO_CONTENT_LIST);
1541                 pArgs->RemoveAll();
1542                 delete pArgs;
1543
1544                 return;
1545         }
1546
1547         SetPlayerScreenState(PLAYER_SCREEN_STATE_APP_CONTROL);
1548         int playIndex = (static_cast<Integer*>(pArgs->GetAt(1)))->ToInt();
1549         __pPlayerPresentationModel->Play(playIndex, MIN_PLAY_STATE_SLIDER_COUNT);
1550
1551
1552         TableView* pContentsTableView = static_cast<TableView*>(__pContentsListViewPanel->GetControl(IDC_CONTENTS_TABLEVIEW));
1553         if (pContentsTableView != null)
1554         {
1555                 pContentsTableView->UpdateTableView();
1556         }
1557
1558         pArgs->RemoveAll();
1559         delete pArgs;
1560
1561         Invalidate(true);
1562         AppLogDebug("EXIT");
1563 }
1564
1565 void
1566 PlayerForm::OnUserEventReceivedN(RequestId requestId, Tizen::Base::Collection::IList* pArgs)
1567 {
1568         AppLogDebug("ENTER");
1569         AppLogDebug("OnUserEventReceivedN %d", requestId);
1570         if (requestId == ID_DESTORY_PLAY_LIST_PICKER_POPUP || requestId == ID_DESTORY_SHARE_POPUP)
1571         {
1572                 RemovePlayListPicker();
1573                 RemoveSharePicker();
1574         }
1575
1576         if (requestId == ID_SHOW_SUCCESS_MESSAGE)
1577         {
1578                 MessageBox messageBox;
1579                 messageBox.Construct(L"", ResourceManager::GetString(L"IDS_COM_POP_SUCCESS"),
1580                                 MSGBOX_STYLE_OK,
1581                                 COUNT_MESSAGE_BOX_TIMEOUT);
1582                 int modalResult = 0;
1583                 messageBox.ShowAndWait(modalResult);
1584         }
1585
1586         if (pArgs != null)
1587         {
1588                 pArgs->RemoveAll(true);
1589                 delete pArgs;
1590         }
1591         AppLogDebug("EXIT");
1592 }
1593
1594 void
1595 PlayerForm::OnPlayStateChanged(PlayerState playerState)
1596 {
1597         AppLogDebug("ENTER");
1598         AppLogDebug("%d", playerState);
1599
1600         if (playerState == PLAYER_STATE_ERROR)
1601         {
1602                 MusicPlayerApp* pApp = static_cast<MusicPlayerApp*>(App::GetInstance());
1603                 RemoveOptionMenu();
1604                 SetContentInfo( __pPlayerPresentationModel->GetCurrentContentIndex());
1605
1606                 if (__pPlayerPresentationModel->IsDuringCall())
1607                 {
1608                         SetPlayerScreenState(PLAYER_SCREEN_STATE_DURING_CALL);
1609                 }
1610                 else
1611                 {
1612                         SetPlayerScreenState(PLAYER_SCREEN_STATE_ERROR_CONTENT);
1613                 }
1614
1615                 __pMsgShowTimer->Cancel();
1616                 __pMsgShowTimer->Start(10);
1617
1618                 if (pApp != null && pApp->GetRequestId() != null)
1619                 {
1620                         AppControlProviderManager::GetInstance()->SendAppControlResult(pApp->GetRequestId(),APP_CTRL_RESULT_FAILED,null);
1621                         pApp->ResetRequestId();
1622                 }
1623         }
1624
1625         else if (playerState == PLAYER_STATE_PAUSED)
1626         {
1627                 if (__pPlayerPresentationModel->IsDuringCall() == true)
1628                 {
1629                         SetPlayerScreenState(PLAYER_SCREEN_STATE_DURING_CALL);
1630                 }
1631         }
1632         else if(playerState == PLAYER_STATE_PLAYING && GetPlayerScreenState() != PLAYER_SCREEN_STATE_APP_CONTROL)
1633         {
1634                 SetPlayerScreenState(PLAYER_SCREEN_STATE_NORMAL);
1635         }
1636
1637         TogglePlayPauseImage(playerState);
1638         AppLogDebug("EXIT");
1639 }
1640
1641 void
1642 PlayerForm::OnPlayContentChanged(int currentContentIndex)
1643 {
1644         AppLogDebug("ENTER");
1645         String* pCurrentPlayConent = __pPlayerPresentationModel->GetPlayContentPath();
1646         String* pContentPath = __pPlayerPresentationModel->GetContentPath(__pPlayerPresentationModel->GetCurrentContentIndex());
1647
1648         if (!pContentPath->Equals(*pCurrentPlayConent,true) || !__pPlayerPresentationModel->IsDuringCall())
1649         {
1650                 SetContentInfo(currentContentIndex);
1651                 RemoveOptionMenu();
1652                 RemoveSetAsPicker();
1653                 RemoveSharePicker();
1654                 RemovePlayListPicker();
1655                 SetFileNotExistState(__pPlayerPresentationModel->IsFileExist(currentContentIndex));
1656         }
1657
1658         if ( __pPlayerPresentationModel->IsDuringCall())
1659         {
1660                 SetPlayerScreenState(PLAYER_SCREEN_STATE_DURING_CALL);
1661         }
1662         else if (__playerScreenState == PLAYER_SCREEN_STATE_DURING_CALL)
1663         {
1664                 SetPlayerScreenState(__playerScreenStateBeforeCall);
1665         }
1666
1667         AppLogDebug("EXIT");
1668 }
1669
1670 void
1671 PlayerForm::OnPlayContentRemoved(int removedContentIndex)
1672 {
1673         AppLogDebug("ENTER");
1674         int currentIndex = __pPlayerPresentationModel->GetCurrentContentIndex();
1675         int currentContentCount = __pPlayerPresentationModel->GetContentListCount();
1676
1677         if ((removedContentIndex == currentIndex - 1)
1678                 || (currentIndex == 0 && removedContentIndex == 0)
1679                 || (currentIndex == removedContentIndex)
1680                 || (currentIndex == __pPlayerPresentationModel->GetPreviousContentIndex()))
1681         {
1682                 UpdateAnimationAlbumArt(ALBUM_ART_IMAGE_PREVIOUS);
1683         }
1684         else if ((removedContentIndex == currentIndex + 1)
1685                         || (currentIndex == currentContentCount - 1 && removedContentIndex == 0))
1686         {
1687                 UpdateAnimationAlbumArt(ALBUM_ART_IMAGE_NEXT);
1688         }
1689         AppLogDebug("EXIT");
1690 }
1691
1692 void
1693 PlayerForm::OnPlayVolumeBarStateChanged(void)
1694 {
1695         AppLogDebug("ENTER");
1696         if (__pVolumePanel->GetShowState() == true)
1697         {
1698                 __pVolumePanel->SetShowState(false);
1699         }
1700         AppLogDebug("EXIT");
1701 }
1702
1703 void
1704 PlayerForm::OnPlayTimeChanged(const Tizen::Base::String& currentDuration, int currentPosition)
1705 {
1706 //      AppLogDebug("ENTER");
1707         if (__playPosition == -1)
1708         {
1709                 __pCurrentTimeLabel->SetText(currentDuration);
1710                 __pPlayStateSlider->SetValue(currentPosition);
1711                 __pCurrentTimeLabel->Draw();
1712                 __pCurrentTimeLabel->Show();
1713                 __pPlayStateSlider->Draw();
1714                 __pPlayStateSlider->Show();
1715         }
1716 //      AppLogDebug("EXIT");
1717 }
1718
1719 void
1720 PlayerForm::OnAutoOffTimeChanged(int autoOffTime)
1721 {
1722 //      AppLogDebug("ENTER");
1723         __pPlayerPresentationModel->StartAutoOffTimer(autoOffTime);
1724 //      AppLogDebug("EXIT");
1725 }
1726
1727 void
1728 PlayerForm::OnPlayPresentationModelDestroying(void)
1729 {
1730         AppLogDebug("ENTER");
1731         if (__pPlayerPresentationModel != null)
1732         {
1733                 __pPlayerPresentationModel = null;
1734         }
1735         AppLogDebug("EXIT");
1736 }
1737
1738 result
1739 PlayerForm::ShowMessageBox(const Tizen::Base::String& showText)
1740 {
1741         AppLogDebug("ENTER");
1742         MessageBox messageBox;
1743         messageBox.Construct(L"Error", showText, MSGBOX_STYLE_NONE, 3000);
1744         int modalResult = 0;
1745         messageBox.ShowAndWait(modalResult);
1746
1747 //      SceneManager* pSceneManager = SceneManager::GetInstance();
1748 //      AppAssert(pSceneManager);
1749 //      if (static_cast<MusicPlayerApp*>(MusicPlayerApp::GetInstance())->GetOperationId().Equals(TIZEN_APPCONTROL_OPERATION_PLAY, true)
1750 //              || static_cast<MusicPlayerApp*>(MusicPlayerApp::GetInstance())->GetOperationId().Equals(TIZEN_APPCONTROL_OPERATION_VIEW, true))
1751 //      {
1752 //              UiApp* pApp = UiApp::GetInstance();
1753 //              pApp->Terminate();
1754 //      }
1755 //      else
1756         {
1757 //              if (pSceneManager->IsSceneAlive(IDSCN_ALL_LIST))
1758 //              {
1759 //                      pSceneManager->GoBackward(BackwardSceneTransition());
1760 //              }
1761 //              else
1762 //              {
1763 //                      UiApp* pApp = UiApp::GetInstance();
1764 //                      pApp->Terminate();
1765 //              }
1766         }
1767         AppLogDebug("EXIT");
1768         return E_SUCCESS;
1769 }
1770
1771 void
1772 PlayerForm::SetContentInfo(int currentContentIndex)
1773 {
1774         AppLogDebug("ENTER");
1775         ContentInformation* pContentInfoStruct = __pPlayerPresentationModel->GetContentInfoN(currentContentIndex);
1776         TryReturnVoid(pContentInfoStruct != null, "The currentContentIndex is invalid");
1777
1778         __pTitleName->SetText(pContentInfoStruct->TitleName);
1779         __pArtistName->SetText(pContentInfoStruct->ArtistName);
1780
1781         __pPlayStateSlider->SetRange(MIN_PLAY_STATE_SLIDER_COUNT, MAX_PLAY_STATE_SLIDER_COUNT);
1782         Invalidate(true);
1783
1784         String totalTime = CommonUtil::GetFormatDate(pContentInfoStruct->Duration);
1785         if (totalTime.Equals(INITIAL_TIME, true) != true)
1786         {
1787                 __pTotalTimeLabel->SetText(totalTime);
1788         }
1789         else
1790         {
1791                 __pTotalTimeLabel->SetText(INITIAL_TIME);
1792         }
1793
1794         if (pContentInfoStruct->contentId.ToString().Equals(INVALID_VALUE_OF_CONTENT_ID, true))
1795         {
1796                 SetPlayerScreenState(PLAYER_SCREEN_STATE_INVALID_CONTENT_ID);
1797         }
1798 /*      else
1799         {
1800                 if (__pPlayerPresentationModel->GetPlayerState() != PLAYER_STATE_ERROR)
1801                 {
1802                         if (__pPlayStateSlider->IsEnabled() != true)
1803                         {
1804                                 __pPlayStateSlider->SetEnabled(true);
1805                         }
1806                         SetFileNotExistState(true);
1807                 }
1808         }*/
1809         delete pContentInfoStruct;
1810
1811         UpdateAnimationAlbumArt(ALBUM_ART_IMAGE_CURRENT);
1812         Invalidate(true);
1813         AppLogDebug("EXIT");
1814 }
1815
1816 void
1817 PlayerForm::UpdateAnimationAlbumArt(AlbumArtImage position)
1818 {
1819         AppLogDebug("ENTER");
1820         Bitmap* pAlbumArtBitmap[ALBUM_ART_IMAGE_COUNT] = {null, };
1821         FloatDimension floatDimension = static_cast<Label*>(__pContentsAlbumViewPanel->GetControl(IDC_CONTENTS_THUMBNAIL))->GetSizeF();
1822
1823         switch (position)
1824         {
1825         case ALBUM_ART_IMAGE_CURRENT:
1826                 {
1827                         pAlbumArtBitmap[ALBUM_ART_IMAGE_CURRENT] = __pPlayerPresentationModel->GetContentAlbumArtN(__pPlayerPresentationModel->GetCurrentContentIndex());
1828
1829                         if (pAlbumArtBitmap[ALBUM_ART_IMAGE_CURRENT] != null)
1830                         {
1831                                 pAlbumArtBitmap[ALBUM_ART_IMAGE_CURRENT]->Scale(floatDimension);
1832                         }
1833                         pAlbumArtBitmap[ALBUM_ART_IMAGE_PREVIOUS] = __pPlayerPresentationModel->GetContentAlbumArtN(__pPlayerPresentationModel->GetPreviousContentIndex());
1834
1835                         if (pAlbumArtBitmap[ALBUM_ART_IMAGE_PREVIOUS] != null)
1836                         {
1837                                 pAlbumArtBitmap[ALBUM_ART_IMAGE_PREVIOUS]->Scale(floatDimension);
1838                         }
1839                         pAlbumArtBitmap[ALBUM_ART_IMAGE_NEXT] = __pPlayerPresentationModel->GetContentAlbumArtN(__pPlayerPresentationModel->GetNextContentIndex());
1840
1841                         if (pAlbumArtBitmap[ALBUM_ART_IMAGE_NEXT] != null)
1842                         {
1843                                 pAlbumArtBitmap[ALBUM_ART_IMAGE_NEXT]->Scale(floatDimension);
1844                         }
1845                 }
1846                 break;
1847
1848         case ALBUM_ART_IMAGE_PREVIOUS:
1849                 {
1850                         pAlbumArtBitmap[ALBUM_ART_IMAGE_CURRENT] = null;
1851                         pAlbumArtBitmap[ALBUM_ART_IMAGE_PREVIOUS] = __pPlayerPresentationModel->GetContentAlbumArtN(__pPlayerPresentationModel->GetPreviousContentIndex());
1852                         if (pAlbumArtBitmap[ALBUM_ART_IMAGE_PREVIOUS] != null)
1853                         {
1854                                 pAlbumArtBitmap[ALBUM_ART_IMAGE_PREVIOUS]->Scale(floatDimension);
1855                         }
1856                         pAlbumArtBitmap[ALBUM_ART_IMAGE_NEXT] = null;
1857                 }
1858                 break;
1859
1860         case ALBUM_ART_IMAGE_NEXT:
1861                 {
1862                         pAlbumArtBitmap[ALBUM_ART_IMAGE_CURRENT] = null;
1863                         pAlbumArtBitmap[ALBUM_ART_IMAGE_PREVIOUS] = null;
1864                         pAlbumArtBitmap[ALBUM_ART_IMAGE_NEXT] = __pPlayerPresentationModel->GetContentAlbumArtN(__pPlayerPresentationModel->GetNextContentIndex());
1865                         if (pAlbumArtBitmap[ALBUM_ART_IMAGE_NEXT] != null)
1866                         {
1867                                 pAlbumArtBitmap[ALBUM_ART_IMAGE_NEXT]->Scale(floatDimension);
1868                         }
1869                 }
1870                 break;
1871
1872         default:
1873                 break;
1874         }
1875
1876         if (pAlbumArtBitmap[ALBUM_ART_IMAGE_CURRENT] != null)
1877         {
1878                 Canvas* pCanvas = __pAlbumArtElement[ALBUM_ART_IMAGE_CURRENT]->GetCanvasN();
1879                 if (pCanvas)
1880                 {
1881                         pCanvas->Clear();
1882                         Point point(INIT_VALUE, INIT_VALUE);
1883                         pCanvas->DrawBitmap(point, *pAlbumArtBitmap[ALBUM_ART_IMAGE_CURRENT]);
1884                         delete pCanvas;
1885                 }
1886                 delete pAlbumArtBitmap[ALBUM_ART_IMAGE_CURRENT];
1887         }
1888
1889         if (pAlbumArtBitmap[ALBUM_ART_IMAGE_PREVIOUS] != null)
1890         {
1891                 Canvas* pCanvas = __pAlbumArtElement[ALBUM_ART_IMAGE_PREVIOUS]->GetCanvasN();
1892                 if (pCanvas)
1893                 {
1894                         pCanvas->Clear();
1895                         Point point(INIT_VALUE, INIT_VALUE);
1896                         pCanvas->DrawBitmap(point, *pAlbumArtBitmap[ALBUM_ART_IMAGE_PREVIOUS]);
1897                         delete pCanvas;
1898                 }
1899                 delete pAlbumArtBitmap[ALBUM_ART_IMAGE_PREVIOUS];
1900         }
1901
1902         if (pAlbumArtBitmap[ALBUM_ART_IMAGE_NEXT] != null)
1903         {
1904                 Canvas* pCanvas = __pAlbumArtElement[ALBUM_ART_IMAGE_NEXT]->GetCanvasN();
1905                 if (pCanvas)
1906                 {
1907                         pCanvas->Clear();
1908                         Point point(INIT_VALUE, INIT_VALUE);
1909                         pCanvas->DrawBitmap(point, *pAlbumArtBitmap[ALBUM_ART_IMAGE_NEXT]);
1910                         delete pCanvas;
1911                 }
1912                 delete pAlbumArtBitmap[ALBUM_ART_IMAGE_NEXT];
1913         }
1914         AppLogDebug("EXIT");
1915         return;
1916 }
1917
1918 void
1919 PlayerForm::SetRepeatButtonImage(int repeatValue)// 0 - 2 (OFF, ONE, ALL)
1920 {
1921         AppLogDebug("ENTER");
1922         Bitmap* pOptionRepeatBitmap;
1923         Bitmap* pOptionRepeatPressBitmap;
1924
1925         switch (repeatValue)
1926         {
1927         case 0:
1928                 {
1929                         pOptionRepeatBitmap = ResourceManager::GetBitmapN(L"T02_option_rep_A.png");
1930                         pOptionRepeatPressBitmap = ResourceManager::GetBitmapN(L"T02_option_rep_A_press.png");
1931                 }
1932                 break;
1933
1934         case 1:
1935                 {
1936                         pOptionRepeatBitmap = ResourceManager::GetBitmapN(L"T02_option_rep_1.png");
1937                         pOptionRepeatPressBitmap = ResourceManager::GetBitmapN(L"T02_option_rep_1_press.png");
1938                 }
1939                 break;
1940
1941         case 2:
1942                 {
1943                         pOptionRepeatBitmap = ResourceManager::GetBitmapN(L"T02_option_rep_all.png");
1944                         pOptionRepeatPressBitmap = ResourceManager::GetBitmapN(L"T02_option_rep_all_press.png");
1945                 }
1946                 break;
1947
1948         default:
1949                 break;
1950         }
1951         __pRepeatButton->SetNormalBitmap(Point(INIT_VALUE, INIT_VALUE), *pOptionRepeatBitmap);
1952         __pRepeatButton->SetPressedBitmap(Point(INIT_VALUE, INIT_VALUE), *pOptionRepeatPressBitmap);
1953         __pRepeatButton->Invalidate(true);
1954         __pPlayerPresentationModel->SetRepeatMode(repeatValue);
1955
1956         delete pOptionRepeatBitmap;
1957         pOptionRepeatBitmap = null;
1958         delete pOptionRepeatPressBitmap;
1959         pOptionRepeatPressBitmap = null;
1960         AppLogDebug("EXIT");
1961 }
1962
1963 void
1964 PlayerForm::SetShuffleButtonImage(bool shuffleEnable)
1965 {
1966         AppLogDebug("ENTER");
1967         Bitmap* pOptionShuffleBitmap;
1968
1969         if (shuffleEnable == false)
1970         {
1971                 pOptionShuffleBitmap = ResourceManager::GetBitmapN(L"T02_option_shuffle_on_dim.png");
1972         }
1973         else
1974         {
1975                 pOptionShuffleBitmap = ResourceManager::GetBitmapN(L"T02_option_shuffle_on.png");
1976         }
1977
1978         __pShuffleButton->SetNormalBitmap(Point(INIT_VALUE, INIT_VALUE), *pOptionShuffleBitmap);
1979         __pShuffleButton->Invalidate(true);
1980         __pPlayerPresentationModel->SetShuffleEnable(shuffleEnable);
1981         UpdateAnimationAlbumArt(ALBUM_ART_IMAGE_CURRENT);
1982
1983         delete pOptionShuffleBitmap;
1984         pOptionShuffleBitmap = null;
1985         AppLogDebug("EXIT");
1986 }
1987
1988 void
1989 PlayerForm::SetFileNotExistState(bool isFileExist)
1990 {
1991         AppLogDebug("ENTER");
1992         if (!isFileExist)
1993         {
1994                 RemoveOptionMenu();
1995         }
1996
1997         if(GetPlayerScreenState() != PLAYER_SCREEN_STATE_DURING_CALL &&
1998                         GetPlayerScreenState() != PLAYER_SCREEN_STATE_ERROR_CONTENT)
1999         {
2000                 __pContentsViewToggleButton->SetEnabled(isFileExist);
2001                 __pContentsViewToggleButton->Invalidate(true);
2002                 __pShuffleButton->SetEnabled(isFileExist);
2003                 __pShuffleButton->Invalidate(true);
2004         }
2005
2006         AppLogDebug("EXIT");
2007 }
2008
2009 void
2010 PlayerForm::TogglePlayPauseImage(PlayerState playerState)
2011 {
2012         AppLogDebug("ENTER");
2013         if (playerState == PLAYER_STATE_PLAYING)
2014         {
2015                 RelativeLayout* layout = dynamic_cast<RelativeLayout*>(__pContentsAlbumViewPanel->GetLayoutN());
2016                 if (layout != null)
2017                 {
2018                         layout->ResetCenterAligned(*static_cast<Label*>(__pContentsAlbumViewPanel->GetControl(IDC_ALBUM_THUMBANIL_BACKGROUND)), CENTER_ALIGN_HORIZONTAL);
2019                         delete layout;
2020                 }
2021
2022                 static_cast<Label*>(__pContentsAlbumViewPanel->GetControl(IDC_ALBUM_TURN_TABLE))->SetShowState(true);
2023                 SetPauseButtonImage();
2024         }
2025         else
2026         {
2027                 RelativeLayout* layout = dynamic_cast<RelativeLayout*>(__pContentsAlbumViewPanel->GetLayoutN());
2028                 if (layout != null)
2029                 {
2030                         layout->SetCenterAligned(*static_cast<Label*>(__pContentsAlbumViewPanel->GetControl(IDC_ALBUM_THUMBANIL_BACKGROUND)), CENTER_ALIGN_HORIZONTAL);
2031                         delete layout;
2032                 }
2033
2034                 static_cast<Label*>(__pContentsAlbumViewPanel->GetControl(IDC_ALBUM_TURN_TABLE))->SetShowState(false);
2035                 SetPlayButtonImage();
2036         }
2037
2038         if (__pContentsAlbumViewPanel->GetShowState() == true)
2039         {
2040                 __pContentsAlbumViewPanel->Invalidate(true);
2041         }
2042         AppLogDebug("EXIT");
2043 }
2044 void
2045 PlayerForm::SetPlayButtonImage(void)
2046 {
2047         AppLogDebug("ENTER");
2048         Point point(INIT_VALUE, INIT_VALUE);
2049         Bitmap* pBitmap = ResourceManager::GetBitmapN(IDB_PLAY_BUTTON_ICON_NORMAL);
2050         __pPlayPauseButton->SetNormalBitmap(point, *pBitmap);
2051         delete pBitmap;
2052
2053         pBitmap = ResourceManager::GetBitmapN(IDB_PLAY_BUTTON_ICON_PRESSED);
2054         __pPlayPauseButton->SetPressedBitmap(point, *pBitmap);
2055         delete pBitmap;
2056
2057         pBitmap = ResourceManager::GetBitmapN(IDB_PLAY_BUTTON_ICON_DISABLED);
2058         __pPlayPauseButton->SetDisabledBitmap(point, *pBitmap);
2059         delete pBitmap;
2060
2061         __pPlayPauseButton->SetActionId(IDA_PLAYER_CONTROLLER_PLAY);
2062         __pPlayPauseButton->Invalidate(true);
2063         AppLogDebug("EXIT");
2064 }
2065
2066 void
2067 PlayerForm::SetPauseButtonImage(void)
2068 {
2069         AppLogDebug("ENTER");
2070         Point point(INIT_VALUE, INIT_VALUE);
2071         Bitmap* pBitmap = ResourceManager::GetBitmapN(IDB_PAUSE_BUTTON_ICON_NORMAL);
2072         __pPlayPauseButton->SetNormalBitmap(point, *pBitmap);
2073         delete pBitmap;
2074
2075         pBitmap = ResourceManager::GetBitmapN(IDB_PAUSE_BUTTON_ICON_PRESSED);
2076         __pPlayPauseButton->SetPressedBitmap(point, *pBitmap);
2077         delete pBitmap;
2078
2079         pBitmap = ResourceManager::GetBitmapN(IDB_PAUSE_BUTTON_ICON_DISABLED);
2080         __pPlayPauseButton->SetDisabledBitmap(point, *pBitmap);
2081         delete pBitmap;
2082
2083         __pPlayPauseButton->SetActionId(IDA_PLAYER_CONTROLLER_PAUSE);
2084         __pPlayPauseButton->Invalidate(true);
2085         AppLogDebug("EXIT");
2086 }
2087
2088 result
2089 PlayerForm::InitializeVolumeBar(void)
2090 {
2091         AppLogDebug("ENTER");
2092         int MediaSoundVolume = 0;
2093         SettingInfo::GetValue(MEDIA_VOLUME, MediaSoundVolume);
2094         __pPlayerPresentationModel->SetVolume(MediaSoundVolume);
2095
2096         __pVolumePanel = new (std::nothrow) Panel();
2097         __pVolumeSlider = new (std::nothrow) Slider();
2098         OrientationStatus orientationStatue = GetOrientationStatus();
2099         Rectangle clientBounds = GetClientAreaBounds();
2100         Rectangle bounds = GetBounds();
2101         RelativeLayout layout;
2102         layout.Construct();
2103
2104         if (orientationStatue == ORIENTATION_STATUS_LANDSCAPE
2105                 || orientationStatue == ORIENTATION_STATUS_LANDSCAPE_REVERSE)
2106         {
2107                 AppLogDebug("CHECK %d", clientBounds.width);
2108                 if (clientBounds.width > 1200)
2109                 {
2110                         __pVolumePanel->Construct(layout, Rectangle(clientBounds.width - W_HORIZONTAL_PLAYER
2111                                                                         , GetClientAreaBounds().height - H_HORIZONTAL_CONTROLLER_PANEL - H_VOLUME_PANEL - 50
2112                                                                         , W_HORIZONTAL_PLAYER
2113                                                                         , H_VOLUME_PANEL));
2114                 }
2115                 else
2116                 {
2117                         __pVolumePanel->Construct(layout, Rectangle(clientBounds.width - 670
2118                                                                         , GetClientAreaBounds().height - H_HORIZONTAL_CONTROLLER_PANEL - H_VOLUME_PANEL - 50
2119                                                                         , 680
2120                                                                         , H_VOLUME_PANEL));
2121                 }
2122         }
2123         else if (orientationStatue == ORIENTATION_STATUS_PORTRAIT
2124                         || orientationStatue == ORIENTATION_STATUS_PORTRAIT_REVERSE)
2125         {
2126                 __pVolumePanel->Construct(layout, Rectangle(0
2127                                                                 , clientBounds.height - H_CONTROLLER_PANEL - H_VOLUME_PANEL - 50
2128                                                                 , clientBounds.width
2129                                                                 , H_VOLUME_PANEL));
2130         }
2131
2132         if (clientBounds.width > 1200)
2133         {
2134                 __pVolumeSlider->Construct(Rectangle(0
2135                                                                 , 0, W_HORIZONTAL_PLAYER, H_VOLUME_PANEL)
2136                                                                 , BACKGROUND_STYLE_NONE
2137                                                                 , false
2138                                                                 , MIN_VOLUME_SLIDER_COUNT
2139                                                                 , MAX_VOLUME_SLIDER_COUNT
2140                                                                 , GROUP_STYLE_NONE);
2141         }
2142         else
2143         {
2144                 __pVolumeSlider->Construct(Rectangle(0
2145                                                                 , 0, 680, H_VOLUME_PANEL)
2146                                                                 , BACKGROUND_STYLE_NONE
2147                                                                 , false
2148                                                                 , MIN_VOLUME_SLIDER_COUNT
2149                                                                 , MAX_VOLUME_SLIDER_COUNT
2150                                                                 , GROUP_STYLE_NONE);
2151         }
2152
2153         __pVolumeSlider->SetColor(TRANSPARENT_COLOR);
2154         AddControl(__pVolumePanel);
2155         __pVolumePanel->AddControl(__pVolumeSlider);
2156         CommonUtil::SetLayoutFitToContainer(*__pVolumePanel, *__pVolumeSlider);
2157
2158         Bitmap* pVolumeLeftIconBitmap = ResourceManager::GetBitmapN(L"T02_volume_icon_01.png");
2159         Bitmap* pVolumeRightIconBitmap = ResourceManager::GetBitmapN(L"T02_volume_icon_02.png");
2160
2161         __pVolumeSlider->SetThumbBitmap(SLIDER_THUMB_STATUS_NORMAL, *ResourceManager::GetBitmapN(L"T02_player_progress_handle.png"));
2162         __pVolumeSlider->SetThumbBitmap(SLIDER_THUMB_STATUS_PRESSED, *ResourceManager::GetBitmapN(L"T02_player_progress_handle_press.png"));
2163         __pVolumeSlider->SetThumbTextColor(SLIDER_THUMB_STATUS_NORMAL, Color(255, 255, 255, 0));
2164         __pVolumeSlider->SetThumbTextColor(SLIDER_THUMB_STATUS_PRESSED, Color(255, 255, 255, 0));
2165
2166         __pVolumeSlider->SetIcon(ICON_POSITION_LEFT, *pVolumeLeftIconBitmap);
2167         __pVolumeSlider->SetIcon(ICON_POSITION_RIGHT, *pVolumeRightIconBitmap);
2168         __pVolumeSlider->SetValue(__pPlayerPresentationModel->GetVolume());
2169         __pVolumeSlider->AddSliderEventListener(*this);
2170
2171         delete pVolumeLeftIconBitmap;
2172         pVolumeLeftIconBitmap = null;
2173         delete pVolumeRightIconBitmap;
2174         pVolumeRightIconBitmap = null;
2175
2176         return E_SUCCESS;
2177 }
2178
2179 result
2180 PlayerForm::CreateTableViewItem(Tizen::Ui::Container& parent,
2181                                                 const ContentInformation& contentInfoStruct)
2182 {
2183         AppLogDebug("ENTER");
2184         Panel* pTableViewItem = new (std::nothrow) Panel();
2185
2186         if (__fontSizeValue.Equals(STRING_FONT_SIZE_GIANT, false))
2187         {
2188                 if (IsFailed(pTableViewItem->Construct(IDL_CONTENTS_LIBARY_ITEM_PANEL_FONT_SIZE_GIANT)))
2189                 {
2190                         AppLogDebug("Construct(IDL_CONTENTS_LIBARY_ITEM_PANEL) failed(%s)", GetErrorMessage(GetLastResult()));
2191                         return E_FAILURE;
2192                 }
2193         }
2194         else if (__fontSizeValue.Equals(STRING_FONT_SIZE_HUGE, false))
2195         {
2196                 if (IsFailed(pTableViewItem->Construct(IDL_CONTENTS_LIBARY_ITEM_PANEL_FONT_SIZE_HUGE)))
2197                 {
2198                         AppLogDebug("Construct(IDL_CONTENTS_LIBARY_ITEM_PANEL) failed(%s)", GetErrorMessage(GetLastResult()));
2199                         return E_FAILURE;
2200                 }
2201         }
2202         else if (__fontSizeValue.Equals(STRING_FONT_SIZE_LARGE, false))
2203         {
2204                 if (IsFailed(pTableViewItem->Construct(IDL_CONTENTS_LIBARY_ITEM_PANEL_FONT_SIZE_LARGE)))
2205                 {
2206                         AppLogDebug("Construct(IDL_CONTENTS_LIBARY_ITEM_PANEL) failed(%s)", GetErrorMessage(GetLastResult()));
2207                         return E_FAILURE;
2208                 }
2209         }
2210         else if (__fontSizeValue.Equals(STRING_FONT_SIZE_SMALL, false))
2211         {
2212                 if (IsFailed(pTableViewItem->Construct(IDL_CONTENTS_LIBARY_ITEM_PANEL_FONT_SIZE_SMALL)))
2213                 {
2214                         AppLogDebug("Construct(IDL_CONTENTS_LIBARY_ITEM_PANEL) failed(%s)", GetErrorMessage(GetLastResult()));
2215                         return E_FAILURE;
2216                 }
2217         }
2218         else
2219         {
2220                 if (IsFailed(pTableViewItem->Construct(IDL_CONTENTS_LIBARY_ITEM_PANEL_DEFAULT)))
2221                 {
2222                         AppLogDebug("Construct(IDL_CONTENTS_LIBARY_ITEM_PANEL) failed(%s)", GetErrorMessage(GetLastResult()));
2223                         return E_FAILURE;
2224                 }
2225         }
2226
2227         static_cast<Label*>(pTableViewItem->GetControl(IDC_CONTENTS_TITLE_NAME))->SetText(contentInfoStruct.TitleName);
2228         static_cast<Label*>(pTableViewItem->GetControl(IDC_CONTENTS_ARTIST_NAME))->SetText(contentInfoStruct.ArtistName);
2229
2230         if(contentInfoStruct.contentId.ToString().Equals(INVALID_VALUE_OF_CONTENT_ID,true) && __playerScreenState == PLAYER_SCREEN_STATE_APP_CONTROL)
2231         {
2232                 Bitmap* pBmp = __pPlayerPresentationModel->GetContentAlbumArtN(__pPlayerPresentationModel->GetCurrentContentIndex());
2233                 static_cast<Label*>(pTableViewItem->GetControl(IDC_CONTENTS_THUMBNAIL))->SetBackgroundBitmap(*pBmp);
2234                 delete pBmp;
2235                 pBmp = null;
2236         }
2237         else
2238         {
2239                 static_cast<Label*>(pTableViewItem->GetControl(IDC_CONTENTS_THUMBNAIL))->SetBackgroundBitmap(*GetDefaultThumbnail());
2240         }
2241
2242 //      pTableViewItem->SetSize(parent.GetWidthF()-10,pTableViewItem->GetHeightF());
2243         parent.AddControl(pTableViewItem);
2244         CommonUtil::SetLayoutFitToContainer(parent, *pTableViewItem);
2245
2246         AppLogDebug("EXIT");
2247         return E_SUCCESS;
2248 }
2249
2250 void
2251 PlayerForm::UpdateSplitBarState(void)
2252 {
2253         AppLogDebug("ENTER");
2254         Label* pSplitBar = static_cast<Label*>(GetControl(IDC_SPLIT_BAR));
2255         if ((GetOrientationStatus() == ORIENTATION_STATUS_PORTRAIT) || (GetOrientationStatus() == ORIENTATION_STATUS_PORTRAIT_REVERSE))
2256         {
2257                 pSplitBar->SetSize(GetClientAreaBounds().width, 0);
2258         }
2259         else
2260         {
2261                 pSplitBar->SetSize(13,  GetClientAreaBounds().height);
2262         }
2263         AppLogDebug("EXIT");
2264 }
2265
2266 void
2267 PlayerForm::OnThumbnailInfoReveivedN(ThumbnailInfo* pThumbnailInfo)
2268 {
2269         AppLogDebug("ENTER");
2270         __pThumbnail = pThumbnailInfo->GetBitmapN();
2271         Object* pParam = pThumbnailInfo->GetUserParamN();
2272         if (pParam != null)
2273         {
2274                 static_cast<TableView*>(__pContentsListViewPanel->GetControl(IDC_CONTENTS_TABLEVIEW))->RefreshItem((static_cast<Integer*>(pParam))->ToInt(), TABLE_VIEW_REFRESH_TYPE_ITEM_MODIFY);
2275                 delete pParam;
2276         }
2277
2278         delete pThumbnailInfo;
2279         AppLogDebug("EXIT");
2280 }
2281
2282 void
2283 PlayerForm::OnMusicContentUpdateCompleted(void)
2284 {
2285         AppLogDebug("ENTER");
2286         RemoveOptionMenu();
2287         RemoveSharePicker();
2288         RemovePlayListPicker();
2289
2290         UiApp* pApp = UiApp::GetInstance();
2291         AppAssert(pApp);
2292
2293         if (pApp->GetAppUiState() == APP_UI_STATE_FOREGROUND)
2294         {
2295                 RemoveSetAsPicker();
2296         }
2297
2298         bool isCurrentContentModified = false;
2299
2300         if (__pPlayerPresentationModel->IsFileExist(__pPlayerPresentationModel->GetCurrentContentIndex()) != true)
2301         {
2302                 isCurrentContentModified = true;
2303                 SetFileNotExistState(false);
2304         }
2305
2306         AllListPresentationModel* pPresentationModel = AllListPresentationModel::GetInstance();
2307         if (pPresentationModel == null)
2308         {
2309                 AppLogDebug("EXIT");
2310                 return;
2311         }
2312
2313         pPresentationModel->UpdateContentList();
2314         IList* pList = pPresentationModel->GetContentListN();
2315
2316         if (pList == null || pList->GetCount() == INIT_VALUE)
2317         {
2318                 AppLogDebug("EXIT");
2319                 delete pList;
2320                 return;
2321         }
2322
2323         String* pPlayContentPath = __pPlayerPresentationModel->GetPlayContentPath();
2324         int iContentListCount = __pPlayerPresentationModel->GetContentListCount();
2325         for (int iCount =  iContentListCount - 1; iCount >= 0; iCount--)
2326         {
2327                 bool isFind = false;
2328                 String* pContentPath = __pPlayerPresentationModel->GetContentPath(iCount);
2329                 if (pContentPath == null)
2330                 {
2331                         continue;
2332                 }
2333                 IEnumerator* pIEnum = pList->GetEnumeratorN();
2334                 while (pIEnum->MoveNext() == E_SUCCESS)
2335                 {
2336                         String* pCurrentPath = static_cast<String*>(pIEnum->GetCurrent());
2337                         if (pCurrentPath == null)
2338                         {
2339                                 continue;
2340                         }
2341
2342                         if (pContentPath->Equals(*pCurrentPath, false))
2343                         {
2344                                 isFind = true;
2345                                 break;
2346                         }
2347
2348                         if (pPlayContentPath != null && pContentPath->Equals(*pPlayContentPath, false))
2349                         {
2350                                 isFind = true;
2351                                 break;
2352                         }
2353                 }
2354                 delete pIEnum;
2355
2356                 if (isFind == false)
2357                 {
2358                         __pPlayerPresentationModel->RemoveContent(*pContentPath);
2359                 }
2360         }
2361
2362         if (__pContentsListViewPanel->IsEnabled() == true)
2363         {
2364                 if (__pPlayerPresentationModel->GetContentListCount() != INIT_VALUE && isCurrentContentModified == false)
2365                 {
2366                         static_cast<TableView*>(__pContentsListViewPanel->GetControl(IDC_CONTENTS_TABLEVIEW))->UpdateTableView();
2367                 }
2368                 else if (__pContentsListViewPanel->GetShowState() == true)
2369                 {
2370                         __pContentsListViewPanel->SetShowState(false);
2371                         __pContentsViewToggleButton->SetActionId(IDA_BUTTON_CONTENTS_LIST_VIEW);
2372                         __pContentsAlbumViewPanel->SetShowState(true);
2373                         __pPanelRegisterBar->Invalidate(true);
2374                 }
2375         }
2376         AppLogDebug("EXIT");
2377 }
2378
2379 void
2380 PlayerForm::UpdateItem(int itemIndex, Tizen::Ui::Controls::TableViewItem* pItem)
2381 {
2382         AppLogDebug("ENTER");
2383         if (pItem == null)
2384         {
2385                 AppLogDebug("pItem is null");
2386                 delete __pThumbnail;
2387                 __pThumbnail = null;
2388                 return;
2389         }
2390         Label* pThumbnailLabel = static_cast<Label*>(pItem->GetControl(IDC_CONTENTS_THUMBNAIL, true));
2391         if (__pThumbnail == null || pThumbnailLabel == null)
2392         {
2393                 AppLogDebug("__pThumbnail or pThumbnailLabel is null");
2394                 delete __pThumbnail;
2395                 __pThumbnail = null;
2396                 return;
2397         }
2398         pThumbnailLabel->SetBackgroundBitmap(*__pThumbnail);
2399         delete __pThumbnail;
2400         __pThumbnail = null;
2401         pThumbnailLabel->Invalidate(true);
2402         AppLogDebug("EXIT");
2403 }
2404
2405 void
2406 PlayerForm::SetPlayerScreenState(unsigned int playerScreenState)
2407 {
2408         AppLogDebug("ENTER %d && old = %d",playerScreenState,__playerScreenState);
2409
2410         if (__playerScreenState == playerScreenState)
2411         {
2412                 AppLogDebug("EXIT");
2413                 return;
2414         }
2415
2416         __playerScreenStateBeforeCall = playerScreenState;
2417
2418         switch (playerScreenState)
2419         {
2420         case PLAYER_SCREEN_STATE_NORMAL:
2421                 {
2422                         __pVolumeButton->SetEnabled(true);
2423                         __pContentsViewToggleButton->SetEnabled(true);
2424                         __pShuffleButton->SetShowState(true);
2425                         __pRepeatButton->SetShowState(true);
2426                         __pShuffleButton->SetEnabled(true);
2427                         __pRepeatButton->SetEnabled(true);
2428                         __pRewindButton->SetEnabled(true);
2429                         __pPlayPauseButton->SetEnabled(true);
2430                         __pForwardButton->SetEnabled(true);
2431                         __pPlayStateSlider->SetEnabled(true);
2432
2433                         if (__playerScreenState == PLAYER_SCREEN_STATE_INVALID_CONTENT_ID)
2434                         {
2435                         //      __pContentsViewToggleButton->SetEnabled(false);
2436                                 __pShuffleButton->SetEnabled(false);
2437                         }
2438
2439                         if (__isRunByAppControl == false)
2440                         {
2441                                 break;
2442                         }
2443                 }
2444                 // fall through
2445         case PLAYER_SCREEN_STATE_APP_CONTROL:
2446                 {
2447                         AppLogDebug("111111111111111111111");
2448                         __pPlayPauseButton->SetEnabled(true);
2449                         __pContentsViewToggleButton->SetEnabled(true);
2450                         __pPlayStateSlider->SetEnabled(true);
2451
2452                         RemoveOptionMenu();
2453                         __pShuffleButton->SetShowState(false);
2454                         __pRepeatButton->SetShowState(false);
2455                         __prevRepeatStateRunByAppControl = __pPlayerPresentationModel->GetRepeatState();
2456
2457                         if (__pContentsListViewPanel->GetShowState() == true)
2458                         {
2459                                 __pContentsListViewPanel->SetShowState(false);
2460                                 __pContentsViewToggleButton->SetActionId(IDA_BUTTON_CONTENTS_LIST_VIEW);
2461                                 __pContentsAlbumViewPanel->SetShowState(true);
2462                         }
2463                         playerScreenState = PLAYER_SCREEN_STATE_APP_CONTROL;
2464                         __isRunByAppControl = true;
2465                 }
2466                 break;
2467
2468         case PLAYER_SCREEN_STATE_INVALID_CONTENT_ID:
2469                 {
2470                 //      __pContentsViewToggleButton->SetEnabled(false);
2471                 //      __pContentsViewToggleButton->Invalidate(true);
2472                         if (__playerScreenState != PLAYER_SCREEN_STATE_APP_CONTROL)
2473                         {
2474                                 __pRepeatButton->SetShowState(true);
2475                                 __pRepeatButton->SetEnabled(false);
2476                         }
2477                         else
2478                         {
2479                                 return;
2480                         }
2481 //                      __pMoreContextButton->SetEnabled(false);
2482                 }
2483                 break;
2484
2485         case PLAYER_SCREEN_STATE_NO_CONTENT_LIST:
2486                 {
2487                         __pVolumeButton->SetEnabled(false);
2488                         __pContentsViewToggleButton->SetEnabled(false);
2489                         __pShuffleButton->SetShowState(true);
2490                         __pRepeatButton->SetShowState(true);
2491                         __pShuffleButton->SetEnabled(false);
2492                         __pRepeatButton->SetEnabled(false);
2493                         __pRewindButton->SetEnabled(false);
2494                         __pPlayPauseButton->SetEnabled(false);
2495                         __pForwardButton->SetEnabled(false);
2496                         __pPlayStateSlider->SetEnabled(false);
2497                         RemoveOptionMenu();
2498
2499                         Bitmap* pThumb = ResourceManager::GetBitmapN(L"music_play_grid_thumb_loading.png");
2500                         static_cast<Label*>(__pContentsAlbumViewPanel->GetControl(IDC_CONTENTS_THUMBNAIL))->SetBackgroundBitmap(*pThumb);
2501                         delete pThumb;
2502                 }
2503                 break;
2504
2505         case PLAYER_SCREEN_STATE_ERROR_CONTENT:
2506                 {
2507                         AppLogDebug("222222222222222222222");
2508                         if (__pPlayerPresentationModel->IsDuringCall())
2509                         {
2510                                 if (__isRunByAppControl)
2511                                 {
2512                                         SetPlayerScreenState(PLAYER_SCREEN_STATE_APP_CONTROL);
2513                                 }
2514                                 else
2515                                 {
2516                                         SetPlayerScreenState(PLAYER_SCREEN_STATE_DURING_CALL);
2517                                 }
2518                                 return;
2519                         }
2520                         else
2521                         {
2522                                 __pPlayStateSlider->SetShowState(true);
2523                                 __pPlayStateSlider->SetValue(0);
2524                                 __pPlayPauseButton->SetEnabled(false);
2525                                 __pPlayStateSlider->SetEnabled(false);
2526                                 __pShuffleButton->SetEnabled(false);
2527                                 RemoveOptionMenu();
2528                                 __pPlayStateSlider->Invalidate(true);
2529
2530                                 Bitmap* pThumb = ResourceManager::GetBitmapN(L"music_play_grid_thumb_loading.png");
2531                                 static_cast<Label*>(__pContentsAlbumViewPanel->GetControl(IDC_CONTENTS_THUMBNAIL))->SetBackgroundBitmap(*pThumb);
2532                                 delete pThumb;
2533                         }
2534                 }
2535                 break;
2536
2537         case PLAYER_SCREEN_STATE_DURING_CALL:
2538                 {
2539                         __playerScreenStateBeforeCall = __playerScreenState;
2540                         __pPlayPauseButton->SetEnabled(false);
2541                         RemoveOptionMenu();
2542                         __pContentsViewToggleButton->SetEnabled(false);
2543                         __pPlayStateSlider->SetEnabled(false);
2544
2545                         if (__pContentsListViewPanel->GetShowState() == true)
2546                         {
2547                                 __pContentsListViewPanel->SetShowState(false);
2548                                 __pContentsViewToggleButton->SetActionId(IDA_BUTTON_CONTENTS_LIST_VIEW);
2549                                 __pContentsAlbumViewPanel->SetShowState(true);
2550                         }
2551
2552                         Bitmap* pThumb = ResourceManager::GetBitmapN(L"music_play_grid_thumb_loading.png");
2553                         static_cast<Label*>(__pContentsAlbumViewPanel->GetControl(IDC_CONTENTS_THUMBNAIL))->SetBackgroundBitmap(*pThumb);
2554                         delete pThumb;
2555                 }
2556                 break;
2557
2558         default:
2559                 break;
2560         }
2561
2562         __playerScreenState = playerScreenState;
2563         Invalidate(true);
2564         AppLogDebug("EXIT");
2565 }
2566
2567 unsigned int
2568 PlayerForm::GetPlayerScreenState(void)
2569 {
2570         AppLogDebug("ENTER");
2571         AppLogDebug("EXIT");
2572         return __playerScreenState;
2573 }
2574
2575 result
2576 PlayerForm::SetOptionMenuItem(unsigned int contextMenuItemStyle, Tizen::Graphics::Point anchorPosition)
2577 {
2578         AppLogDebug("ENTER");
2579         if (__pOptionMenu == null)
2580         {
2581                 AppLogDebug("EXIT");
2582                 return E_FAILURE;
2583         }
2584
2585         CommonUtil::AddOptionMenuItem(*__pOptionMenu, contextMenuItemStyle);
2586         CommonUtil::ShowOptionMenu(*__pOptionMenu, true);
2587
2588 //      if (anchorPosition.x != -1 && anchorPosition.y != -1)
2589 //      {
2590 //              __pOptionMenu->SetAnchorPosition(anchorPosition);
2591 //      }
2592         AppLogDebug("EXIT");
2593         return E_SUCCESS;
2594 }
2595
2596 result
2597 PlayerForm::CreateOptionMenuN(const Tizen::Ui::Control& source)
2598 {
2599         AppLogDebug("ENTER");
2600         RemoveOptionMenu();
2601         __pOptionMenu = CommonUtil::CreateOptionMenuN(source, *this);
2602         if (__pOptionMenu != null)
2603         {
2604                 return E_SUCCESS;
2605         }
2606         AppLogDebug("EXIT");
2607         return E_FAILURE;
2608 }
2609
2610 void
2611 PlayerForm::RemoveOptionMenu(void)
2612 {
2613         AppLogDebug("ENTER");
2614         if (__pOptionMenu != null)
2615         {
2616                 CommonUtil::SetShowStateControl(*__pOptionMenu, false);
2617                 delete __pOptionMenu;
2618                 __pOptionMenu = null;
2619         }
2620         AppLogDebug("EXIT");
2621 }
2622
2623 result
2624 PlayerForm::TryRemoveContextMenu(int actionId)
2625 {
2626         AppLogDebug("ENTER");
2627         result r = E_FAILURE;
2628         if (CommonUtil::IsVaildContextMenuItemActionId(actionId) == true)
2629         {
2630                 RemoveOptionMenu();
2631                 r = E_SUCCESS;
2632         }
2633         AppLogDebug("EXIT");
2634         return r;
2635 }
2636
2637 result
2638 PlayerForm::ShowSharePicker(Tizen::Base::Collection::IList* pIList)
2639 {
2640         AppLogDebug("ENTER");
2641         RemoveSharePicker();
2642
2643         __pSharePicker = new (std::nothrow) SharePopup();
2644         if (IsFailed(__pSharePicker->Initialize(this)))
2645         {
2646                 AppLogDebug("__pSharePicker->Initialize failed(%s)", GetErrorMessage(E_FAILURE));
2647                 RemoveSharePicker();
2648                 return E_FAILURE;
2649         }
2650
2651         __pSharePicker->SetArguments(pIList);
2652         __pSharePicker->SetShowState(true);
2653         __pSharePicker->Show();
2654
2655         AppLogDebug("EXIT");
2656         return E_SUCCESS;
2657 }
2658
2659 void
2660 PlayerForm::RemoveSharePicker(void)
2661 {
2662         AppLogDebug("ENTER");
2663         if (__pSharePicker != null)
2664         {
2665                 CommonUtil::SetShowStateControl(*__pSharePicker, false);
2666                 delete __pSharePicker;
2667                 __pSharePicker = null;
2668         }
2669         AppLogDebug("EXIT");
2670 }
2671
2672 result
2673 PlayerForm::ShowPlayListPicker(Tizen::Base::Collection::IList* pIList)
2674 {
2675         AppLogDebug("ENTER");
2676         RemovePlayListPicker();
2677
2678         __pPlayListPicker = new (std::nothrow) PlayListPickerPopup();
2679         if (IsFailed(__pPlayListPicker->Initialize(this, pIList)))
2680         {
2681                 AppLogDebug("__pSharePicker->Initialize failed(%s)", GetErrorMessage(E_FAILURE));
2682                 RemovePlayListPicker();
2683                 return E_FAILURE;
2684         }
2685
2686         __pPlayListPicker->SetShowState(true);
2687         __pPlayListPicker->Show();
2688
2689         AppLogDebug("EXIT");
2690         return E_SUCCESS;
2691 }
2692
2693 void
2694 PlayerForm::RemovePlayListPicker(void)
2695 {
2696         AppLogDebug("ENTER");
2697         if (__pPlayListPicker != null)
2698         {
2699                 CommonUtil::SetShowStateControl(*__pPlayListPicker, false);
2700                 delete __pPlayListPicker;
2701                 __pPlayListPicker = null;
2702         }
2703         AppLogDebug("EXIT");
2704 }
2705
2706 result
2707 PlayerForm::ShowSetAsPicker(Tizen::Base::Collection::IList* pIList)
2708 {
2709         AppLogDebug("ENTER");
2710         RemoveSetAsPicker();
2711
2712         __pSetAsPicker = new (std::nothrow) SetAsPopup();
2713         if (IsFailed(__pSetAsPicker->Initialize(this)))
2714         {
2715                 AppLogDebug("__pSharePicker->Initialize failed(%s)", GetErrorMessage(E_FAILURE));
2716                 RemoveSetAsPicker();
2717                 return E_FAILURE;
2718         }
2719
2720         __pSetAsPicker->SetCurrentContentPath(new (std::nothrow) String(*static_cast<String*>(pIList->GetAt(0))));
2721         __pSetAsPicker->SetShowState(true);
2722         __pSetAsPicker->Show();
2723
2724         pIList->RemoveAll(true);
2725         delete pIList;
2726
2727         AppLogDebug("EXIT");
2728         return E_SUCCESS;
2729 }
2730
2731 void
2732 PlayerForm::RemoveSetAsPicker(void)
2733 {
2734         AppLogDebug("ENTER");
2735         if (__pSetAsPicker != null)
2736         {
2737                 CommonUtil::SetShowStateControl(*__pSetAsPicker, false);
2738 //              delete __pSetAsPicker;
2739 //              __pSetAsPicker = null;
2740         }
2741         AppLogDebug("EXIT");
2742 }
2743
2744 result
2745 PlayerForm::LanucherPicker(PickerType pickerType)
2746 {
2747         AppLogDebug("ENTER");
2748         IList* pArgumentList = GetPickerArgumentListN(pickerType);
2749         if (pArgumentList == null)
2750         {
2751                 AppLogDebug("GetPickerArgumentListN is null");
2752                 return E_FAILURE;
2753         }
2754
2755         result r = E_FAILURE;
2756         if (pickerType == PICKER_TYPE_PLAY_LIST_PICKER)
2757         {
2758                 r = ShowPlayListPicker(pArgumentList);
2759         }
2760         else if (pickerType == PICKER_TYPE_SHARE_PICKER)
2761         {
2762                 r = ShowSharePicker(pArgumentList);
2763         }
2764         else if (pickerType == PICKER_TYPE_SET_AS_PICKER)
2765         {
2766                 r = ShowSetAsPicker(pArgumentList);
2767         }
2768
2769         if (IsFailed(r))
2770         {
2771                 AppLogDebug("ShowPlayListPicker failed(%s)", GetErrorMessage(r));
2772                 delete pArgumentList;
2773         }
2774         AppLogDebug("EXIT");
2775         return r;
2776 }
2777
2778 Tizen::Base::Collection::IList*
2779 PlayerForm::GetPickerArgumentListN(PickerType pickerType)
2780 {
2781         AppLogDebug("ENTER");
2782         String contentPath;
2783         switch (pickerType)
2784         {
2785         case PICKER_TYPE_SET_AS_PICKER:
2786                 // fall through
2787         case PICKER_TYPE_PLAY_LIST_PICKER:
2788                 // fall through
2789         case PICKER_TYPE_SHARE_PICKER:
2790                 {
2791                         contentPath.Append(*__pPlayerPresentationModel->GetContentPath(__pPlayerPresentationModel->GetCurrentContentIndex()));
2792                 }
2793                 break;
2794
2795         default:
2796                 {
2797                         AppLogDebug("EXIT");
2798                         return null;
2799                 }
2800                 break;
2801         }
2802
2803         Tizen::Base::Collection::ArrayList* pDataList = new (std::nothrow) ArrayList(SingleObjectDeleter);
2804         if (IsFailed(pDataList->Construct()))
2805         {
2806                 AppLogDebug("Construct failed(%s)", GetErrorMessage(GetLastResult()));
2807                 delete pDataList;
2808                 return null;
2809         }
2810
2811         pDataList->Add(*(new (std::nothrow) String(contentPath)));
2812         AppLogDebug("EXIT");
2813         return pDataList;
2814 }
2815
2816 void
2817 PlayerForm::OnFontSizeChanged(void)
2818 {
2819         __fontSizeValue = CommonUtil::GetFontSizeValue();
2820         __itemHeight = CommonUtil::GetItemHeight(__fontSizeValue);
2821         TableView* pContentsTableView = static_cast<TableView*>(__pContentsListViewPanel->GetControl(IDC_CONTENTS_TABLEVIEW));
2822         pContentsTableView->UpdateTableView();
2823 }