Skip to content

Commit e64cd00

Browse files
committed
Update README.md
1 parent f45db40 commit e64cd00

File tree

1 file changed

+31
-7
lines changed

1 file changed

+31
-7
lines changed

README.md

Lines changed: 31 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -31,10 +31,12 @@ dependencies {
3131
compile 'com.turingtechnologies.materialscrollbar:lib:34+'
3232
}
3333
```
34+
Documentation
35+
-------
3436

35-
How to use - ScrollBar
36-
--------
37-
For version 3.0.0 and later, all you need to add is this line of code:
37+
Note: All customisation methods (setAutoHide, setBarColour, etc) return the materialScrollBar, so they can be chained together if wanted. Alternativly, you can just operate on a variable.
38+
39+
###How to use - ScrollBar
3840

3941
```java
4042
MaterialScrollBar materialScrollBar = new MaterialScrollBar(this, recyclerView, {{lightOnTouch}});
@@ -52,17 +54,39 @@ For devices running Lollipop and above, the accent colour will be read automatic
5254

5355
Also note that the library does not currently support recyclerViews which do not boarder the screen's edge on the right side.
5456

55-
How to use - Section Indicator
56-
--------
57+
###How to use - Section Indicator
58+
5759
To add a section indicator, simply add the following line of code:
5860

5961
```java
6062
materialScrollBar.addSectionIndicator({{Section Indicator}});
6163
```
6264

63-
The section indicator should be either AlphatbetIndicator, DateAndTimeIndicator, or CustomIndicator. See below for specific instructions per indicator. **It's thundering atm. Shutting off PC until it passes. Documentation incomplete.**
65+
The section indicator should be either AlphatbetIndicator, DateAndTimeIndicator, or CustomIndicator. See below for specific instructions per indicator.
66+
67+
To use an indicator, you **MUST** make your recyclerView's adapter implement the relevant interface. If you do not, the library will throw a runtime error informing you of your mistake. See documentation for the relevant interface.
68+
69+
###Indicators
70+
####AlphabetIndicator
71+
72+
**Required Interface:** INameableAdapter
73+
74+
To implement an AlphabetIndicator, which displays one character usually corresponding to the first letter of each item, add the following to the end of your materialScrollBar instantiation, or add it as a seperate line.
75+
```java
76+
...addSectionIndicator(new AlphabetIndicator(this));
77+
```
78+
79+
####DateAndTimeIndicator
80+
81+
**Required Interface:** IDateableAdapter
82+
83+
To implement a DateAndTimeIndicator, which displays any combination of time, day of the month, month, and year, add the following to the end of your materialScrollBar instantiation, or add it as a seperate line.
84+
```java
85+
...addSectionIndicator(new DateAndTimeIndicator(this, {{includeYear}}, {{includeMonth}}, {{includeDay}}, {{includeTime}}));
86+
```
87+
88+
All of the arguments are booleans (except for this first one obviously). The indicator will dynamically size, add punctuation, and localise for you. All you need to do is provide a Date object for each element in your adapter. You should almost always use miliseconds since the epoch unless you have a good reason not to. Otherwise, the library might crash.
6489

65-
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.
6690

6791
Versioning Policy
6892
-------

0 commit comments

Comments
 (0)