Skip to content

Commit fbf5025

Browse files
committed
Update README.md
1 parent 4308eb5 commit fbf5025

File tree

1 file changed

+37
-1
lines changed

1 file changed

+37
-1
lines changed

README.md

Lines changed: 37 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,43 @@ which is now outsourced in favor of a better modularization.
99

1010
<img src="https://github.com/tobiasschuerg/android-week-view/blob/master/meta/device-2018-02-24-121341.png" height="400">
1111

12-
# Get it
12+
## Usage:
13+
See `SampleActivity.kt` for how to use the week view.
14+
15+
### In short:
16+
1. Attach the view to your layout:
17+
```xml
18+
<de.tobiasschuerg.weekview.view.WeekView
19+
android:id="@+id/week_view"
20+
android:layout_width="match_parent"
21+
android:layout_height="wrap_content"
22+
app:accent_color="@color/colorAccent"
23+
app:start_hour="8"
24+
app:end_hour="15" />
25+
```
26+
2. Configure how events are displayed (optional):
27+
```kotlin
28+
val config = EventConfig(showSubtitle = false, showTimeEnd = false)
29+
weekView.eventConfig = config
30+
weekView.setShowNowIndicator(true)
31+
```
32+
33+
3Add events:
34+
```kotlin
35+
val nowEvent = Event.Single(
36+
id = 1337,
37+
date = LocalDate.now(),
38+
title = "Dentist Appointment",
39+
shortTitle = "DENT",
40+
timeSpan = TimeSpan.of(LocalTime.of(10, 0), Duration.ofHours(1)),
41+
backgroundColor = Color.RED,
42+
textColor = Color.WHITE
43+
)
44+
weekView.addEvent(nowEvent)
45+
```
46+
47+
48+
## Get it
1349

1450
1. Add it in your root build.gradle at the end of repositories:
1551
```gradle

0 commit comments

Comments
 (0)