Пример #1
0
  /** @param params */
  public void initParams(GpsParams params, StorageService service) {
    /*
     * Comes from storage service. This will do nothing for fresh start,
     * but it will load previous combo on re-activation
     */
    mService = service;

    mMovement = mService.getMovement();
    mImageDataSource = mService.getDBResource();
    if (null == mMovement) {
      mMovement = new Movement();
    }
    mPan = mService.getPan();
    if (null == mPan) {
      mPan = new Pan();
      mService.setPan(mPan);
    }
    if (null != params) {
      mGpsParams = params;
    } else if (null != mService.getDestination()) {
      mGpsParams = new GpsParams(mService.getDestination().getLocation());
    } else {
      mGpsParams = new GpsParams(null);
    }
    loadTiles();
    postInvalidate();

    // Tell the CDI the paint that we use for display tfr
    mService.getCDI().setSize(mPaint, Math.min(getWidth(), getHeight()));
    mService.getVNAV().setSize(mPaint, Math.min(getWidth(), getHeight()));

    // Tell the odometer how to access preferences
    mService.getOdometer().setPref(mPref);

    mService.getEdgeTape().setPaint(mPaint);

    // Resize our runway icon based upon the size of the display.
    // We want the icon no more than 1/3 the size of the screen. Since we show 2 images
    // of this icon, that means the total size is no more than 2/3 of the available space.
    // This leaves room to print the runway numbers with some real estate left over.
    Bitmap newRunway =
        Helper.getResizedBitmap(mRunwayBitmap.getBitmap(), getWidth(), getHeight(), (double) 1 / 3);

    // If a new bitmap was generated, then load it in.
    if (newRunway != mRunwayBitmap.getBitmap()) {
      mRunwayBitmap = new BitmapHolder(newRunway);
    }
  }