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);
496 TableView* pContentsTableView = static_cast<TableView*>(__pContentsListViewPanel->GetControl(IDC_CONTENTS_TABLEVIEW));
497 pContentsTableView->UpdateTableView();
501 case IDA_PLAYER_CONTROLLER_VOLUME:
503 if (__pVolumePanel == null)
505 InitializeVolumeBar();
509 if (__pVolumePanel->GetShowState() == true)
511 __pVolumePanel->SetShowState(false);
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);
526 case IDA_PLAYER_CONTROLLER_PLAY:
528 String* pCurrentPlayConent = __pPlayerPresentationModel->GetPlayContentPath();
529 String* pContentPath = __pPlayerPresentationModel->GetContentPath(__pPlayerPresentationModel->GetCurrentContentIndex());
531 if (pCurrentPlayConent->Equals(*pContentPath))
533 __pPlayerPresentationModel->Play(__pPlayerPresentationModel->GetCurrentContentIndex(), __pPlayStateSlider->GetValue(), true);
537 __pPlayerPresentationModel->Play(__pPlayerPresentationModel->GetCurrentContentIndex(), __pPlayStateSlider->GetValue());
540 if (__pPlayerPresentationModel->IsFileExist(__pPlayerPresentationModel->GetCurrentContentIndex()) != true)
542 SetFileNotExistState(false);
547 case IDA_PLAYER_CONTROLLER_PAUSE:
549 __pPlayerPresentationModel->Pause();
553 case IDA_PLAYER_CONTROLLER_BACK:
555 result r = pSceneManager->GoBackward(BackwardSceneTransition(SCENE_TRANSITION_ANIMATION_TYPE_NONE, SCENE_DESTROY_OPTION_KEEP));
558 UiApp* pApp = UiApp::GetInstance();
561 __isRunByAppControl = false;
562 // else if (__isRunByAppControl)
564 // Tizen::App::UiApp::GetInstance()->GetFrameAt(0)->SetShowMode(FRAME_SHOW_MODE_MINIMIZED);
569 case IDA_PLAYER_CONTROLLER_REPEAT:
571 switch (__pPlayerPresentationModel->GetRepeatState())
573 case IDA_TYPE_REPEAT_A:
575 SetRepeatButtonImage(IDA_TYPE_REPEAT_ONE);
579 case IDA_TYPE_REPEAT_ONE:
581 SetRepeatButtonImage(IDA_TYPE_REPEAT_ALL);
585 case IDA_TYPE_REPEAT_ALL:
587 SetRepeatButtonImage(IDA_TYPE_REPEAT_A);
597 case IDA_PLAYER_CONTROLLER_SHUFFLE:
599 if (__pPlayerPresentationModel->IsShuffleEnable() == false)
601 SetShuffleButtonImage(true);
605 SetShuffleButtonImage(false);
610 case IDA_PLAYER_CONTROLLER_MORE:
612 if (GetPlayerScreenState() == PLAYER_SCREEN_STATE_NORMAL)
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);
618 else if (GetPlayerScreenState() == PLAYER_SCREEN_STATE_APP_CONTROL || GetPlayerScreenState() == PLAYER_SCREEN_STATE_INVALID_CONTENT_ID)
620 CreateOptionMenuN(source);
621 SetOptionMenuItem(CONTEXT_MENU_ITEM_STYLE_SET_AS | CONTEXT_MENU_ITEM_STYLE_DETAILS | CONTEXT_MENU_ITEM_STYLE_SHARE_VIA);
626 case IDA_CONTEXT_MENU_ITEM_SHARE_VIA:
628 LanucherPicker(PICKER_TYPE_SHARE_PICKER);
632 case IDA_CONTEXT_MENU_ITEM_STYLE_ADD_TO_PLAYLIST:
634 LanucherPicker(PICKER_TYPE_PLAY_LIST_PICKER);
638 case IDA_CONTEXT_MENU_ITEM_STYLE_SET_AS:
640 LanucherPicker(PICKER_TYPE_SET_AS_PICKER);
644 case IDA_CONTEXT_MENU_ITEM_STYLE_SOUND_PATH:
646 if (__pSoundPathPopup == null)
648 __pSoundPathPopup = new (std::nothrow) SoundPathPopup();
649 __pSoundPathPopup->Initialize();
651 __pSoundPathPopup->ShowPopup(true);
655 case IDA_CONTEXT_MENU_ITEM_STYLE_DETAILS:
657 pSceneManager->GoForward(ForwardSceneTransition(IDSCN_CONTENT_DETAIL));
661 case IDA_CONTEXT_MENU_ITEM_SETTINGS:
663 SettingPresentationModel::GetInstance()->InitializeSettingValue();
664 pSceneManager->GoForward(ForwardSceneTransition(IDSCN_MUSIC_SETTING));
672 TryRemoveContextMenu(actionId);
677 PlayerForm::OnKeyPressed(const Tizen::Ui::Control& source, Tizen::Ui::KeyCode keyCode)
679 AppLogDebug("ENTER");
684 if (__pVolumePanel == null)
686 InitializeVolumeBar();
689 __pVolumePanel->SetShowState(true);
690 __pPlayerPresentationModel->SetVolume(__pPlayerPresentationModel->GetVolume() + 1);
691 __pVolumeSlider->SetValue(__pPlayerPresentationModel->GetVolume());
692 __pVolumeSlider->Invalidate(true);
698 if (__pVolumePanel == null)
700 InitializeVolumeBar();
703 __pVolumePanel->SetShowState(true);
704 __pPlayerPresentationModel->SetVolume(__pPlayerPresentationModel->GetVolume() - 1);
705 __pVolumeSlider->SetValue(__pPlayerPresentationModel->GetVolume());
706 __pVolumeSlider->Invalidate(true);
711 if (source.Equals(*__pForwardButton) || source.Equals(*__pRewindButton))
713 __isLongPressed = false;
724 PlayerForm::OnKeyReleased(const Tizen::Ui::Control& source, Tizen::Ui::KeyCode keyCode)
726 AppLogDebug("ENTER");
730 if (source.Equals(*__pForwardButton) || source.Equals(*__pRewindButton))
732 if (__isLongPressed == true)
734 __pPlayerPresentationModel->StopForwardRewind();
738 if (source.Equals(*__pRewindButton))
740 if (__pPlayerPresentationModel->GetContentListCount() > 1)
742 while (__pPlayerPresentationModel->IsFileExist(__pPlayerPresentationModel->GetPreviousContentIndex()) == false
743 && __pPlayerPresentationModel->GetContentListCount() > 0)
745 __pPlayerPresentationModel->RemoveContent(*__pPlayerPresentationModel->GetContentPath(__pPlayerPresentationModel->GetPreviousContentIndex()));
748 __flickDirection = FLICK_DIRECTION_RIGHT;
750 if (__pPlayerPresentationModel->GetContentListCount() <= 1)
752 MessageBox messageBox;
753 messageBox.Construct(L"", ResourceManager::GetString(L"IDS_MUSIC_HEADER_NO_SONGS"), MSGBOX_STYLE_NONE, 1000);
756 messageBox.ShowAndWait(modalResult);
765 if (__pPlayerPresentationModel->GetContentListCount() > 1)
767 while (__pPlayerPresentationModel->IsFileExist(__pPlayerPresentationModel->GetNextContentIndex()) == false
768 && __pPlayerPresentationModel->GetContentListCount() > 0)
770 __pPlayerPresentationModel->RemoveContent(*__pPlayerPresentationModel->GetContentPath(__pPlayerPresentationModel->GetNextContentIndex()));
773 __flickDirection = FLICK_DIRECTION_LEFT;
775 if (__pPlayerPresentationModel->GetContentListCount() <= 1)
777 MessageBox messageBox;
778 messageBox.Construct(L"", ResourceManager::GetString(L"IDS_MUSIC_HEADER_NO_SONGS"), MSGBOX_STYLE_NONE, 1000);
781 messageBox.ShowAndWait(modalResult);
799 PlayerForm::OnKeyLongPressed(const Tizen::Ui::Control& source, Tizen::Ui::KeyCode keyCode)
801 AppLogDebug("ENTER");
802 AppLogDebug("keycode(%d)", keyCode);
806 if (source.Equals(*__pForwardButton) || source.Equals(*__pRewindButton))
808 __isLongPressed = true;
809 if (source.Equals(*__pRewindButton) && (__pPlayStateSlider->IsEnabled()))
811 __pPlayerPresentationModel->SeekToRewind();
813 else if (__pPlayStateSlider->IsEnabled())
815 __pPlayerPresentationModel->SeekToForward();
827 PlayerForm::OnTouchLongPressed(const Control& source, const Point& currentPosition, const TouchEventInfo& touchInfo)
829 AppLogDebug("ENTER");
830 if (source.Equals(*__pForwardButton) || source.Equals(*__pRewindButton))
832 __isLongPressed = true;
833 if (source.Equals(*__pRewindButton) && (__pPlayStateSlider->IsEnabled()))
835 __pPlayerPresentationModel->SeekToRewind();
837 else if (__pPlayStateSlider->IsEnabled())
839 __pPlayerPresentationModel->SeekToForward();
846 PlayerForm::OnTouchMoved(const Tizen::Ui::Control& source, const Tizen::Graphics::Point& currentPosition, const Tizen::Ui::TouchEventInfo& touchInfo)
848 AppLogDebug("ENTER");
849 Label *pAlbumLable = static_cast<Label*>(__pContentsAlbumViewPanel->GetControl(IDC_CONTENTS_THUMBNAIL));
850 if (source.Equals(*pAlbumLable) == false)
855 if (__isAnimationPerformed == true || __isContentMoveCompleted == true)
860 if (currentPosition.y < 0 || currentPosition.y > GetBounds().height - __pControllerPanel->GetBounds().height)
865 if (Tizen::Base::Utility::Math::Abs(touchInfo.GetStartPosition().y - currentPosition.y) > 100)
870 if (currentPosition.x > touchInfo.GetStartPosition().x + 100)
872 if (__pPlayerPresentationModel->GetContentListCount() > 1)
874 while (__pPlayerPresentationModel->IsFileExist(__pPlayerPresentationModel->GetPreviousContentIndex()) == false
875 && __pPlayerPresentationModel->GetContentListCount() > 0)
877 __pPlayerPresentationModel->RemoveContent(*__pPlayerPresentationModel->GetContentPath(__pPlayerPresentationModel->GetPreviousContentIndex()));
880 __flickDirection = FLICK_DIRECTION_RIGHT;
881 __isContentMoveCompleted = true;
882 if (__pPlayerPresentationModel->GetContentListCount() <= 1)
884 MessageBox messageBox;
885 messageBox.Construct(L"", ResourceManager::GetString(L"IDS_MUSIC_HEADER_NO_SONGS"), MSGBOX_STYLE_NONE, 1000);
888 messageBox.ShowAndWait(modalResult);
895 else if (currentPosition.x < touchInfo.GetStartPosition().x - 100)
897 if (__pPlayerPresentationModel->GetContentListCount() > 1)
899 while (__pPlayerPresentationModel->IsFileExist(__pPlayerPresentationModel->GetNextContentIndex()) == false
900 && __pPlayerPresentationModel->GetContentListCount() > 0)
902 __pPlayerPresentationModel->RemoveContent(*__pPlayerPresentationModel->GetContentPath(__pPlayerPresentationModel->GetNextContentIndex()));
905 __flickDirection = FLICK_DIRECTION_LEFT;
906 __isContentMoveCompleted = true;
907 if (__pPlayerPresentationModel->GetContentListCount() <= 1)
909 MessageBox messageBox;
910 messageBox.Construct(L"", ResourceManager::GetString(L"IDS_MUSIC_HEADER_NO_SONGS"), MSGBOX_STYLE_NONE, 1000);
913 messageBox.ShowAndWait(modalResult);
924 PlayerForm::OnTouchPressed(const Control& source, const Point& currentPosition, const TouchEventInfo& touchInfo)
926 AppLogDebug("ENTER");
927 if (source.Equals(*__pForwardButton) || source.Equals(*__pRewindButton))
929 __isLongPressed = false;
933 if (__pVolumePanel != null && __pVolumePanel->GetShowState())
935 __pVolumePanel->SetShowState(false);
942 PlayerForm::OnTouchReleased(const Control& source, const Point& currentPosition, const TouchEventInfo& touchInfo)
944 AppLogDebug("ENTER");
945 __isContentMoveCompleted = false;
946 if (source.Equals(*__pForwardButton) || source.Equals(*__pRewindButton))
948 if (__isLongPressed == true)
950 __pPlayerPresentationModel->StopForwardRewind();
954 if(0 > currentPosition.x || source.GetWidth() < currentPosition.x ||
955 0 > currentPosition.y || source.GetHeight() < currentPosition.y)
960 if (source.Equals(*__pRewindButton))
962 if (__pPlayerPresentationModel->GetContentListCount() > 1)
964 while (__pPlayerPresentationModel->IsFileExist(__pPlayerPresentationModel->GetPreviousContentIndex()) == false
965 && __pPlayerPresentationModel->GetContentListCount() > 0)
967 __pPlayerPresentationModel->RemoveContent(*__pPlayerPresentationModel->GetContentPath(__pPlayerPresentationModel->GetPreviousContentIndex()));
970 __flickDirection = FLICK_DIRECTION_RIGHT;
972 if (__pPlayerPresentationModel->GetContentListCount() <= 1)
974 MessageBox messageBox;
975 messageBox.Construct(L"", ResourceManager::GetString(L"IDS_MUSIC_HEADER_NO_SONGS"), MSGBOX_STYLE_NONE, 1000);
978 messageBox.ShowAndWait(modalResult);
987 if (__pPlayerPresentationModel->GetContentListCount() > 1)
989 while (__pPlayerPresentationModel->IsFileExist(__pPlayerPresentationModel->GetNextContentIndex()) == false
990 && __pPlayerPresentationModel->GetContentListCount() > 0)
992 __pPlayerPresentationModel->RemoveContent(*__pPlayerPresentationModel->GetContentPath(__pPlayerPresentationModel->GetNextContentIndex()));
995 __flickDirection = FLICK_DIRECTION_LEFT;
997 if (__pPlayerPresentationModel->GetContentListCount() <= 1)
999 MessageBox messageBox;
1000 messageBox.Construct(L"", ResourceManager::GetString(L"IDS_MUSIC_HEADER_NO_SONGS"), MSGBOX_STYLE_NONE, 1000);
1002 int modalResult = 0;
1003 messageBox.ShowAndWait(modalResult);
1016 AppLogDebug("EXIT");
1020 PlayerForm::OnTouchCanceled(const Tizen::Ui::Control& source, const Tizen::Graphics::Point& currentPosition, const Tizen::Ui::TouchEventInfo& touchInfo)
1022 AppLogDebug("ENTER");
1023 __isContentMoveCompleted = false;
1025 if (source.Equals(*__pForwardButton) || source.Equals(*__pRewindButton))
1027 if (__isLongPressed == true)
1029 __pPlayerPresentationModel->StopForwardRewind();
1030 __isLongPressed = false;
1034 AppLogDebug("EXIT");
1039 PlayerForm::PlayAnimation(void)
1041 AppLogDebug("ENTER");
1042 __isAnimationPerformed = true;
1043 // if (AnimationTransaction::GetStatus(__transactionID) == ANIMATION_TRANSACTION_STATUS_STOPPED)
1045 if (__flickDirection == FLICK_DIRECTION_RIGHT)
1047 __pAlbumArtElement[ALBUM_ART_IMAGE_PREVIOUS]->SetShowState(true);
1049 AnimationTransaction::Begin(__transactionID);
1050 AnimationTransaction::SetVisualElementAnimationDuration(200);
1051 AnimationTransaction::SetCurrentTransactionEventListener(this);
1053 VisualElementPropertyAnimation* pAnimation = new (std::nothrow) VisualElementPropertyAnimation();
1054 pAnimation->SetPropertyName(L"bounds");
1055 pAnimation->SetStartValue(Variant(rectanglePreviousElement));
1056 pAnimation->SetEndValue(Variant(rectangleCurrentElement));
1058 __pAlbumArtElement[ALBUM_ART_IMAGE_PREVIOUS]->AddAnimation(*pAnimation);
1061 pAnimation = new (std::nothrow) VisualElementPropertyAnimation();
1062 pAnimation->SetPropertyName(L"bounds");
1063 pAnimation->SetStartValue(Variant(rectangleCurrentElement));
1064 pAnimation->SetEndValue(Variant(rectangleNextElement));
1066 __pAlbumArtElement[ALBUM_ART_IMAGE_CURRENT]->AddAnimation(*pAnimation);
1068 __pAlbumArtElement[ALBUM_ART_IMAGE_NEXT]->SetShowState(false);
1071 AnimationTransaction::Commit();
1073 else if (__flickDirection == FLICK_DIRECTION_LEFT)
1075 __pAlbumArtElement[ALBUM_ART_IMAGE_NEXT]->SetShowState(true);
1077 AnimationTransaction::Begin(__transactionID);
1078 AnimationTransaction::SetVisualElementAnimationDuration(200);
1079 AnimationTransaction::SetCurrentTransactionEventListener(this);
1081 VisualElementPropertyAnimation* pAnimation = new (std::nothrow) VisualElementPropertyAnimation();
1082 pAnimation->SetPropertyName(L"bounds");
1083 pAnimation->SetStartValue(Variant(rectangleCurrentElement));
1084 pAnimation->SetEndValue(Variant(rectanglePreviousElement));
1086 __pAlbumArtElement[ALBUM_ART_IMAGE_CURRENT]->AddAnimation(*pAnimation);
1089 pAnimation = new (std::nothrow) VisualElementPropertyAnimation();
1090 pAnimation->SetPropertyName(L"bounds");
1091 pAnimation->SetStartValue(Variant(rectangleNextElement));
1092 pAnimation->SetEndValue(Variant(rectangleCurrentElement));
1094 __pAlbumArtElement[ALBUM_ART_IMAGE_NEXT]->AddAnimation(*pAnimation);
1095 __pAlbumArtElement[ALBUM_ART_IMAGE_PREVIOUS]->SetShowState(false);
1098 AnimationTransaction::Commit();
1105 AppLogDebug("EXIT");
1109 PlayerForm::StopAnimation(void)
1111 AppLogDebug("ENTER");
1112 AppLogDebug("EXIT");
1116 PlayerForm::OnAnimationTransactionStarted(int transactionId)
1118 AppLogDebug("ENTER");
1119 __pContentPlayTimer->Cancel();
1120 AppLogDebug("EXIT");
1124 PlayerForm::OnAnimationTransactionStopped(int transactionId)
1126 AppLogDebug("ENTER");
1127 AppLogDebug("EXIT");
1131 PlayerForm::OnAnimationTransactionFinished(int transactionId)
1133 AppLogDebug("ENTER");
1134 __isAnimationPerformed = false;
1135 __pAnimationFinishedTimer->Start(1);
1136 __pContentPlayTimer->Start(700);
1137 AppLogDebug("EXIT");
1141 PlayerForm::OnSliderBarMoved(Tizen::Ui::Controls::Slider& source, int value)
1143 AppLogDebug("ENTER value = %d",value);
1144 if (source.Equals(*__pPlayStateSlider))
1148 __pPlayStateSlider->SetShowState(false);//To cancel touch event.
1149 __pSeekTimer->Cancel();
1150 __playPosition = -1;
1151 __pPlayerPresentationModel->SetPlayPosition(100);
1155 __playPosition = value;
1156 __pSeekTimer->Cancel();
1157 __pSeekTimer->Start(100);
1159 //__pPlayerPresentationModel->SetPlayPosition(value);
1161 __pPlayStateSlider->SetShowState(true);
1165 if (__pVolumePanel->GetShowState() == false)
1167 __pVolumePanel->SetShowState(true);
1169 __pPlayerPresentationModel->SetVolume(value);
1171 AppLogDebug("EXIT");
1175 PlayerForm::OnTimerExpired(Tizen::Base::Runtime::Timer& timer)
1177 AppLogDebug("ENTER");
1178 if (&timer == __pAnimationFinishedTimer)
1180 if (__flickDirection == FLICK_DIRECTION_RIGHT)
1182 Tizen::Ui::Animations::VisualElement* pTempVisualElement = __pAlbumArtElement[ALBUM_ART_IMAGE_NEXT];
1183 pTempVisualElement->SetBounds(rectanglePreviousElement);
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);
1190 __pPlayerPresentationModel->MovePreviousContent(true);
1192 else if (__flickDirection == FLICK_DIRECTION_LEFT)
1194 Tizen::Ui::Animations::VisualElement* pTempVisualElement = __pAlbumArtElement[ALBUM_ART_IMAGE_PREVIOUS];
1195 pTempVisualElement->SetBounds(rectangleNextElement);
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);
1202 __pPlayerPresentationModel->MoveNextContent();
1204 __flickDirection = FLICK_DIRECTION_NONE;
1205 __transactionID = ANIMATION_TRANSACTION_STATUS_STOPPED;
1207 else if (&timer == __pMsgShowTimer)
1209 ShowMessageBox(ResourceManager::GetString(L"IDS_MUSIC_POP_UNABLE_TO_PLAY_ERROR_OCCURRED"));
1211 else if (&timer == __pSeekTimer)
1213 int playPosition = __playPosition;
1214 __playPosition = -1;
1215 __pPlayerPresentationModel->SetPlayPosition(playPosition);
1219 String* currentPlayConent = __pPlayerPresentationModel->GetPlayContentPath();
1220 String* ContentPath = __pPlayerPresentationModel->GetContentPath(__pPlayerPresentationModel->GetCurrentContentIndex());
1222 if ((__pPlayerPresentationModel->GetPlayerState() != PLAYER_STATE_PAUSED) && (__pPlayerPresentationModel->IsDuringCall() == false))
1224 __pPlayStateSlider->SetShowState(false);//To cancel touch event.
1225 __pPlayerPresentationModel->Play(__pPlayerPresentationModel->GetCurrentContentIndex(), MIN_PLAY_STATE_SLIDER_COUNT);
1226 __pPlayStateSlider->SetShowState(true);
1228 else if (!currentPlayConent->Equals(*ContentPath,true))
1230 if (__pPlayerPresentationModel->GetPlayerState() != PLAYER_STATE_PAUSED &&
1231 __pPlayerPresentationModel->GetPlayerState() != PLAYER_STATE_PLAYING )
1233 __pPlayerPresentationModel->Play(__pPlayerPresentationModel->GetCurrentContentIndex(), MIN_PLAY_STATE_SLIDER_COUNT);
1234 __pPlayerPresentationModel->Pause();
1236 __pPlayStateSlider->SetValue(0);
1237 __pPlayerPresentationModel->SetPlayPosition(0);
1240 if (!__pPlayerPresentationModel->IsDuringCall())
1242 SetFileNotExistState(__pPlayerPresentationModel->IsFileExist(__pPlayerPresentationModel->GetCurrentContentIndex()));
1245 AppLogDebug("EXIT");
1249 PlayerForm::GetItemCount(void)
1251 AppLogDebug("ENTER");
1252 if (__pPlayerPresentationModel == null)
1256 AppLogDebug("EXIT");
1257 return __pPlayerPresentationModel->GetContentListCount();
1260 Tizen::Ui::Controls::TableViewItem*
1261 PlayerForm::CreateItem(int index, int itemWidth)
1263 AppLogDebug("ENTER");
1264 RelativeLayout layout;
1267 TableViewItem* pItem = new (std::nothrow) TableViewItem();
1268 ContentInformation* pContentInfo = __pPlayerPresentationModel->GetContentInfoN(index);
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()));
1274 r = CreateTableViewItem(*pItem, *pContentInfo);
1275 TryCatch(r == E_SUCCESS, delete pItem, "CreateTableViewItem failed(%s)", GetErrorMessage(r));
1277 RequestThumbnail(pContentInfo->contentId, (new (std::nothrow) Integer(index)));
1278 delete pContentInfo;
1280 AppLogDebug("EXIT");
1284 AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult()));
1285 delete pContentInfo;
1290 PlayerForm::DeleteItem(const int itemIndex, Tizen::Ui::Controls::TableViewItem* pItem)
1292 AppLogDebug("ENTER");
1295 AppLogDebug("EXIT");
1300 PlayerForm::GetDefaultItemHeight(void)
1302 AppLogDebug("ENTER");
1303 AppLogDebug("EXIT");
1308 PlayerForm::OnTableViewItemStateChanged(Tizen::Ui::Controls::TableView& tableView, int itemIndex, Tizen::Ui::Controls::TableViewItem* pItem, Tizen::Ui::Controls::TableViewItemStatus status)
1310 AppLogDebug("ENTER");
1311 SceneManager* pSceneManager = SceneManager::GetInstance();
1312 AppAssert(pSceneManager);
1314 if (status == TABLE_VIEW_ITEM_STATUS_SELECTED)
1316 __pPlayerPresentationModel->Play(itemIndex, MIN_PLAY_STATE_SLIDER_COUNT);
1318 if (__pPlayerPresentationModel->IsFileExist(__pPlayerPresentationModel->GetCurrentContentIndex()) != true)
1320 SetFileNotExistState(false);
1323 AppLogDebug("EXIT");
1327 PlayerForm::OnTableViewContextItemActivationStateChanged(Tizen::Ui::Controls::TableView& tableView, int itemIndex, Tizen::Ui::Controls::TableViewContextItem* pContextItem, bool activated)
1329 AppLogDebug("ENTER");
1330 AppLogDebug("EXIT");
1334 PlayerForm::OnTableViewItemReordered(Tizen::Ui::Controls::TableView& tableView, int itemIndexFrom, int itemIndexTo)
1336 AppLogDebug("ENTER");
1337 AppLogDebug("EXIT");
1341 PlayerForm::OnFormBackRequested(Tizen::Ui::Controls::Form& source)
1343 AppLogDebug("ENTER");
1344 SceneManager* pSceneManager = SceneManager::GetInstance();
1345 result r = pSceneManager->GoBackward(BackwardSceneTransition(SCENE_TRANSITION_ANIMATION_TYPE_NONE, SCENE_DESTROY_OPTION_KEEP));
1348 UiApp* pApp = UiApp::GetInstance();
1351 __isRunByAppControl = false;
1352 // else if (__isRunByAppControl)
1354 // Tizen::App::UiApp::GetInstance()->GetFrameAt(0)->SetShowMode(FRAME_SHOW_MODE_MINIMIZED);
1356 AppLogDebug("EXIT");
1360 PlayerForm::OnFormMenuRequested(Tizen::Ui::Controls::Form& source)
1362 AppLogDebug("ENTER");
1363 bool isFileExist = __pPlayerPresentationModel->IsFileExist(__pPlayerPresentationModel->GetCurrentContentIndex());
1370 if (GetPlayerScreenState() == PLAYER_SCREEN_STATE_NORMAL)
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);
1376 else if ((GetPlayerScreenState() == PLAYER_SCREEN_STATE_APP_CONTROL || GetPlayerScreenState() == PLAYER_SCREEN_STATE_INVALID_CONTENT_ID))
1378 CreateOptionMenuN(source);
1379 SetOptionMenuItem(CONTEXT_MENU_ITEM_STYLE_SET_AS | CONTEXT_MENU_ITEM_STYLE_DETAILS | CONTEXT_MENU_ITEM_STYLE_SHARE_VIA);
1382 AppLogDebug("EXIT");
1386 PlayerForm::OnSceneActivatedN(const Tizen::Ui::Scenes::SceneId& previousSceneId,
1387 const Tizen::Ui::Scenes::SceneId& currentSceneId,
1388 Tizen::Base::Collection::IList* pArgs)
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);
1400 __pPlayerPresentationModel->AddMusicPlayerEventListener(*this);
1404 if (IsFailed(__pPlayerPresentationModel->SetContentList(pArgs)))
1406 AppLogDebug("__pPlayerPresentationModel->SetContentList failed(%s)", GetErrorMessage(GetLastResult()));
1407 SetPlayerScreenState(PLAYER_SCREEN_STATE_NO_CONTENT_LIST);
1414 if (!static_cast<String*>(pArgs->GetAt(0))->Equals(MUSIC, false))
1416 SetPlayerScreenState(PLAYER_SCREEN_STATE_APP_CONTROL);
1420 if (GetPlayerScreenState() == PLAYER_SCREEN_STATE_APP_CONTROL)
1422 if (__pPlayerPresentationModel->IsDuringCall())
1424 SetPlayerScreenState(PLAYER_SCREEN_STATE_DURING_CALL);
1428 SetPlayerScreenState(PLAYER_SCREEN_STATE_NORMAL);
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());
1440 TableView* pContentsTableView = static_cast<TableView*>(__pContentsListViewPanel->GetControl(IDC_CONTENTS_TABLEVIEW));
1441 if (pContentsTableView != null)
1443 pContentsTableView->UpdateTableView();
1446 __isRunByAppControl = false;
1448 pArgs->RemoveAll(true);
1453 PlayerState playerState = __pPlayerPresentationModel->GetPlayerState();
1455 if (playerState != PLAYER_STATE_PAUSED
1456 && playerState != PLAYER_STATE_PLAYING
1457 && __pPlayerPresentationModel->GetContentListCount() == INIT_VALUE)
1459 playerState = PLAYER_STATE_ERROR;
1462 SetContentInfo( __pPlayerPresentationModel->GetCurrentContentIndex());
1463 OnPlayTimeChanged(__pPlayerPresentationModel->GetCurrentDuration(), __pPlayerPresentationModel->GetPlayPosition());
1464 OnPlayStateChanged(playerState);
1466 if (GetPlayerScreenState() == PLAYER_SCREEN_STATE_DURING_CALL
1467 && playerState != PLAYER_STATE_ERROR
1468 && __pPlayerPresentationModel->IsDuringCall() == false)
1470 SetPlayerScreenState(__playerScreenStateBeforeCall);
1472 else if (__pPlayerPresentationModel->IsDuringCall())
1474 SetPlayerScreenState(PLAYER_SCREEN_STATE_DURING_CALL);
1477 SetFileNotExistState(__pPlayerPresentationModel->IsFileExist(__pPlayerPresentationModel->GetCurrentContentIndex()));
1480 /*if (__pContentsListViewPanel->IsEnabled() == true && __isRunByAppControl == false)
1482 TableView* pContentsTableView = static_cast<TableView*>(__pContentsListViewPanel->GetControl(IDC_CONTENTS_TABLEVIEW));
1483 pContentsTableView->UpdateTableView();
1487 AppLogDebug("EXIT");
1491 PlayerForm::OnSceneDeactivated(const Tizen::Ui::Scenes::SceneId& currentSceneId,
1492 const Tizen::Ui::Scenes::SceneId& nextSceneId)
1494 AppLogDebug("ENTER");
1495 CancelAllThumbnailRequest();
1496 __pPlayerPresentationModel->RemoveMusicPlayerEventListener(*this);
1498 if (__pVolumePanel != null && __pVolumePanel->GetShowState())
1500 __pVolumePanel->SetShowState(false);
1502 AppLogDebug("EXIT");
1506 PlayerForm::OnChangedContentListByAppControlN(Tizen::Base::Collection::IList* pArgs)
1508 AppLogDebug("ENTER");
1509 MusicPlayerApp* pMusicPlayerApp = static_cast<MusicPlayerApp*>(MusicPlayerApp::GetInstance());
1510 TryReturnVoid(pMusicPlayerApp != null, "Unable to cast UiApp to MusicPlayerApp");
1512 if (pArgs == null || static_cast<String*>(pArgs->GetAt(0))->Equals(MUSIC, false))
1514 AppLogDebug("EXIT(E_FAILURE)");
1523 result r = __pPlayerPresentationModel->SetContentList(pArgs);
1526 AppLogDebug("EXIT(%s)", GetErrorMessage(r));
1527 SetPlayerScreenState(PLAYER_SCREEN_STATE_NO_CONTENT_LIST);
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);
1539 TableView* pContentsTableView = static_cast<TableView*>(__pContentsListViewPanel->GetControl(IDC_CONTENTS_TABLEVIEW));
1540 if (pContentsTableView != null)
1542 pContentsTableView->UpdateTableView();
1549 AppLogDebug("EXIT");
1553 PlayerForm::OnUserEventReceivedN(RequestId requestId, Tizen::Base::Collection::IList* pArgs)
1555 AppLogDebug("ENTER");
1556 AppLogDebug("OnUserEventReceivedN %d", requestId);
1557 if (requestId == ID_DESTORY_PLAY_LIST_PICKER_POPUP || requestId == ID_DESTORY_SHARE_POPUP)
1559 RemovePlayListPicker();
1560 RemoveSharePicker();
1563 if (requestId == ID_SHOW_SUCCESS_MESSAGE)
1565 MessageBox messageBox;
1566 messageBox.Construct(L"", ResourceManager::GetString(L"IDS_COM_POP_SUCCESS"),
1568 COUNT_MESSAGE_BOX_TIMEOUT);
1569 int modalResult = 0;
1570 messageBox.ShowAndWait(modalResult);
1575 pArgs->RemoveAll(true);
1578 AppLogDebug("EXIT");
1582 PlayerForm::OnPlayStateChanged(PlayerState playerState)
1584 AppLogDebug("ENTER");
1585 AppLogDebug("%d", playerState);
1587 if (playerState == PLAYER_STATE_ERROR)
1589 MusicPlayerApp* pApp = static_cast<MusicPlayerApp*>(App::GetInstance());
1591 SetContentInfo( __pPlayerPresentationModel->GetCurrentContentIndex());
1593 if (__pPlayerPresentationModel->IsDuringCall())
1595 SetPlayerScreenState(PLAYER_SCREEN_STATE_DURING_CALL);
1599 SetPlayerScreenState(PLAYER_SCREEN_STATE_ERROR_CONTENT);
1602 __pMsgShowTimer->Cancel();
1603 __pMsgShowTimer->Start(10);
1605 if (pApp != null && pApp->GetRequestId() != null)
1607 AppControlProviderManager::GetInstance()->SendAppControlResult(pApp->GetRequestId(),APP_CTRL_RESULT_FAILED,null);
1608 pApp->ResetRequestId();
1612 else if (playerState == PLAYER_STATE_PAUSED)
1614 if (__pPlayerPresentationModel->IsDuringCall() == true)
1616 SetPlayerScreenState(PLAYER_SCREEN_STATE_DURING_CALL);
1619 else if(playerState == PLAYER_STATE_PLAYING && GetPlayerScreenState() != PLAYER_SCREEN_STATE_APP_CONTROL)
1621 SetPlayerScreenState(PLAYER_SCREEN_STATE_NORMAL);
1624 TogglePlayPauseImage(playerState);
1625 AppLogDebug("EXIT");
1629 PlayerForm::OnPlayContentChanged(int currentContentIndex)
1631 AppLogDebug("ENTER");
1632 String* pCurrentPlayConent = __pPlayerPresentationModel->GetPlayContentPath();
1633 String* pContentPath = __pPlayerPresentationModel->GetContentPath(__pPlayerPresentationModel->GetCurrentContentIndex());
1635 if (!pContentPath->Equals(*pCurrentPlayConent,true) || !__pPlayerPresentationModel->IsDuringCall())
1637 SetContentInfo(currentContentIndex);
1639 RemoveSetAsPicker();
1640 RemoveSharePicker();
1641 RemovePlayListPicker();
1642 SetFileNotExistState(__pPlayerPresentationModel->IsFileExist(currentContentIndex));
1645 if ( __pPlayerPresentationModel->IsDuringCall())
1647 SetPlayerScreenState(PLAYER_SCREEN_STATE_DURING_CALL);
1649 else if (__playerScreenState == PLAYER_SCREEN_STATE_DURING_CALL)
1651 SetPlayerScreenState(__playerScreenStateBeforeCall);
1654 AppLogDebug("EXIT");
1658 PlayerForm::OnPlayContentRemoved(int removedContentIndex)
1660 AppLogDebug("ENTER");
1661 int currentIndex = __pPlayerPresentationModel->GetCurrentContentIndex();
1662 int currentContentCount = __pPlayerPresentationModel->GetContentListCount();
1664 if ((removedContentIndex == currentIndex - 1)
1665 || (currentIndex == 0 && removedContentIndex == 0)
1666 || (currentIndex == removedContentIndex)
1667 || (currentIndex == __pPlayerPresentationModel->GetPreviousContentIndex()))
1669 UpdateAnimationAlbumArt(ALBUM_ART_IMAGE_PREVIOUS);
1671 else if ((removedContentIndex == currentIndex + 1)
1672 || (currentIndex == currentContentCount - 1 && removedContentIndex == 0))
1674 UpdateAnimationAlbumArt(ALBUM_ART_IMAGE_NEXT);
1676 AppLogDebug("EXIT");
1680 PlayerForm::OnPlayVolumeBarStateChanged(void)
1682 AppLogDebug("ENTER");
1683 if (__pVolumePanel->GetShowState() == true)
1685 __pVolumePanel->SetShowState(false);
1687 AppLogDebug("EXIT");
1691 PlayerForm::OnPlayTimeChanged(const Tizen::Base::String& currentDuration, int currentPosition)
1693 // AppLogDebug("ENTER");
1694 if (__playPosition == -1)
1696 __pCurrentTimeLabel->SetText(currentDuration);
1697 __pPlayStateSlider->SetValue(currentPosition);
1698 __pCurrentTimeLabel->Draw();
1699 __pCurrentTimeLabel->Show();
1700 __pPlayStateSlider->Draw();
1701 __pPlayStateSlider->Show();
1703 // AppLogDebug("EXIT");
1707 PlayerForm::OnAutoOffTimeChanged(int autoOffTime)
1709 // AppLogDebug("ENTER");
1710 __pPlayerPresentationModel->StartAutoOffTimer(autoOffTime);
1711 // AppLogDebug("EXIT");
1715 PlayerForm::OnPlayPresentationModelDestroying(void)
1717 AppLogDebug("ENTER");
1718 if (__pPlayerPresentationModel != null)
1720 __pPlayerPresentationModel = null;
1722 AppLogDebug("EXIT");
1726 PlayerForm::ShowMessageBox(const Tizen::Base::String& showText)
1728 AppLogDebug("ENTER");
1729 MessageBox messageBox;
1730 messageBox.Construct(L"Error", showText, MSGBOX_STYLE_NONE, 3000);
1731 int modalResult = 0;
1732 messageBox.ShowAndWait(modalResult);
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))
1739 // UiApp* pApp = UiApp::GetInstance();
1740 // pApp->Terminate();
1744 // if (pSceneManager->IsSceneAlive(IDSCN_ALL_LIST))
1746 // pSceneManager->GoBackward(BackwardSceneTransition());
1750 // UiApp* pApp = UiApp::GetInstance();
1751 // pApp->Terminate();
1754 AppLogDebug("EXIT");
1759 PlayerForm::SetContentInfo(int currentContentIndex)
1761 AppLogDebug("ENTER");
1762 ContentInformation* pContentInfoStruct = __pPlayerPresentationModel->GetContentInfoN(currentContentIndex);
1763 TryReturnVoid(pContentInfoStruct != null, "The currentContentIndex is invalid");
1765 __pTitleName->SetText(pContentInfoStruct->TitleName);
1766 __pArtistName->SetText(pContentInfoStruct->ArtistName);
1768 __pPlayStateSlider->SetRange(MIN_PLAY_STATE_SLIDER_COUNT, MAX_PLAY_STATE_SLIDER_COUNT);
1771 String totalTime = CommonUtil::GetFormatDate(pContentInfoStruct->Duration);
1772 if (totalTime.Equals(INITIAL_TIME, true) != true)
1774 __pTotalTimeLabel->SetText(totalTime);
1778 __pTotalTimeLabel->SetText(INITIAL_TIME);
1781 if (pContentInfoStruct->contentId.ToString().Equals(INVALID_VALUE_OF_CONTENT_ID, true))
1783 SetPlayerScreenState(PLAYER_SCREEN_STATE_INVALID_CONTENT_ID);
1787 if (__pPlayerPresentationModel->GetPlayerState() != PLAYER_STATE_ERROR)
1789 if (__pPlayStateSlider->IsEnabled() != true)
1791 __pPlayStateSlider->SetEnabled(true);
1793 SetFileNotExistState(true);
1796 delete pContentInfoStruct;
1798 UpdateAnimationAlbumArt(ALBUM_ART_IMAGE_CURRENT);
1800 AppLogDebug("EXIT");
1804 PlayerForm::UpdateAnimationAlbumArt(AlbumArtImage position)
1806 AppLogDebug("ENTER");
1807 Bitmap* pAlbumArtBitmap[ALBUM_ART_IMAGE_COUNT] = {null, };
1808 FloatDimension floatDimension = static_cast<Label*>(__pContentsAlbumViewPanel->GetControl(IDC_CONTENTS_THUMBNAIL))->GetSizeF();
1812 case ALBUM_ART_IMAGE_CURRENT:
1814 pAlbumArtBitmap[ALBUM_ART_IMAGE_CURRENT] = __pPlayerPresentationModel->GetContentAlbumArtN(__pPlayerPresentationModel->GetCurrentContentIndex());
1816 if (pAlbumArtBitmap[ALBUM_ART_IMAGE_CURRENT] != null)
1818 pAlbumArtBitmap[ALBUM_ART_IMAGE_CURRENT]->Scale(floatDimension);
1820 pAlbumArtBitmap[ALBUM_ART_IMAGE_PREVIOUS] = __pPlayerPresentationModel->GetContentAlbumArtN(__pPlayerPresentationModel->GetPreviousContentIndex());
1822 if (pAlbumArtBitmap[ALBUM_ART_IMAGE_PREVIOUS] != null)
1824 pAlbumArtBitmap[ALBUM_ART_IMAGE_PREVIOUS]->Scale(floatDimension);
1826 pAlbumArtBitmap[ALBUM_ART_IMAGE_NEXT] = __pPlayerPresentationModel->GetContentAlbumArtN(__pPlayerPresentationModel->GetNextContentIndex());
1828 if (pAlbumArtBitmap[ALBUM_ART_IMAGE_NEXT] != null)
1830 pAlbumArtBitmap[ALBUM_ART_IMAGE_NEXT]->Scale(floatDimension);
1835 case ALBUM_ART_IMAGE_PREVIOUS:
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)
1841 pAlbumArtBitmap[ALBUM_ART_IMAGE_PREVIOUS]->Scale(floatDimension);
1843 pAlbumArtBitmap[ALBUM_ART_IMAGE_NEXT] = null;
1847 case ALBUM_ART_IMAGE_NEXT:
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)
1854 pAlbumArtBitmap[ALBUM_ART_IMAGE_NEXT]->Scale(floatDimension);
1863 if (pAlbumArtBitmap[ALBUM_ART_IMAGE_CURRENT] != null)
1865 Canvas* pCanvas = __pAlbumArtElement[ALBUM_ART_IMAGE_CURRENT]->GetCanvasN();
1869 Point point(INIT_VALUE, INIT_VALUE);
1870 pCanvas->DrawBitmap(point, *pAlbumArtBitmap[ALBUM_ART_IMAGE_CURRENT]);
1873 delete pAlbumArtBitmap[ALBUM_ART_IMAGE_CURRENT];
1876 if (pAlbumArtBitmap[ALBUM_ART_IMAGE_PREVIOUS] != null)
1878 Canvas* pCanvas = __pAlbumArtElement[ALBUM_ART_IMAGE_PREVIOUS]->GetCanvasN();
1882 Point point(INIT_VALUE, INIT_VALUE);
1883 pCanvas->DrawBitmap(point, *pAlbumArtBitmap[ALBUM_ART_IMAGE_PREVIOUS]);
1886 delete pAlbumArtBitmap[ALBUM_ART_IMAGE_PREVIOUS];
1889 if (pAlbumArtBitmap[ALBUM_ART_IMAGE_NEXT] != null)
1891 Canvas* pCanvas = __pAlbumArtElement[ALBUM_ART_IMAGE_NEXT]->GetCanvasN();
1895 Point point(INIT_VALUE, INIT_VALUE);
1896 pCanvas->DrawBitmap(point, *pAlbumArtBitmap[ALBUM_ART_IMAGE_NEXT]);
1899 delete pAlbumArtBitmap[ALBUM_ART_IMAGE_NEXT];
1901 AppLogDebug("EXIT");
1906 PlayerForm::SetRepeatButtonImage(int repeatValue)// 0 - 2 (OFF, ONE, ALL)
1908 AppLogDebug("ENTER");
1909 Bitmap* pOptionRepeatBitmap;
1910 Bitmap* pOptionRepeatPressBitmap;
1912 switch (repeatValue)
1916 pOptionRepeatBitmap = ResourceManager::GetBitmapN(L"T02_option_rep_A.png");
1917 pOptionRepeatPressBitmap = ResourceManager::GetBitmapN(L"T02_option_rep_A_press.png");
1923 pOptionRepeatBitmap = ResourceManager::GetBitmapN(L"T02_option_rep_1.png");
1924 pOptionRepeatPressBitmap = ResourceManager::GetBitmapN(L"T02_option_rep_1_press.png");
1930 pOptionRepeatBitmap = ResourceManager::GetBitmapN(L"T02_option_rep_all.png");
1931 pOptionRepeatPressBitmap = ResourceManager::GetBitmapN(L"T02_option_rep_all_press.png");
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);
1943 delete pOptionRepeatBitmap;
1944 pOptionRepeatBitmap = null;
1945 delete pOptionRepeatPressBitmap;
1946 pOptionRepeatPressBitmap = null;
1947 AppLogDebug("EXIT");
1951 PlayerForm::SetShuffleButtonImage(bool shuffleEnable)
1953 AppLogDebug("ENTER");
1954 Bitmap* pOptionShuffleBitmap;
1956 if (shuffleEnable == false)
1958 pOptionShuffleBitmap = ResourceManager::GetBitmapN(L"T02_option_shuffle_on_dim.png");
1962 pOptionShuffleBitmap = ResourceManager::GetBitmapN(L"T02_option_shuffle_on.png");
1965 __pShuffleButton->SetNormalBitmap(Point(INIT_VALUE, INIT_VALUE), *pOptionShuffleBitmap);
1966 __pShuffleButton->Invalidate(true);
1967 __pPlayerPresentationModel->SetShuffleEnable(shuffleEnable);
1968 UpdateAnimationAlbumArt(ALBUM_ART_IMAGE_CURRENT);
1970 delete pOptionShuffleBitmap;
1971 pOptionShuffleBitmap = null;
1972 AppLogDebug("EXIT");
1976 PlayerForm::SetFileNotExistState(bool isFileExist)
1978 AppLogDebug("ENTER");
1984 if(GetPlayerScreenState() != PLAYER_SCREEN_STATE_DURING_CALL &&
1985 GetPlayerScreenState() != PLAYER_SCREEN_STATE_ERROR_CONTENT)
1987 __pContentsViewToggleButton->SetEnabled(isFileExist);
1988 __pContentsViewToggleButton->Invalidate(true);
1989 __pShuffleButton->SetEnabled(isFileExist);
1990 __pShuffleButton->Invalidate(true);
1993 AppLogDebug("EXIT");
1997 PlayerForm::TogglePlayPauseImage(PlayerState playerState)
1999 AppLogDebug("ENTER");
2000 if (playerState == PLAYER_STATE_PLAYING)
2002 RelativeLayout* layout = dynamic_cast<RelativeLayout*>(__pContentsAlbumViewPanel->GetLayoutN());
2005 layout->ResetCenterAligned(*static_cast<Label*>(__pContentsAlbumViewPanel->GetControl(IDC_ALBUM_THUMBANIL_BACKGROUND)), CENTER_ALIGN_HORIZONTAL);
2009 static_cast<Label*>(__pContentsAlbumViewPanel->GetControl(IDC_ALBUM_TURN_TABLE))->SetShowState(true);
2010 SetPauseButtonImage();
2014 RelativeLayout* layout = dynamic_cast<RelativeLayout*>(__pContentsAlbumViewPanel->GetLayoutN());
2017 layout->SetCenterAligned(*static_cast<Label*>(__pContentsAlbumViewPanel->GetControl(IDC_ALBUM_THUMBANIL_BACKGROUND)), CENTER_ALIGN_HORIZONTAL);
2021 static_cast<Label*>(__pContentsAlbumViewPanel->GetControl(IDC_ALBUM_TURN_TABLE))->SetShowState(false);
2022 SetPlayButtonImage();
2025 if (__pContentsAlbumViewPanel->GetShowState() == true)
2027 __pContentsAlbumViewPanel->Invalidate(true);
2029 AppLogDebug("EXIT");
2032 PlayerForm::SetPlayButtonImage(void)
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);
2040 pBitmap = ResourceManager::GetBitmapN(IDB_PLAY_BUTTON_ICON_PRESSED);
2041 __pPlayPauseButton->SetPressedBitmap(point, *pBitmap);
2044 pBitmap = ResourceManager::GetBitmapN(IDB_PLAY_BUTTON_ICON_DISABLED);
2045 __pPlayPauseButton->SetDisabledBitmap(point, *pBitmap);
2048 __pPlayPauseButton->SetActionId(IDA_PLAYER_CONTROLLER_PLAY);
2049 __pPlayPauseButton->Invalidate(true);
2050 AppLogDebug("EXIT");
2054 PlayerForm::SetPauseButtonImage(void)
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);
2062 pBitmap = ResourceManager::GetBitmapN(IDB_PAUSE_BUTTON_ICON_PRESSED);
2063 __pPlayPauseButton->SetPressedBitmap(point, *pBitmap);
2066 pBitmap = ResourceManager::GetBitmapN(IDB_PAUSE_BUTTON_ICON_DISABLED);
2067 __pPlayPauseButton->SetDisabledBitmap(point, *pBitmap);
2070 __pPlayPauseButton->SetActionId(IDA_PLAYER_CONTROLLER_PAUSE);
2071 __pPlayPauseButton->Invalidate(true);
2072 AppLogDebug("EXIT");
2076 PlayerForm::InitializeVolumeBar(void)
2078 AppLogDebug("ENTER");
2079 int MediaSoundVolume = 0;
2080 SettingInfo::GetValue(MEDIA_VOLUME, MediaSoundVolume);
2081 __pPlayerPresentationModel->SetVolume(MediaSoundVolume);
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;
2091 if (orientationStatue == ORIENTATION_STATUS_LANDSCAPE
2092 || orientationStatue == ORIENTATION_STATUS_LANDSCAPE_REVERSE)
2094 AppLogDebug("CHECK %d", clientBounds.width);
2095 if (clientBounds.width > 1200)
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
2104 __pVolumePanel->Construct(layout, Rectangle(clientBounds.width - 670
2105 , GetClientAreaBounds().height - H_HORIZONTAL_CONTROLLER_PANEL - H_VOLUME_PANEL - 50
2110 else if (orientationStatue == ORIENTATION_STATUS_PORTRAIT
2111 || orientationStatue == ORIENTATION_STATUS_PORTRAIT_REVERSE)
2113 __pVolumePanel->Construct(layout, Rectangle(0
2114 , clientBounds.height - H_CONTROLLER_PANEL - H_VOLUME_PANEL - 50
2115 , clientBounds.width
2119 if (clientBounds.width > 1200)
2121 __pVolumeSlider->Construct(Rectangle(0
2122 , 0, W_HORIZONTAL_PLAYER, H_VOLUME_PANEL)
2123 , BACKGROUND_STYLE_NONE
2125 , MIN_VOLUME_SLIDER_COUNT
2126 , MAX_VOLUME_SLIDER_COUNT
2127 , GROUP_STYLE_NONE);
2131 __pVolumeSlider->Construct(Rectangle(0
2132 , 0, 680, H_VOLUME_PANEL)
2133 , BACKGROUND_STYLE_NONE
2135 , MIN_VOLUME_SLIDER_COUNT
2136 , MAX_VOLUME_SLIDER_COUNT
2137 , GROUP_STYLE_NONE);
2140 __pVolumeSlider->SetColor(TRANSPARENT_COLOR);
2141 AddControl(__pVolumePanel);
2142 __pVolumePanel->AddControl(__pVolumeSlider);
2143 CommonUtil::SetLayoutFitToContainer(*__pVolumePanel, *__pVolumeSlider);
2145 Bitmap* pVolumeLeftIconBitmap = ResourceManager::GetBitmapN(L"T02_volume_icon_01.png");
2146 Bitmap* pVolumeRightIconBitmap = ResourceManager::GetBitmapN(L"T02_volume_icon_02.png");
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));
2153 __pVolumeSlider->SetIcon(ICON_POSITION_LEFT, *pVolumeLeftIconBitmap);
2154 __pVolumeSlider->SetIcon(ICON_POSITION_RIGHT, *pVolumeRightIconBitmap);
2155 __pVolumeSlider->SetValue(__pPlayerPresentationModel->GetVolume());
2156 __pVolumeSlider->AddSliderEventListener(*this);
2158 delete pVolumeLeftIconBitmap;
2159 pVolumeLeftIconBitmap = null;
2160 delete pVolumeRightIconBitmap;
2161 pVolumeRightIconBitmap = null;
2167 PlayerForm::CreateTableViewItem(Tizen::Ui::Container& parent,
2168 const ContentInformation& contentInfoStruct)
2170 AppLogDebug("ENTER");
2171 Panel* pTableViewItem = new (std::nothrow) Panel();
2173 if (__fontSizeValue.Equals(STRING_FONT_SIZE_GIANT, false))
2175 if (IsFailed(pTableViewItem->Construct(IDL_CONTENTS_LIBARY_ITEM_PANEL_FONT_SIZE_GIANT)))
2177 AppLogDebug("Construct(IDL_CONTENTS_LIBARY_ITEM_PANEL) failed(%s)", GetErrorMessage(GetLastResult()));
2181 else if (__fontSizeValue.Equals(STRING_FONT_SIZE_HUGE, false))
2183 if (IsFailed(pTableViewItem->Construct(IDL_CONTENTS_LIBARY_ITEM_PANEL_FONT_SIZE_HUGE)))
2185 AppLogDebug("Construct(IDL_CONTENTS_LIBARY_ITEM_PANEL) failed(%s)", GetErrorMessage(GetLastResult()));
2189 else if (__fontSizeValue.Equals(STRING_FONT_SIZE_LARGE, false))
2191 if (IsFailed(pTableViewItem->Construct(IDL_CONTENTS_LIBARY_ITEM_PANEL_FONT_SIZE_LARGE)))
2193 AppLogDebug("Construct(IDL_CONTENTS_LIBARY_ITEM_PANEL) failed(%s)", GetErrorMessage(GetLastResult()));
2197 else if (__fontSizeValue.Equals(STRING_FONT_SIZE_SMALL, false))
2199 if (IsFailed(pTableViewItem->Construct(IDL_CONTENTS_LIBARY_ITEM_PANEL_FONT_SIZE_SMALL)))
2201 AppLogDebug("Construct(IDL_CONTENTS_LIBARY_ITEM_PANEL) failed(%s)", GetErrorMessage(GetLastResult()));
2207 if (IsFailed(pTableViewItem->Construct(IDL_CONTENTS_LIBARY_ITEM_PANEL_DEFAULT)))
2209 AppLogDebug("Construct(IDL_CONTENTS_LIBARY_ITEM_PANEL) failed(%s)", GetErrorMessage(GetLastResult()));
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);
2217 if(contentInfoStruct.contentId.ToString().Equals(INVALID_VALUE_OF_CONTENT_ID,true) && __playerScreenState == PLAYER_SCREEN_STATE_APP_CONTROL)
2219 Bitmap* pBmp = __pPlayerPresentationModel->GetContentAlbumArtN(__pPlayerPresentationModel->GetCurrentContentIndex());
2220 static_cast<Label*>(pTableViewItem->GetControl(IDC_CONTENTS_THUMBNAIL))->SetBackgroundBitmap(*pBmp);
2226 static_cast<Label*>(pTableViewItem->GetControl(IDC_CONTENTS_THUMBNAIL))->SetBackgroundBitmap(*GetDefaultThumbnail());
2229 // pTableViewItem->SetSize(parent.GetWidthF()-10,pTableViewItem->GetHeightF());
2230 parent.AddControl(pTableViewItem);
2231 CommonUtil::SetLayoutFitToContainer(parent, *pTableViewItem);
2233 AppLogDebug("EXIT");
2238 PlayerForm::UpdateSplitBarState(void)
2240 AppLogDebug("ENTER");
2241 Label* pSplitBar = static_cast<Label*>(GetControl(IDC_SPLIT_BAR));
2242 if ((GetOrientationStatus() == ORIENTATION_STATUS_PORTRAIT) || (GetOrientationStatus() == ORIENTATION_STATUS_PORTRAIT_REVERSE))
2244 pSplitBar->SetSize(GetClientAreaBounds().width, 0);
2248 pSplitBar->SetSize(13, GetClientAreaBounds().height);
2250 AppLogDebug("EXIT");
2254 PlayerForm::OnThumbnailInfoReveivedN(ThumbnailInfo* pThumbnailInfo)
2256 AppLogDebug("ENTER");
2257 __pThumbnail = pThumbnailInfo->GetBitmapN();
2258 Object* pParam = pThumbnailInfo->GetUserParamN();
2261 static_cast<TableView*>(__pContentsListViewPanel->GetControl(IDC_CONTENTS_TABLEVIEW))->RefreshItem((static_cast<Integer*>(pParam))->ToInt(), TABLE_VIEW_REFRESH_TYPE_ITEM_MODIFY);
2265 delete pThumbnailInfo;
2266 AppLogDebug("EXIT");
2270 PlayerForm::OnMusicContentUpdateCompleted(void)
2272 AppLogDebug("ENTER");
2274 RemoveSharePicker();
2275 RemovePlayListPicker();
2277 UiApp* pApp = UiApp::GetInstance();
2280 if (pApp->GetAppUiState() == APP_UI_STATE_FOREGROUND)
2282 RemoveSetAsPicker();
2285 bool isCurrentContentModified = false;
2287 if (__pPlayerPresentationModel->IsFileExist(__pPlayerPresentationModel->GetCurrentContentIndex()) != true)
2289 isCurrentContentModified = true;
2290 SetFileNotExistState(false);
2293 AllListPresentationModel* pPresentationModel = AllListPresentationModel::GetInstance();
2294 if (pPresentationModel == null)
2296 AppLogDebug("EXIT");
2300 pPresentationModel->UpdateContentList();
2301 IList* pList = pPresentationModel->GetContentListN();
2303 if (pList == null || pList->GetCount() == INIT_VALUE)
2305 AppLogDebug("EXIT");
2310 String* pPlayContentPath = __pPlayerPresentationModel->GetPlayContentPath();
2311 int iContentListCount = __pPlayerPresentationModel->GetContentListCount();
2312 for (int iCount = iContentListCount - 1; iCount >= 0; iCount--)
2314 bool isFind = false;
2315 String* pContentPath = __pPlayerPresentationModel->GetContentPath(iCount);
2316 if (pContentPath == null)
2320 IEnumerator* pIEnum = pList->GetEnumeratorN();
2321 while (pIEnum->MoveNext() == E_SUCCESS)
2323 String* pCurrentPath = static_cast<String*>(pIEnum->GetCurrent());
2324 if (pCurrentPath == null)
2329 if (pContentPath->Equals(*pCurrentPath, false))
2335 if (pPlayContentPath != null && pContentPath->Equals(*pPlayContentPath, false))
2343 if (isFind == false)
2345 __pPlayerPresentationModel->RemoveContent(*pContentPath);
2349 if (__pContentsListViewPanel->IsEnabled() == true)
2351 if (__pPlayerPresentationModel->GetContentListCount() != INIT_VALUE && isCurrentContentModified == false)
2353 static_cast<TableView*>(__pContentsListViewPanel->GetControl(IDC_CONTENTS_TABLEVIEW))->UpdateTableView();
2355 else if (__pContentsListViewPanel->GetShowState() == true)
2357 __pContentsListViewPanel->SetShowState(false);
2358 __pContentsViewToggleButton->SetActionId(IDA_BUTTON_CONTENTS_LIST_VIEW);
2359 __pContentsAlbumViewPanel->SetShowState(true);
2360 __pPanelRegisterBar->Invalidate(true);
2363 AppLogDebug("EXIT");
2367 PlayerForm::UpdateItem(int itemIndex, Tizen::Ui::Controls::TableViewItem* pItem)
2369 AppLogDebug("ENTER");
2372 AppLogDebug("pItem is null");
2373 delete __pThumbnail;
2374 __pThumbnail = null;
2377 Label* pThumbnailLabel = static_cast<Label*>(pItem->GetControl(IDC_CONTENTS_THUMBNAIL, true));
2378 if (__pThumbnail == null || pThumbnailLabel == null)
2380 AppLogDebug("__pThumbnail or pThumbnailLabel is null");
2381 delete __pThumbnail;
2382 __pThumbnail = null;
2385 pThumbnailLabel->SetBackgroundBitmap(*__pThumbnail);
2386 delete __pThumbnail;
2387 __pThumbnail = null;
2388 pThumbnailLabel->Invalidate(true);
2389 AppLogDebug("EXIT");
2393 PlayerForm::SetPlayerScreenState(unsigned int playerScreenState)
2395 AppLogDebug("ENTER %d && old = %d",playerScreenState,__playerScreenState);
2397 if (__playerScreenState == playerScreenState)
2399 AppLogDebug("EXIT");
2403 __playerScreenStateBeforeCall = playerScreenState;
2405 switch (playerScreenState)
2407 case PLAYER_SCREEN_STATE_NORMAL:
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);
2420 if (__playerScreenState == PLAYER_SCREEN_STATE_INVALID_CONTENT_ID)
2422 // __pContentsViewToggleButton->SetEnabled(false);
2423 __pShuffleButton->SetEnabled(false);
2426 if (__isRunByAppControl == false)
2432 case PLAYER_SCREEN_STATE_APP_CONTROL:
2434 AppLogDebug("111111111111111111111");
2435 __pPlayPauseButton->SetEnabled(true);
2436 __pContentsViewToggleButton->SetEnabled(true);
2437 __pPlayStateSlider->SetEnabled(true);
2440 __pShuffleButton->SetShowState(false);
2441 __pRepeatButton->SetShowState(false);
2442 __prevRepeatStateRunByAppControl = __pPlayerPresentationModel->GetRepeatState();
2444 if (__pContentsListViewPanel->GetShowState() == true)
2446 __pContentsListViewPanel->SetShowState(false);
2447 __pContentsViewToggleButton->SetActionId(IDA_BUTTON_CONTENTS_LIST_VIEW);
2448 __pContentsAlbumViewPanel->SetShowState(true);
2450 playerScreenState = PLAYER_SCREEN_STATE_APP_CONTROL;
2451 __isRunByAppControl = true;
2455 case PLAYER_SCREEN_STATE_INVALID_CONTENT_ID:
2457 // __pContentsViewToggleButton->SetEnabled(false);
2458 // __pContentsViewToggleButton->Invalidate(true);
2459 if (__playerScreenState != PLAYER_SCREEN_STATE_APP_CONTROL)
2461 __pRepeatButton->SetShowState(true);
2462 __pRepeatButton->SetEnabled(false);
2468 // __pMoreContextButton->SetEnabled(false);
2472 case PLAYER_SCREEN_STATE_NO_CONTENT_LIST:
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);
2486 Bitmap* pThumb = ResourceManager::GetBitmapN(L"music_play_grid_thumb_loading.png");
2487 static_cast<Label*>(__pContentsAlbumViewPanel->GetControl(IDC_CONTENTS_THUMBNAIL))->SetBackgroundBitmap(*pThumb);
2492 case PLAYER_SCREEN_STATE_ERROR_CONTENT:
2494 AppLogDebug("222222222222222222222");
2495 if (__pPlayerPresentationModel->IsDuringCall())
2497 if (__isRunByAppControl)
2499 SetPlayerScreenState(PLAYER_SCREEN_STATE_APP_CONTROL);
2503 SetPlayerScreenState(PLAYER_SCREEN_STATE_DURING_CALL);
2509 __pPlayStateSlider->SetShowState(true);
2510 __pPlayStateSlider->SetValue(0);
2511 __pPlayPauseButton->SetEnabled(false);
2512 __pPlayStateSlider->SetEnabled(false);
2513 __pShuffleButton->SetEnabled(false);
2515 __pPlayStateSlider->Invalidate(true);
2517 Bitmap* pThumb = ResourceManager::GetBitmapN(L"music_play_grid_thumb_loading.png");
2518 static_cast<Label*>(__pContentsAlbumViewPanel->GetControl(IDC_CONTENTS_THUMBNAIL))->SetBackgroundBitmap(*pThumb);
2524 case PLAYER_SCREEN_STATE_DURING_CALL:
2526 __playerScreenStateBeforeCall = __playerScreenState;
2527 __pPlayPauseButton->SetEnabled(false);
2529 __pContentsViewToggleButton->SetEnabled(false);
2530 __pPlayStateSlider->SetEnabled(false);
2532 if (__pContentsListViewPanel->GetShowState() == true)
2534 __pContentsListViewPanel->SetShowState(false);
2535 __pContentsViewToggleButton->SetActionId(IDA_BUTTON_CONTENTS_LIST_VIEW);
2536 __pContentsAlbumViewPanel->SetShowState(true);
2539 Bitmap* pThumb = ResourceManager::GetBitmapN(L"music_play_grid_thumb_loading.png");
2540 static_cast<Label*>(__pContentsAlbumViewPanel->GetControl(IDC_CONTENTS_THUMBNAIL))->SetBackgroundBitmap(*pThumb);
2549 __playerScreenState = playerScreenState;
2551 AppLogDebug("EXIT");
2555 PlayerForm::GetPlayerScreenState(void)
2557 AppLogDebug("ENTER");
2558 AppLogDebug("EXIT");
2559 return __playerScreenState;
2563 PlayerForm::SetOptionMenuItem(unsigned int contextMenuItemStyle, Tizen::Graphics::Point anchorPosition)
2565 AppLogDebug("ENTER");
2566 if (__pOptionMenu == null)
2568 AppLogDebug("EXIT");
2572 CommonUtil::AddOptionMenuItem(*__pOptionMenu, contextMenuItemStyle);
2573 CommonUtil::ShowOptionMenu(*__pOptionMenu, true);
2575 // if (anchorPosition.x != -1 && anchorPosition.y != -1)
2577 // __pOptionMenu->SetAnchorPosition(anchorPosition);
2579 AppLogDebug("EXIT");
2584 PlayerForm::CreateOptionMenuN(const Tizen::Ui::Control& source)
2586 AppLogDebug("ENTER");
2588 __pOptionMenu = CommonUtil::CreateOptionMenuN(source, *this);
2589 if (__pOptionMenu != null)
2593 AppLogDebug("EXIT");
2598 PlayerForm::RemoveOptionMenu(void)
2600 AppLogDebug("ENTER");
2601 if (__pOptionMenu != null)
2603 CommonUtil::SetShowStateControl(*__pOptionMenu, false);
2604 delete __pOptionMenu;
2605 __pOptionMenu = null;
2607 AppLogDebug("EXIT");
2611 PlayerForm::TryRemoveContextMenu(int actionId)
2613 AppLogDebug("ENTER");
2614 result r = E_FAILURE;
2615 if (CommonUtil::IsVaildContextMenuItemActionId(actionId) == true)
2620 AppLogDebug("EXIT");
2625 PlayerForm::ShowSharePicker(Tizen::Base::Collection::IList* pIList)
2627 AppLogDebug("ENTER");
2628 RemoveSharePicker();
2630 __pSharePicker = new (std::nothrow) SharePopup();
2631 if (IsFailed(__pSharePicker->Initialize(this)))
2633 AppLogDebug("__pSharePicker->Initialize failed(%s)", GetErrorMessage(E_FAILURE));
2634 RemoveSharePicker();
2638 __pSharePicker->SetArguments(pIList);
2639 __pSharePicker->SetShowState(true);
2640 __pSharePicker->Show();
2642 AppLogDebug("EXIT");
2647 PlayerForm::RemoveSharePicker(void)
2649 AppLogDebug("ENTER");
2650 if (__pSharePicker != null)
2652 CommonUtil::SetShowStateControl(*__pSharePicker, false);
2653 delete __pSharePicker;
2654 __pSharePicker = null;
2656 AppLogDebug("EXIT");
2660 PlayerForm::ShowPlayListPicker(Tizen::Base::Collection::IList* pIList)
2662 AppLogDebug("ENTER");
2663 RemovePlayListPicker();
2665 __pPlayListPicker = new (std::nothrow) PlayListPickerPopup();
2666 if (IsFailed(__pPlayListPicker->Initialize(this, pIList)))
2668 AppLogDebug("__pSharePicker->Initialize failed(%s)", GetErrorMessage(E_FAILURE));
2669 RemovePlayListPicker();
2673 __pPlayListPicker->SetShowState(true);
2674 __pPlayListPicker->Show();
2676 AppLogDebug("EXIT");
2681 PlayerForm::RemovePlayListPicker(void)
2683 AppLogDebug("ENTER");
2684 if (__pPlayListPicker != null)
2686 CommonUtil::SetShowStateControl(*__pPlayListPicker, false);
2687 delete __pPlayListPicker;
2688 __pPlayListPicker = null;
2690 AppLogDebug("EXIT");
2694 PlayerForm::ShowSetAsPicker(Tizen::Base::Collection::IList* pIList)
2696 AppLogDebug("ENTER");
2697 RemoveSetAsPicker();
2699 __pSetAsPicker = new (std::nothrow) SetAsPopup();
2700 if (IsFailed(__pSetAsPicker->Initialize(this)))
2702 AppLogDebug("__pSharePicker->Initialize failed(%s)", GetErrorMessage(E_FAILURE));
2703 RemoveSetAsPicker();
2707 __pSetAsPicker->SetCurrentContentPath(new (std::nothrow) String(*static_cast<String*>(pIList->GetAt(0))));
2708 __pSetAsPicker->SetShowState(true);
2709 __pSetAsPicker->Show();
2711 pIList->RemoveAll(true);
2714 AppLogDebug("EXIT");
2719 PlayerForm::RemoveSetAsPicker(void)
2721 AppLogDebug("ENTER");
2722 if (__pSetAsPicker != null)
2724 CommonUtil::SetShowStateControl(*__pSetAsPicker, false);
2725 // delete __pSetAsPicker;
2726 // __pSetAsPicker = null;
2728 AppLogDebug("EXIT");
2732 PlayerForm::LanucherPicker(PickerType pickerType)
2734 AppLogDebug("ENTER");
2735 IList* pArgumentList = GetPickerArgumentListN(pickerType);
2736 if (pArgumentList == null)
2738 AppLogDebug("GetPickerArgumentListN is null");
2742 result r = E_FAILURE;
2743 if (pickerType == PICKER_TYPE_PLAY_LIST_PICKER)
2745 r = ShowPlayListPicker(pArgumentList);
2747 else if (pickerType == PICKER_TYPE_SHARE_PICKER)
2749 r = ShowSharePicker(pArgumentList);
2751 else if (pickerType == PICKER_TYPE_SET_AS_PICKER)
2753 r = ShowSetAsPicker(pArgumentList);
2758 AppLogDebug("ShowPlayListPicker failed(%s)", GetErrorMessage(r));
2759 delete pArgumentList;
2761 AppLogDebug("EXIT");
2765 Tizen::Base::Collection::IList*
2766 PlayerForm::GetPickerArgumentListN(PickerType pickerType)
2768 AppLogDebug("ENTER");
2772 case PICKER_TYPE_SET_AS_PICKER:
2774 case PICKER_TYPE_PLAY_LIST_PICKER:
2776 case PICKER_TYPE_SHARE_PICKER:
2778 contentPath.Append(*__pPlayerPresentationModel->GetContentPath(__pPlayerPresentationModel->GetCurrentContentIndex()));
2784 AppLogDebug("EXIT");
2790 Tizen::Base::Collection::ArrayList* pDataList = new (std::nothrow) ArrayList(SingleObjectDeleter);
2791 if (IsFailed(pDataList->Construct()))
2793 AppLogDebug("Construct failed(%s)", GetErrorMessage(GetLastResult()));
2798 pDataList->Add(*(new (std::nothrow) String(contentPath)));
2799 AppLogDebug("EXIT");
2804 PlayerForm::OnFontSizeChanged(void)
2806 __fontSizeValue = CommonUtil::GetFontSizeValue();
2807 __itemHeight = CommonUtil::GetItemHeight(__fontSizeValue);
2808 TableView* pContentsTableView = static_cast<TableView*>(__pContentsListViewPanel->GetControl(IDC_CONTENTS_TABLEVIEW));
2809 pContentsTableView->UpdateTableView();