Update message UI

This commit is contained in:
huanghongxun 2018-09-24 17:26:02 +08:00
parent 1611d11544
commit 80f79d20a5
4 changed files with 22 additions and 4 deletions

View File

@ -78,6 +78,8 @@ public final class MainPage extends StackPane implements DecoratorPage {
@FXML
private Label lblCurrentGame;
@FXML
private Label lblIcon;
@FXML
private TwoLineListItem lblLatestVersion;
@FXML
private Rectangle separator;
@ -106,6 +108,7 @@ public final class MainPage extends StackPane implements DecoratorPage {
}));
nowAnimation.play();
});
lblIcon.setGraphic(SVG.update(Theme.whiteFillBinding(), 20, 20));
updateListener = any -> {
if (UpdateChecker.isOutdated()) {
lblLatestVersion.setTitle(i18n("update.bubble.title", UpdateChecker.getLatestVersion().getVersion()));

View File

@ -33,6 +33,7 @@ import java.util.Collections;
import java.util.List;
public class TwoLineListItem extends StackPane {
private static final String DEFAULT_STYLE_CLASS = "two-line-list-item";
private final StringProperty title = new SimpleStringProperty(this, "title");
private final StringProperty subtitle = new SimpleStringProperty(this, "subtitle");
@ -64,6 +65,8 @@ public class TwoLineListItem extends StackPane {
VBox vbox = new VBox();
vbox.getChildren().setAll(lblTitle, lblSubtitle);
getChildren().setAll(vbox);
getStyleClass().add(DEFAULT_STYLE_CLASS);
}
public String getTitle() {

View File

@ -98,6 +98,12 @@
-fx-text-fill: white;
}
.two-line-list-item {
-jfx-title-font-size: 15px;
-jfx-title-fill: black;
-jfx-subtitle-fill: gray;
}
/*******************************************************************************
* *
* JFX Tab Pane *

View File

@ -8,23 +8,29 @@
<?import org.jackhuang.hmcl.ui.FXUtils?>
<?import javafx.geometry.Insets?>
<?import org.jackhuang.hmcl.ui.construct.TwoLineListItem?>
<?import javafx.scene.layout.HBox?>
<fx:root type="StackPane" pickOnBounds="false"
xmlns="http://javafx.com/javafx/8.0.112" xmlns:fx="http://javafx.com/fxml/1">
<StackPane fx:id="main" style="-fx-padding: 25;">
<StackPane fx:id="updatePane" styleClass="bubble" FXUtils.limitWidth="230" FXUtils.limitHeight="55"
onMouseClicked="#onUpgrade" StackPane.alignment="TOP_RIGHT">
<TwoLineListItem StackPane.alignment="CENTER_LEFT" titleFill="white" subtitleFill="white" subtitle="%update.bubble.subtitle" fx:id="lblLatestVersion" pickOnBounds="false">
<HBox StackPane.alignment="CENTER_LEFT" alignment="CENTER_LEFT" spacing="12">
<Label fx:id="lblIcon" />
<TwoLineListItem titleFill="white" subtitleFill="white" subtitle="%update.bubble.subtitle" fx:id="lblLatestVersion" pickOnBounds="false"
style="-jfx-title-font-weight: BOLD;" />
<StackPane.margin>
<Insets left="12" top="9" right="12" bottom="9" />
<Insets left="16" top="9" right="12" bottom="9" />
</StackPane.margin>
</TwoLineListItem>
</HBox>
<JFXButton fx:id="closeButton" StackPane.alignment="TOP_RIGHT" styleClass="toggle-icon-tiny">
<StackPane.margin>
<Insets topRightBottomLeft="4" />
<Insets topRightBottomLeft="5" />
</StackPane.margin>
</JFXButton>
</StackPane>
<StackPane maxWidth="230" maxHeight="55" StackPane.alignment="BOTTOM_RIGHT">
<JFXButton prefWidth="230" prefHeight="55" buttonType="RAISED" styleClass="jfx-button-raised"
onMouseClicked="#launch" fx:id="btnLaunch">