Skip to content

5.x | Third party Layout Managers

jcuypers edited this page Feb 5, 2018 · 1 revision

Interface

The IFlexibleLayoutManager interface will make any third party LayoutManager suitable for FlexibleAdapter. Suppose you have any XYZLayoutManager library imported, you create a new class by extending that XYZLayoutManager and implementing IFlexibleLayoutManager.

ℹ️ Note: If you use the internal SmoothScroller Layout Managers, those, already implement this interface.

Example

⚠️ Warning: Some methods could be already implemented by XYZLayoutManager! If so, don't override them.

public class FlexibleXYZLayoutManager
       extends XYZLayoutManager
       implements IFlexibleLayoutManager {

    @Override
    public int getOrientation() {
        return ...
    }

    @Override
    public int getSpanCount() {
        return ...
    }

    @Override
    public int findFirstCompletelyVisibleItemPosition() {
        return ...
    }

    @Override
    public int findFirstVisibleItemPosition() {
        return ...
    }

    @Override
    public int findLastCompletelyVisibleItemPosition() {
        return ...
    }

    @Override
    public int findLastVisibleItemPosition() {
        return ...
    }

}
Clone this wiki locally