-
-
Notifications
You must be signed in to change notification settings - Fork 494
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
11 changed files
with
231 additions
and
101 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
63 changes: 63 additions & 0 deletions
63
app/src/main/java/com/mikepenz/fastadapter/app/adapter/FastScrollIndicatorAdapter.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,63 @@ | ||
package com.mikepenz.fastadapter.app.adapter; | ||
|
||
import com.mikepenz.fastadapter.AbstractAdapter; | ||
import com.mikepenz.fastadapter.IItem; | ||
import com.mikepenz.fastadapter.app.items.SampleItem; | ||
import com.turingtechnologies.materialscrollbar.INameableAdapter; | ||
|
||
import java.util.List; | ||
|
||
/** | ||
* Created by mikepenz on 30.12.15. | ||
* This is a FastAdapter adapter implementation for the awesome Sticky-Headers lib by timehop | ||
* https://github.com/timehop/sticky-headers-recyclerview | ||
*/ | ||
public class FastScrollIndicatorAdapter<Item extends IItem> extends AbstractAdapter<Item> implements INameableAdapter { | ||
@Override | ||
public Character getCharacterForElement(int position) { | ||
IItem item = getItem(position); | ||
if (item instanceof SampleItem && ((SampleItem) item).name != null) { | ||
//based on the position we set the headers text | ||
return ((SampleItem) item).name.getText().charAt(0); | ||
} | ||
return ' '; | ||
} | ||
|
||
/** | ||
* REQUIRED FOR THE FastAdapter. Set order to < 0 to tell the FastAdapter he can ignore this one. | ||
**/ | ||
|
||
/** | ||
* @return | ||
*/ | ||
@Override | ||
public int getOrder() { | ||
return -100; | ||
} | ||
|
||
@Override | ||
public int getAdapterItemCount() { | ||
return 0; | ||
} | ||
|
||
@Override | ||
public List<Item> getAdapterItems() { | ||
return null; | ||
} | ||
|
||
@Override | ||
public Item getAdapterItem(int position) { | ||
return null; | ||
} | ||
|
||
@Override | ||
public int getAdapterPosition(IItem item) { | ||
return -1; | ||
} | ||
|
||
@Override | ||
public int getGlobalPosition(int position) { | ||
return -1; | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.