File tree Expand file tree Collapse file tree 1 file changed +37
-1
lines changed Expand file tree Collapse file tree 1 file changed +37
-1
lines changed Original file line number Diff line number Diff line change @@ -9,7 +9,43 @@ which is now outsourced in favor of a better modularization.
9
9
10
10
<img src =" https://github.com/tobiasschuerg/android-week-view/blob/master/meta/device-2018-02-24-121341.png " height =" 400 " >
11
11
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
13
49
14
50
1 . Add it in your root build.gradle at the end of repositories:
15
51
``` gradle
You can’t perform that action at this time.
0 commit comments