feat: Allow sending photos larger 1280

This commit is contained in:
xtaodada 2023-01-09 13:16:31 +08:00
parent 61c6b0cb98
commit 7a2f854de4
Signed by: xtaodada
GPG Key ID: 4CBB3F4FA8C85659
3 changed files with 19 additions and 5 deletions

View File

@ -2146,7 +2146,7 @@ public class AndroidUtilities {
public static int getPhotoSize() {
if (photoSize == null) {
photoSize = 1280;
photoSize = 2560;
}
return photoSize;
}

View File

@ -41,7 +41,7 @@ import java.util.ArrayList;
public class CropView extends FrameLayout implements CropAreaView.AreaViewListener, CropGestureDetector.CropGestureListener {
private static final float EPSILON = 0.00001f;
private static final int RESULT_SIDE = 1280;
private static final int RESULT_SIDE = 2560;
private static final float MAX_SCALE = 30.0f;
public CropAreaView areaView;

View File

@ -37,6 +37,7 @@ import org.telegram.messenger.LocaleController;
import org.telegram.messenger.MediaController;
import org.telegram.messenger.MessageObject;
import org.telegram.messenger.R;
import org.telegram.messenger.SharedConfig;
import org.telegram.messenger.UserConfig;
import org.telegram.messenger.Utilities;
import org.telegram.messenger.VideoEditedInfo;
@ -426,10 +427,23 @@ public class PhotoPaintView extends FrameLayout implements IPhotoPaintView, Enti
float height = bitmapToEdit.getHeight();
Size size = new Size(width, height);
size.width = 1280;
int maxSide;
switch (SharedConfig.getDevicePerformanceClass()) {
case SharedConfig.PERFORMANCE_CLASS_LOW:
maxSide = 1280;
break;
default:
case SharedConfig.PERFORMANCE_CLASS_AVERAGE:
maxSide = 2560;
break;
case SharedConfig.PERFORMANCE_CLASS_HIGH:
maxSide = 3840;
break;
}
size.width = maxSide;
size.height = (float) Math.floor(size.width * height / width);
if (size.height > 1280) {
size.height = 1280;
if (size.height > maxSide) {
size.height = maxSide;
size.width = (float) Math.floor(size.height * width / height);
}
paintingSize = size;