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
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,10 @@
*/
package org.jackhuang.hmcl.ui.versions;

import com.jfoenix.controls.*;
import com.jfoenix.effects.JFXDepthManager;
import com.jfoenix.controls.JFXButton;
import com.jfoenix.controls.JFXComboBox;
import com.jfoenix.controls.JFXListView;
import com.jfoenix.controls.JFXTextField;
import javafx.beans.binding.Bindings;
import javafx.beans.binding.ObjectBinding;
import javafx.beans.property.*;
Expand Down Expand Up @@ -532,6 +534,7 @@ protected ModDownloadListPageSkin(DownloadListPage control) {
private static final Insets PADDING = new Insets(9, 9, 0, 9);

private final RipplerContainer graphic;
private final StackPane wrapper = new StackPane();

private final TwoLineListItem content = new TwoLineListItem();
private final ImageView imageView = new ImageView();
Expand All @@ -540,20 +543,22 @@ protected ModDownloadListPageSkin(DownloadListPage control) {
setPadding(PADDING);

HBox container = new HBox(8);
container.getStyleClass().add("card");
container.setPadding(new Insets(8));
container.setCursor(Cursor.HAND);
container.setAlignment(Pos.CENTER_LEFT);
JFXDepthManager.setDepth(container, 1);

imageView.setFitWidth(40);
imageView.setFitHeight(40);
imageView.setMouseTransparent(true);

container.getChildren().setAll(FXUtils.limitingSize(imageView, 40, 40), content);
HBox.setHgrow(content, Priority.ALWAYS);

this.graphic = new RipplerContainer(container);
graphic.setPosition(JFXRippler.RipplerPos.FRONT);
FXUtils.onClicked(graphic, () -> {
wrapper.getChildren().setAll(this.graphic);
wrapper.getStyleClass().add("card-no-padding");

FXUtils.onClicked(wrapper, () -> {
RemoteMod item = getItem();
if (item != null)
Controllers.navigate(new DownloadPage(getSkinnable(), item, getSkinnable().getProfileVersion(), getSkinnable().callback));
Expand All @@ -580,7 +585,7 @@ protected void updateItem(RemoteMod item, boolean empty) {
content.addTag(getSkinnable().getLocalizedCategory(category));
}
iconLoader.load(imageView.imageProperty(), item.getIconUrl());
setGraphic(graphic);
setGraphic(wrapper);
}
}
});
Expand Down
7 changes: 7 additions & 0 deletions HMCL/src/main/resources/assets/css/root.css
Original file line number Diff line number Diff line change
Expand Up @@ -1046,6 +1046,13 @@
-fx-effect: dropshadow(gaussian, rgba(0, 0, 0, 0.26), 10, 0.12, -1, 2);
}

.card-no-padding {
-fx-background-color: -monet-surface-container-low-transparent-80;
-fx-background-radius: 4;

-fx-effect: dropshadow(gaussian, rgba(0, 0, 0, 0.26), 10, 0.12, -1, 2);
}

.card-non-transparent {
-fx-background-color: -monet-surface-container-low;
-fx-background-radius: 4;
Expand Down