本文整理匯總了Java中com.bumptech.glide.load.engine.Resource.equals方法的典型用法代碼示例。如果您正苦於以下問題:Java Resource.equals方法的具體用法?Java Resource.equals怎麽用?Java Resource.equals使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類com.bumptech.glide.load.engine.Resource
的用法示例。
在下文中一共展示了Resource.equals方法的5個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: transform
import com.bumptech.glide.load.engine.Resource; //導入方法依賴的package包/類
@Override
public Resource<GifDrawable> transform(
Context context, Resource<GifDrawable> resource, int outWidth, int outHeight) {
GifDrawable drawable = resource.get();
// The drawable needs to be initialized with the correct width and height in order for a view
// displaying it to end up with the right dimensions. Since our transformations may arbitrarily
// modify the dimensions of our GIF, here we create a stand in for a frame and pass it to the
// transformation to see what the final transformed dimensions will be so that our drawable can
// report the correct intrinsic width and height.
BitmapPool bitmapPool = Glide.get(context).getBitmapPool();
Bitmap firstFrame = drawable.getFirstFrame();
Resource<Bitmap> bitmapResource = new BitmapResource(firstFrame, bitmapPool);
Resource<Bitmap> transformed = wrapped.transform(context, bitmapResource, outWidth, outHeight);
if (!bitmapResource.equals(transformed)) {
bitmapResource.recycle();
}
Bitmap transformedFrame = transformed.get();
drawable.setFrameTransformation(wrapped, transformedFrame);
return resource;
}
示例2: transform
import com.bumptech.glide.load.engine.Resource; //導入方法依賴的package包/類
@Override
public Resource<BitmapDrawable> transform(
Context context, Resource<BitmapDrawable> drawableResourceToTransform, int outWidth,
int outHeight) {
BitmapDrawable drawableToTransform = drawableResourceToTransform.get();
Bitmap bitmapToTransform = drawableToTransform.getBitmap();
BitmapPool bitmapPool = Glide.get(context).getBitmapPool();
BitmapResource bitmapResourceToTransform = BitmapResource.obtain(bitmapToTransform, bitmapPool);
Resource<Bitmap> transformedBitmapResource =
wrapped.transform(context, bitmapResourceToTransform, outWidth, outHeight);
if (transformedBitmapResource.equals(bitmapResourceToTransform)) {
return drawableResourceToTransform;
} else {
return LazyBitmapDrawableResource.obtain(context, transformedBitmapResource.get());
}
}
示例3: transform
import com.bumptech.glide.load.engine.Resource; //導入方法依賴的package包/類
@Override
public Resource<Drawable> transform(Context context, Resource<Drawable> resource, int outWidth,
int outHeight) {
BitmapPool bitmapPool = Glide.get(context).getBitmapPool();
Drawable drawable = resource.get();
Resource<Bitmap> bitmapResourceToTransform =
DrawableToBitmapConverter.convert(bitmapPool, drawable, outWidth, outHeight);
if (bitmapResourceToTransform == null) {
if (isRequired) {
throw new IllegalArgumentException("Unable to convert " + drawable + " to a Bitmap");
} else {
return resource;
}
}
Resource<Bitmap> transformedBitmapResource =
wrapped.transform(context, bitmapResourceToTransform, outWidth, outHeight);
if (transformedBitmapResource.equals(bitmapResourceToTransform)) {
transformedBitmapResource.recycle();
return resource;
} else {
return newDrawableResource(context, transformedBitmapResource.get());
}
}
示例4: getTransformedFrame
import com.bumptech.glide.load.engine.Resource; //導入方法依賴的package包/類
private Resource<Bitmap> getTransformedFrame(Bitmap currentFrame,
Transformation<Bitmap> transformation, GifDrawable drawable) {
// TODO: what if current frame is null?
Resource<Bitmap> bitmapResource = factory.buildFrameResource(currentFrame, bitmapPool);
Resource<Bitmap> transformedResource =
transformation.transform(
context, bitmapResource, drawable.getIntrinsicWidth(), drawable.getIntrinsicHeight());
if (!bitmapResource.equals(transformedResource)) {
bitmapResource.recycle();
}
return transformedResource;
}
示例5: transform
import com.bumptech.glide.load.engine.Resource; //導入方法依賴的package包/類
@Override
public Resource<T> transform(
Context context, Resource<T> resource, int outWidth, int outHeight) {
Resource<T> previous = resource;
for (Transformation<T> transformation : transformations) {
Resource<T> transformed = transformation.transform(context, previous, outWidth, outHeight);
if (previous != null && !previous.equals(resource) && !previous.equals(transformed)) {
previous.recycle();
}
previous = transformed;
}
return previous;
}