From 9b69fe8c5639c6ace8462012fcf4cf4485e2bbe0 Mon Sep 17 00:00:00 2001 From: yushijinhun Date: Sat, 22 Sep 2018 12:52:30 +0800 Subject: [PATCH] Remove Constants.DEFAULT_ICON --- .../jackhuang/hmcl/ui/account/AddAccountPane.java | 13 +++++-------- .../java/org/jackhuang/hmcl/util/Constants.java | 7 ------- 2 files changed, 5 insertions(+), 15 deletions(-) diff --git a/HMCL/src/main/java/org/jackhuang/hmcl/ui/account/AddAccountPane.java b/HMCL/src/main/java/org/jackhuang/hmcl/ui/account/AddAccountPane.java index 5d2e9f54f..aaf04f7ce 100644 --- a/HMCL/src/main/java/org/jackhuang/hmcl/ui/account/AddAccountPane.java +++ b/HMCL/src/main/java/org/jackhuang/hmcl/ui/account/AddAccountPane.java @@ -42,7 +42,6 @@ import org.jackhuang.hmcl.task.Task; import org.jackhuang.hmcl.ui.Controllers; import org.jackhuang.hmcl.ui.FXUtils; import org.jackhuang.hmcl.ui.construct.*; -import org.jackhuang.hmcl.util.Constants; import org.jackhuang.hmcl.util.Logging; import java.util.List; @@ -190,6 +189,7 @@ public class AddAccountPane extends StackPane { } private class Selector extends BorderPane implements CharacterSelector { + private final AdvancedListBox listBox = new AdvancedListBox(); private final JFXButton cancel = new JFXButton(); @@ -225,16 +225,13 @@ public class AddAccountPane extends StackPane { image = AccountHelper.getSkinImmediately(yggdrasilAccount, profile, 4); } catch (Exception e) { Logging.LOG.log(Level.WARNING, "Failed to get skin for " + profile.getName(), e); - image = null; + image = AccountHelper.getDefaultSkin(profile.getId(), 4); } + ImageView portraitView = new ImageView(); portraitView.setSmooth(false); - if (image == null) { - portraitView.setImage(Constants.DEFAULT_ICON.get()); - } else { - portraitView.setImage(image); - portraitView.setViewport(AccountHelper.getViewport(4)); - } + portraitView.setImage(image); + portraitView.setViewport(AccountHelper.getViewport(4)); FXUtils.limitSize(portraitView, 32, 32); IconedItem accountItem = new IconedItem(portraitView, profile.getName()); diff --git a/HMCLCore/src/main/java/org/jackhuang/hmcl/util/Constants.java b/HMCLCore/src/main/java/org/jackhuang/hmcl/util/Constants.java index ec220e2bb..4d03a4679 100644 --- a/HMCLCore/src/main/java/org/jackhuang/hmcl/util/Constants.java +++ b/HMCLCore/src/main/java/org/jackhuang/hmcl/util/Constants.java @@ -17,10 +17,6 @@ */ package org.jackhuang.hmcl.util; -import javafx.beans.binding.Bindings; -import javafx.beans.binding.ObjectBinding; -import javafx.scene.image.Image; - import org.jackhuang.hmcl.task.Schedulers; import org.jackhuang.hmcl.util.platform.OperatingSystem; @@ -59,7 +55,4 @@ public final class Constants { else javafx.application.Platform.runLater(s); }; - - // lazy loading - public static final ObjectBinding DEFAULT_ICON = Bindings.createObjectBinding(() -> new Image("/assets/img/icon.png")); }