Mercurial > dwindows
comparison android/DWindows.kt @ 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 | d3f09b3f3703 |
comparison
equal
deleted
inserted
replaced
2523:82cdb3ad7c25 | 2524:d5c3c573c74e |
---|---|
1491 { | 1491 { |
1492 var calendar: CalendarView? = null | 1492 var calendar: CalendarView? = null |
1493 | 1493 |
1494 waitOnUiThread { | 1494 waitOnUiThread { |
1495 calendar = CalendarView(this) | 1495 calendar = CalendarView(this) |
1496 calendar!!.setOnDateChangeListener { calendar, year, month, day -> | |
1497 val c: Calendar = Calendar.getInstance(); | |
1498 c.set(year, month, day); | |
1499 calendar.date = c.timeInMillis | |
1500 } | |
1496 } | 1501 } |
1497 | 1502 |
1498 return calendar | 1503 return calendar |
1499 } | 1504 } |
1500 | 1505 |
1501 fun calendarSetDate(calendar: CalendarView, date: Long) | 1506 fun calendarSetDate(calendar: CalendarView, date: Long) |
1502 { | 1507 { |
1503 waitOnUiThread { | 1508 waitOnUiThread { |
1504 calendar.setDate(date, true, true) | 1509 // Convert from seconds to milliseconds |
1510 calendar.setDate(date * 1000, true, true) | |
1505 } | 1511 } |
1506 } | 1512 } |
1507 | 1513 |
1508 fun calendarGetDate(calendar: CalendarView): Long | 1514 fun calendarGetDate(calendar: CalendarView): Long |
1509 { | 1515 { |
1510 var date: Long = 0 | 1516 var date: Long = 0 |
1511 | 1517 |
1512 waitOnUiThread { | 1518 waitOnUiThread { |
1513 date = calendar.date | 1519 // Convert from milliseconds to seconds |
1520 date = calendar.date / 1000 | |
1514 } | 1521 } |
1515 return date | 1522 return date |
1516 } | 1523 } |
1517 | 1524 |
1518 fun timerConnect(interval: Long, sigfunc: Long, data: Long): Timer | 1525 fun timerConnect(interval: Long, sigfunc: Long, data: Long): Timer |