Skip to content

Commit 62a8069

Browse files
committed
Merge remote-tracking branch 'remotes/MaterialScrollBar/master'
2 parents 0647a24 + 7d8bde2 commit 62a8069

File tree

1 file changed

+10
-31
lines changed

1 file changed

+10
-31
lines changed

README.md

Lines changed: 10 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -27,52 +27,31 @@ maven {
2727

2828
```gradle
2929
dependencies {
30-
compile 'com.turingtechnologies.materialscrollbar:lib:2.+'
30+
compile 'com.turingtechnologies.materialscrollbar:lib:3.+'
3131
}
3232
```
3333

3434
How to use - ScrollBar
3535
--------
36-
It is very important that the scroller be aligned to the right side of the screen in order to present correctly. You can manipulate the handle and bar colours through the xml or programatically. The recomended width for the view is 20dp to allow for a reasonable area for dragging on the side of the screen.
37-
38-
```xml
39-
<com.turingtechnologies.materialscrollbar.MaterialScrollBar
40-
android:id="@+id/material_scroller"
41-
android:layout_width="20dp"
42-
android:layout_height="match_parent"
43-
app:handleColour="{{colour here}}" (optional)
44-
app:barColour="{{colour here}}" (optional)
45-
android:layout_alignParentRight="true"
46-
android:layout_alignTop="@+id/recycler_view" />
47-
```
48-
49-
Lastly, it also imperative that you give the materialScrollBar whatever recyclerView to which you wish to attach it. If you fail to do this, the library will spam error messages to the log until you fix it.
36+
For version 3.0.0 and later, all you need to add is this line of code:
5037

5138
```java
52-
materialScrollBar.setRecyclerView(recyclerView);
39+
MaterialScrollBar materialScrollBar = new MaterialScrollBar(this, recyclerView);
5340
```
5441

55-
How to use - Section Indicator
56-
--------
57-
Every step here is important, so make sure you've done them all.
42+
where 'recyclerView' is the recyclerView to which you want to link the scrollBar.
5843

59-
1- Add it to the xml.
44+
If you're updating from an older version, remove any xml from this library and rewrite your code to implement the API as above.
6045

61-
```xml
62-
<com.turingtechnologies.materialscrollbar.SectionIndicator
63-
android:layout_width="100dp"
64-
android:id="@+id/sectionIndicator"
65-
android:layout_alignRight="[Id of scrollBar]"
66-
android:layout_alignTop="[Id of scrollBar]"
67-
android:layout_height="match_parent"/>
68-
```
69-
2- Link the scrollBar and the section indicator programatically.
46+
How to use - Section Indicator
47+
--------
48+
To add a section indicator, simply add the following line of code:
7049

7150
```java
72-
scrollBar.setSectionIndicator((SectionIndicator) findViewById(R.id.sectionIndicator));
51+
materialScrollBar.addSectionIndicator(this);
7352
```
7453

75-
3- Make the adapter for your recyclerView implement INameableAdapter and fill in the getCharacterForElement method for your adapter.
54+
To use a section indicator, you **MUST** make your recyclerView's adapter implement INameableAdapter. If you do not, the library will throw a runtime error informing you of your mistake.
7655

7756
License
7857
--------

0 commit comments

Comments
 (0)