Browse Source

REPORT-99485 fix:灰化图标无法跟随DPI变化

newui
vito 12 months ago
parent
commit
9cde4b2105
  1. 5
      designer-base/src/main/java/com/fine/theme/icon/IconManager.java
  2. 8
      designer-base/src/main/java/com/fine/theme/icon/UrlIconResource.java

5
designer-base/src/main/java/com/fine/theme/icon/IconManager.java

@ -25,9 +25,7 @@ public class IconManager {
public static boolean initialized = false; public static boolean initialized = false;
public static ArrayList<IconSet> iconSets = new ArrayList<>(2); public static ArrayList<IconSet> iconSets = new ArrayList<>(2);
;
public static HashMap<String, WeakReference<Icon>> cache = new HashMap<>(60); public static HashMap<String, WeakReference<Icon>> cache = new HashMap<>(60);
;
public static HashMap<String, WeakReference<Icon>> disableCache = new HashMap<>(60); public static HashMap<String, WeakReference<Icon>> disableCache = new HashMap<>(60);
@ -130,6 +128,7 @@ public class IconManager {
*/ */
public static void clearCache() { public static void clearCache() {
cache.clear(); cache.clear();
disableCache.clear();
} }
/** /**
@ -137,11 +136,13 @@ public class IconManager {
*/ */
public static void clearIconCache(String id) { public static void clearIconCache(String id) {
cache.remove(id); cache.remove(id);
disableCache.remove(id);
} }
private static void clearIconSetCache(@NotNull IconSet set) { private static void clearIconSetCache(@NotNull IconSet set) {
for (String id : set.getIds()) { for (String id : set.getIds()) {
cache.remove(id); cache.remove(id);
disableCache.remove(id);
} }
} }
} }

8
designer-base/src/main/java/com/fine/theme/icon/UrlIconResource.java

@ -6,6 +6,7 @@ import com.fr.third.errorprone.annotations.Immutable;
import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.NotNull;
import java.io.InputStream; import java.io.InputStream;
import java.util.StringJoiner;
/** /**
* url图标资源 * url图标资源
@ -42,4 +43,11 @@ public class UrlIconResource implements IconResource {
InputStream inputStream = IOUtils.getInputStream(path); InputStream inputStream = IOUtils.getInputStream(path);
return inputStream != null ? inputStream : ResourceIOUtils.read(path); return inputStream != null ? inputStream : ResourceIOUtils.read(path);
} }
@Override
public String toString() {
return new StringJoiner(", ", UrlIconResource.class.getSimpleName() + "[", "]")
.add("path='" + path + "'")
.toString();
}
} }

Loading…
Cancel
Save