while switching between views the background is shown for sometime

Login to reply to this topic.
Fri, 2005-09-02 14:31
Joined: 2005-08-24
Forum posts: 41
Hi
My application have two views. I have followed the "Bookstoredb" example to create views. I am showing views deleting the current view and creating the new view by a function ChangeView as in Bookstoredb

But the problem is that while shifting between views the background is shown for sometime.
Please help me solving that.
thanx

Tue, 2005-09-06 13:21
Joined: 2005-08-24
Forum posts: 41
Re: while switching between views the background is shown for so
My appui is as follows

#include <avkon.hrh>
#include <aknnotewrappers.h>
#include <aknnavi.h>
#include <akntitle.h>
#include <aknnavide.h>
#include <akntabgrp.h>
#include <barsread.h>
#include <eikmenup.h>
#include <coeaui.h>
#include <e32std.h>
#include <hlplch.h>
#include <coemain.h>
//User Included Header Files
#include "CallReport.pan"
#include "CallReportAppUi.h"
#include "CallReportAppView.h"
#include "CallReportListBox.h"
#include "CallReport.hrh"
#include "playeradapter.h"
#include "CActiveClass.h"
#include "recorderadapter.h"
#include "CallReportPersonaliseView.h"
#include "Help.hlp.hrh"
#include <Callreport.rsg>
#include "CallReportApplication.h"

//Wav file for Playing at the Intial

_LIT(KSoundSampleFile, "C:\\System\\Apps\\CallReport\\play.wav");



// ConstructL is called by the application framework
void CCallReportAppUi::ConstructL()
{
   // load the menu, etc. configuration from the resources
    BaseConstructL();

    cba = CEikButtonGroupContainer::Current();
      //cba->DrawDeferred();

   iCurrentView=ENone;//Set Current view to none
   ChangeView(EListBoxView);//show the view listbox i.e. first screen

   //For Active Class
    iActive=CActiveClass::NewL();
}

CCallReportAppUi::CCallReportAppUi():iAppView(NULL),iListView(NULL)                             
{
   // no implementation required
}

CCallReportAppUi::~CCallReportAppUi()
{
   // DeleteTabGroup();
   
    if ( iNaviPane )
    {
       if ( iNaviPane->Top() == iDecoratedTabGroup )
       {
          iNaviPane->Pop( iDecoratedTabGroup );
          delete iDecoratedTabGroup;
       }
    }
    //Delete AppView
    if (iAppView)
    {
       if(iCurrentView==EMainView)
       {
          RemoveFromStack(iAppView);
          iEikonEnv->RemoveFromStack(iAppView);
          delete iAppView;
          iAppView = NULL;
       }
    }
    //Delete ListBoxView
    if(iListView)
    {
       if(iCurrentView==EListBoxView)
       {
          RemoveFromStack(iListView);
             iEikonEnv->RemoveFromStack(iListView);
          delete iListView;
          iListView = NULL;
       }
    }
    //Delete Personalise View
    if(iPersonaliseView)
    {
       if(iCurrentView==EPersonaliseView)
       {
          RemoveFromStack(iPersonaliseView);
             iEikonEnv->RemoveFromStack(iPersonaliseView);
          delete iPersonaliseView;
          iPersonaliseView = NULL;
       }
    }

//For Active Class

//   if (iActive)
//    {
//       
//        delete iActive;
//        iActive= NULL;
//    }

}


void CCallReportAppUi::HandleForegroundEventL(TBool aForeground)
{
   if(aForeground)
   {
      iActive->iActvateOrDeactvateNotifier=-1;
   }
}

// handle any menu commands. This function is called if the user selects an
// option from the menu of the softkeys defined in the resources file
void CCallReportAppUi::HandleCommandL(TInt aCommand)
{
    switch(aCommand)
    {
       
        case EAknSoftkeyExit:
        case EEikCmdExit:
        {
            CAknQueryDialog* dlg=CAknQueryDialog::NewL();
            TBool yesno=dlg->ExecuteLD(R_CALLREPORT_CONFIRMATION_QUERY);
            if(yesno)
            {
               iActive->Cancel();
               Exit();
            }
        }
        break;
           
       case EAknSoftkeyBack:
       {
          DeleteTabGroup();
          ChangeView(EListBoxView);
       }
       break;
     
        case ECallReportSelect:
        {
              TInt CurrentItemInListBox; 
              CurrentItemInListBox=iListView->GetSelectedItemL();
              switch (CurrentItemInListBox)
              {
                 case 0://To Activate or Deactivate the application
                {
                   //Wheather SMS or VoiceMail
                      // iActive->iSmsOrVoice= iActive->ECallReportSms;
                     
                    //variable for ActvateOrDeactvate
                   
                    _LIT(KActivatedMsg,"Activated");
                    //_LIT(KDeActivatedMsg,"DeActivated");
                   
                    //Change Activate to Deactivate and vice versa
                    iActive->iActvateOrDeactvateNotifier = 1;//(iActive->iActvateOrDeactvateNotifier)*(-1);
                     
                    if(iActive->iActvateOrDeactvateNotifier==1)
                    {
                       //iListView->RemoveAndAddItemL(CCallReportListBox::EDeActivate);
                       iEikonEnv->AlertWin(KActivatedMsg);
                     
                         // To Bring To Back Groud 
                   
                       // Construct en empty TApaTask object
                      // giving it a reference to the Window Server session
                         TApaTask task(iEikonEnv->WsSession( ));
               
                       // Initialise the object with the window group id of
                       // our application (so that it represent our app)
                          task.SetWgId(CEikonEnv::Static()->RootWin().Identifier());

                       // Request window server to bring our application
                       // to Background
                          task.SendToBackground();         
                     
                     }
                    /*else //if ( iActive->iActvateOrDeactvateNotifier==1)
                    {
                       iListView->RemoveAndAddItemL(CCallReportListBox::EActivate);
                       iEikonEnv->AlertWin(KDeActivatedMsg);
                      }*/
                }
                break;
               
               case 1://For Personalise
               {
                  ChangeView(EPersonaliseView);
                   //  add the control to the control stack - it will recieve key press events
                    AddToStackL(iPersonaliseView);
               }
               break;
              
               case 2: //For Schedule
               {
                  
                    _LIT(KScheduleMsg,"This Option is Not Available in Demo Version");
                     CAknInformationNote *iInformationNote =new(ELeave) CAknInformationNote();
                     iInformationNote->ExecuteLD(KScheduleMsg);
              }
              break;
             
                case 3:  //For Always BG
               {
                
                   _LIT(KAlwaysBGMsg,"This Option is Not Available in Demo Version");
                    CAknInformationNote *iInformationNote1 =new(ELeave) CAknInformationNote();
                     iInformationNote1->ExecuteLD(KAlwaysBGMsg);
                 }
              break;
               
             case 4://For Help
             {
                  CArrayFix<TCoeHelpContext>* buf = CCoeAppUi::AppHelpContextL();
                  HlpLauncher::LaunchHelpApplicationL(iEikonEnv->WsSession(), buf);
             }
              break;
             
                  default:
                 break;
             }
         }
        break;
       
       case ECallReportHelp://Help on the selected Item
       {
            CArrayFix<TCoeHelpContext>* buf = CCoeAppUi::AppHelpContextL();
            HlpLauncher::LaunchHelpApplicationL(iEikonEnv->WsSession(), buf);
       }
        break;

        case ECallReportSetSms://Set Sms for the group or others
       {
          iPersonaliseView->SetForGroup(1);
      }
      break;
      
       case ECallReportSetVoice://Set voice call for the group or others
       {
           iPersonaliseView->SetForGroup(4);
      }
      break;
      
      case ECallReportSetClr:
       {
          iPersonaliseView->SetForGroup(100);//Clear Sms/Voice for the group or others
       }
      break;
      
       /*case ECallReportBack://Back to the ListBox view
       {
          DeleteTabGroup();
          ChangeView(EListBoxView);
       }
       break;*/
       
       case ECallReportTab2Select://Select the items in the settings tab
       {
         TInt CurrentItemInListBox; 
         CurrentItemInListBox=iPersonaliseView->GetSelectedItemL();
         switch(CurrentItemInListBox)
         {
            case 0://Contacts of the phone
            {
               // Application Uid
               const TUid KPBkUid = { 0x101f4cce };
               // View Uid of the external application - contacts view
               const TUid KPbkGroupViewUid = { 1 };
               ActivateViewL(TVwsViewId(KPBkUid, KPbkGroupViewUid));
               
            }
            break;
            
            case 1://Play the recorded file
            {
               iActive->iRecorderAdapter->PlayL();
            }
            break;
            
                case 2://To Record a voice
                {
                   _LIT(KRecord,"This Option is Not Available in Demo Version");
                    CAknInformationNote *iInformationNote1 =new(ELeave) CAknInformationNote();
                     iInformationNote1->ExecuteLD(KRecord);
                }
                break;

            default:
               break;
         }
       }
       break;

        default:
            Panic(ECallReportBasicUi);
            break;
    }
}

void CCallReportAppUi::ChangeView(TViewId aNewView)//Delete Current view and show another
{
   if(aNewView==iCurrentView)
   {
      return;
   }
   
   switch(iCurrentView)//Delete the Current view
   {
        case EMainView:
        {
            RemoveFromStack(iAppView);
            delete iAppView;
            iAppView = NULL;
        }
        break;

        case EListBoxView:
        {
            RemoveFromStack(iListView);
            delete iListView;
            iListView = NULL;
        }
        break;
           
        case EPersonaliseView:
        {
            RemoveFromStack(iPersonaliseView);
            delete iPersonaliseView;
            iPersonaliseView = NULL;
        }
        break;
           
        case ENone:
        default:
            break;
   }
   
   switch(aNewView)//Show the new view
   {
      case EMainView:
        {
            iAppView = CCallReportAppView::NewL(ClientRect());
            AddToStackL(iAppView);
        }
        break;

        case EListBoxView:
        {
            iListView = CCallReportListBox::NewL(ClientRect(),*this);
            AddToStackL(iListView);
            //iListView->SetMopParent(this);
            if(iCurrentView==EPersonaliseView)
            {
               cba->SetCommandSetL(R_AVKON_SOFTKEYS_OPTIONS_EXIT);
               cba->DrawNow();
               /*if(iActive->iActvateOrDeactvateNotifier==1)
               {
                  iListView->RemoveAndAddItemL(CCallReportListBox::EDeActivate);
               }*/
            }
        }
        break;
          case EPersonaliseView:
        {
            cba->SetCommandSetL(R_AVKON_SOFTKEYS_OPTIONS_BACK);
            cba->DrawNow();
            iPersonaliseView = CCallReportPersonaliseView::NewL(ClientRect(),*this);
            AddToStackL(iPersonaliseView);
            //iPersonaliseView->SetMopParent(this);
        }
        break;
       
        case ENone:
        default:
            break;
   }
   iCurrentView=aNewView;//Set Current view to the new view
}

void CCallReportAppUi::SetNavigationPaneL()
{
    if ( !iNaviPane )
    {
       iNaviPane = STATIC_CAST(
        CAknNavigationControlContainer*,
        StatusPane()->ControlL( TUid::Uid( EEikStatusPaneUidNavi ) ) );
    }   
   TInt resourceId(0);
   resourceId = R_CALLREPORT_MULTISELECTION_TAB;
   if ( resourceId )
    {
       if ( !iDecoratedTabGroup ) // Isn't tab group created?
        {
            //SetTitlePaneL( outlineId );

            TResourceReader reader;
            iCoeEnv->CreateResourceReaderLC( reader, resourceId );
            iDecoratedTabGroup = iNaviPane->CreateTabGroupL( reader );
            CleanupStack::PopAndDestroy();  // resource reader

            iTabGroup = STATIC_CAST( CAknTabGroup*,
                                     iDecoratedTabGroup->DecoratedControl() );

            iNaviPane->PushL( *iDecoratedTabGroup );
        }
    }
}

// ----------------------------------------------------------------------------
// CCallReportAppUi::DeleteTabGroup()
// Deletes tab group.
// ----------------------------------------------------------------------------
//
void CCallReportAppUi::DeleteTabGroup()
{
   if ( iNaviPane )
   {
      if ( iDecoratedTabGroup )
      {
         iNaviPane->Pop( iDecoratedTabGroup );
         delete iDecoratedTabGroup;
         iDecoratedTabGroup = NULL;
         iTabGroup = NULL;
      }
   }
}

//Dynamaically changes the Menu
   
void CCallReportAppUi::DynInitMenuPaneL(TInt aResourceId,CEikMenuPane* aMenuPane)
{
   if(aResourceId==R_CALLREPORT_MENU)
   {
      aMenuPane->SetItemDimmed(ECallReportSelect,ETrue);
      aMenuPane->SetItemDimmed(ECallReportSet,ETrue);
      aMenuPane->SetItemDimmed(ECallReportHelp,ETrue);
      aMenuPane->SetItemDimmed(EAknSoftkeyExit,ETrue);
      aMenuPane->SetItemDimmed(ECallReportTab2Select,ETrue);
      switch(iCurrentView)
      {
         case EMainView:
            break;
            
         case EListBoxView://For main view Select and Help
         {
            aMenuPane->SetItemDimmed(ECallReportSelect,EFalse);
            aMenuPane->SetItemDimmed(ECallReportHelp,EFalse);
            aMenuPane->SetItemDimmed(EAknSoftkeyExit,EFalse);
         }
         break;
         
         case EPersonaliseView:
         {
            if(iTabGroup->TabIdFromIndex( iTabGroup->ActiveTabIndex())
                   ==ECallReportTab2)
            {
               aMenuPane->SetItemDimmed(ECallReportSet,EFalse);
               aMenuPane->SetItemDimmed(ECallReportHelp,EFalse);
               aMenuPane->SetItemDimmed(EAknSoftkeyExit,EFalse);
            }
            else
            {
               aMenuPane->SetItemDimmed(ECallReportTab2Select,EFalse);
               aMenuPane->SetItemDimmed(ECallReportHelp,EFalse);
               aMenuPane->SetItemDimmed(EAknSoftkeyExit,EFalse);
            }
         }
         break;
         
         case ENone:
         default:
            break;
      }
   }
}


I have two views
the first one is first called in the constructor which contains only  a listbox,
setting the focus to the second item of the listbox pressing options->select(menu command) the second view appears which has two tabs with a listbox on each tab.

the problem is that in between the transition of the views the background is shown for sometime

any suggestions how to solve it.

thanx in advance


Sat, 2007-12-29 08:21
Joined: 2007-07-24
Forum posts: 55
while switching between views the background is shown

Hi friend,
while switching view from 1st to 2nd ,in this case u don't try remove 1st view from control stack.after ceation of 2nd view u should delete 1st view .so that the flickering won't come any more.i have solved it like this.
Regards
mitu

Wed, 2008-01-02 12:00
Joined: 2007-10-16
Forum posts: 65
Re: while switching between views the background

Hai Satyajit,
What is that background color?Is that the background color of FirstView.I also worked with views.Pls once go thru
[url=http://http://www.newlc.com/Enable-Skin-support-in-your.html] , may solve ur problem.

Wed, 2008-01-02 12:43
Joined: 2007-10-16
Forum posts: 65
Re: while switching between views the background

Hai Satyajit,
Is your Application having two containers and two containerviews?Then ,in Second Container just comment the code under HandleResourceChange.This may help u.

In Container2.cpp

void CContainer2::HandleResourceChange( TInt aType )
{
//CCoeControl::HandleResourceChange( aType );
//SetRect( iAvkonViewAppUi->View( TUid::Uid( ESecureDBContainer4ViewId ) )->ClientRect() );
// [[[ begin generated region: do not modify [Generated Contents]
// ]]] end generated region [Generated Contents]
}

Tue, 2008-01-08 10:58
Joined: 2005-08-24
Forum posts: 41
Re: while switching between views the background is shown for so

Hi Shilpa,
Thanks for ur reply.
No, I have only two container classes, no containerview class.

thanks
Satyajit

  • Login to reply to this topic.