Update to 7.3.0 (2195)

This commit is contained in:
DrKLO 2020-12-23 11:48:30 +04:00
parent 5a47056c7b
commit d52b2c921a
4526 changed files with 73002 additions and 104030 deletions

View file

@ -3,6 +3,8 @@ package org.telegram.messenger;
import org.telegram.tgnet.TLRPC;
import org.telegram.ui.ActionBar.Theme;
import java.util.ArrayList;
public class DocumentObject {
public static class ThemeDocument extends TLRPC.TL_document {
@ -39,4 +41,57 @@ public class DocumentObject {
}
}
}
public static SvgHelper.SvgDrawable getSvgThumb(ArrayList<TLRPC.PhotoSize> sizes, String colorKey, float alpha) {
int w = 0;
int h = 0;
TLRPC.TL_photoPathSize photoPathSize = null;
for (int a = 0, N = sizes.size(); a < N; a++) {
TLRPC.PhotoSize photoSize = sizes.get(a);
if (photoSize instanceof TLRPC.TL_photoPathSize) {
photoPathSize = (TLRPC.TL_photoPathSize) photoSize;
} else {
w = photoSize.w;
h = photoSize.h;
}
if (photoPathSize != null && w != 0 && h != 0) {
SvgHelper.SvgDrawable pathThumb = SvgHelper.getDrawableByPath(SvgHelper.decompress(photoPathSize.bytes), w, h);
if (pathThumb != null) {
pathThumb.setupGradient(colorKey, alpha);
}
return pathThumb;
}
}
return null;
}
public static SvgHelper.SvgDrawable getSvgThumb(TLRPC.Document document, String colorKey, float alpha) {
return getSvgThumb(document, colorKey, alpha, 1.0f);
}
public static SvgHelper.SvgDrawable getSvgThumb(TLRPC.Document document, String colorKey, float alpha, float zoom) {
SvgHelper.SvgDrawable pathThumb = null;
for (int b = 0, N2 = document.thumbs.size(); b < N2; b++) {
TLRPC.PhotoSize size = document.thumbs.get(b);
if (size instanceof TLRPC.TL_photoPathSize) {
int w = 512, h = 512;
for (int a = 0, N = document.attributes.size(); a < N; a++) {
TLRPC.DocumentAttribute attribute = document.attributes.get(a);
if (attribute instanceof TLRPC.TL_documentAttributeImageSize) {
w = attribute.w;
h = attribute.h;
break;
}
}
if (w != 0 && h != 0) {
pathThumb = SvgHelper.getDrawableByPath(SvgHelper.decompress(size.bytes), (int) (w * zoom), (int) (h * zoom));
if (pathThumb != null) {
pathThumb.setupGradient(colorKey, alpha);
}
}
break;
}
}
return pathThumb;
}
}