aboutsummaryrefslogtreecommitdiffstats
path: root/src/main/java
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--src/main/java/de/thedevstack/conversationsplus/ui/listeners/ResizePictureUserDecisionListener.java2
-rw-r--r--src/main/java/eu/siacs/conversations/services/XmppConnectionService.java2
-rw-r--r--src/main/java/eu/siacs/conversations/ui/ShareWithActivity.java36
-rw-r--r--src/main/java/eu/siacs/conversations/ui/XmppActivity.java8
-rw-r--r--src/main/java/eu/siacs/conversations/utils/FileUtils.java2
5 files changed, 29 insertions, 21 deletions
diff --git a/src/main/java/de/thedevstack/conversationsplus/ui/listeners/ResizePictureUserDecisionListener.java b/src/main/java/de/thedevstack/conversationsplus/ui/listeners/ResizePictureUserDecisionListener.java
index 992776e5..03401e3c 100644
--- a/src/main/java/de/thedevstack/conversationsplus/ui/listeners/ResizePictureUserDecisionListener.java
+++ b/src/main/java/de/thedevstack/conversationsplus/ui/listeners/ResizePictureUserDecisionListener.java
@@ -15,7 +15,6 @@ import de.thedevstack.conversationsplus.ConversationsPlusApplication;
import de.thedevstack.conversationsplus.ConversationsPlusPreferences;
import de.thedevstack.conversationsplus.enums.UserDecision;
import de.thedevstack.conversationsplus.exceptions.UiException;
-import de.thedevstack.conversationsplus.utils.FileUtils;
import de.thedevstack.conversationsplus.utils.ImageUtil;
import de.thedevstack.conversationsplus.utils.MessageUtil;
import de.thedevstack.conversationsplus.utils.StreamUtil;
@@ -28,6 +27,7 @@ import eu.siacs.conversations.persistance.FileBackend;
import eu.siacs.conversations.services.XmppConnectionService;
import eu.siacs.conversations.ui.UiCallback;
import eu.siacs.conversations.ui.XmppActivity;
+import eu.siacs.conversations.utils.FileUtils;
/**
* Created by tzur on 31.10.2015.
diff --git a/src/main/java/eu/siacs/conversations/services/XmppConnectionService.java b/src/main/java/eu/siacs/conversations/services/XmppConnectionService.java
index f39460b3..ad2c0b99 100644
--- a/src/main/java/eu/siacs/conversations/services/XmppConnectionService.java
+++ b/src/main/java/eu/siacs/conversations/services/XmppConnectionService.java
@@ -62,7 +62,6 @@ import de.thedevstack.android.logcat.Logging;
import de.thedevstack.conversationsplus.ConversationsPlusApplication;
import de.thedevstack.conversationsplus.ConversationsPlusPreferences;
import de.thedevstack.conversationsplus.exceptions.FileCopyException;
-import de.thedevstack.conversationsplus.utils.FileUtils;
import de.thedevstack.conversationsplus.utils.ImageUtil;
import de.thedevstack.conversationsplus.utils.MessageUtil;
import de.thedevstack.conversationsplus.utils.UiUpdateHelper;
@@ -98,6 +97,7 @@ import eu.siacs.conversations.persistance.FileBackend;
import eu.siacs.conversations.ui.UiCallback;
import eu.siacs.conversations.utils.CryptoHelper;
import eu.siacs.conversations.utils.ExceptionHelper;
+import eu.siacs.conversations.utils.FileUtils;
import eu.siacs.conversations.utils.OnPhoneContactsLoadedListener;
import eu.siacs.conversations.utils.PRNGFixes;
import eu.siacs.conversations.utils.PhoneHelper;
diff --git a/src/main/java/eu/siacs/conversations/ui/ShareWithActivity.java b/src/main/java/eu/siacs/conversations/ui/ShareWithActivity.java
index 80e52ec2..cc2806f9 100644
--- a/src/main/java/eu/siacs/conversations/ui/ShareWithActivity.java
+++ b/src/main/java/eu/siacs/conversations/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();
}
}
diff --git a/src/main/java/eu/siacs/conversations/ui/XmppActivity.java b/src/main/java/eu/siacs/conversations/ui/XmppActivity.java
index a01abb5b..8923ef31 100644
--- a/src/main/java/eu/siacs/conversations/ui/XmppActivity.java
+++ b/src/main/java/eu/siacs/conversations/ui/XmppActivity.java
@@ -744,7 +744,7 @@ public abstract class XmppActivity extends Activity {
case UNTRUSTED:
case TRUSTED:
case TRUSTED_X509:
- trustToggle.setChecked(trust.trusted(), false);
+ trustToggle.setChecked(trust.trusted());
trustToggle.setEnabled(trust != XmppAxolotlSession.Trust.TRUSTED_X509);
if (trust == XmppAxolotlSession.Trust.TRUSTED_X509) {
trustToggle.setOnClickListener(null);
@@ -753,7 +753,7 @@ public abstract class XmppActivity extends Activity {
keyType.setTextColor(getSecondaryTextColor());
break;
case UNDECIDED:
- trustToggle.setChecked(false, false);
+ trustToggle.setChecked(false);
trustToggle.setEnabled(false);
key.setTextColor(getPrimaryTextColor());
keyType.setTextColor(getSecondaryTextColor());
@@ -761,7 +761,7 @@ public abstract class XmppActivity extends Activity {
case INACTIVE_UNTRUSTED:
case INACTIVE_UNDECIDED:
trustToggle.setOnClickListener(null);
- trustToggle.setChecked(false, false);
+ trustToggle.setChecked(false);
trustToggle.setEnabled(false);
key.setTextColor(getTertiaryTextColor());
keyType.setTextColor(getTertiaryTextColor());
@@ -769,7 +769,7 @@ public abstract class XmppActivity extends Activity {
case INACTIVE_TRUSTED:
case INACTIVE_TRUSTED_X509:
trustToggle.setOnClickListener(null);
- trustToggle.setChecked(true, false);
+ trustToggle.setChecked(true);
trustToggle.setEnabled(false);
key.setTextColor(getTertiaryTextColor());
keyType.setTextColor(getTertiaryTextColor());
diff --git a/src/main/java/eu/siacs/conversations/utils/FileUtils.java b/src/main/java/eu/siacs/conversations/utils/FileUtils.java
index 0edaf9a9..7783bcc9 100644
--- a/src/main/java/eu/siacs/conversations/utils/FileUtils.java
+++ b/src/main/java/eu/siacs/conversations/utils/FileUtils.java
@@ -11,6 +11,8 @@ import android.os.Environment;
import android.provider.DocumentsContract;
import android.provider.MediaStore;
+import java.io.File;
+
import de.thedevstack.conversationsplus.ConversationsPlusApplication;
public final class FileUtils {