mpxplugins/viewplugins/views/collectionviewhg/src/mpxcollectionviewhgcontainer.cpp
branchRCL_3
changeset 66 1f1dad4af8f8
parent 60 bdd9da0d70fe
equal deleted inserted replaced
60:bdd9da0d70fe 66:1f1dad4af8f8
   162 	iOpenAlbumTracks(EFalse),
   162 	iOpenAlbumTracks(EFalse),
   163 	iShuffleItem(0),
   163 	iShuffleItem(0),
   164 	iSetEmptyTextNeeded(EFalse),
   164 	iSetEmptyTextNeeded(EFalse),
   165 	iPopupListRect(TRect(0,0,0,0)),
   165 	iPopupListRect(TRect(0,0,0,0)),
   166 	iPreviousViewId(TUid::Uid(0)),
   166 	iPreviousViewId(TUid::Uid(0)),
   167 	iDrawBackGround(EFalse),
   167 	iDrawBackGround(EFalse)
   168 	iIsNowPlayingView(EFalse)
       
   169     {
   168     {
   170     }
   169     }
   171 
   170 
   172 // ---------------------------------------------------------------------------
   171 // ---------------------------------------------------------------------------
   173 // Destructor
   172 // Destructor
   799 
   798 
   800             TRect clientRect = ((CAknView*)iView)->ClientRect();
   799             TRect clientRect = ((CAknView*)iView)->ClientRect();
   801             SetRect( clientRect );
   800             SetRect( clientRect );
   802             iBgContext->SetRect(((CAknAppUi*)iCoeEnv->AppUi())->ApplicationRect());
   801             iBgContext->SetRect(((CAknAppUi*)iCoeEnv->AppUi())->ApplicationRect());
   803 
   802 
   804  			if ( iCurrentViewType == EMPXViewMediawall )
   803             // call HandleLbxItemAdditionL
   805 				{
   804             HandleLbxItemAdditionL();
   806 				PrepareTboneViewL();
       
   807 				}
       
   808 			else
       
   809 				{
       
   810 	            // call HandleLbxItemAdditionL
       
   811 	            HandleLbxItemAdditionL();
       
   812 				}
       
   813             }
   805             }
   814         );
   806         );
   815     if(iMediaWall)
   807     if(iMediaWall)
   816         iMediaWall->HandleResourceChange( aType );
   808         iMediaWall->HandleResourceChange( aType );
   817     if(iListWidget)
   809     if(iListWidget)
  1007 //
   999 //
  1008 TInt CMPXCollectionViewHgContainer::TopLbxItemIndex() const
  1000 TInt CMPXCollectionViewHgContainer::TopLbxItemIndex() const
  1009     {
  1001     {
  1010     MPX_FUNC( "CMPXCollectionViewHgContainer::TopLbxItemIndex" );
  1002     MPX_FUNC( "CMPXCollectionViewHgContainer::TopLbxItemIndex" );
  1011     return iTopIndex;
  1003     return iTopIndex;
  1012     }
       
  1013 
       
  1014 
       
  1015 // -----------------------------------------------------------------------------
       
  1016 // Gets first listbox item index on screen(relative to the original listbox).
       
  1017 // -----------------------------------------------------------------------------
       
  1018 //
       
  1019 TInt CMPXCollectionViewHgContainer::FirstIndexOnScreen() const
       
  1020     {
       
  1021     MPX_FUNC( "CMPXCollectionViewHgContainer::FirstIndexOnScreen" );
       
  1022     TInt index = 0;
       
  1023     if ( iListWidget )
       
  1024         {
       
  1025         index = iListWidget->FirstIndexOnScreen();
       
  1026         }
       
  1027     return index;
       
  1028     }
  1004     }
  1029 
  1005 
  1030 
  1006 
  1031 // -----------------------------------------------------------------------------
  1007 // -----------------------------------------------------------------------------
  1032 // Gets bottom listbox item index (relative to the original listbox).
  1008 // Gets bottom listbox item index (relative to the original listbox).
  1281             // We only need to use this for one transition coming
  1257             // We only need to use this for one transition coming
  1282             // from playback view.
  1258             // from playback view.
  1283             TBool pbv = (iPreviousViewId == TUid::Uid(KMPXPluginTypePlaybackUid)) ? ETrue : EFalse;
  1259             TBool pbv = (iPreviousViewId == TUid::Uid(KMPXPluginTypePlaybackUid)) ? ETrue : EFalse;
  1284             if ( pbv )
  1260             if ( pbv )
  1285                 {
  1261                 {
  1286                 iIsNowPlayingView = ETrue;
       
  1287             	iPreviousViewId = TUid::Uid(0);
  1262             	iPreviousViewId = TUid::Uid(0);
  1288             	SetupTransitionType(KMPXInterviewTransition, pbv);
  1263             	SetupTransitionType(KMPXInterviewTransition, pbv);
  1289                 }
  1264                 }
  1290             else // intraview transitions
  1265             else // intraview transitions
  1291 				{
  1266 				{
  1309                 }
  1284                 }
  1310             case EMPXViewTBone:
  1285             case EMPXViewTBone:
  1311                 {
  1286                 {
  1312                 RestoreSelectedAlbumItemL(mediaArray);
  1287                 RestoreSelectedAlbumItemL(mediaArray);
  1313                 PrepareMediaWallWithListL( mediaArray, count );
  1288                 PrepareMediaWallWithListL( mediaArray, count );
       
  1289                 // We need to adjust the CBA for this view.
       
  1290                 if( iCbaHandler )
       
  1291                     {
       
  1292                     iCbaHandler->UpdateCba();
       
  1293                     }
  1314                 break;
  1294                 break;
  1315                 }
  1295                 }
  1316             case EMPXViewList:
  1296             case EMPXViewList:
  1317                 {
  1297                 {
  1318                 PrepareListL(mediaArray, count);
  1298                 PrepareListL(mediaArray, count);
  1640         iListWidget->SetMenuProviderL(this);
  1620         iListWidget->SetMenuProviderL(this);
  1641         iListWidget->SetSelectionObserver(*this);
  1621         iListWidget->SetSelectionObserver(*this);
  1642         // TODO. check if this is correct for all lists
  1622         // TODO. check if this is correct for all lists
  1643         iListWidget->ClearFlags( CHgScroller::EHgScrollerKeyMarkingDisabled );
  1623         iListWidget->ClearFlags( CHgScroller::EHgScrollerKeyMarkingDisabled );
  1644         iListWidget->SetFocus(ETrue);
  1624         iListWidget->SetFocus(ETrue);
  1645         if( iContext == EContextItemPlaylist )
  1625         iListWidget->SetScrollBarTypeL( CHgScroller::EHgScrollerLetterStripLite );
  1646             {
       
  1647             iListWidget->SetScrollBarTypeL( CHgScroller::EHgScrollerScrollBar);
       
  1648             }   
       
  1649         else
       
  1650             {
       
  1651             iListWidget->SetScrollBarTypeL( CHgScroller::EHgScrollerLetterStripLite );
       
  1652             }
       
  1653         iListWidget->DrawableWindow()->SetOrdinalPosition( -1 );
  1626         iListWidget->DrawableWindow()->SetOrdinalPosition( -1 );
  1654         iListWidget->DrawableWindow()->SetFaded(((CAknAppUi*)iCoeEnv->AppUi())->IsFaded(), RWindowTreeNode::EFadeIncludeChildren);
  1627         iListWidget->DrawableWindow()->SetFaded(((CAknAppUi*)iCoeEnv->AppUi())->IsFaded(), RWindowTreeNode::EFadeIncludeChildren);
  1655         ProvideDataWithoutThumbnailsL(aMediaArray);
  1628         ProvideDataWithoutThumbnailsL(aMediaArray);
  1656         }
  1629         }
  1657     else
  1630     else
  1658         {
  1631         {
  1659         iListWidget->Reset();
  1632         iListWidget->Reset();
  1660         iListWidget->ResizeL( aCount );
  1633         iListWidget->ResizeL( aCount );
  1661         iListWidget->SetFocus(ETrue);
  1634         iListWidget->SetFocus(ETrue);
  1662         if( iContext == EContextItemPlaylist )
       
  1663             {
       
  1664             iListWidget->SetScrollBarTypeL( CHgScroller::EHgScrollerScrollBar);
       
  1665             }   
       
  1666         else
       
  1667             {
       
  1668             iListWidget->SetScrollBarTypeL( CHgScroller::EHgScrollerLetterStripLite );
       
  1669             }
       
  1670         ProvideDataWithoutThumbnailsL(aMediaArray);
  1635         ProvideDataWithoutThumbnailsL(aMediaArray);
  1671         iListWidget->MakeVisible(ETrue);
  1636         iListWidget->MakeVisible(ETrue);
  1672         iListWidget->InitScreenL(clientRect);
  1637         iListWidget->InitScreenL(clientRect);
  1673         }
  1638         }
  1674 
  1639 
  1726 
  1691 
  1727 	// Now create the media wall & the list
  1692 	// Now create the media wall & the list
  1728 
  1693 
  1729     ((CAknAppUi*)iCoeEnv->AppUi())->StatusPane()->MakeVisible(EFalse);
  1694     ((CAknAppUi*)iCoeEnv->AppUi())->StatusPane()->MakeVisible(EFalse);
  1730     iThumbnailManager->SetSizeL( EAudioGridThumbnailSize );
  1695     iThumbnailManager->SetSizeL( EAudioGridThumbnailSize );
  1731     if( iCbaHandler )
  1696 
  1732         {
       
  1733         iCbaHandler->UpdateCba();
       
  1734         }
       
  1735     TRect clientRect = ((CAknView*)iView)->ClientRect();
  1697     TRect clientRect = ((CAknView*)iView)->ClientRect();
  1736 
  1698 
  1737     TAknLayoutRect mediawallLayout;
  1699     TAknLayoutRect mediawallLayout;
  1738     mediawallLayout.LayoutRect( clientRect, AknLayoutScalable_Apps::cf0_flow_pane(0) );
  1700     mediawallLayout.LayoutRect( clientRect, AknLayoutScalable_Apps::cf0_flow_pane(0) );
  1739 
  1701 
  1859         switchBuffer = CMPXCollectionViewHgSwitchBuffer::CreateBufferLC( *iListWidget );
  1821         switchBuffer = CMPXCollectionViewHgSwitchBuffer::CreateBufferLC( *iListWidget );
  1860         }
  1822         }
  1861     else if ( iMediaWall && iPrevViewType == EMPXViewTBone )
  1823     else if ( iMediaWall && iPrevViewType == EMPXViewTBone )
  1862         {
  1824         {
  1863         switchBuffer = CMPXCollectionViewHgSwitchBuffer::CreateBufferLC( *iMediaWall );
  1825         switchBuffer = CMPXCollectionViewHgSwitchBuffer::CreateBufferLC( *iMediaWall );
  1864         if (aMediaArray.Count()>1)
  1826         switchBuffer->SetIndexOffset(1);
  1865             {
       
  1866             switchBuffer->SetIndexOffset(1);
       
  1867             }
       
  1868         }
  1827         }
  1869     if( iMediaWall )
  1828     if( iMediaWall )
  1870         {
  1829         {
  1871         delete iMediaWall;
  1830         delete iMediaWall;
  1872         iMediaWall = 0;
  1831         iMediaWall = 0;
  1874         iMwListWidget = 0;
  1833         iMwListWidget = 0;
  1875         }
  1834         }
  1876 
  1835 
  1877 	if (!iMediaWall)
  1836 	if (!iMediaWall)
  1878 	    {
  1837 	    {
  1879 	    if ( iIsNowPlayingView )
  1838         iMediaWall = CHgVgMediaWall::NewL(
  1880 	        {
  1839                 appRect,
  1881 			// back from now playing view, create mediawall with empty albumart icon to avoid flickering
  1840                 aCount,
  1882 	        iMediaWall = CHgVgMediaWall::NewL(
  1841                 CHgVgMediaWall::EHgVgMediaWallStyleCoverflowFullScreen,
  1883 	                appRect,
  1842                 ETrue,
  1884 	                aCount,
  1843                 this,
  1885 	                CHgVgMediaWall::EHgVgMediaWallStyleCoverflowFullScreen,
  1844                 DefaultIconL() );
  1886 	                ETrue,
  1845 
  1887 	                this,
       
  1888 	                CGulIcon::NewL( new CFbsBitmap()) );
       
  1889 	        }
       
  1890 	    else
       
  1891 	        {
       
  1892 	        iMediaWall = CHgVgMediaWall::NewL(
       
  1893 	                appRect,
       
  1894 	                aCount,
       
  1895 	                CHgVgMediaWall::EHgVgMediaWallStyleCoverflowFullScreen,
       
  1896 	                ETrue,
       
  1897 	                this,
       
  1898 	                DefaultIconL() );
       
  1899 	        }
       
  1900     
       
  1901         if( !iIsForeground )
  1846         if( !iIsForeground )
  1902             iMediaWall->HandleLosingForeground();
  1847             iMediaWall->HandleLosingForeground();
  1903 
  1848 
  1904         iMediaWall->SetMopParent(this);
  1849         iMediaWall->SetMopParent(this);
  1905         iMediaWall->SetSelectionObserver(*this);
  1850         iMediaWall->SetSelectionObserver(*this);
  1973         {
  1918         {
  1974         switchBuffer->FillFromBufferL( *iMediaWall );
  1919         switchBuffer->FillFromBufferL( *iMediaWall );
  1975         CleanupStack::PopAndDestroy( switchBuffer );
  1920         CleanupStack::PopAndDestroy( switchBuffer );
  1976         switchBuffer = NULL;
  1921         switchBuffer = NULL;
  1977         }
  1922         }
  1978 	
  1923 	iDefaultIconSet = ETrue;
  1979 	if ( iIsNowPlayingView )
       
  1980 	    {
       
  1981         iDefaultIconSet = EFalse;
       
  1982         iIsNowPlayingView = EFalse;
       
  1983 	    }
       
  1984 	else
       
  1985 	    {
       
  1986         iDefaultIconSet = ETrue;
       
  1987 	    }
       
  1988 	CleanPrevView();
  1924 	CleanPrevView();
  1989     }
  1925     }
  1990 
  1926 
  1991 // ----------------------------------------------------------------------------
  1927 // ----------------------------------------------------------------------------
  1992 // Add shuffle list item to the top of the list.
  1928 // Add shuffle list item to the top of the list.
  2341             }
  2277             }
  2342         else if ( !ShufflePlayAllL(index) )
  2278         else if ( !ShufflePlayAllL(index) )
  2343             {
  2279             {
  2344             // To open the selected album.
  2280             // To open the selected album.
  2345             iView->ProcessCommandL( EMPXCmdCommonEnterKey );
  2281             iView->ProcessCommandL( EMPXCmdCommonEnterKey );
  2346             iPlaybackUtility->SetL( EPbPropertyRandomMode, EFalse ); 
       
  2347             }
  2282             }
  2348 
  2283 
  2349 		// Disable transition in reorder mode
  2284 		// Disable transition in reorder mode
  2350         if( !inReorderMode )
  2285         if( !inReorderMode )
  2351             {   
  2286             {   
  4141 					cpath->Set(randIndex);
  4076 					cpath->Set(randIndex);
  4142 					iPlaybackUtility->SetL( EPbPropertyRandomMode, ETrue );
  4077 					iPlaybackUtility->SetL( EPbPropertyRandomMode, ETrue );
  4143 					}
  4078 					}
  4144 				else
  4079 				else
  4145 					{
  4080 					{
  4146 					iPlaybackUtility->SetL( EPbPropertyRandomMode, EFalse ); 
       
  4147 					cpath->Set(aIndex-1); // actual selection
  4081 					cpath->Set(aIndex-1); // actual selection
  4148 					}
  4082 					}
  4149 				}
  4083 				}
  4150 			else
  4084 			else
  4151 				{
  4085 				{
  4152 				iPlaybackUtility->SetL( EPbPropertyRandomMode, EFalse ); 
       
  4153 				cpath->Set(aIndex);
  4086 				cpath->Set(aIndex);
  4154 				}
  4087 				}
  4155 			}
  4088 			}
  4156 
  4089 
  4157 		MPX_DEBUG_PATH(*cpath);
  4090 		MPX_DEBUG_PATH(*cpath);
  4735         // Start animation now as next view activated is
  4668         // Start animation now as next view activated is
  4736         // now playing view. We will end animation in now playing view.
  4669         // now playing view. We will end animation in now playing view.
  4737         SetupTransitionType(KMPXInterviewTransition);
  4670         SetupTransitionType(KMPXInterviewTransition);
  4738         BeginFullScreenAnimation();
  4671         BeginFullScreenAnimation();
  4739         }
  4672         }
  4740     else if( !iLayoutSwitch && iMediaWall && ( iCurrentViewType == EMPXViewMediawall ) )
  4673     else if( !iLayoutSwitch && iMediaWall )
  4741         {
  4674         {
  4742         // Close mediawall "flip animation"
  4675         // Close mediawall "flip animation"
  4743         iMediaWall->StartOpeningAnimationL( EFalse );
  4676         iMediaWall->StartOpeningAnimationL( EFalse );
  4744         }
  4677         }
  4745 
  4678 
  4771 	if( songCount > 1 )
  4704 	if( songCount > 1 )
  4772 		{
  4705 		{
  4773 		listSize++;
  4706 		listSize++;
  4774 		indexAddition = 1;
  4707 		indexAddition = 1;
  4775 		}
  4708 		}
  4776 	currentList->Reset(); //clears any selection along with list reset	
       
  4777 	// Add space for shuffle item if list contains more than one item.
  4709 	// Add space for shuffle item if list contains more than one item.
  4778 	currentList->ResizeL( listSize );
  4710 	currentList->ResizeL( listSize );
  4779 
  4711 
  4780 	for ( TInt i = 0; i < songCount ; i++ )
  4712 	for ( TInt i = 0; i < songCount ; i++ )
  4781 		{
  4713 		{