Skip to content

Instantly share code, notes, and snippets.

@CWrecker
Last active March 31, 2019 09:51
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save CWrecker/d6ab812cf5875edff1af3e669baf5b6d to your computer and use it in GitHub Desktop.
Save CWrecker/d6ab812cf5875edff1af3e669baf5b6d to your computer and use it in GitHub Desktop.
Here we are actually creating the carousels. There are three in total. One for Gin, Rum and wisky. an item is then added to a carousel, with an image attached. This is what will show up on the screen. The images already have the names written on them so it makes it easy to find a drink.
//---------------------------------------------
// DRINK ITEMS / IMAGES ON CAROUSEL!
//---------------------------------------------
carouselPicker1 = findViewById(R.id.carouselPicker1);
carouselPicker2 = findViewById(R.id.carouselPicker2);
carouselPicker3 = findViewById(R.id.carouselPicker3);
//VODKA BASED DRINKS
List<CarouselPicker.PickerItem> itemsImages = new ArrayList<>();
itemsImages.add(new CarouselPicker.DrawableItem(R.mipmap.ic_launcher_round));
itemsImages.add(new CarouselPicker.DrawableItem(R.mipmap.drinkpic01));
itemsImages.add(new CarouselPicker.DrawableItem(R.mipmap.drinkpic02));
itemsImages.add(new CarouselPicker.DrawableItem(R.mipmap.drinkpic03));
itemsImages.add(new CarouselPicker.DrawableItem(R.mipmap.drinkpic04));
CarouselPicker.CarouselViewAdapter imageAdapter = new CarouselPicker.CarouselViewAdapter(this, itemsImages, 0);
carouselPicker1.setAdapter(imageAdapter);
//RUM BASED DRINKS
/**
List<CarouselPicker.PickerItem> textItems = new ArrayList<>();
textItems.add(new CarouselPicker.TextItem("One", 2));
textItems.add(new CarouselPicker.TextItem("Two", 2));
textItems.add(new CarouselPicker.TextItem("Three", 2));
CarouselPicker.CarouselViewAdapter textAdapter = new CarouselPicker.CarouselViewAdapter(this, textItems, 0);
carouselPicker2.setAdapter(textAdapter);
**/
List<CarouselPicker.PickerItem> RumImages = new ArrayList<>();
RumImages.add(new CarouselPicker.DrawableItem(R.mipmap.ic_launcher_round));
RumImages.add(new CarouselPicker.DrawableItem(R.mipmap.drinkpic01));
RumImages.add(new CarouselPicker.DrawableItem(R.mipmap.drinkpic02));
RumImages.add(new CarouselPicker.DrawableItem(R.mipmap.drinkpic03));
RumImages.add(new CarouselPicker.DrawableItem(R.mipmap.drinkpic04));
CarouselPicker.CarouselViewAdapter imageRumAdapter = new CarouselPicker.CarouselViewAdapter(this, RumImages, 0);
carouselPicker2.setAdapter(imageRumAdapter);
//GIN BASED DRINKS
/**
List<CarouselPicker.PickerItem> mixItems = new ArrayList<>();
mixItems.add(new CarouselPicker.TextItem("One", 2));
mixItems.add(new CarouselPicker.DrawableItem(R.mipmap.drinkpic06));
mixItems.add(new CarouselPicker.TextItem("Three", 2));
mixItems.add(new CarouselPicker.DrawableItem(R.mipmap.drinkpic07));
CarouselPicker.CarouselViewAdapter mixAdapter = new CarouselPicker.CarouselViewAdapter(this, mixItems, 0);
carouselPicker3.setAdapter(mixAdapter);
**/
List<CarouselPicker.PickerItem> GinImages = new ArrayList<>();
GinImages.add(new CarouselPicker.DrawableItem(R.mipmap.ic_launcher_round));
GinImages.add(new CarouselPicker.DrawableItem(R.mipmap.drinkpic01));
GinImages.add(new CarouselPicker.DrawableItem(R.mipmap.drinkpic02));
GinImages.add(new CarouselPicker.DrawableItem(R.mipmap.drinkpic03));
GinImages.add(new CarouselPicker.DrawableItem(R.mipmap.drinkpic04));
CarouselPicker.CarouselViewAdapter imageGinAdapter = new CarouselPicker.CarouselViewAdapter(this, GinImages, 0);
carouselPicker3.setAdapter(imageGinAdapter);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment