@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();
    }
  }
Beispiel #2
0
  @Override
  public void onActivityCreated(Bundle savedInstanceState) {
    super.onActivityCreated(savedInstanceState);

    listView = getListView();
    registerForContextMenu(listView);

    if (savedInstanceState != null) {
      selectedLookData =
          (LookData) savedInstanceState.getSerializable(BUNDLE_ARGUMENTS_SELECTED_LOOK);

      boolean uriIsSet = savedInstanceState.getBoolean(BUNDLE_ARGUMENTS_URI_IS_SET);
      if (uriIsSet) {
        String defLookName = getString(R.string.default_look_name);
        lookFromCameraUri = UtilCamera.getDefaultLookFromCameraUri(defLookName);
      }
    }
    lookDataList = ProjectManager.INSTANCE.getCurrentSprite().getLookDataList();

    adapter =
        new LookAdapter(getActivity(), R.layout.fragment_look_looklist_item, lookDataList, false);
    adapter.setOnLookEditListener(this);
    setListAdapter(adapter);

    Utils.loadProjectIfNeeded(getActivity());
  }
Beispiel #3
0
  public void selectImageFromCamera() {
    lookFromCameraUri =
        UtilCamera.getDefaultLookFromCameraUri(getString(R.string.default_look_name));

    Intent intent = new Intent(MediaStore.ACTION_IMAGE_CAPTURE);
    intent.putExtra(MediaStore.EXTRA_OUTPUT, lookFromCameraUri);

    Intent chooser = Intent.createChooser(intent, getString(R.string.select_look_from_camera));
    startActivityForResult(chooser, REQUEST_TAKE_PICTURE);
  }