diff options
Diffstat (limited to 'src/main/java/de/thedevstack/conversationsplus/ui')
4 files changed, 11 insertions, 9 deletions
diff --git a/src/main/java/de/thedevstack/conversationsplus/ui/ConversationActivity.java b/src/main/java/de/thedevstack/conversationsplus/ui/ConversationActivity.java index 301ba563..de69c1e6 100644 --- a/src/main/java/de/thedevstack/conversationsplus/ui/ConversationActivity.java +++ b/src/main/java/de/thedevstack/conversationsplus/ui/ConversationActivity.java @@ -47,6 +47,7 @@ import de.thedevstack.android.logcat.Logging; import de.thedevstack.conversationsplus.ConversationsPlusPreferences; import de.thedevstack.conversationsplus.ui.dialogs.UserDecisionDialog; import de.thedevstack.conversationsplus.ui.listeners.ResizePictureUserDecisionListener; +import de.thedevstack.conversationsplus.utils.ConversationUtil; import de.timroes.android.listview.EnhancedListView; import de.thedevstack.conversationsplus.Config; import de.thedevstack.conversationsplus.R; @@ -1420,7 +1421,7 @@ public class ConversationActivity extends XmppActivity if (conversation == null) { return; } - xmppConnectionService.attachLocationToConversation(conversation,uri, new UiCallback<Message>() { + ConversationUtil.attachLocationToConversation(conversation,uri, new UiCallback<Message>() { @Override public void success(Message message) { @@ -1445,7 +1446,7 @@ public class ConversationActivity extends XmppActivity } final Toast prepareFileToast = Toast.makeText(getApplicationContext(),getText(R.string.preparing_file), Toast.LENGTH_LONG); prepareFileToast.show(); - xmppConnectionService.attachFileToConversation(conversation, uri, new UiCallback<Message>() { + ConversationUtil.attachFileToConversation(conversation, uri, new UiCallback<Message>() { @Override public void success(Message message) { hidePrepareFileToast(prepareFileToast); diff --git a/src/main/java/de/thedevstack/conversationsplus/ui/ConversationFragment.java b/src/main/java/de/thedevstack/conversationsplus/ui/ConversationFragment.java index 4ae88a5e..f065a25b 100644 --- a/src/main/java/de/thedevstack/conversationsplus/ui/ConversationFragment.java +++ b/src/main/java/de/thedevstack/conversationsplus/ui/ConversationFragment.java @@ -69,6 +69,7 @@ import de.thedevstack.conversationsplus.ui.adapter.MessageAdapter.OnContactPictu import de.thedevstack.conversationsplus.ui.adapter.MessageAdapter.OnContactPictureLongClicked; import de.thedevstack.conversationsplus.ui.listeners.ConversationSwipeRefreshListener; import de.thedevstack.conversationsplus.utils.GeoHelper; +import de.thedevstack.conversationsplus.utils.MessageUtil; import de.thedevstack.conversationsplus.utils.UIHelper; import de.thedevstack.conversationsplus.xmpp.chatstate.ChatState; import de.thedevstack.conversationsplus.xmpp.jid.Jid; @@ -693,7 +694,7 @@ public class ConversationFragment extends Fragment implements EditMessage.Keyboa if (transferable != null) { transferable.cancel(); } else { - activity.xmppConnectionService.markMessage(message, Message.STATUS_SEND_FAILED); + MessageUtil.markMessage(message, Message.STATUS_SEND_FAILED); } } diff --git a/src/main/java/de/thedevstack/conversationsplus/ui/ShareWithActivity.java b/src/main/java/de/thedevstack/conversationsplus/ui/ShareWithActivity.java index fe3ed73f..28e8beb8 100644 --- a/src/main/java/de/thedevstack/conversationsplus/ui/ShareWithActivity.java +++ b/src/main/java/de/thedevstack/conversationsplus/ui/ShareWithActivity.java @@ -31,6 +31,7 @@ import de.thedevstack.conversationsplus.entities.Message; import de.thedevstack.conversationsplus.persistance.FileBackend; import de.thedevstack.conversationsplus.services.XmppConnectionService; import de.thedevstack.conversationsplus.ui.adapter.ConversationAdapter; +import de.thedevstack.conversationsplus.utils.ConversationUtil; import de.thedevstack.conversationsplus.utils.FileUtils; import de.thedevstack.conversationsplus.xmpp.jid.InvalidJidException; import de.thedevstack.conversationsplus.xmpp.jid.Jid; @@ -300,9 +301,7 @@ public class ShareWithActivity extends XmppActivity implements XmppConnectionSer @Override public void onPresenceSelected() { replaceToast(getString(R.string.preparing_file)); - ShareWithActivity.this.xmppConnectionService - .attachFileToConversation(conversation, share.uris.get(0), - attachFileCallback); + ConversationUtil.attachFileToConversation(conversation, share.uris.get(0), attachFileCallback); switchToConversation(conversation, null, true); finish(); } 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 231f738c..b7340ce0 100644 --- a/src/main/java/de/thedevstack/conversationsplus/ui/listeners/ResizePictureUserDecisionListener.java +++ b/src/main/java/de/thedevstack/conversationsplus/ui/listeners/ResizePictureUserDecisionListener.java @@ -13,6 +13,7 @@ import java.io.InputStream; import de.thedevstack.android.logcat.Logging; import de.thedevstack.conversationsplus.ConversationsPlusApplication; import de.thedevstack.conversationsplus.ConversationsPlusPreferences; +import de.thedevstack.conversationsplus.crypto.PgpEngine; import de.thedevstack.conversationsplus.enums.UserDecision; import de.thedevstack.conversationsplus.exceptions.UiException; import de.thedevstack.conversationsplus.utils.FileUtils; @@ -29,7 +30,7 @@ import de.thedevstack.conversationsplus.ui.XmppActivity; import de.thedevstack.conversationsplus.utils.StreamUtil; /** - * Created by tzur on 31.10.2015. + * Listener to let the user decide whether to resize a picture before sending or not. */ public class ResizePictureUserDecisionListener implements UserDecisionListener { protected Uri uri; @@ -156,7 +157,7 @@ public class ResizePictureUserDecisionListener implements UserDecisionListener { String filePath = FileUtils.getPath(uri); MessageUtil.updateMessageWithImageDetails(message, filePath, imageSize, imageWidth, imageHeight); if (conversation.getNextEncryption() == Message.ENCRYPTION_PGP) { - xmppConnectionService.getPgpEngine().encrypt(message, callback); + PgpEngine.getInstance().encrypt(message, callback); } else { callback.success(message); } @@ -195,7 +196,7 @@ public class ResizePictureUserDecisionListener implements UserDecisionListener { int imageHeight = resizedAndRotatedImage.getHeight(); MessageUtil.updateMessageWithImageDetails(message, filePath, imageSize, imageWidth, imageHeight); if (conversation.getNextEncryption() == Message.ENCRYPTION_PGP) { - xmppConnectionService.getPgpEngine().encrypt(message, callback); + PgpEngine.getInstance().encrypt(message, callback); } else { callback.success(message); } |