-
Notifications
You must be signed in to change notification settings - Fork 12
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
11 changed files
with
246 additions
and
33 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
36 changes: 36 additions & 0 deletions
36
src/main/java/com/faforever/moderatorclient/ui/AvatarCache.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
package com.faforever.moderatorclient.ui; | ||
|
||
import javafx.scene.image.Image; | ||
|
||
import java.util.HashMap; | ||
import java.util.Map; | ||
|
||
public class AvatarCache { | ||
|
||
private final Map<String, Image> cache; | ||
|
||
private static AvatarCache singleton; | ||
|
||
private AvatarCache() { | ||
this.cache = new HashMap<>(); | ||
} | ||
|
||
public static synchronized AvatarCache getInstance() { | ||
if (singleton == null) { | ||
singleton = new AvatarCache(); | ||
} | ||
return singleton; | ||
} | ||
|
||
public Image get(String key) { | ||
return this.cache.get(key); | ||
} | ||
|
||
public boolean containsKey(String key) { | ||
return this.cache.containsKey(key); | ||
} | ||
|
||
public void put(String cacheKey, Image img) { | ||
this.cache.put(cacheKey, img); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.