From 4ab8fe13dea85e23f856bbe853fbf81af908edea Mon Sep 17 00:00:00 2001 From: Daniel Gultsch Date: Sat, 9 Jan 2016 16:17:39 +0100 Subject: [PATCH] let the user decide on whether or not to compress pictures --- .../services/XmppConnectionService.java | 10 +++++-- src/main/res/values/arrays.xml | 12 +++++++++ src/main/res/values/strings.xml | 6 ++++- src/main/res/xml/preferences.xml | 26 ++++++++++++------- 4 files changed, 41 insertions(+), 13 deletions(-) diff --git a/src/main/java/eu/siacs/conversations/services/XmppConnectionService.java b/src/main/java/eu/siacs/conversations/services/XmppConnectionService.java index 5c7cceb35..e707fc985 100644 --- a/src/main/java/eu/siacs/conversations/services/XmppConnectionService.java +++ b/src/main/java/eu/siacs/conversations/services/XmppConnectionService.java @@ -414,8 +414,10 @@ public class XmppConnectionService extends Service implements OnPhoneContactsLoa } public void attachImageToConversation(final Conversation conversation, final Uri uri, final UiCallback callback) { - if (getFileBackend().useImageAsIs(uri)) { - Log.d(Config.LOGTAG, "using image as is"); + final String compressPictures = getCompressPicturesPreference(); + if ("never".equals(compressPictures) + || ("auto".equals(compressPictures) && getFileBackend().useImageAsIs(uri))) { + Log.d(Config.LOGTAG,conversation.getAccount().getJid().toBareJid()+ ": not compressing picture. sending as file"); attachFileToConversation(conversation, uri, callback); return; } @@ -590,6 +592,10 @@ public class XmppConnectionService extends Service implements OnPhoneContactsLoa return getPreferences().getBoolean("away_when_screen_off", false); } + private String getCompressPicturesPreference() { + return getPreferences().getString("picture_compression", "auto"); + } + private int getTargetPresence() { if (xaOnSilentMode() && isPhoneSilenced()) { return Presences.XA; diff --git a/src/main/res/values/arrays.xml b/src/main/res/values/arrays.xml index 5be352d1c..ca63a0f12 100644 --- a/src/main/res/values/arrays.xml +++ b/src/main/res/values/arrays.xml @@ -57,4 +57,16 @@ voice location + + + never + auto + always + + + + @string/never + @string/automatically + @string/always + diff --git a/src/main/res/values/strings.xml b/src/main/res/values/strings.xml index 049a5dc61..deffa64ea 100644 --- a/src/main/res/values/strings.xml +++ b/src/main/res/values/strings.xml @@ -287,7 +287,7 @@ Build and licensing information Conversations • the very last word in instant messaging. - \n\nCopyright © 2014-2015 Daniel Gultsch + \n\nCopyright © 2014-2016 Daniel Gultsch \n\nThis program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or @@ -571,4 +571,8 @@ Notify only when highlighted Notifications disabled Notifications paused + Compress Pictures + Resize and compressed pictures + Always + Automatically diff --git a/src/main/res/xml/preferences.xml b/src/main/res/xml/preferences.xml index 34fb7c0a5..b3afe0c3e 100644 --- a/src/main/res/xml/preferences.xml +++ b/src/main/res/xml/preferences.xml @@ -22,7 +22,13 @@ android:key="auto_accept_file_size" android:summary="@string/pref_accept_files_summary" android:title="@string/pref_accept_files"/> - + + android:summary="@string/pref_use_white_background_summary" + android:title="@string/pref_use_white_background"/> + android:key="connection_options" + android:title="@string/pref_connection_options"> + android:summary="@string/pref_use_tor_summary" + android:title="@string/pref_use_tor"/> + android:key="export_logs" + android:summary="@string/pref_export_logs_summary" + android:title="@string/pref_export_logs"/>