2016-07-20 4 views
1

私はワンポイントで限定された作物ツールでイメージエディタを開きたいと思っています。私は、1つのアプリケーションの別のポイントでのみ四角いクロップアイテムでイメージエディタを開きたいと思います。さまざまなAdobe Creative SDKイメージエディタコールで異なるクロップツール項目を設定する方法はありますか?

私はアプリケーション全体に対してクロップツール項目を設定できますが、呼び出しはできません。

アップデート1:

私は両方のエディタの呼び出しのためのすべてのツールを使用したいが、私は1回の通話のためのクロップ値のリストを制限したい場合、別のために限定するものではありません。 com_adobe_image_editor_crop_labels/com_adobe_image_editor_crop_valuesリソース配列を上書きしてクロップ項目を制限できますが、この制限は両方の呼び出しに適用されます。

だから、私は1つのエディタの呼び出しのために、この制限を使用する:別のエディタ呼び出しの

<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> 

そして、この値:

<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> 

私はこれを行うことができますか?

答えて

0

これについては、コードにロジックを設定することもできます。以下のコードで

は、onCreate()で、私が設定:私のlaunchImageEditor()ヘルパーメソッドで

  • CheckBox
  • Button
  • ボタンのOnClickListener

を、Iチェックボックスがオンになっているかどうかを判断するロジックがある場合は、それに応じてイメージエディタを設定します。あなたは違ったイメージエディタのバージョンが発売されたかに応じて活動の結果を処理したい場合は

@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); 
} 

、あなたはそれぞれのリクエストコードに対して異なるintを渡し、if/else文にstartActivityForResult()を移動することができます。

+0

答えをいただきありがとうございます。私の更新をご覧ください。 –

+0

Image Editorはツール値を渡すためのAPIを提供していません。残念ながら、実行時に 'res'フォルダの内容を変更することはできないと思います。 –

関連する問題