Skip to content

Instantly share code, notes, and snippets.

@Camden5S
Created March 31, 2019 10:03
Show Gist options
  • Save Camden5S/c1c0fa1eb048dbb25b0fdf4df1641e54 to your computer and use it in GitHub Desktop.
Save Camden5S/c1c0fa1eb048dbb25b0fdf4df1641e54 to your computer and use it in GitHub Desktop.
Here we are actually creating the carousels and the items within them. Each item has an image associated with it. The name of each drink is already included in the image so it makes it easy to view.
//---------------------------------------------
// 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