|
@@ -6,6 +6,7 @@ import androidx.recyclerview.widget.RecyclerView
|
|
import com.chad.library.adapter.base.BaseQuickAdapter
|
|
import com.chad.library.adapter.base.BaseQuickAdapter
|
|
import com.shanp.youqi.base.rx.EventSubscriber
|
|
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.R2
|
|
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.common.widget.EmptyView
|
|
@@ -39,7 +40,6 @@ 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
|
|
|
|
|
|
@@ -53,11 +53,15 @@ class MessageListOnlyUserFragment : UChatFragment() {
|
|
}
|
|
}
|
|
|
|
|
|
private fun initRecyclerView() {
|
|
private fun initRecyclerView() {
|
|
- emptyView = EmptyView(mContext)
|
|
|
|
|
|
+ binding.emptyView
|
|
.setColorStyle(true)
|
|
.setColorStyle(true)
|
|
.setNoDataTitle("暂无聊天联系人")
|
|
.setNoDataTitle("暂无聊天联系人")
|
|
.setNoDataIconIds(R.drawable.empty_box_bright)
|
|
.setNoDataIconIds(R.drawable.empty_box_bright)
|
|
.setLayoutType(EmptyView.LayoutType.TYPE_LAYOUT_NO_DATA)
|
|
.setLayoutType(EmptyView.LayoutType.TYPE_LAYOUT_NO_DATA)
|
|
|
|
+
|
|
|
|
+ binding.emptyView.pageRootLayout.setBackgroundResource(R.drawable.bg_white_radius_top_13)
|
|
|
|
+
|
|
|
|
+ binding.emptyView.visibility = View.GONE
|
|
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
|
|
@@ -127,6 +131,7 @@ class MessageListOnlyUserFragment : UChatFragment() {
|
|
adapter.remove(oldDataIndex)
|
|
adapter.remove(oldDataIndex)
|
|
}
|
|
}
|
|
adapter.addData(0, ConversationListVo(it))
|
|
adapter.addData(0, ConversationListVo(it))
|
|
|
|
+ binding.emptyView.visibility = View.GONE
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
@@ -159,26 +164,31 @@ 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()
|
|
}
|
|
}
|
|
|
|
+
|
|
|
|
+ if (adapter.itemCount <= 0) {
|
|
|
|
+ binding.emptyView.visibility = View.VISIBLE
|
|
|
|
+ } else {
|
|
|
|
+ binding.emptyView.visibility = View.GONE
|
|
|
|
+ }
|
|
}
|
|
}
|
|
|
|
|
|
override fun onError(error: RongIMClient.ErrorCode?) {
|
|
override fun onError(error: RongIMClient.ErrorCode?) {
|
|
binding.srl.finishLoadMore()
|
|
binding.srl.finishLoadMore()
|
|
|
|
+ if (adapter.itemCount <= 0) {
|
|
|
|
+ binding.emptyView.visibility = View.VISIBLE
|
|
|
|
+ } else {
|
|
|
|
+ binding.emptyView.visibility = View.GONE
|
|
|
|
+ }
|
|
}
|
|
}
|
|
|
|
|
|
}
|
|
}
|