mirror of
https://github.com/Card-Forge/forge.git
synced 2025-11-20 12:48:00 +00:00
invalidate the image cache after downloading new images so the new images can be loaded if they were previously cached as not found
This commit is contained in:
@@ -83,6 +83,11 @@ public class ImageCache {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
public static void clear() {
|
||||
CACHE.invalidateAll();
|
||||
}
|
||||
|
||||
/**
|
||||
* retrieve an image from the cache. returns null if the image is not found in the cache
|
||||
* and cannot be loaded from disk. pass -1 for width and/or height to avoid resizing in that dimension.
|
||||
|
||||
@@ -55,6 +55,7 @@ import org.apache.commons.lang3.tuple.Pair;
|
||||
import com.esotericsoftware.minlog.Log;
|
||||
|
||||
import forge.Command;
|
||||
import forge.ImageCache;
|
||||
import forge.error.BugReporter;
|
||||
import forge.gui.SOverlayUtils;
|
||||
import forge.gui.toolbox.FButton;
|
||||
@@ -70,12 +71,14 @@ import forge.util.MyRandom;
|
||||
|
||||
@SuppressWarnings("serial")
|
||||
public abstract class GuiDownloader extends DefaultBoundedRangeModel implements Runnable {
|
||||
public static final Proxy.Type[] TYPES = Proxy.Type.values(); /** */
|
||||
public static final Proxy.Type[] TYPES = Proxy.Type.values();
|
||||
|
||||
// Actions and commands
|
||||
private final ActionListener actStartDownload = new ActionListener() {
|
||||
@Override
|
||||
public void actionPerformed(final ActionEvent e) {
|
||||
// invalidate image cache so newly downloaded images will be loaded
|
||||
ImageCache.clear();
|
||||
new Thread(GuiDownloader.this).start();
|
||||
btnStart.setEnabled(false);
|
||||
}
|
||||
@@ -374,5 +377,4 @@ public abstract class GuiDownloader extends DefaultBoundedRangeModel implements
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user