Glideで読み込まれた一連の画像があります。Glideで読み込まれたgifにアニメーションが適用されないようにする方法がありますか?
グライド(wasabeef)ビットマップ変換を使用してNSFWのビットをぼかすことができますが、アニメーションGIFでもかまいません。その場合、最初のフレームがぼやけて見え、アニメーションはループします(ぼかしなし)。
次は私が試してみましたと動作しないものです:
DrawableTypeRequest<String> builder = Glide.with(mImage.getContext()).load(...);
if (entry.isNsfw()) {
builder.asBitmap();
}
builder.diskCacheStrategy(DiskCacheStrategy.SOURCE) //it's likely none of this is relevant
.skipMemoryCache(true)
.override(props.getWidth(), props.getHeight());
if (entry.isNsfw()) {
//successfully blurs nsfw images, but still allows unblurred animation
builder.dontAnimate().bitmapTransform(centreCrop, blur);
} else {
builder.centerCrop();
}
builder.crossFade(500) //moving crossfade only into the sfw posts has no effect
.into(mImage);
も動作していないが、負荷を傍受されています
私は一方で、個々のイメージのGIFの再生をオフにするにはどうすればよいbuilder.listener(new RequestListener<String, GlideDrawable>() {
@Override
public boolean onException(Exception e, String model, Target<GlideDrawable> target, boolean isFirstResource) {
return false;
}
@Override
public boolean onResourceReady(GlideDrawable resource, String model, Target<GlideDrawable> target, boolean isFromMemoryCache, boolean isFirstResource) {
if (entry.isNsfw()) {
target.onResourceReady(resource, null); //If I add this and return true the image is static, but unblurred
resource.stop(); //if this is called before target, it has no effect
return true;
}
return false; //returning true without calling the target stops any of the images being set on the view
}
});
まだぼかし変換を維持していますか?
'onResourceReady'メソッドで' true'を返そうとしましたか? 'false'を返すと、デフォルトの動作が実行されます。 [this](https://github.com/bumptech/glide/issues/1107#issuecomment-205735933)もチェックしてください –
trueを返すと、ターゲットに設定されている画像が停止します。 asBitmapを使用しても効果はありませんでした。今まで試した他のものを表示するために、私の例のコードを更新します。 –