Code Monkey home page Code Monkey logo

stickylistheaders's Introduction

StickyListHeaders

StickyListHeaders is an Android library that makes it easy to integrate section headers in your ListView. These section headers stick to the top like in the new People app of Android 4.0 Ice Cream Sandwich. This behavior is also found in lists with sections on iOS devices. This library can also be used without the sticky functionality if you just want section headers.

StickyListHeaders actively supports android versions 2.3 (gingerbread) and above. That said, it works all the way down to 2.1 but is not actively tested or working perfectly.

Here is a short gif showing the functionality you get with this library:

alt text

Goal

The goal of this project is to deliver a high performance replacement to ListView. You should with minimal effort and time be able to add section headers to a list. This should be done via a simple to use API without any special features. This library will always priorities general use cases over special ones. This means that the library will add very few public methods to the standard ListView and will not try to work for every use case. While I will want to support even narrow use cases I will not do so if it compromises the API or any other feature.

Installing

###Maven Add the following maven dependency exchanging x.x.x for the latest release.

<dependency>
    <groupId>se.emilsjolander</groupId>
    <artifactId>stickylistheaders</artifactId>
    <version>x.x.x</version>
</dependency>

###Gradle Add the following gradle dependency exchanging x.x.x for the latest release.

dependencies {
    compile 'se.emilsjolander:stickylistheaders:x.x.x'
}

###Cloning First of all you will have to clone the library.

git clone https://github.com/emilsjolander/StickyListHeaders.git

Now that you have the library you will have to import it into Android Studio. In Android Studio navigate the menus like this.

File -> Import Project ...

In the following dialog navigate to StickyListHeaders which you cloned to your computer in the previous steps and select the build.gradle.

Getting Started

###Base usage

Ok lets start with your activities or fragments xml file. It might look something like this.

<se.emilsjolander.stickylistheaders.StickyListHeadersListView
    android:id="@+id/list"
    android:layout_width="match_parent"
    android:layout_height="match_parent"/>

Now in your activities onCreate() or your fragments onCreateView() you would want to do something like this

StickyListHeadersListView stickyList = (StickyListHeadersListView) findViewById(R.id.list);
MyAdapter adapter = new MyAdapter(this);
stickyList.setAdapter(adapter);

MyAdapter in the above example would look something like this if your list was a list of countries where each header was for a letter in the alphabet.

public class MyAdapter extends BaseAdapter implements StickyListHeadersAdapter {

    private String[] countries;
    private LayoutInflater inflater;

    public MyAdapter(Context context) {
        inflater = LayoutInflater.from(context);
        countries = context.getResources().getStringArray(R.array.countries);
    }

    @Override
    public int getCount() {
        return countries.length;
    }

    @Override
    public Object getItem(int position) {
        return countries[position];
    }

    @Override
    public long getItemId(int position) {
        return position;
    }

    @Override 
    public View getView(int position, View convertView, ViewGroup parent) {
        ViewHolder holder;

        if (convertView == null) {
            holder = new ViewHolder();
            convertView = inflater.inflate(R.layout.test_list_item_layout, parent, false);
            holder.text = (TextView) convertView.findViewById(R.id.text);
            convertView.setTag(holder);
        } else {
            holder = (ViewHolder) convertView.getTag();
        }

        holder.text.setText(countries[position]);

        return convertView;
    }

    @Override 
    public View getHeaderView(int position, View convertView, ViewGroup parent) {
        HeaderViewHolder holder;
        if (convertView == null) {
            holder = new HeaderViewHolder();
            convertView = inflater.inflate(R.layout.header, parent, false);
            holder.text = (TextView) convertView.findViewById(R.id.text);
            convertView.setTag(holder);
        } else {
            holder = (HeaderViewHolder) convertView.getTag();
        }
        //set header text as first char in name
        String headerText = "" + countries[position].subSequence(0, 1).charAt(0);
        holder.text.setText(headerText);
        return convertView;
    }

    @Override
    public long getHeaderId(int position) {
        //return the first character of the country as ID because this is what headers are based upon
        return countries[position].subSequence(0, 1).charAt(0);
    }

    class HeaderViewHolder {
        TextView text;
    }

    class ViewHolder {
        TextView text;
    }
    
}

That's it! Look through the API docs below to get know about things to customize and if you have any problems getting started please open an issue as it probably means the getting started guide need some improvement!

###Styling

You can apply your own theme to StickyListHeadersListViews. Say you define a style called Widget.MyApp.ListView in values/styles.xml:

<resources>
    <style name="Widget.MyApp.ListView" parent="@android:style/Widget.ListView">
        <item name="android:paddingLeft">@dimen/vertical_padding</item>
        <item name="android:paddingRight">@dimen/vertical_padding</item>
    </style>
</resources>

You can then apply this style to all StickyListHeadersListViews by adding something like this to your theme (e.g. values/themes.xml):

<resources>
    <style name="Theme.MyApp" parent="android:Theme.NoTitleBar">
        <item name="stickyListHeadersListViewStyle">@style/Widget.MyApp.ListView</item>
    </style>
</resources>

###Expandable support Now, you can use ExpandableStickyListHeadersListView to expand/collapse subitems. xml first

<se.emilsjolander.stickylistheaders.ExpandableStickyListHeadersListView
    android:id="@+id/list"
    android:layout_width="match_parent"
    android:layout_height="match_parent"/>

Then you need to setup your listview on onCreate() or onCreateView()๏ผš

ExpandableStickyListHeadersListView expandableStickyList = (ExpandableStickyListHeadersListView) findViewById(R.id.list);
StickyListHeadersAdapter adapter = new MyAdapter(this);
expandableStickyList.setAdapter(adapter);
expandableStickyList.setOnHeaderClickListener(new StickyListHeadersListView.OnHeaderClickListener() {
            @Override
            public void onHeaderClick(StickyListHeadersListView l, View header, int itemPosition, long headerId, boolean currentlySticky) {
                if(expandableStickyList.isHeaderCollapsed(headerId)){
                    expandableStickyList.expand(headerId);
                }else {
                    expandableStickyList.collapse(headerId);
                }
            }
        });

As you see, MyAdapter is just a StickyListHeadersAdapter which is mentioned in the previous section. You needn't do any more extra operations.

There are three important functions: isHeaderCollapsed(long headerId),expand(long headerId) and collapse(long headerId).

The function isHeaderCollapsed is used to check whether the subitems belonging to the header have collapsed. You can call expand or collapse method to hide or show subitems. You can also define a AnimationExecutor which implements ExpandableStickyListHeadersListView.IAnimationExecutor, and put it into the ExpandableStickyListHeadersListView by setAnimExecutor method,if you want more fancy animation when hiding or showing subitems.

Upgrading from 1.x versions

First of all the package name has changed from com.emilsjolander.components.stickylistheaders -> se.emilsjolander.stickylistheaders so update all your imports and xml files using StickyListHeaders!

If you are Upgrading from a version prior to 2.x you might run into the following problems.

  1. StickyListHeadersListView is no longer a ListView subclass. This means that it cannot be passed into a method expecting a ListView. You can retrieve an instance of the ListView via getWrappedList() but use this with caution as things will probably break if you start setting things directly on that list.
  2. Because StickyListHeadersListView is no longer a ListView it does not support all the methods. I have implemented delegate methods for all the usual methods and gladly accept pull requests for more.

API

###StickyListHeadersAdapter

public interface StickyListHeadersAdapter extends ListAdapter {
    View getHeaderView(int position, View convertView, ViewGroup parent);
    long getHeaderId(int position);
}

Your adapter must implement this interface to function with StickyListHeadersListView. getHeaderId() must return a unique integer for every section. A valid implementation for a list with alphabetical sections is the return the char value of the section that position is a part of.

getHeaderView() works exactly like getView() in a regular ListAdapter.

###StickyListHeadersListView Headers are sticky by default but that can easily be changed with this setter. There is of course also a matching getter for the sticky property.

public void setAreHeadersSticky(boolean areHeadersSticky);
public boolean areHeadersSticky();

A OnHeaderClickListener is the header version of OnItemClickListener. This is the setter for it and the interface of the listener. The currentlySticky boolean flag indicated if the header that was clicked was sticking to the top at the time it was clicked.

public void setOnHeaderClickListener(OnHeaderClickListener listener);

public interface OnHeaderClickListener {
    public void onHeaderClick(StickyListHeadersListView l, View header, int itemPosition, long headerId, boolean currentlySticky);
}

A OnStickyHeaderOffsetChangedListener is a Listener used for listening to when the sticky header slides out of the screen. The offset parameter will slowly grow to be the same size as the headers height. Use the listeners callback to transform the header in any way you see fit, the standard android contacts app dims the text for example.

public void setOnStickyHeaderOffsetChangedListener(OnStickyHeaderOffsetChangedListener listener);

public interface OnStickyHeaderOffsetChangedListener {
    public void onStickyHeaderOffsetChanged(StickyListHeadersListView l, View header, int offset);
}

A OnStickyHeaderChangedListener listens for changes to the header. This enables UI elements elsewhere to react to the current header (e.g. if each header is a date, then the rest of the UI can update when you scroll to a new date).

public void setOnStickyHeaderChangedListener(OnStickyHeaderChangedListener listener);

public interface OnStickyHeaderChangedListener {
    void onStickyHeaderChanged(StickyListHeadersListView l, View header, int itemPosition, long headerId);
}

Here are two methods added to the API for inspecting the children of the underlying ListView. I could not override the normal getChildAt() and getChildCount() methods as that would mess up the underlying measurement system of the FrameLayout wrapping the ListView.

public View getListChildAt(int index);
public int getListChildCount();

This is a setter and getter for an internal attribute that controls if the list should be drawn under the stuck header. The default value is true. If you do not want to see the list scroll under your header you will want to set this attribute to false.

public void setDrawingListUnderStickyHeader(boolean drawingListUnderStickyHeader);
public boolean isDrawingListUnderStickyHeader();

If you are using a transparent action bar the following getter+setter will be very helpful. Use them to set the position of the sticky header from the top of the view.

public void setStickyHeaderTopOffset(int stickyHeaderTopOffset);
public int getStickyHeaderTopOffset();

Get the amount of overlap the sticky header has when position in on the top of the list.

public int getHeaderOverlap(int position);

Contributing

Contributions are very welcome. Now that this library has grown in popularity i have a hard time keeping upp with all the issues while tending to a multitude of other projects as well as school. So if you find a bug in the library or want a feature and think you can fix it yourself, fork + pull request and i will greatly appreciate it!

I love getting pull requests for new features as well as bugs. However, when it comes to new features please also explain the use case and way you think the library should include it. If you don't want to start coding a feature without knowing if the feature will have chance of being included, open an issue and we can discuss the feature!

stickylistheaders's People

Contributors

aballano avatar androidmoney avatar anton-novikau avatar arturdryomov avatar briangriffey avatar cameoh avatar christiankatzmann avatar dmccartneyklout avatar emilsjolander avatar ffgiraldez avatar ghawk1ns avatar intrications avatar isaacseymour avatar jakewharton avatar josh-burton avatar lsjwzh avatar meredrica avatar mpfeiffermway avatar mtotschnig avatar passos avatar plastiv avatar rciovati avatar rno avatar sohamtriveous avatar thatsmydoing avatar thibaut-buirette avatar tymarc avatar yarikx avatar yhpark avatar zach-klippenstein avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

stickylistheaders's Issues

Problems with padding and "stuck" headers

When there are elements in the header that are right aligned, they move a little to the right when the header becomes "stuck". This only happens when the list has padding, almost as if the header forgets about the padding. This also happens in the sample project so I'm wondering if this is supposed to happen?

The reason this is a problem is that i have an expand arrow on the header which when pressed will expand the list. It doesn't look good when it suddenly disappears as the header becomes stuck. I could remove the padding but I don't like the look of the dividers being edge to edge.

Crash while scrolling to second sticky header

Reproduction:

  • ListView with two headers
  • Scroll down till second header will become sticky
  • SetText will cause a crash

LOGCAT

FATAL EXCEPTION: main
java.lang.NullPointerException
at android.widget.TextView.checkForRelayout(TextView.java:6729)
at android.widget.TextView.setText(TextView.java:3306)
at android.widget.TextView.setText(TextView.java:3162)
at android.widget.TextView.setText(TextView.java:3137)
at mobi.inthepocket.madoc.heuvelland.adapters.StickyThematizedAdapter.bindHeaderView(StickyThematizedAdapter.java:41)
at mobi.inthepocket.madoc.heuvelland.stickylistheader.StickyListHeadersCursorAdapter.getHeaderView(StickyListHeadersCursorAdapter.java:89)
at mobi.inthepocket.madoc.heuvelland.stickylistheader.StickyListHeadersListView.onScroll(StickyListHeadersListView.java:274)
at android.widget.AbsListView.invokeOnItemScrollListener(AbsListView.java:1276)
at android.widget.AbsListView.trackMotionScroll(AbsListView.java:4565)
at android.widget.AbsListView.scrollIfNeeded(AbsListView.java:2852)
at android.widget.AbsListView.onTouchEvent(AbsListView.java:3106)
at android.view.View.dispatchTouchEvent(View.java:5541)
at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:1951)
at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:1712)
at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:1957)
at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:1726)
at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:1957)
at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:1726)
at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:1957)
at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:1726)
at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:1957)
at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:1726)
at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:1957)
at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:1726)
at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:1957)
at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:1726)
at com.android.internal.policy.impl.PhoneWindow$DecorView.superDispatchTouchEvent(PhoneWindow.java:1912)
at com.android.internal.policy.impl.PhoneWindow.superDispatchTouchEvent(PhoneWindow.java:1371)
at android.app.Activity.dispatchTouchEvent(Activity.java:2364)
at com.android.internal.policy.impl.PhoneWindow$DecorView.dispatchTouchEvent(PhoneWindow.java:1860)
at android.view.View.dispatchPointerEvent(View.java:5721)
at android.view.ViewRootImpl.deliverPointerEvent(ViewRootImpl.java:2890)
at android.view.ViewRootImpl.handleMessage(ViewRootImpl.java:2466)
at android.view.ViewRootImpl.processInputEvents(ViewRootImpl.java:845)
at android.view.ViewRootImpl.handleMessage(ViewRootImpl.java:2475)
at android.os.Handler.dispatchMessage(Handler.java:99)
at android.os.Looper.loop(Looper.java:137)
at android.app.ActivityThread.main(ActivityThread.java:4424)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:511)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:784)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:551)
at dalvik.system.NativeStart.main(Native Method)

IMPLEMENTATION

@OverRide
protected View newHeaderView(Context context, Cursor cursor)
{
final TextView textView = (TextView)LayoutInflater.from(context).inflate(R.layout.listview_spotslist_header, null);
return textView;
}

@OverRide
protected void bindHeaderView(View view, Context context, Cursor cursor)
{
final ThematizedSpot t = new ThematizedSpot();
t.constructFromCursor(cursor);

if (view instanceof TextView)
{
    final TextView textView = (TextView)view;
    String text = t.getSpot().isVisited() ? context.getResources().getString(R.string.pathdetail_visited) : context.getResources().getString(R.string.pathdetail_unvisited);
    if (text == null)
        text = "";
    textView.setText(text);
}

}

@OverRide
protected long getHeaderId(Context context, Cursor cursor)
{
final ThematizedSpot t = new ThematizedSpot();
t.constructFromCursor(cursor);
return (t.getSpot().isVisited() ? 1 : 0);
}

Consider replacing layout\wrapper.xml with code

There is really no good reason why a single LinearLayout should be inflated from a resource. Creating it from code is just as simple and faster.

So the WrapperView constructors should be changed to:

public WrapperView(Context c) {
    setup(new LinearLayout(context));
}

public WrapperView(View v) {
    setup((LinearLayout) v);
}


private void setup(LinearLayout linearLayout)
{
    linearLayout.setOrientation(LinearLayout.VERTICAL);
    linearLayout.setId(R.id.wrapper);

    this.v = linearLayout;
}

There maybe some other minor changes needed to the LayoutParams, so if you make the other changes, I can submit a pull request.

"Jump" to specific header

Is it possible to jump/scroll to a specific header?

I tried setSelection(index), which didn't work.
And I tried scrollTo(0, 100), which scrolls, but the headers arent drawn correctly.

A convenience function would be nice, like scrollToHeader("StickyHeader2");

Kind regards

Unable to use fastscrolling

Looks like the new implementation broke the ability to use fast scrolling. To reproduce just put android:fastScrollEnabled="true"attribute at the ListView in the sample project.

Logcat:

12-08 19:28:20.973: E/AndroidRuntime(28358): FATAL EXCEPTION: main
12-08 19:28:20.973: E/AndroidRuntime(28358): java.lang.ClassCastException: com.emilsjolander.components.stickylistheaders.StickyListHeadersAdapterWrapper cannot be cast to android.widget.BaseAdapter
12-08 19:28:20.973: E/AndroidRuntime(28358):    at android.widget.FastScroller.getSectionsFromIndexer(FastScroller.java:511)
12-08 19:28:20.973: E/AndroidRuntime(28358):    at android.widget.FastScroller.getThumbPositionForListPosition(FastScroller.java:632)
12-08 19:28:20.973: E/AndroidRuntime(28358):    at android.widget.FastScroller.onScroll(FastScroller.java:457)
12-08 19:28:20.973: E/AndroidRuntime(28358):    at android.widget.AbsListView.invokeOnItemScrollListener(AbsListView.java:1337)
12-08 19:28:20.973: E/AndroidRuntime(28358):    at android.widget.ListView.layoutChildren(ListView.java:1753)
12-08 19:28:20.973: E/AndroidRuntime(28358):    at android.widget.AbsListView.onLayout(AbsListView.java:1994)
12-08 19:28:20.973: E/AndroidRuntime(28358):    at android.view.View.layout(View.java:14003)
12-08 19:28:20.973: E/AndroidRuntime(28358):    at android.view.ViewGroup.layout(ViewGroup.java:4375)
12-08 19:28:20.973: E/AndroidRuntime(28358):    at android.widget.LinearLayout.setChildFrame(LinearLayout.java:1663)
12-08 19:28:20.973: E/AndroidRuntime(28358):    at android.widget.LinearLayout.layoutVertical(LinearLayout.java:1521)
12-08 19:28:20.973: E/AndroidRuntime(28358):    at android.widget.LinearLayout.onLayout(LinearLayout.java:1434)
12-08 19:28:20.973: E/AndroidRuntime(28358):    at android.view.View.layout(View.java:14003)
12-08 19:28:20.973: E/AndroidRuntime(28358):    at android.view.ViewGroup.layout(ViewGroup.java:4375)
12-08 19:28:20.973: E/AndroidRuntime(28358):    at android.widget.FrameLayout.onLayout(FrameLayout.java:448)
12-08 19:28:20.973: E/AndroidRuntime(28358):    at android.view.View.layout(View.java:14003)
12-08 19:28:20.973: E/AndroidRuntime(28358):    at android.view.ViewGroup.layout(ViewGroup.java:4375)
12-08 19:28:20.973: E/AndroidRuntime(28358):    at android.widget.LinearLayout.setChildFrame(LinearLayout.java:1663)
12-08 19:28:20.973: E/AndroidRuntime(28358):    at android.widget.LinearLayout.layoutVertical(LinearLayout.java:1521)
12-08 19:28:20.973: E/AndroidRuntime(28358):    at android.widget.LinearLayout.onLayout(LinearLayout.java:1434)
12-08 19:28:20.973: E/AndroidRuntime(28358):    at android.view.View.layout(View.java:14003)
12-08 19:28:20.973: E/AndroidRuntime(28358):    at android.view.ViewGroup.layout(ViewGroup.java:4375)
12-08 19:28:20.973: E/AndroidRuntime(28358):    at android.widget.FrameLayout.onLayout(FrameLayout.java:448)
12-08 19:28:20.973: E/AndroidRuntime(28358):    at android.view.View.layout(View.java:14003)
12-08 19:28:20.973: E/AndroidRuntime(28358):    at android.view.ViewGroup.layout(ViewGroup.java:4375)
12-08 19:28:20.973: E/AndroidRuntime(28358):    at android.view.ViewRootImpl.performLayout(ViewRootImpl.java:1892)
12-08 19:28:20.973: E/AndroidRuntime(28358):    at android.view.ViewRootImpl.performTraversals(ViewRootImpl.java:1711)
12-08 19:28:20.973: E/AndroidRuntime(28358):    at android.view.ViewRootImpl.doTraversal(ViewRootImpl.java:989)
12-08 19:28:20.973: E/AndroidRuntime(28358):    at android.view.ViewRootImpl$TraversalRunnable.run(ViewRootImpl.java:4351)
12-08 19:28:20.973: E/AndroidRuntime(28358):    at android.view.Choreographer$CallbackRecord.run(Choreographer.java:749)
12-08 19:28:20.973: E/AndroidRuntime(28358):    at android.view.Choreographer.doCallbacks(Choreographer.java:562)
12-08 19:28:20.973: E/AndroidRuntime(28358):    at android.view.Choreographer.doFrame(Choreographer.java:532)
12-08 19:28:20.973: E/AndroidRuntime(28358):    at android.view.Choreographer$FrameDisplayEventReceiver.run(Choreographer.java:735)
12-08 19:28:20.973: E/AndroidRuntime(28358):    at android.os.Handler.handleCallback(Handler.java:725)
12-08 19:28:20.973: E/AndroidRuntime(28358):    at android.os.Handler.dispatchMessage(Handler.java:92)
12-08 19:28:20.973: E/AndroidRuntime(28358):    at android.os.Looper.loop(Looper.java:137)
12-08 19:28:20.973: E/AndroidRuntime(28358):    at android.app.ActivityThread.main(ActivityThread.java:5039)
12-08 19:28:20.973: E/AndroidRuntime(28358):    at java.lang.reflect.Method.invokeNative(Native Method)
12-08 19:28:20.973: E/AndroidRuntime(28358):    at java.lang.reflect.Method.invoke(Method.java:511)
12-08 19:28:20.973: E/AndroidRuntime(28358):    at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:793)
12-08 19:28:20.973: E/AndroidRuntime(28358):    at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:560)
12-08 19:28:20.973: E/AndroidRuntime(28358):    at dalvik.system.NativeStart.main(Native Method)

Orientation change

Hi.
What i have:

<activity android:name=".ActivityMain" android:configChanges="orientation" >

@Override public void onSaveInstanceState( Bundle outState ) { super.onSaveInstanceState( outState ); outState.putInt( KEY_LIST_POSITION, mFirstVisible ); }

When I change my phone's orientation to landscape, I get too narrow header.before1
And When I change my phone's orientation to portrait, I get too wide header.before2
It continues, until the header keeps its ID. When the ID is changed, the header gets normal size. It all happens with a stickyHeader, when a real header being shown all right, but when it go away and the stickyHeader arises, the stickyHeader has wrong size.

I've little changed code, and problem has gone. But i'm sure you will be able to make it better.

My resolve is to:

add into StickyListHeadersListView:
boolean updateHeader = false; @TargetApi(Build.VERSION_CODES.FROYO) @Override protected void onConfigurationChanged( Configuration newConfig ) { if ( Build.VERSION.SDK_INT >= Build.VERSION_CODES.FROYO ) super.onConfigurationChanged( newConfig ); updateHeader = true; }

change in StickyListHeaderListView.scrollChanged():
if (currentHeaderId == null || currentHeaderId != newHeaderId || updateHeader ) { updateHeader = false; headerPosition = firstVisibleItem; header = adapter.delegate.getHeaderView(headerPosition, header, this); measureHeader(); }

after1
after2

Enhancement request: Allow specifying custom header when "stuck"

Easiest to show a screen shot from my app:

device-2013-02-03-215953

Basically, I have headers over a slight gradient, so I want them to be transparent. But when it is "stuck" on the top, I would like it be either completely or partially opaque so that the header is legible. Currently, it is not, as you can see.

ListView performItemClick() should extract the real View

Currently, the callback is called with the composited view, as opposed to the view returned by getView().

The following method (or an equivalent )should be added , so that the callback is called with the right view.

@Override
public boolean performItemClick(View view, int position, long id)
{
    return super.performItemClick(((ViewGroup)view).getChildAt(1), position, id);
}

Using it with a gridview

I have a gridview. It looks like a list view in portrait orientation but in landscape I have 2 columns.
Is it easy to change this library to work with GridView? GridView in Android is very dummy I think.

Thank you

Add library to some maven repository

I've noticed that you plan to use Sonatype Maven repo for this lib in next lines:

<parent>
        <groupId>org.sonatype.oss</groupId>
        <artifactId>oss-parent</artifactId>
        <version>7</version>
</parent>

But Sonatype repo does not contain this lib.
I want to add StickyListHeader as a maven dependency to my project but currently I have to add classes manually.

Any plans on adding a lib to some public Maven repo?

Thanks.

Containment for floating header doesn't fill its parent

I'm coming across an issue where I'm trying to float an image to the right. In the normal list its fine, but as soon as a header is "stickied" the image jumps over to the left right beside the title text. It would appear that however you're containing it is wrapping the content instead of being full width.

When I scroll down to a header with a larger title, then all the images will be that far out to the right.

Remove unused resources

The following resources are not needed for a library projects:

  • Icons (the Drawable* folders can be deleted)
  • main.xml layout
  • both String resources

ListView choice modes are not supported

I recently found out that StickyListHeadersListView doesn't support any of choice modes other than default one (AbsListView#CHOICE_MODE_NONE). It means that if you use CheckedTextView, CheckBox or any other Checkable view as a list view item (I mean checkable view is the root of the list item), click on this item will not check the check box on this view even if AbsListView#isItemChecked(int) returns true for the current position. To support choice modes in the list view other than default one WrapperView must implement Checkable interface itself and delegate its state to the wrapped view.

Please see pull request #52 with my suggestion on how to add support of choice modes to StickyListHeaders. I hope it helps.

If you need more details, please just let me know

Still a small issue with 2.1

  • Run the sample app
  • Turn it to landscape mode
  • Slowly scroll to B
  • Title A is pushed out by B
  • Once A is fully pushed out, A is shown again (in error), then as you scroll up some more, it switches to the correct B.

Enhancement request: Generic header ID's

If I want to use a string as header, I have to calculate some fancy hash value for the string. It would be neater if the header ID was generic, so we could pass any object to it.

drawing bug when using viewpager

If I add 3 fragments to a viewpager, the first has a stickylistheaderlistview inside, scroll the list a bit so the header "gets sticky" and then scroll the viewpager to the last fragment. When I scroll back to the first fragment again I can see that the header has disappeared until the viewpager is fully scrolled to the first fragment...

2013-02-09 20 29 22
2013-02-09 20 29 27

Multiple textview on header

I have done a listview header with 4 textview, but when i scroll the list, the textviews on the header disappear from the view

screen1

screen2

there is a solution for this?

Sticky header does not resize when fragment/container does

Just noticed some strange behaviour: when I add a fragment to the screen so that the one containing the StickyListHeaderListView becomes smaller (in practice: resizing the container) then the top/sticky header does not resize. All other headers (and items) resize as expected. The same goes for enlarging the container; the sticky header only covers the old width.

I've got the list wrapped in https://github.com/chrisbanes/Android-PullToRefresh but that should not make a difference, should it? After all, everything else resizes as expected.

Please see attached screenshot - not the best but one of the headers has a faded edge (properly resized) and the other doesn't, it extends beneath the added fragment to the right.

image

Looking at it in Hierarchy View reveals that the faded edge actually is there:

image

But it seems like it's only the background of the LinearLayout of the header that is not redrawn correctly, all the dimensions are right. We can safely assume I'm at fault here - any idea what it might be?

Bug when adding a header View to the StickyListHeadersListView

Hello,

I'm trying to add a header View (using addHeaderView()) to the StickyListHeadersListView, this way :
mAdapter = new BlogsAdapter(getActivity(), blogs, mOnBlogClickedListener); TextView headerView = new TextView(getActivity()); headerView.setText("This is the header View"); mBlogsList.addHeaderView(headerView); mBlogsList.setAdapter(mAdapter);

But it crashes in StickyListHeadersListView.java, on line 284 : WrapperView viewToWatch = (WrapperView) super.getChildAt(0);

Here is the stacktrace :
FATAL EXCEPTION: main
java.lang.ClassCastException: android.widget.TextView cannot be cast to com.emilsjolander.components.stickylistheaders.WrapperView
at com.emilsjolander.components.stickylistheaders.StickyListHeadersListView.scrollChanged(StickyListHeadersListView.java:284)
at com.emilsjolander.components.stickylistheaders.StickyListHeadersListView.onScroll(StickyListHeadersListView.java:262)
at android.widget.AbsListView.invokeOnItemScrollListener(AbsListView.java:1388)
at android.widget.ListView.layoutChildren(ListView.java:1705)
at android.widget.AbsListView.onLayout(AbsListView.java:2037)
at android.view.View.layout(View.java:11325)
at android.view.ViewGroup.layout(ViewGroup.java:4224)
at android.widget.LinearLayout.setChildFrame(LinearLayout.java:1634)
at android.widget.LinearLayout.layoutVertical(LinearLayout.java:1492)
at android.widget.LinearLayout.onLayout(LinearLayout.java:1405)
at android.view.View.layout(View.java:11325)
at android.view.ViewGroup.layout(ViewGroup.java:4224)
at android.widget.FrameLayout.onLayout(FrameLayout.java:431)
at android.view.View.layout(View.java:11325)
at android.view.ViewGroup.layout(ViewGroup.java:4224)
at android.widget.LinearLayout.setChildFrame(LinearLayout.java:1634)
at android.widget.LinearLayout.layoutHorizontal(LinearLayout.java:1623)
at android.widget.LinearLayout.onLayout(LinearLayout.java:1407)
at android.view.View.layout(View.java:11325)
at android.view.ViewGroup.layout(ViewGroup.java:4224)
at android.widget.FrameLayout.onLayout(FrameLayout.java:431)
at android.view.View.layout(View.java:11325)
at android.view.ViewGroup.layout(ViewGroup.java:4224)
at android.widget.LinearLayout.setChildFrame(LinearLayout.java:1634)
at android.widget.LinearLayout.layoutVertical(LinearLayout.java:1492)
at android.widget.LinearLayout.onLayout(LinearLayout.java:1405)
at android.view.View.layout(View.java:11325)
at android.view.ViewGroup.layout(ViewGroup.java:4224)
at android.widget.FrameLayout.onLayout(FrameLayout.java:431)
at android.view.View.layout(View.java:11325)
at android.view.ViewGroup.layout(ViewGroup.java:4224)
at android.view.ViewRootImpl.performTraversals(ViewRootImpl.java:1502)
at android.view.ViewRootImpl.handleMessage(ViewRootImpl.java:2459)
at android.os.Handler.dispatchMessage(Handler.java:99)
at android.os.Looper.loop(Looper.java:137)
at android.app.ActivityThread.main(ActivityThread.java:4514)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:511)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:790)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:557)
at dalvik.system.NativeStart.main(Native Method)

Tell me if you need more informations.

Orientation change

Hi,
if the orientation changed, the width of the "stickied" header is wrong.

portrait --> landscape = too small
landscape --> portrait = too wide (text isn't centered)

Crash while scrolling to second sticky header

Reproduction:

  • ListView with two headers
  • Scroll down till second header will become sticky
  • SetText will cause a crash

LOGCAT

FATAL EXCEPTION: main
java.lang.NullPointerException
at android.widget.TextView.checkForRelayout(TextView.java:6729)
at android.widget.TextView.setText(TextView.java:3306)
at android.widget.TextView.setText(TextView.java:3162)
at android.widget.TextView.setText(TextView.java:3137)
at mobi.inthepocket.madoc.heuvelland.adapters.StickyThematizedAdapter.bindHeaderView(StickyThematizedAdapter.java:41)
at mobi.inthepocket.madoc.heuvelland.stickylistheader.StickyListHeadersCursorAdapter.getHeaderView(StickyListHeadersCursorAdapter.java:89)
at mobi.inthepocket.madoc.heuvelland.stickylistheader.StickyListHeadersListView.onScroll(StickyListHeadersListView.java:274)
at android.widget.AbsListView.invokeOnItemScrollListener(AbsListView.java:1276)
at android.widget.AbsListView.trackMotionScroll(AbsListView.java:4565)
at android.widget.AbsListView.scrollIfNeeded(AbsListView.java:2852)
at android.widget.AbsListView.onTouchEvent(AbsListView.java:3106)
at android.view.View.dispatchTouchEvent(View.java:5541)
at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:1951)
at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:1712)
at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:1957)
at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:1726)
at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:1957)
at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:1726)
at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:1957)
at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:1726)
at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:1957)
at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:1726)
at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:1957)
at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:1726)
at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:1957)
at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:1726)
at com.android.internal.policy.impl.PhoneWindow$DecorView.superDispatchTouchEvent(PhoneWindow.java:1912)
at com.android.internal.policy.impl.PhoneWindow.superDispatchTouchEvent(PhoneWindow.java:1371)
at android.app.Activity.dispatchTouchEvent(Activity.java:2364)
at com.android.internal.policy.impl.PhoneWindow$DecorView.dispatchTouchEvent(PhoneWindow.java:1860)
at android.view.View.dispatchPointerEvent(View.java:5721)
at android.view.ViewRootImpl.deliverPointerEvent(ViewRootImpl.java:2890)
at android.view.ViewRootImpl.handleMessage(ViewRootImpl.java:2466)
at android.view.ViewRootImpl.processInputEvents(ViewRootImpl.java:845)
at android.view.ViewRootImpl.handleMessage(ViewRootImpl.java:2475)
at android.os.Handler.dispatchMessage(Handler.java:99)
at android.os.Looper.loop(Looper.java:137)
at android.app.ActivityThread.main(ActivityThread.java:4424)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:511)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:784)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:551)
at dalvik.system.NativeStart.main(Native Method)

IMPLEMENTATION

@OverRide
protected View newHeaderView(Context context, Cursor cursor)
{
final TextView textView = (TextView)LayoutInflater.from(context).inflate(R.layout.listview_spotslist_header, null);
return textView;
}

@OverRide
protected void bindHeaderView(View view, Context context, Cursor cursor)
{
final ThematizedSpot t = new ThematizedSpot();
t.constructFromCursor(cursor);

if (view instanceof TextView)
{
    final TextView textView = (TextView)view;
    String text = t.getSpot().isVisited() ? context.getResources().getString(R.string.pathdetail_visited) : context.getResources().getString(R.string.pathdetail_unvisited);
    if (text == null)
        text = "";
    textView.setText(text);
}

}

@OverRide
protected long getHeaderId(Context context, Cursor cursor)
{
final ThematizedSpot t = new ThematizedSpot();
t.constructFromCursor(cursor);
return (t.getSpot().isVisited() ? 1 : 0);
}

TestAdapter extends from wrong base adapter?

I see in TestAdapter.java you make it extend from StickyListHeadersAdapter.

public class TestAdapter extends StickyListHeadersAdapter {

Is there any mistake here? Because StickyListHeadersAdapter is just an interface.
After I change it to StickyListHeadersBaseAdapter, now I can build project.

Enhancement request: Sticky Footers

Here's my use case:

I have a list of accounts in sections which I am displaying a Header line (the account type) and the sum of the account balances (Footer line). I would like the footer to stick to the bottom of the list view.

I requested this once and was turned down, but I don't see why this is not in the scope of the project. The Android ListView has parallel header/footer API's also and I think is a natural extension. If the code is factored properly, this should be trivial to implement -- almost for free, as far as I can see.

Feature suggestion: Footers

My app could make use of Sticky footers also. If I made changes to the code to include footers, would it be something you'd consider including? I think if the footer handling code can be factored out into its own class from the ListView, using a second copy of it for footers would be a simple way of doing it.

Minor: shouldn't getHeaderView take a header ID?

Seems silly that I have to calculate the header ID twice, effectively, once for getHeaderId and another time for getHeaderView. Why not pass the header ID into getHeaderView?

Probably just add a new parameter to cause minimum pain for users of the library.

Crash in RelativeLayout.onMeasure()

I had the following layout for my header:

<RelativeLayout android:id="@+id/date_header_group"
                android:layout_width="match_parent"
                android:layout_height="wrap_content">

    <TextView android:id="@+id/date_header"
              android:layout_width="wrap_content"
              android:layout_height="wrap_content"
              android:layout_centerHorizontal="true"
              android:layout_alignParentTop="true"
              android:paddingLeft="5dp"
              android:paddingRight="5dp"/>                      

    <View android:layout_width="0px"
          android:layout_height="2dp"
          android:layout_centerVertical="true"
          android:layout_alignParentLeft="true"
          android:layout_toLeftOf="@+id/date_header"
          android:background="@drawable/divider_horizontal_dark_opaque"/>

    <View android:layout_width="0px"
          android:layout_height="2dp"
          android:layout_centerVertical="true"
          android:layout_alignParentRight="true"
          android:layout_toRightOf="@+id/date_header"
          android:background="@drawable/divider_horizontal_dark_opaque"/>
</RelativeLayout>

<com.actionbarsherlock.internal.widget.CapitalizingTextView
          android:id="@android:id/text1"
          android:layout_width="match_parent"
          android:layout_height="wrap_content"
          android:paddingLeft="10dp"
          style="?android:attr/listSeparatorTextViewStyle"/>        

When I used this layout as a header, I got a crash:

java.lang.NullPointerException
at android.widget.RelativeLayout.onMeasure(RelativeLayout.java:523)
at android.view.View.measure(View.java:15513)
at com.emilsjolander.components.stickylistheaders.StickyListHeadersListView.measureHeader(StickyListHeadersListView.java:253)
at com.emilsjolander.components.stickylistheaders.StickyListHeadersListView.scrollChanged(StickyListHeadersListView.java:311)
at com.emilsjolander.components.stickylistheaders.StickyListHeadersListView.onScroll(StickyListHeadersListView.java:280)
at android.widget.AbsListView.invokeOnItemScrollListener(AbsListView.java:1340)
at android.widget.ListView.layoutChildren(ListView.java:1753)
at android.widget.AbsListView.onLayout(AbsListView.java:1994)
at com.emilsjolander.components.stickylistheaders.StickyListHeadersListView.onLayout(StickyListHeadersListView.java:112)

I fixed it by changing the RelativeLayout to a FrameLayout, which it should have been anyhow, but the point remains that it should not crash.

Asks for headers from empty list adapters

When using an empty list (one reporting size of 0), StickListHeaders will ask for header information, despite the fact that there are no objects in the list.

This causes crashes unless the implementation checks for the count before trying to fetch items.

Improve the performance of scrollChanged()

getHeaderId() can be an expensive call.

I suggest replacing,

        if(oldHeaderId != ((StickyListHeadersAdapter)getAdapter()).getHeaderId(firstVisibleItem)){
            headerHasChanged = true;
            header = ((StickyListHeadersAdapter)getAdapter()).getHeaderView(firstVisibleItem, header);
            header.setLayoutParams(new ViewGroup.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, headerHeight));
        }
        oldHeaderId = ((StickyListHeadersAdapter)getAdapter()).getHeaderId(firstVisibleItem);

with

        long newHeaderId = ((StickyListHeadersAdapter)getAdapter()).getHeaderId(firstVisibleItem);
        if(oldHeaderId != newHeaderId){
            headerHasChanged = true;
            header = ((StickyListHeadersAdapter)getAdapter()).getHeaderView(firstVisibleItem, header);
            header.setLayoutParams(new ViewGroup.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, headerHeight));
        }
        oldHeaderId = newHeaderId;

NotifyDataSetChanged does not work! please help

Hi, I found that NotifyDataSetChanged does not work.

At first, I have some data to display, that's perfect. but after deleting all the data then NotifyDataSetChanged, nothing is happen. Is there something else I have to do to make this happen?

If list position is retained on rotation header get unstuck

If I store the position of the listview in saved instance state and then rotate and set selection of the listview the header is back to the top of the list and scrolls with the list, the issue is fixed if I scroll back upt to the top of the list and then rotate.

Bug when first row has no header

Modify the sample app the following way:

TestBaseAdpater.getHeaderView()

replace

    holder.text.setText(countries[position].subSequence(0, 1));

with the following to hide the header for the first section:

    CharSequence firstChar = countries[position].subSequence(0, 1);
    if (!firstChar.equals("A")) {
        holder.text.setVisibility(View.VISIBLE);
        holder.text.setText(firstChar);
    } else
        holder.text.setVisibility(View.GONE);

Remove the padding around the header layout:

<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="#640000ff"
android:orientation="horizontal">

Run the sample app. As you can see, B and the other headers are not shown correctly as you scroll down.

If the "A" is shown, everything works as expected.

Header shows selector when attached to its row

Do I need to alter the header so I don't get this odd selector behavior?
overhighlight

As soon as the header is 'stuck' to the top, I no longer see the issue:
overhighlight-under

I am using android:drawSelectorOnTop="true". Is that the problem?

Please save Java sources with UTF-8 encoding

Right now, when building a project using SticklyListHeaders, I am getting the following compile warning for each file:

 C:\Android\projects\com.emilsjolander.components.StickyListHeaders\src\com\emilsjolander\components\StickyListHeaders\StickyListHeadersBaseAdapter.java:14: warning: unmappable character for encoding UTF-8
[javac]  * @author Emil Sj?lander
[javac]                   ^
[javac] 

It's because the default Android compile scripts expect the input files to be UTF-8 format, but these weren't saved so. There is an Eclipse setting for this.

Enhancement Request: StickyListHeadersGridView

Any chance you are working on or can quickly create a StickyListHeadersGridView?

A Sticky header grid view: Similar to the StickyListHeadersListView but for a GridView

Much appreciated!! Thanks!

SectionIndexer stopped working after the latest changes.

After updating to the latest version, my SectionIndexer (I was using an AlphabetIndexer) has stopped working.
I used the library with a cursor adapter (ResourceCursorAdapter) and had an AlphabetIndexer set. It worked fine, except for issue #67. I've updated to the latest version that has this issue fixed but since then, my list doesn't display the sections indicator when scrolling the list with the fast scroll bar.
Please check if this is related to the latest fixes you've made.

Thank you.

There is an issue with View reuse

I don't know what the problem is, but there is some kind of problem with Vew recycle. I sent my app with StickyListHeaders to a beta tester and he reported that on his Droid Razr, sometimes the list displays the wrong data. I cannot duplicate it on my Galaxy Nexus, but when I sent him the same code where the only change was it used a normal ListView, the problem went away for him. So there is some issue StickyListHeaders. Don't know what it is, but I figured I'd throw it out there in case you feel like taking a second peek.

ListView member variables need to be reset on setAdapter()

The library currently doesn't work correctly when adapters are replaced as data from the old adapter is kept around.

I solved this by adding a reset() method called from setup() and setAdapter()

private void reset()
{
    headerBottomPosition = 0;
    headerHeight = -1;
    header = null;
    headerIdLast = -1;
    headerHasChanged = true;
    lastWatchedViewHeader = null;
}

Incorrect behavior when the first header ID returned is -1

This is caused by oldHeaderId being initalized to -1, so if -1 is returned for the first header ID, it's not drawn correctly.

To fix:

private boolean oldHeaderIdValid;


private void reset()
{
    headerBottomPosition = 0;
    headerHeight = -1;
    header = null;
    oldHeaderIdValid = false;
    headerHasChanged = true;
}


private void scrollChanged(int firstVisibleItem){
     :
     :
        long newHeaderId = ((StickyListHeadersAdapter)getAdapter()).getHeaderId(firstVisibleItem);
        if(!oldHeaderIdValid || (oldHeaderId != newHeaderId)){
            headerHasChanged = true;
            header = ((StickyListHeadersAdapter)getAdapter()).getHeaderView(firstVisibleItem, header);
            header.setLayoutParams(new ViewGroup.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, headerHeight));
        }
        oldHeaderId = newHeaderId;
        oldHeaderIdValid = true;
         :
         :
          }

doesn't show list dividers

I updated the library in my and now it doesn't show list dividers anymore. The version I used previously was from before Jake's changes (it still had Adapter classes instead of the interface). When i switch to a normal ListView everything shows normally.

No way to retrieve "real" adapter set on StickyListHeadersListView

Updated my code to the latest.

I used to use ListView.getAdapter() to retrieve my adapter, but this is no longer possible.

Please either provide:

  1. StickyListHeadersListView.getRealAdapter()
  • or -
  1. make StickyListHeadersAdapterWrapper public and provide a way to retrieve the adapter wrapped

Please qualify resource names with a namespace

Right now the resource names are generic and there is a large chance of collision with the main app's names.

For example, instead of using

<item type="id" name="header_view"

Please use

<item type="id" name="__stickylistheaders_header_view"

(I am taking the two-underscore convention from ActionBarSherlock, which I think can be used as an example of good practices when it comes to Library Projects)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.