mirror of
https://gitlab.linphone.org/BC/public/linphone-android.git
synced 2026-01-17 11:28:06 +00:00
Fixed meeting scheduling issues + fixed meetings for today not being displayed
This commit is contained in:
parent
94f2c1cc98
commit
b301a5227a
4 changed files with 21 additions and 7 deletions
|
|
@ -83,7 +83,7 @@ class MeetingsListAdapter :
|
|||
|
||||
override fun getItemViewType(position: Int): Int {
|
||||
val data = getItem(position)
|
||||
if (data.isToday) {
|
||||
if (data.isTodayIndicator) {
|
||||
return TODAY_INDICATOR
|
||||
}
|
||||
return MEETING
|
||||
|
|
|
|||
|
|
@ -28,6 +28,8 @@ class MeetingListItemModel @WorkerThread constructor(
|
|||
) {
|
||||
val isToday = meetingModel == null || meetingModel.isToday
|
||||
|
||||
val isTodayIndicator = meetingModel == null
|
||||
|
||||
val month = meetingModel?.month ?: TimestampUtils.month(System.currentTimeMillis(), false)
|
||||
|
||||
val day = meetingModel?.day ?: TimestampUtils.dayOfWeek(System.currentTimeMillis(), false)
|
||||
|
|
|
|||
|
|
@ -128,6 +128,7 @@ class MeetingsListViewModel @UiThread constructor() : AbstractMainViewModel() {
|
|||
}
|
||||
|
||||
if (add) {
|
||||
Log.d("$TAG Found meeting model info [${info.subject}]")
|
||||
val model = MeetingModel(info)
|
||||
|
||||
var firstMeetingOfTheWeek = previousModelWeekLabel != model.weekLabel
|
||||
|
|
@ -139,7 +140,8 @@ class MeetingsListViewModel @UiThread constructor() : AbstractMainViewModel() {
|
|||
}
|
||||
model.firstMeetingOfTheDay.postValue(firstMeetingOfTheDay)
|
||||
|
||||
if (model.isToday) {
|
||||
if (model.isToday && !meetingForTodayFound) {
|
||||
Log.i("$TAG Found a meeting scheduled for today")
|
||||
meetingForTodayFound = true
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -416,9 +416,9 @@ class ScheduleMeetingViewModel @UiThread constructor() : GenericViewModel() {
|
|||
|
||||
cal.timeInMillis = endTimestamp
|
||||
cal.set(Calendar.HOUR_OF_DAY, 0)
|
||||
cal.set(Calendar.MINUTE, 0)
|
||||
cal.set(Calendar.SECOND, 0)
|
||||
cal.add(Calendar.HOUR, 24)
|
||||
cal.add(Calendar.HOUR, 23)
|
||||
cal.set(Calendar.MINUTE, 59)
|
||||
cal.set(Calendar.SECOND, 59)
|
||||
val endTime = cal.timeInMillis / 1000 // Linphone expects timestamp in seconds
|
||||
val duration = ((endTime - startTime) / 60).toInt() // Linphone expects duration in minutes
|
||||
|
||||
|
|
@ -611,7 +611,8 @@ class ScheduleMeetingViewModel @UiThread constructor() : GenericViewModel() {
|
|||
cal.set(Calendar.HOUR_OF_DAY, startHour)
|
||||
cal.set(Calendar.MINUTE, startMinutes)
|
||||
}
|
||||
val start = TimestampUtils.timeToString(cal.timeInMillis, timestampInSecs = false)
|
||||
startTimestamp = cal.timeInMillis
|
||||
val start = TimestampUtils.timeToString(startTimestamp, timestampInSecs = false)
|
||||
Log.i("$TAG Computed start time for timestamp [$startTimestamp] is [$start]")
|
||||
fromTime.postValue(start)
|
||||
|
||||
|
|
@ -619,8 +620,17 @@ class ScheduleMeetingViewModel @UiThread constructor() : GenericViewModel() {
|
|||
if (endHour != -1 && endMinutes != -1) {
|
||||
cal.set(Calendar.HOUR_OF_DAY, endHour)
|
||||
cal.set(Calendar.MINUTE, endMinutes)
|
||||
|
||||
if (endHour < startHour || (endHour == startHour && endMinutes <= startMinutes)) {
|
||||
// Make sure if endTime is after startTime that it is on the next day
|
||||
if (cal.timeInMillis <= startTimestamp) {
|
||||
Log.i("$TAG endTime < startTime, adding 1 day to endTimestamp")
|
||||
cal.add(Calendar.DAY_OF_YEAR, 1)
|
||||
}
|
||||
}
|
||||
}
|
||||
val end = TimestampUtils.timeToString(cal.timeInMillis, timestampInSecs = false)
|
||||
endTimestamp = cal.timeInMillis
|
||||
val end = TimestampUtils.timeToString(endTimestamp, timestampInSecs = false)
|
||||
Log.i("$TAG Computed end time for timestamp [$endTimestamp] is [$end]")
|
||||
toTime.postValue(end)
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue