fix(好友列表模块): 修复好友列表不显示问题
修复好友列表不显示问题
This commit is contained in:
parent
fea67b33ce
commit
c1a28b9bef
@ -41,7 +41,14 @@ class FriendListActivity : AppCompatActivity() {
|
||||
private fun getFriendList(username: String) {
|
||||
friendListViewModel.getFriendList(username).observe(this) { value ->
|
||||
if (value != null) {
|
||||
friendList = value as MutableList<FriendItem>
|
||||
friendList.addAll(value)
|
||||
binding.recycleFriendList.adapter?.notifyDataSetChanged()
|
||||
|
||||
if (friendList.isEmpty()) {
|
||||
binding.tvNothing.visibility = View.VISIBLE
|
||||
} else {
|
||||
binding.tvNothing.visibility = View.GONE
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -6,6 +6,7 @@ import android.view.LayoutInflater
|
||||
import android.view.ViewGroup
|
||||
import androidx.recyclerview.widget.RecyclerView
|
||||
import androidx.recyclerview.widget.RecyclerView.ViewHolder
|
||||
import com.bumptech.glide.Glide
|
||||
import com.kaixed.kchat.databinding.FriendRecycleItemBinding
|
||||
import com.kaixed.kchat.model.friend.FriendItem
|
||||
import com.kaixed.kchat.view.activity.ChatActivity
|
||||
@ -35,6 +36,10 @@ class FriendListAdapter(private val items: MutableList<FriendItem>, private val
|
||||
intent.putExtra("friendId", item.username)
|
||||
context.startActivity(intent)
|
||||
}
|
||||
|
||||
holder.binding.tvNickname.text = item.nickname
|
||||
holder.binding.tvSignature.text = item.signature
|
||||
Glide.with(context).load(item.avatarUrl).into(holder.binding.ifvAvatar)
|
||||
}
|
||||
|
||||
override fun getItemCount(): Int = items.size
|
||||
|
Loading…
Reference in New Issue
Block a user