diff --git a/HMCL/src/main/java/com/jfoenix/controls/JFXRippler.java b/HMCL/src/main/java/com/jfoenix/controls/JFXRippler.java index e534277b4a..91a7a44af4 100644 --- a/HMCL/src/main/java/com/jfoenix/controls/JFXRippler.java +++ b/HMCL/src/main/java/com/jfoenix/controls/JFXRippler.java @@ -417,7 +417,6 @@ private void releaseRippleImmediately() { if (overlayRect != null) { overlayRect.inAnimation.stop(); if (!forceOverlay) { - overlayRect.outAnimation.stop(); overlayRect.setOpacity(0D); } } diff --git a/HMCL/src/main/java/org/jackhuang/hmcl/ui/construct/MDListCell.java b/HMCL/src/main/java/org/jackhuang/hmcl/ui/construct/MDListCell.java index ba236c974e..0f50676e5d 100644 --- a/HMCL/src/main/java/org/jackhuang/hmcl/ui/construct/MDListCell.java +++ b/HMCL/src/main/java/org/jackhuang/hmcl/ui/construct/MDListCell.java @@ -25,6 +25,8 @@ import javafx.scene.layout.StackPane; import org.jackhuang.hmcl.ui.FXUtils; +import java.util.Objects; + public abstract class MDListCell extends ListCell { private static final PseudoClass SELECTED = PseudoClass.getPseudoClass("selected"); @@ -56,10 +58,11 @@ protected void updateItem(T item, boolean empty) { T oldItem = getItem(); boolean oldEmpty = isEmpty(); - ripplerContainer.releaseRippleImmediately(); super.updateItem(item, empty); - if (oldItem == item && oldEmpty == empty) return; + if (Objects.equals(oldItem, item) && oldEmpty == empty) return; + + ripplerContainer.releaseRippleImmediately(); updateControl(item, empty); if (empty || item == null) { diff --git a/HMCL/src/main/java/org/jackhuang/hmcl/ui/download/VersionsPage.java b/HMCL/src/main/java/org/jackhuang/hmcl/ui/download/VersionsPage.java index 69a79bb7fc..2cd2c8c6fe 100644 --- a/HMCL/src/main/java/org/jackhuang/hmcl/ui/download/VersionsPage.java +++ b/HMCL/src/main/java/org/jackhuang/hmcl/ui/download/VersionsPage.java @@ -67,6 +67,7 @@ import org.jackhuang.hmcl.util.versioning.GameVersionNumber; import java.util.Locale; +import java.util.Objects; import java.util.regex.Pattern; import java.util.stream.Collectors; import java.util.stream.Stream; @@ -214,18 +215,20 @@ private void onOpenWiki() { @Override public void updateItem(RemoteVersion remoteVersion, boolean empty) { RemoteVersion oldRemoteVersion = getItem(); + boolean oldEmpty = isEmpty(); - ripplerContainer.releaseRippleImmediately(); super.updateItem(remoteVersion, empty); + if (Objects.equals(oldRemoteVersion, remoteVersion) && oldEmpty == empty) return; + + ripplerContainer.releaseRippleImmediately(); + if (empty) { setGraphic(null); return; } setGraphic(pane); - if (oldRemoteVersion == remoteVersion) return; - twoLineListItem.setTitle(I18n.getDisplayVersion(remoteVersion)); if (remoteVersion.getReleaseDate() != null) { twoLineListItem.setSubtitle(I18n.formatDateTime(remoteVersion.getReleaseDate())); diff --git a/HMCL/src/main/java/org/jackhuang/hmcl/ui/instances/DownloadListPage.java b/HMCL/src/main/java/org/jackhuang/hmcl/ui/instances/DownloadListPage.java index f9ad6b1a11..499d6f9fd3 100644 --- a/HMCL/src/main/java/org/jackhuang/hmcl/ui/instances/DownloadListPage.java +++ b/HMCL/src/main/java/org/jackhuang/hmcl/ui/instances/DownloadListPage.java @@ -581,8 +581,15 @@ protected ModDownloadListPageSkin(DownloadListPage control) { @Override protected void updateItem(RemoteAddon item, boolean empty) { - this.graphic.releaseRippleImmediately(); + RemoteAddon oldItem = getItem(); + boolean oldEmpty = isEmpty(); + super.updateItem(item, empty); + + if (Objects.equals(oldItem, item) && oldEmpty == empty) return; + + this.graphic.releaseRippleImmediately(); + if (empty || item == null) { setGraphic(null); } else { diff --git a/HMCL/src/main/java/org/jackhuang/hmcl/ui/instances/GameListCell.java b/HMCL/src/main/java/org/jackhuang/hmcl/ui/instances/GameListCell.java index 54b881667a..acff23e792 100644 --- a/HMCL/src/main/java/org/jackhuang/hmcl/ui/instances/GameListCell.java +++ b/HMCL/src/main/java/org/jackhuang/hmcl/ui/instances/GameListCell.java @@ -162,9 +162,15 @@ public void fire() { @Override public void updateItem(GameListItem item, boolean empty) { - this.graphic.releaseRippleImmediately(); + GameListItem oldItem = getItem(); + boolean oldEmpty = isEmpty(); + super.updateItem(item, empty); + if (oldItem == item && oldEmpty == empty) return; + + this.graphic.releaseRippleImmediately(); + this.imageView.imageProperty().unbind(); this.content.titleProperty().unbind(); this.content.subtitleProperty().unbind(); diff --git a/HMCL/src/main/java/org/jackhuang/hmcl/ui/instances/GameListPopupMenu.java b/HMCL/src/main/java/org/jackhuang/hmcl/ui/instances/GameListPopupMenu.java index e75758b142..38f7bf361c 100644 --- a/HMCL/src/main/java/org/jackhuang/hmcl/ui/instances/GameListPopupMenu.java +++ b/HMCL/src/main/java/org/jackhuang/hmcl/ui/instances/GameListPopupMenu.java @@ -165,9 +165,14 @@ public Cell(ListView listView) { @Override protected void updateItem(GameItem item, boolean empty) { - this.ripplerContainer.releaseRippleImmediately(); + GameItem oldItem = getItem(); + boolean oldEmpty = isEmpty(); + super.updateItem(item, empty); + if (oldItem == item && oldEmpty == empty) return; + + this.ripplerContainer.releaseRippleImmediately(); this.imageView.imageProperty().unbind(); this.content.titleProperty().unbind(); this.content.subtitleProperty().unbind(); diff --git a/HMCL/src/main/java/org/jackhuang/hmcl/ui/instances/SchematicsPage.java b/HMCL/src/main/java/org/jackhuang/hmcl/ui/instances/SchematicsPage.java index 603f25ec5e..bbbc97115f 100644 --- a/HMCL/src/main/java/org/jackhuang/hmcl/ui/instances/SchematicsPage.java +++ b/HMCL/src/main/java/org/jackhuang/hmcl/ui/instances/SchematicsPage.java @@ -613,9 +613,14 @@ public Cell() { @Override protected void updateItem(Item item, boolean empty) { - graphics.releaseRippleImmediately(); + Item oldItem = getItem(); + boolean oldEmpty = isEmpty(); + super.updateItem(item, empty); + if (Objects.equals(oldItem, item) && oldEmpty == empty) return; + + graphics.releaseRippleImmediately(); iconImageView.setImage(null); if (empty || item == null) { diff --git a/HMCL/src/main/java/org/jackhuang/hmcl/ui/instances/WorldListPage.java b/HMCL/src/main/java/org/jackhuang/hmcl/ui/instances/WorldListPage.java index aa5134042e..377e62945a 100644 --- a/HMCL/src/main/java/org/jackhuang/hmcl/ui/instances/WorldListPage.java +++ b/HMCL/src/main/java/org/jackhuang/hmcl/ui/instances/WorldListPage.java @@ -326,11 +326,11 @@ protected void updateItem(World world, boolean empty) { World oldWorld = getItem(); boolean oldEmpty = isEmpty(); - this.graphic.releaseRippleImmediately(); super.updateItem(world, empty); if (oldWorld == world && oldEmpty == empty) return; + this.graphic.releaseRippleImmediately(); this.content.getTags().clear(); if (empty || world == null) { diff --git a/HMCL/src/main/java/org/jackhuang/hmcl/ui/main/JavaManagementPage.java b/HMCL/src/main/java/org/jackhuang/hmcl/ui/main/JavaManagementPage.java index c615ad8201..e21c322de8 100644 --- a/HMCL/src/main/java/org/jackhuang/hmcl/ui/main/JavaManagementPage.java +++ b/HMCL/src/main/java/org/jackhuang/hmcl/ui/main/JavaManagementPage.java @@ -298,9 +298,14 @@ private static final class JavaItemCell extends ListCell { @Override protected void updateItem(JavaRuntime item, boolean empty) { JavaRuntime oldItem = getItem(); + boolean oldEmpty = isEmpty(); - this.graphic.releaseRippleImmediately(); super.updateItem(item, empty); + + if (oldItem == item && oldEmpty == empty) return; + + this.graphic.releaseRippleImmediately(); + if (empty || item == null) { setGraphic(null); } else { diff --git a/HMCL/src/main/java/org/jackhuang/hmcl/ui/main/ThemePackManagementPage.java b/HMCL/src/main/java/org/jackhuang/hmcl/ui/main/ThemePackManagementPage.java index 3be7b6c6dc..e96899ce24 100644 --- a/HMCL/src/main/java/org/jackhuang/hmcl/ui/main/ThemePackManagementPage.java +++ b/HMCL/src/main/java/org/jackhuang/hmcl/ui/main/ThemePackManagementPage.java @@ -714,20 +714,21 @@ private ThemePackItemCell(ThemePackManagementPage page) { @Override protected void updateItem(ThemePackManager.@Nullable InstalledThemePack themePack, boolean empty) { var currentItem = getItem(); + boolean oldEmpty = isEmpty(); - this.graphic.releaseRippleImmediately(); super.updateItem(themePack, empty); - if (Objects.equals(getItem(), currentItem)) return; + if (Objects.equals(getItem(), currentItem) && oldEmpty == empty) return; + this.graphic.releaseRippleImmediately(); content.getTags().clear(); iconImage.setImage(null); iconFallback.setVisible(false); + if (empty || themePack == null) { setGraphic(null); return; } - setGraphic(graphic); ThemePackManifest manifest = themePack.manifest();