mpxplugins/viewplugins/views/collectionviewhg/src/mpxcollectionviewhgcontainer.cpp
branchRCL_3
changeset 28 56b11cf8addb
parent 26 70a8526f03f2
child 31 a12246c97fcc
equal deleted inserted replaced
26:70a8526f03f2 28:56b11cf8addb
   103 #endif
   103 #endif
   104 const TInt KMPXMaxFileLength = 256;
   104 const TInt KMPXMaxFileLength = 256;
   105 const TReal KIconFactor = 0.7;
   105 const TReal KIconFactor = 0.7;
   106 
   106 
   107 const TInt KThumbLoadingPauseForTransition(500000);
   107 const TInt KThumbLoadingPauseForTransition(500000);
       
   108 const TInt KMPXInterviewTransition = 0;
       
   109 const TInt KMPXIntraviewTransition = 1;
   108 
   110 
   109 _LIT( KMPXDash, " - " );
   111 _LIT( KMPXDash, " - " );
   110 #ifdef HG_MP_LOC_AVAILABLE
   112 #ifdef HG_MP_LOC_AVAILABLE
   111 _LIT( KMPXSpace, " ");
   113 _LIT( KMPXSpace, " ");
   112 #endif //HG_MP_LOC_AVAILABLE
   114 #endif //HG_MP_LOC_AVAILABLE
   113 _LIT( KMPXZeroDurationMark, "--");
   115 _LIT( KMPXZeroDurationMark, "--");
   114 
   116 
   115 _LIT( KSong, " song" );
       
   116 _LIT( KSongs, " songs" );
       
   117 _LIT( KEpisode, " episode" );
       
   118 _LIT( KEpisodes, " episodes" );
       
   119 _LIT( KAlbum, " album" );
       
   120 _LIT( KAlbums, " albums" );
       
   121 _LIT( KSongDash, " song - " );
       
   122 _LIT( KSongsDash, " songs - " );
       
   123 
   117 
   124 // ======== MEMBER FUNCTIONS ========
   118 // ======== MEMBER FUNCTIONS ========
   125 
   119 
   126 // ---------------------------------------------------------------------------
   120 // ---------------------------------------------------------------------------
   127 // Two-phased constructor.
   121 // Two-phased constructor.
   215         }
   209         }
   216 
   210 
   217     delete iPlaylist;
   211     delete iPlaylist;
   218     delete iPlaylistHelper;
   212     delete iPlaylistHelper;
   219 
   213 
   220     if( iAsyncCallBack )
       
   221         {
       
   222         iAsyncCallBack->Cancel();
       
   223         }
       
   224     delete iAsyncCallBack;
       
   225 
       
   226     iCoeEnv->RemoveForegroundObserver( *this );
   214     iCoeEnv->RemoveForegroundObserver( *this );
   227     }
   215     }
   228 
   216 
   229 // ---------------------------------------------------------------------------
   217 // ---------------------------------------------------------------------------
   230 // Symbian 2nd phase constructor can leave.
   218 // Symbian 2nd phase constructor can leave.
   272     CreateIconArrayL();
   260     CreateIconArrayL();
   273 
   261 
   274     iIsForeground = ETrue;
   262     iIsForeground = ETrue;
   275     iCoeEnv->AddForegroundObserverL( *this );
   263     iCoeEnv->AddForegroundObserverL( *this );
   276 
   264 
   277     TCallBack callback(CMPXCollectionViewHgContainer::AsyncCallback, this);
   265     iPreviousOrientation = Layout_Meta_Data::IsLandscapeOrientation();
   278     iAsyncCallBack = new (ELeave) CAsyncCallBack( CActive::EPriorityStandard );
       
   279     iAsyncCallBack->Set(callback);
       
   280 
   266 
   281     GfxTransEffect::Enable();
   267     GfxTransEffect::Enable();
   282 
   268 
   283     CreateWindowL();
   269     CreateWindowL();
   284     ActivateL();
   270     ActivateL();
   726     TRAP_IGNORE(
   712     TRAP_IGNORE(
   727         if ( aType == KAknsMessageSkinChange )
   713         if ( aType == KAknsMessageSkinChange )
   728             {
   714             {
   729             delete iIconArray;
   715             delete iIconArray;
   730             iIconArray = NULL;
   716             iIconArray = NULL;
   731             CreateIconArrayL();
       
   732 
   717 
   733             if( iCurrentViewType == EMPXViewMediawall || iCurrentViewType == EMPXViewTBone )
   718             if( iCurrentViewType == EMPXViewMediawall || iCurrentViewType == EMPXViewTBone )
   734                 {
   719                 {
   735             	iMediaWall->SetDefaultIconL(NULL);
   720             	iMediaWall->SetDefaultIconL(NULL);
   736                 iMediaWall->EnableScrollBufferL(*this, KMPXListBufferSize, KMPXListBufferSize/4);
   721             	CreateIconArrayL();
       
   722                 iMediaWall->EnableScrollBufferL(*this, KMPXListBufferSizeWithMediaWall, KMPXListBufferSizeWithMediaWall/4);
   737                 }
   723                 }
   738             else
   724             else
   739                 {
   725                 {
   740                 CHgScroller* list = CurrentListWidget();
   726                 CHgScroller* list = CurrentListWidget();
   741                 if( list )
   727                 if( list )
   742                     {
   728                     {
   743                     list->SetDefaultIconL(NULL);
   729                     list->SetDefaultIconL(NULL);
   744                     list->EnableScrollBufferL(*this, KMPXListBufferSizeWithMediaWall, KMPXListBufferSizeWithMediaWall/4);
   730             		CreateIconArrayL();
       
   731                     list->EnableScrollBufferL(*this, KMPXListBufferSize, KMPXListBufferSize/4);
   745                     }
   732                     }
   746                 }
   733                 }
   747 			SetDetailIconShuffleL();
   734             // Reset the shuffle item for TBone view
   748             }
   735 			if ( iCurrentViewType == EMPXViewTBone )
   749         else if ( aType == KEikDynamicLayoutVariantSwitch )
   736 				{
       
   737 				if (iMwListWidget && iMwListWidget->ItemCount() > 1)
       
   738 					{
       
   739 					SetShuffleItemToListL(iMwListWidget);
       
   740 					}
       
   741 				}
       
   742 			// Songs dialog is opened in mediawall, we need to reset its shuffle item
       
   743 			else if ( iCurrentViewType == EMPXViewMediawall && iDialog )
       
   744 				{
       
   745 				CAknIconArray* iconArray = new( ELeave ) CAknIconArray( 1 );
       
   746 				CleanupStack::PushL( iconArray );
       
   747 				// Prepare icon array.
       
   748 				CGulIcon* icon = (*iIconArray)[EMPXClvIconShuffle];
       
   749 				CGulIcon* iconCopy = CGulIcon::NewL(icon->Bitmap(), icon->Mask());
       
   750 				iconCopy->SetBitmapsOwnedExternally(ETrue);
       
   751 				iconArray->AppendL(iconCopy);
       
   752 				CAknSingleGraphicPopupMenuStyleListBox* listbox = (CAknSingleGraphicPopupMenuStyleListBox *)iDialog->ListBox();
       
   753 				listbox->ItemDrawer()->ColumnData()->SetIconArrayL( iconArray );
       
   754 				CleanupStack::Pop(); // iconArray
       
   755 				}
       
   756 			else
       
   757 				{
       
   758             	// Reset the shuffle item for other views
       
   759 				SetDetailIconShuffleL();
       
   760 				}
       
   761             }
       
   762         else if ( aType == KEikDynamicLayoutVariantSwitch &&
       
   763         		( iPreviousOrientation != landscapeOrientation ) )
   750             {
   764             {
   751             iLayoutSwitch = ETrue;
   765             iLayoutSwitch = ETrue;
       
   766 			// To prevent multiple layout change causing multiple repopulation of the list.
       
   767 			// Temporary fix until rootcause is found.
       
   768             iPreviousOrientation = landscapeOrientation;
   752 
   769 
   753             if ( iCurrentViewType == EMPXViewMediawall )
   770             if ( iCurrentViewType == EMPXViewMediawall )
   754                 {
   771                 {
   755                 if ( iDialog )
   772                 if ( iDialog )
   756                     {
   773                     {
   757                     iDialog->CancelPopup();
   774                     iDialog->CancelPopup();
   758                     }
   775                     }
   759                 // make cba visible so that visible screen area is calculated correctly in list view
       
   760                 if( iCbaHandler )
       
   761                     iCbaHandler->ChangeCbaVisibility( ETrue );
       
   762                 }
   776                 }
   763             iSetEmptyTextNeeded = ETrue;
   777             iSetEmptyTextNeeded = ETrue;
   764 
   778 
   765 
   779 
   766             TRect clientRect = ((CAknView*)iView)->ClientRect();
   780             TRect clientRect = ((CAknView*)iView)->ClientRect();
  1225             // from playback view.
  1239             // from playback view.
  1226             TBool pbv = (iPreviousViewId == TUid::Uid(KMPXPluginTypePlaybackUid)) ? ETrue : EFalse;
  1240             TBool pbv = (iPreviousViewId == TUid::Uid(KMPXPluginTypePlaybackUid)) ? ETrue : EFalse;
  1227             if ( pbv )
  1241             if ( pbv )
  1228                 {
  1242                 {
  1229             	iPreviousViewId = TUid::Uid(0);
  1243             	iPreviousViewId = TUid::Uid(0);
       
  1244             	SetupTransitionType(KMPXInterviewTransition, pbv);
  1230                 }
  1245                 }
  1231             BeginFullScreenAnimation( pbv );
  1246             else // intraview transitions
       
  1247 				{
       
  1248             	SetupTransitionType(KMPXIntraviewTransition);
       
  1249 				}
       
  1250             BeginFullScreenAnimation();
  1232             }
  1251             }
  1233 
  1252 
  1234         switch (iCurrentViewType)
  1253         switch (iCurrentViewType)
  1235             {
  1254             {
  1236             case EMPXViewMediawall:
  1255             case EMPXViewMediawall:
  1267             }
  1286             }
  1268         }
  1287         }
  1269 
  1288 
  1270     DrawableWindow()->SetOrdinalPosition( -1 );
  1289     DrawableWindow()->SetOrdinalPosition( -1 );
  1271 
  1290 
  1272     CleanPrevView();
       
  1273     iPrevViewType = iCurrentViewType;
  1291     iPrevViewType = iCurrentViewType;
  1274     iPrevContext = iContext;
  1292     iPrevContext = iContext;
  1275     if ( iSetEmptyTextNeeded )
  1293     if ( iSetEmptyTextNeeded )
  1276         {
  1294         {
  1277         LoadAndSetEmptyTextL();
  1295         LoadAndSetEmptyTextL();
  1278         iSetEmptyTextNeeded = EFalse;
  1296         iSetEmptyTextNeeded = EFalse;
  1279         }
  1297         }
  1280     if( !iDefaultIconSet )
       
  1281         {
       
  1282         SetDefaultIconL();
       
  1283         }
       
  1284 
       
  1285     iLayoutSwitch = EFalse;
  1298     iLayoutSwitch = EFalse;
  1286     }
  1299     }
  1287 
  1300 
  1288 // -----------------------------------------------------------------------------
  1301 // -----------------------------------------------------------------------------
  1289 // Handle listbox item addition, preserving the current display index
  1302 // Handle listbox item addition, preserving the current display index
  1516             {
  1529             {
  1517              iSelectedAlbumIndex = mediaIndex;
  1530              iSelectedAlbumIndex = mediaIndex;
  1518              SaveSelectedAlbumItemL( iSelectedAlbumIndex );
  1531              SaveSelectedAlbumItemL( iSelectedAlbumIndex );
  1519             }
  1532             }
  1520 
  1533 
       
  1534         TInt prevItemCount( iMediaWall->ItemCount() );
  1521         iMediaWall->Reset();
  1535         iMediaWall->Reset();
  1522         if ( aCount )
  1536         if ( aCount )
  1523             {
  1537             {
       
  1538             // enable scroll buffering now as it has not been enabled when empty mediawall was constructed
       
  1539             if ( !prevItemCount )
       
  1540                 {
       
  1541                 iMediaWall->EnableScrollBufferL( *this, KMPXListBufferSizeWithMediaWall, KMPXListBufferSizeWithMediaWall/4 );
       
  1542                 }
  1524             iMediaWall->ResizeL( aCount );
  1543             iMediaWall->ResizeL( aCount );
  1525             ProvideDataWithoutThumbnailsMwL(aMediaArray);
  1544             ProvideDataWithoutThumbnailsMwL(aMediaArray);
  1526 
  1545 
  1527             iMediaWall->SetSelectedIndex( mediaIndex + iShuffleItem);
  1546             iMediaWall->SetSelectedIndex( mediaIndex + iShuffleItem);
  1528             if ( iCurrentViewType == EMPXViewTBone )
  1547             if ( iCurrentViewType == EMPXViewTBone )
  1606         // Check if the list is empty, Enable scroll buffer won't call requst if list is empty
  1625         // Check if the list is empty, Enable scroll buffer won't call requst if list is empty
  1607         ( iListWidget->ItemCount() != 0 ) )
  1626         ( iListWidget->ItemCount() != 0 ) )
  1608         {
  1627         {
  1609         MPX_DEBUG1("CMPXCollectionViewHgContainer::PrepareListL - EnableScrollBufferL");
  1628         MPX_DEBUG1("CMPXCollectionViewHgContainer::PrepareListL - EnableScrollBufferL");
  1610         iListWidget->EnableScrollBufferL(*this, KMPXListBufferSize, KMPXListBufferSize/4);
  1629         iListWidget->EnableScrollBufferL(*this, KMPXListBufferSize, KMPXListBufferSize/4);
       
  1630    		iDefaultIconSet = EFalse;
       
  1631 		// Setting an empty icon to the list as default icon.
       
  1632         iListWidget->SetDefaultIconL(CGulIcon::NewL(new CFbsBitmap()));
       
  1633         CleanPrevView();
  1611         }
  1634         }
  1612     else
  1635     else
  1613         {
  1636         {
       
  1637 		// Note: Special case
       
  1638 		// We need to clean previous view prior to setting default icon otherwise the
       
  1639 		// icon will be set to the wrong scroller.
       
  1640 		CleanPrevView();
       
  1641         SetDefaultIconL();
  1614         EndFullScreenAnimation();
  1642         EndFullScreenAnimation();
  1615         iListWidget->RefreshScreen(0);
  1643         iListWidget->RefreshScreen(0);
  1616         }
  1644     	iDefaultIconSet = ETrue;
  1617     iDefaultIconSet = EFalse;
  1645         }
  1618     }
  1646     }
  1619 
  1647 
  1620 // ----------------------------------------------------------------------------
  1648 // ----------------------------------------------------------------------------
  1621 // Prepare view for displaying data in media wall with list
  1649 // Prepare view for displaying data in media wall with list
  1622 // ----------------------------------------------------------------------------
  1650 // ----------------------------------------------------------------------------
  1659 				mediaWallRect,
  1687 				mediaWallRect,
  1660 				aCount,
  1688 				aCount,
  1661 				CHgVgMediaWall::EHgVgMediaWallStyleCoverflowTBonePortrait,
  1689 				CHgVgMediaWall::EHgVgMediaWallStyleCoverflowTBonePortrait,
  1662 				EFalse,
  1690 				EFalse,
  1663 				this,
  1691 				this,
  1664 				DefaultIconL() );
  1692 				CGulIcon::NewL( new CFbsBitmap()) );
  1665 
  1693 
  1666 		if( !iIsForeground )
  1694 		if( !iIsForeground )
  1667 		    iMediaWall->HandleLosingForeground();
  1695 		    iMediaWall->HandleLosingForeground();
  1668 
  1696 
  1669 		iMediaWall->SetMopParent(this);
  1697 		iMediaWall->SetMopParent(this);
  1727         if( iTranstionType == EMPXTranstionNotDefined )
  1755         if( iTranstionType == EMPXTranstionNotDefined )
  1728             iMediaWall->RefreshScreen(iAlbumIndex);
  1756             iMediaWall->RefreshScreen(iAlbumIndex);
  1729         OpenAlbumL(iAlbumIndex);
  1757         OpenAlbumL(iAlbumIndex);
  1730        }
  1758        }
  1731     iMwListWidget->RefreshScreen(0);
  1759     iMwListWidget->RefreshScreen(0);
  1732 	iDefaultIconSet = ETrue;
  1760 
       
  1761 	CleanPrevView();
  1733     }
  1762     }
  1734 
  1763 
  1735 // ----------------------------------------------------------------------------
  1764 // ----------------------------------------------------------------------------
  1736 // Prepare view for displaying data in Media wall format.
  1765 // Prepare view for displaying data in Media wall format.
  1737 // ----------------------------------------------------------------------------
  1766 // ----------------------------------------------------------------------------
  1752 
  1781 
  1753     if( iListWidget && (iPrevContext == EContextGroupAlbum || iPrevContext == EContextItemAlbum ) )
  1782     if( iListWidget && (iPrevContext == EContextGroupAlbum || iPrevContext == EContextItemAlbum ) )
  1754         {
  1783         {
  1755         switchBuffer = CMPXCollectionViewHgSwitchBuffer::CreateBufferLC( *iListWidget );
  1784         switchBuffer = CMPXCollectionViewHgSwitchBuffer::CreateBufferLC( *iListWidget );
  1756         }
  1785         }
  1757     else if ( iMediaWall )
  1786     else if ( iMediaWall && iPrevViewType == EMPXViewTBone )
  1758         {
  1787         {
  1759         switchBuffer = CMPXCollectionViewHgSwitchBuffer::CreateBufferLC( *iMediaWall );
  1788         switchBuffer = CMPXCollectionViewHgSwitchBuffer::CreateBufferLC( *iMediaWall );
  1760         switchBuffer->SetIndexOffset(1);
  1789         switchBuffer->SetIndexOffset(1);
  1761         }
  1790         }
  1762     if( iMediaWall )
  1791     if( iMediaWall )
  1784         iMediaWall->SetSelectionObserver(*this);
  1813         iMediaWall->SetSelectionObserver(*this);
  1785         iMediaWall->SetObserver( this ); // softkey visibility event observer
  1814         iMediaWall->SetObserver( this ); // softkey visibility event observer
  1786         // Check if the list is empty, Enable scroll buffer won't call requst if list is empty
  1815         // Check if the list is empty, Enable scroll buffer won't call requst if list is empty
  1787         if( iMediaWall->ItemCount() != 0 )
  1816         if( iMediaWall->ItemCount() != 0 )
  1788             {
  1817             {
  1789         		iMediaWall->EnableScrollBufferL(
  1818         	iMediaWall->EnableScrollBufferL(
  1790                 *this,
  1819                 *this,
  1791                 KMPXListBufferSizeWithMediaWall,
  1820                 KMPXListBufferSizeWithMediaWall,
  1792                 KMPXListBufferSizeWithMediaWall / 4);
  1821                 KMPXListBufferSizeWithMediaWall / 4);
  1793             }
  1822             }
  1794         else
  1823         else
  1817 	    iMediaWall->MakeVisible( ETrue );
  1846 	    iMediaWall->MakeVisible( ETrue );
  1818         iMediaWall->SetFocus( ETrue );
  1847         iMediaWall->SetFocus( ETrue );
  1819 		// Check if the list is empty, Enable scroll buffer won't call requst if list is empty
  1848 		// Check if the list is empty, Enable scroll buffer won't call requst if list is empty
  1820         if( iMediaWall->ItemCount() != 0 )
  1849         if( iMediaWall->ItemCount() != 0 )
  1821             {
  1850             {
  1822         		iMediaWall->EnableScrollBufferL(
  1851         	iMediaWall->EnableScrollBufferL(
  1823                 *this,
  1852                 *this,
  1824                 KMPXListBufferSizeWithMediaWall,
  1853                 KMPXListBufferSizeWithMediaWall,
  1825                 KMPXListBufferSizeWithMediaWall / 4);
  1854                 KMPXListBufferSizeWithMediaWall / 4);
  1826             }
  1855             }
  1827         else
  1856         else
  1838     if( iTranstionType != EMPXTranstionNotDefined )
  1867     if( iTranstionType != EMPXTranstionNotDefined )
  1839         {
  1868         {
  1840         iMediaWall->SetFlags( CHgVgMediaWall::EHgVgMediaWallDrawToWindowGC );
  1869         iMediaWall->SetFlags( CHgVgMediaWall::EHgVgMediaWallDrawToWindowGC );
  1841         }
  1870         }
  1842 
  1871 
  1843 	if( iPopupListRect == TRect(0,0,0,0) )
  1872 	  if( iPopupListRect == TRect(0,0,0,0) )
  1844 		{
  1873 		   {
  1845 	    ResolvePopupListSizeL();
  1874 	     ResolvePopupListSizeL();
  1846 		}
  1875 		   }
  1847 
  1876 		
  1848     iMediaWall->SetOpenedItemRect( iPopupListRect );
  1877     iMediaWall->SetOpenedItemRect( iPopupListRect );
  1849     iMediaWall->SetOpeningAnimationType( CHgVgMediaWall::EHgVgOpeningAnimationZoomToFront );
  1878     iMediaWall->SetOpeningAnimationType( CHgVgMediaWall::EHgVgOpeningAnimationZoomToFront );
  1850 
  1879 
  1851     if( switchBuffer )
  1880     if( switchBuffer )
  1852         {
  1881         {
  1853         switchBuffer->FillFromBufferL( *iMediaWall );
  1882         switchBuffer->FillFromBufferL( *iMediaWall );
  1854         CleanupStack::PopAndDestroy( switchBuffer );
  1883         CleanupStack::PopAndDestroy( switchBuffer );
  1855         switchBuffer = NULL;
  1884         switchBuffer = NULL;
  1856         }
  1885         }
  1857 	iDefaultIconSet = ETrue;
  1886 	iDefaultIconSet = ETrue;
       
  1887 	CleanPrevView();
  1858     }
  1888     }
  1859 
  1889 
  1860 // ----------------------------------------------------------------------------
  1890 // ----------------------------------------------------------------------------
  1861 // Add shuffle list item to the top of the list.
  1891 // Add shuffle list item to the top of the list.
  1862 // ----------------------------------------------------------------------------
  1892 // ----------------------------------------------------------------------------
  2112                     }
  2142                     }
  2113                 default:
  2143                 default:
  2114                     break;
  2144                     break;
  2115                 }
  2145                 }
  2116             }
  2146             }
       
  2147         // Start animation now as next view activated is
       
  2148         // now playing view. We will end animation in now playing view.
       
  2149         SetupTransitionType(KMPXInterviewTransition);
       
  2150         BeginFullScreenAnimation();
  2117         }
  2151         }
  2118     }
  2152     }
  2119 
  2153 
  2120 // ---------------------------------------------------------------------------
  2154 // ---------------------------------------------------------------------------
  2121 // From MHgSelectionObserver
  2155 // From MHgSelectionObserver
  2170     // ganes list components still uses this version of the HandleOpen
  2204     // ganes list components still uses this version of the HandleOpen
  2171     if ( iContext == EContextItemAlbum  )
  2205     if ( iContext == EContextItemAlbum  )
  2172 		{
  2206 		{
  2173         SaveSelectedAlbumItemL(iSelectedAlbumIndex);
  2207         SaveSelectedAlbumItemL(iSelectedAlbumIndex);
  2174 		UpdatePathAndOpenL(index);
  2208 		UpdatePathAndOpenL(index);
       
  2209         // Start animation now as next view activated is
       
  2210         // now playing view. We will end animation in now playing view.
       
  2211         SetupTransitionType(KMPXInterviewTransition);
       
  2212         BeginFullScreenAnimation();
  2175 		}
  2213 		}
  2176     else if ( iContext == EContextGroupAlbum )
  2214     else if ( iContext == EContextGroupAlbum )
  2177         {
  2215         {
  2178         SaveSelectedAlbumItemL(index);
  2216         SaveSelectedAlbumItemL(index);
  2179         iAlbumIndex = index;
  2217         iAlbumIndex = index;
  2190         if (!ShufflePlayAllL(index))
  2228         if (!ShufflePlayAllL(index))
  2191             {
  2229             {
  2192             // To open the selected album.
  2230             // To open the selected album.
  2193             iView->ProcessCommandL( EMPXCmdCommonEnterKey );
  2231             iView->ProcessCommandL( EMPXCmdCommonEnterKey );
  2194             }
  2232             }
       
  2233         // Start animation now as next view activated is
       
  2234         // now playing view. We will end animation in now playing view.
       
  2235         SetupTransitionType(KMPXInterviewTransition);
       
  2236         BeginFullScreenAnimation();
  2195         }
  2237         }
  2196     else
  2238     else
  2197 		{
  2239 		{
  2198 		iView->ProcessCommandL( EMPXCmdCommonEnterKey );
  2240 		iView->ProcessCommandL( EMPXCmdCommonEnterKey );
  2199 		}
  2241 		}
  2236 			// If item in list was opened, we only play the selected one.
  2278 			// If item in list was opened, we only play the selected one.
  2237             SaveSelectedAlbumItemL(iSelectedAlbumIndex);
  2279             SaveSelectedAlbumItemL(iSelectedAlbumIndex);
  2238            // Open the selected song of album
  2280            // Open the selected song of album
  2239             UpdatePathAndOpenL(index);
  2281             UpdatePathAndOpenL(index);
  2240             }
  2282             }
       
  2283         // Start animation now as next view activated is
       
  2284         // now playing view. We will end animation in now playing view.
       
  2285         SetupTransitionType(KMPXInterviewTransition);
       
  2286         BeginFullScreenAnimation();
  2241         }
  2287         }
  2242     else if ( iContext == EContextGroupAlbum  )
  2288     else if ( iContext == EContextGroupAlbum  )
  2243         {
  2289         {
  2244         if ( aControl == iMediaWall )
  2290         if ( aControl == iMediaWall )
  2245             {
  2291             {
  2246 			// Check if shuffle play all was selected.
  2292 			// Check if shuffle play all was selected.
  2247 			if (!ShufflePlayAllL(index))
  2293 			if (!ShufflePlayAllL(index))
  2248 				{
  2294 				{
  2249 	            OpenAlbumL(index);
  2295 	            OpenAlbumL(index);
       
  2296 				}
       
  2297 			else
       
  2298 				{
       
  2299 				// Start animation now as next view activated is
       
  2300 				// now playing view. We will end animation in now playing view.
       
  2301 				SetupTransitionType(KMPXInterviewTransition);
       
  2302 				BeginFullScreenAnimation();
  2250 				}
  2303 				}
  2251             }
  2304             }
  2252         }
  2305         }
  2253     else
  2306     else
  2254         {
  2307         {
  2654 				break;
  2707 				break;
  2655 				}
  2708 				}
  2656 			}
  2709 			}
  2657         if ( canRefresh )
  2710         if ( canRefresh )
  2658             {
  2711             {
       
  2712 			if( !iDefaultIconSet )
       
  2713 				{
       
  2714 				SetDefaultIconL();
       
  2715 				iDefaultIconSet = ETrue;
       
  2716 				}
  2659             if( iCurrentViewType == EMPXViewTBone || iCurrentViewType == EMPXViewMediawall )
  2717             if( iCurrentViewType == EMPXViewTBone || iCurrentViewType == EMPXViewMediawall )
  2660                 {
  2718                 {
  2661                 if( iTranstionType != EMPXTranstionNotDefined )
  2719                 if( iTranstionType != EMPXTranstionNotDefined )
  2662                     {
  2720                     {
  2663                     // This will tricker the transtition animation
  2721                     // This will trigger the transtition animation
  2664                     EndFullScreenAnimation();
  2722                     EndFullScreenAnimation();
  2665                     iMediaWall->DrawNow();
  2723                     iMediaWall->DrawNow();
  2666                     }
  2724                     }
  2667                 else
  2725                 else
  2668                     {
  2726                     {
  2671                 }
  2729                 }
  2672             else
  2730             else
  2673                 {
  2731                 {
  2674                 if( iTranstionType != EMPXTranstionNotDefined )
  2732                 if( iTranstionType != EMPXTranstionNotDefined )
  2675                     {
  2733                     {
  2676                     // This will tricker the transtition animation
  2734                     // This will trigger the transtition animation
  2677                     // Use DrawNow since RefreshScreen uses DrawDeferred and we want to start
  2735                     // Use DrawNow since RefreshScreen uses DrawDeferred and we want to start
  2678                     // the animation immediately.
  2736                     // the animation immediately.
  2679                     EndFullScreenAnimation();
  2737                     EndFullScreenAnimation();
  2680                     listWidget->DrawNow();
  2738                     listWidget->DrawNow();
  2681                     }
  2739                     }
  2779 			}
  2837 			}
  2780 		case EContextGroupAlbum:
  2838 		case EContextGroupAlbum:
  2781 		case EContextItemAlbum:
  2839 		case EContextItemAlbum:
  2782             {
  2840             {
  2783             defaultIcon = EMPXDefaultIconAlbum;
  2841             defaultIcon = EMPXDefaultIconAlbum;
  2784             iconIndex = EMPXClvIconAlbum;
  2842             iconIndex = 27; // default album art in mediawall and list view
  2785 			break;
  2843 			break;
  2786 			}
  2844 			}
  2787 		case EContextGroupPodcast:
  2845 		case EContextGroupPodcast:
  2788 		case EContextItemPodcast:
  2846 		case EContextItemPodcast:
  2789 			{
  2847 			{
  4485             KMPXMediaArrayContents ) ) );
  4543             KMPXMediaArrayContents ) ) );
  4486     User::LeaveIfNull( songArray );
  4544     User::LeaveIfNull( songArray );
  4487     TInt songCount = songArray->Count();
  4545     TInt songCount = songArray->Count();
  4488 
  4546 
  4489     CDesC16ArrayFlat* songList = new (ELeave) CDesC16ArrayFlat(songCount);
  4547     CDesC16ArrayFlat* songList = new (ELeave) CDesC16ArrayFlat(songCount);
  4490     CleanupStack::PushL(songList); 
  4548     CleanupStack::PushL(songList);
  4491     
  4549 
  4492     if ( songCount > 1 )
  4550     if ( songCount > 1 )
  4493         {
  4551         {
  4494         HBufC* shuffleText = StringLoader::LoadLC(
  4552         HBufC* shuffleText = StringLoader::LoadLC(
  4495             R_MPX_MEDIAWALL_DIALOG_SHUFFLE );
  4553             R_MPX_MEDIAWALL_DIALOG_SHUFFLE );
  4496         // Make room for 3 more formatting characters.
  4554         // Make room for 3 more formatting characters.
  4555         TInt index = listBox->CurrentItemIndex();
  4613         TInt index = listBox->CurrentItemIndex();
  4556         // If item in list was opened, we only play the selected one.
  4614         // If item in list was opened, we only play the selected one.
  4557         SaveSelectedAlbumItemL(iSelectedAlbumIndex);
  4615         SaveSelectedAlbumItemL(iSelectedAlbumIndex);
  4558         // Open the selected song of album
  4616         // Open the selected song of album
  4559         UpdatePathAndOpenL(index);
  4617         UpdatePathAndOpenL(index);
       
  4618         // Start animation now as next view activated is
       
  4619         // now playing view. We will end animation in now playing view.
       
  4620         SetupTransitionType(KMPXInterviewTransition);
       
  4621         BeginFullScreenAnimation();
  4560         }
  4622         }
  4561     else if( !iLayoutSwitch && iMediaWall )
  4623     else if( !iLayoutSwitch && iMediaWall )
  4562         {
  4624         {
  4563         // Close mediawall "flip animation"
  4625         // Close mediawall "flip animation"
  4564         iMediaWall->StartOpeningAnimationL( EFalse );
  4626         iMediaWall->StartOpeningAnimationL( EFalse );
  4795     }
  4857     }
  4796 
  4858 
  4797 void CMPXCollectionViewHgContainer::HandleGainingForeground()
  4859 void CMPXCollectionViewHgContainer::HandleGainingForeground()
  4798     {
  4860     {
  4799     iIsForeground = ETrue;
  4861     iIsForeground = ETrue;
       
  4862     if ( iCurrentViewType == EMPXViewMediawall )
       
  4863         {
       
  4864         if( iCbaHandler )
       
  4865             iCbaHandler->ChangeCbaVisibility( EFalse );
       
  4866         }
  4800     }
  4867     }
  4801 
  4868 
  4802 void CMPXCollectionViewHgContainer::HandleLosingForeground()
  4869 void CMPXCollectionViewHgContainer::HandleLosingForeground()
  4803     {
  4870     {
  4804     iIsForeground = EFalse;
  4871     iIsForeground = EFalse;
  4867 	// MediaWall sets the default icon in the construction phase.
  4934 	// MediaWall sets the default icon in the construction phase.
  4868 	iDefaultIconSet = EFalse;
  4935 	iDefaultIconSet = EFalse;
  4869 
  4936 
  4870     if( !iLayoutSwitch  )
  4937     if( !iLayoutSwitch  )
  4871         {
  4938         {
       
  4939 		SetupTransitionType(KMPXIntraviewTransition);
  4872         BeginFullScreenAnimation();
  4940         BeginFullScreenAnimation();
  4873         }
  4941         }
  4874 
  4942 
  4875 	RestoreSelectedAlbumItemL(mediaArray);
  4943 	RestoreSelectedAlbumItemL(mediaArray);
  4876 	PrepareMediaWallWithListL( mediaArray, mediaCount );
  4944 	PrepareMediaWallWithListL( mediaArray, mediaCount );
  4877 
  4945 
  4878     DrawableWindow()->SetOrdinalPosition( -1 );
  4946     DrawableWindow()->SetOrdinalPosition( -1 );
  4879 
  4947 
  4880     CleanPrevView();
       
  4881 
       
  4882     iPrevViewType = iCurrentViewType;
  4948     iPrevViewType = iCurrentViewType;
  4883 
  4949 
  4884     if( !iDefaultIconSet )
       
  4885         {
       
  4886         SetDefaultIconL();
       
  4887         }
       
  4888     // We need to adjust the CBA for this view.
  4950     // We need to adjust the CBA for this view.
  4889 	if( iCbaHandler )
  4951 	if( iCbaHandler )
  4890 		iCbaHandler->UpdateCba();
  4952 		iCbaHandler->UpdateCba();
  4891 
  4953 
  4892 	iLayoutSwitch = EFalse;
  4954 	iLayoutSwitch = EFalse;
  5010 
  5072 
  5011 // ---------------------------------------------------------------------------
  5073 // ---------------------------------------------------------------------------
  5012 // Prepare and begin fullscreen animation effects
  5074 // Prepare and begin fullscreen animation effects
  5013 // ---------------------------------------------------------------------------
  5075 // ---------------------------------------------------------------------------
  5014 //
  5076 //
  5015 void CMPXCollectionViewHgContainer::BeginFullScreenAnimation(TBool aPrevViewWasPlayback)
  5077 void CMPXCollectionViewHgContainer::BeginFullScreenAnimation()
  5016     {
  5078     {
  5017     if( iTranstionType != EMPXTranstionNotDefined )
  5079     if( iTranstionType == EMPXTranstionNotDefined )
  5018         return;
  5080         return;
  5019 
       
  5020     iTranstionType = EMPXTranstionToLeft;
       
  5021 
       
  5022     if ( (iPrevContext == EContextUnknown ||
       
  5023           iPrevContext == EContextItemAlbum ) && aPrevViewWasPlayback )
       
  5024         {
       
  5025         iTranstionType = EMPXTranstionToLeft;
       
  5026         }
       
  5027     else if( iPrevContext == EContextUnknown )
       
  5028         {
       
  5029         // We aren't coming from playback view and prev context is unknown.
       
  5030         // Musicplayer is propably started so we shouldn't use any animation.
       
  5031         iTranstionType = EMPXTranstionNotDefined;
       
  5032         return;
       
  5033         }
       
  5034     else if( iContext == EContextItemAlbum ||
       
  5035              iContext == EContextItemGenre ||
       
  5036              iContext == EContextItemPlaylist )
       
  5037         {
       
  5038         iTranstionType = EMPXTranstionToRight;
       
  5039         }
       
  5040 
       
  5041     if( iPrevViewType == EMPXViewMediawall || iPrevViewType == EMPXViewTBone )
       
  5042         {
       
  5043         iMediaWall->SetFlags( CHgVgMediaWall::EHgVgMediaWallDrawToWindowGC );
       
  5044         iMediaWall->DrawNow();
       
  5045 		// workaround for NGA animations: includes Media Wall into transition animation.
       
  5046 		iCoeEnv->WsSession().Finish();
       
  5047 		User::After(1000);
       
  5048         }
       
  5049 
  5081 
  5050     const TInt flags = AknTransEffect::TParameter::EActivateExplicitCancel;
  5082     const TInt flags = AknTransEffect::TParameter::EActivateExplicitCancel;
  5051     TRect appRect = ((CAknAppUi*)iCoeEnv->AppUi())->ApplicationRect();
  5083     TRect appRect = ((CAknAppUi*)iCoeEnv->AppUi())->ApplicationRect();
  5052     GfxTransEffect::BeginFullScreen( iTranstionType, appRect,
  5084     GfxTransEffect::BeginFullScreen( iTranstionType, appRect,
  5053             AknTransEffect::EParameterType,
  5085             AknTransEffect::EParameterType,
  5068         //iThumbnailManager->Pause(TTimeIntervalMicroSeconds32(KThumbLoadingPauseForTransition));
  5100         //iThumbnailManager->Pause(TTimeIntervalMicroSeconds32(KThumbLoadingPauseForTransition));
  5069         }
  5101         }
  5070     }
  5102     }
  5071 
  5103 
  5072 // ---------------------------------------------------------------------------
  5104 // ---------------------------------------------------------------------------
       
  5105 // Setup transition types for animation.
       
  5106 // ---------------------------------------------------------------------------
       
  5107 //
       
  5108 void CMPXCollectionViewHgContainer::SetupTransitionType( TInt aType, TBool aPrevViewWasPlayback )
       
  5109     {
       
  5110 	if ( aType == KMPXIntraviewTransition )
       
  5111 		{
       
  5112 		iTranstionType = EMPXTranstionToLeft;
       
  5113 
       
  5114 		if( iPrevContext == EContextUnknown )
       
  5115 			{
       
  5116 			// We aren't coming from playback view and prev context is unknown.
       
  5117 			// Musicplayer is propably started so we shouldn't use any animation.
       
  5118 			iTranstionType = EMPXTranstionNotDefined;
       
  5119 			return;
       
  5120 			}
       
  5121 		else if( iContext == EContextItemAlbum ||
       
  5122 				 iContext == EContextItemGenre ||
       
  5123 				 iContext == EContextItemPlaylist )
       
  5124 			{
       
  5125 			iTranstionType = EMPXTranstionToRight;
       
  5126 			}
       
  5127 
       
  5128 		if( iPrevViewType == EMPXViewMediawall || iPrevViewType == EMPXViewTBone )
       
  5129 			{
       
  5130 			iMediaWall->SetFlags( CHgVgMediaWall::EHgVgMediaWallDrawToWindowGC );
       
  5131 			iMediaWall->DrawNow();
       
  5132 			}
       
  5133 		}
       
  5134 	else // interview transition
       
  5135 		{
       
  5136 
       
  5137 		iTranstionType = EMPXTranstionToRight;
       
  5138 		if ( (iPrevContext == EContextUnknown ||
       
  5139 			  iPrevContext == EContextItemAlbum ) && aPrevViewWasPlayback )
       
  5140 			{
       
  5141 			iTranstionType = EMPXTranstionToLeft;
       
  5142 			}
       
  5143 		}
       
  5144     }
       
  5145 
       
  5146 // ---------------------------------------------------------------------------
  5073 // Resolving the size of the popup list rectangle.
  5147 // Resolving the size of the popup list rectangle.
  5074 // ---------------------------------------------------------------------------
  5148 // ---------------------------------------------------------------------------
  5075 //
  5149 //
  5076 void CMPXCollectionViewHgContainer::ResolvePopupListSizeL()
  5150 void CMPXCollectionViewHgContainer::ResolvePopupListSizeL()
  5077     {
  5151     {