merge 9.2.0

This commit is contained in:
wrwrabbit 2022-12-07 14:37:39 +03:00
commit e5daf2504b
242 changed files with 14282 additions and 5046 deletions

View file

@ -5100,6 +5100,10 @@ public class PhotoViewer implements NotificationCenter.NotificationCenterDelegat
requestVideoPreview(2);
});
qualityPicker.doneButton.setOnClickListener(view -> {
Object object = imagesArrLocals.get(currentIndex);
if (object instanceof MediaController.MediaEditState) {
((MediaController.MediaEditState) object).editedInfo = getCurrentVideoEditedInfo();
}
showQualityView(false);
requestVideoPreview(2);
});
@ -7518,6 +7522,7 @@ public class PhotoViewer implements NotificationCenter.NotificationCenterDelegat
videoEditedInfo.endTime *= 2;
}
videoEditedInfo.end = videoEditedInfo.endTime;
videoEditedInfo.compressQuality = selectedCompression;
videoEditedInfo.rotationValue = 0;
videoEditedInfo.originalPath = currentImagePath;
videoEditedInfo.estimatedSize = (int) (videoEditedInfo.endTime / 1000.0f * 115200);
@ -7574,6 +7579,7 @@ public class PhotoViewer implements NotificationCenter.NotificationCenterDelegat
videoEditedInfo.endTime = endTime;
videoEditedInfo.start = videoCutStart;
videoEditedInfo.end = videoCutEnd;
videoEditedInfo.compressQuality = selectedCompression;
videoEditedInfo.rotationValue = rotationValue;
videoEditedInfo.originalWidth = originalWidth;
videoEditedInfo.originalHeight = originalHeight;
@ -10645,7 +10651,7 @@ public class PhotoViewer implements NotificationCenter.NotificationCenterDelegat
}
}
} else if (MessageObject.getMedia(message.messageOwner) instanceof TLRPC.TL_messageMediaInvoice) {
return ImageLocation.getForWebFile(WebFile.createWithWebDocument(((TLRPC.TL_messageMediaInvoice) MessageObject.getMedia(message.messageOwner)).photo));
return ImageLocation.getForWebFile(WebFile.createWithWebDocument(((TLRPC.TL_messageMediaInvoice) MessageObject.getMedia(message.messageOwner)).webPhoto));
} else if (message.getDocument() != null) {
TLRPC.Document document = message.getDocument();
if (sharedMediaType == MediaDataController.MEDIA_GIF) {
@ -11584,15 +11590,17 @@ public class PhotoViewer implements NotificationCenter.NotificationCenterDelegat
boolean isMuted = false;
float start = 0.0f;
float end = 1.0f;
int compressQuality = -1;
if (object instanceof MediaController.PhotoEntry) {
MediaController.PhotoEntry photoEntry = ((MediaController.PhotoEntry) object);
if (photoEntry.editedInfo != null) {
isMuted = photoEntry.editedInfo.muted;
start = photoEntry.editedInfo.start;
end = photoEntry.editedInfo.end;
compressQuality = photoEntry.editedInfo.compressQuality;
}
}
processOpenVideo(currentPathObject, isMuted, start, end);
processOpenVideo(currentPathObject, isMuted, start, end, compressQuality);
if (isDocumentsPicker || Build.VERSION.SDK_INT < 18) {
showVideoTimeline(false, animated);
videoAvatarTooltip.setVisibility(View.GONE);
@ -11916,8 +11924,8 @@ public class PhotoViewer implements NotificationCenter.NotificationCenterDelegat
}
if (isVideo || isEmbedVideo) {
speedItem.setVisibility(View.VISIBLE);
speedGap.setVisibility(View.VISIBLE);
menuItem.showSubItem(gallery_menu_speed);
speedGap.setVisibility(menuItem.getVisibleSubItemsCount() > 1 ? View.VISIBLE : View.GONE);
} else {
speedItem.setVisibility(View.GONE);
speedGap.setVisibility(View.GONE);
@ -16833,7 +16841,7 @@ public class PhotoViewer implements NotificationCenter.NotificationCenterDelegat
return new ByteArrayInputStream(output, 0, outPos);
}
private void processOpenVideo(final String videoPath, boolean muted, float start, float end) {
private void processOpenVideo(final String videoPath, boolean muted, float start, float end, int compressQality) {
if (currentLoadingVideoRunnable != null) {
Utilities.globalQueue.cancelRunnable(currentLoadingVideoRunnable);
currentLoadingVideoRunnable = null;
@ -16886,7 +16894,11 @@ public class PhotoViewer implements NotificationCenter.NotificationCenterDelegat
resultHeight = originalHeight = params[AnimatedFileDrawable.PARAM_NUM_HEIGHT];
updateCompressionsCount(originalWidth, originalHeight);
selectedCompression = selectCompression();
if (compressQality == -1) {
selectedCompression = selectCompression();
} else {
selectedCompression = compressQality;
}
updateWidthHeightBitrateForCompression();
if (selectedCompression > compressionsCount - 1) {