mirror of
https://gitlab.linphone.org/BC/public/linphone-android.git
synced 2026-01-17 11:28:06 +00:00
Fixed wrong position of today indicator in meetings list
This commit is contained in:
parent
e6d5e35f29
commit
9fc6a1eb57
9 changed files with 24 additions and 20 deletions
|
|
@ -116,7 +116,7 @@ abstract class AbstractNewTransferCallFragment : GenericCallFragment() {
|
|||
|
||||
binding.contactsAndSuggestionsList.setHasFixedSize(true)
|
||||
|
||||
val headerItemDecoration = RecyclerViewHeaderDecoration(requireContext(), adapter, true)
|
||||
val headerItemDecoration = RecyclerViewHeaderDecoration(requireContext(), adapter)
|
||||
binding.contactsAndSuggestionsList.addItemDecoration(headerItemDecoration)
|
||||
|
||||
adapter.contactClickedEvent.observe(viewLifecycleOwner) {
|
||||
|
|
|
|||
|
|
@ -115,7 +115,7 @@ abstract class GenericAddressPickerFragment : GenericFragment() {
|
|||
recyclerView.setHasFixedSize(true)
|
||||
recyclerView.layoutManager = LinearLayoutManager(requireContext())
|
||||
|
||||
val headerItemDecoration = RecyclerViewHeaderDecoration(requireContext(), adapter, true)
|
||||
val headerItemDecoration = RecyclerViewHeaderDecoration(requireContext(), adapter)
|
||||
recyclerView.addItemDecoration(headerItemDecoration)
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -36,13 +36,12 @@ class ContactsAndSuggestionsListAdapter :
|
|||
|
||||
override fun displayHeaderForPosition(position: Int): Boolean {
|
||||
val model = getItem(position)
|
||||
if (model.friend == null) {
|
||||
if (position == 0) {
|
||||
return true
|
||||
}
|
||||
if (position == 0) {
|
||||
return true
|
||||
} else if (model.friend == null) {
|
||||
val previousModel = getItem(position - 1)
|
||||
return previousModel.friend != null
|
||||
} else if (position == 0) return true
|
||||
}
|
||||
return false
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -88,7 +88,7 @@ class HistoryListAdapter : ListAdapter<CallLogModel, RecyclerView.ViewHolder>(Ca
|
|||
}
|
||||
|
||||
override fun areContentsTheSame(oldItem: CallLogModel, newItem: CallLogModel): Boolean {
|
||||
return oldItem.avatarModel.id == newItem.avatarModel.id && oldItem.iconResId.value == newItem.iconResId.value
|
||||
return oldItem.avatarModel.id == newItem.avatarModel.id && oldItem.iconResId == newItem.iconResId
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -3,7 +3,6 @@ package org.linphone.ui.main.history.model
|
|||
import androidx.annotation.IntegerRes
|
||||
import androidx.annotation.UiThread
|
||||
import androidx.annotation.WorkerThread
|
||||
import androidx.lifecycle.MutableLiveData
|
||||
import org.linphone.LinphoneApplication.Companion.coreContext
|
||||
import org.linphone.R
|
||||
import org.linphone.core.Call.Dir
|
||||
|
|
|
|||
|
|
@ -97,9 +97,9 @@ class MeetingsListFragment : AbstractTopBarFragment() {
|
|||
binding.viewModel = listViewModel
|
||||
|
||||
binding.meetingsList.setHasFixedSize(true)
|
||||
val headerItemDecoration = RecyclerViewHeaderDecoration(requireContext(), adapter, true)
|
||||
binding.meetingsList.addItemDecoration(headerItemDecoration)
|
||||
binding.meetingsList.layoutManager = LinearLayoutManager(requireContext())
|
||||
val headerItemDecoration = RecyclerViewHeaderDecoration(requireContext(), adapter)
|
||||
binding.meetingsList.addItemDecoration(headerItemDecoration)
|
||||
|
||||
binding.setNewMeetingClicked {
|
||||
if (findNavController().currentDestination?.id == R.id.meetingsListFragment) {
|
||||
|
|
|
|||
|
|
@ -30,7 +30,7 @@ import androidx.recyclerview.widget.RecyclerView
|
|||
class RecyclerViewHeaderDecoration(
|
||||
private val context: Context,
|
||||
private val adapter: HeaderAdapter,
|
||||
private val sticky: Boolean = false
|
||||
private val sticky: Boolean = true
|
||||
) : RecyclerView.ItemDecoration() {
|
||||
private val headers: SparseArray<View> = SparseArray()
|
||||
|
||||
|
|
|
|||
|
|
@ -47,9 +47,17 @@ class TimestampUtils {
|
|||
cal.timeInMillis = if (timestampInSecs) timestamp * 1000 else timestamp
|
||||
|
||||
val tomorrow = Calendar.getInstance()
|
||||
return cal[Calendar.ERA] >= tomorrow[Calendar.ERA] &&
|
||||
cal[Calendar.YEAR] >= tomorrow[Calendar.YEAR] &&
|
||||
cal[Calendar.DAY_OF_YEAR] >= tomorrow[Calendar.DAY_OF_YEAR]
|
||||
tomorrow.timeInMillis = System.currentTimeMillis()
|
||||
|
||||
if (cal.get(Calendar.ERA) > tomorrow.get(Calendar.ERA)) return true
|
||||
if (cal.get(Calendar.ERA) == tomorrow.get(Calendar.ERA) &&
|
||||
cal.get(Calendar.YEAR) > tomorrow.get(Calendar.YEAR)
|
||||
) {
|
||||
return true
|
||||
}
|
||||
return cal.get(Calendar.ERA) == tomorrow.get(Calendar.ERA) &&
|
||||
cal.get(Calendar.YEAR) == tomorrow.get(Calendar.YEAR) &&
|
||||
cal.get(Calendar.DAY_OF_YEAR) >= tomorrow.get(Calendar.DAY_OF_YEAR)
|
||||
}
|
||||
|
||||
@AnyThread
|
||||
|
|
|
|||
|
|
@ -7,18 +7,16 @@
|
|||
</data>
|
||||
|
||||
<androidx.appcompat.widget.AppCompatTextView
|
||||
style="@style/default_text_style_800"
|
||||
style="@style/section_header_style"
|
||||
android:id="@+id/header"
|
||||
android:background="?attr/color_main2_000"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:paddingStart="20dp"
|
||||
android:paddingEnd="20dp"
|
||||
android:paddingTop="16dp"
|
||||
android:paddingBottom="16dp"
|
||||
android:paddingStart="16dp"
|
||||
android:paddingEnd="16dp"
|
||||
android:text="October"
|
||||
android:textSize="20sp"
|
||||
android:textColor="@color/gray_main2_600"
|
||||
android:gravity="center_vertical"
|
||||
tools:ignore="HardcodedText" />
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue