add different icons depending on chatType

This commit is contained in:
Chumva 2018-07-13 17:53:59 +03:00
parent af7c9bed4b
commit 4026eff998
3 changed files with 20 additions and 3 deletions

View file

@ -26,7 +26,12 @@ object TelegramUiHelper {
bitmap = app.uiUtils.getCircleBitmap(photoPath)
}
if (bitmap == null) {
drawable = app.uiUtils.getIcon(placeholderId)
drawable =
if (placeholderId == R.drawable.img_user_picture || placeholderId == R.drawable.img_group_picture) {
app.uiUtils.getIcon(placeholderId)
} else {
app.uiUtils.getThemedIcon(placeholderId)
}
}
if (bitmap != null) {
iv.setImageBitmap(bitmap)

View file

@ -344,8 +344,14 @@ class MyLocationTabFragment : Fragment(), TelegramListener {
override fun onBindViewHolder(holder: ChatViewHolder, position: Int) {
val chat = chats[position]
val lastItem = position == itemCount - 1
val placeholderId: Int =
if (chat.type is TdApi.ChatTypeBasicGroup || chat.type is TdApi.ChatTypeSupergroup) {
R.drawable.img_group_picture
} else {
R.drawable.img_user_picture
}
TelegramUiHelper.setupPhoto(app, holder.icon, chat.photo?.small?.local?.path)
TelegramUiHelper.setupPhoto(app, holder.icon, chat.photo?.small?.local?.path, placeholderId)
holder.title?.text = chat.title
holder.description?.text = "Some description" // FIXME
holder.checkBox?.apply {

View file

@ -208,8 +208,14 @@ class SetTimeDialogFragment : DialogFragment() {
override fun onBindViewHolder(holder: ChatViewHolder, position: Int) {
val chat = chats[position]
val placeholderId: Int =
if (chat.type is TdApi.ChatTypeBasicGroup || chat.type is TdApi.ChatTypeSupergroup) {
R.drawable.img_group_picture
} else {
R.drawable.img_user_picture
}
TelegramUiHelper.setupPhoto(app, holder.icon, chat.photo?.small?.local?.path)
TelegramUiHelper.setupPhoto(app, holder.icon, chat.photo?.small?.local?.path, placeholderId)
holder.title?.text = chat.title
holder.description?.text = "Some description" // FIXME
holder.textInArea?.apply {