show resource prompt when sending uncompressed video
This commit is contained in:
parent
9276eff1db
commit
863ac7f2e5
|
@ -56,6 +56,7 @@ import eu.siacs.conversations.Config;
|
||||||
import eu.siacs.conversations.R;
|
import eu.siacs.conversations.R;
|
||||||
import eu.siacs.conversations.entities.DownloadableFile;
|
import eu.siacs.conversations.entities.DownloadableFile;
|
||||||
import eu.siacs.conversations.entities.Message;
|
import eu.siacs.conversations.entities.Message;
|
||||||
|
import eu.siacs.conversations.services.AttachFileToConversationRunnable;
|
||||||
import eu.siacs.conversations.services.XmppConnectionService;
|
import eu.siacs.conversations.services.XmppConnectionService;
|
||||||
import eu.siacs.conversations.ui.RecordingActivity;
|
import eu.siacs.conversations.ui.RecordingActivity;
|
||||||
import eu.siacs.conversations.ui.util.Attachment;
|
import eu.siacs.conversations.ui.util.Attachment;
|
||||||
|
@ -111,6 +112,7 @@ public class FileBackend {
|
||||||
}
|
}
|
||||||
|
|
||||||
public static boolean allFilesUnderSize(Context context, List<Attachment> attachments, long max) {
|
public static boolean allFilesUnderSize(Context context, List<Attachment> attachments, long max) {
|
||||||
|
final boolean compressVideo = !AttachFileToConversationRunnable.getVideoCompression(context).equals("uncompressed");
|
||||||
if (max <= 0) {
|
if (max <= 0) {
|
||||||
Log.d(Config.LOGTAG, "server did not report max file size for http upload");
|
Log.d(Config.LOGTAG, "server did not report max file size for http upload");
|
||||||
return true; //exception to be compatible with HTTP Upload < v0.2
|
return true; //exception to be compatible with HTTP Upload < v0.2
|
||||||
|
@ -120,7 +122,7 @@ public class FileBackend {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
String mime = attachment.getMime();
|
String mime = attachment.getMime();
|
||||||
if (mime != null && mime.startsWith("video/")) {
|
if (mime != null && mime.startsWith("video/") && compressVideo) {
|
||||||
try {
|
try {
|
||||||
Dimensions dimensions = FileBackend.getVideoDimensions(context, attachment.getUri());
|
Dimensions dimensions = FileBackend.getVideoDimensions(context, attachment.getUri());
|
||||||
if (dimensions.getMin() > 720) {
|
if (dimensions.getMin() > 720) {
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
package eu.siacs.conversations.services;
|
package eu.siacs.conversations.services;
|
||||||
|
|
||||||
|
import android.content.Context;
|
||||||
import android.content.SharedPreferences;
|
import android.content.SharedPreferences;
|
||||||
import android.net.Uri;
|
import android.net.Uri;
|
||||||
import android.os.Build;
|
import android.os.Build;
|
||||||
|
@ -177,7 +178,11 @@ public class AttachFileToConversationRunnable implements Runnable, MediaTranscod
|
||||||
}
|
}
|
||||||
|
|
||||||
private String getVideoCompression() {
|
private String getVideoCompression() {
|
||||||
final SharedPreferences preferences = PreferenceManager.getDefaultSharedPreferences(mXmppConnectionService);
|
return getVideoCompression(mXmppConnectionService);
|
||||||
return preferences.getString("video_compression", mXmppConnectionService.getResources().getString(R.string.video_compression));
|
}
|
||||||
|
|
||||||
|
public static String getVideoCompression(final Context context) {
|
||||||
|
final SharedPreferences preferences = PreferenceManager.getDefaultSharedPreferences(context);
|
||||||
|
return preferences.getString("video_compression", context.getResources().getString(R.string.video_compression));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue