2 // Copyright (c) 2012 Samsung Electronics Co., Ltd.
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
8 // http://floralicense.org/license/
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.
18 * @file MpMusicPlayerForm.h
19 * @brief This is the implementation file for MusicPlayerForm class.
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"
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;
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;
59 static const int TRANSPARENT_COLOR = 0x00000000;
61 static const int MIN_VOLUME_SLIDER_COUNT = 0;
62 static const int MAX_VOLUME_SLIDER_COUNT = 15;
64 static const int IDA_BUTTON_CONTENTS_LIST_VIEW = 200;
65 static const int IDA_BUTTON_CONTENTS_ALBUM_VIEW = 201;
67 static const Tizen::Base::String INVALID_VALUE_OF_CONTENT_ID = L"00000000-0000-0000-0000-000000000000";
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";
76 FloatRectangle rectanglePreviousElement;
77 FloatRectangle rectangleCurrentElement;
78 FloatRectangle rectangleNextElement;
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 */
87 enum PlayerScreenState
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
99 enum IDAPlayerController
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
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)
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)
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)
150 , __pAnimationFinishedTimer(null)
151 , __pContentPlayTimer(null)
152 , __pMsgShowTimer(null)
154 , __pPreviousSceneId(null)
156 , __pOptionMenu(null)
157 , __itemHeight(ITEM_HEIGHT_MAIN_TEXT_NORMAL)
159 AppLogDebug("ENTER");
163 PlayerForm::~PlayerForm(void)
165 AppLogDebug("ENTER");
170 PlayerForm::Initialize(void)
172 AppLogDebug("ENTER");
173 if (IsFailed(Form::Construct(IDL_MUSIC_PLAYER_FORM)))
175 AppLogDebug("Form::Construct(IDL_MUSIC_PLAYER_FORM) failed(%s)", GetErrorMessage(GetLastResult()));
183 PlayerForm::OnInitializing(void)
185 AppLogDebug("ENTER");
187 __fontSizeValue = CommonUtil::GetFontSizeValue();
188 __itemHeight = CommonUtil::GetItemHeight(__fontSizeValue);
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));
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");
198 if (pButtonBackgroundBitmap != null)
200 //blank_normal_background.png
201 Canvas* pCanvas = new (std::nothrow) Canvas();
202 pCanvas->Construct(__pContentsViewToggleButton->GetBoundsF());
203 pCanvas->DrawNinePatchedBitmap(pCanvas->GetBoundsF(),*pButtonBackgroundBitmap);
205 Bitmap* pFinalBackBitmap = new Bitmap();
206 pFinalBackBitmap->Construct(*pCanvas,pCanvas->GetBoundsF());
207 __pContentsViewToggleButton->SetNormalBackgroundBitmap(*pFinalBackBitmap);
208 __pContentsViewToggleButton->SetPressedBackgroundBitmap(*pFinalBackBitmap);
209 __pContentsViewToggleButton->SetDisabledBackgroundBitmap(*pFinalBackBitmap);
211 delete pFinalBackBitmap;
213 delete pButtonBackgroundBitmap;
216 __pContentsViewToggleButton->AddActionEventListener(*this);
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);
228 Button* pButton = static_cast<Button*>(__pControllerPanel->GetControl(IDC_OPTION_PLAY_LIST_ADD));
229 pButton->SetShowState(false);
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);
236 __pPlayPauseButton = static_cast<Button*>(__pControllerPanel->GetControl(IDC_PALY_TOGGLE_CONTROL_BUTTON));
237 __pPlayPauseButton->SetActionId(IDA_PLAYER_CONTROLLER_PLAY);
238 __pPlayPauseButton->AddActionEventListener(*this);
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);
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);
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));
254 SetFormMenuEventListener(this);
255 SetFormBackEventListener(this);
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();
267 __pContentsListViewPanel = new (std::nothrow) Panel();
268 if (IsFailed(__pContentsListViewPanel->Construct(IDL_MUSIC_PLAYER_CONTENTS_LIST_VIEW_PANEL)))
270 AppLogDebug("Construct(IDL_MUSIC_PLAYER_CONTENTS_LIST_VIEW_PANEL) failed(%s)", GetErrorMessage(GetLastResult()));
271 delete __pContentsListViewPanel;
275 __pPanelRegisterBar = static_cast<Panel*>(GetControl(IDC_PANEL_REGISTER_BAR));
276 __pPanelRegisterBar->AddControl(__pContentsListViewPanel);
277 __pContentsListViewPanel->SetShowState(false);
278 __pContentsListViewPanel->SetEnabled(false);
280 CommonUtil::SetLayoutFitToContainer(*__pPanelRegisterBar, *__pContentsListViewPanel);
281 TableView* pContentsTableView = static_cast<TableView*>(__pContentsListViewPanel->GetControl(IDC_CONTENTS_TABLEVIEW));
282 pContentsTableView->AddTableViewItemEventListener(*this);
283 pContentsTableView->SetItemProvider(this);
285 __pContentsAlbumViewPanel = new (std::nothrow) Panel();
286 if (IsFailed(__pContentsAlbumViewPanel->Construct(IDL_MUSIC_PLAYER_CONTENTS_ALBUM_VIEW_PANEL)))
288 AppLogDebug("Construct(IDL_MUSIC_PLAYER_CONTENTS_ALBUM_VIEW_PANEL) failed(%s)", GetErrorMessage(GetLastResult()));
289 delete __pContentsAlbumViewPanel;
292 __pPanelRegisterBar->AddControl(__pContentsAlbumViewPanel);
293 CommonUtil::SetLayoutFitToContainer(*__pPanelRegisterBar, *__pContentsAlbumViewPanel);
295 Label* pAlbumThumbnailLabel = static_cast<Label*>(__pContentsAlbumViewPanel->GetControl(IDC_CONTENTS_THUMBNAIL));
296 __pContentsAlbumViewPanel->SetControlAlwaysOnTop(*pAlbumThumbnailLabel, true);
297 pAlbumThumbnailLabel->AddTouchEventListener(*this);
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);
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]);
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]);
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));
325 __pAlbumArtElement[ALBUM_ART_IMAGE_NEXT]->SetShowState(true);
326 __pAlbumArtElements->AttachChild(*__pAlbumArtElement[ALBUM_ART_IMAGE_NEXT]);
328 rectanglePreviousElement = __pAlbumArtElement[ALBUM_ART_IMAGE_PREVIOUS]->GetBounds();
329 rectangleCurrentElement = __pAlbumArtElement[ALBUM_ART_IMAGE_CURRENT]->GetBounds();
330 rectangleNextElement = __pAlbumArtElement[ALBUM_ART_IMAGE_NEXT]->GetBounds();
332 AddOrientationEventListener(*this);
333 //AddKeyEventListener(*this);
335 UpdateSplitBarState();
336 TogglePlayPauseImage(PLAYER_STATE_CLOSED);
337 SetRepeatButtonImage(__pPlayerPresentationModel->GetRepeatState());
340 return ThumbnailBase::Construct();
344 PlayerForm::OnOrientationChanged(const Tizen::Ui::Control& source, Tizen::Ui::OrientationStatus orientationStatus)
346 AppLogDebug("ENTER");
347 FloatDimension floatDimension = static_cast<Label*>(__pContentsAlbumViewPanel->GetControl(IDC_CONTENTS_THUMBNAIL))->GetSizeF();
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);
355 rectanglePreviousElement = __pAlbumArtElement[ALBUM_ART_IMAGE_PREVIOUS]->GetBounds();
356 rectangleCurrentElement = __pAlbumArtElement[ALBUM_ART_IMAGE_CURRENT]->GetBounds();
357 rectangleNextElement = __pAlbumArtElement[ALBUM_ART_IMAGE_NEXT]->GetBounds();
359 UpdateSplitBarState();
361 Rectangle clientBounds = GetClientAreaBounds();
362 if (orientationStatus == ORIENTATION_STATUS_LANDSCAPE
363 || orientationStatus == ORIENTATION_STATUS_LANDSCAPE_REVERSE)
365 if (__pVolumePanel != null)
367 if (clientBounds.width > 1200)
369 __pVolumePanel->SetPosition(clientBounds.width - W_HORIZONTAL_PLAYER , GetClientAreaBounds().height - H_HORIZONTAL_CONTROLLER_PANEL - H_VOLUME_PANEL - 50);
373 __pVolumePanel->SetBounds(Rectangle(clientBounds.width - 670
374 , GetClientAreaBounds().height - H_HORIZONTAL_CONTROLLER_PANEL - H_VOLUME_PANEL - 50
378 __pVolumePanel->Invalidate(true);
381 else if (orientationStatus == ORIENTATION_STATUS_PORTRAIT
382 || orientationStatus == ORIENTATION_STATUS_PORTRAIT_REVERSE)
384 if (__pVolumePanel != null)
386 if (clientBounds.width > 1200)
388 __pVolumePanel->SetPosition(0, clientBounds.height - H_CONTROLLER_PANEL - H_VOLUME_PANEL - 50);
392 __pVolumePanel->SetBounds( Rectangle(0
393 , clientBounds.height - H_CONTROLLER_PANEL - H_VOLUME_PANEL - 50
397 __pVolumePanel->Invalidate(true);
400 TogglePlayPauseImage(__pPlayerPresentationModel->GetPlayerState());
401 TableView* pContentsTableView = static_cast<TableView*>(__pContentsListViewPanel->GetControl(IDC_CONTENTS_TABLEVIEW));
402 pContentsTableView->UpdateTableView();
403 __pContentsListViewPanel->Invalidate(true);
408 PlayerForm::OnTerminating(void)
410 AppLogDebug("ENTER");
411 ThumbnailBase::Stop();
412 if (__pAlbumArtElements)
414 __pAlbumArtElements->Destroy();
415 __pAlbumArtElements = null;
418 if (__isRunByAppControl == true)
420 __pPlayerPresentationModel->SetRepeatMode(__prevRepeatStateRunByAppControl);
421 __isRunByAppControl = false;
426 RemovePlayListPicker();
429 RemoveOrientationEventListener(*this);
430 RemoveKeyEventListener(*this);
432 delete __pSoundPathPopup;
433 __pSoundPathPopup = null;
435 if (__pAnimationFinishedTimer != null)
437 __pAnimationFinishedTimer->Cancel();
438 delete __pAnimationFinishedTimer;
441 if (__pContentPlayTimer != null)
443 __pContentPlayTimer->Cancel();
444 delete __pContentPlayTimer;
447 if (__pMsgShowTimer != null)
449 __pMsgShowTimer->Cancel();
450 delete __pMsgShowTimer;
453 if (__pSeekTimer != null)
455 __pSeekTimer->Cancel();
459 if (__pPlayerPresentationModel != null)
461 __pPlayerPresentationModel->RemoveMusicPlayerEventListener(*this);
462 __pPlayerPresentationModel->DestroyPlayerPresentationModel();
464 SettingPresentationModel::GetInstance()->DestroySettingPresentationModel();
470 PlayerForm::OnActionPerformed(const Tizen::Ui::Control& source, int actionId)
472 AppLogDebug("ENTER");
473 SceneManager* pSceneManager = SceneManager::GetInstance();
474 AppAssert(pSceneManager);
478 case IDA_BUTTON_CONTENTS_ALBUM_VIEW:
480 CancelAllThumbnailRequest();
481 __pContentsListViewPanel->SetShowState(false);
482 __pContentsViewToggleButton->SetActionId(IDA_BUTTON_CONTENTS_LIST_VIEW);
483 __pContentsAlbumViewPanel->SetShowState(true);
484 __pPanelRegisterBar->Invalidate(true);
488 case IDA_BUTTON_CONTENTS_LIST_VIEW:
490 __pContentsAlbumViewPanel->SetShowState(false);
491 __pContentsViewToggleButton->SetActionId(IDA_BUTTON_CONTENTS_ALBUM_VIEW);
492 __pContentsListViewPanel->SetShowState(true);
493 __pContentsListViewPanel->SetEnabled(true);
494 __pPanelRegisterBar->Invalidate(true);
498 case IDA_PLAYER_CONTROLLER_VOLUME:
500 if (__pVolumePanel == null)
502 InitializeVolumeBar();
506 if (__pVolumePanel->GetShowState() == true)
508 __pVolumePanel->SetShowState(false);
512 int MediaSoundVolume = 0;
513 SettingInfo::GetValue(MEDIA_VOLUME, MediaSoundVolume);
514 __pPlayerPresentationModel->SetVolume(MediaSoundVolume);
515 __pVolumeSlider->SetValue(__pPlayerPresentationModel->GetVolume());
516 __pVolumeSlider->Invalidate(true);
517 __pVolumePanel->SetShowState(true);
523 case IDA_PLAYER_CONTROLLER_PLAY:
525 String* pCurrentPlayConent = __pPlayerPresentationModel->GetPlayContentPath();
526 String* pContentPath = __pPlayerPresentationModel->GetContentPath(__pPlayerPresentationModel->GetCurrentContentIndex());
528 if (pCurrentPlayConent->Equals(*pContentPath))
530 __pPlayerPresentationModel->Play(__pPlayerPresentationModel->GetCurrentContentIndex(), __pPlayStateSlider->GetValue(), true);
534 __pPlayerPresentationModel->Play(__pPlayerPresentationModel->GetCurrentContentIndex(), __pPlayStateSlider->GetValue());
537 if (__pPlayerPresentationModel->IsFileExist(__pPlayerPresentationModel->GetCurrentContentIndex()) != true)
539 SetFileNotExistState(false);
544 case IDA_PLAYER_CONTROLLER_PAUSE:
546 __pPlayerPresentationModel->Pause();
550 case IDA_PLAYER_CONTROLLER_BACK:
552 result r = pSceneManager->GoBackward(BackwardSceneTransition(SCENE_TRANSITION_ANIMATION_TYPE_NONE, SCENE_DESTROY_OPTION_KEEP));
555 UiApp* pApp = UiApp::GetInstance();
558 __isRunByAppControl = false;
559 // else if (__isRunByAppControl)
561 // Tizen::App::UiApp::GetInstance()->GetFrameAt(0)->SetShowMode(FRAME_SHOW_MODE_MINIMIZED);
566 case IDA_PLAYER_CONTROLLER_REPEAT:
568 switch (__pPlayerPresentationModel->GetRepeatState())
570 case IDA_TYPE_REPEAT_A:
572 SetRepeatButtonImage(IDA_TYPE_REPEAT_ONE);
576 case IDA_TYPE_REPEAT_ONE:
578 SetRepeatButtonImage(IDA_TYPE_REPEAT_ALL);
582 case IDA_TYPE_REPEAT_ALL:
584 SetRepeatButtonImage(IDA_TYPE_REPEAT_A);
594 case IDA_PLAYER_CONTROLLER_SHUFFLE:
596 if (__pPlayerPresentationModel->IsShuffleEnable() == false)
598 SetShuffleButtonImage(true);
602 SetShuffleButtonImage(false);
607 case IDA_PLAYER_CONTROLLER_MORE:
609 if (GetPlayerScreenState() == PLAYER_SCREEN_STATE_NORMAL)
611 CreateOptionMenuN(source);
612 SetOptionMenuItem(CONTEXT_MENU_ITEM_STYLE_SET_AS | CONTEXT_MENU_ITEM_STYLE_DETAILS | CONTEXT_MENU_ITEM_STYLE_SHARE_VIA
613 | CONTEXT_MENU_ITEM_STYLE_ADD_TO_PLAYLIST | CONTEXT_MENU_ITEM_STYLE_SETTINGS);
615 else if (GetPlayerScreenState() == PLAYER_SCREEN_STATE_APP_CONTROL || GetPlayerScreenState() == PLAYER_SCREEN_STATE_INVALID_CONTENT_ID)
617 CreateOptionMenuN(source);
618 SetOptionMenuItem(CONTEXT_MENU_ITEM_STYLE_SET_AS | CONTEXT_MENU_ITEM_STYLE_DETAILS | CONTEXT_MENU_ITEM_STYLE_SHARE_VIA);
623 case IDA_CONTEXT_MENU_ITEM_SHARE_VIA:
625 LanucherPicker(PICKER_TYPE_SHARE_PICKER);
629 case IDA_CONTEXT_MENU_ITEM_STYLE_ADD_TO_PLAYLIST:
631 LanucherPicker(PICKER_TYPE_PLAY_LIST_PICKER);
635 case IDA_CONTEXT_MENU_ITEM_STYLE_SET_AS:
637 LanucherPicker(PICKER_TYPE_SET_AS_PICKER);
641 case IDA_CONTEXT_MENU_ITEM_STYLE_SOUND_PATH:
643 if (__pSoundPathPopup == null)
645 __pSoundPathPopup = new (std::nothrow) SoundPathPopup();
646 __pSoundPathPopup->Initialize();
648 __pSoundPathPopup->ShowPopup(true);
652 case IDA_CONTEXT_MENU_ITEM_STYLE_DETAILS:
654 pSceneManager->GoForward(ForwardSceneTransition(IDSCN_CONTENT_DETAIL));
658 case IDA_CONTEXT_MENU_ITEM_SETTINGS:
660 SettingPresentationModel::GetInstance()->InitializeSettingValue();
661 pSceneManager->GoForward(ForwardSceneTransition(IDSCN_MUSIC_SETTING));
669 TryRemoveContextMenu(actionId);
674 PlayerForm::OnKeyPressed(const Tizen::Ui::Control& source, Tizen::Ui::KeyCode keyCode)
676 AppLogDebug("ENTER");
681 if (__pVolumePanel == null)
683 InitializeVolumeBar();
686 __pVolumePanel->SetShowState(true);
687 __pPlayerPresentationModel->SetVolume(__pPlayerPresentationModel->GetVolume() + 1);
688 __pVolumeSlider->SetValue(__pPlayerPresentationModel->GetVolume());
689 __pVolumeSlider->Invalidate(true);
695 if (__pVolumePanel == null)
697 InitializeVolumeBar();
700 __pVolumePanel->SetShowState(true);
701 __pPlayerPresentationModel->SetVolume(__pPlayerPresentationModel->GetVolume() - 1);
702 __pVolumeSlider->SetValue(__pPlayerPresentationModel->GetVolume());
703 __pVolumeSlider->Invalidate(true);
708 if (source.Equals(*__pForwardButton) || source.Equals(*__pRewindButton))
710 __isLongPressed = false;
721 PlayerForm::OnKeyReleased(const Tizen::Ui::Control& source, Tizen::Ui::KeyCode keyCode)
723 AppLogDebug("ENTER");
727 if (source.Equals(*__pForwardButton) || source.Equals(*__pRewindButton))
729 if (__isLongPressed == true)
731 __pPlayerPresentationModel->StopForwardRewind();
735 if (source.Equals(*__pRewindButton))
737 if (__pPlayerPresentationModel->GetContentListCount() > 1)
739 while (__pPlayerPresentationModel->IsFileExist(__pPlayerPresentationModel->GetPreviousContentIndex()) == false
740 && __pPlayerPresentationModel->GetContentListCount() > 0)
742 __pPlayerPresentationModel->RemoveContent(*__pPlayerPresentationModel->GetContentPath(__pPlayerPresentationModel->GetPreviousContentIndex()));
745 __flickDirection = FLICK_DIRECTION_RIGHT;
747 if (__pPlayerPresentationModel->GetContentListCount() <= 1)
749 MessageBox messageBox;
750 messageBox.Construct(L"", ResourceManager::GetString(L"IDS_MUSIC_HEADER_NO_SONGS"), MSGBOX_STYLE_NONE, 1000);
753 messageBox.ShowAndWait(modalResult);
757 __pSeekTimer->Cancel();
764 if (__pPlayerPresentationModel->GetContentListCount() > 1)
766 while (__pPlayerPresentationModel->IsFileExist(__pPlayerPresentationModel->GetNextContentIndex()) == false
767 && __pPlayerPresentationModel->GetContentListCount() > 0)
769 __pPlayerPresentationModel->RemoveContent(*__pPlayerPresentationModel->GetContentPath(__pPlayerPresentationModel->GetNextContentIndex()));
772 __flickDirection = FLICK_DIRECTION_LEFT;
774 if (__pPlayerPresentationModel->GetContentListCount() <= 1)
776 MessageBox messageBox;
777 messageBox.Construct(L"", ResourceManager::GetString(L"IDS_MUSIC_HEADER_NO_SONGS"), MSGBOX_STYLE_NONE, 1000);
780 messageBox.ShowAndWait(modalResult);
784 __pSeekTimer->Cancel();
800 PlayerForm::OnKeyLongPressed(const Tizen::Ui::Control& source, Tizen::Ui::KeyCode keyCode)
802 AppLogDebug("ENTER");
803 AppLogDebug("keycode(%d)", keyCode);
807 if (source.Equals(*__pForwardButton) || source.Equals(*__pRewindButton))
809 __isLongPressed = true;
810 if (source.Equals(*__pRewindButton) && (__pPlayStateSlider->IsEnabled()))
812 __pPlayerPresentationModel->SeekToRewind();
814 else if (__pPlayStateSlider->IsEnabled())
816 __pPlayerPresentationModel->SeekToForward();
828 PlayerForm::OnTouchLongPressed(const Control& source, const Point& currentPosition, const TouchEventInfo& touchInfo)
830 AppLogDebug("ENTER");
831 if (source.Equals(*__pForwardButton) || source.Equals(*__pRewindButton))
833 __isLongPressed = true;
834 if (source.Equals(*__pRewindButton) && (__pPlayStateSlider->IsEnabled()))
836 __pPlayerPresentationModel->SeekToRewind();
838 else if (__pPlayStateSlider->IsEnabled())
840 __pPlayerPresentationModel->SeekToForward();
847 PlayerForm::OnTouchMoved(const Tizen::Ui::Control& source, const Tizen::Graphics::Point& currentPosition, const Tizen::Ui::TouchEventInfo& touchInfo)
849 AppLogDebug("ENTER");
850 Label *pAlbumLable = static_cast<Label*>(__pContentsAlbumViewPanel->GetControl(IDC_CONTENTS_THUMBNAIL));
851 if (source.Equals(*pAlbumLable) == false)
856 if (__isAnimationPerformed == true || __isContentMoveCompleted == true)
861 if (currentPosition.y < 0 || currentPosition.y > GetBounds().height - __pControllerPanel->GetBounds().height)
866 if (Tizen::Base::Utility::Math::Abs(touchInfo.GetStartPosition().y - currentPosition.y) > 100)
871 if (currentPosition.x > touchInfo.GetStartPosition().x + 100)
873 if (__pPlayerPresentationModel->GetContentListCount() > 1)
875 while (__pPlayerPresentationModel->IsFileExist(__pPlayerPresentationModel->GetPreviousContentIndex()) == false
876 && __pPlayerPresentationModel->GetContentListCount() > 0)
878 __pPlayerPresentationModel->RemoveContent(*__pPlayerPresentationModel->GetContentPath(__pPlayerPresentationModel->GetPreviousContentIndex()));
881 __flickDirection = FLICK_DIRECTION_RIGHT;
882 __isContentMoveCompleted = true;
883 if (__pPlayerPresentationModel->GetContentListCount() <= 1)
885 MessageBox messageBox;
886 messageBox.Construct(L"", ResourceManager::GetString(L"IDS_MUSIC_HEADER_NO_SONGS"), MSGBOX_STYLE_NONE, 1000);
889 messageBox.ShowAndWait(modalResult);
893 __pSeekTimer->Cancel();
898 else if (currentPosition.x < touchInfo.GetStartPosition().x - 100)
900 if (__pPlayerPresentationModel->GetContentListCount() > 1)
902 while (__pPlayerPresentationModel->IsFileExist(__pPlayerPresentationModel->GetNextContentIndex()) == false
903 && __pPlayerPresentationModel->GetContentListCount() > 0)
905 __pPlayerPresentationModel->RemoveContent(*__pPlayerPresentationModel->GetContentPath(__pPlayerPresentationModel->GetNextContentIndex()));
908 __flickDirection = FLICK_DIRECTION_LEFT;
909 __isContentMoveCompleted = true;
910 if (__pPlayerPresentationModel->GetContentListCount() <= 1)
912 MessageBox messageBox;
913 messageBox.Construct(L"", ResourceManager::GetString(L"IDS_MUSIC_HEADER_NO_SONGS"), MSGBOX_STYLE_NONE, 1000);
916 messageBox.ShowAndWait(modalResult);
920 __pSeekTimer->Cancel();
929 PlayerForm::OnTouchPressed(const Control& source, const Point& currentPosition, const TouchEventInfo& touchInfo)
931 AppLogDebug("ENTER");
932 if (source.Equals(*__pForwardButton) || source.Equals(*__pRewindButton))
934 __isLongPressed = false;
938 if (__pVolumePanel != null && __pVolumePanel->GetShowState())
940 __pVolumePanel->SetShowState(false);
947 PlayerForm::OnTouchReleased(const Control& source, const Point& currentPosition, const TouchEventInfo& touchInfo)
949 AppLogDebug("ENTER");
950 __isContentMoveCompleted = false;
951 if (source.Equals(*__pForwardButton) || source.Equals(*__pRewindButton))
953 if (__isLongPressed == true)
955 __pPlayerPresentationModel->StopForwardRewind();
959 if(0 > currentPosition.x || source.GetWidth() < currentPosition.x ||
960 0 > currentPosition.y || source.GetHeight() < currentPosition.y)
965 if (source.Equals(*__pRewindButton))
967 if (__pPlayerPresentationModel->GetContentListCount() > 1)
969 while (__pPlayerPresentationModel->IsFileExist(__pPlayerPresentationModel->GetPreviousContentIndex()) == false
970 && __pPlayerPresentationModel->GetContentListCount() > 0)
972 __pPlayerPresentationModel->RemoveContent(*__pPlayerPresentationModel->GetContentPath(__pPlayerPresentationModel->GetPreviousContentIndex()));
975 __flickDirection = FLICK_DIRECTION_RIGHT;
977 if (__pPlayerPresentationModel->GetContentListCount() <= 1)
979 MessageBox messageBox;
980 messageBox.Construct(L"", ResourceManager::GetString(L"IDS_MUSIC_HEADER_NO_SONGS"), MSGBOX_STYLE_NONE, 1000);
983 messageBox.ShowAndWait(modalResult);
987 __pSeekTimer->Cancel();
994 if (__pPlayerPresentationModel->GetContentListCount() > 1)
996 while (__pPlayerPresentationModel->IsFileExist(__pPlayerPresentationModel->GetNextContentIndex()) == false
997 && __pPlayerPresentationModel->GetContentListCount() > 0)
999 __pPlayerPresentationModel->RemoveContent(*__pPlayerPresentationModel->GetContentPath(__pPlayerPresentationModel->GetNextContentIndex()));
1002 __flickDirection = FLICK_DIRECTION_LEFT;
1004 if (__pPlayerPresentationModel->GetContentListCount() <= 1)
1006 MessageBox messageBox;
1007 messageBox.Construct(L"", ResourceManager::GetString(L"IDS_MUSIC_HEADER_NO_SONGS"), MSGBOX_STYLE_NONE, 1000);
1009 int modalResult = 0;
1010 messageBox.ShowAndWait(modalResult);
1014 __pSeekTimer->Cancel();
1015 __playPosition = -1;
1025 AppLogDebug("EXIT");
1029 PlayerForm::OnTouchCanceled(const Tizen::Ui::Control& source, const Tizen::Graphics::Point& currentPosition, const Tizen::Ui::TouchEventInfo& touchInfo)
1031 AppLogDebug("ENTER");
1032 __isContentMoveCompleted = false;
1034 if (source.Equals(*__pForwardButton) || source.Equals(*__pRewindButton))
1036 if (__isLongPressed == true)
1038 __pPlayerPresentationModel->StopForwardRewind();
1039 __isLongPressed = false;
1043 AppLogDebug("EXIT");
1048 PlayerForm::PlayAnimation(void)
1050 AppLogDebug("ENTER");
1051 __isAnimationPerformed = true;
1052 // if (AnimationTransaction::GetStatus(__transactionID) == ANIMATION_TRANSACTION_STATUS_STOPPED)
1054 if (__flickDirection == FLICK_DIRECTION_RIGHT)
1056 __pAlbumArtElement[ALBUM_ART_IMAGE_PREVIOUS]->SetShowState(true);
1058 AnimationTransaction::Begin(__transactionID);
1059 AnimationTransaction::SetVisualElementAnimationDuration(200);
1060 AnimationTransaction::SetCurrentTransactionEventListener(this);
1062 VisualElementPropertyAnimation* pAnimation = new (std::nothrow) VisualElementPropertyAnimation();
1063 pAnimation->SetPropertyName(L"bounds");
1064 pAnimation->SetStartValue(Variant(rectanglePreviousElement));
1065 pAnimation->SetEndValue(Variant(rectangleCurrentElement));
1067 __pAlbumArtElement[ALBUM_ART_IMAGE_PREVIOUS]->AddAnimation(*pAnimation);
1070 pAnimation = new (std::nothrow) VisualElementPropertyAnimation();
1071 pAnimation->SetPropertyName(L"bounds");
1072 pAnimation->SetStartValue(Variant(rectangleCurrentElement));
1073 pAnimation->SetEndValue(Variant(rectangleNextElement));
1075 __pAlbumArtElement[ALBUM_ART_IMAGE_CURRENT]->AddAnimation(*pAnimation);
1077 __pAlbumArtElement[ALBUM_ART_IMAGE_NEXT]->SetShowState(false);
1080 AnimationTransaction::Commit();
1082 else if (__flickDirection == FLICK_DIRECTION_LEFT)
1084 __pAlbumArtElement[ALBUM_ART_IMAGE_NEXT]->SetShowState(true);
1086 AnimationTransaction::Begin(__transactionID);
1087 AnimationTransaction::SetVisualElementAnimationDuration(200);
1088 AnimationTransaction::SetCurrentTransactionEventListener(this);
1090 VisualElementPropertyAnimation* pAnimation = new (std::nothrow) VisualElementPropertyAnimation();
1091 pAnimation->SetPropertyName(L"bounds");
1092 pAnimation->SetStartValue(Variant(rectangleCurrentElement));
1093 pAnimation->SetEndValue(Variant(rectanglePreviousElement));
1095 __pAlbumArtElement[ALBUM_ART_IMAGE_CURRENT]->AddAnimation(*pAnimation);
1098 pAnimation = new (std::nothrow) VisualElementPropertyAnimation();
1099 pAnimation->SetPropertyName(L"bounds");
1100 pAnimation->SetStartValue(Variant(rectangleNextElement));
1101 pAnimation->SetEndValue(Variant(rectangleCurrentElement));
1103 __pAlbumArtElement[ALBUM_ART_IMAGE_NEXT]->AddAnimation(*pAnimation);
1104 __pAlbumArtElement[ALBUM_ART_IMAGE_PREVIOUS]->SetShowState(false);
1107 AnimationTransaction::Commit();
1114 AppLogDebug("EXIT");
1118 PlayerForm::StopAnimation(void)
1120 AppLogDebug("ENTER");
1121 AppLogDebug("EXIT");
1125 PlayerForm::OnAnimationTransactionStarted(int transactionId)
1127 AppLogDebug("ENTER");
1128 __pContentPlayTimer->Cancel();
1129 AppLogDebug("EXIT");
1133 PlayerForm::OnAnimationTransactionStopped(int transactionId)
1135 AppLogDebug("ENTER");
1136 AppLogDebug("EXIT");
1140 PlayerForm::OnAnimationTransactionFinished(int transactionId)
1142 AppLogDebug("ENTER");
1143 __isAnimationPerformed = false;
1144 __pAnimationFinishedTimer->Start(1);
1145 __pContentPlayTimer->Start(700);
1146 AppLogDebug("EXIT");
1150 PlayerForm::OnSliderBarMoved(Tizen::Ui::Controls::Slider& source, int value)
1152 AppLogDebug("ENTER value = %d",value);
1153 if (source.Equals(*__pPlayStateSlider))
1157 __pPlayStateSlider->SetShowState(false);//To cancel touch event.
1158 __pSeekTimer->Cancel();
1159 __playPosition = -1;
1160 __pPlayerPresentationModel->SetPlayPosition(100);
1164 __playPosition = value;
1165 __pSeekTimer->Cancel();
1166 __pSeekTimer->Start(100);
1168 //__pPlayerPresentationModel->SetPlayPosition(value);
1170 __pPlayStateSlider->SetShowState(true);
1174 if (__pVolumePanel->GetShowState() == false)
1176 __pVolumePanel->SetShowState(true);
1178 __pPlayerPresentationModel->SetVolume(value);
1180 AppLogDebug("EXIT");
1184 PlayerForm::OnTimerExpired(Tizen::Base::Runtime::Timer& timer)
1186 AppLogDebug("ENTER");
1187 if (&timer == __pAnimationFinishedTimer)
1189 if (__flickDirection == FLICK_DIRECTION_RIGHT)
1191 Tizen::Ui::Animations::VisualElement* pTempVisualElement = __pAlbumArtElement[ALBUM_ART_IMAGE_NEXT];
1192 pTempVisualElement->SetBounds(rectanglePreviousElement);
1194 __pAlbumArtElement[ALBUM_ART_IMAGE_NEXT] = __pAlbumArtElement[ALBUM_ART_IMAGE_CURRENT];
1195 __pAlbumArtElement[ALBUM_ART_IMAGE_CURRENT] = __pAlbumArtElement[ALBUM_ART_IMAGE_PREVIOUS];
1196 __pAlbumArtElement[ALBUM_ART_IMAGE_PREVIOUS] = pTempVisualElement;
1197 __pAlbumArtElement[ALBUM_ART_IMAGE_PREVIOUS]->SetShowState(false);
1199 __pPlayerPresentationModel->MovePreviousContent(true);
1201 else if (__flickDirection == FLICK_DIRECTION_LEFT)
1203 Tizen::Ui::Animations::VisualElement* pTempVisualElement = __pAlbumArtElement[ALBUM_ART_IMAGE_PREVIOUS];
1204 pTempVisualElement->SetBounds(rectangleNextElement);
1206 __pAlbumArtElement[ALBUM_ART_IMAGE_PREVIOUS] = __pAlbumArtElement[ALBUM_ART_IMAGE_CURRENT];
1207 __pAlbumArtElement[ALBUM_ART_IMAGE_CURRENT] = __pAlbumArtElement[ALBUM_ART_IMAGE_NEXT];
1208 __pAlbumArtElement[ALBUM_ART_IMAGE_NEXT] = pTempVisualElement;
1209 __pAlbumArtElement[ALBUM_ART_IMAGE_NEXT]->SetShowState(false);
1211 __pPlayerPresentationModel->MoveNextContent();
1213 __flickDirection = FLICK_DIRECTION_NONE;
1214 __transactionID = ANIMATION_TRANSACTION_STATUS_STOPPED;
1216 else if (&timer == __pMsgShowTimer)
1218 ShowMessageBox(ResourceManager::GetString(L"IDS_MUSIC_POP_UNABLE_TO_PLAY_ERROR_OCCURRED"));
1220 else if (&timer == __pSeekTimer)
1222 int playPosition = __playPosition;
1223 __playPosition = -1;
1224 __pPlayerPresentationModel->SetPlayPosition(playPosition);
1228 String* currentPlayConent = __pPlayerPresentationModel->GetPlayContentPath();
1229 String* ContentPath = __pPlayerPresentationModel->GetContentPath(__pPlayerPresentationModel->GetCurrentContentIndex());
1231 if ((__pPlayerPresentationModel->GetPlayerState() != PLAYER_STATE_PAUSED) && (__pPlayerPresentationModel->IsDuringCall() == false))
1233 __pPlayStateSlider->SetShowState(false);//To cancel touch event.
1234 __pPlayerPresentationModel->Play(__pPlayerPresentationModel->GetCurrentContentIndex(), MIN_PLAY_STATE_SLIDER_COUNT);
1235 __pPlayStateSlider->SetShowState(true);
1237 else if (!currentPlayConent->Equals(*ContentPath,true))
1239 if (__pPlayerPresentationModel->GetPlayerState() != PLAYER_STATE_PAUSED &&
1240 __pPlayerPresentationModel->GetPlayerState() != PLAYER_STATE_PLAYING )
1242 __pPlayerPresentationModel->Play(__pPlayerPresentationModel->GetCurrentContentIndex(), MIN_PLAY_STATE_SLIDER_COUNT);
1243 __pPlayerPresentationModel->Pause();
1245 __pPlayStateSlider->SetValue(0);
1246 __pPlayerPresentationModel->SetPlayPosition(0);
1249 if (!__pPlayerPresentationModel->IsDuringCall())
1251 SetFileNotExistState(__pPlayerPresentationModel->IsFileExist(__pPlayerPresentationModel->GetCurrentContentIndex()));
1254 AppLogDebug("EXIT");
1258 PlayerForm::GetItemCount(void)
1260 AppLogDebug("ENTER");
1261 if (__pPlayerPresentationModel == null)
1265 AppLogDebug("EXIT");
1266 return __pPlayerPresentationModel->GetContentListCount();
1269 Tizen::Ui::Controls::TableViewItem*
1270 PlayerForm::CreateItem(int index, int itemWidth)
1272 AppLogDebug("ENTER");
1273 RelativeLayout layout;
1276 TableViewItem* pItem = new (std::nothrow) TableViewItem();
1277 ContentInformation* pContentInfo = __pPlayerPresentationModel->GetContentInfoN(index);
1279 result r = pItem->Construct(layout, Dimension(itemWidth, __itemHeight), TABLE_VIEW_ANNEX_STYLE_NORMAL);
1280 TryCatch(r == E_SUCCESS, delete pItem, "pItem->Construct(%s)", GetErrorMessage(r));
1281 TryCatch(pContentInfo != null, delete pItem, "pContentInfo is null", GetErrorMessage(GetLastResult()));
1283 r = CreateTableViewItem(*pItem, *pContentInfo);
1284 TryCatch(r == E_SUCCESS, delete pItem, "CreateTableViewItem failed(%s)", GetErrorMessage(r));
1286 RequestThumbnail(pContentInfo->contentId, (new (std::nothrow) Integer(index)));
1287 delete pContentInfo;
1289 AppLogDebug("EXIT");
1293 AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult()));
1294 delete pContentInfo;
1299 PlayerForm::DeleteItem(const int itemIndex, Tizen::Ui::Controls::TableViewItem* pItem)
1301 AppLogDebug("ENTER");
1304 AppLogDebug("EXIT");
1309 PlayerForm::GetDefaultItemHeight(void)
1311 AppLogDebug("ENTER");
1312 AppLogDebug("EXIT");
1317 PlayerForm::OnTableViewItemStateChanged(Tizen::Ui::Controls::TableView& tableView, int itemIndex, Tizen::Ui::Controls::TableViewItem* pItem, Tizen::Ui::Controls::TableViewItemStatus status)
1319 AppLogDebug("ENTER");
1320 SceneManager* pSceneManager = SceneManager::GetInstance();
1321 AppAssert(pSceneManager);
1323 if (status == TABLE_VIEW_ITEM_STATUS_SELECTED)
1325 __pPlayerPresentationModel->Play(itemIndex, MIN_PLAY_STATE_SLIDER_COUNT);
1327 if (__pPlayerPresentationModel->IsFileExist(__pPlayerPresentationModel->GetCurrentContentIndex()) != true)
1329 SetFileNotExistState(false);
1332 AppLogDebug("EXIT");
1336 PlayerForm::OnTableViewContextItemActivationStateChanged(Tizen::Ui::Controls::TableView& tableView, int itemIndex, Tizen::Ui::Controls::TableViewContextItem* pContextItem, bool activated)
1338 AppLogDebug("ENTER");
1339 AppLogDebug("EXIT");
1343 PlayerForm::OnTableViewItemReordered(Tizen::Ui::Controls::TableView& tableView, int itemIndexFrom, int itemIndexTo)
1345 AppLogDebug("ENTER");
1346 AppLogDebug("EXIT");
1350 PlayerForm::OnFormBackRequested(Tizen::Ui::Controls::Form& source)
1352 AppLogDebug("ENTER");
1353 SceneManager* pSceneManager = SceneManager::GetInstance();
1354 result r = pSceneManager->GoBackward(BackwardSceneTransition(SCENE_TRANSITION_ANIMATION_TYPE_NONE, SCENE_DESTROY_OPTION_KEEP));
1357 UiApp* pApp = UiApp::GetInstance();
1360 __isRunByAppControl = false;
1361 // else if (__isRunByAppControl)
1363 // Tizen::App::UiApp::GetInstance()->GetFrameAt(0)->SetShowMode(FRAME_SHOW_MODE_MINIMIZED);
1365 AppLogDebug("EXIT");
1369 PlayerForm::OnFormMenuRequested(Tizen::Ui::Controls::Form& source)
1371 AppLogDebug("ENTER");
1372 bool isFileExist = __pPlayerPresentationModel->IsFileExist(__pPlayerPresentationModel->GetCurrentContentIndex());
1379 if (GetPlayerScreenState() == PLAYER_SCREEN_STATE_NORMAL)
1381 CreateOptionMenuN(source);
1382 SetOptionMenuItem(CONTEXT_MENU_ITEM_STYLE_SET_AS | CONTEXT_MENU_ITEM_STYLE_DETAILS | CONTEXT_MENU_ITEM_STYLE_SHARE_VIA
1383 | CONTEXT_MENU_ITEM_STYLE_ADD_TO_PLAYLIST | CONTEXT_MENU_ITEM_STYLE_SETTINGS);
1385 else if ((GetPlayerScreenState() == PLAYER_SCREEN_STATE_APP_CONTROL || GetPlayerScreenState() == PLAYER_SCREEN_STATE_INVALID_CONTENT_ID))
1387 CreateOptionMenuN(source);
1388 SetOptionMenuItem(CONTEXT_MENU_ITEM_STYLE_SET_AS | CONTEXT_MENU_ITEM_STYLE_DETAILS | CONTEXT_MENU_ITEM_STYLE_SHARE_VIA);
1391 AppLogDebug("EXIT");
1395 PlayerForm::OnSceneActivatedN(const Tizen::Ui::Scenes::SceneId& previousSceneId,
1396 const Tizen::Ui::Scenes::SceneId& currentSceneId,
1397 Tizen::Base::Collection::IList* pArgs)
1399 AppLogDebug("ENTER");
1400 MusicPlayerApp* pMusicPlayerApp = static_cast<MusicPlayerApp*>(MusicPlayerApp::GetInstance());
1401 TryReturnVoid(pMusicPlayerApp != null, "Unable to cast UiApp to MusicPlayerApp");
1402 /* Comment out this code temporarily in 2.0. This will be supported in 2.1.
1403 SetKeyCapture(KEY_SIDE_UP);
1404 SetKeyCapture(KEY_SIDE_DOWN);
1409 __pPlayerPresentationModel->AddMusicPlayerEventListener(*this);
1413 if (IsFailed(__pPlayerPresentationModel->SetContentList(pArgs)))
1415 AppLogDebug("__pPlayerPresentationModel->SetContentList failed(%s)", GetErrorMessage(GetLastResult()));
1416 SetPlayerScreenState(PLAYER_SCREEN_STATE_NO_CONTENT_LIST);
1423 if (!static_cast<String*>(pArgs->GetAt(0))->Equals(MUSIC, false))
1425 SetPlayerScreenState(PLAYER_SCREEN_STATE_APP_CONTROL);
1429 if (GetPlayerScreenState() == PLAYER_SCREEN_STATE_APP_CONTROL)
1431 if (__pPlayerPresentationModel->IsDuringCall())
1433 SetPlayerScreenState(PLAYER_SCREEN_STATE_DURING_CALL);
1437 SetPlayerScreenState(PLAYER_SCREEN_STATE_NORMAL);
1442 __pPlayerPresentationModel->Play(static_cast<Integer*>(pArgs->GetAt(1))->ToInt(), MIN_PLAY_STATE_SLIDER_COUNT);
1443 SetFileNotExistState(__pPlayerPresentationModel->IsFileExist(__pPlayerPresentationModel->GetCurrentContentIndex()));
1444 SetRepeatButtonImage(__pPlayerPresentationModel->GetRepeatState());// 0 - 2 (OFF, ONE, ALL)
1445 SetShuffleButtonImage(__pPlayerPresentationModel->IsShuffleEnable());// 0 - 1 (OFF, ON)
1446 TogglePlayPauseImage(__pPlayerPresentationModel->GetPlayerState());
1448 if (__pContentsListViewPanel != null && __pContentsListViewPanel->GetShowState())
1450 TableView* pContentsTableView = static_cast<TableView*>(__pContentsListViewPanel->GetControl(IDC_CONTENTS_TABLEVIEW));
1452 if (pContentsTableView != null)
1454 pContentsTableView->UpdateTableView();
1458 __isRunByAppControl = false;
1460 pArgs->RemoveAll(true);
1465 TableView* pContentsTableView = null;
1466 PlayerState playerState = __pPlayerPresentationModel->GetPlayerState();
1468 if (playerState != PLAYER_STATE_PAUSED
1469 && playerState != PLAYER_STATE_PLAYING
1470 && __pPlayerPresentationModel->GetContentListCount() == INIT_VALUE)
1472 playerState = PLAYER_STATE_ERROR;
1475 SetContentInfo( __pPlayerPresentationModel->GetCurrentContentIndex());
1476 OnPlayTimeChanged(__pPlayerPresentationModel->GetCurrentDuration(), __pPlayerPresentationModel->GetPlayPosition());
1477 OnPlayStateChanged(playerState);
1479 if (GetPlayerScreenState() == PLAYER_SCREEN_STATE_DURING_CALL
1480 && playerState != PLAYER_STATE_ERROR
1481 && __pPlayerPresentationModel->IsDuringCall() == false)
1483 SetPlayerScreenState(__playerScreenStateBeforeCall);
1485 else if (__pPlayerPresentationModel->IsDuringCall())
1487 SetPlayerScreenState(PLAYER_SCREEN_STATE_DURING_CALL);
1490 SetFileNotExistState(__pPlayerPresentationModel->IsFileExist(__pPlayerPresentationModel->GetCurrentContentIndex()));
1491 pContentsTableView = static_cast<TableView*>(__pContentsListViewPanel->GetControl(IDC_CONTENTS_TABLEVIEW));
1493 if (pContentsTableView != null)
1495 pContentsTableView->UpdateTableView();
1500 AppLogDebug("EXIT");
1504 PlayerForm::OnSceneDeactivated(const Tizen::Ui::Scenes::SceneId& currentSceneId,
1505 const Tizen::Ui::Scenes::SceneId& nextSceneId)
1507 AppLogDebug("ENTER");
1508 CancelAllThumbnailRequest();
1509 __pPlayerPresentationModel->RemoveMusicPlayerEventListener(*this);
1511 if (__pVolumePanel != null && __pVolumePanel->GetShowState())
1513 __pVolumePanel->SetShowState(false);
1515 AppLogDebug("EXIT");
1519 PlayerForm::OnChangedContentListByAppControlN(Tizen::Base::Collection::IList* pArgs)
1521 AppLogDebug("ENTER");
1522 MusicPlayerApp* pMusicPlayerApp = static_cast<MusicPlayerApp*>(MusicPlayerApp::GetInstance());
1523 TryReturnVoid(pMusicPlayerApp != null, "Unable to cast UiApp to MusicPlayerApp");
1525 if (pArgs == null || static_cast<String*>(pArgs->GetAt(0))->Equals(MUSIC, false))
1527 AppLogDebug("EXIT(E_FAILURE)");
1536 result r = __pPlayerPresentationModel->SetContentList(pArgs);
1539 AppLogDebug("EXIT(%s)", GetErrorMessage(r));
1540 SetPlayerScreenState(PLAYER_SCREEN_STATE_NO_CONTENT_LIST);
1547 SetPlayerScreenState(PLAYER_SCREEN_STATE_APP_CONTROL);
1548 int playIndex = (static_cast<Integer*>(pArgs->GetAt(1)))->ToInt();
1549 __pPlayerPresentationModel->Play(playIndex, MIN_PLAY_STATE_SLIDER_COUNT);
1552 TableView* pContentsTableView = static_cast<TableView*>(__pContentsListViewPanel->GetControl(IDC_CONTENTS_TABLEVIEW));
1553 if (pContentsTableView != null)
1555 pContentsTableView->UpdateTableView();
1562 AppLogDebug("EXIT");
1566 PlayerForm::OnUserEventReceivedN(RequestId requestId, Tizen::Base::Collection::IList* pArgs)
1568 AppLogDebug("ENTER");
1569 AppLogDebug("OnUserEventReceivedN %d", requestId);
1570 if (requestId == ID_DESTORY_PLAY_LIST_PICKER_POPUP || requestId == ID_DESTORY_SHARE_POPUP)
1572 RemovePlayListPicker();
1573 RemoveSharePicker();
1576 if (requestId == ID_SHOW_SUCCESS_MESSAGE)
1578 MessageBox messageBox;
1579 messageBox.Construct(L"", ResourceManager::GetString(L"IDS_COM_POP_SUCCESS"),
1581 COUNT_MESSAGE_BOX_TIMEOUT);
1582 int modalResult = 0;
1583 messageBox.ShowAndWait(modalResult);
1588 pArgs->RemoveAll(true);
1591 AppLogDebug("EXIT");
1595 PlayerForm::OnPlayStateChanged(PlayerState playerState)
1597 AppLogDebug("ENTER");
1598 AppLogDebug("%d", playerState);
1600 if (playerState == PLAYER_STATE_ERROR)
1602 MusicPlayerApp* pApp = static_cast<MusicPlayerApp*>(App::GetInstance());
1604 SetContentInfo( __pPlayerPresentationModel->GetCurrentContentIndex());
1606 if (__pPlayerPresentationModel->IsDuringCall())
1608 SetPlayerScreenState(PLAYER_SCREEN_STATE_DURING_CALL);
1612 SetPlayerScreenState(PLAYER_SCREEN_STATE_ERROR_CONTENT);
1615 __pMsgShowTimer->Cancel();
1616 __pMsgShowTimer->Start(10);
1618 if (pApp != null && pApp->GetRequestId() != null)
1620 AppControlProviderManager::GetInstance()->SendAppControlResult(pApp->GetRequestId(),APP_CTRL_RESULT_FAILED,null);
1621 pApp->ResetRequestId();
1625 else if (playerState == PLAYER_STATE_PAUSED)
1627 if (__pPlayerPresentationModel->IsDuringCall() == true)
1629 SetPlayerScreenState(PLAYER_SCREEN_STATE_DURING_CALL);
1632 else if(playerState == PLAYER_STATE_PLAYING && GetPlayerScreenState() != PLAYER_SCREEN_STATE_APP_CONTROL)
1634 SetPlayerScreenState(PLAYER_SCREEN_STATE_NORMAL);
1637 TogglePlayPauseImage(playerState);
1638 AppLogDebug("EXIT");
1642 PlayerForm::OnPlayContentChanged(int currentContentIndex)
1644 AppLogDebug("ENTER");
1645 String* pCurrentPlayConent = __pPlayerPresentationModel->GetPlayContentPath();
1646 String* pContentPath = __pPlayerPresentationModel->GetContentPath(__pPlayerPresentationModel->GetCurrentContentIndex());
1648 if (!pContentPath->Equals(*pCurrentPlayConent,true) || !__pPlayerPresentationModel->IsDuringCall())
1650 SetContentInfo(currentContentIndex);
1652 RemoveSetAsPicker();
1653 RemoveSharePicker();
1654 RemovePlayListPicker();
1655 SetFileNotExistState(__pPlayerPresentationModel->IsFileExist(currentContentIndex));
1658 if ( __pPlayerPresentationModel->IsDuringCall())
1660 SetPlayerScreenState(PLAYER_SCREEN_STATE_DURING_CALL);
1662 else if (__playerScreenState == PLAYER_SCREEN_STATE_DURING_CALL)
1664 SetPlayerScreenState(__playerScreenStateBeforeCall);
1667 AppLogDebug("EXIT");
1671 PlayerForm::OnPlayContentRemoved(int removedContentIndex)
1673 AppLogDebug("ENTER");
1674 int currentIndex = __pPlayerPresentationModel->GetCurrentContentIndex();
1675 int currentContentCount = __pPlayerPresentationModel->GetContentListCount();
1677 if ((removedContentIndex == currentIndex - 1)
1678 || (currentIndex == 0 && removedContentIndex == 0)
1679 || (currentIndex == removedContentIndex)
1680 || (currentIndex == __pPlayerPresentationModel->GetPreviousContentIndex()))
1682 UpdateAnimationAlbumArt(ALBUM_ART_IMAGE_PREVIOUS);
1684 else if ((removedContentIndex == currentIndex + 1)
1685 || (currentIndex == currentContentCount - 1 && removedContentIndex == 0))
1687 UpdateAnimationAlbumArt(ALBUM_ART_IMAGE_NEXT);
1689 AppLogDebug("EXIT");
1693 PlayerForm::OnPlayVolumeBarStateChanged(void)
1695 AppLogDebug("ENTER");
1696 if (__pVolumePanel->GetShowState() == true)
1698 __pVolumePanel->SetShowState(false);
1700 AppLogDebug("EXIT");
1704 PlayerForm::OnPlayTimeChanged(const Tizen::Base::String& currentDuration, int currentPosition)
1706 // AppLogDebug("ENTER");
1707 if (__playPosition == -1)
1709 __pCurrentTimeLabel->SetText(currentDuration);
1710 __pPlayStateSlider->SetValue(currentPosition);
1711 __pCurrentTimeLabel->Draw();
1712 __pCurrentTimeLabel->Show();
1713 __pPlayStateSlider->Draw();
1714 __pPlayStateSlider->Show();
1716 // AppLogDebug("EXIT");
1720 PlayerForm::OnAutoOffTimeChanged(int autoOffTime)
1722 // AppLogDebug("ENTER");
1723 __pPlayerPresentationModel->StartAutoOffTimer(autoOffTime);
1724 // AppLogDebug("EXIT");
1728 PlayerForm::OnPlayPresentationModelDestroying(void)
1730 AppLogDebug("ENTER");
1731 if (__pPlayerPresentationModel != null)
1733 __pPlayerPresentationModel = null;
1735 AppLogDebug("EXIT");
1739 PlayerForm::ShowMessageBox(const Tizen::Base::String& showText)
1741 AppLogDebug("ENTER");
1742 MessageBox messageBox;
1743 messageBox.Construct(L"Error", showText, MSGBOX_STYLE_NONE, 3000);
1744 int modalResult = 0;
1745 messageBox.ShowAndWait(modalResult);
1747 // SceneManager* pSceneManager = SceneManager::GetInstance();
1748 // AppAssert(pSceneManager);
1749 // if (static_cast<MusicPlayerApp*>(MusicPlayerApp::GetInstance())->GetOperationId().Equals(TIZEN_APPCONTROL_OPERATION_PLAY, true)
1750 // || static_cast<MusicPlayerApp*>(MusicPlayerApp::GetInstance())->GetOperationId().Equals(TIZEN_APPCONTROL_OPERATION_VIEW, true))
1752 // UiApp* pApp = UiApp::GetInstance();
1753 // pApp->Terminate();
1757 // if (pSceneManager->IsSceneAlive(IDSCN_ALL_LIST))
1759 // pSceneManager->GoBackward(BackwardSceneTransition());
1763 // UiApp* pApp = UiApp::GetInstance();
1764 // pApp->Terminate();
1767 AppLogDebug("EXIT");
1772 PlayerForm::SetContentInfo(int currentContentIndex)
1774 AppLogDebug("ENTER");
1775 ContentInformation* pContentInfoStruct = __pPlayerPresentationModel->GetContentInfoN(currentContentIndex);
1776 TryReturnVoid(pContentInfoStruct != null, "The currentContentIndex is invalid");
1778 __pTitleName->SetText(pContentInfoStruct->TitleName);
1779 __pArtistName->SetText(pContentInfoStruct->ArtistName);
1781 __pPlayStateSlider->SetRange(MIN_PLAY_STATE_SLIDER_COUNT, MAX_PLAY_STATE_SLIDER_COUNT);
1784 String totalTime = CommonUtil::GetFormatDate(pContentInfoStruct->Duration);
1785 if (totalTime.Equals(INITIAL_TIME, true) != true)
1787 __pTotalTimeLabel->SetText(totalTime);
1791 __pTotalTimeLabel->SetText(INITIAL_TIME);
1794 if (pContentInfoStruct->contentId.ToString().Equals(INVALID_VALUE_OF_CONTENT_ID, true))
1796 SetPlayerScreenState(PLAYER_SCREEN_STATE_INVALID_CONTENT_ID);
1800 if (__pPlayerPresentationModel->GetPlayerState() != PLAYER_STATE_ERROR)
1802 if (__pPlayStateSlider->IsEnabled() != true)
1804 __pPlayStateSlider->SetEnabled(true);
1806 SetFileNotExistState(true);
1809 delete pContentInfoStruct;
1811 UpdateAnimationAlbumArt(ALBUM_ART_IMAGE_CURRENT);
1813 AppLogDebug("EXIT");
1817 PlayerForm::UpdateAnimationAlbumArt(AlbumArtImage position)
1819 AppLogDebug("ENTER");
1820 Bitmap* pAlbumArtBitmap[ALBUM_ART_IMAGE_COUNT] = {null, };
1821 FloatDimension floatDimension = static_cast<Label*>(__pContentsAlbumViewPanel->GetControl(IDC_CONTENTS_THUMBNAIL))->GetSizeF();
1825 case ALBUM_ART_IMAGE_CURRENT:
1827 pAlbumArtBitmap[ALBUM_ART_IMAGE_CURRENT] = __pPlayerPresentationModel->GetContentAlbumArtN(__pPlayerPresentationModel->GetCurrentContentIndex());
1829 if (pAlbumArtBitmap[ALBUM_ART_IMAGE_CURRENT] != null)
1831 pAlbumArtBitmap[ALBUM_ART_IMAGE_CURRENT]->Scale(floatDimension);
1833 pAlbumArtBitmap[ALBUM_ART_IMAGE_PREVIOUS] = __pPlayerPresentationModel->GetContentAlbumArtN(__pPlayerPresentationModel->GetPreviousContentIndex());
1835 if (pAlbumArtBitmap[ALBUM_ART_IMAGE_PREVIOUS] != null)
1837 pAlbumArtBitmap[ALBUM_ART_IMAGE_PREVIOUS]->Scale(floatDimension);
1839 pAlbumArtBitmap[ALBUM_ART_IMAGE_NEXT] = __pPlayerPresentationModel->GetContentAlbumArtN(__pPlayerPresentationModel->GetNextContentIndex());
1841 if (pAlbumArtBitmap[ALBUM_ART_IMAGE_NEXT] != null)
1843 pAlbumArtBitmap[ALBUM_ART_IMAGE_NEXT]->Scale(floatDimension);
1848 case ALBUM_ART_IMAGE_PREVIOUS:
1850 pAlbumArtBitmap[ALBUM_ART_IMAGE_CURRENT] = null;
1851 pAlbumArtBitmap[ALBUM_ART_IMAGE_PREVIOUS] = __pPlayerPresentationModel->GetContentAlbumArtN(__pPlayerPresentationModel->GetPreviousContentIndex());
1852 if (pAlbumArtBitmap[ALBUM_ART_IMAGE_PREVIOUS] != null)
1854 pAlbumArtBitmap[ALBUM_ART_IMAGE_PREVIOUS]->Scale(floatDimension);
1856 pAlbumArtBitmap[ALBUM_ART_IMAGE_NEXT] = null;
1860 case ALBUM_ART_IMAGE_NEXT:
1862 pAlbumArtBitmap[ALBUM_ART_IMAGE_CURRENT] = null;
1863 pAlbumArtBitmap[ALBUM_ART_IMAGE_PREVIOUS] = null;
1864 pAlbumArtBitmap[ALBUM_ART_IMAGE_NEXT] = __pPlayerPresentationModel->GetContentAlbumArtN(__pPlayerPresentationModel->GetNextContentIndex());
1865 if (pAlbumArtBitmap[ALBUM_ART_IMAGE_NEXT] != null)
1867 pAlbumArtBitmap[ALBUM_ART_IMAGE_NEXT]->Scale(floatDimension);
1876 if (pAlbumArtBitmap[ALBUM_ART_IMAGE_CURRENT] != null)
1878 Canvas* pCanvas = __pAlbumArtElement[ALBUM_ART_IMAGE_CURRENT]->GetCanvasN();
1882 Point point(INIT_VALUE, INIT_VALUE);
1883 pCanvas->DrawBitmap(point, *pAlbumArtBitmap[ALBUM_ART_IMAGE_CURRENT]);
1886 delete pAlbumArtBitmap[ALBUM_ART_IMAGE_CURRENT];
1889 if (pAlbumArtBitmap[ALBUM_ART_IMAGE_PREVIOUS] != null)
1891 Canvas* pCanvas = __pAlbumArtElement[ALBUM_ART_IMAGE_PREVIOUS]->GetCanvasN();
1895 Point point(INIT_VALUE, INIT_VALUE);
1896 pCanvas->DrawBitmap(point, *pAlbumArtBitmap[ALBUM_ART_IMAGE_PREVIOUS]);
1899 delete pAlbumArtBitmap[ALBUM_ART_IMAGE_PREVIOUS];
1902 if (pAlbumArtBitmap[ALBUM_ART_IMAGE_NEXT] != null)
1904 Canvas* pCanvas = __pAlbumArtElement[ALBUM_ART_IMAGE_NEXT]->GetCanvasN();
1908 Point point(INIT_VALUE, INIT_VALUE);
1909 pCanvas->DrawBitmap(point, *pAlbumArtBitmap[ALBUM_ART_IMAGE_NEXT]);
1912 delete pAlbumArtBitmap[ALBUM_ART_IMAGE_NEXT];
1914 AppLogDebug("EXIT");
1919 PlayerForm::SetRepeatButtonImage(int repeatValue)// 0 - 2 (OFF, ONE, ALL)
1921 AppLogDebug("ENTER");
1922 Bitmap* pOptionRepeatBitmap;
1923 Bitmap* pOptionRepeatPressBitmap;
1925 switch (repeatValue)
1929 pOptionRepeatBitmap = ResourceManager::GetBitmapN(L"T02_option_rep_A.png");
1930 pOptionRepeatPressBitmap = ResourceManager::GetBitmapN(L"T02_option_rep_A_press.png");
1936 pOptionRepeatBitmap = ResourceManager::GetBitmapN(L"T02_option_rep_1.png");
1937 pOptionRepeatPressBitmap = ResourceManager::GetBitmapN(L"T02_option_rep_1_press.png");
1943 pOptionRepeatBitmap = ResourceManager::GetBitmapN(L"T02_option_rep_all.png");
1944 pOptionRepeatPressBitmap = ResourceManager::GetBitmapN(L"T02_option_rep_all_press.png");
1951 __pRepeatButton->SetNormalBitmap(Point(INIT_VALUE, INIT_VALUE), *pOptionRepeatBitmap);
1952 __pRepeatButton->SetPressedBitmap(Point(INIT_VALUE, INIT_VALUE), *pOptionRepeatPressBitmap);
1953 __pRepeatButton->Invalidate(true);
1954 __pPlayerPresentationModel->SetRepeatMode(repeatValue);
1956 delete pOptionRepeatBitmap;
1957 pOptionRepeatBitmap = null;
1958 delete pOptionRepeatPressBitmap;
1959 pOptionRepeatPressBitmap = null;
1960 AppLogDebug("EXIT");
1964 PlayerForm::SetShuffleButtonImage(bool shuffleEnable)
1966 AppLogDebug("ENTER");
1967 Bitmap* pOptionShuffleBitmap;
1969 if (shuffleEnable == false)
1971 pOptionShuffleBitmap = ResourceManager::GetBitmapN(L"T02_option_shuffle_on_dim.png");
1975 pOptionShuffleBitmap = ResourceManager::GetBitmapN(L"T02_option_shuffle_on.png");
1978 __pShuffleButton->SetNormalBitmap(Point(INIT_VALUE, INIT_VALUE), *pOptionShuffleBitmap);
1979 __pShuffleButton->Invalidate(true);
1980 __pPlayerPresentationModel->SetShuffleEnable(shuffleEnable);
1981 UpdateAnimationAlbumArt(ALBUM_ART_IMAGE_CURRENT);
1983 delete pOptionShuffleBitmap;
1984 pOptionShuffleBitmap = null;
1985 AppLogDebug("EXIT");
1989 PlayerForm::SetFileNotExistState(bool isFileExist)
1991 AppLogDebug("ENTER");
1997 if(GetPlayerScreenState() != PLAYER_SCREEN_STATE_DURING_CALL &&
1998 GetPlayerScreenState() != PLAYER_SCREEN_STATE_ERROR_CONTENT)
2000 __pContentsViewToggleButton->SetEnabled(isFileExist);
2001 __pContentsViewToggleButton->Invalidate(true);
2002 __pShuffleButton->SetEnabled(isFileExist);
2003 __pShuffleButton->Invalidate(true);
2006 AppLogDebug("EXIT");
2010 PlayerForm::TogglePlayPauseImage(PlayerState playerState)
2012 AppLogDebug("ENTER");
2013 if (playerState == PLAYER_STATE_PLAYING)
2015 RelativeLayout* layout = dynamic_cast<RelativeLayout*>(__pContentsAlbumViewPanel->GetLayoutN());
2018 layout->ResetCenterAligned(*static_cast<Label*>(__pContentsAlbumViewPanel->GetControl(IDC_ALBUM_THUMBANIL_BACKGROUND)), CENTER_ALIGN_HORIZONTAL);
2022 static_cast<Label*>(__pContentsAlbumViewPanel->GetControl(IDC_ALBUM_TURN_TABLE))->SetShowState(true);
2023 SetPauseButtonImage();
2027 RelativeLayout* layout = dynamic_cast<RelativeLayout*>(__pContentsAlbumViewPanel->GetLayoutN());
2030 layout->SetCenterAligned(*static_cast<Label*>(__pContentsAlbumViewPanel->GetControl(IDC_ALBUM_THUMBANIL_BACKGROUND)), CENTER_ALIGN_HORIZONTAL);
2034 static_cast<Label*>(__pContentsAlbumViewPanel->GetControl(IDC_ALBUM_TURN_TABLE))->SetShowState(false);
2035 SetPlayButtonImage();
2038 if (__pContentsAlbumViewPanel->GetShowState() == true)
2040 __pContentsAlbumViewPanel->Invalidate(true);
2042 AppLogDebug("EXIT");
2045 PlayerForm::SetPlayButtonImage(void)
2047 AppLogDebug("ENTER");
2048 Point point(INIT_VALUE, INIT_VALUE);
2049 Bitmap* pBitmap = ResourceManager::GetBitmapN(IDB_PLAY_BUTTON_ICON_NORMAL);
2050 __pPlayPauseButton->SetNormalBitmap(point, *pBitmap);
2053 pBitmap = ResourceManager::GetBitmapN(IDB_PLAY_BUTTON_ICON_PRESSED);
2054 __pPlayPauseButton->SetPressedBitmap(point, *pBitmap);
2057 pBitmap = ResourceManager::GetBitmapN(IDB_PLAY_BUTTON_ICON_DISABLED);
2058 __pPlayPauseButton->SetDisabledBitmap(point, *pBitmap);
2061 __pPlayPauseButton->SetActionId(IDA_PLAYER_CONTROLLER_PLAY);
2062 __pPlayPauseButton->Invalidate(true);
2063 AppLogDebug("EXIT");
2067 PlayerForm::SetPauseButtonImage(void)
2069 AppLogDebug("ENTER");
2070 Point point(INIT_VALUE, INIT_VALUE);
2071 Bitmap* pBitmap = ResourceManager::GetBitmapN(IDB_PAUSE_BUTTON_ICON_NORMAL);
2072 __pPlayPauseButton->SetNormalBitmap(point, *pBitmap);
2075 pBitmap = ResourceManager::GetBitmapN(IDB_PAUSE_BUTTON_ICON_PRESSED);
2076 __pPlayPauseButton->SetPressedBitmap(point, *pBitmap);
2079 pBitmap = ResourceManager::GetBitmapN(IDB_PAUSE_BUTTON_ICON_DISABLED);
2080 __pPlayPauseButton->SetDisabledBitmap(point, *pBitmap);
2083 __pPlayPauseButton->SetActionId(IDA_PLAYER_CONTROLLER_PAUSE);
2084 __pPlayPauseButton->Invalidate(true);
2085 AppLogDebug("EXIT");
2089 PlayerForm::InitializeVolumeBar(void)
2091 AppLogDebug("ENTER");
2092 int MediaSoundVolume = 0;
2093 SettingInfo::GetValue(MEDIA_VOLUME, MediaSoundVolume);
2094 __pPlayerPresentationModel->SetVolume(MediaSoundVolume);
2096 __pVolumePanel = new (std::nothrow) Panel();
2097 __pVolumeSlider = new (std::nothrow) Slider();
2098 OrientationStatus orientationStatue = GetOrientationStatus();
2099 Rectangle clientBounds = GetClientAreaBounds();
2100 Rectangle bounds = GetBounds();
2101 RelativeLayout layout;
2104 if (orientationStatue == ORIENTATION_STATUS_LANDSCAPE
2105 || orientationStatue == ORIENTATION_STATUS_LANDSCAPE_REVERSE)
2107 AppLogDebug("CHECK %d", clientBounds.width);
2108 if (clientBounds.width > 1200)
2110 __pVolumePanel->Construct(layout, Rectangle(clientBounds.width - W_HORIZONTAL_PLAYER
2111 , GetClientAreaBounds().height - H_HORIZONTAL_CONTROLLER_PANEL - H_VOLUME_PANEL - 50
2112 , W_HORIZONTAL_PLAYER
2117 __pVolumePanel->Construct(layout, Rectangle(clientBounds.width - 670
2118 , GetClientAreaBounds().height - H_HORIZONTAL_CONTROLLER_PANEL - H_VOLUME_PANEL - 50
2123 else if (orientationStatue == ORIENTATION_STATUS_PORTRAIT
2124 || orientationStatue == ORIENTATION_STATUS_PORTRAIT_REVERSE)
2126 __pVolumePanel->Construct(layout, Rectangle(0
2127 , clientBounds.height - H_CONTROLLER_PANEL - H_VOLUME_PANEL - 50
2128 , clientBounds.width
2132 if (clientBounds.width > 1200)
2134 __pVolumeSlider->Construct(Rectangle(0
2135 , 0, W_HORIZONTAL_PLAYER, H_VOLUME_PANEL)
2136 , BACKGROUND_STYLE_NONE
2138 , MIN_VOLUME_SLIDER_COUNT
2139 , MAX_VOLUME_SLIDER_COUNT
2140 , GROUP_STYLE_NONE);
2144 __pVolumeSlider->Construct(Rectangle(0
2145 , 0, 680, H_VOLUME_PANEL)
2146 , BACKGROUND_STYLE_NONE
2148 , MIN_VOLUME_SLIDER_COUNT
2149 , MAX_VOLUME_SLIDER_COUNT
2150 , GROUP_STYLE_NONE);
2153 __pVolumeSlider->SetColor(TRANSPARENT_COLOR);
2154 AddControl(__pVolumePanel);
2155 __pVolumePanel->AddControl(__pVolumeSlider);
2156 CommonUtil::SetLayoutFitToContainer(*__pVolumePanel, *__pVolumeSlider);
2158 Bitmap* pVolumeLeftIconBitmap = ResourceManager::GetBitmapN(L"T02_volume_icon_01.png");
2159 Bitmap* pVolumeRightIconBitmap = ResourceManager::GetBitmapN(L"T02_volume_icon_02.png");
2161 __pVolumeSlider->SetThumbBitmap(SLIDER_THUMB_STATUS_NORMAL, *ResourceManager::GetBitmapN(L"T02_player_progress_handle.png"));
2162 __pVolumeSlider->SetThumbBitmap(SLIDER_THUMB_STATUS_PRESSED, *ResourceManager::GetBitmapN(L"T02_player_progress_handle_press.png"));
2163 __pVolumeSlider->SetThumbTextColor(SLIDER_THUMB_STATUS_NORMAL, Color(255, 255, 255, 0));
2164 __pVolumeSlider->SetThumbTextColor(SLIDER_THUMB_STATUS_PRESSED, Color(255, 255, 255, 0));
2166 __pVolumeSlider->SetIcon(ICON_POSITION_LEFT, *pVolumeLeftIconBitmap);
2167 __pVolumeSlider->SetIcon(ICON_POSITION_RIGHT, *pVolumeRightIconBitmap);
2168 __pVolumeSlider->SetValue(__pPlayerPresentationModel->GetVolume());
2169 __pVolumeSlider->AddSliderEventListener(*this);
2171 delete pVolumeLeftIconBitmap;
2172 pVolumeLeftIconBitmap = null;
2173 delete pVolumeRightIconBitmap;
2174 pVolumeRightIconBitmap = null;
2180 PlayerForm::CreateTableViewItem(Tizen::Ui::Container& parent,
2181 const ContentInformation& contentInfoStruct)
2183 AppLogDebug("ENTER");
2184 Panel* pTableViewItem = new (std::nothrow) Panel();
2186 if (__fontSizeValue.Equals(STRING_FONT_SIZE_GIANT, false))
2188 if (IsFailed(pTableViewItem->Construct(IDL_CONTENTS_LIBARY_ITEM_PANEL_FONT_SIZE_GIANT)))
2190 AppLogDebug("Construct(IDL_CONTENTS_LIBARY_ITEM_PANEL) failed(%s)", GetErrorMessage(GetLastResult()));
2194 else if (__fontSizeValue.Equals(STRING_FONT_SIZE_HUGE, false))
2196 if (IsFailed(pTableViewItem->Construct(IDL_CONTENTS_LIBARY_ITEM_PANEL_FONT_SIZE_HUGE)))
2198 AppLogDebug("Construct(IDL_CONTENTS_LIBARY_ITEM_PANEL) failed(%s)", GetErrorMessage(GetLastResult()));
2202 else if (__fontSizeValue.Equals(STRING_FONT_SIZE_LARGE, false))
2204 if (IsFailed(pTableViewItem->Construct(IDL_CONTENTS_LIBARY_ITEM_PANEL_FONT_SIZE_LARGE)))
2206 AppLogDebug("Construct(IDL_CONTENTS_LIBARY_ITEM_PANEL) failed(%s)", GetErrorMessage(GetLastResult()));
2210 else if (__fontSizeValue.Equals(STRING_FONT_SIZE_SMALL, false))
2212 if (IsFailed(pTableViewItem->Construct(IDL_CONTENTS_LIBARY_ITEM_PANEL_FONT_SIZE_SMALL)))
2214 AppLogDebug("Construct(IDL_CONTENTS_LIBARY_ITEM_PANEL) failed(%s)", GetErrorMessage(GetLastResult()));
2220 if (IsFailed(pTableViewItem->Construct(IDL_CONTENTS_LIBARY_ITEM_PANEL_DEFAULT)))
2222 AppLogDebug("Construct(IDL_CONTENTS_LIBARY_ITEM_PANEL) failed(%s)", GetErrorMessage(GetLastResult()));
2227 static_cast<Label*>(pTableViewItem->GetControl(IDC_CONTENTS_TITLE_NAME))->SetText(contentInfoStruct.TitleName);
2228 static_cast<Label*>(pTableViewItem->GetControl(IDC_CONTENTS_ARTIST_NAME))->SetText(contentInfoStruct.ArtistName);
2230 if(contentInfoStruct.contentId.ToString().Equals(INVALID_VALUE_OF_CONTENT_ID,true) && __playerScreenState == PLAYER_SCREEN_STATE_APP_CONTROL)
2232 Bitmap* pBmp = __pPlayerPresentationModel->GetContentAlbumArtN(__pPlayerPresentationModel->GetCurrentContentIndex());
2233 static_cast<Label*>(pTableViewItem->GetControl(IDC_CONTENTS_THUMBNAIL))->SetBackgroundBitmap(*pBmp);
2239 static_cast<Label*>(pTableViewItem->GetControl(IDC_CONTENTS_THUMBNAIL))->SetBackgroundBitmap(*GetDefaultThumbnail());
2242 // pTableViewItem->SetSize(parent.GetWidthF()-10,pTableViewItem->GetHeightF());
2243 parent.AddControl(pTableViewItem);
2244 CommonUtil::SetLayoutFitToContainer(parent, *pTableViewItem);
2246 AppLogDebug("EXIT");
2251 PlayerForm::UpdateSplitBarState(void)
2253 AppLogDebug("ENTER");
2254 Label* pSplitBar = static_cast<Label*>(GetControl(IDC_SPLIT_BAR));
2255 if ((GetOrientationStatus() == ORIENTATION_STATUS_PORTRAIT) || (GetOrientationStatus() == ORIENTATION_STATUS_PORTRAIT_REVERSE))
2257 pSplitBar->SetSize(GetClientAreaBounds().width, 0);
2261 pSplitBar->SetSize(13, GetClientAreaBounds().height);
2263 AppLogDebug("EXIT");
2267 PlayerForm::OnThumbnailInfoReveivedN(ThumbnailInfo* pThumbnailInfo)
2269 AppLogDebug("ENTER");
2270 __pThumbnail = pThumbnailInfo->GetBitmapN();
2271 Object* pParam = pThumbnailInfo->GetUserParamN();
2274 static_cast<TableView*>(__pContentsListViewPanel->GetControl(IDC_CONTENTS_TABLEVIEW))->RefreshItem((static_cast<Integer*>(pParam))->ToInt(), TABLE_VIEW_REFRESH_TYPE_ITEM_MODIFY);
2278 delete pThumbnailInfo;
2279 AppLogDebug("EXIT");
2283 PlayerForm::OnMusicContentUpdateCompleted(void)
2285 AppLogDebug("ENTER");
2287 RemoveSharePicker();
2288 RemovePlayListPicker();
2290 UiApp* pApp = UiApp::GetInstance();
2293 if (pApp->GetAppUiState() == APP_UI_STATE_FOREGROUND)
2295 RemoveSetAsPicker();
2298 bool isCurrentContentModified = false;
2300 if (__pPlayerPresentationModel->IsFileExist(__pPlayerPresentationModel->GetCurrentContentIndex()) != true)
2302 isCurrentContentModified = true;
2303 SetFileNotExistState(false);
2306 AllListPresentationModel* pPresentationModel = AllListPresentationModel::GetInstance();
2307 if (pPresentationModel == null)
2309 AppLogDebug("EXIT");
2313 pPresentationModel->UpdateContentList();
2314 IList* pList = pPresentationModel->GetContentListN();
2316 if (pList == null || pList->GetCount() == INIT_VALUE)
2318 AppLogDebug("EXIT");
2323 String* pPlayContentPath = __pPlayerPresentationModel->GetPlayContentPath();
2324 int iContentListCount = __pPlayerPresentationModel->GetContentListCount();
2325 for (int iCount = iContentListCount - 1; iCount >= 0; iCount--)
2327 bool isFind = false;
2328 String* pContentPath = __pPlayerPresentationModel->GetContentPath(iCount);
2329 if (pContentPath == null)
2333 IEnumerator* pIEnum = pList->GetEnumeratorN();
2334 while (pIEnum->MoveNext() == E_SUCCESS)
2336 String* pCurrentPath = static_cast<String*>(pIEnum->GetCurrent());
2337 if (pCurrentPath == null)
2342 if (pContentPath->Equals(*pCurrentPath, false))
2348 if (pPlayContentPath != null && pContentPath->Equals(*pPlayContentPath, false))
2356 if (isFind == false)
2358 __pPlayerPresentationModel->RemoveContent(*pContentPath);
2362 if (__pContentsListViewPanel->IsEnabled() == true)
2364 if (__pPlayerPresentationModel->GetContentListCount() != INIT_VALUE && isCurrentContentModified == false)
2366 static_cast<TableView*>(__pContentsListViewPanel->GetControl(IDC_CONTENTS_TABLEVIEW))->UpdateTableView();
2368 else if (__pContentsListViewPanel->GetShowState() == true)
2370 __pContentsListViewPanel->SetShowState(false);
2371 __pContentsViewToggleButton->SetActionId(IDA_BUTTON_CONTENTS_LIST_VIEW);
2372 __pContentsAlbumViewPanel->SetShowState(true);
2373 __pPanelRegisterBar->Invalidate(true);
2376 AppLogDebug("EXIT");
2380 PlayerForm::UpdateItem(int itemIndex, Tizen::Ui::Controls::TableViewItem* pItem)
2382 AppLogDebug("ENTER");
2385 AppLogDebug("pItem is null");
2386 delete __pThumbnail;
2387 __pThumbnail = null;
2390 Label* pThumbnailLabel = static_cast<Label*>(pItem->GetControl(IDC_CONTENTS_THUMBNAIL, true));
2391 if (__pThumbnail == null || pThumbnailLabel == null)
2393 AppLogDebug("__pThumbnail or pThumbnailLabel is null");
2394 delete __pThumbnail;
2395 __pThumbnail = null;
2398 pThumbnailLabel->SetBackgroundBitmap(*__pThumbnail);
2399 delete __pThumbnail;
2400 __pThumbnail = null;
2401 pThumbnailLabel->Invalidate(true);
2402 AppLogDebug("EXIT");
2406 PlayerForm::SetPlayerScreenState(unsigned int playerScreenState)
2408 AppLogDebug("ENTER %d && old = %d",playerScreenState,__playerScreenState);
2410 if (__playerScreenState == playerScreenState)
2412 AppLogDebug("EXIT");
2416 __playerScreenStateBeforeCall = playerScreenState;
2418 switch (playerScreenState)
2420 case PLAYER_SCREEN_STATE_NORMAL:
2422 __pVolumeButton->SetEnabled(true);
2423 __pContentsViewToggleButton->SetEnabled(true);
2424 __pShuffleButton->SetShowState(true);
2425 __pRepeatButton->SetShowState(true);
2426 __pShuffleButton->SetEnabled(true);
2427 __pRepeatButton->SetEnabled(true);
2428 __pRewindButton->SetEnabled(true);
2429 __pPlayPauseButton->SetEnabled(true);
2430 __pForwardButton->SetEnabled(true);
2431 __pPlayStateSlider->SetEnabled(true);
2433 if (__playerScreenState == PLAYER_SCREEN_STATE_INVALID_CONTENT_ID)
2435 // __pContentsViewToggleButton->SetEnabled(false);
2436 __pShuffleButton->SetEnabled(false);
2439 if (__isRunByAppControl == false)
2445 case PLAYER_SCREEN_STATE_APP_CONTROL:
2447 AppLogDebug("111111111111111111111");
2448 __pPlayPauseButton->SetEnabled(true);
2449 __pContentsViewToggleButton->SetEnabled(true);
2450 __pPlayStateSlider->SetEnabled(true);
2453 __pShuffleButton->SetShowState(false);
2454 __pRepeatButton->SetShowState(false);
2455 __prevRepeatStateRunByAppControl = __pPlayerPresentationModel->GetRepeatState();
2457 if (__pContentsListViewPanel->GetShowState() == true)
2459 __pContentsListViewPanel->SetShowState(false);
2460 __pContentsViewToggleButton->SetActionId(IDA_BUTTON_CONTENTS_LIST_VIEW);
2461 __pContentsAlbumViewPanel->SetShowState(true);
2463 playerScreenState = PLAYER_SCREEN_STATE_APP_CONTROL;
2464 __isRunByAppControl = true;
2468 case PLAYER_SCREEN_STATE_INVALID_CONTENT_ID:
2470 // __pContentsViewToggleButton->SetEnabled(false);
2471 // __pContentsViewToggleButton->Invalidate(true);
2472 if (__playerScreenState != PLAYER_SCREEN_STATE_APP_CONTROL)
2474 __pRepeatButton->SetShowState(true);
2475 __pRepeatButton->SetEnabled(false);
2481 // __pMoreContextButton->SetEnabled(false);
2485 case PLAYER_SCREEN_STATE_NO_CONTENT_LIST:
2487 __pVolumeButton->SetEnabled(false);
2488 __pContentsViewToggleButton->SetEnabled(false);
2489 __pShuffleButton->SetShowState(true);
2490 __pRepeatButton->SetShowState(true);
2491 __pShuffleButton->SetEnabled(false);
2492 __pRepeatButton->SetEnabled(false);
2493 __pRewindButton->SetEnabled(false);
2494 __pPlayPauseButton->SetEnabled(false);
2495 __pForwardButton->SetEnabled(false);
2496 __pPlayStateSlider->SetEnabled(false);
2499 Bitmap* pThumb = ResourceManager::GetBitmapN(L"music_play_grid_thumb_loading.png");
2500 static_cast<Label*>(__pContentsAlbumViewPanel->GetControl(IDC_CONTENTS_THUMBNAIL))->SetBackgroundBitmap(*pThumb);
2505 case PLAYER_SCREEN_STATE_ERROR_CONTENT:
2507 AppLogDebug("222222222222222222222");
2508 if (__pPlayerPresentationModel->IsDuringCall())
2510 if (__isRunByAppControl)
2512 SetPlayerScreenState(PLAYER_SCREEN_STATE_APP_CONTROL);
2516 SetPlayerScreenState(PLAYER_SCREEN_STATE_DURING_CALL);
2522 __pPlayStateSlider->SetShowState(true);
2523 __pPlayStateSlider->SetValue(0);
2524 __pPlayPauseButton->SetEnabled(false);
2525 __pPlayStateSlider->SetEnabled(false);
2526 __pShuffleButton->SetEnabled(false);
2528 __pPlayStateSlider->Invalidate(true);
2530 Bitmap* pThumb = ResourceManager::GetBitmapN(L"music_play_grid_thumb_loading.png");
2531 static_cast<Label*>(__pContentsAlbumViewPanel->GetControl(IDC_CONTENTS_THUMBNAIL))->SetBackgroundBitmap(*pThumb);
2537 case PLAYER_SCREEN_STATE_DURING_CALL:
2539 __playerScreenStateBeforeCall = __playerScreenState;
2540 __pPlayPauseButton->SetEnabled(false);
2542 __pContentsViewToggleButton->SetEnabled(false);
2543 __pPlayStateSlider->SetEnabled(false);
2545 if (__pContentsListViewPanel->GetShowState() == true)
2547 __pContentsListViewPanel->SetShowState(false);
2548 __pContentsViewToggleButton->SetActionId(IDA_BUTTON_CONTENTS_LIST_VIEW);
2549 __pContentsAlbumViewPanel->SetShowState(true);
2552 Bitmap* pThumb = ResourceManager::GetBitmapN(L"music_play_grid_thumb_loading.png");
2553 static_cast<Label*>(__pContentsAlbumViewPanel->GetControl(IDC_CONTENTS_THUMBNAIL))->SetBackgroundBitmap(*pThumb);
2562 __playerScreenState = playerScreenState;
2564 AppLogDebug("EXIT");
2568 PlayerForm::GetPlayerScreenState(void)
2570 AppLogDebug("ENTER");
2571 AppLogDebug("EXIT");
2572 return __playerScreenState;
2576 PlayerForm::SetOptionMenuItem(unsigned int contextMenuItemStyle, Tizen::Graphics::Point anchorPosition)
2578 AppLogDebug("ENTER");
2579 if (__pOptionMenu == null)
2581 AppLogDebug("EXIT");
2585 CommonUtil::AddOptionMenuItem(*__pOptionMenu, contextMenuItemStyle);
2586 CommonUtil::ShowOptionMenu(*__pOptionMenu, true);
2588 // if (anchorPosition.x != -1 && anchorPosition.y != -1)
2590 // __pOptionMenu->SetAnchorPosition(anchorPosition);
2592 AppLogDebug("EXIT");
2597 PlayerForm::CreateOptionMenuN(const Tizen::Ui::Control& source)
2599 AppLogDebug("ENTER");
2601 __pOptionMenu = CommonUtil::CreateOptionMenuN(source, *this);
2602 if (__pOptionMenu != null)
2606 AppLogDebug("EXIT");
2611 PlayerForm::RemoveOptionMenu(void)
2613 AppLogDebug("ENTER");
2614 if (__pOptionMenu != null)
2616 CommonUtil::SetShowStateControl(*__pOptionMenu, false);
2617 delete __pOptionMenu;
2618 __pOptionMenu = null;
2620 AppLogDebug("EXIT");
2624 PlayerForm::TryRemoveContextMenu(int actionId)
2626 AppLogDebug("ENTER");
2627 result r = E_FAILURE;
2628 if (CommonUtil::IsVaildContextMenuItemActionId(actionId) == true)
2633 AppLogDebug("EXIT");
2638 PlayerForm::ShowSharePicker(Tizen::Base::Collection::IList* pIList)
2640 AppLogDebug("ENTER");
2641 RemoveSharePicker();
2643 __pSharePicker = new (std::nothrow) SharePopup();
2644 if (IsFailed(__pSharePicker->Initialize(this)))
2646 AppLogDebug("__pSharePicker->Initialize failed(%s)", GetErrorMessage(E_FAILURE));
2647 RemoveSharePicker();
2651 __pSharePicker->SetArguments(pIList);
2652 __pSharePicker->SetShowState(true);
2653 __pSharePicker->Show();
2655 AppLogDebug("EXIT");
2660 PlayerForm::RemoveSharePicker(void)
2662 AppLogDebug("ENTER");
2663 if (__pSharePicker != null)
2665 CommonUtil::SetShowStateControl(*__pSharePicker, false);
2666 delete __pSharePicker;
2667 __pSharePicker = null;
2669 AppLogDebug("EXIT");
2673 PlayerForm::ShowPlayListPicker(Tizen::Base::Collection::IList* pIList)
2675 AppLogDebug("ENTER");
2676 RemovePlayListPicker();
2678 __pPlayListPicker = new (std::nothrow) PlayListPickerPopup();
2679 if (IsFailed(__pPlayListPicker->Initialize(this, pIList)))
2681 AppLogDebug("__pSharePicker->Initialize failed(%s)", GetErrorMessage(E_FAILURE));
2682 RemovePlayListPicker();
2686 __pPlayListPicker->SetShowState(true);
2687 __pPlayListPicker->Show();
2689 AppLogDebug("EXIT");
2694 PlayerForm::RemovePlayListPicker(void)
2696 AppLogDebug("ENTER");
2697 if (__pPlayListPicker != null)
2699 CommonUtil::SetShowStateControl(*__pPlayListPicker, false);
2700 delete __pPlayListPicker;
2701 __pPlayListPicker = null;
2703 AppLogDebug("EXIT");
2707 PlayerForm::ShowSetAsPicker(Tizen::Base::Collection::IList* pIList)
2709 AppLogDebug("ENTER");
2710 RemoveSetAsPicker();
2712 __pSetAsPicker = new (std::nothrow) SetAsPopup();
2713 if (IsFailed(__pSetAsPicker->Initialize(this)))
2715 AppLogDebug("__pSharePicker->Initialize failed(%s)", GetErrorMessage(E_FAILURE));
2716 RemoveSetAsPicker();
2720 __pSetAsPicker->SetCurrentContentPath(new (std::nothrow) String(*static_cast<String*>(pIList->GetAt(0))));
2721 __pSetAsPicker->SetShowState(true);
2722 __pSetAsPicker->Show();
2724 pIList->RemoveAll(true);
2727 AppLogDebug("EXIT");
2732 PlayerForm::RemoveSetAsPicker(void)
2734 AppLogDebug("ENTER");
2735 if (__pSetAsPicker != null)
2737 CommonUtil::SetShowStateControl(*__pSetAsPicker, false);
2738 // delete __pSetAsPicker;
2739 // __pSetAsPicker = null;
2741 AppLogDebug("EXIT");
2745 PlayerForm::LanucherPicker(PickerType pickerType)
2747 AppLogDebug("ENTER");
2748 IList* pArgumentList = GetPickerArgumentListN(pickerType);
2749 if (pArgumentList == null)
2751 AppLogDebug("GetPickerArgumentListN is null");
2755 result r = E_FAILURE;
2756 if (pickerType == PICKER_TYPE_PLAY_LIST_PICKER)
2758 r = ShowPlayListPicker(pArgumentList);
2760 else if (pickerType == PICKER_TYPE_SHARE_PICKER)
2762 r = ShowSharePicker(pArgumentList);
2764 else if (pickerType == PICKER_TYPE_SET_AS_PICKER)
2766 r = ShowSetAsPicker(pArgumentList);
2771 AppLogDebug("ShowPlayListPicker failed(%s)", GetErrorMessage(r));
2772 delete pArgumentList;
2774 AppLogDebug("EXIT");
2778 Tizen::Base::Collection::IList*
2779 PlayerForm::GetPickerArgumentListN(PickerType pickerType)
2781 AppLogDebug("ENTER");
2785 case PICKER_TYPE_SET_AS_PICKER:
2787 case PICKER_TYPE_PLAY_LIST_PICKER:
2789 case PICKER_TYPE_SHARE_PICKER:
2791 contentPath.Append(*__pPlayerPresentationModel->GetContentPath(__pPlayerPresentationModel->GetCurrentContentIndex()));
2797 AppLogDebug("EXIT");
2803 Tizen::Base::Collection::ArrayList* pDataList = new (std::nothrow) ArrayList(SingleObjectDeleter);
2804 if (IsFailed(pDataList->Construct()))
2806 AppLogDebug("Construct failed(%s)", GetErrorMessage(GetLastResult()));
2811 pDataList->Add(*(new (std::nothrow) String(contentPath)));
2812 AppLogDebug("EXIT");
2817 PlayerForm::OnFontSizeChanged(void)
2819 __fontSizeValue = CommonUtil::GetFontSizeValue();
2820 __itemHeight = CommonUtil::GetItemHeight(__fontSizeValue);
2821 TableView* pContentsTableView = static_cast<TableView*>(__pContentsListViewPanel->GetControl(IDC_CONTENTS_TABLEVIEW));
2822 pContentsTableView->UpdateTableView();