Java Code Examples for org.telegram.ui.Components.AnimatedFileDrawable#getAnimatedBitmap()

The following examples show how to use org.telegram.ui.Components.AnimatedFileDrawable#getAnimatedBitmap() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: ImageReceiver.java    From Telegram-FOSS with GNU General Public License v2.0 6 votes vote down vote up
public Bitmap getBitmap() {
    AnimatedFileDrawable animation = getAnimation();
    RLottieDrawable lottieDrawable = getLottieAnimation();
    if (lottieDrawable != null && lottieDrawable.hasBitmap()) {
        return lottieDrawable.getAnimatedBitmap();
    } else if (animation != null && animation.hasBitmap()) {
        return animation.getAnimatedBitmap();
    } else if (currentMediaDrawable instanceof BitmapDrawable && !(currentMediaDrawable instanceof AnimatedFileDrawable) && !(currentMediaDrawable instanceof RLottieDrawable)) {
        return ((BitmapDrawable) currentMediaDrawable).getBitmap();
    } else if (currentImageDrawable instanceof BitmapDrawable && !(currentImageDrawable instanceof AnimatedFileDrawable) && !(currentMediaDrawable instanceof RLottieDrawable)) {
        return ((BitmapDrawable) currentImageDrawable).getBitmap();
    } else if (currentThumbDrawable instanceof BitmapDrawable && !(currentThumbDrawable instanceof AnimatedFileDrawable) && !(currentMediaDrawable instanceof RLottieDrawable)) {
        return ((BitmapDrawable) currentThumbDrawable).getBitmap();
    } else if (staticThumbDrawable instanceof BitmapDrawable) {
        return ((BitmapDrawable) staticThumbDrawable).getBitmap();
    }
    return null;
}
 
Example 2
Source File: ImageReceiver.java    From Telegram-FOSS with GNU General Public License v2.0 6 votes vote down vote up
public BitmapHolder getBitmapSafe() {
    Bitmap bitmap = null;
    String key = null;
    AnimatedFileDrawable animation = getAnimation();
    RLottieDrawable lottieDrawable = getLottieAnimation();
    if (lottieDrawable != null && lottieDrawable.hasBitmap()) {
        bitmap = lottieDrawable.getAnimatedBitmap();
    } else if (animation != null && animation.hasBitmap()) {
        bitmap = animation.getAnimatedBitmap();
    } else if (currentMediaDrawable instanceof BitmapDrawable && !(currentMediaDrawable instanceof AnimatedFileDrawable) && !(currentMediaDrawable instanceof RLottieDrawable)) {
        bitmap = ((BitmapDrawable) currentMediaDrawable).getBitmap();
        key = currentMediaKey;
    } else if (currentImageDrawable instanceof BitmapDrawable && !(currentImageDrawable instanceof AnimatedFileDrawable) && !(currentMediaDrawable instanceof RLottieDrawable)) {
        bitmap = ((BitmapDrawable) currentImageDrawable).getBitmap();
        key = currentImageKey;
    } else if (currentThumbDrawable instanceof BitmapDrawable && !(currentThumbDrawable instanceof AnimatedFileDrawable) && !(currentMediaDrawable instanceof RLottieDrawable)) {
        bitmap = ((BitmapDrawable) currentThumbDrawable).getBitmap();
        key = currentThumbKey;
    } else if (staticThumbDrawable instanceof BitmapDrawable) {
        bitmap = ((BitmapDrawable) staticThumbDrawable).getBitmap();
    }
    if (bitmap != null) {
        return new BitmapHolder(bitmap, key);
    }
    return null;
}
 
Example 3
Source File: ImageReceiver.java    From Telegram with GNU General Public License v2.0 6 votes vote down vote up
public Bitmap getBitmap() {
    AnimatedFileDrawable animation = getAnimation();
    RLottieDrawable lottieDrawable = getLottieAnimation();
    if (lottieDrawable != null && lottieDrawable.hasBitmap()) {
        return lottieDrawable.getAnimatedBitmap();
    } else if (animation != null && animation.hasBitmap()) {
        return animation.getAnimatedBitmap();
    } else if (currentMediaDrawable instanceof BitmapDrawable && !(currentMediaDrawable instanceof AnimatedFileDrawable) && !(currentMediaDrawable instanceof RLottieDrawable)) {
        return ((BitmapDrawable) currentMediaDrawable).getBitmap();
    } else if (currentImageDrawable instanceof BitmapDrawable && !(currentImageDrawable instanceof AnimatedFileDrawable) && !(currentMediaDrawable instanceof RLottieDrawable)) {
        return ((BitmapDrawable) currentImageDrawable).getBitmap();
    } else if (currentThumbDrawable instanceof BitmapDrawable && !(currentThumbDrawable instanceof AnimatedFileDrawable) && !(currentMediaDrawable instanceof RLottieDrawable)) {
        return ((BitmapDrawable) currentThumbDrawable).getBitmap();
    } else if (staticThumbDrawable instanceof BitmapDrawable) {
        return ((BitmapDrawable) staticThumbDrawable).getBitmap();
    }
    return null;
}
 
Example 4
Source File: ImageReceiver.java    From Telegram with GNU General Public License v2.0 6 votes vote down vote up
public BitmapHolder getBitmapSafe() {
    Bitmap bitmap = null;
    String key = null;
    AnimatedFileDrawable animation = getAnimation();
    RLottieDrawable lottieDrawable = getLottieAnimation();
    if (lottieDrawable != null && lottieDrawable.hasBitmap()) {
        bitmap = lottieDrawable.getAnimatedBitmap();
    } else if (animation != null && animation.hasBitmap()) {
        bitmap = animation.getAnimatedBitmap();
    } else if (currentMediaDrawable instanceof BitmapDrawable && !(currentMediaDrawable instanceof AnimatedFileDrawable) && !(currentMediaDrawable instanceof RLottieDrawable)) {
        bitmap = ((BitmapDrawable) currentMediaDrawable).getBitmap();
        key = currentMediaKey;
    } else if (currentImageDrawable instanceof BitmapDrawable && !(currentImageDrawable instanceof AnimatedFileDrawable) && !(currentMediaDrawable instanceof RLottieDrawable)) {
        bitmap = ((BitmapDrawable) currentImageDrawable).getBitmap();
        key = currentImageKey;
    } else if (currentThumbDrawable instanceof BitmapDrawable && !(currentThumbDrawable instanceof AnimatedFileDrawable) && !(currentMediaDrawable instanceof RLottieDrawable)) {
        bitmap = ((BitmapDrawable) currentThumbDrawable).getBitmap();
        key = currentThumbKey;
    } else if (staticThumbDrawable instanceof BitmapDrawable) {
        bitmap = ((BitmapDrawable) staticThumbDrawable).getBitmap();
    }
    if (bitmap != null) {
        return new BitmapHolder(bitmap, key);
    }
    return null;
}