Skip to content
This repository has been archived by the owner on Oct 26, 2022. It is now read-only.

Commit

Permalink
Merge pull request #52 from nohana/feature/fixHeaderCrash
Browse files Browse the repository at this point in the history
consider header click event
  • Loading branch information
hiroyuki-seto authored Jan 5, 2017
2 parents cec0e52 + ec22007 commit b275d0c
Showing 1 changed file with 8 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -33,9 +33,9 @@

/**
* @author KeithYokoma
* @since 2014/03/20
* @version 1.0.0
* @hide
* @since 2014/03/20
*/
public class AlbumListFragment extends Fragment implements
AdapterView.OnItemClickListener,
Expand Down Expand Up @@ -87,7 +87,13 @@ public void onDestroyView() {

@Override
public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
AlbumListViewHelper.callOnSelect(mListener, (Cursor) parent.getItemAtPosition(position));
Cursor cursor = (Cursor) parent.getItemAtPosition(position);
if (cursor == null) {
//avoid moving selection to header
AlbumListViewHelper.setCheckedState(this, mCollection.getCurrentSelection());
return;
}
AlbumListViewHelper.callOnSelect(mListener, cursor);
AlbumListViewHelper.setCheckedState(this, position);
mCollection.setStateCurrentSelection(position);
}
Expand Down

0 comments on commit b275d0c

Please sign in to comment.