Android Open Source - SuperSLiM Section Layout Manager






From Project

Back to project page SuperSLiM.

License

The source code is released under:

Apache License

If you think the Android project SuperSLiM listed in this page is inappropriate, such as containing malicious code/tools or violating the copyright, please email info at java2s dot com, thanks.

Java Source Code

package com.tonicartos.superslim;
//from   w w w  . j  a v  a 2  s . co m
import android.support.v7.widget.RecyclerView;
import android.view.View;

public abstract class SectionLayoutManager {

    private static final int MARGIN_UNSET = -1;

    protected RecyclerView.LayoutManager mLayoutManager;

    public SectionLayoutManager(LayoutManager layoutManager) {
        mLayoutManager = layoutManager;
    }

    /**
     * Measure and layout children. Make sure to only lay out views belonging to this mSection,
     * excepting headers, which are laid out by the wrapping layout manager.
     */
    public abstract FillResult fill(LayoutState state, SectionData sectionData);

    public int getAnchorPosition(LayoutState state, SectionData params,
            int position) {
        return position;
    }

    /**
     * Locate the view which has the earliest adapter position.
     *
     * @param sectionFirstPosition Section id.
     * @return View.
     */
    public abstract View getFirstView(int sectionFirstPosition);

    public int getHeaderEndMargin() {
        return MARGIN_UNSET;
    }

    public int getHeaderStartMargin() {
        return MARGIN_UNSET;
    }

    /**
     * Find the highest displayed edge of the section. If there is no member found then return the
     * start edge instead.
     */
    public abstract int getHighestEdge(int sectionFirstPosition, int startEdge);

    /**
     * Locate the view which has the latest adapter position.
     *
     * @param sectionFirstPosition Section id.
     * @return View.
     */
    public abstract View getLastView(int sectionFirstPosition);

    /**
     * Find the lowest displayed edge of the section. IF there is no member found then return the
     * end edge instead.
     */
    public abstract int getLowestEdge(int sectionFirstPosition, int endEdge);


}




Java Source Code List

com.tonicartos.superslim.ApplicationTest.java
com.tonicartos.superslim.FillResult.java
com.tonicartos.superslim.GridSectionLayoutManager.java
com.tonicartos.superslim.LayoutManager.java
com.tonicartos.superslim.LayoutState.java
com.tonicartos.superslim.LinearSectionLayoutManager.java
com.tonicartos.superslim.SectionData.java
com.tonicartos.superslim.SectionLayoutManager.java
com.tonicartos.superslimexample.ApplicationTest.java
com.tonicartos.superslimexample.CountriesFragment.java
com.tonicartos.superslimexample.CountryNamesAdapter.java
com.tonicartos.superslimexample.CountryViewHolder.java
com.tonicartos.superslimexample.MainActivity.java