The shrinked images' sizes are now compared with the limit and not the untouched originals.

This commit is contained in:
Lyndon
2017-12-12 17:09:28 -04:00
parent bfbb740987
commit bf42f364b4
2 changed files with 12 additions and 12 deletions

View File

@@ -34,8 +34,8 @@ android {
applicationId "de.beyondsoft.ownchat"
minSdkVersion 19
targetSdkVersion 26
versionCode 11
versionName "1.11"
versionCode 12
versionName "1.12"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
multiDexEnabled true
}

View File

@@ -421,17 +421,17 @@ public class ChatPresenter extends MVPAbstractPresenter<ChatView> implements Cha
return;
}
if(mUploadMaxSizePreference.get() > 0 && file.length() > mUploadMaxSizePreference.get()) {
getView().showError(R.string.error_file_is_too_large);
return;
}
if(mimeType != null && (mimeType.equals(Constants.MIME_TYPE_JPEG) || mimeType.equals(Constants.MIME_TYPE_PNG)) && (file.length() > (1000L * 1024L))) {
FileUtils.clearTmpFilesDir(mContext);
file = FileUtils.scaleImageDown(file, mContext);
}
if(mUploadMaxSizePreference.get() > 0 && file.length() > mUploadMaxSizePreference.get()) {
getView().showError(R.string.error_file_is_too_large);
return;
}
final File fileToSend = file;
String[] split = fileToSend.getAbsolutePath().split("/");
@@ -615,17 +615,17 @@ public class ChatPresenter extends MVPAbstractPresenter<ChatView> implements Cha
return;
}
if(mUploadMaxSizePreference.get() > 0 && file.length() > mUploadMaxSizePreference.get()) {
getView().showError(R.string.error_file_is_too_large);
return;
}
if(mimeType != null && (mimeType.equals(Constants.MIME_TYPE_JPEG) || mimeType.equals(Constants.MIME_TYPE_PNG)) && (file.length() > (1000L * 1024L))) {
FileUtils.clearTmpFilesDir(mContext);
file = FileUtils.scaleImageDown(file, mContext);
}
if(mUploadMaxSizePreference.get() > 0 && file.length() > mUploadMaxSizePreference.get()) {
getView().showError(R.string.error_file_is_too_large);
return;
}
final File fileToSend = file;
// create RequestBody instance from file