Show thumb, if offline_picture is not available
Tweak the insets
This commit is contained in:
parent
07864dc10a
commit
7442ddd3e4
|
@ -61,7 +61,7 @@ public class CamsodaShowsTab extends Tab implements TabSelectionListener {
|
|||
}
|
||||
|
||||
private void createGui() {
|
||||
showList = new VBox(10);
|
||||
showList = new VBox();
|
||||
progressIndicator = new ProgressIndicator();
|
||||
progressIndicator.setPrefSize(100, 100);
|
||||
setContent(progressIndicator);
|
||||
|
@ -120,7 +120,7 @@ public class CamsodaShowsTab extends Tab implements TabSelectionListener {
|
|||
showList.getChildren().clear();
|
||||
for (ShowBox showBox : boxes) {
|
||||
showList.getChildren().add(showBox);
|
||||
VBox.setMargin(showBox, new Insets(20));
|
||||
VBox.setMargin(showBox, new Insets(20, 20, 0, 20));
|
||||
}
|
||||
} catch (Exception e) {
|
||||
LOG.error("Couldn't load upcoming camsoda shows", e);
|
||||
|
@ -147,8 +147,10 @@ public class CamsodaShowsTab extends Tab implements TabSelectionListener {
|
|||
}
|
||||
|
||||
private class ShowBox extends TitledPane {
|
||||
|
||||
BorderPane root = new BorderPane();
|
||||
int thumbSize = 200;
|
||||
|
||||
public ShowBox(Model model, ZonedDateTime startTime, ZonedDateTime endTime) {
|
||||
setText(model.getName());
|
||||
setPrefHeight(268);
|
||||
|
@ -203,9 +205,13 @@ public class CamsodaShowsTab extends Tab implements TabSelectionListener {
|
|||
JSONObject user = json.getJSONObject("user");
|
||||
if(user.has("settings")) {
|
||||
JSONObject settings = user.getJSONObject("settings");
|
||||
String imageUrl;
|
||||
if(settings.has("offline_picture")) {
|
||||
imageUrl = settings.getString("offline_picture");
|
||||
} else {
|
||||
imageUrl = "https:" + user.getString("thumb");
|
||||
}
|
||||
Platform.runLater(() -> {
|
||||
String imageUrl = settings.getString("offline_picture");
|
||||
Image img = new Image(imageUrl, 1000, thumbSize, true, true, true);
|
||||
img.progressProperty().addListener(new ChangeListener<Number>() {
|
||||
@Override
|
||||
|
@ -221,7 +227,6 @@ public class CamsodaShowsTab extends Tab implements TabSelectionListener {
|
|||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
resp.close();
|
||||
} catch(Exception e) {
|
||||
LOG.error("Couldn't load model details", e);
|
||||
|
|
Loading…
Reference in New Issue