Package 

Class KRecyclerItemTypeBuilder


  • 
    public final class KRecyclerItemTypeBuilder
    
                        

    Class that maps types to providing functions

    To be able to support different item types in KRecyclerView, this class adds support for mapping item type classes to functions that provide them. KEmptyRecyclerItem is added by default.

    • Field Summary

      Fields 
      Modifier and Type Field Description
      private final <ERROR CLASS> itemTypes
    • Method Summary

      Modifier and Type Method Description
      final <ERROR CLASS> getItemTypes()
      final <T extends KRecyclerItem<?>> Unit itemType(Function1<Matcher<View>, T> provideItem) Adds entry that helps KRecyclerView to automatically build child viewsTo make it work, you need to pass here function (lambda, constructor), that takes matcher and returns instance of your item type.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • KRecyclerItemTypeBuilder

        KRecyclerItemTypeBuilder()
    • Method Detail

      • itemType

         final <T extends KRecyclerItem<?>> Unit itemType(Function1<Matcher<View>, T> provideItem)

        Adds entry that helps KRecyclerView to automatically build child views

        To make it work, you need to pass here function (lambda, constructor), that takes matcher and returns instance of your item type. In this case, matcher actually matches root view of your adapter item.

        Parameters:
        provideItem - Function that takes matcher of item's root view and returns instance of item view