public void loadProductData() { colorOptions = currentProduct.getColors(); sizeOptions = currentProduct.getSizes(); imageUrls = currentProduct.getImageUrls(); Collections.shuffle(imageUrls); boolean loadImages = false; List<UIImage> images = new ArrayList<>(); for (String url : imageUrls) { File file = new File(url); if (file.exists()) { images.add(new UIImage(file)); } else { loadImages = true; } } imageView = new JBKenBurnsView( new CGRect(0, -60, UIScreen.getMainScreen().getBounds().getWidth(), 400)); imageView.setImages(images); imageView.setUserInteractionEnabled(false); if (loadImages) { // Add spinner while loading data. getTableView().setModel(new ProductDetailPageModel(new SpinnerCell())); loadImages(this::fillViewController); } else { fillViewController(); } }
public ProductDetailViewController(Product product) { this.currentProduct = product; this.order = new Order(product); setTitle(currentProduct.getName()); loadProductData(); getTableView().setTableFooterView(new UIView(new CGRect(0, 0, 0, BottomButtonView.HEIGHT))); tshirtIcon = UIImage.getImage("t-shirt"); bottomView = new BottomButtonView(); bottomView.setButtonText("Add to Basket"); bottomView.setButtonTapListener((b, e) -> addToBasket()); getView().addSubview(bottomView); }
public void update(Product product) { name.setText(product.getName()); descriptionLabel.setText(product.getDescription()); price.setText(product.getPriceDescription()); }