Mercurial > dwindows
changeset 2524:d5c3c573c74e
Android: Calendar fixes, need to be in milliseconds not seconds... also...
Need to override the onDateChanged and set the date in there.
author | bsmith@81767d24-ef19-dc11-ae90-00e081727c95 |
---|---|
date | Sun, 09 May 2021 21:51:31 +0000 |
parents | 82cdb3ad7c25 |
children | 9fd26efff9da |
files | android/DWindows.kt |
diffstat | 1 files changed, 9 insertions(+), 2 deletions(-) [+] |
line wrap: on
line diff
--- a/android/DWindows.kt Sun May 09 21:17:32 2021 +0000 +++ b/android/DWindows.kt Sun May 09 21:51:31 2021 +0000 @@ -1493,6 +1493,11 @@ waitOnUiThread { calendar = CalendarView(this) + calendar!!.setOnDateChangeListener { calendar, year, month, day -> + val c: Calendar = Calendar.getInstance(); + c.set(year, month, day); + calendar.date = c.timeInMillis + } } return calendar @@ -1501,7 +1506,8 @@ fun calendarSetDate(calendar: CalendarView, date: Long) { waitOnUiThread { - calendar.setDate(date, true, true) + // Convert from seconds to milliseconds + calendar.setDate(date * 1000, true, true) } } @@ -1510,7 +1516,8 @@ var date: Long = 0 waitOnUiThread { - date = calendar.date + // Convert from milliseconds to seconds + date = calendar.date / 1000 } return date }