当前位置: 首页>>代码示例>>Java>>正文


Java AnimatedFileDrawable类代码示例

本文整理汇总了Java中org.telegram.ui.Components.AnimatedFileDrawable的典型用法代码示例。如果您正苦于以下问题:Java AnimatedFileDrawable类的具体用法?Java AnimatedFileDrawable怎么用?Java AnimatedFileDrawable使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


AnimatedFileDrawable类属于org.telegram.ui.Components包,在下文中一共展示了AnimatedFileDrawable类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: onPostExecute

import org.telegram.ui.Components.AnimatedFileDrawable; //导入依赖的package包/类
private void onPostExecute(final BitmapDrawable bitmapDrawable) {
    AndroidUtilities.runOnUIThread(new Runnable() {
        @Override
        public void run() {
            BitmapDrawable toSet = null;
            if (bitmapDrawable instanceof AnimatedFileDrawable) {
                toSet = bitmapDrawable;
            } else if (bitmapDrawable != null) {
                toSet = memCache.get(cacheImage.key);
                if (toSet == null) {
                    memCache.put(cacheImage.key, bitmapDrawable);
                    toSet = bitmapDrawable;
                } else {
                    Bitmap image = bitmapDrawable.getBitmap();
                    image.recycle();
                }
            }
            final BitmapDrawable toSetFinal = toSet;
            imageLoadQueue.postRunnable(new Runnable() {
                @Override
                public void run() {
                    cacheImage.setImageAndClear(toSetFinal);
                }
            });
        }
    });
}
 
开发者ID:MLNO,项目名称:airgram,代码行数:28,代码来源:ImageLoader.java

示例2: getBitmap

import org.telegram.ui.Components.AnimatedFileDrawable; //导入依赖的package包/类
public Bitmap getBitmap() {
    if (currentImage instanceof AnimatedFileDrawable) {
        return ((AnimatedFileDrawable) currentImage).getAnimatedBitmap();
    } else if (staticThumb instanceof AnimatedFileDrawable) {
        return ((AnimatedFileDrawable) staticThumb).getAnimatedBitmap();
    } else if (currentImage instanceof BitmapDrawable) {
        return ((BitmapDrawable) currentImage).getBitmap();
    } else if (currentThumb instanceof BitmapDrawable) {
        return ((BitmapDrawable) currentThumb).getBitmap();
    } else if (staticThumb instanceof BitmapDrawable) {
        return ((BitmapDrawable) staticThumb).getBitmap();
    }
    return null;
}
 
开发者ID:MLNO,项目名称:airgram,代码行数:15,代码来源:ImageReceiver.java

示例3: getBitmapWidth

import org.telegram.ui.Components.AnimatedFileDrawable; //导入依赖的package包/类
public int getBitmapWidth() {
    if (currentImage instanceof AnimatedFileDrawable) {
        return orientation % 360 == 0 || orientation % 360 == 180 ? currentImage.getIntrinsicWidth() : currentImage.getIntrinsicHeight();
    } else if (staticThumb instanceof AnimatedFileDrawable) {
        return orientation % 360 == 0 || orientation % 360 == 180 ? staticThumb.getIntrinsicWidth() : staticThumb.getIntrinsicHeight();
    }
    Bitmap bitmap = getBitmap();
    return orientation % 360 == 0 || orientation % 360 == 180 ? bitmap.getWidth() : bitmap.getHeight();
}
 
开发者ID:MLNO,项目名称:airgram,代码行数:10,代码来源:ImageReceiver.java

示例4: getBitmapHeight

import org.telegram.ui.Components.AnimatedFileDrawable; //导入依赖的package包/类
public int getBitmapHeight() {
    if (currentImage instanceof AnimatedFileDrawable) {
        return orientation % 360 == 0 || orientation % 360 == 180 ? currentImage.getIntrinsicHeight() : currentImage.getIntrinsicWidth();
    } else if (staticThumb instanceof AnimatedFileDrawable) {
        return orientation % 360 == 0 || orientation % 360 == 180 ? staticThumb.getIntrinsicHeight() : staticThumb.getIntrinsicWidth();
    }
    Bitmap bitmap = getBitmap();
    return orientation % 360 == 0 || orientation % 360 == 180 ? bitmap.getHeight() : bitmap.getWidth();
}
 
开发者ID:MLNO,项目名称:airgram,代码行数:10,代码来源:ImageReceiver.java

示例5: setParentView

import org.telegram.ui.Components.AnimatedFileDrawable; //导入依赖的package包/类
public void setParentView(View view) {
    parentView = view;
    if (currentImage instanceof AnimatedFileDrawable) {
        AnimatedFileDrawable fileDrawable = (AnimatedFileDrawable) currentImage;
        fileDrawable.setParentView(parentView);
    }
}
 
开发者ID:MLNO,项目名称:airgram,代码行数:8,代码来源:ImageReceiver.java

示例6: recycleBitmap

import org.telegram.ui.Components.AnimatedFileDrawable; //导入依赖的package包/类
private void recycleBitmap(String newKey, boolean thumb) {
    String key;
    Drawable image;
    if (thumb) {
        key = currentThumbKey;
        image = currentThumb;
    } else {
        key = currentKey;
        image = currentImage;
    }
    if (key != null && (newKey == null || !newKey.equals(key)) && image != null) {
        if (image instanceof AnimatedFileDrawable) {
            AnimatedFileDrawable fileDrawable = (AnimatedFileDrawable) image;
            fileDrawable.recycle();
        } else if (image instanceof BitmapDrawable) {
            Bitmap bitmap = ((BitmapDrawable) image).getBitmap();
            boolean canDelete = ImageLoader.getInstance().decrementUseCount(key);
            if (!ImageLoader.getInstance().isInCache(key)) {
                if (canDelete) {
                    bitmap.recycle();
                }
            }
        }
    }
    if (thumb) {
        currentThumb = null;
        currentThumbKey = null;
    } else {
        currentImage = null;
        currentKey = null;
    }
}
 
开发者ID:MLNO,项目名称:airgram,代码行数:33,代码来源:ImageReceiver.java

示例7: getAnimatedOrientation

import org.telegram.ui.Components.AnimatedFileDrawable; //导入依赖的package包/类
public int getAnimatedOrientation() {
    if (currentImage instanceof AnimatedFileDrawable) {
        return ((AnimatedFileDrawable) currentImage).getOrientation();
    } else if (staticThumb instanceof AnimatedFileDrawable) {
        return ((AnimatedFileDrawable) staticThumb).getOrientation();
    }
    return 0;
}
 
开发者ID:pooyafaroka,项目名称:PlusGram,代码行数:9,代码来源:ImageReceiver.java

示例8: getBitmapWidth

import org.telegram.ui.Components.AnimatedFileDrawable; //导入依赖的package包/类
public int getBitmapWidth() {
    if (currentImage instanceof AnimatedFileDrawable) {
        return orientation % 360 == 0 || orientation % 360 == 180 ? currentImage.getIntrinsicWidth() : currentImage.getIntrinsicHeight();
    } else if (staticThumb instanceof AnimatedFileDrawable) {
        return orientation % 360 == 0 || orientation % 360 == 180 ? staticThumb.getIntrinsicWidth() : staticThumb.getIntrinsicHeight();
    }
    Bitmap bitmap = getBitmap();
    if (bitmap == null) {
        if (staticThumb != null) {
            return staticThumb.getIntrinsicWidth();
        }
        return 1;
    }
    return orientation % 360 == 0 || orientation % 360 == 180 ? bitmap.getWidth() : bitmap.getHeight();
}
 
开发者ID:DrKLO,项目名称:Telegram,代码行数:16,代码来源:ImageReceiver.java

示例9: getBitmapHeight

import org.telegram.ui.Components.AnimatedFileDrawable; //导入依赖的package包/类
public int getBitmapHeight() {
    if (currentImage instanceof AnimatedFileDrawable) {
        return orientation % 360 == 0 || orientation % 360 == 180 ? currentImage.getIntrinsicHeight() : currentImage.getIntrinsicWidth();
    } else if (staticThumb instanceof AnimatedFileDrawable) {
        return orientation % 360 == 0 || orientation % 360 == 180 ? staticThumb.getIntrinsicHeight() : staticThumb.getIntrinsicWidth();
    }
    Bitmap bitmap = getBitmap();
    if (bitmap == null) {
        if (staticThumb != null) {
            return staticThumb.getIntrinsicHeight();
        }
        return 1;
    }
    return orientation % 360 == 0 || orientation % 360 == 180 ? bitmap.getHeight() : bitmap.getWidth();
}
 
开发者ID:DrKLO,项目名称:Telegram,代码行数:16,代码来源:ImageReceiver.java

示例10: recycleBitmap

import org.telegram.ui.Components.AnimatedFileDrawable; //导入依赖的package包/类
private void recycleBitmap(String newKey, int type) {
    String key;
    Drawable image;
    if (type == 2) {
        key = crossfadeKey;
        image = crossfadeImage;
    } else if (type == 1) {
        key = currentThumbKey;
        image = currentThumb;
    } else {
        key = currentKey;
        image = currentImage;
    }
    if (key != null && (newKey == null || !newKey.equals(key)) && image != null) {
        if (image instanceof AnimatedFileDrawable) {
            AnimatedFileDrawable fileDrawable = (AnimatedFileDrawable) image;
            fileDrawable.recycle();
        } else if (image instanceof BitmapDrawable) {
            Bitmap bitmap = ((BitmapDrawable) image).getBitmap();
            boolean canDelete = ImageLoader.getInstance().decrementUseCount(key);
            if (!ImageLoader.getInstance().isInCache(key)) {
                if (canDelete) {
                    bitmap.recycle();
                }
            }
        }
    }
    if (type == 2) {
        crossfadeKey = null;
        crossfadeImage = null;
    } else if (type == 1) {
        currentThumb = null;
        currentThumbKey = null;
    } else {
        currentImage = null;
        currentKey = null;
    }
}
 
开发者ID:DrKLO,项目名称:Telegram,代码行数:39,代码来源:ImageReceiver.java

示例11: draw

import org.telegram.ui.Components.AnimatedFileDrawable; //导入依赖的package包/类
public boolean draw(Canvas canvas) {
    try {
        Drawable drawable = null;
        boolean animationNotReady = currentImage instanceof AnimatedFileDrawable && !((AnimatedFileDrawable) currentImage).hasBitmap();
        boolean isThumb = false;
        if (!forcePreview && currentImage != null && !animationNotReady) {
            drawable = currentImage;
        } else if (staticThumb instanceof BitmapDrawable) {
            drawable = staticThumb;
            isThumb = true;
        } else if (currentThumb != null) {
            drawable = currentThumb;
            isThumb = true;
        }
        if (drawable != null) {
            if (crossfadeAlpha != 0) {
                if (crossfadeWithThumb && animationNotReady) {
                    drawDrawable(canvas, drawable, (int) (overrideAlpha * 255), bitmapShaderThumb);
                } else {
                    if (crossfadeWithThumb && currentAlpha != 1.0f) {
                        Drawable thumbDrawable = null;
                        if (drawable == currentImage) {
                            if (staticThumb != null) {
                                thumbDrawable = staticThumb;
                            } else if (currentThumb != null) {
                                thumbDrawable = currentThumb;
                            }
                        } else if (drawable == currentThumb) {
                            if (staticThumb != null) {
                                thumbDrawable = staticThumb;
                            }
                        }
                        if (thumbDrawable != null) {
                            drawDrawable(canvas, thumbDrawable, (int) (overrideAlpha * 255), bitmapShaderThumb);
                        }
                    }
                    drawDrawable(canvas, drawable, (int) (overrideAlpha * currentAlpha * 255), isThumb ? bitmapShaderThumb : bitmapShader);
                }
            } else {
                drawDrawable(canvas, drawable, (int) (overrideAlpha * 255), isThumb ? bitmapShaderThumb : bitmapShader);
            }

            checkAlphaAnimation(animationNotReady && crossfadeWithThumb);
            return true;
        } else if (staticThumb != null) {
            drawDrawable(canvas, staticThumb, 255, null);
            checkAlphaAnimation(animationNotReady);
            return true;
        } else {
            checkAlphaAnimation(animationNotReady);
        }
    } catch (Exception e) {
        FileLog.e("tmessages", e);
    }
    return false;
}
 
开发者ID:MLNO,项目名称:airgram,代码行数:57,代码来源:ImageReceiver.java

示例12: startAnimation

import org.telegram.ui.Components.AnimatedFileDrawable; //导入依赖的package包/类
public void startAnimation() {
    if (currentImage instanceof AnimatedFileDrawable) {
        ((AnimatedFileDrawable) currentImage).start();
    }
}
 
开发者ID:MLNO,项目名称:airgram,代码行数:6,代码来源:ImageReceiver.java

示例13: stopAnimation

import org.telegram.ui.Components.AnimatedFileDrawable; //导入依赖的package包/类
public void stopAnimation() {
    if (currentImage instanceof AnimatedFileDrawable) {
        ((AnimatedFileDrawable) currentImage).stop();
    }
}
 
开发者ID:MLNO,项目名称:airgram,代码行数:6,代码来源:ImageReceiver.java

示例14: isAnimationRunning

import org.telegram.ui.Components.AnimatedFileDrawable; //导入依赖的package包/类
public boolean isAnimationRunning() {
    return currentImage instanceof AnimatedFileDrawable && ((AnimatedFileDrawable) currentImage).isRunning();
}
 
开发者ID:MLNO,项目名称:airgram,代码行数:4,代码来源:ImageReceiver.java

示例15: getAnimation

import org.telegram.ui.Components.AnimatedFileDrawable; //导入依赖的package包/类
public AnimatedFileDrawable getAnimation() {
    return currentImage instanceof AnimatedFileDrawable ? (AnimatedFileDrawable) currentImage : null;
}
 
开发者ID:MLNO,项目名称:airgram,代码行数:4,代码来源:ImageReceiver.java


注:本文中的org.telegram.ui.Components.AnimatedFileDrawable类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。