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