From 392c53af586ac73c12b3f75f7b8f9ad888f7035d Mon Sep 17 00:00:00 2001 From: Philip Flohr Date: Sat, 7 Nov 2015 22:30:32 +0100 Subject: don't use the imagepicker provided by android-crop --- .../conversations/ui/PublishProfilePictureActivity.java | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) (limited to 'src/main/java/eu/siacs') diff --git a/src/main/java/eu/siacs/conversations/ui/PublishProfilePictureActivity.java b/src/main/java/eu/siacs/conversations/ui/PublishProfilePictureActivity.java index afcbeb7c7..e48e6a1cb 100644 --- a/src/main/java/eu/siacs/conversations/ui/PublishProfilePictureActivity.java +++ b/src/main/java/eu/siacs/conversations/ui/PublishProfilePictureActivity.java @@ -140,7 +140,12 @@ public class PublishProfilePictureActivity extends XmppActivity { @Override public void onClick(View v) { - Crop.pickImage(PublishProfilePictureActivity.this); + Intent attachFileIntent = new Intent(); + attachFileIntent.setType("image/*"); + attachFileIntent.setAction(Intent.ACTION_GET_CONTENT); + Intent chooser = Intent.createChooser(attachFileIntent, + getString(R.string.attach_file)); + startActivityForResult(chooser, REQUEST_CHOOSE_FILE); } }); this.defaultUri = PhoneHelper.getSefliUri(getApplicationContext()); @@ -150,9 +155,12 @@ public class PublishProfilePictureActivity extends XmppActivity { protected void onActivityResult(int requestCode, int resultCode, final Intent data) { super.onActivityResult(requestCode, resultCode, data); - if (resultCode == RESULT_OK && requestCode == Crop.REQUEST_PICK) { - Uri destination = Uri.fromFile(new File(getCacheDir(), "croppedAvatar")); - Crop.of(data.getData(), destination).withMaxSize(Config.AVATAR_SIZE, Config.AVATAR_SIZE).asSquare().start(PublishProfilePictureActivity.this); + if (resultCode == RESULT_OK) { + if (requestCode == REQUEST_CHOOSE_FILE) { + this.avatarUri = data.getData(); + Uri destination = Uri.fromFile(new File(getCacheDir(), "croppedAvatar")); + Crop.of(this.avatarUri, destination).withMaxSize(Config.AVATAR_SIZE, Config.AVATAR_SIZE).asSquare().start(PublishProfilePictureActivity.this); + } } if (requestCode == Crop.REQUEST_CROP) { this.avatarUri = Uri.fromFile(new File(getCacheDir(), "croppedAvatar")); -- cgit v1.2.3