mpxplugins/viewplugins/views/collectionviewhg/src/mpxcollectionviewhgcontainer.cpp
branchRCL_3
changeset 40 cb96c29156b2
parent 31 a12246c97fcc
child 50 26a1709b9fec
equal deleted inserted replaced
31:a12246c97fcc 40:cb96c29156b2
   160 	iSelectedAlbumHandler (aSelectedAlbumHandler),
   160 	iSelectedAlbumHandler (aSelectedAlbumHandler),
   161 	iOpenAlbumTracks(EFalse),
   161 	iOpenAlbumTracks(EFalse),
   162 	iShuffleItem(0),
   162 	iShuffleItem(0),
   163 	iSetEmptyTextNeeded(EFalse),
   163 	iSetEmptyTextNeeded(EFalse),
   164 	iPopupListRect(TRect(0,0,0,0)),
   164 	iPopupListRect(TRect(0,0,0,0)),
   165 	iPreviousViewId(TUid::Uid(0))
   165 	iPreviousViewId(TUid::Uid(0)),
       
   166 	iDrawBackGround(EFalse)
   166     {
   167     {
   167     }
   168     }
   168 
   169 
   169 // ---------------------------------------------------------------------------
   170 // ---------------------------------------------------------------------------
   170 // Destructor
   171 // Destructor
   816 // Draw this application's view to the screen
   817 // Draw this application's view to the screen
   817 // ---------------------------------------------------------------------------
   818 // ---------------------------------------------------------------------------
   818 //
   819 //
   819 void CMPXCollectionViewHgContainer::Draw(const TRect& /*aRect*/) const
   820 void CMPXCollectionViewHgContainer::Draw(const TRect& /*aRect*/) const
   820     {
   821     {
   821     if ( iContext == EContextUnknown )
   822     if ( iContext == EContextUnknown || iDrawBackGround != EFalse )
   822         {
   823         {
   823         MAknsSkinInstance* skin = AknsUtils::SkinInstance();
   824         MAknsSkinInstance* skin = AknsUtils::SkinInstance();
   824         MAknsControlContext* cc = AknsDrawUtils::ControlContext( this );
   825         MAknsControlContext* cc = AknsDrawUtils::ControlContext( this );
   825         AknsDrawUtils::DrawBackground( skin, cc, this, SystemGc(),
   826         AknsDrawUtils::DrawBackground( skin, cc, this, SystemGc(),
   826                 TPoint(0,0), Rect(), KAknsDrawParamDefault );
   827                 TPoint(0,0), Rect(), KAknsDrawParamDefault );
  1500     TInt mediaCount = aMediaArray.Count();
  1501     TInt mediaCount = aMediaArray.Count();
  1501 
  1502 
  1502     if( iListWidget )
  1503     if( iListWidget )
  1503         {
  1504         {
  1504         TRect clientRect = ((CAknView*)iView)->ClientRect();
  1505         TRect clientRect = ((CAknView*)iView)->ClientRect();
  1505         TInt mediaIndex = MediaIndex(iListWidget->SelectedIndex());
  1506         TInt index = MediaIndex(iListWidget->SelectedIndex()); 
       
  1507         TInt mediaIndex (index);
  1506         mediaIndex = ( KErrNotFound == mediaIndex ) ? iListWidget->FirstIndexOnScreen() : mediaIndex;
  1508         mediaIndex = ( KErrNotFound == mediaIndex ) ? iListWidget->FirstIndexOnScreen() : mediaIndex;
  1507         mediaIndex = ( mediaIndex >= 0 && (mediaIndex < (mediaCount)) ) ? mediaIndex : (mediaCount - 1);
  1509         mediaIndex = ( mediaIndex >= 0 && (mediaIndex < (mediaCount)) ) ? mediaIndex : (mediaCount - 1);
  1508 
  1510 		// No need to modify index of first item, if reorder is activated
       
  1511         if ( IsInReorderMode() && index == KErrNotFound )
       
  1512             {
       
  1513             mediaIndex = KErrNotFound;  
       
  1514             }      
  1509         TInt prevItemCount = iListWidget->ItemCount();
  1515         TInt prevItemCount = iListWidget->ItemCount();
  1510 
  1516 
  1511         iListWidget->InitScreenL( clientRect );
  1517         iListWidget->InitScreenL( clientRect );
  1512         iListWidget->Reset();
  1518         iListWidget->Reset();
  1513         if ( aCount )
  1519         if ( aCount )
  1518                 iListWidget->EnableScrollBufferL( *this, KMPXListBufferSize, KMPXListBufferSize/4 );
  1524                 iListWidget->EnableScrollBufferL( *this, KMPXListBufferSize, KMPXListBufferSize/4 );
  1519                 }
  1525                 }
  1520             iListWidget->ResizeL( aCount );
  1526             iListWidget->ResizeL( aCount );
  1521             ProvideDataWithoutThumbnailsL(aMediaArray);
  1527             ProvideDataWithoutThumbnailsL(aMediaArray);
  1522             iListWidget->SetSelectedIndex( mediaIndex + iShuffleItem );
  1528             iListWidget->SetSelectedIndex( mediaIndex + iShuffleItem );
       
  1529 		    // Reserve mark icon for playlist in reorder mode
       
  1530 			if ( IsInReorderMode() )
       
  1531                 {
       
  1532                 MarkGrabedItemL( CurrentLbxItemIndex() + 1 );
       
  1533                 }
       
  1534 				
       
  1535 			// To remove flicker of default albumart in playlist track level
       
  1536 			if ( iContext == EContextItemPlaylist )
       
  1537 			    {  
       
  1538             	iDefaultIconSet = EFalse;
       
  1539             	// Setting an empty icon to the list as default icon.
       
  1540             	iListWidget->SetDefaultIconL(CGulIcon::NewL(new CFbsBitmap()));
       
  1541             	}	
  1523             }
  1542             }
  1524         else
  1543         else
  1525             {
  1544             {
  1526             iListWidget->RefreshScreen(0);
  1545             iListWidget->RefreshScreen(0);
  1527             }
  1546             }
  1888 
  1907 
  1889 	  if( iPopupListRect == TRect(0,0,0,0) )
  1908 	  if( iPopupListRect == TRect(0,0,0,0) )
  1890 		   {
  1909 		   {
  1891 	     ResolvePopupListSizeL();
  1910 	     ResolvePopupListSizeL();
  1892 		   }
  1911 		   }
  1893 		
  1912 
  1894     iMediaWall->SetOpenedItemRect( iPopupListRect );
  1913     iMediaWall->SetOpenedItemRect( iPopupListRect );
  1895     iMediaWall->SetOpeningAnimationType( CHgVgMediaWall::EHgVgOpeningAnimationZoomToFront );
  1914     iMediaWall->SetOpeningAnimationType( CHgVgMediaWall::EHgVgOpeningAnimationZoomToFront );
  1896 
  1915 
  1897     if( switchBuffer )
  1916     if( switchBuffer )
  1898         {
  1917         {
  2219     TInt index(MediaIndex(aIndex));
  2238     TInt index(MediaIndex(aIndex));
  2220 
  2239 
  2221     // ganes list components still uses this version of the HandleOpen
  2240     // ganes list components still uses this version of the HandleOpen
  2222     if ( iContext == EContextItemAlbum  )
  2241     if ( iContext == EContextItemAlbum  )
  2223 		{
  2242 		{
       
  2243         if( iCurrentViewType == EMPXViewTBone )
       
  2244             {
       
  2245             iMediaWall->SetFlags( CHgVgMediaWall::EHgVgMediaWallDrawToWindowGC );
       
  2246             iMediaWall->DrawNow();
       
  2247             }
  2224         SaveSelectedAlbumItemL(iSelectedAlbumIndex);
  2248         SaveSelectedAlbumItemL(iSelectedAlbumIndex);
  2225 		UpdatePathAndOpenL(index);
  2249 		UpdatePathAndOpenL(index);
  2226         // Start animation now as next view activated is
  2250         // Start animation now as next view activated is
  2227         // now playing view. We will end animation in now playing view.
  2251         // now playing view. We will end animation in now playing view.
  2228         SetupTransitionType(KMPXInterviewTransition);
  2252         SetupTransitionType(KMPXInterviewTransition);
  2240             }
  2264             }
  2241         }
  2265         }
  2242     else if ( iContext == EContextGroupSong || iContext == EContextItemPlaylist || iContext == EContextItemGenre )
  2266     else if ( iContext == EContextGroupSong || iContext == EContextItemPlaylist || iContext == EContextItemGenre )
  2243         {
  2267         {
  2244         // Check if shuffle play all was selected.
  2268         // Check if shuffle play all was selected.
  2245         if (!ShufflePlayAllL(index))
  2269         TBool inReorderMode ( IsInReorderMode() );
       
  2270         if ( inReorderMode && index == KErrNotFound )
       
  2271             {
       
  2272 			// If Shuffle is selected in reorder mode than Grabbed item should move 
       
  2273 			// to first position in the playlist, just after shuffle item.
       
  2274             SetLbxCurrentItemIndex(1);
       
  2275             iView->ProcessCommandL( EMPXCmdCommonEnterKey );
       
  2276             }
       
  2277         else if ( !ShufflePlayAllL(index) )
  2246             {
  2278             {
  2247             // To open the selected album.
  2279             // To open the selected album.
  2248             iView->ProcessCommandL( EMPXCmdCommonEnterKey );
  2280             iView->ProcessCommandL( EMPXCmdCommonEnterKey );
  2249             }
  2281             }
  2250         // Start animation now as next view activated is
  2282 
  2251         // now playing view. We will end animation in now playing view.
  2283 		// Disable transition in reorder mode
  2252         SetupTransitionType(KMPXInterviewTransition);
  2284         if( !inReorderMode )
  2253         BeginFullScreenAnimation();
  2285             {   
       
  2286 			// Start animation now as next view activated is
       
  2287             // now playing view. We will end animation in now playing view.
       
  2288             SetupTransitionType(KMPXInterviewTransition);
       
  2289             BeginFullScreenAnimation();
       
  2290             }
  2254         }
  2291         }
  2255     else
  2292     else
  2256 		{
  2293 		{
  2257 		iView->ProcessCommandL( EMPXCmdCommonEnterKey );
  2294 		iView->ProcessCommandL( EMPXCmdCommonEnterKey );
  2258 		}
  2295 		}
  5081 
  5118 
  5082 	iPreviousViewId = aViewUid;
  5119 	iPreviousViewId = aViewUid;
  5083     }
  5120     }
  5084 
  5121 
  5085 // ---------------------------------------------------------------------------
  5122 // ---------------------------------------------------------------------------
       
  5123 // Hides container window controls
       
  5124 // ---------------------------------------------------------------------------
       
  5125 //
       
  5126 void CMPXCollectionViewHgContainer::HideContainerWindow()
       
  5127     {
       
  5128     if( iMediaWall )
       
  5129         iMediaWall->MakeVisible(EFalse);
       
  5130     if( iListWidget )
       
  5131         iListWidget->MakeVisible(EFalse);
       
  5132     if( iMwListWidget )
       
  5133         iMwListWidget->MakeVisible(EFalse);
       
  5134 
       
  5135 	// draw background application rectangle
       
  5136     iDrawBackGround = ETrue;
       
  5137     DrawNow();
       
  5138     iDrawBackGround = EFalse;
       
  5139      }
       
  5140 
       
  5141 // ---------------------------------------------------------------------------
  5086 // Prepare and begin fullscreen animation effects
  5142 // Prepare and begin fullscreen animation effects
  5087 // ---------------------------------------------------------------------------
  5143 // ---------------------------------------------------------------------------
  5088 //
  5144 //
  5089 void CMPXCollectionViewHgContainer::BeginFullScreenAnimation()
  5145 void CMPXCollectionViewHgContainer::BeginFullScreenAnimation()
  5090     {
  5146     {
  5169             AknPopupLayouts::EDynMenuWindow );
  5225             AknPopupLayouts::EDynMenuWindow );
  5170 
  5226 
  5171     CleanupStack::PushL( dialog );
  5227     CleanupStack::PushL( dialog );
  5172 
  5228 
  5173     listBox->ConstructL( dialog, EAknListBoxViewerFlags );
  5229     listBox->ConstructL( dialog, EAknListBoxViewerFlags );
  5174     
  5230 
  5175     // title can be hardcoded because it is not shown to user. Just for the calculations.
  5231     // title can be hardcoded because it is not shown to user. Just for the calculations.
  5176     dialog->SetTitleL(_L("Foo"));
  5232     dialog->SetTitleL(_L("Foo"));
  5177     iPopupListRect = dialog->LayoutRect();
  5233     iPopupListRect = dialog->LayoutRect();
  5178 
  5234 
  5179     CleanupStack::PopAndDestroy( dialog );
  5235     CleanupStack::PopAndDestroy( dialog );
  5180     CleanupStack::PopAndDestroy( listBox );
  5236     CleanupStack::PopAndDestroy( listBox );
  5181     }
  5237     }
       
  5238 
       
  5239 // ---------------------------------------------------------------------------
       
  5240 // Marked the grabbed item for reordering
       
  5241 // ---------------------------------------------------------------------------
       
  5242 //
       
  5243 void CMPXCollectionViewHgContainer::MarkGrabedItemL(TInt aIndex)
       
  5244     {
       
  5245 	MPX_DEBUG2( "CMPXCollectionViewHgContainer::MarkGrabedItemL item %d", aIndex + iShuffleItem );
       
  5246     iListWidget->Mark( aIndex + iShuffleItem );
       
  5247     }
       
  5248 
  5182 //  End of File
  5249 //  End of File