use of com.android.tools.idea.wizard.WizardConstants.DEFAULT_GALLERY_THUMBNAIL_SIZE in project android by JetBrains.
the class ChooseModuleTypeStep method createGallery.
@NotNull
private JComponent createGallery() {
myFormFactorGallery = new ASGallery<ModuleGalleryEntry>(JBList.createDefaultListModel(), image -> image.getIcon() == null ? null : IconUtil.toImage(image.getIcon()), label -> label == null ? message("android.wizard.gallery.item.none") : label.getName(), DEFAULT_GALLERY_THUMBNAIL_SIZE, null) {
@Override
public Dimension getPreferredScrollableViewportSize() {
// The default implementations assigns a height as tall as the screen.
// When calling setVisibleRowCount(2), the underlying implementation is buggy, and will have a gap on the right and when the user
// resizes, it enters on an adjustment loop at some widths (can't decide to fit 3 or for elements, and loops between the two)
Dimension cellSize = computeCellSize();
int heightInsets = getInsets().top + getInsets().bottom;
int widthInsets = getInsets().left + getInsets().right;
// Don't want to show an exact number of rows, since then it's not obvious there's another row available.
return new Dimension(cellSize.width * 5 + widthInsets, (int) (cellSize.height * 2.2) + heightInsets);
}
};
myFormFactorGallery.setBorder(BorderFactory.createLineBorder(JBColor.border()));
AccessibleContext accessibleContext = myFormFactorGallery.getAccessibleContext();
if (accessibleContext != null) {
accessibleContext.setAccessibleDescription(getTitle());
}
return new JBScrollPane(myFormFactorGallery);
}
Aggregations