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(); } }
@Override public boolean didFinishLaunching( UIApplication application, UIApplicationLaunchOptions launchOptions) { // Set up the view controller. rootViewController = new APAViewController(); // Create a new window at screen size. window = new UIWindow(UIScreen.getMainScreen().getBounds()); // Set our viewcontroller as the root controller for the window. window.setRootViewController(rootViewController); // Make the window visible. window.makeKeyAndVisible(); return true; }
@Override public void didFinishLaunching(UIApplication application) { window = new UIWindow(UIScreen.getMainScreen().getBounds()); window.makeKeyAndVisible(); UIViewController viewController = new UIViewController(); UIButton boton = new UIButton(new CGRect(10, 10, 200, 30)); boton.setBackgroundColor(new UIColor(1, 0, 0, 0.5f)); boton.setTitle("Send Mail", UIControlState.Normal); boton.addOnTouchUpInsideListener( new OnTouchUpInsideListener() { @Override public void onTouchUpInside(UIControl control, UIEvent event) { sendMail(); } }); viewController.setView(boton); window.setRootViewController(viewController); }