public LevelImportMode(ModeController modeController, GameResources gameResources, Intent intent)
      throws IOException {
    super(modeController, gameResources);

    camera.center.set(0, 0, 0);
    camera.eye.set(0, 15, -15f);

    if ("content".equals(intent.getScheme())) {
      InputStream attachment = context.getContentResolver().openInputStream(intent.getData());
      level = Level.loadFromFile(attachment, gameResources);
      attachment.close();
    } else {
      File importFile = new File(intent.getDataString());
      levelFileName = importFile.getName();
      if (!levelFileName.endsWith(".bclevel")) levelFileName = ".bclevel";

      InputStream attachment = context.getContentResolver().openInputStream(intent.getData());
      level = Level.loadFromFile(attachment, gameResources);
      attachment.close();
    }

    if (level != null) {
      state = new GameState(level);
    }
  }
  @Override
  public void onModeCreate(GL10 gl, int displayWidth, int displayHeight) {
    super.onModeCreate(gl, displayWidth, displayHeight);

    final int paddingX = (int) context.getResources().getDimension(R.dimen.buttonPaddingX);
    final int paddingY = (int) context.getResources().getDimension(R.dimen.buttonPaddingY);

    final int levelNameWidth = displayWidth * 2 / 3;
    final int levelNameHeight = 64;
    final int levelNameX = (displayWidth - levelNameWidth) / 2;
    final int levelNameY = displayHeight - paddingY;

    final int startButtonWidth = 210;
    final int startButtonHeight = 64;
    final int startButtonX = (displayWidth - startButtonWidth - paddingX);
    final int startButtonY = paddingY + startButtonHeight;

    String name = "Unknown";
    if (level != null && level.getName() != null) name = level.getName();

    levelName =
        new UIElementText(
            gameResources,
            context,
            gl,
            -1,
            name,
            levelNameX,
            levelNameY,
            levelNameWidth,
            levelNameHeight,
            BUTTON_TEXT_SIZE);
    importButton =
        new UIElementText(
            gameResources,
            context,
            gl,
            IMPORT_BUTTON,
            "Import Level",
            startButtonX,
            startButtonY,
            startButtonWidth,
            startButtonHeight,
            BUTTON_TEXT_SIZE);

    uiElements.add(levelName);
    uiElements.add(importButton);
  }