diff options
-rw-r--r-- | src/main/java/de/pixart/messenger/services/XmppConnectionService.java | 15 | ||||
-rw-r--r-- | src/main/java/de/pixart/messenger/ui/XmppActivity.java | 5 | ||||
-rw-r--r-- | src/main/res/values/defaults.xml | 1 |
3 files changed, 5 insertions, 16 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); } diff --git a/src/main/res/values/defaults.xml b/src/main/res/values/defaults.xml index 36f881348..2ccb19a1f 100644 --- a/src/main/res/values/defaults.xml +++ b/src/main/res/values/defaults.xml @@ -63,7 +63,6 @@ <integer name="grace_period">144</integer> <string name="default_resource" translatable="false">Phone</string> <string name="notification_ringtone">content://settings/system/notification_sound</string> - <string name="picture_compression">auto</string> <string name="image_compression">mid</string> <string name="video_compression">mid</string> <string name="quick_action">recent</string> |