--- a/application/inc/PodcastFeedView.h Sat Oct 30 14:28:25 2010 +0100
+++ b/application/inc/PodcastFeedView.h Sun Oct 31 10:35:57 2010 +0000
@@ -100,7 +100,7 @@
// from MImageHandlerCallback
void ImageOperationCompleteL(TInt aError, TUint aHandle, CPodcastModel& aPodcastModel);
-
+ void SizeChanged();
private:
void FormatFeedInfoListBoxItemL(CFeedInfo& aFeedInfo, TBool aIsUpdating = EFalse);
void HandleAddFeedL();
--- a/application/inc/PodcastListView.h Sat Oct 30 14:28:25 2010 +0100
+++ b/application/inc/PodcastListView.h Sun Oct 31 10:35:57 2010 +0000
@@ -35,9 +35,10 @@
class CEikFormattedCellListBox;
-class MKeyEventListener {
+class MContainerListener {
public:
virtual TKeyResponse OfferKeyEventL(const TKeyEvent& aKeyEvent,TEventCode aType) = 0;
+virtual void SizeChanged() = 0;
};
class MPointerListener {
@@ -56,25 +57,31 @@
CCoeControl* ComponentControl( TInt aIndex ) const;
void HandleResourceChange(TInt aType);
virtual TKeyResponse OfferKeyEventL(const TKeyEvent& aKeyEvent,TEventCode aType);
- void SetKeyEventListener(MKeyEventListener *aKeyEventListener);
+ void SetContainerListener(MContainerListener *aContainerListener);
- CEikFormattedCellListBox* Listbox();
+ CEikColumnListBox* Listbox();
+ void SetListboxIcons(CArrayPtr< CGulIcon >* aIcons);
+ CArrayPtr<CGulIcon>* ListboxIcons();
+ void SetTextArray(CDesCArray* aArray);
void ScrollToVisible();
- void Draw(const TRect& aRect) const;
-
- CEikFormattedCellListBox * iListbox;
-
+ void Draw(const TRect& aRect) const;
+ TBool IsLandscape();
protected:
TTypeUid::Ptr MopSupplyObject( TTypeUid aId );
private:
- MKeyEventListener* iKeyEventListener;
+ MContainerListener* iContainerListener;
CAknsBasicBackgroundControlContext* iBgContext;
+
+ CAknSingleLargeStyleListBox * iListboxLandscape;
+ CAknDoubleLargeStyleListBox * iListboxPortrait;
+ CEikColumnListBox * iListbox;
+ TBool iLandscape;
};
class CPodcastListView : public CAknView, public MAknToolbarObserver,
-public MProgressDialogCallback, public MKeyEventListener
+public MProgressDialogCallback, public MContainerListener
{
public:
~CPodcastListView();
@@ -82,7 +89,8 @@
TBool IsVisible();
protected:
- void ConstructL();
+ void SwitchListbox();
+ void ConstructL();
CPodcastListView();
/**
@@ -136,9 +144,11 @@
// from MProgressDialogCallback
void DialogDismissedL(TInt /*aButtonId*/) {}
- // from MKeyEventListener
+ // from MContainerListener
virtual TKeyResponse OfferKeyEventL(const TKeyEvent& aKeyEvent,TEventCode aType);
-
+ virtual void SizeChanged() = 0;
+ void ResetContainer();
+
protected:
CPodcastListContainer* iListContainer;
/** Previous activated view */
@@ -154,6 +164,8 @@
CAknToolbar *iToolbar;
CAknWaitDialog *iWaitDialog;
+ TBool flipFlop;
+ CArrayPtr< CGulIcon >* iIconArray;
};
#endif // PODCASTBASEVIEWH
--- a/application/inc/PodcastSearchView.h Sat Oct 30 14:28:25 2010 +0100
+++ b/application/inc/PodcastSearchView.h Sun Oct 31 10:35:57 2010 +0000
@@ -79,6 +79,7 @@
*/
void HandleCommandL(TInt aCommand);
+ void SizeChanged();
private:
CPodcastModel& iPodcastModel;
TBool iSearchRunning;
--- a/application/inc/PodcastShowsView.h Sat Oct 30 14:28:25 2010 +0100
+++ b/application/inc/PodcastShowsView.h Sun Oct 31 10:35:57 2010 +0000
@@ -109,6 +109,8 @@
void UpdateViewTitleL();
void GetShowErrorText(TDes &aErrorMessage, TInt aErrorCode);
+ void SizeChanged();
+
protected:
CPodcastModel& iPodcastModel;
--- a/application/src/PodcastFeedView.cpp Sat Oct 30 14:28:25 2010 +0100
+++ b/application/src/PodcastFeedView.cpp Sun Oct 31 10:35:57 2010 +0000
@@ -40,7 +40,9 @@
#define KMaxMessageLength 200
#define KMaxTitleLength 100
-_LIT(KFeedFormat, "%d\t%S\t%S%S");
+_LIT(KFeedFormatPortrait, "%d\t%S\t%S%S");
+//_LIT(KFeedFormatPortrait, "%d\t%S");
+_LIT(KFeedFormatLandscape, "%d\t%S");
enum
{
EFeedIcon
@@ -61,6 +63,50 @@
return self;
}
+void CPodcastFeedView::SizeChanged()
+ {
+ DP("CPodcastFeedView::SizeChanged BEGIN");
+ iListContainer->Listbox()->SetListBoxObserver(this);
+ iFeedIdForIconArray.Reset();
+ iItemArray->Reset();
+
+ DP("before icons");
+ CFbsBitmap* bitmap = NULL;
+ CFbsBitmap* mask = NULL;
+ _LIT(KAsterisk, "*");
+ // Load the bitmap for empty icon
+ TFileName fname;
+ fname.Copy(KAsterisk);
+ TParsePtr parser(fname);
+ iIconArray= new(ELeave) CArrayPtrFlat< CGulIcon >(1);
+ CleanupStack::PushL( iIconArray );
+
+ // Load svg.-image and mask with a single call
+ AknIconUtils::CreateIconL(bitmap,
+ mask,
+ iEikonEnv->EikAppUi()->Application()->BitmapStoreName(),
+ EMbmPodcastFeed,
+ EMbmPodcastFeed_mask);
+
+ /*bitmap = iEikonEnv->CreateBitmapL(KAsterisk,EMbmPodcastFeed_40x40);
+ * */
+ CleanupStack::PushL( bitmap );
+ // Load the mask for feed icon
+ //mask = iEikonEnv->CreateBitmapL(KAsterisk,EMbmPodcastFeed_40x40m );
+ CleanupStack::PushL( mask );
+ // Append the feed icon to icon array
+ iIconArray->AppendL( CGulIcon::NewL( bitmap, mask ) );
+ CleanupStack::Pop(2); // bitmap, mask
+ iListContainer->SetListboxIcons(iIconArray);
+ CleanupStack::Pop(iIconArray); // icons
+
+ UpdateListboxItemsL();
+ iListContainer->SetTextArray(iItemArray);
+ iListContainer->SetListboxIcons(iIconArray);
+ iListContainer->Listbox()->DrawNow();
+ DP("CPodcastFeedView::SizeChanged END");
+ }
+
CPodcastFeedView::CPodcastFeedView(CPodcastModel& aPodcastModel):iPodcastModel(aPodcastModel)
{
iFirstActivateAfterLaunch = ETrue;
@@ -75,37 +121,35 @@
iFeedsFormat = iEikonEnv->AllocReadResourceL(R_PODCAST_FEEDS_STATUS_FORMAT);
CPodcastListView::ConstructL();
iPodcastModel.FeedEngine().AddObserver(this);
- CArrayPtr< CGulIcon >* icons = new(ELeave) CArrayPtrFlat< CGulIcon >(1);
- CleanupStack::PushL( icons );
-
- CFbsBitmap* bitmap = NULL;
- CFbsBitmap* mask = NULL;
- // Load the bitmap for empty icon
- TFileName fname = KAsterisk;
- TParsePtr parser(fname);
+ SetEmptyTextL(R_PODCAST_NO_FEEDS);
+ SizeChanged();
+// CFbsBitmap* bitmap = NULL;
+// CFbsBitmap* mask = NULL;
+// // Load the bitmap for empty icon
+// TFileName fname = KAsterisk;
+// TParsePtr parser(fname);
- SetEmptyTextL(R_PODCAST_NO_FEEDS);
-
- // Load svg.-image and mask with a single call
- AknIconUtils::CreateIconL(bitmap,
- mask,
- iEikonEnv->EikAppUi()->Application()->BitmapStoreName(),
- EMbmPodcastFeed,
- EMbmPodcastFeed_mask);
-
- /*bitmap = iEikonEnv->CreateBitmapL(KAsterisk,EMbmPodcastFeed_40x40);
- * */
- CleanupStack::PushL( bitmap );
- // Load the mask for feed icon
- //mask = iEikonEnv->CreateBitmapL(KAsterisk,EMbmPodcastFeed_40x40m );
- CleanupStack::PushL( mask );
- // Append the feed icon to icon array
- icons->AppendL( CGulIcon::NewL( bitmap, mask ) );
- CleanupStack::Pop(2); // bitmap, mask
- iListContainer->Listbox()->ItemDrawer()->FormattedCellData()->SetIconArrayL( icons );
- CleanupStack::Pop(icons); // icons
-
- iListContainer->Listbox()->SetListBoxObserver(this);
+//
+// // Load svg.-image and mask with a single call
+// AknIconUtils::CreateIconL(bitmap,
+// mask,
+// iEikonEnv->EikAppUi()->Application()->BitmapStoreName(),
+// EMbmPodcastFeed,
+// EMbmPodcastFeed_mask);
+//
+// /*bitmap = iEikonEnv->CreateBitmapL(KAsterisk,EMbmPodcastFeed_40x40);
+// * */
+// CleanupStack::PushL( bitmap );
+// // Load the mask for feed icon
+// //mask = iEikonEnv->CreateBitmapL(KAsterisk,EMbmPodcastFeed_40x40m );
+// CleanupStack::PushL( mask );
+// // Append the feed icon to icon array
+// iIconArray->AppendL( CGulIcon::NewL( bitmap, mask ) );
+// CleanupStack::Pop(2); // bitmap, mask
+// iListContainer->SetListboxIcons(iIconArray);
+// CleanupStack::Pop(iIconArray); // icons
+//
+// iListContainer->Listbox()->SetListBoxObserver(this);
iUpdater = CPodcastFeedViewUpdater::NewL(*this);
DP("CPodcastFeedView::ConstructL END");
@@ -322,6 +366,7 @@
void CPodcastFeedView::FormatFeedInfoListBoxItemL(CFeedInfo& aFeedInfo, TBool aIsUpdating)
{
+ DP("CPodcastFeedView::FormatFeedInfoListBoxItemL");
TBuf<KMaxShortDateFormatSpec*2> updatedDate;
TBuf<KMaxUnplayedFeedsLength> unplayedShows;
TUint unplayedCount = 0;
@@ -371,7 +416,7 @@
updatedDate.Zero();
}
}
- CArrayPtr<CGulIcon>* icons = iListContainer->Listbox()->ItemDrawer()->FormattedCellData()->IconArray();
+
iconIndex = iFeedIdForIconArray.Find(aFeedInfo.Uid());
if(iconIndex == KErrNotFound && aFeedInfo.FeedIcon() != NULL && aFeedInfo.ImageFileName().Length() > 0 &&
aFeedInfo.FeedIcon()->SizeInPixels().iHeight > 0 &&
@@ -382,11 +427,11 @@
CFbsBitmap* bmpCopy = new (ELeave) CFbsBitmap;
CleanupStack::PushL(bmpCopy);
bmpCopy->Duplicate(aFeedInfo.FeedIcon()->Handle());
- icons->AppendL( CGulIcon::NewL(AknIconUtils::CreateIconL(bmpCopy), NULL));
+ iIconArray->AppendL( CGulIcon::NewL(AknIconUtils::CreateIconL(bmpCopy), NULL));
iFeedIdForIconArray.Append(aFeedInfo.Uid());
CleanupStack::Pop(bmpCopy);
- iconIndex = icons->Count()-1;
+ iconIndex = iIconArray->Count()-1;
}
else
{
@@ -396,8 +441,15 @@
if (unplayedShows.Length() > 0 && updatedDate.Length() > 0) {
unplayedShows.Insert(0,_L(", "));
}
-
- iListboxFormatbuffer.Format(KFeedFormat(), iconIndex, &(aFeedInfo.Title()), &updatedDate, &unplayedShows);
+
+ if (iListContainer->IsLandscape())
+ {
+ iListboxFormatbuffer.Format(KFeedFormatLandscape(), iconIndex, &(aFeedInfo.Title()));
+ }
+ else
+ {
+ iListboxFormatbuffer.Format(KFeedFormatPortrait(), iconIndex, &(aFeedInfo.Title()), &updatedDate, &unplayedShows);
+ }
}
void CPodcastFeedView::ImageOperationCompleteL(TInt aError, TUint aHandle, CPodcastModel& /*aPodcastModel*/)
@@ -436,6 +488,7 @@
// No reason to do any work if it isn't going to show..
if(!iListContainer->IsVisible())
{
+ DP("not visible");
return;
}
@@ -463,6 +516,7 @@
{
iItemArray->Delete(iItemArray->Count() - 1);
}
+ //iListContainer->Listbox()->
iUpdater->StartUpdate(nbrItems);
}
else
@@ -514,8 +568,9 @@
break;
case EPodcastUpdateAllFeeds:
{
- iPodcastModel.FeedEngine().UpdateAllFeedsL();
- UpdateToolbar();
+ SwitchListbox();
+ //iPodcastModel.FeedEngine().UpdateAllFeedsL();
+ //UpdateToolbar();
}break;
case EPodcastUpdateFeed:
{
--- a/application/src/PodcastListView.cpp Sat Oct 30 14:28:25 2010 +0100
+++ b/application/src/PodcastListView.cpp Sun Oct 31 10:35:57 2010 +0000
@@ -30,6 +30,8 @@
#include <aknquerydialog.h>
#include <barsread.h>
#include <akntitle.h>
+#include <akniconarray.h>
+#include <EIKCLBD.H>
#include "buildno.h"
@@ -39,46 +41,70 @@
{
}
-void CPodcastListContainer::SetKeyEventListener(MKeyEventListener *aKeyEventListener)
+void CPodcastListContainer::SetContainerListener(MContainerListener *aContainerListener)
{
- iKeyEventListener = aKeyEventListener;
+ iContainerListener = aContainerListener;
}
TKeyResponse CPodcastListContainer::OfferKeyEventL(const TKeyEvent& aKeyEvent,TEventCode aType)
{
TKeyResponse response = iListbox->OfferKeyEventL(aKeyEvent, aType);
- if (iKeyEventListener)
- iKeyEventListener->OfferKeyEventL(aKeyEvent, aType);
+ if (iContainerListener)
+ iContainerListener->OfferKeyEventL(aKeyEvent, aType);
return response;
}
void CPodcastListContainer::ConstructL( const TRect& aRect, TInt aListboxFlags )
{
+ DP("CPodcastListContainer::ConstructL BEGIN");
CreateWindowL();
iBgContext =
CAknsBasicBackgroundControlContext::NewL( KAknsIIDQsnBgAreaMain,
aRect,
ETrue );
-
+
+ if (iListbox)
+ delete iListbox;
+
+ if (aRect.Width() > aRect.Height())
+ {
+ DP("Landscape mode");
+ iLandscape = ETrue;
+ iListboxLandscape = new (ELeave) CAknSingleLargeStyleListBox;
+ iListboxLandscape->ConstructL(this, aListboxFlags);
+ iListboxLandscape->SetMopParent( this );
+ iListboxLandscape->SetContainerWindowL(*this);
+ iListboxLandscape->CreateScrollBarFrameL(ETrue);
+ iListboxLandscape->ScrollBarFrame()->SetScrollBarVisibilityL(CEikScrollBarFrame::EAuto, CEikScrollBarFrame::EAuto );
+ iListboxLandscape->SetSize(aRect.Size());
+ iListboxLandscape->MakeVisible(ETrue);
+ iListbox = iListboxLandscape;
+ }
+ else
+ {
+ DP("Portrait mode");
+ iLandscape = EFalse;
+ iListboxPortrait = new (ELeave) CAknDoubleLargeStyleListBox;
+ iListboxPortrait->ConstructL(this, aListboxFlags);
+ iListboxPortrait->SetMopParent( this );
+ iListboxPortrait->SetContainerWindowL(*this);
+ iListboxPortrait->CreateScrollBarFrameL(ETrue);
+ iListboxPortrait->ScrollBarFrame()->SetScrollBarVisibilityL(CEikScrollBarFrame::EAuto, CEikScrollBarFrame::EAuto );
+ iListboxPortrait->SetSize(aRect.Size());
+ iListboxPortrait->MakeVisible(ETrue);
+ iListbox = (CEikColumnListBox*) iListboxPortrait;
+ }
+
+ MakeVisible(EFalse);
+
// Set the windows size
- SetRect( aRect );
- iListbox =static_cast<CEikFormattedCellListBox*>( new (ELeave) CAknDoubleLargeStyleListBox);
- iListbox->ConstructL(this, aListboxFlags);
- iListbox->SetMopParent( this );
- iListbox->SetContainerWindowL(*this);
- iListbox->CreateScrollBarFrameL(ETrue);
- iListbox->ScrollBarFrame()->SetScrollBarVisibilityL(CEikScrollBarFrame::EAuto, CEikScrollBarFrame::EAuto );
-
- iListbox->ItemDrawer()->FormattedCellData()->EnableMarqueeL( ETrue );
+ SetRect( aRect );
- iListbox->SetSize(aRect.Size());
- iListbox->MakeVisible(ETrue);
- MakeVisible(EFalse);
-
// Activate the window, which makes it ready to be drawn
ActivateL();
+ DP("CPodcastListContainer::ConstructL END");
}
TInt CPodcastListContainer::CountComponentControls() const
@@ -112,27 +138,65 @@
iListbox->ScrollToMakeItemVisible(iListbox->CurrentItemIndex());
}
}
+
+TBool CPodcastListContainer::IsLandscape()
+ {
+ return iLandscape;
+ }
+
void CPodcastListContainer::SizeChanged()
{
- DP2("CPodcastListContainer::SizeChanged(), width=%d, height=%d",Size().iWidth, Size().iHeight);
- if(iListbox != NULL)
- {
- iListbox->SetSize(Size());
- }
+ DP2("CPodcastListContainer::SizeChanged() BEGIN, width=%d, height=%d",Size().iWidth, Size().iHeight);
+
+ if (iListbox == NULL)
+ return;
+
+ iListbox->SetSize(Size());
+
+ if (iContainerListener)
+ iContainerListener->SizeChanged();
+
+ DP("CPodcastListContainer::SizeChanged END");
}
-CEikFormattedCellListBox* CPodcastListContainer::Listbox()
+CEikColumnListBox* CPodcastListContainer::Listbox()
{
return iListbox;
}
+void CPodcastListContainer::SetListboxIcons(CArrayPtr< CGulIcon >* aIcons)
+{
+ if (iListboxLandscape == iListbox)
+ iListboxLandscape->ItemDrawer()->ColumnData()->SetIconArray(aIcons);
+ else
+ iListboxPortrait->ItemDrawer()->FormattedCellData()->SetIconArrayL(aIcons);
+}
+
+CArrayPtr<CGulIcon>* CPodcastListContainer::ListboxIcons()
+ {
+ if (iListboxLandscape == iListbox)
+ return iListboxLandscape->ItemDrawer()->ColumnData()->IconArray();
+ else
+ return iListboxPortrait->ItemDrawer()->FormattedCellData()->IconArray();
+ }
+
+void CPodcastListContainer::SetTextArray(CDesCArray* aArray)
+ {
+ iListbox->Model()->SetOwnershipType(ELbmDoesNotOwnItemArray);
+ iListbox->Model()->SetItemTextArray(aArray);
+ }
+
CPodcastListContainer::~CPodcastListContainer()
{
delete iListbox;
delete iBgContext;
}
+void CPodcastListView::SwitchListbox()
+ {
+ HandleViewRectChange();
+ }
void CPodcastListContainer::Draw(const TRect& aRect) const
{
@@ -160,27 +224,69 @@
void CPodcastListView::ConstructL()
{
DP("CPodcastListView::ConstructL BEGIN");
- iListContainer = new (ELeave) CPodcastListContainer;
- iListContainer->ConstructL(ClientRect(), iListboxFlags);
- iListContainer->SetMopParent(this);
- iListContainer->ActivateL();
- iItemArray = new (ELeave)CDesCArrayFlat(KDefaultGran);
- iListContainer->Listbox()->Model()->SetItemTextArray(iItemArray);
- iListContainer->Listbox()->Model()->SetOwnershipType(ELbmDoesNotOwnItemArray);
+ ResetContainer();
+
if (Toolbar()) {
iToolbar = Toolbar();
iToolbar->SetToolbarObserver(this);
}
- iListContainer->SetKeyEventListener(this);
DP("CPodcastListView::ConstructL END");
}
+void CPodcastListView::ResetContainer()
+ {
+ DP("CPodcastListView::ResetContainer BEGIN");
+
+ if(iListContainer)
+ {
+ AppUi()->RemoveFromStack(iListContainer);
+ delete iListContainer;
+ }
+
+ iListContainer = new (ELeave) CPodcastListContainer;
+ TRect rect = ClientRect();
+
+// flipFlop = !flipFlop;
+//
+// if (!flipFlop)
+// {
+// TUint w = rect.Width();
+// rect.SetWidth(rect.Height());
+// rect.SetHeight(w);
+// }
+
+ iListContainer->ConstructL(rect, iListboxFlags);
+ iListContainer->SetMopParent(this);
+ iListContainer->ActivateL();
+ iItemArray = new (ELeave)CDesCArrayFlat(KDefaultGran);
+ iListContainer->SetTextArray(iItemArray);
+ iListContainer->SetContainerListener(this);
+
+ DP("CPodcastListView::ResetContainer END");
+ }
+
void CPodcastListView::HandleViewRectChange()
-{
- if ( iListContainer )
+{
+ TBool wasVisible = iListContainer->IsVisible();
+
+ if (wasVisible)
+ {
+ AppUi()->ActivateLocalViewL(KUidPodcastSearchViewID, TUid::Uid(0), KNullDesC8);
+
+ DoDeactivate();
+ }
+
+ ResetContainer();
+
+ if (wasVisible)
+ {
+ AppUi()->ActivateLocalViewL(ViewId().iViewUid, TUid::Uid(0), KNullDesC8);
+ }
+
+ if ( iListContainer )
{
iListContainer->SetRect( ClientRect() );
}
@@ -190,11 +296,7 @@
{
DP2("CPodcastListView::HandleStatusPaneSizeChange(), width=%d, height=%d", ClientRect().Width(), ClientRect().Height());
- if ( iListContainer )
- {
- iListContainer->SetRect( ClientRect() );
- }
-
+ HandleViewRectChange();
}
--- a/application/src/PodcastSearchView.cpp Sat Oct 30 14:28:25 2010 +0100
+++ b/application/src/PodcastSearchView.cpp Sun Oct 31 10:35:57 2010 +0000
@@ -84,7 +84,7 @@
icons->AppendL( CGulIcon::NewL( bitmap, mask ) );
CleanupStack::Pop(2); // bitmap, mask
- iListContainer->Listbox()->ItemDrawer()->FormattedCellData()->SetIconArrayL( icons );
+ iListContainer->SetListboxIcons(icons);
CleanupStack::Pop(icons); // icons
iListContainer->Listbox()->SetListBoxObserver(this);
@@ -99,6 +99,11 @@
DP("CPodcastSearchView::~CPodcastSearchView END");
}
+void CPodcastSearchView::SizeChanged()
+ {
+
+ }
+
TUid CPodcastSearchView::Id() const
{
return KUidPodcastSearchViewID;
--- a/application/src/PodcastShowsView.cpp Sat Oct 30 14:28:25 2010 +0100
+++ b/application/src/PodcastShowsView.cpp Sun Oct 31 10:35:57 2010 +0000
@@ -103,6 +103,12 @@
{
}
+void CPodcastShowsView::SizeChanged()
+ {
+
+ }
+
+
void CPodcastShowsView::ConstructL()
{
BaseConstructL(R_PODCAST_SHOWSVIEW);
@@ -140,7 +146,8 @@
pos+=2;
}
- iListContainer->Listbox()->ItemDrawer()->FormattedCellData()->SetIconArrayL(icons);
+ //iListContainer->Listbox()->ItemDrawer()->FormattedCellData()->SetIconArrayL(icons);
+ iListContainer->SetListboxIcons(icons);
CleanupStack::Pop(icons); // icons
}