Package 

Class KViewPagerItemTypeBuilder


  • 
    public final class KViewPagerItemTypeBuilder
    
                        

    Class that maps types to providing functions

    To be able to support different item types in KViewPager2, this class adds support for mapping item type classes to functions that provide them. KEmptyViewPagerItem 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 KViewPagerItem<?>> Unit itemType(Function1<Matcher<View>, T> provideItem) Adds entry that helps KViewPager2 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

      • KViewPagerItemTypeBuilder

        KViewPagerItemTypeBuilder()
    • Method Detail

      • itemType

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

        Adds entry that helps KViewPager2 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