|
@@ -8,6 +8,7 @@ import com.shanp.youqi.base.rx.EventSubscriber
|
|
import com.shanp.youqi.base.rx.RxBus
|
|
import com.shanp.youqi.base.rx.RxBus
|
|
import com.shanp.youqi.common.base.UChatFragment
|
|
import com.shanp.youqi.common.base.UChatFragment
|
|
import com.shanp.youqi.common.vo.im.ConversationListVo
|
|
import com.shanp.youqi.common.vo.im.ConversationListVo
|
|
|
|
+import com.shanp.youqi.common.widget.EmptyView
|
|
import com.shanp.youqi.core.event.IMReceivedMessageEvent
|
|
import com.shanp.youqi.core.event.IMReceivedMessageEvent
|
|
import com.shanp.youqi.core.memory.AppManager
|
|
import com.shanp.youqi.core.memory.AppManager
|
|
import com.shanp.youqi.im.R
|
|
import com.shanp.youqi.im.R
|
|
@@ -38,6 +39,7 @@ class MessageListOnlyUserFragment : UChatFragment() {
|
|
|
|
|
|
private var adapter = MessageListOnlyUserAdapter(null)
|
|
private var adapter = MessageListOnlyUserAdapter(null)
|
|
private val messageListDialog: MessageListDialog by lazy { parentFragment as MessageListDialog }
|
|
private val messageListDialog: MessageListDialog by lazy { parentFragment as MessageListDialog }
|
|
|
|
+ private lateinit var emptyView: EmptyView
|
|
|
|
|
|
override fun getLayoutId(): Int = R.layout.im_fragment_message_list_only_user
|
|
override fun getLayoutId(): Int = R.layout.im_fragment_message_list_only_user
|
|
|
|
|
|
@@ -51,6 +53,11 @@ class MessageListOnlyUserFragment : UChatFragment() {
|
|
}
|
|
}
|
|
|
|
|
|
private fun initRecyclerView() {
|
|
private fun initRecyclerView() {
|
|
|
|
+ emptyView = EmptyView(mContext)
|
|
|
|
+ .setColorStyle(true)
|
|
|
|
+ .setNoDataTitle("暂无聊天联系人")
|
|
|
|
+ .setNoDataIconIds(R.drawable.empty_box_bright)
|
|
|
|
+ .setLayoutType(EmptyView.LayoutType.TYPE_LAYOUT_NO_DATA)
|
|
val manager = LinearLayoutManager(mContext, RecyclerView.VERTICAL, false)
|
|
val manager = LinearLayoutManager(mContext, RecyclerView.VERTICAL, false)
|
|
binding.rcv.itemAnimator = null
|
|
binding.rcv.itemAnimator = null
|
|
binding.rcv.layoutManager = manager
|
|
binding.rcv.layoutManager = manager
|
|
@@ -152,12 +159,18 @@ class MessageListOnlyUserFragment : UChatFragment() {
|
|
}
|
|
}
|
|
|
|
|
|
if (tempData.size > 0) {
|
|
if (tempData.size > 0) {
|
|
|
|
+ adapter.isUseEmpty(false)
|
|
adapter.addData(tempData)
|
|
adapter.addData(tempData)
|
|
}
|
|
}
|
|
timeStamp = adapter.data.last().conversation.sentTime
|
|
timeStamp = adapter.data.last().conversation.sentTime
|
|
binding.srl.setEnableLoadMore(data.size >= count)
|
|
binding.srl.setEnableLoadMore(data.size >= count)
|
|
binding.srl.finishLoadMore()
|
|
binding.srl.finishLoadMore()
|
|
} else {
|
|
} else {
|
|
|
|
+ if (adapter.itemCount <= 0) {
|
|
|
|
+ adapter.isUseEmpty(true)
|
|
|
|
+ adapter.emptyView = emptyView
|
|
|
|
+ adapter.notifyDataSetChanged()
|
|
|
|
+ }
|
|
binding.srl.setEnableLoadMore(false)
|
|
binding.srl.setEnableLoadMore(false)
|
|
binding.srl.setNoMoreData(true)
|
|
binding.srl.setNoMoreData(true)
|
|
binding.srl.finishLoadMore()
|
|
binding.srl.finishLoadMore()
|