aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/main/java/de/pixart/messenger/persistance/FileBackend.java3
-rw-r--r--src/main/java/de/pixart/messenger/services/AudioPlayer.java3
-rw-r--r--src/main/java/de/pixart/messenger/ui/ConversationFragment.java16
-rw-r--r--src/main/java/de/pixart/messenger/utils/MimeUtils.java3
4 files changed, 16 insertions, 9 deletions
diff --git a/src/main/java/de/pixart/messenger/persistance/FileBackend.java b/src/main/java/de/pixart/messenger/persistance/FileBackend.java
index ce8219f6e..3a53d31b9 100644
--- a/src/main/java/de/pixart/messenger/persistance/FileBackend.java
+++ b/src/main/java/de/pixart/messenger/persistance/FileBackend.java
@@ -341,6 +341,9 @@ public class FileBackend {
if (extension == null) {
extension = getExtensionFromUri(uri);
}
+ if (extension == null) {
+ extension = MimeUtils.guessExtensionFromMimeType(mime);
+ }
String filename = fileDateFormat.format(new Date(message.getTimeSent())) + "_" + message.getUuid().substring(0, 4);
message.setRelativeFilePath(filename + "." + extension);
copyFileToPrivateStorage(mXmppConnectionService.getFileBackend().getFile(message), uri);
diff --git a/src/main/java/de/pixart/messenger/services/AudioPlayer.java b/src/main/java/de/pixart/messenger/services/AudioPlayer.java
index 3cc2fe1be..fa043655f 100644
--- a/src/main/java/de/pixart/messenger/services/AudioPlayer.java
+++ b/src/main/java/de/pixart/messenger/services/AudioPlayer.java
@@ -14,6 +14,7 @@ import android.widget.TextView;
import java.lang.ref.WeakReference;
import java.util.Locale;
+import de.pixart.messenger.Config;
import de.pixart.messenger.R;
import de.pixart.messenger.entities.Message;
import de.pixart.messenger.ui.adapter.MessageAdapter;
@@ -21,7 +22,7 @@ import de.pixart.messenger.utils.WeakReferenceSet;
public class AudioPlayer implements View.OnClickListener, MediaPlayer.OnCompletionListener, SeekBar.OnSeekBarChangeListener, Runnable {
- private static final int REFRESH_INTERVAL = 250;
+ private static final int REFRESH_INTERVAL = Config.REFRESH_UI_INTERVAL;
private static final Object LOCK = new Object();
private static MediaPlayer player = null;
private static Message currentlyPlayingMessage = null;
diff --git a/src/main/java/de/pixart/messenger/ui/ConversationFragment.java b/src/main/java/de/pixart/messenger/ui/ConversationFragment.java
index a8f8cf1dc..c30ccd92a 100644
--- a/src/main/java/de/pixart/messenger/ui/ConversationFragment.java
+++ b/src/main/java/de/pixart/messenger/ui/ConversationFragment.java
@@ -1107,14 +1107,6 @@ public class ConversationFragment extends Fragment implements EditMessage.Keyboa
showSnackbar(R.string.contact_added_you, R.string.add_back, this.mAddBackClickListener, this.mLongPressBlockListener);
} else if (contact.getOption(Contact.Options.PENDING_SUBSCRIPTION_REQUEST)) {
showSnackbar(R.string.contact_asks_for_presence_subscription, R.string.allow, this.mAllowPresenceSubscription, this.mLongPressBlockListener);
- } else if (activity.xmppConnectionService.warnUnecryptedChat() && (conversation.getNextEncryption() == Message.ENCRYPTION_NONE
- && ((mode == Conversation.MODE_SINGLE)
- && ((Config.supportOmemo() && conversation.getAccount().getAxolotlService().isConversationAxolotlCapable(conversation))
- || (Config.supportOpenPgp() && account.isPgpDecryptionServiceConnected()) || Config.supportOtr()))
- || ((mode == Conversation.MODE_MULTI && conversation.getMucOptions().membersOnly() && conversation.getMucOptions().nonanonymous())
- && (Config.supportOmemo() && conversation.getAccount().getAxolotlService().isConversationAxolotlCapable(conversation)
- || (Config.supportOpenPgp() && account.isPgpDecryptionServiceConnected()))))) {
- showSnackbar(R.string.conversation_unencrypted_hint, R.string.ok, mHideUnencryptionHint, null);
} else if (mode == Conversation.MODE_MULTI
&& !conversation.getMucOptions().online()
&& account.getStatus() == Account.State.ONLINE) {
@@ -1171,6 +1163,14 @@ public class ConversationFragment extends Fragment implements EditMessage.Keyboa
&& !conversation.isBlocked()
&& conversation.isWithStranger()) {
showSnackbar(R.string.received_message_from_stranger, R.string.block, mBlockClickListener);
+ } else if (activity.xmppConnectionService.warnUnecryptedChat() && (conversation.getNextEncryption() == Message.ENCRYPTION_NONE
+ && ((mode == Conversation.MODE_SINGLE)
+ && ((Config.supportOmemo() && conversation.getAccount().getAxolotlService().isConversationAxolotlCapable(conversation))
+ || (Config.supportOpenPgp() && account.isPgpDecryptionServiceConnected()) || Config.supportOtr()))
+ || ((mode == Conversation.MODE_MULTI && conversation.getMucOptions().membersOnly() && conversation.getMucOptions().nonanonymous())
+ && (Config.supportOmemo() && conversation.getAccount().getAxolotlService().isConversationAxolotlCapable(conversation)
+ || (Config.supportOpenPgp() && account.isPgpDecryptionServiceConnected()))))) {
+ showSnackbar(R.string.conversation_unencrypted_hint, R.string.ok, mHideUnencryptionHint, null);
} else {
hideSnackbar();
}
diff --git a/src/main/java/de/pixart/messenger/utils/MimeUtils.java b/src/main/java/de/pixart/messenger/utils/MimeUtils.java
index d2ce21b72..bfcf71c6e 100644
--- a/src/main/java/de/pixart/messenger/utils/MimeUtils.java
+++ b/src/main/java/de/pixart/messenger/utils/MimeUtils.java
@@ -509,6 +509,9 @@ public final class MimeUtils {
String mimeType;
try {
mimeType = context.getContentResolver().getType(uri);
+ if (mimeType != null && mimeType.equals("application/octet-stream")) {
+ mimeType = null;
+ }
} catch (Throwable throwable) {
mimeType = null;
}