1

I want to open image editor with not limited crop tool at the one point and i want to open image editor with the square crop item only at the another point at the one application.

I can set crop tool items for a whole application but not for a call.

Update 1:

I want to use all tools for both editor calls, but i want to limit the list of crop values for the one call and do not limit for another. I can limit the crop items by override the com_adobe_image_editor_crop_labels / com_adobe_image_editor_crop_values resources arrays, but this limitiation applys for both calls.

So, i want to use this limitation for the one editor call:

<string-array name="com_adobe_image_editor_crop_labels">
    <item>@string/feather_original</item>
    <item>@string/feather_square</item>
    <item>@string/feather_custom</item>
    <item>3:2</item>
    <item>4:3</item>
    <item>5:3</item>
    <item>5:4</item>
    <item>6:4</item>
    <item>6:5</item>
    <item>7:5</item>
    <item>14:11</item>
    <item>16:9</item>
    <item>16:10</item>
    <item>2.35:1</item>
</string-array>
<string-array name="com_adobe_image_editor_crop_values">
    <item>-1:-1</item>
    <item>1:1</item>
    <item>0:0</item>
    <item>3:2</item>
    <item>4:3</item>
    <item>5:3</item>
    <item>5:4</item>
    <item>6:4</item>
    <item>6:5</item>
    <item>7:5</item>
    <item>14:11</item>
    <item>16:9</item>
    <item>16:10</item>
    <item>235:100</item>
</string-array>

And this values for another editor call:

<string-array name="com_adobe_image_editor_crop_labels">
    <item>@string/feather_square</item>
</string-array>
<string-array name="com_adobe_image_editor_crop_values">
    <item>1:1</item>
</string-array>

Can i do this?

Alexey Rogovoy
  • 691
  • 6
  • 13

1 Answers1

0

One way you might go about this is to set up some logic in your code.

In the code below, in onCreate(), I set up:

  • a CheckBox
  • a Button
  • an OnClickListener for the button

In my launchImageEditor() helper method, I have logic to determine if the checkbox is checked, then I set up the Image Editor accordingly.

@Override
protected void onCreate(Bundle savedInstanceState) {
    // ...

    mCheckBox = (CheckBox) findViewById(R.id.checkBox);
    mImageEditorButton = (Button) findViewById(R.id.imageEditorButton);

    View.OnClickListener imageEditorButtonListener = new View.OnClickListener() {
        @Override
        public void onClick(View view) {
            launchImageEditor();
        }
    };
    mImageEditorButton.setOnClickListener(imageEditorButtonListener);

}

private void launchImageEditor() {
    /* 1) Make a new Uri object (Replace this with a real image on your device) */
    Uri imageUri = Uri.parse("content://media/external/images/media/1248");

    /* 2) Create a new Intent */
    Intent imageEditorIntent;

    if (mCheckBox.isChecked()) {
        ToolLoaderFactory.Tools[] toolList = {ToolLoaderFactory.Tools.CROP};

        imageEditorIntent = new AdobeImageIntent.Builder(this)
                .setData(imageUri)
                .withToolList(toolList)
                .build();
    }
    else {
        imageEditorIntent = new AdobeImageIntent.Builder(this)
                .setData(imageUri)
                .build();
    }

    /* 3) Start the Image Editor with request code 1 */
    startActivityForResult(imageEditorIntent, 1);
}

If you want to handle the Activity results differently depending on which version of the Image Editor was launched, you could move startActivityForResult() into the if/else statements, passing in a different int for each request code.

Ash Ryan Arnwine
  • 1,471
  • 1
  • 11
  • 27
  • The Image Editor doesn't provide an API for passing in tool values, and unfortunately, I don't think it is possible to alter the contents of the `res` folder at runtime. – Ash Ryan Arnwine Jul 21 '16 at 14:47