diff options
author | Christian Schneppe <christian@pix-art.de> | 2016-11-19 22:50:12 +0100 |
---|---|---|
committer | Christian Schneppe <christian@pix-art.de> | 2016-11-19 22:50:12 +0100 |
commit | 82c15b653c3902a144000079911d69e9b6ce33e0 (patch) | |
tree | 324933be899871debda3692b9b6b34660a46512a /src/main/java/de/pixart/messenger | |
parent | 508e5b589f3e9b8b5208d322b9ff9dc9fff8056a (diff) |
set preference switch to enable, disable or do automatic video compression
automatic = SDK >= Lollipop & video size >= 10 MB (default)
never = never compress videos
always = SDK >= Lollipop
Diffstat (limited to 'src/main/java/de/pixart/messenger')
-rw-r--r-- | src/main/java/de/pixart/messenger/services/XmppConnectionService.java | 17 |
1 files changed, 16 insertions, 1 deletions
diff --git a/src/main/java/de/pixart/messenger/services/XmppConnectionService.java b/src/main/java/de/pixart/messenger/services/XmppConnectionService.java index 92b288494..e41943597 100644 --- a/src/main/java/de/pixart/messenger/services/XmppConnectionService.java +++ b/src/main/java/de/pixart/messenger/services/XmppConnectionService.java @@ -544,6 +544,8 @@ public class XmppConnectionService extends Service { File f = new File(FileUtils.getPath(this, uri)); long filesize = f.length(); String path = f.toString(); + final String compressVideos = getCompressVideoPreference(); + boolean sendVideoAsIs = false; final Integer NOTIFICATION_ID = (int) (new Date().getTime()/1000); mNotifyManager = (NotificationManager) getSystemService(Context.NOTIFICATION_SERVICE); NotificationCompat.Builder mBuilder = new NotificationCompat.Builder(getBaseContext()); @@ -572,7 +574,16 @@ public class XmppConnectionService extends Service { + "_komp.mp4"); final String compressed_path = compressed_file.toString(); final Uri compressed_uri = Uri.fromFile(compressed_file); - if (filesize > Config.VIDEO_MAX_SIZE && Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP){ + if ("never".equals(compressVideos)) { + sendVideoAsIs = true; + } else if ("always".equals(compressVideos) && Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) { + sendVideoAsIs = false; + } else if ("auto".equals(compressVideos) && filesize > Config.VIDEO_MAX_SIZE && Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) { + sendVideoAsIs = false; + } else { + sendVideoAsIs = true; + } + if (!sendVideoAsIs){ CompressVideo = new VideoCompressor(path, compressed_path, new Interface() { @Override public void videocompressed(boolean result) { @@ -878,6 +889,10 @@ public class XmppConnectionService extends Service { return getPreferences().getString("picture_compression", "auto"); } + private String getCompressVideoPreference() { + return getPreferences().getString("video_compression", "auto"); + } + private Presence.Status getTargetPresence() { if (xaOnSilentMode() && isPhoneSilenced()) { return Presence.Status.XA; |