Search in sources :

Example 6 with LongSparseArray

use of android.support.v4.util.LongSparseArray in project SeriesGuide by UweTrottmann.

the class CalendarAdapter method generateHeaderList.

protected List<HeaderData> generateHeaderList() {
    int count = getCount();
    if (count == 0 || !mIsShowingHeaders) {
        return null;
    }
    // pre-size to 30 as we display 30 days == headers at most
    LongSparseArray<HeaderData> mapping = new LongSparseArray<>(30);
    List<HeaderData> headers = new ArrayList<>();
    for (int position = 0; position < count; position++) {
        long headerId = getHeaderId(position);
        HeaderData headerData = mapping.get(headerId);
        if (headerData == null) {
            headerData = new HeaderData(position);
            headers.add(headerData);
        }
        headerData.incrementCount();
        mapping.put(headerId, headerData);
    }
    return headers;
}
Also used : LongSparseArray(android.support.v4.util.LongSparseArray) ArrayList(java.util.ArrayList) HeaderData(com.battlelancer.seriesguide.adapters.model.HeaderData)

Aggregations

LongSparseArray (android.support.v4.util.LongSparseArray)6 View (android.view.View)2 ListView (android.widget.ListView)2 HeaderData (com.battlelancer.seriesguide.adapters.model.HeaderData)2 Point (com.google.maps.android.geometry.Point)2 ArrayList (java.util.ArrayList)2 SuppressLint (android.annotation.SuppressLint)1 Parcelable (android.os.Parcelable)1 SparseBooleanArray (android.util.SparseBooleanArray)1 Cluster (com.google.maps.android.clustering.Cluster)1 SphericalMercatorProjection (com.google.maps.android.projection.SphericalMercatorProjection)1 HashSet (java.util.HashSet)1 AppListAdapter (org.ethack.orwall.adapter.AppListAdapter)1 AppRule (org.ethack.orwall.lib.AppRule)1 AppRuleComparator (org.ethack.orwall.lib.AppRuleComparator)1 Iptables (org.ethack.orwall.lib.Iptables)1 NatRules (org.ethack.orwall.lib.NatRules)1