@@ -581,7 +581,7 @@ class MessagesListFragment : BaseFragment<FragmentMessagesListBinding>(),
581
581
): Int {
582
582
val position = viewHolder.bindingAdapterPosition
583
583
return if (position != RecyclerView .NO_POSITION ) {
584
- val msgEntity: MessageEntity ? = null // adapter.getMsgEntity (position)
584
+ val msgEntity: MessageEntity ? = adapter.getMessageEntity (position)
585
585
if (msgEntity?.msgState == MessageState .PENDING_ARCHIVING ) {
586
586
0
587
587
} else
@@ -594,10 +594,10 @@ class MessagesListFragment : BaseFragment<FragmentMessagesListBinding>(),
594
594
override fun onSwiped (viewHolder : RecyclerView .ViewHolder , direction : Int ) {
595
595
val position = viewHolder.bindingAdapterPosition
596
596
if (position != RecyclerView .NO_POSITION ) {
597
- val item = adapter.getItemId (position)
597
+ val itemId = adapter.getMessageEntity (position)?.id ? : return
598
598
currentFolder?.let {
599
599
msgsViewModel.changeMsgsState(
600
- listOf (element = item ),
600
+ ids = listOf (itemId ),
601
601
localFolder = it,
602
602
newMsgState = MessageState .PENDING_ARCHIVING ,
603
603
notifyMsgStatesListener = false
@@ -611,7 +611,12 @@ class MessagesListFragment : BaseFragment<FragmentMessagesListBinding>(),
611
611
duration = Snackbar .LENGTH_LONG
612
612
) {
613
613
currentFolder?.let {
614
- msgsViewModel.changeMsgsState(listOf (item), it, MessageState .NONE , false )
614
+ msgsViewModel.changeMsgsState(
615
+ ids = listOf (itemId),
616
+ localFolder = it,
617
+ newMsgState = MessageState .NONE ,
618
+ notifyMsgStatesListener = false
619
+ )
615
620
// we should force archiving action because we can have other messages in the pending archiving states
616
621
msgsViewModel.msgStatesLiveData.postValue(MessageState .PENDING_ARCHIVING )
617
622
}
@@ -823,7 +828,7 @@ class MessagesListFragment : BaseFragment<FragmentMessagesListBinding>(),
823
828
824
829
private fun setupMsgsViewModel () {
825
830
msgsViewModel.msgsCountLiveData.observe(viewLifecycleOwner) {
826
- if (it ? : 0 == 0 ) {
831
+ if (( it ? : 0 ) == 0 ) {
827
832
showEmptyView()
828
833
} else {
829
834
showContent()
0 commit comments