diff options
author | Daniel Gultsch <daniel@gultsch.de> | 2016-01-09 16:17:39 +0100 |
---|---|---|
committer | Daniel Gultsch <daniel@gultsch.de> | 2016-01-09 16:17:39 +0100 |
commit | 4ab8fe13dea85e23f856bbe853fbf81af908edea (patch) | |
tree | fedba70c6363b0ff228dfd7940da7b29240d812a /src | |
parent | 708d7c5b98e71c5b5b02a2d4c721b70cea0db906 (diff) |
let the user decide on whether or not to compress pictures
Diffstat (limited to 'src')
-rw-r--r-- | src/main/java/eu/siacs/conversations/services/XmppConnectionService.java | 10 | ||||
-rw-r--r-- | src/main/res/values/arrays.xml | 12 | ||||
-rw-r--r-- | src/main/res/values/strings.xml | 6 | ||||
-rw-r--r-- | 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 5c7cceb3..e707fc98 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<Message> 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 5be352d1..ca63a0f1 100644 --- a/src/main/res/values/arrays.xml +++ b/src/main/res/values/arrays.xml @@ -57,4 +57,16 @@ <item>voice</item> <item>location</item> </string-array> + + <string-array name="picture_compression_values"> + <item>never</item> + <item>auto</item> + <item>always</item> + </string-array> + + <string-array name="picture_compression_entries"> + <item>@string/never</item> + <item>@string/automatically</item> + <item>@string/always</item> + </string-array> </resources> diff --git a/src/main/res/values/strings.xml b/src/main/res/values/strings.xml index 049a5dc6..deffa64e 100644 --- a/src/main/res/values/strings.xml +++ b/src/main/res/values/strings.xml @@ -287,7 +287,7 @@ <string name="pref_about_conversations_summary">Build and licensing information</string> <string name="pref_about_message" translatable="false"> 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 @@ <string name="notify_only_when_highlighted">Notify only when highlighted</string> <string name="notify_never">Notifications disabled</string> <string name="notify_paused">Notifications paused</string> + <string name="pref_picture_compression">Compress Pictures</string> + <string name="pref_picture_compression_summary">Resize and compressed pictures</string> + <string name="always">Always</string> + <string name="automatically">Automatically</string> </resources> diff --git a/src/main/res/xml/preferences.xml b/src/main/res/xml/preferences.xml index 34fb7c0a..b3afe0c3 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"/> - + <ListPreference + android:defaultValue="auto" + android:entries="@array/picture_compression_entries" + android:entryValues="@array/picture_compression_values" + android:key="picture_compression" + android:summary="@string/pref_picture_compression_summary" + android:title="@string/pref_picture_compression"/> <CheckBoxPreference android:defaultValue="true" android:key="confirm_messages" @@ -92,8 +98,8 @@ <CheckBoxPreference android:defaultValue="false" android:key="use_white_background" - android:title="@string/pref_use_white_background" - android:summary="@string/pref_use_white_background_summary"/> + android:summary="@string/pref_use_white_background_summary" + android:title="@string/pref_use_white_background"/> <CheckBoxPreference android:defaultValue="false" android:key="use_larger_font" @@ -142,13 +148,13 @@ android:title="@string/pref_remove_trusted_certificates_title"/> </PreferenceCategory> <PreferenceCategory - android:title="@string/pref_connection_options" - android:key="connection_options"> + android:key="connection_options" + android:title="@string/pref_connection_options"> <CheckBoxPreference android:defaultValue="false" android:key="use_tor" - android:title="@string/pref_use_tor" - android:summary="@string/pref_use_tor_summary"/> + android:summary="@string/pref_use_tor_summary" + android:title="@string/pref_use_tor"/> </PreferenceCategory> <PreferenceCategory android:title="@string/pref_input_options"> <CheckBoxPreference @@ -186,9 +192,9 @@ android:summary="@string/pref_keep_foreground_service_summary" android:title="@string/pref_keep_foreground_service"/> <eu.siacs.conversations.ui.ExportLogsPreference - android:key="export_logs" - android:title="@string/pref_export_logs" - android:summary="@string/pref_export_logs_summary"/> + android:key="export_logs" + android:summary="@string/pref_export_logs_summary" + android:title="@string/pref_export_logs"/> </PreferenceCategory> </PreferenceScreen> |