private void switchViews(boolean trackBallSelection){
  Event selectedEvent=mSelectedEvent;
  mPopup.dismiss();
  mLastPopupEventID=INVALID_EVENT_ID;
  if (mNumDays > 1) {
    if (trackBallSelection) {
      if (selectedEvent == null) {
        long startMillis=getSelectedTimeInMillis();
        long endMillis=startMillis + DateUtils.HOUR_IN_MILLIS;
        long extraLong=0;
        if (mSelectionAllday) {
          extraLong=CalendarController.EXTRA_CREATE_ALL_DAY;
        }
        mController.sendEventRelatedEventWithExtra(this,EventType.CREATE_EVENT,-1,startMillis,endMillis,-1,-1,extraLong,-1);
      }
 else {
        if (mIsAccessibilityEnabled) {
          mAccessibilityMgr.interrupt();
        }
        mController.sendEventRelatedEvent(this,EventType.VIEW_EVENT,selectedEvent.id,selectedEvent.startMillis,selectedEvent.endMillis,0,0,getSelectedTimeInMillis());
      }
    }
 else {
      if (mSelectedEvents.size() == 1) {
        if (mIsAccessibilityEnabled) {
          mAccessibilityMgr.interrupt();
        }
        mController.sendEventRelatedEvent(this,EventType.VIEW_EVENT,selectedEvent.id,selectedEvent.startMillis,selectedEvent.endMillis,0,0,getSelectedTimeInMillis());
      }
    }
  }
 else {
    if (selectedEvent == null) {
      long startMillis=getSelectedTimeInMillis();
      long endMillis=startMillis + DateUtils.HOUR_IN_MILLIS;
      long extraLong=0;
      if (mSelectionAllday) {
        extraLong=CalendarController.EXTRA_CREATE_ALL_DAY;
      }
      mController.sendEventRelatedEventWithExtra(this,EventType.CREATE_EVENT,-1,startMillis,endMillis,-1,-1,extraLong,-1);
    }
 else {
      if (mIsAccessibilityEnabled) {
        mAccessibilityMgr.interrupt();
      }
      mController.sendEventRelatedEvent(this,EventType.VIEW_EVENT,selectedEvent.id,selectedEvent.startMillis,selectedEvent.endMillis,0,0,getSelectedTimeInMillis());
    }
  }
}

private void switchViews ( boolean trackBallSelection ) { Event selectedEvent = mSelectedEvent ; mPopup . dismiss ( ) ; mLastPopupEventID = INVALID_EVENT_ID ; if ( mNumDays > 1 ) { if ( trackBallSelection ) { if ( selectedEvent == null ) { long startMillis = getSelectedTimeInMillis ( ) ; long endMillis = startMillis + DateUtils . HOUR_IN_MILLIS ; long extraLong = 0 ; if ( mSelectionAllday ) { extraLong = CalendarController . EXTRA_CREATE_ALL_DAY ; } mController . sendEventRelatedEventWithExtra ( this , EventType . CREATE_EVENT , - 1 , startMillis , endMillis , - 1 , - 1 , extraLong , - 1 ) ; } else { if ( mIsAccessibilityEnabled ) { mAccessibilityMgr . interrupt ( ) ; } mController . sendEventRelatedEvent ( this , EventType . VIEW_EVENT , selectedEvent . id , selectedEvent . startMillis , selectedEvent . endMillis , 0 , 0 , getSelectedTimeInMillis ( ) ) ; } } else { if ( mSelectedEvents . size ( ) == 1 ) { if ( mIsAccessibilityEnabled ) { mAccessibilityMgr . interrupt ( ) ; } mController . sendEventRelatedEvent ( this , EventType . VIEW_EVENT , selectedEvent . id , selectedEvent . startMillis , selectedEvent . endMillis , 0 , 0 , getSelectedTimeInMillis ( ) ) ; } } } else { if ( selectedEvent == null ) { long startMillis = getSelectedTimeInMillis ( ) ; long endMillis = startMillis + DateUtils . HOUR_IN_MILLIS ; long extraLong = 0 ; if ( mSelectionAllday ) { extraLong = CalendarController . EXTRA_CREATE_ALL_DAY ; } mController . sendEventRelatedEventWithExtra ( this , EventType . CREATE_EVENT , - 1 , startMillis , endMillis , - 1 , - 1 , extraLong , - 1 ) ; } else { if ( mIsAccessibilityEnabled ) { mAccessibilityMgr . interrupt ( ) ; } mController . sendEventRelatedEvent ( this , EventType . VIEW_EVENT , selectedEvent . id , selectedEvent . startMillis , selectedEvent . endMillis , 0 , 0 , getSelectedTimeInMillis ( ) ) ; } } }
switch to another view based on what was selected ( an event or a free slot ) and how it was selected ( by touch or by trackball ) .
