Update to 8.5.1

This commit is contained in:
xaxtix 2022-02-04 01:18:58 +03:00
parent a1817ea7d3
commit 146cea26cd
44 changed files with 152 additions and 79 deletions

View File

@ -300,7 +300,7 @@ android {
} }
} }
defaultConfig.versionCode = 2547 defaultConfig.versionCode = 2551
applicationVariants.all { variant -> applicationVariants.all { variant ->
variant.outputs.all { output -> variant.outputs.all { output ->
@ -319,7 +319,7 @@ android {
defaultConfig { defaultConfig {
minSdkVersion 16 minSdkVersion 16
targetSdkVersion 30 targetSdkVersion 30
versionName "8.5.0" versionName "8.5.1"
vectorDrawables.generatedDensities = ['mdpi', 'hdpi', 'xhdpi', 'xxhdpi'] vectorDrawables.generatedDensities = ['mdpi', 'hdpi', 'xhdpi', 'xxhdpi']

View File

@ -4,7 +4,7 @@
# used # used
# ffmpeg 4.3.3 # ffmpeg 4.3.3
# lib vpx 1.10.9 # lib vpx 1.10.9
# NDK build_ffmpeg for compile libvpx. Last sussecfull build with 21.1.6352462 # NDK for compile libvpx. Last successful build with 21.1.6352462
# NDK r10e for compile ffmpeg # NDK r10e for compile ffmpeg
# #
# 1) download ffmpeg # 1) download ffmpeg
@ -18,7 +18,7 @@
NDK="/opt/android/ndk/android-ndk-r21e" NDK="/opt/android/ndk/android-ndk-r21e"
NDK_r10e="/opt/android/ndk/android-ndk-r10e" NDK_r10e="/opt/android/ndk/android-ndk-r10e"
#build vpx
cd ./vpx-android cd ./vpx-android
export ANDROID_NDK=$NDK export ANDROID_NDK=$NDK
sh build-vpx.sh sh build-vpx.sh
@ -86,6 +86,7 @@ LIBS=" -L${PREFIX}/lib"
--enable-decoder=mjpeg \ --enable-decoder=mjpeg \
--enable-decoder=gif \ --enable-decoder=gif \
--enable-decoder=alac \ --enable-decoder=alac \
--enable-decoder=opus \
--enable-demuxer=mov \ --enable-demuxer=mov \
--enable-demuxer=gif \ --enable-demuxer=gif \
--enable-demuxer=ogg \ --enable-demuxer=ogg \

View File

@ -790,11 +790,12 @@ int readCallback(void *opaque, uint8_t *buf, int buf_size) {
if (attached) { if (attached) {
javaVm->DetachCurrentThread(); javaVm->DetachCurrentThread();
} }
return (int) read(info->fd, buf, (size_t) buf_size); int ret = (int) read(info->fd, buf, (size_t) buf_size);
return ret ? ret : AVERROR_EOF;
} }
} }
} }
return 0; return AVERROR_EOF;
} }
int64_t seekCallback(void *opaque, int64_t offset, int whence) { int64_t seekCallback(void *opaque, int64_t offset, int whence) {
@ -1150,6 +1151,11 @@ extern "C" JNIEXPORT void JNICALL Java_org_telegram_ui_Components_AnimatedFileDr
} }
} }
uint32_t premultiply_channel_value(const uint32_t pixel, const uint8_t offset, const float normalizedAlpha) {
auto multipliedValue = ((pixel >> offset) & 0xFF) * normalizedAlpha;
return ((uint32_t)std::min(multipliedValue, 255.0f)) << offset;
}
static inline void writeFrameToBitmap(JNIEnv *env, VideoInfo *info, jintArray data, jobject bitmap, jint stride) { static inline void writeFrameToBitmap(JNIEnv *env, VideoInfo *info, jintArray data, jobject bitmap, jint stride) {
jint *dataArr = env->GetIntArrayElements(data, 0); jint *dataArr = env->GetIntArrayElements(data, 0);
int32_t wantedWidth; int32_t wantedWidth;
@ -1173,15 +1179,15 @@ static inline void writeFrameToBitmap(JNIEnv *env, VideoInfo *info, jintArray da
void *pixels; void *pixels;
if (AndroidBitmap_lockPixels(env, bitmap, &pixels) >= 0) { if (AndroidBitmap_lockPixels(env, bitmap, &pixels) >= 0) {
if (info->sws_ctx == nullptr) { if (info->sws_ctx == nullptr) {
if (info->frame->format > AV_PIX_FMT_NONE && info->frame->format < AV_PIX_FMT_NB) { if (info->frame->format > AV_PIX_FMT_NONE && info->frame->format < AV_PIX_FMT_NB && !info->frame->format == AV_PIX_FMT_YUVA420P) {
info->sws_ctx = sws_getContext(info->frame->width, info->frame->height, (AVPixelFormat) info->frame->format, bitmapWidth, bitmapHeight, AV_PIX_FMT_RGBA, SWS_BILINEAR, NULL, NULL, NULL); info->sws_ctx = sws_getContext(info->frame->width, info->frame->height, (AVPixelFormat) info->frame->format, bitmapWidth, bitmapHeight, AV_PIX_FMT_RGBA, SWS_BILINEAR, NULL, NULL, NULL);
} else if (info->video_dec_ctx->pix_fmt > AV_PIX_FMT_NONE && info->video_dec_ctx->pix_fmt < AV_PIX_FMT_NB) { } else if (info->video_dec_ctx->pix_fmt > AV_PIX_FMT_NONE && info->video_dec_ctx->pix_fmt < AV_PIX_FMT_NB && !info->frame->format == AV_PIX_FMT_YUVA420P) {
info->sws_ctx = sws_getContext(info->video_dec_ctx->width, info->video_dec_ctx->height, info->video_dec_ctx->pix_fmt, bitmapWidth, bitmapHeight, AV_PIX_FMT_RGBA, SWS_BILINEAR, NULL, NULL, NULL); info->sws_ctx = sws_getContext(info->video_dec_ctx->width, info->video_dec_ctx->height, info->video_dec_ctx->pix_fmt, bitmapWidth, bitmapHeight, AV_PIX_FMT_RGBA, SWS_BILINEAR, NULL, NULL, NULL);
} }
} }
if (info->sws_ctx == nullptr || ((intptr_t) pixels) % 16 != 0) { if (info->sws_ctx == nullptr || ((intptr_t) pixels) % 16 != 0) {
if (info->frame->format == AV_PIX_FMT_YUVA420P) { if (info->frame->format == AV_PIX_FMT_YUVA420P) {
libyuv::I420AlphaToARGBMatrix(info->frame->data[0], info->frame->linesize[0], info->frame->data[2], info->frame->linesize[2], info->frame->data[1], info->frame->linesize[1], info->frame->data[3], info->frame->linesize[3], (uint8_t *) pixels, bitmapWidth * 4, &libyuv::kYvuI601Constants, bitmapWidth, bitmapHeight, 50); libyuv::I420AlphaToARGBMatrix(info->frame->data[0], info->frame->linesize[0], info->frame->data[2], info->frame->linesize[2], info->frame->data[1], info->frame->linesize[1], info->frame->data[3], info->frame->linesize[3], (uint8_t *) pixels, bitmapWidth * 4, &libyuv::kYvuI601Constants, bitmapWidth, bitmapHeight, 1);
} else if (info->frame->format == AV_PIX_FMT_YUV444P) { } else if (info->frame->format == AV_PIX_FMT_YUV444P) {
libyuv::H444ToARGB(info->frame->data[0], info->frame->linesize[0], info->frame->data[2], info->frame->linesize[2], info->frame->data[1], info->frame->linesize[1], (uint8_t *) pixels, bitmapWidth * 4, bitmapWidth, bitmapHeight); libyuv::H444ToARGB(info->frame->data[0], info->frame->linesize[0], info->frame->data[2], info->frame->linesize[2], info->frame->data[1], info->frame->linesize[1], (uint8_t *) pixels, bitmapWidth * 4, bitmapWidth, bitmapHeight);
} else if (info->frame->format == AV_PIX_FMT_YUV420P || info->frame->format == AV_PIX_FMT_YUVJ420P) { } else if (info->frame->format == AV_PIX_FMT_YUV420P || info->frame->format == AV_PIX_FMT_YUVJ420P) {
@ -1199,17 +1205,6 @@ static inline void writeFrameToBitmap(JNIEnv *env, VideoInfo *info, jintArray da
info->dst_linesize[0] = stride; info->dst_linesize[0] = stride;
sws_scale(info->sws_ctx, info->frame->data, info->frame->linesize, 0, sws_scale(info->sws_ctx, info->frame->data, info->frame->linesize, 0,
info->frame->height, dst_data, info->dst_linesize); info->frame->height, dst_data, info->dst_linesize);
if (info->frame->format == AV_PIX_FMT_YUVA420P) {
auto pixelArr = ((uint32_t *) pixels);
for (int i = 0; i < bitmapWidth; i++) {
for (int j = 0; j < bitmapHeight; j++) {
int a = RGB8888_A(pixelArr[j * bitmapWidth + i]);
if (a < 125) {
pixelArr[j * bitmapWidth + i] = 0;
}
}
}
}
} }
} }
AndroidBitmap_unlockPixels(env, bitmap); AndroidBitmap_unlockPixels(env, bitmap);

View File

@ -20,11 +20,10 @@ public class BuildVars {
public static boolean USE_CLOUD_STRINGS = true; public static boolean USE_CLOUD_STRINGS = true;
public static boolean CHECK_UPDATES = true; public static boolean CHECK_UPDATES = true;
public static boolean NO_SCOPED_STORAGE = Build.VERSION.SDK_INT <= 29; public static boolean NO_SCOPED_STORAGE = Build.VERSION.SDK_INT <= 29;
public static int BUILD_VERSION = 2547; public static int BUILD_VERSION = 2551;
public static String BUILD_VERSION_STRING = "8.5.0"; public static String BUILD_VERSION_STRING = "8.5.1";
public static int APP_ID = 4; public static int APP_ID = 4;
public static String APP_HASH = "014b35b6184100b085b0d0572f9b5103"; public static String APP_HASH = "014b35b6184100b085b0d0572f9b5103";
public static String APPCENTER_HASH = "a5b5c4f5-51da-dedc-9918-d9766a22ca7c";
public static String SMS_HASH = isStandaloneApp() ? "w0lkcmTZkKh" : (DEBUG_VERSION ? "O2P2z+/jBpJ" : "oLeq9AcOZkT"); public static String SMS_HASH = isStandaloneApp() ? "w0lkcmTZkKh" : (DEBUG_VERSION ? "O2P2z+/jBpJ" : "oLeq9AcOZkT");
public static String PLAYSTORE_APP_URL = "https://play.google.com/store/apps/details?id=org.telegram.messenger"; public static String PLAYSTORE_APP_URL = "https://play.google.com/store/apps/details?id=org.telegram.messenger";

View File

@ -211,7 +211,7 @@ public class ImageReceiver implements NotificationCenter.NotificationCenterDeleg
private Drawable currentMediaDrawable; private Drawable currentMediaDrawable;
private BitmapShader mediaShader; private BitmapShader mediaShader;
private boolean useRoundForThumb; private boolean useRoundForThumb = true;
private Drawable staticThumbDrawable; private Drawable staticThumbDrawable;
@ -277,6 +277,7 @@ public class ImageReceiver implements NotificationCenter.NotificationCenterDeleg
private int animateFromIsPressed; private int animateFromIsPressed;
private String uniqKeyPrefix; private String uniqKeyPrefix;
private ArrayList<Runnable> loadingOperations = new ArrayList<>(); private ArrayList<Runnable> loadingOperations = new ArrayList<>();
private boolean attachedToWindow;
public ImageReceiver() { public ImageReceiver() {
this(null); this(null);
@ -576,16 +577,12 @@ public class ImageReceiver implements NotificationCenter.NotificationCenterDeleg
legacyBitmap.recycle(); legacyBitmap.recycle();
legacyBitmap = null; legacyBitmap = null;
} }
if (useRoundForThumb && staticThumbDrawable != null) {
updateDrawableRadius(staticThumbDrawable);
}
currentAlpha = 1.0f; currentAlpha = 1.0f;
previousAlpha = 1f; previousAlpha = 1f;
if (staticThumbDrawable instanceof SvgHelper.SvgDrawable) { if (staticThumbDrawable instanceof SvgHelper.SvgDrawable) {
((SvgHelper.SvgDrawable) staticThumbDrawable).setParent(this); ((SvgHelper.SvgDrawable) staticThumbDrawable).setParent(this);
} }
updateDrawableRadius(staticThumbDrawable);
if (delegate != null) { if (delegate != null) {
delegate.didSetImage(this, currentImageDrawable != null || currentThumbDrawable != null || staticThumbDrawable != null || currentMediaDrawable != null, currentImageDrawable == null && currentMediaDrawable == null, false); delegate.didSetImage(this, currentImageDrawable != null || currentThumbDrawable != null || staticThumbDrawable != null || currentMediaDrawable != null, currentImageDrawable == null && currentMediaDrawable == null, false);
@ -707,6 +704,9 @@ public class ImageReceiver implements NotificationCenter.NotificationCenterDeleg
if (bitmap instanceof AnimatedFileDrawable) { if (bitmap instanceof AnimatedFileDrawable) {
AnimatedFileDrawable fileDrawable = (AnimatedFileDrawable) bitmap; AnimatedFileDrawable fileDrawable = (AnimatedFileDrawable) bitmap;
fileDrawable.setParentView(parentView); fileDrawable.setParentView(parentView);
if (attachedToWindow) {
fileDrawable.addParent(parentView);
}
fileDrawable.setUseSharedQueue(useSharedAnimationQueue || fileDrawable.isWebmSticker); fileDrawable.setUseSharedQueue(useSharedAnimationQueue || fileDrawable.isWebmSticker);
if (allowStartAnimation && currentOpenedLayerFlags == 0) { if (allowStartAnimation && currentOpenedLayerFlags == 0) {
fileDrawable.start(); fileDrawable.start();
@ -841,6 +841,7 @@ public class ImageReceiver implements NotificationCenter.NotificationCenterDeleg
} }
public void onDetachedFromWindow() { public void onDetachedFromWindow() {
attachedToWindow = false;
if (currentImageLocation != null || currentMediaLocation != null || currentThumbLocation != null || staticThumbDrawable != null) { if (currentImageLocation != null || currentMediaLocation != null || currentThumbLocation != null || staticThumbDrawable != null) {
if (setImageBackup == null) { if (setImageBackup == null) {
setImageBackup = new SetImageBackup(); setImageBackup = new SetImageBackup();
@ -869,6 +870,11 @@ public class ImageReceiver implements NotificationCenter.NotificationCenterDeleg
if (isPressed == 0) { if (isPressed == 0) {
pressedProgress = 0f; pressedProgress = 0f;
} }
AnimatedFileDrawable animatedFileDrawable = getAnimation();
if (animatedFileDrawable != null) {
animatedFileDrawable.removeParent(parentView);
}
} }
private boolean setBackupImage() { private boolean setBackupImage() {
@ -888,6 +894,7 @@ public class ImageReceiver implements NotificationCenter.NotificationCenterDeleg
} }
public boolean onAttachedToWindow() { public boolean onAttachedToWindow() {
attachedToWindow = true;
currentOpenedLayerFlags = NotificationCenter.getGlobalInstance().getCurrentHeavyOperationFlags(); currentOpenedLayerFlags = NotificationCenter.getGlobalInstance().getCurrentHeavyOperationFlags();
currentOpenedLayerFlags &= ~currentLayerNum; currentOpenedLayerFlags &= ~currentLayerNum;
NotificationCenter.getGlobalInstance().addObserver(this, NotificationCenter.didReplacedPhotoInMemCache); NotificationCenter.getGlobalInstance().addObserver(this, NotificationCenter.didReplacedPhotoInMemCache);
@ -901,6 +908,9 @@ public class ImageReceiver implements NotificationCenter.NotificationCenterDeleg
lottieDrawable.start(); lottieDrawable.start();
} }
AnimatedFileDrawable animatedFileDrawable = getAnimation(); AnimatedFileDrawable animatedFileDrawable = getAnimation();
if (animatedFileDrawable != null && parentView != null) {
animatedFileDrawable.addParent(parentView);
}
if (animatedFileDrawable != null && allowStartAnimation && currentOpenedLayerFlags == 0) { if (animatedFileDrawable != null && allowStartAnimation && currentOpenedLayerFlags == 0) {
animatedFileDrawable.start(); animatedFileDrawable.start();
if (parentView != null) { if (parentView != null) {
@ -1418,6 +1428,9 @@ public class ImageReceiver implements NotificationCenter.NotificationCenterDeleg
orientation = imageOrientation; orientation = imageOrientation;
} else if (staticThumbDrawable instanceof BitmapDrawable) { } else if (staticThumbDrawable instanceof BitmapDrawable) {
drawable = staticThumbDrawable; drawable = staticThumbDrawable;
if (useRoundForThumb && thumbShader == null) {
updateDrawableRadius(staticThumbDrawable);
}
shaderToUse = thumbShader; shaderToUse = thumbShader;
orientation = thumbOrientation; orientation = thumbOrientation;
} else if (currentThumbDrawable != null) { } else if (currentThumbDrawable != null) {
@ -1429,7 +1442,10 @@ public class ImageReceiver implements NotificationCenter.NotificationCenterDeleg
if (drawable != null) { if (drawable != null) {
if (crossfadeAlpha != 0) { if (crossfadeAlpha != 0) {
if (previousAlpha != 1f && (drawable == currentImageDrawable || drawable == currentMediaDrawable) && staticThumbDrawable != null) { if (previousAlpha != 1f && (drawable == currentImageDrawable || drawable == currentMediaDrawable) && staticThumbDrawable != null) {
drawDrawable(canvas, staticThumbDrawable, (int) (overrideAlpha * 255), shaderToUse, orientation); if (useRoundForThumb && thumbShader == null) {
updateDrawableRadius(staticThumbDrawable);
}
drawDrawable(canvas, staticThumbDrawable, (int) (overrideAlpha * 255), thumbShader, orientation);
} }
if (crossfadeWithThumb && animationNotReady) { if (crossfadeWithThumb && animationNotReady) {
drawDrawable(canvas, drawable, (int) (overrideAlpha * 255), shaderToUse, orientation); drawDrawable(canvas, drawable, (int) (overrideAlpha * 255), shaderToUse, orientation);
@ -1446,11 +1462,17 @@ public class ImageReceiver implements NotificationCenter.NotificationCenterDeleg
thumbShaderToUse = thumbShader; thumbShaderToUse = thumbShader;
} else if (staticThumbDrawable != null) { } else if (staticThumbDrawable != null) {
thumbDrawable = staticThumbDrawable; thumbDrawable = staticThumbDrawable;
if (useRoundForThumb && thumbShader == null) {
updateDrawableRadius(staticThumbDrawable);
}
thumbShaderToUse = thumbShader; thumbShaderToUse = thumbShader;
} }
} else if (drawable == currentThumbDrawable || drawable == crossfadeImage) { } else if (drawable == currentThumbDrawable || drawable == crossfadeImage) {
if (staticThumbDrawable != null) { if (staticThumbDrawable != null) {
thumbDrawable = staticThumbDrawable; thumbDrawable = staticThumbDrawable;
if (useRoundForThumb && thumbShader == null) {
updateDrawableRadius(staticThumbDrawable);
}
thumbShaderToUse = thumbShader; thumbShaderToUse = thumbShader;
} }
} else if (drawable == staticThumbDrawable) { } else if (drawable == staticThumbDrawable) {
@ -1900,12 +1922,10 @@ public class ImageReceiver implements NotificationCenter.NotificationCenterDeleg
if (currentMediaDrawable != null && mediaShader == null) { if (currentMediaDrawable != null && mediaShader == null) {
updateDrawableRadius(currentMediaDrawable); updateDrawableRadius(currentMediaDrawable);
} }
if (thumbShader == null) { if (currentThumbDrawable != null) {
if (currentThumbDrawable != null) { updateDrawableRadius(currentThumbDrawable);
updateDrawableRadius(currentThumbDrawable); } else if (staticThumbDrawable != null) {
} else if (staticThumbDrawable != null) { updateDrawableRadius(staticThumbDrawable);
updateDrawableRadius(staticThumbDrawable);
}
} }
} }
} }
@ -2199,6 +2219,9 @@ public class ImageReceiver implements NotificationCenter.NotificationCenterDeleg
if (drawable instanceof AnimatedFileDrawable) { if (drawable instanceof AnimatedFileDrawable) {
AnimatedFileDrawable fileDrawable = (AnimatedFileDrawable) drawable; AnimatedFileDrawable fileDrawable = (AnimatedFileDrawable) drawable;
fileDrawable.setUseSharedQueue(useSharedAnimationQueue); fileDrawable.setUseSharedQueue(useSharedAnimationQueue);
if (attachedToWindow) {
fileDrawable.addParent(parentView);
}
if (allowStartAnimation && currentOpenedLayerFlags == 0) { if (allowStartAnimation && currentOpenedLayerFlags == 0) {
fileDrawable.start(); fileDrawable.start();
} }
@ -2262,6 +2285,10 @@ public class ImageReceiver implements NotificationCenter.NotificationCenterDeleg
RLottieDrawable lottieDrawable = (RLottieDrawable) image; RLottieDrawable lottieDrawable = (RLottieDrawable) image;
lottieDrawable.removeParentView(parentView); lottieDrawable.removeParentView(parentView);
} }
if (image instanceof AnimatedFileDrawable) {
AnimatedFileDrawable lottieDrawable = (AnimatedFileDrawable) image;
lottieDrawable.removeParent(parentView);
}
if (key != null && (newKey == null || !newKey.equals(key)) && image != null) { if (key != null && (newKey == null || !newKey.equals(key)) && image != null) {
if (image instanceof RLottieDrawable) { if (image instanceof RLottieDrawable) {
RLottieDrawable fileDrawable = (RLottieDrawable) image; RLottieDrawable fileDrawable = (RLottieDrawable) image;

View File

@ -4993,12 +4993,16 @@ public class MessageObject {
return FileLoader.getDocumentFileName(getDocument()); return FileLoader.getDocumentFileName(getDocument());
} }
public static boolean isVideoSticker(TLRPC.Document document) { public static boolean isWebM(TLRPC.Document document) {
return document != null && "video/webm".equals(document.mime_type); return document != null && "video/webm".equals(document.mime_type);
} }
public static boolean isVideoSticker(TLRPC.Document document) {
return document != null && isVideoStickerDocument(document);
}
public boolean isVideoSticker() { public boolean isVideoSticker() {
return getDocument() != null && "video/webm".equals(getDocument().mime_type); return getDocument() != null && isVideoStickerDocument(getDocument());
} }
public static boolean isStickerDocument(TLRPC.Document document) { public static boolean isStickerDocument(TLRPC.Document document) {
@ -5013,6 +5017,18 @@ public class MessageObject {
return false; return false;
} }
public static boolean isVideoStickerDocument(TLRPC.Document document) {
if (document != null) {
for (int a = 0; a < document.attributes.size(); a++) {
TLRPC.DocumentAttribute attribute = document.attributes.get(a);
if (attribute instanceof TLRPC.TL_documentAttributeSticker) {
return "video/webm".equals(document.mime_type);
}
}
}
return false;
}
public static boolean isStickerHasSet(TLRPC.Document document) { public static boolean isStickerHasSet(TLRPC.Document document) {
if (document != null) { if (document != null) {
for (int a = 0; a < document.attributes.size(); a++) { for (int a = 0; a < document.attributes.size(); a++) {

View File

@ -368,7 +368,7 @@ public class MessagesController extends BaseController implements NotificationCe
getConnectionsManager().sendRequest(req, (response, error) -> AndroidUtilities.runOnUIThread(() -> { getConnectionsManager().sendRequest(req, (response, error) -> AndroidUtilities.runOnUIThread(() -> {
TLRPC.messages_Messages res = (TLRPC.messages_Messages) response; TLRPC.messages_Messages res = (TLRPC.messages_Messages) response;
int messageId = 0; int messageId = 0;
if (error != null && !res.messages.isEmpty()) { if (error != null && res != null && res.messages != null && !res.messages.isEmpty()) {
messageId = res.messages.get(0).id; messageId = res.messages.get(0).id;
} }
int finalMessageId = messageId; int finalMessageId = messageId;

View File

@ -995,6 +995,7 @@ public class ChatMessageCell extends BaseCell implements SeekBar.SeekBarDelegate
contactAvatarDrawable = new AvatarDrawable(); contactAvatarDrawable = new AvatarDrawable();
photoImage = new ImageReceiver(this); photoImage = new ImageReceiver(this);
photoImage.setUseRoundForThumbDrawable(true);
photoImage.setDelegate(this); photoImage.setDelegate(this);
radialProgress = new RadialProgress2(this, resourcesProvider); radialProgress = new RadialProgress2(this, resourcesProvider);
videoRadialProgress = new RadialProgress2(this, resourcesProvider); videoRadialProgress = new RadialProgress2(this, resourcesProvider);
@ -4633,7 +4634,7 @@ public class ChatMessageCell extends BaseCell implements SeekBar.SeekBarDelegate
photoImage.setImage(ImageLocation.getForDocument(documentAttach), ImageLoader.AUTOPLAY_FILTER, ImageLocation.getForObject(currentPhotoObject, photoParentObject), currentPhotoFilter, ImageLocation.getForDocument(currentPhotoObjectThumb, documentAttach), currentPhotoFilterThumb, currentPhotoObjectThumbStripped, documentAttach.size, null, messageObject, 0); photoImage.setImage(ImageLocation.getForDocument(documentAttach), ImageLoader.AUTOPLAY_FILTER, ImageLocation.getForObject(currentPhotoObject, photoParentObject), currentPhotoFilter, ImageLocation.getForDocument(currentPhotoObjectThumb, documentAttach), currentPhotoFilterThumb, currentPhotoObjectThumbStripped, documentAttach.size, null, messageObject, 0);
autoPlayingMedia = true; autoPlayingMedia = true;
} else { } else {
if (currentPhotoObjectThumb != null) { if (currentPhotoObjectThumb != null || currentPhotoObjectThumbStripped != null) {
photoImage.setImage(ImageLocation.getForObject(currentPhotoObject, photoParentObject), currentPhotoFilter, ImageLocation.getForObject(currentPhotoObjectThumb, photoParentObject), currentPhotoFilterThumb, currentPhotoObjectThumbStripped, 0, null, messageObject, 0); photoImage.setImage(ImageLocation.getForObject(currentPhotoObject, photoParentObject), currentPhotoFilter, ImageLocation.getForObject(currentPhotoObjectThumb, photoParentObject), currentPhotoFilterThumb, currentPhotoObjectThumbStripped, 0, null, messageObject, 0);
} else { } else {
photoImage.setImage(null, null, ImageLocation.getForObject(currentPhotoObject, photoParentObject), currentPhotoObject instanceof TLRPC.TL_photoStrippedSize || "s".equals(currentPhotoObject.type) ? currentPhotoFilterThumb : currentPhotoFilter, currentPhotoObjectThumbStripped, 0, null, messageObject, 0); photoImage.setImage(null, null, ImageLocation.getForObject(currentPhotoObject, photoParentObject), currentPhotoObject instanceof TLRPC.TL_photoStrippedSize || "s".equals(currentPhotoObject.type) ? currentPhotoFilterThumb : currentPhotoFilter, currentPhotoObjectThumbStripped, 0, null, messageObject, 0);
@ -4669,7 +4670,7 @@ public class ChatMessageCell extends BaseCell implements SeekBar.SeekBarDelegate
photoImage.setImage(ImageLocation.getForObject(currentPhotoObject, photoParentObject), currentPhotoFilter, ImageLocation.getForObject(currentPhotoObjectThumb, photoParentObject), currentPhotoFilterThumb, currentPhotoObjectThumbStripped, 0, null, messageObject, 0); photoImage.setImage(ImageLocation.getForObject(currentPhotoObject, photoParentObject), currentPhotoFilter, ImageLocation.getForObject(currentPhotoObjectThumb, photoParentObject), currentPhotoFilterThumb, currentPhotoObjectThumbStripped, 0, null, messageObject, 0);
} else { } else {
photoNotSet = true; photoNotSet = true;
if (currentPhotoObjectThumb != null) { if (currentPhotoObjectThumb != null || currentPhotoObjectThumbStripped != null) {
photoImage.setImage(null, null, ImageLocation.getForObject(currentPhotoObjectThumb, photoParentObject), String.format(Locale.US, "%d_%d_b", w, h), currentPhotoObjectThumbStripped, 0, null, messageObject, 0); photoImage.setImage(null, null, ImageLocation.getForObject(currentPhotoObjectThumb, photoParentObject), String.format(Locale.US, "%d_%d_b", w, h), currentPhotoObjectThumbStripped, 0, null, messageObject, 0);
} else { } else {
photoImage.setImageBitmap((Drawable) null); photoImage.setImageBitmap((Drawable) null);
@ -6178,7 +6179,7 @@ public class ChatMessageCell extends BaseCell implements SeekBar.SeekBarDelegate
photoImage.setImage(ImageLocation.getForObject(currentPhotoObject, photoParentObject), currentPhotoFilter, ImageLocation.getForObject(currentPhotoObjectThumb, photoParentObject), currentPhotoFilterThumb, currentPhotoObjectThumbStripped, currentPhotoObject.size, null, currentMessageObject, currentMessageObject.shouldEncryptPhotoOrVideo() ? 2 : 0); photoImage.setImage(ImageLocation.getForObject(currentPhotoObject, photoParentObject), currentPhotoFilter, ImageLocation.getForObject(currentPhotoObjectThumb, photoParentObject), currentPhotoFilterThumb, currentPhotoObjectThumbStripped, currentPhotoObject.size, null, currentMessageObject, currentMessageObject.shouldEncryptPhotoOrVideo() ? 2 : 0);
} else { } else {
photoNotSet = true; photoNotSet = true;
if (currentPhotoObjectThumb != null) { if (currentPhotoObjectThumb != null || currentPhotoObjectThumbStripped != null) {
photoImage.setImage(null, null, ImageLocation.getForObject(currentPhotoObjectThumb, photoParentObject), currentPhotoFilterThumb, currentPhotoObjectThumbStripped, 0, null, currentMessageObject, currentMessageObject.shouldEncryptPhotoOrVideo() ? 2 : 0); photoImage.setImage(null, null, ImageLocation.getForObject(currentPhotoObjectThumb, photoParentObject), currentPhotoFilterThumb, currentPhotoObjectThumbStripped, 0, null, currentMessageObject, currentMessageObject.shouldEncryptPhotoOrVideo() ? 2 : 0);
} else { } else {
photoImage.setImageBitmap((Drawable) null); photoImage.setImageBitmap((Drawable) null);

View File

@ -29,14 +29,6 @@ import android.graphics.drawable.Drawable;
import android.net.Uri; import android.net.Uri;
import android.os.Build; import android.os.Build;
import android.os.Bundle; import android.os.Bundle;
import androidx.collection.LongSparseArray;
import androidx.core.content.FileProvider;
import androidx.recyclerview.widget.ChatListItemAnimator;
import androidx.recyclerview.widget.LinearLayoutManager;
import androidx.recyclerview.widget.LinearSmoothScrollerCustom;
import androidx.recyclerview.widget.RecyclerView;
import android.text.TextUtils; import android.text.TextUtils;
import android.text.style.CharacterStyle; import android.text.style.CharacterStyle;
import android.text.style.URLSpan; import android.text.style.URLSpan;
@ -55,6 +47,13 @@ import android.widget.ImageView;
import android.widget.TextView; import android.widget.TextView;
import android.widget.Toast; import android.widget.Toast;
import androidx.collection.LongSparseArray;
import androidx.core.content.FileProvider;
import androidx.recyclerview.widget.ChatListItemAnimator;
import androidx.recyclerview.widget.LinearLayoutManager;
import androidx.recyclerview.widget.LinearSmoothScrollerCustom;
import androidx.recyclerview.widget.RecyclerView;
import com.google.android.exoplayer2.ui.AspectRatioFrameLayout; import com.google.android.exoplayer2.ui.AspectRatioFrameLayout;
import org.telegram.messenger.AndroidUtilities; import org.telegram.messenger.AndroidUtilities;
@ -62,13 +61,13 @@ import org.telegram.messenger.BuildConfig;
import org.telegram.messenger.BuildVars; import org.telegram.messenger.BuildVars;
import org.telegram.messenger.ChatObject; import org.telegram.messenger.ChatObject;
import org.telegram.messenger.ContactsController; import org.telegram.messenger.ContactsController;
import org.telegram.messenger.ImageLocation;
import org.telegram.messenger.MediaDataController;
import org.telegram.messenger.FileLoader; import org.telegram.messenger.FileLoader;
import org.telegram.messenger.FileLog; import org.telegram.messenger.FileLog;
import org.telegram.messenger.ImageLocation;
import org.telegram.messenger.ImageReceiver; import org.telegram.messenger.ImageReceiver;
import org.telegram.messenger.LocaleController; import org.telegram.messenger.LocaleController;
import org.telegram.messenger.MediaController; import org.telegram.messenger.MediaController;
import org.telegram.messenger.MediaDataController;
import org.telegram.messenger.MessageObject; import org.telegram.messenger.MessageObject;
import org.telegram.messenger.MessagesController; import org.telegram.messenger.MessagesController;
import org.telegram.messenger.NotificationCenter; import org.telegram.messenger.NotificationCenter;
@ -689,6 +688,8 @@ public class ChannelAdminLogActivity extends BaseFragment implements Notificatio
childTop -= AndroidUtilities.dp(24) - (actionBar.getVisibility() == VISIBLE ? actionBar.getMeasuredHeight() / 2 : 0); childTop -= AndroidUtilities.dp(24) - (actionBar.getVisibility() == VISIBLE ? actionBar.getMeasuredHeight() / 2 : 0);
} else if (child == actionBar) { } else if (child == actionBar) {
childTop -= getPaddingTop(); childTop -= getPaddingTop();
} else if (child == backgroundView) {
childTop = 0;
} }
child.layout(childLeft, childTop, childLeft + width, childTop + height); child.layout(childLeft, childTop, childLeft + width, childTop + height);
} }

View File

@ -1442,7 +1442,7 @@ public class ChatActivity extends BaseFragment implements NotificationCenter.Not
return false; return false;
} }
ChatMessageCell cell = (ChatMessageCell) view; ChatMessageCell cell = (ChatMessageCell) view;
return !cell.getMessageObject().isSending() && !cell.getMessageObject().isEditing() && cell.getMessageObject().type != 16 && !actionBar.isActionModeShowed() && !isSecretChat() && !isInScheduleMode(); return !cell.getMessageObject().isSending() && !cell.getMessageObject().isEditing() && cell.getMessageObject().type != 16 && !actionBar.isActionModeShowed() && !isSecretChat() && !isInScheduleMode() && !cell.getMessageObject().isSponsored();
} }
@Override @Override
@ -1454,7 +1454,7 @@ public class ChatActivity extends BaseFragment implements NotificationCenter.Not
MessageObject primaryMessage = cell.getPrimaryMessageObject(); MessageObject primaryMessage = cell.getPrimaryMessageObject();
ReactionsEffectOverlay.removeCurrent(false); ReactionsEffectOverlay.removeCurrent(false);
TLRPC.TL_availableReaction reaction = getMediaDataController().getReactionsMap().get(getMediaDataController().getDoubleTapReaction()); TLRPC.TL_availableReaction reaction = getMediaDataController().getReactionsMap().get(getMediaDataController().getDoubleTapReaction());
if (reaction == null) { if (reaction == null || cell.getMessageObject().isSponsored()) {
return; return;
} }
boolean available = dialog_id >= 0; boolean available = dialog_id >= 0;
@ -7119,8 +7119,6 @@ public class ChatActivity extends BaseFragment implements NotificationCenter.Not
undoView.showWithAction(0, Math.abs(value - 1.0f) > 0.001f ? UndoView.ACTION_PLAYBACK_SPEED_ENABLED : UndoView.ACTION_PLAYBACK_SPEED_DISABLED, value, null, null); undoView.showWithAction(0, Math.abs(value - 1.0f) > 0.001f ? UndoView.ACTION_PLAYBACK_SPEED_ENABLED : UndoView.ACTION_PLAYBACK_SPEED_DISABLED, value, null, null);
} }
} }
}; };
contentView.addView(fragmentLocationContextView, LayoutHelper.createFrame(LayoutHelper.MATCH_PARENT, 38, Gravity.TOP | Gravity.LEFT, 0, -36, 0, 0)); contentView.addView(fragmentLocationContextView, LayoutHelper.createFrame(LayoutHelper.MATCH_PARENT, 38, Gravity.TOP | Gravity.LEFT, 0, -36, 0, 0));
contentView.addView(fragmentContextView, LayoutHelper.createFrame(LayoutHelper.MATCH_PARENT, 38, Gravity.TOP | Gravity.LEFT, 0, -36, 0, 0)); contentView.addView(fragmentContextView, LayoutHelper.createFrame(LayoutHelper.MATCH_PARENT, 38, Gravity.TOP | Gravity.LEFT, 0, -36, 0, 0));

View File

@ -125,13 +125,15 @@ public class AnimatedFileDrawable extends BitmapDrawable implements Animatable {
private View parentView; private View parentView;
private ArrayList<View> secondParentViews = new ArrayList<>(); private ArrayList<View> secondParentViews = new ArrayList<>();
private ArrayList<View> parents = new ArrayList<>();
private AnimatedFileDrawableStream stream; private AnimatedFileDrawableStream stream;
private boolean useSharedQueue; private boolean useSharedQueue;
private boolean invalidatePath = true; private boolean invalidatePath = true;
private boolean invalidateTaskIsRunning; private boolean invalidateTaskIsRunning;
private static ScheduledThreadPoolExecutor executor = new ScheduledThreadPoolExecutor(16, new ThreadPoolExecutor.DiscardPolicy()); private static ScheduledThreadPoolExecutor executor = new ScheduledThreadPoolExecutor(8, new ThreadPoolExecutor.DiscardPolicy());
protected final Runnable mInvalidateTask = () -> { protected final Runnable mInvalidateTask = () -> {
invalidateTaskIsRunning = false; invalidateTaskIsRunning = false;
@ -244,14 +246,7 @@ public class AnimatedFileDrawable extends BitmapDrawable implements Animatable {
destroyDecoder(nativePtr); destroyDecoder(nativePtr);
nativePtr = 0; nativePtr = 0;
} }
if (renderingHeight > 0 && renderingWidth > 0 && metaData[0] > 0 && metaData[1] > 0) { updateScaleFactor();
scaleFactor = Math.max(renderingWidth / (float) metaData[0], renderingHeight / (float) metaData[1]);
if (isWebmSticker || scaleFactor <= 0 || scaleFactor > 0.7) {
scaleFactor = 1;
}
} else {
scaleFactor = 1f;
}
decoderCreated = true; decoderCreated = true;
} }
try { try {
@ -281,10 +276,12 @@ public class AnimatedFileDrawable extends BitmapDrawable implements Animatable {
} }
if (backgroundBitmap != null) { if (backgroundBitmap != null) {
lastFrameDecodeTime = System.currentTimeMillis(); lastFrameDecodeTime = System.currentTimeMillis();
if (getVideoFrame(nativePtr, backgroundBitmap, metaData, backgroundBitmap.getRowBytes(), false, startTime, endTime) == 0) { if (getVideoFrame(nativePtr, backgroundBitmap, metaData, backgroundBitmap.getRowBytes(), false, startTime, endTime) == 0) {
AndroidUtilities.runOnUIThread(uiRunnableNoFrame); AndroidUtilities.runOnUIThread(uiRunnableNoFrame);
return; return;
} }
if (seekWas) { if (seekWas) {
lastTimeStamp = metaData[3]; lastTimeStamp = metaData[3];
} }
@ -302,6 +299,17 @@ public class AnimatedFileDrawable extends BitmapDrawable implements Animatable {
} }
}; };
private void updateScaleFactor() {
if (!isWebmSticker && renderingHeight > 0 && renderingWidth > 0 && metaData[0] > 0 && metaData[1] > 0) {
scaleFactor = Math.max(renderingWidth / (float) metaData[0], renderingHeight / (float) metaData[1]);
if (scaleFactor <= 0 || scaleFactor > 0.7) {
scaleFactor = 1;
}
} else {
scaleFactor = 1f;
}
}
private final Runnable mStartTask = () -> { private final Runnable mStartTask = () -> {
if (!secondParentViews.isEmpty()) { if (!secondParentViews.isEmpty()) {
for (int a = 0, N = secondParentViews.size(); a < N; a++) { for (int a = 0, N = secondParentViews.size(); a < N; a++) {
@ -337,14 +345,7 @@ public class AnimatedFileDrawable extends BitmapDrawable implements Animatable {
destroyDecoder(nativePtr); destroyDecoder(nativePtr);
nativePtr = 0; nativePtr = 0;
} }
if (renderingHeight > 0 && renderingWidth > 0 && metaData[0] > 0 && metaData[1] > 0) { updateScaleFactor();
scaleFactor = Math.max(renderingWidth / (float) metaData[0], renderingHeight / (float) metaData[1]);
if (isWebmSticker || scaleFactor <= 0 || scaleFactor > 0.7) {
scaleFactor = 1f;
}
} else {
scaleFactor = 1f;
}
decoderCreated = true; decoderCreated = true;
} }
if (seekTo != 0) { if (seekTo != 0) {
@ -386,6 +387,19 @@ public class AnimatedFileDrawable extends BitmapDrawable implements Animatable {
parentView = view; parentView = view;
} }
public void addParent(View view) {
if (!parents.contains(view)) {
parents.add(view);
if (isRunning) {
scheduleNextGetFrame();
}
}
}
public void removeParent(View view) {
parents.remove(view);
}
public void setInvalidateParentViewWithSecond(boolean value) { public void setInvalidateParentViewWithSecond(boolean value) {
invalidateParentViewWithSecond = value; invalidateParentViewWithSecond = value;
} }
@ -550,7 +564,7 @@ public class AnimatedFileDrawable extends BitmapDrawable implements Animatable {
} }
private void scheduleNextGetFrame() { private void scheduleNextGetFrame() {
if (loadFrameTask != null || nativePtr == 0 && decoderCreated || destroyWhenDone || !isRunning && (!decodeSingleFrame || decodeSingleFrame && singleFrameDecoded)) { if (loadFrameTask != null || nativePtr == 0 && decoderCreated || destroyWhenDone || !isRunning && (!decodeSingleFrame || decodeSingleFrame && singleFrameDecoded) || parents.size() == 0) {
return; return;
} }
long ms = 0; long ms = 0;

View File

@ -2,6 +2,7 @@ package org.telegram.ui.Components;
import android.content.Context; import android.content.Context;
import android.graphics.Canvas; import android.graphics.Canvas;
import android.graphics.Color;
import android.graphics.Paint; import android.graphics.Paint;
import android.view.View; import android.view.View;
import android.widget.FrameLayout; import android.widget.FrameLayout;
@ -16,7 +17,7 @@ public class ChatBlurredFrameLayout extends FrameLayout {
ChatActivity chatActivity; ChatActivity chatActivity;
protected Paint backgroundPaint; protected Paint backgroundPaint;
public int backgroundColor; public int backgroundColor = Color.TRANSPARENT;
public int backgroundPaddingBottom; public int backgroundPaddingBottom;
public int backgroundPaddingTop; public int backgroundPaddingTop;
public boolean isTopView = true; public boolean isTopView = true;
@ -29,7 +30,7 @@ public class ChatBlurredFrameLayout extends FrameLayout {
@Override @Override
protected void dispatchDraw(Canvas canvas) { protected void dispatchDraw(Canvas canvas) {
if (SharedConfig.chatBlurEnabled() && chatActivity != null && drawBlur) { if (SharedConfig.chatBlurEnabled() && chatActivity != null && drawBlur && backgroundColor != Color.TRANSPARENT) {
if (backgroundPaint == null) { if (backgroundPaint == null) {
backgroundPaint = new Paint(); backgroundPaint = new Paint();
} }

View File

@ -75,6 +75,7 @@ import org.telegram.messenger.Emoji;
import org.telegram.messenger.EmojiData; import org.telegram.messenger.EmojiData;
import org.telegram.messenger.FileLoader; import org.telegram.messenger.FileLoader;
import org.telegram.messenger.FileLog; import org.telegram.messenger.FileLog;
import org.telegram.messenger.ImageLoader;
import org.telegram.messenger.ImageLocation; import org.telegram.messenger.ImageLocation;
import org.telegram.messenger.ImageReceiver; import org.telegram.messenger.ImageReceiver;
import org.telegram.messenger.LocaleController; import org.telegram.messenger.LocaleController;
@ -4053,7 +4054,7 @@ public class EmojiView extends FrameLayout implements NotificationCenter.Notific
if (svgThumb != null) { if (svgThumb != null) {
svgThumb.overrideWidthAndHeight(512, 512); svgThumb.overrideWidthAndHeight(512, 512);
} }
if (object == null) { if (object == null || MessageObject.isVideoSticker(document)) {
object = document; object = document;
} }
@ -4071,7 +4072,7 @@ public class EmojiView extends FrameLayout implements NotificationCenter.Notific
if (imageLocation == null) { if (imageLocation == null) {
return; return;
} }
if (object instanceof TLRPC.Document && MessageObject.isAnimatedStickerDocument(document, true)) { if (object instanceof TLRPC.Document && (MessageObject.isAnimatedStickerDocument(document, true) || MessageObject.isVideoSticker(document))) {
if (svgThumb != null) { if (svgThumb != null) {
imageView.setImage(ImageLocation.getForDocument(document), "30_30", svgThumb, 0, set); imageView.setImage(ImageLocation.getForDocument(document), "30_30", svgThumb, 0, set);
} else { } else {

View File

@ -17,6 +17,7 @@ import android.content.Context;
import android.content.DialogInterface; import android.content.DialogInterface;
import android.content.Intent; import android.content.Intent;
import android.graphics.Canvas; import android.graphics.Canvas;
import android.graphics.Color;
import android.graphics.LinearGradient; import android.graphics.LinearGradient;
import android.graphics.Matrix; import android.graphics.Matrix;
import android.graphics.Paint; import android.graphics.Paint;
@ -932,6 +933,7 @@ public class FragmentContextView extends FrameLayout implements NotificationCent
muteDrawable.setCurrentFrame(muteDrawable.getCustomEndFrame() - 1, false, true); muteDrawable.setCurrentFrame(muteDrawable.getCustomEndFrame() - 1, false, true);
muteButton.invalidate(); muteButton.invalidate();
frameLayout.setBackground(null); frameLayout.setBackground(null);
frameLayout.setBackgroundColor(Color.TRANSPARENT);
importingImageView.setVisibility(GONE); importingImageView.setVisibility(GONE);
importingImageView.stopAnimation(); importingImageView.stopAnimation();
Theme.getFragmentContextViewWavesDrawable().addParent(this); Theme.getFragmentContextViewWavesDrawable().addParent(this);

View File

@ -277,7 +277,11 @@ public class ReactedUsersListView extends FrameLayout {
if (r != null) { if (r != null) {
SvgHelper.SvgDrawable svgThumb = DocumentObject.getSvgThumb(r.static_icon.thumbs, Theme.key_windowBackgroundGray, 1.0f); SvgHelper.SvgDrawable svgThumb = DocumentObject.getSvgThumb(r.static_icon.thumbs, Theme.key_windowBackgroundGray, 1.0f);
reactView.setImage(ImageLocation.getForDocument(r.static_icon), "50_50", "webp", svgThumb, r); reactView.setImage(ImageLocation.getForDocument(r.static_icon), "50_50", "webp", svgThumb, r);
} else {
reactView.setImageDrawable(null);
} }
} else {
reactView.setImageDrawable(null);
} }
} }

View File

@ -631,7 +631,7 @@ public class ContentPreviewViewer {
public void setParentActivity(Activity activity) { public void setParentActivity(Activity activity) {
currentAccount = UserConfig.selectedAccount; currentAccount = UserConfig.selectedAccount;
centerImage.setCurrentAccount(currentAccount); centerImage.setCurrentAccount(currentAccount);
centerImage.setLayerNum(7); centerImage.setLayerNum(Integer.MAX_VALUE);
if (parentActivity == activity) { if (parentActivity == activity) {
return; return;
} }
@ -650,7 +650,19 @@ public class ContentPreviewViewer {
}); });
} }
containerView = new FrameLayoutDrawer(activity); containerView = new FrameLayoutDrawer(activity) {
@Override
protected void onAttachedToWindow() {
super.onAttachedToWindow();
centerImage.onAttachedToWindow();
}
@Override
protected void onDetachedFromWindow() {
super.onDetachedFromWindow();
centerImage.onDetachedFromWindow();
}
};
containerView.setFocusable(false); containerView.setFocusable(false);
windowView.addView(containerView, LayoutHelper.createFrame(LayoutHelper.MATCH_PARENT, LayoutHelper.MATCH_PARENT, Gravity.TOP | Gravity.LEFT)); windowView.addView(containerView, LayoutHelper.createFrame(LayoutHelper.MATCH_PARENT, LayoutHelper.MATCH_PARENT, Gravity.TOP | Gravity.LEFT));
containerView.setOnTouchListener((v, event) -> { containerView.setOnTouchListener((v, event) -> {
@ -960,4 +972,5 @@ public class ContentPreviewViewer {
Integer color = resourcesProvider != null ? resourcesProvider.getColor(key) : null; Integer color = resourcesProvider != null ? resourcesProvider.getColor(key) : null;
return color != null ? color : Theme.getColor(key); return color != null ? color : Theme.getColor(key);
} }
} }