@Override
  public void onDetachedFromWindow() {
    super.onDetachedFromWindow();

    ImageManager.eventBus.unregister(mEventHandler);
    if (mBackgroundRenderer != null) {
      mBackgroundRenderer.close();
      mBackgroundRenderer = null;
    }
    ShieldManager.eventBus.unregister(mEventHandler);
  }
  /**
   * Draws the actual starfield to the given \c Canvas. This will be called in a background thread,
   * so we can't do anything UI-specific, except drawing to the canvas.
   */
  @Override
  public void onDraw(Canvas canvas) {
    if (isInEditMode()) {
      return;
    }

    if (mStar != null) {
      canvas.drawColor(Color.BLACK);

      if (mBackgroundRenderer == null) {
        mBackgroundRenderer =
            new StarfieldBackgroundRenderer(new long[] {mStar.getKey().hashCode()});
      }
      mBackgroundRenderer.drawBackground(
          canvas, 0, 0, canvas.getWidth() / getPixelScale(), canvas.getHeight() / getPixelScale());

      drawSun(canvas);
      drawPlanets(canvas);
    }

    drawOverlays(canvas);
  }