Skip to content

Commit 9fe3b1c

Browse files
committed
Updated README with the new SectionIndicator
1 parent b3e2d2f commit 9fe3b1c

1 file changed

Lines changed: 35 additions & 10 deletions

File tree

README.md

Lines changed: 35 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,10 @@ This project is a demonstration of using the RecyclerViewFastScroller widget in
77

88
![RecyclerViewFastScroller screenshot](http://i.imgur.com/IozUtucl.png)
99

10+
As of [`b3e2d2f`](https://github.com/danoz73/RecyclerViewFastScroller/commit/b3e2d2fa8284dea31fbc5f9f218199f2a187a657), there is now support for adding a `SectionIndicator` widget, which connects to the scroller. This adds functionality similar to Google's Lollipop Contacts application:
11+
12+
![RecyclerViewFastScroller with section indicator screenshot](http://i.imgur.com/2zBwIlwl.png)
13+
1014
### Usage
1115

1216
Below are some simple steps to using a RecyclerViewFastScroller. Currently, there is only a single implementation (`VerticalRecyclerViewFastScroller`), so that will be used here.
@@ -22,7 +26,8 @@ The best way to check everything out is to peruse the example code and run the e
2226
<android.support.v7.widget.RecyclerView
2327
android:id="@+id/recyclerView"
2428
android:layout_width="match_parent"
25-
android:layout_height="match_parent"/>
29+
android:layout_height="match_parent"
30+
/>
2631

2732
<your.package.name.scroller.vertical.VerticalRecyclerViewFastScroller
2833
android:id="@+id/fast_scroller"
@@ -68,20 +73,40 @@ There are currently a few attributes that can be used to customize the vertical
6873
<attr name="handleBackground" format="reference" />
6974
```
7075

71-
You can see usage of some of these in the example `recycler_view_frag.xml` which is the layout for the example app's single fragment.
76+
You can see usage of some of these in the example `recycler_view_with_fast_scroller_fragment.xml` which is the layout for the example app's single fragment.
7277

73-
### Setup
78+
##### SectionIndicators
7479

75-
*(Apologies for the current state of affairs. I'll hopefully make this into a library when I think it is complete enough for my liking)*
80+
Refer to `RecyclerViewWithSectionIndicatorFragment` and the corresponding `recycler_view_with_fast_scroller_section_title_indicator_fragment.xml` in order to find an implementation that adds the Lollipop-Contacts-like section indicator. In addition to the above, you will need to include the indicator in your layout (example here from `recycler_view_with_fast_scroller_section_title_indicator_fragment.xml`):
81+
82+
```java
83+
...
84+
<com.example.recyclerviewfastscroller.ui.example.ColorGroupSectionTitleIndicator
85+
android:id="@+id/fast_scroller_section_title_indicator"
86+
android:layout_width="wrap_content"
87+
android:layout_height="@dimen/list_item_height"
88+
android:layout_toLeftOf="@id/fast_scroller"
89+
android:layout_toStartOf="@id/fast_scroller"
90+
91+
custom:backgroundColor="@android:color/white"
92+
custom:textColor="@android:color/black"
93+
/>
94+
...
95+
```
96+
and then connect it to the scroller in the fragment:
97+
```java
98+
...
99+
// Connect the section indicator to the scroller
100+
fastScroller.setSectionIndicator(sectionTitleIndicator);
101+
...
102+
```
76103

77-
Copy the `Application/src/main/java/com/example/recyclerviewfastscroller/ui/scroller` package and all its files into your source so you now have `scroller` as one of your packages
104+
### Setup
78105

79-
Copy the `VerticalRecyclerViewFastScroller` attributes from my `res/values/attrs.xml` file into your own
106+
*(Apologies for the current state of affairs. I'll hopefully make this into a library when I think it is complete enough for my liking)*
80107

81-
Copy the `vertical_recycler_fast_scroller_layout.xml` file from my `res/layout` directory into your own
108+
For now, you will need to dive into the code yourself and copy/repurpose any of the code you need to use. Most of the code you can reuse should be in the `Application/src/main/java/com/example/recyclerviewfastscroller/ui/scroller` package. You will likely need some of the layout and drawable files as well.
82109

83110
### Contribution
84111

85-
Feel free to submit pull requests. I haven't necessarily implemented this as well as possible, and am always open to suggestions for improvement.
86-
87-
I just couldn't find a simple example for a simple vertical fast scroller for RecyclerView on the internet.
112+
Feel free to submit pull requests and create issues. I haven't necessarily implemented this as well as possible, and am always open to suggestions for improvement.

0 commit comments

Comments
 (0)