aboutsummaryrefslogtreecommitdiffstats
path: root/src/main/java/de/thedevstack/conversationsplus/ui/ShareWithActivity.java
diff options
context:
space:
mode:
Diffstat (limited to 'src/main/java/de/thedevstack/conversationsplus/ui/ShareWithActivity.java')
-rw-r--r--src/main/java/de/thedevstack/conversationsplus/ui/ShareWithActivity.java36
1 files changed, 21 insertions, 15 deletions
diff --git a/src/main/java/de/thedevstack/conversationsplus/ui/ShareWithActivity.java b/src/main/java/de/thedevstack/conversationsplus/ui/ShareWithActivity.java
index 8293937c..e6049c08 100644
--- a/src/main/java/de/thedevstack/conversationsplus/ui/ShareWithActivity.java
+++ b/src/main/java/de/thedevstack/conversationsplus/ui/ShareWithActivity.java
@@ -274,26 +274,31 @@ public class ShareWithActivity extends XmppActivity implements XmppConnectionSer
return;
}
if (share.uris.size() != 0) {
- OnPresenceSelected callback = new OnPresenceSelected() {
- @Override
- public void onPresenceSelected() {
- attachmentCounter.set(share.uris.size());
- if (share.image) {
- share.multiple = share.uris.size() > 1;
- replaceToast(getString(share.multiple ? R.string.preparing_images : R.string.preparing_image));
- for (Iterator<Uri> i = share.uris.iterator(); i.hasNext(); i.remove()) {
- ShareWithActivity.this.xmppConnectionService
- .attachImageToConversation(conversation, i.next(),
- attachFileCallback);
- }
- } else {
+ OnPresenceSelected callback;
+ if (this.share.image) {
+ // TODO: attachementCounter should be set and decremented correctly
+ callback = new OnPresenceSelected() {
+ @Override
+ public void onPresenceSelected() {
+ ResizePictureUserDecisionListener userDecisionListener = new ShareWithResizePictureUserDecisionListener(ShareWithActivity.this, conversation, xmppConnectionService, share.uris);
+ UserDecisionDialog userDecisionDialog = new UserDecisionDialog(ShareWithActivity.this, R.string.userdecision_question_resize_picture, userDecisionListener);
+ userDecisionDialog.decide(ConversationsPlusPreferences.resizePicture());
+ }
+ };
+ } else {
+ attachmentCounter.set(share.uris.size());
+ callback = new OnPresenceSelected() {
+ @Override
+ public void onPresenceSelected() {
replaceToast(getString(R.string.preparing_file));
ShareWithActivity.this.xmppConnectionService
.attachFileToConversation(conversation, share.uris.get(0),
attachFileCallback);
+ switchToConversation(conversation, null, true);
+ finish();
}
- }
- };
+ };
+ }
if (conversation.getAccount().httpUploadAvailable()) {
callback.onPresenceSelected();
} else {
@@ -301,6 +306,7 @@ public class ShareWithActivity extends XmppActivity implements XmppConnectionSer
}
} else {
switchToConversation(conversation, this.share.text, true);
+ finish();
}
}