use of com.eros.framework.extend.hook.ui.components.HookImage in project WeexErosFramework by bmfe.
the class DefaultWXImageAdapter method handleError.
private void handleError(HookWXImageView imageView) {
HookImage component = imageView.getComponent();
if (component == null)
return;
ImmutableDomObject domObject = component.getDomObject();
if (domObject == null)
return;
Bitmap bitmap = getErrorBitmap(imageView.getContext());
if (domObject.getLayoutWidth() > 0 && domObject.getLayoutHeight() > 0) {
int target = Math.min((int) (domObject.getLayoutWidth()), (int) (domObject.getLayoutHeight())) / 2;
Bitmap zoomBitmap = ImageUtil.zoomImage(bitmap, target, target);
if (zoomBitmap != null) {
imageView.drawErrorBitmap(zoomBitmap);
}
}
}
use of com.eros.framework.extend.hook.ui.components.HookImage in project WeexErosFramework by bmfe.
the class HookWXImageView method autoReleaseImage.
public void autoReleaseImage() {
if (enableBitmapAutoManage) {
if (!isBitmapReleased) {
isBitmapReleased = true;
HookImage image = getComponent();
if (image != null) {
image.autoReleaseImage();
}
}
}
}
use of com.eros.framework.extend.hook.ui.components.HookImage in project WeexErosFramework by bmfe.
the class HookWXImageView method setImageDrawable.
public void setImageDrawable(@Nullable Drawable drawable, boolean isGif) {
this.gif = isGif;
ViewGroup.LayoutParams layoutParams;
if ((layoutParams = getLayoutParams()) != null) {
Drawable wrapDrawable = ImageDrawable.createImageDrawable(drawable, getScaleType(), borderRadius, layoutParams.width - getPaddingLeft() - getPaddingRight(), layoutParams.height - getPaddingTop() - getPaddingBottom(), isGif);
if (wrapDrawable instanceof ImageDrawable) {
ImageDrawable imageDrawable = (ImageDrawable) wrapDrawable;
if (!Arrays.equals(imageDrawable.getCornerRadii(), borderRadius)) {
imageDrawable.setCornerRadii(borderRadius);
}
}
if (wrapDrawable instanceof GifDrawable) {
if (mGifBorderRadius == null) {
mGifBorderRadius = new float[] { 0, 0, 0, 0, 0, 0, 0, 0 };
}
if (!Arrays.equals(borderRadius, mGifBorderRadius)) {
mGifBorderRadius = borderRadius;
setGifCornerRadii((GifDrawable) wrapDrawable);
}
}
super.setImageDrawable(wrapDrawable);
if (mWeakReference != null) {
HookImage component = mWeakReference.get();
if (component != null) {
component.readyToRender();
}
}
}
}
use of com.eros.framework.extend.hook.ui.components.HookImage in project WeexErosFramework by bmfe.
the class HookWXImageView method autoRecoverImage.
public void autoRecoverImage() {
if (enableBitmapAutoManage) {
if (isBitmapReleased) {
HookImage image = getComponent();
if (image != null) {
image.autoRecoverImage();
}
isBitmapReleased = false;
}
}
}
Aggregations