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