Another fix related to callLogs crash reported on the Play Store
This commit is contained in:
parent
222d60cfdd
commit
98f6206e75
3 changed files with 6 additions and 4 deletions
|
@ -110,17 +110,17 @@ class CallLogsListAdapter(
|
||||||
override fun displayHeaderForPosition(position: Int): Boolean {
|
override fun displayHeaderForPosition(position: Int): Boolean {
|
||||||
if (position >= itemCount) return false
|
if (position >= itemCount) return false
|
||||||
val callLogGroup = getItem(position)
|
val callLogGroup = getItem(position)
|
||||||
val date = callLogGroup.lastCallLog.startDate
|
val date = callLogGroup.lastCallLogStartTimestamp
|
||||||
val previousPosition = position - 1
|
val previousPosition = position - 1
|
||||||
return if (previousPosition >= 0) {
|
return if (previousPosition >= 0) {
|
||||||
val previousItemDate = getItem(previousPosition).lastCallLog.startDate
|
val previousItemDate = getItem(previousPosition).lastCallLogStartTimestamp
|
||||||
!TimestampUtils.isSameDay(date, previousItemDate)
|
!TimestampUtils.isSameDay(date, previousItemDate)
|
||||||
} else true
|
} else true
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun getHeaderViewForPosition(context: Context, position: Int): View {
|
override fun getHeaderViewForPosition(context: Context, position: Int): View {
|
||||||
val callLog = getItem(position)
|
val callLog = getItem(position)
|
||||||
val date = formatDate(context, callLog.lastCallLog.startDate)
|
val date = formatDate(context, callLog.lastCallLogStartTimestamp)
|
||||||
val binding: GenericListHeaderBinding = DataBindingUtil.inflate(
|
val binding: GenericListHeaderBinding = DataBindingUtil.inflate(
|
||||||
LayoutInflater.from(context),
|
LayoutInflater.from(context),
|
||||||
R.layout.generic_list_header, null, false
|
R.layout.generic_list_header, null, false
|
||||||
|
|
|
@ -27,6 +27,7 @@ class GroupedCallLogData(callLog: CallLog) {
|
||||||
|
|
||||||
var lastCallLog: CallLog = callLog
|
var lastCallLog: CallLog = callLog
|
||||||
var lastCallLogId: String? = callLog.callId
|
var lastCallLogId: String? = callLog.callId
|
||||||
|
var lastCallLogStartTimestamp: Long = callLog.startDate
|
||||||
val lastCallLogViewModel: CallLogViewModel
|
val lastCallLogViewModel: CallLogViewModel
|
||||||
get() {
|
get() {
|
||||||
if (::_lastCallLogViewModel.isInitialized) {
|
if (::_lastCallLogViewModel.isInitialized) {
|
||||||
|
@ -47,5 +48,6 @@ class GroupedCallLogData(callLog: CallLog) {
|
||||||
fun updateLastCallLog(callLog: CallLog) {
|
fun updateLastCallLog(callLog: CallLog) {
|
||||||
lastCallLog = callLog
|
lastCallLog = callLog
|
||||||
lastCallLogId = callLog.callId
|
lastCallLogId = callLog.callId
|
||||||
|
lastCallLogStartTimestamp = callLog.startDate
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -122,7 +122,7 @@ class CallLogsListViewModel : ViewModel() {
|
||||||
previousCallLogGroup.lastCallLog.remoteAddress.equal(callLog.remoteAddress)
|
previousCallLogGroup.lastCallLog.remoteAddress.equal(callLog.remoteAddress)
|
||||||
) {
|
) {
|
||||||
if (TimestampUtils.isSameDay(
|
if (TimestampUtils.isSameDay(
|
||||||
previousCallLogGroup.lastCallLog.startDate,
|
previousCallLogGroup.lastCallLogStartTimestamp,
|
||||||
callLog.startDate
|
callLog.startDate
|
||||||
)
|
)
|
||||||
) {
|
) {
|
||||||
|
|
Loading…
Reference in a new issue