Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion HMCL/src/main/java/com/jfoenix/controls/JFXRippler.java
Original file line number Diff line number Diff line change
Expand Up @@ -417,7 +417,6 @@ private void releaseRippleImmediately() {
if (overlayRect != null) {
overlayRect.inAnimation.stop();
if (!forceOverlay) {
overlayRect.outAnimation.stop();
overlayRect.setOpacity(0D);
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,8 @@
import javafx.scene.layout.StackPane;
import org.jackhuang.hmcl.ui.FXUtils;

import java.util.Objects;

public abstract class MDListCell<T> extends ListCell<T> {
private static final PseudoClass SELECTED = PseudoClass.getPseudoClass("selected");

Expand Down Expand Up @@ -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) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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()));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -165,9 +165,14 @@ public Cell(ListView<GameItem> 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();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -298,9 +298,14 @@ private static final class JavaItemCell extends ListCell<JavaRuntime> {
@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 {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down