Add support for 16:9 thumbnails
This commit is contained in:
parent
0a5365360f
commit
ad3a8d9e48
|
@ -31,6 +31,7 @@ public class LiveJasminTabProvider extends TabProvider {
|
||||||
|
|
||||||
followedTab = new LiveJasminFollowedTab(liveJasmin);
|
followedTab = new LiveJasminFollowedTab(liveJasmin);
|
||||||
followedTab.setRecorder(liveJasmin.getRecorder());
|
followedTab.setRecorder(liveJasmin.getRecorder());
|
||||||
|
followedTab.setImageAspectRatio(9.0 / 16.0);
|
||||||
tabs.add(followedTab);
|
tabs.add(followedTab);
|
||||||
|
|
||||||
return tabs;
|
return tabs;
|
||||||
|
@ -43,9 +44,10 @@ public class LiveJasminTabProvider extends TabProvider {
|
||||||
|
|
||||||
private ThumbOverviewTab createTab(String title, String url) {
|
private ThumbOverviewTab createTab(String title, String url) {
|
||||||
LiveJasminUpdateService s = new LiveJasminUpdateService(liveJasmin, url);
|
LiveJasminUpdateService s = new LiveJasminUpdateService(liveJasmin, url);
|
||||||
|
s.setPeriod(Duration.seconds(60));
|
||||||
ThumbOverviewTab tab = new LiveJasminTab(title, s, liveJasmin);
|
ThumbOverviewTab tab = new LiveJasminTab(title, s, liveJasmin);
|
||||||
tab.setRecorder(liveJasmin.getRecorder());
|
tab.setRecorder(liveJasmin.getRecorder());
|
||||||
s.setPeriod(Duration.seconds(60));
|
tab.setImageAspectRatio(9.0 / 16.0);
|
||||||
return tab;
|
return tab;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -29,6 +29,7 @@ public class MVLiveTabProvider extends TabProvider {
|
||||||
MVLiveUpdateService updateService = new MVLiveUpdateService(mvlive);
|
MVLiveUpdateService updateService = new MVLiveUpdateService(mvlive);
|
||||||
ThumbOverviewTab tab = new ThumbOverviewTab(title, updateService, mvlive);
|
ThumbOverviewTab tab = new ThumbOverviewTab(title, updateService, mvlive);
|
||||||
tab.setRecorder(mvlive.getRecorder());
|
tab.setRecorder(mvlive.getRecorder());
|
||||||
|
tab.setImageAspectRatio(1);
|
||||||
return tab;
|
return tab;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -35,20 +35,16 @@ public class MyFreeCamsTabProvider extends TabProvider {
|
||||||
tabs.add(friends);
|
tabs.add(friends);
|
||||||
|
|
||||||
updateService = new HDCamsUpdateService();
|
updateService = new HDCamsUpdateService();
|
||||||
ThumbOverviewTab hd = new ThumbOverviewTab("HD", updateService, myFreeCams);
|
ThumbOverviewTab hd = createTab("HD", updateService);
|
||||||
hd.setRecorder(recorder);
|
hd.setImageAspectRatio(9.0 / 16.0);
|
||||||
//hd.setImageAspectRatio(9.0 / 16.0);
|
hd.preserveAspectRatioProperty().set(false);
|
||||||
tabs.add(hd);
|
tabs.add(hd);
|
||||||
|
|
||||||
updateService = new PopularModelService();
|
updateService = new PopularModelService();
|
||||||
ThumbOverviewTab pop = new ThumbOverviewTab("Most Popular", updateService, myFreeCams);
|
tabs.add(createTab("Most Popular", updateService));
|
||||||
pop.setRecorder(recorder);
|
|
||||||
tabs.add(pop);
|
|
||||||
|
|
||||||
updateService = new NewModelService();
|
updateService = new NewModelService();
|
||||||
ThumbOverviewTab newModels = new ThumbOverviewTab("New", updateService, myFreeCams);
|
tabs.add(createTab("New", updateService));
|
||||||
newModels.setRecorder(recorder);
|
|
||||||
tabs.add(newModels);
|
|
||||||
|
|
||||||
MyFreeCamsTableTab table = new MyFreeCamsTableTab(myFreeCams);
|
MyFreeCamsTableTab table = new MyFreeCamsTableTab(myFreeCams);
|
||||||
tabs.add(table);
|
tabs.add(table);
|
||||||
|
@ -56,6 +52,12 @@ public class MyFreeCamsTabProvider extends TabProvider {
|
||||||
return tabs;
|
return tabs;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private ThumbOverviewTab createTab(String title, PaginatedScheduledService updateService) {
|
||||||
|
ThumbOverviewTab tab = new ThumbOverviewTab(title, updateService, myFreeCams);
|
||||||
|
tab.setRecorder(recorder);
|
||||||
|
return tab;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Tab getFollowedTab() {
|
public Tab getFollowedTab() {
|
||||||
return friends;
|
return friends;
|
||||||
|
|
|
@ -38,6 +38,7 @@ public class StripchatTabProvider extends TabProvider {
|
||||||
tabs.add(createTab("Trans", MessageFormat.format(urlTemplate, "trans")));
|
tabs.add(createTab("Trans", MessageFormat.format(urlTemplate, "trans")));
|
||||||
followedTab.setRecorder(recorder);
|
followedTab.setRecorder(recorder);
|
||||||
followedTab.setScene(scene);
|
followedTab.setScene(scene);
|
||||||
|
followedTab.setImageAspectRatio(9.0 / 16.0);
|
||||||
tabs.add(followedTab);
|
tabs.add(followedTab);
|
||||||
return tabs;
|
return tabs;
|
||||||
}
|
}
|
||||||
|
@ -51,6 +52,7 @@ public class StripchatTabProvider extends TabProvider {
|
||||||
StripchatUpdateService updateService = new StripchatUpdateService(url, false, stripchat);
|
StripchatUpdateService updateService = new StripchatUpdateService(url, false, stripchat);
|
||||||
ThumbOverviewTab tab = new ThumbOverviewTab(title, updateService, stripchat);
|
ThumbOverviewTab tab = new ThumbOverviewTab(title, updateService, stripchat);
|
||||||
tab.setRecorder(recorder);
|
tab.setRecorder(recorder);
|
||||||
|
tab.setImageAspectRatio(9.0 / 16.0);
|
||||||
return tab;
|
return tab;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -37,6 +37,7 @@ import javafx.animation.FillTransition;
|
||||||
import javafx.animation.ParallelTransition;
|
import javafx.animation.ParallelTransition;
|
||||||
import javafx.animation.Transition;
|
import javafx.animation.Transition;
|
||||||
import javafx.application.Platform;
|
import javafx.application.Platform;
|
||||||
|
import javafx.beans.property.BooleanProperty;
|
||||||
import javafx.beans.property.SimpleBooleanProperty;
|
import javafx.beans.property.SimpleBooleanProperty;
|
||||||
import javafx.beans.value.ChangeListener;
|
import javafx.beans.value.ChangeListener;
|
||||||
import javafx.beans.value.ObservableValue;
|
import javafx.beans.value.ObservableValue;
|
||||||
|
@ -92,6 +93,7 @@ public class ThumbCell extends StackPane {
|
||||||
private final Color colorRecording = new Color(0.8, 0.28, 0.28, .8);
|
private final Color colorRecording = new Color(0.8, 0.28, 0.28, .8);
|
||||||
private SimpleBooleanProperty selectionProperty = new SimpleBooleanProperty(false);
|
private SimpleBooleanProperty selectionProperty = new SimpleBooleanProperty(false);
|
||||||
private double imgAspectRatio = 3.0 / 4.0;
|
private double imgAspectRatio = 3.0 / 4.0;
|
||||||
|
private SimpleBooleanProperty preserveAspectRatio = new SimpleBooleanProperty(true);
|
||||||
|
|
||||||
private ObservableList<Node> thumbCellList;
|
private ObservableList<Node> thumbCellList;
|
||||||
private boolean mouseHovering = false;
|
private boolean mouseHovering = false;
|
||||||
|
@ -120,7 +122,6 @@ public class ThumbCell extends StackPane {
|
||||||
iv = new ImageView();
|
iv = new ImageView();
|
||||||
iv.setSmooth(true);
|
iv.setSmooth(true);
|
||||||
iv.setPreserveRatio(true);
|
iv.setPreserveRatio(true);
|
||||||
setImage(model.getPreview());
|
|
||||||
getChildren().add(iv);
|
getChildren().add(iv);
|
||||||
|
|
||||||
nameBackground = new Rectangle();
|
nameBackground = new Rectangle();
|
||||||
|
@ -351,7 +352,9 @@ public class ThumbCell extends StackPane {
|
||||||
.build();
|
.build();
|
||||||
try (Response resp = CamrecApplication.httpClient.execute(req)) {
|
try (Response resp = CamrecApplication.httpClient.execute(req)) {
|
||||||
if (resp.isSuccessful()) {
|
if (resp.isSuccessful()) {
|
||||||
Image img = new Image(resp.body().byteStream(), 0, 360, true, true);
|
double width = 480;
|
||||||
|
double height = width * imgAspectRatio;
|
||||||
|
Image img = new Image(resp.body().byteStream(), width, height, preserveAspectRatio.get(), true);
|
||||||
if (img.progressProperty().get() == 1.0) {
|
if (img.progressProperty().get() == 1.0) {
|
||||||
Platform.runLater(() -> {
|
Platform.runLater(() -> {
|
||||||
iv.setImage(img);
|
iv.setImage(img);
|
||||||
|
@ -609,7 +612,6 @@ public class ThumbCell extends StackPane {
|
||||||
|
|
||||||
public void setThumbWidth(int width) {
|
public void setThumbWidth(int width) {
|
||||||
int height = (int) (width * imgAspectRatio);
|
int height = (int) (width * imgAspectRatio);
|
||||||
setPrefSize(width, height);
|
|
||||||
setSize(width, height);
|
setSize(width, height);
|
||||||
iv.prefHeight(height);
|
iv.prefHeight(height);
|
||||||
iv.prefWidth(width);
|
iv.prefWidth(width);
|
||||||
|
@ -660,4 +662,8 @@ public class ThumbCell extends StackPane {
|
||||||
public void setImageAspectRatio(double imageAspectRatio) {
|
public void setImageAspectRatio(double imageAspectRatio) {
|
||||||
this.imgAspectRatio = imageAspectRatio;
|
this.imgAspectRatio = imageAspectRatio;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public BooleanProperty preserveAspectRatioProperty() {
|
||||||
|
return preserveAspectRatio;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -49,6 +49,8 @@ import javafx.animation.ScaleTransition;
|
||||||
import javafx.animation.Transition;
|
import javafx.animation.Transition;
|
||||||
import javafx.animation.TranslateTransition;
|
import javafx.animation.TranslateTransition;
|
||||||
import javafx.application.Platform;
|
import javafx.application.Platform;
|
||||||
|
import javafx.beans.property.BooleanProperty;
|
||||||
|
import javafx.beans.property.SimpleBooleanProperty;
|
||||||
import javafx.beans.value.ChangeListener;
|
import javafx.beans.value.ChangeListener;
|
||||||
import javafx.collections.FXCollections;
|
import javafx.collections.FXCollections;
|
||||||
import javafx.collections.ObservableList;
|
import javafx.collections.ObservableList;
|
||||||
|
@ -117,6 +119,7 @@ public class ThumbOverviewTab extends Tab implements TabSelectionListener {
|
||||||
SearchPopover popover;
|
SearchPopover popover;
|
||||||
SearchPopoverTreeList popoverTreelist = new SearchPopoverTreeList();
|
SearchPopoverTreeList popoverTreelist = new SearchPopoverTreeList();
|
||||||
double imageAspectRatio = 3.0 / 4.0;
|
double imageAspectRatio = 3.0 / 4.0;
|
||||||
|
private SimpleBooleanProperty preserveAspectRatio = new SimpleBooleanProperty(true);
|
||||||
|
|
||||||
private ComboBox<Integer> thumbWidth;
|
private ComboBox<Integer> thumbWidth;
|
||||||
|
|
||||||
|
@ -380,6 +383,7 @@ public class ThumbOverviewTab extends Tab implements TabSelectionListener {
|
||||||
ThumbCell newCell = createThumbCell(model, recorder);
|
ThumbCell newCell = createThumbCell(model, recorder);
|
||||||
newCell.setIndex(index);
|
newCell.setIndex(index);
|
||||||
newCell.setImageAspectRatio(imageAspectRatio);
|
newCell.setImageAspectRatio(imageAspectRatio);
|
||||||
|
newCell.preserveAspectRatioProperty().bind(preserveAspectRatio);
|
||||||
positionChangedOrNew.add(newCell);
|
positionChangedOrNew.add(newCell);
|
||||||
}
|
}
|
||||||
index++;
|
index++;
|
||||||
|
@ -909,4 +913,8 @@ public class ThumbOverviewTab extends Tab implements TabSelectionListener {
|
||||||
public void setImageAspectRatio(double imageAspectRatio) {
|
public void setImageAspectRatio(double imageAspectRatio) {
|
||||||
this.imageAspectRatio = imageAspectRatio;
|
this.imageAspectRatio = imageAspectRatio;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public BooleanProperty preserveAspectRatioProperty() {
|
||||||
|
return preserveAspectRatio;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue