コード例 #1
0
  @Override
  public void onActivityResult(int requestCode, int resultCode, Intent data) {
    super.onActivityResult(requestCode, resultCode, data);

    if (resultCode == Activity.RESULT_OK) {
      if (lookUri == null) {
        lookUri = UtilCamera.getDefaultLookFromCameraUri(getString(R.string.default_look_name));
      }

      switch (requestCode) {
        case REQUEST_CREATE_POCKET_PAINT_IMAGE:
          lookUri =
              Uri.parse(data.getExtras().getString(Constants.EXTRA_PICTURE_PATH_POCKET_PAINT));
          break;
        case REQUEST_SELECT_IMAGE:
          lookUri = decodeUri(data.getData());
          newObjectName = new File(lookUri.toString()).getName();
          break;
        case REQUEST_TAKE_PICTURE:
          lookUri =
              UtilCamera.rotatePictureIfNecessary(lookUri, getString(R.string.default_look_name));
          break;
        default:
          return;
      }

      NewSpriteDialog dialog =
          new NewSpriteDialog(
              DialogWizardStep.STEP_2, lookUri, newObjectName, requestedAction, spinnerAdapter);
      dialog.show(getActivity().getSupportFragmentManager(), NewSpriteDialog.DIALOG_FRAGMENT_TAG);
      dismiss();
    }
  }
コード例 #2
0
ファイル: LookFragment.java プロジェクト: vidak92/Catroid
  @Override
  public void onActivityResult(int requestCode, int resultCode, Intent data) {
    super.onActivityResult(requestCode, resultCode, data);

    if (resultCode == Activity.RESULT_OK) {
      switch (requestCode) {
        case REQUEST_SELECT_IMAGE:
          if (data != null) {
            loadImageIntoCatroid(data);
          }
          break;
        case REQUEST_POCKET_PAINT_EDIT_IMAGE:
          if (data != null) {
            loadPocketPaintImageIntoCatroid(data);
          }
          break;
        case REQUEST_TAKE_PICTURE:
          String defLookName = getString(R.string.default_look_name);
          lookFromCameraUri = UtilCamera.rotatePictureIfNecessary(lookFromCameraUri, defLookName);
          loadPictureFromCameraIntoCatroid();
          break;
      }

      isResultHandled = true;
    }
  }