Search in sources :

Example 1 with Cat

use of com.hannesdorfmann.adapterdelegates3.sample.model.Cat in project AdapterDelegates by sockeqwe.

the class MainActivity method getAnimals.

private List<DisplayableItem> getAnimals() {
    List<DisplayableItem> animals = new ArrayList<>();
    animals.add(new Cat("American Curl"));
    animals.add(new Cat("Baliness"));
    animals.add(new Cat("Bengal"));
    animals.add(new Cat("Corat"));
    animals.add(new Cat("Manx"));
    animals.add(new Cat("Nebelung"));
    animals.add(new Dog("Aidi"));
    animals.add(new Dog("Chinook"));
    animals.add(new Dog("Appenzeller"));
    animals.add(new Dog("Collie"));
    animals.add(new Snake("Mub Adder", "Adder"));
    animals.add(new Snake("Texas Blind Snake", "Blind snake"));
    animals.add(new Snake("Tree Boa", "Boa"));
    animals.add(new Gecko("Fat-tailed", "Hemitheconyx"));
    animals.add(new Gecko("Stenodactylus", "Dune Gecko"));
    animals.add(new Gecko("Leopard Gecko", "Eublepharis"));
    animals.add(new Gecko("Madagascar Gecko", "Phelsuma"));
    animals.add(new Advertisement());
    animals.add(new Advertisement());
    animals.add(new Advertisement());
    animals.add(new Advertisement());
    animals.add(new Advertisement());
    Collections.shuffle(animals);
    return animals;
}
Also used : DisplayableItem(com.hannesdorfmann.adapterdelegates3.sample.model.DisplayableItem) Snake(com.hannesdorfmann.adapterdelegates3.sample.model.Snake) Cat(com.hannesdorfmann.adapterdelegates3.sample.model.Cat) ArrayList(java.util.ArrayList) Advertisement(com.hannesdorfmann.adapterdelegates3.sample.model.Advertisement) Dog(com.hannesdorfmann.adapterdelegates3.sample.model.Dog) Gecko(com.hannesdorfmann.adapterdelegates3.sample.model.Gecko)

Example 2 with Cat

use of com.hannesdorfmann.adapterdelegates3.sample.model.Cat in project AdapterDelegates by sockeqwe.

the class CatAdapterDelegate method onBindViewHolder.

@Override
public void onBindViewHolder(@NonNull List<DisplayableItem> items, int position, @NonNull RecyclerView.ViewHolder holder, @Nullable List<Object> payloads) {
    CatViewHolder vh = (CatViewHolder) holder;
    Cat cat = (Cat) items.get(position);
    vh.name.setText(cat.getName());
    Log.d("Scroll", "CatAdapterDelegate bind  " + position);
}
Also used : Cat(com.hannesdorfmann.adapterdelegates3.sample.model.Cat)

Example 3 with Cat

use of com.hannesdorfmann.adapterdelegates3.sample.model.Cat in project AdapterDelegates by sockeqwe.

the class MainActivity method getAnimals.

private List<DisplayableItem> getAnimals() {
    List<DisplayableItem> animals = new ArrayList<>();
    animals.add(new Cat("American Curl"));
    animals.add(new Cat("Baliness"));
    animals.add(new Cat("Bengal"));
    animals.add(new Cat("Corat"));
    animals.add(new Cat("Manx"));
    animals.add(new Cat("Nebelung"));
    animals.add(new Dog("Aidi"));
    animals.add(new Dog("Chinook"));
    animals.add(new Dog("Appenzeller"));
    animals.add(new Dog("Collie"));
    animals.add(new Snake("Mub Adder", "Adder"));
    animals.add(new Snake("Texas Blind Snake", "Blind snake"));
    animals.add(new Snake("Tree Boa", "Boa"));
    animals.add(new Gecko("Fat-tailed", "Hemitheconyx"));
    animals.add(new Gecko("Stenodactylus", "Dune Gecko"));
    animals.add(new Gecko("Leopard Gecko", "Eublepharis"));
    animals.add(new Gecko("Madagascar Gecko", "Phelsuma"));
    animals.add(new Advertisement());
    animals.add(new Advertisement());
    animals.add(new Advertisement());
    animals.add(new Advertisement());
    animals.add(new Advertisement());
    Collections.shuffle(animals);
    return animals;
}
Also used : DisplayableItem(com.hannesdorfmann.adapterdelegates4.sample.model.DisplayableItem) Snake(com.hannesdorfmann.adapterdelegates4.sample.model.Snake) Cat(com.hannesdorfmann.adapterdelegates4.sample.model.Cat) ArrayList(java.util.ArrayList) Advertisement(com.hannesdorfmann.adapterdelegates4.sample.model.Advertisement) Dog(com.hannesdorfmann.adapterdelegates4.sample.model.Dog) Gecko(com.hannesdorfmann.adapterdelegates4.sample.model.Gecko)

Example 4 with Cat

use of com.hannesdorfmann.adapterdelegates3.sample.model.Cat in project AdapterDelegates by sockeqwe.

the class CatAdapterDelegate method onBindViewHolder.

@Override
public void onBindViewHolder(@NonNull List<DisplayableItem> items, int position, @NonNull RecyclerView.ViewHolder holder, @Nullable List<Object> payloads) {
    CatViewHolder vh = (CatViewHolder) holder;
    Cat cat = (Cat) items.get(position);
    vh.name.setText(cat.getName());
    Log.d("Scroll", "CatAdapterDelegate bind  " + position);
}
Also used : Cat(com.hannesdorfmann.adapterdelegates4.sample.model.Cat)

Aggregations

Cat (com.hannesdorfmann.adapterdelegates3.sample.model.Cat)2 Cat (com.hannesdorfmann.adapterdelegates4.sample.model.Cat)2 ArrayList (java.util.ArrayList)2 Advertisement (com.hannesdorfmann.adapterdelegates3.sample.model.Advertisement)1 DisplayableItem (com.hannesdorfmann.adapterdelegates3.sample.model.DisplayableItem)1 Dog (com.hannesdorfmann.adapterdelegates3.sample.model.Dog)1 Gecko (com.hannesdorfmann.adapterdelegates3.sample.model.Gecko)1 Snake (com.hannesdorfmann.adapterdelegates3.sample.model.Snake)1 Advertisement (com.hannesdorfmann.adapterdelegates4.sample.model.Advertisement)1 DisplayableItem (com.hannesdorfmann.adapterdelegates4.sample.model.DisplayableItem)1 Dog (com.hannesdorfmann.adapterdelegates4.sample.model.Dog)1 Gecko (com.hannesdorfmann.adapterdelegates4.sample.model.Gecko)1 Snake (com.hannesdorfmann.adapterdelegates4.sample.model.Snake)1