diff options
author | Christian S <kriztan@users.noreply.github.com> | 2015-11-08 08:59:29 +0100 |
---|---|---|
committer | Christian S <kriztan@users.noreply.github.com> | 2015-11-08 08:59:29 +0100 |
commit | 2fb08c58f30681d2ac840c0d00e939e6025f7042 (patch) | |
tree | a2de4afe82a69549c1433c81de85af14798cbc58 /src | |
parent | f03da70ec8edc1ef5879b2ca2dd18625888473cc (diff) | |
parent | 392c53af586ac73c12b3f75f7b8f9ad888f7035d (diff) |
Merge pull request #50 from philipflohr/master
don't use the imagepicker provided by android-crop
Diffstat (limited to 'src')
-rw-r--r-- | src/main/java/eu/siacs/conversations/ui/PublishProfilePictureActivity.java | 16 |
1 files changed, 12 insertions, 4 deletions
diff --git a/src/main/java/eu/siacs/conversations/ui/PublishProfilePictureActivity.java b/src/main/java/eu/siacs/conversations/ui/PublishProfilePictureActivity.java index 2448d9005..e56a9279d 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")); |