Skip to content

Commit 8d993d6

Browse files
Update README.md
Added withUpdateSelectDate method. It's required when using Kotlin code instead of XML configuration. This method will change the background color of selected date.
1 parent acd317c commit 8d993d6

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

README.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@ implementation 'com.github.shahzadafridi:CalenderView:1.1.4'
3030

3131
```kotlin
3232

33+
var selectedDate = Calendar.getInstance()
3334
var calendarView = findViewBydId(R.id.calendar_view)
3435

3536
calendarView.builder()
@@ -69,6 +70,7 @@ implementation 'com.github.shahzadafridi:CalenderView:1.1.4'
6970
.withCalenderViewBg(
7071
background = R.drawable.rect_lr_wround_bg
7172
)
73+
.withUpdateSelectDate(selectedDate!!) //It's required when using kotlin Instead of XML Configuration.
7274
.withEvents(
7375
events = events,
7476
eventDotColor = R.color.green
@@ -161,6 +163,10 @@ calendarView.setEventHandler(object : CalenderViewInterface.EventHandler {
161163

162164
override fun onDayClick(view: View?, date: Date, position: Int) {
163165
val df = SimpleDateFormat.getDateInstance()
166+
//Required for selected date background. Ignore If you are using XML configuration.
167+
selectedDate = Calendar.getInstance().apply {
168+
time = date
169+
}
164170
Toast.makeText(this@MainActivity, df.format(date), Toast.LENGTH_SHORT).show()
165171
Log.e("TEST", "onDayClick")
166172
}
@@ -211,6 +217,7 @@ calendarView.setEventHandler(object : CalenderViewInterface.EventHandler {
211217
- **withDayPanel** can change the day Text font, Text Color, Text Size, Selected background, Selected Text Color, Background of day
212218
- **withCalenderViewBg** can change the CalendarView background
213219
- **withEvents** can gives events dates to calendarView which shows small dot indcaotr below of day
220+
- **withUpdateSelectDate** This method will change the background color of selected date. It's required when using Kotlin code instead of XML configuration
214221

215222

216223
#### Watch Demo Video

0 commit comments

Comments
 (0)