Send resulting image uri via native calls

This commit is contained in:
Angela Mazzurco 2017-07-11 18:37:01 +02:00
parent 5838b13043
commit 8a59503260
2 changed files with 18 additions and 8 deletions

View File

@ -102,8 +102,8 @@ public class RetroShareQmlActivity extends QtActivity
startActivityForResult( chooserIntent, PICK_PHOTO); startActivityForResult( chooserIntent, PICK_PHOTO);
}; };
public void onActivityResult(int requestCode, int resultCode, Intent data) { public void onActivityResult(int requestCode, int resultCode, Intent data)
{
Log.i("RetroShareQmlActivity", "onActivityResult()" + String.valueOf(requestCode)); Log.i("RetroShareQmlActivity", "onActivityResult()" + String.valueOf(requestCode));
if (resultCode == RESULT_OK) if (resultCode == RESULT_OK)
@ -119,22 +119,32 @@ public class RetroShareQmlActivity extends QtActivity
else else
{ {
final String action = data.getAction(); final String action = data.getAction();
if (action == null) { if (action == null)
{
isCamera = false; isCamera = false;
} else { }
else
{
isCamera = action.equals(android.provider.MediaStore.ACTION_IMAGE_CAPTURE); isCamera = action.equals(android.provider.MediaStore.ACTION_IMAGE_CAPTURE);
} }
} }
Uri selectedImageUri; Uri selectedImageUri;
if (isCamera) { if (isCamera)
{
selectedImageUri = capturedImageURI; selectedImageUri = capturedImageURI;
} else { }
else
{
selectedImageUri = data == null ? null : data.getData(); selectedImageUri = data == null ? null : data.getData();
} }
Log.i("RetroShareQmlActivity", "Image uri found!" + selectedImageUri.toString()); String uri = selectedImageUri.toString();
if (uri != null)
{
Log.i("RetroShareQmlActivity", "Image uri found!" + uri);
NativeCalls.notifyIntentUri(uri);
}
} }
} }
} }