aboutsummaryrefslogtreecommitdiffstats
path: root/src/main/java
diff options
context:
space:
mode:
authorChristian Schneppe <christian.schneppe@pix-art.de>2020-01-31 14:29:55 +0100
committerChristian Schneppe <christian.schneppe@pix-art.de>2020-01-31 14:29:55 +0100
commitb0d0f904a2882d195e83441c39f0138588725722 (patch)
tree9d99cb257602b7dc91fdf2f9d98050badf8fd9bc /src/main/java
parent83c976f2d7cf35d27e040281eab4a2fd40c6d08b (diff)
fix sending uncompressed files
Diffstat (limited to 'src/main/java')
-rw-r--r--src/main/java/de/pixart/messenger/services/XmppConnectionService.java15
-rw-r--r--src/main/java/de/pixart/messenger/ui/XmppActivity.java5
2 files changed, 5 insertions, 15 deletions
diff --git a/src/main/java/de/pixart/messenger/services/XmppConnectionService.java b/src/main/java/de/pixart/messenger/services/XmppConnectionService.java
index 8f9c2ce98..2fc6f74c6 100644
--- a/src/main/java/de/pixart/messenger/services/XmppConnectionService.java
+++ b/src/main/java/de/pixart/messenger/services/XmppConnectionService.java
@@ -572,10 +572,9 @@ public class XmppConnectionService extends Service {
public void attachImageToConversation(final Conversation conversation, final Uri uri, final UiCallback<Message> callback) {
final String mimeType = MimeUtils.guessMimeTypeFromUri(this, uri);
- final String compressPictures = getCompressPicturesPreference();
-
- if ("never".equals(compressPictures)
- || ("auto".equals(compressPictures) && getFileBackend().useImageAsIs(uri))
+ final boolean compressPictures = getCompressImageResolutionPreference() != 0;
+ if (!compressPictures
+ || getFileBackend().useImageAsIs(uri)
|| (mimeType != null && mimeType.endsWith("/gif"))
|| getFileBackend().unusualBounds(uri)) {
Log.d(Config.LOGTAG, conversation.getAccount().getJid().asBareJid() + ": not compressing picture. sending as file");
@@ -1000,12 +999,8 @@ public class XmppConnectionService extends Service {
return getBooleanPreference(SettingsActivity.AWAY_WHEN_SCREEN_IS_OFF, R.bool.away_when_screen_off);
}
- private String getCompressPicturesPreference() {
- return getPreferences().getString("picture_compression", getResources().getString(R.string.picture_compression));
- }
-
public int getCompressImageResolutionPreference() {
- switch (getPreferences().getString("image_compression", getResources().getString(R.string.picture_compression))) {
+ switch (getPreferences().getString("image_compression", getResources().getString(R.string.image_compression))) {
case "low":
return 720;
case "mid":
@@ -1020,7 +1015,7 @@ public class XmppConnectionService extends Service {
}
public int getCompressImageSizePreference() {
- switch (getPreferences().getString("image_compression", getResources().getString(R.string.picture_compression))) {
+ switch (getPreferences().getString("image_compression", getResources().getString(R.string.image_compression))) {
case "low":
return 209715; // 0.2 * 1024 * 1024 = 209715 (0.2 MiB)
case "mid":
diff --git a/src/main/java/de/pixart/messenger/ui/XmppActivity.java b/src/main/java/de/pixart/messenger/ui/XmppActivity.java
index ac2289d92..807a70111 100644
--- a/src/main/java/de/pixart/messenger/ui/XmppActivity.java
+++ b/src/main/java/de/pixart/messenger/ui/XmppActivity.java
@@ -3,7 +3,6 @@ package de.pixart.messenger.ui;
import android.Manifest;
import android.annotation.SuppressLint;
import android.annotation.TargetApi;
-import android.app.AlertDialog.Builder;
import android.app.PendingIntent;
import android.content.ActivityNotFoundException;
import android.content.ClipData;
@@ -973,10 +972,6 @@ public abstract class XmppActivity extends ActionBarActivity {
return false;
}
- protected boolean neverCompressPictures() {
- return getPreferences().getString("picture_compression", getResources().getString(R.string.picture_compression)).equals("never");
- }
-
protected boolean manuallyChangePresence() {
return getBooleanPreference(SettingsActivity.MANUALLY_CHANGE_PRESENCE, R.bool.manually_change_presence);
}