本文整理汇总了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);
}
});
}
});
}
示例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;
}
示例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();
}
示例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();
}
示例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);
}
}
示例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;
}
}
示例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;
}
示例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();
}
示例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();
}
示例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;
}
}
示例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;
}
示例12: startAnimation
import org.telegram.ui.Components.AnimatedFileDrawable; //导入依赖的package包/类
public void startAnimation() {
if (currentImage instanceof AnimatedFileDrawable) {
((AnimatedFileDrawable) currentImage).start();
}
}
示例13: stopAnimation
import org.telegram.ui.Components.AnimatedFileDrawable; //导入依赖的package包/类
public void stopAnimation() {
if (currentImage instanceof AnimatedFileDrawable) {
((AnimatedFileDrawable) currentImage).stop();
}
}
示例14: isAnimationRunning
import org.telegram.ui.Components.AnimatedFileDrawable; //导入依赖的package包/类
public boolean isAnimationRunning() {
return currentImage instanceof AnimatedFileDrawable && ((AnimatedFileDrawable) currentImage).isRunning();
}
示例15: getAnimation
import org.telegram.ui.Components.AnimatedFileDrawable; //导入依赖的package包/类
public AnimatedFileDrawable getAnimation() {
return currentImage instanceof AnimatedFileDrawable ? (AnimatedFileDrawable) currentImage : null;
}