/** Called when the activity is first created. */
  @Override
  protected void onCreate(Bundle load) {
    super.onCreate(load);
    mUnits =
        new UnitsI18n(
            this,
            new UnitsI18n.UnitsChangeListener() {
              public void onUnitsChange() {
                drawTrackingStatistics();
              }
            });
    setContentView(R.layout.statistics);

    mViewFlipper = (ViewFlipper) findViewById(R.id.flipper);
    mViewFlipper.setDrawingCacheEnabled(true);
    mSlideLeftIn = AnimationUtils.loadAnimation(this, R.anim.slide_left_in);
    mSlideLeftOut = AnimationUtils.loadAnimation(this, R.anim.slide_left_out);
    mSlideRightIn = AnimationUtils.loadAnimation(this, R.anim.slide_right_in);
    mSlideRightOut = AnimationUtils.loadAnimation(this, R.anim.slide_right_out);

    mGraphTimeSpeed = (GraphCanvas) mViewFlipper.getChildAt(0);
    mGraphDistanceSpeed = (GraphCanvas) mViewFlipper.getChildAt(1);
    mGraphTimeAltitude = (GraphCanvas) mViewFlipper.getChildAt(2);
    mGraphDistanceAltitude = (GraphCanvas) mViewFlipper.getChildAt(3);

    mGraphTimeSpeed.setType(GraphCanvas.TIMESPEEDGRAPH);
    mGraphDistanceSpeed.setType(GraphCanvas.DISTANCESPEEDGRAPH);
    mGraphTimeAltitude.setType(GraphCanvas.TIMEALTITUDEGRAPH);
    mGraphDistanceAltitude.setType(GraphCanvas.DISTANCEALTITUDEGRAPH);

    mGestureDetector = new GestureDetector(new MyGestureDetector());

    maxSpeedView = (TextView) findViewById(R.id.stat_maximumspeed);
    mAscensionView = (TextView) findViewById(R.id.stat_ascension);
    mElapsedTimeView = (TextView) findViewById(R.id.stat_elapsedtime);
    overallavgSpeedView = (TextView) findViewById(R.id.stat_overallaveragespeed);
    avgSpeedView = (TextView) findViewById(R.id.stat_averagespeed);
    distanceView = (TextView) findViewById(R.id.stat_distance);
    starttimeView = (TextView) findViewById(R.id.stat_starttime);
    endtimeView = (TextView) findViewById(R.id.stat_endtime);
    waypointsView = (TextView) findViewById(R.id.stat_waypoints);

    if (load != null && load.containsKey(TRACKURI)) {
      mTrackUri = Uri.withAppendedPath(Tracks.CONTENT_URI, load.getString(TRACKURI));
    } else {
      mTrackUri = this.getIntent().getData();
    }
  }
  void showIssues() {
    if (flipper.getCurrentView() != flipper.getChildAt(1)) {
      flipper.setInAnimation(getContext(), R.anim.slide_in_right);
      flipper.setOutAnimation(getContext(), R.anim.slide_out_left);
      flipper.showPrevious();
    }

    disambigHeading.setTypeface(null, Typeface.NORMAL);
    disambigHeading.setEnabled(true);
    issuesHeading.setTypeface(null, Typeface.BOLD);
    issuesHeading.setEnabled(false);
  }
	private void initImageFactory() {
		switch (mIndex) {
		case 0:
			if (mImageFactoryCrop == null) {
				mImageFactoryCrop = new ImageFactoryCrop(this,
						mVfFlipper.getChildAt(0));
			}
			mImageFactoryCrop.init(mPath, mScreenWidth, mScreenHeight);			
			mBtnLeft.setText("CANCEL");
			mBtnRight.setText("OK");

			break;

		case 1:
			if (mImageFactoryFliter == null) {
				mImageFactoryFliter = new ImageFactoryFliter(this,
						mVfFlipper.getChildAt(1));
			}
			mImageFactoryFliter.init(mNewPath);			
			mBtnLeft.setText("CANCEL");
			mBtnRight.setText("FINISH");
			break;
		}
	}	
 protected void onDestroy() {
   logger.v("onCreate() ---> Enter");
   this.mController.removeSystemEventListener(22, this);
   int i;
   if (this.mViewFlipper != null) {
     this.mViewFlipper.destroyDrawingCache();
     i = 0;
     while (true) {
       i++;
       if (this.deleteType == 1) {
         ColumnListView localColumnListView = (ColumnListView) this.mViewFlipper.getChildAt(i);
         if (localColumnListView != null) {
           localColumnListView.releaseResource();
           localColumnListView.destroyDrawingCache();
         }
       }
       if (i >= this.mViewFlipper.getChildCount()) {
         this.mViewFlipper.removeAllViews();
         logger.v("onCreate() ---> Exit");
         super.onDestroy();
         return;
       } else {
         if (deleteType == 0) {
           SongListView songlistview = (SongListView) mViewFlipper.getChildAt(i);
           if (songlistview != null) {
             songlistview.releaseResource();
             songlistview.destroyDrawingCache();
           }
         }
       }
     }
   } else {
     this.mViewFlipper = null;
     this.mViewInterface = null;
     this.mTitleBar = null;
     super.onDestroy();
     logger.v("onCreate() ---> Exit");
     return;
   }
 }