我正在尝试使用以下代码下载图片:
Glide.with(recommendedEventViewHolder.itemView)
.load(currentEvent.posterDownloadPath)
.diskCacheStrategy( DiskCacheStrategy.AUTOMATIC )
.into(recommendedEventViewHolder.posterImageView)
但在此视频中,结果是这样的:https://drive.google.com/file/d/1ljGxwsi0wpaZbBY_CLmczdBzD9krz4QQ/view?usp=sharing
当我向下滚动到“回收站”视图的底部,然后回到顶部时,第一个图像消失,似乎重新下载了该图像
我试图将diskStartegy删除为类似这样的内容:
Glide.with(recommendedEventViewHolder.itemView)
.load(currentEvent.posterDownloadPath)
.into(recommendedEventViewHolder.posterImageView)
但是结果是一样的。我在gradle文件中使用它
implementation 'com.github.bumptech.glide:glide:4.9.0'
annotationProcessor 'com.github.bumptech.glide:compiler:4.9.0'
答案 0 :(得分:1)
将diskCacheStrategy从public class TestAtmCustomer
{
[Test]
public void Should_ShowZeroErrorMessage_OnPlaceDeposit_When_AmountIsZero()
{
var mock = new MockMessagePrinter();
ATMCustomer atmCustomer = new ATMCustomer(mock, new RepoTransaction());
atmCustomer.PlaceDeposit(new BankAccount(), 0);
var expectedMessage = "Amount needs to be more than zero. Try again.";
Assert.AreEqual(expectedMessage, mock.Message);
}
}
更改为DiskCacheStrategy.AUTOMATIC
,这仅在图像无法缓存时才尝试发送请求。