diff --git a/res/drawable/ic_timer_gray_18dp.xml b/res/drawable/ic_timer_gray_18dp.xml new file mode 100644 index 000000000..52a5c9218 --- /dev/null +++ b/res/drawable/ic_timer_gray_18dp.xml @@ -0,0 +1,5 @@ + + + diff --git a/res/layout/conversation_title_view.xml b/res/layout/conversation_title_view.xml index d70ae86b2..5be271dcc 100644 --- a/res/layout/conversation_title_view.xml +++ b/res/layout/conversation_title_view.xml @@ -49,17 +49,35 @@ android:layout_toEndOf="@id/contact_photo_image" android:layout_toRightOf="@id/contact_photo_image"> - + android:layout_height="wrap_content"> + + + + + + =1 ) { + if( dcChat.isSelfTalk() ) { + subtitleStr = context.getString(R.string.chat_self_talk_subtitle); + } + else if( dcChat.isDeviceTalk() ) { + subtitleStr = context.getString(R.string.device_talk_subtitle); + } + else { + subtitleStr = dcContext.getContact(chatContacts[0]).getAddr(); + } + } + + subtitle.setText(subtitleStr); + } + + // set icons etc. int imgLeft = 0; int imgRight = 0; - if (dcChat == null) { - setComposeTitle(); - } else { - setRecipientTitle(dcChat, showSubtitle); - if (Prefs.isChatMuted(dcChat)) { - imgLeft = R.drawable.ic_volume_off_white_18dp; - } - if (dcChat.isVerified()) { - imgRight = R.drawable.ic_verified; - } - this.avatar.setAvatar(glideRequests, DcHelper.getContext(getContext()).getRecipient(dcChat), false); + if (Prefs.isChatMuted(dcChat)) { + imgLeft = R.drawable.ic_volume_off_white_18dp; + } + if (dcChat.isVerified()) { + imgRight = R.drawable.ic_verified; } + avatar.setAvatar(glideRequests, DcHelper.getContext(getContext()).getRecipient(dcChat), false); title.setCompoundDrawablesWithIntrinsicBounds(imgLeft, 0, imgRight, 0); + subtitle.setVisibility(showAddInfo? View.VISIBLE : View.GONE); + + boolean isEphemeral = dcContext.getChatEphemeralTimer(chatId) != 0; + ephemeralIcon.setVisibility((showAddInfo && isEphemeral)? View.VISIBLE : View.GONE); } - public void setTitle(@NonNull GlideRequests glideRequests, @Nullable DcContact contact) { + public void setTitle(@NonNull GlideRequests glideRequests, @NonNull DcContact contact) { // the verified state is _not_ shown in the title. this will be confusing as in the one-to-one-ChatViews, the verified // icon is also not shown as these chats are always opportunistic chats avatar.setAvatar(glideRequests, DcHelper.getContext(getContext()).getRecipient(contact), false); @@ -97,10 +128,6 @@ public class ConversationTitleView extends RelativeLayout { this.avatar.setOnClickListener(listener); } - public void setOnAvatarClickListener(@Nullable OnClickListener listener) { - this.avatar.setOnClickListener(listener); - } - @Override public void setOnLongClickListener(@Nullable OnLongClickListener listener) { this.content.setOnLongClickListener(listener); @@ -110,42 +137,4 @@ public class ConversationTitleView extends RelativeLayout { public void setOnBackClickedListener(@Nullable OnClickListener listener) { this.back.setOnClickListener(listener); } - - private void setComposeTitle() { - this.title.setText(null); - this.subtitle.setText(null); - this.subtitle.setVisibility(View.GONE); - } - - private void setRecipientTitle(DcChat dcChat, boolean showSubtitle) { - int chatId = dcChat.getId(); - if( chatId == DcChat.DC_CHAT_ID_DEADDROP ) { - this.title.setText(R.string.menu_deaddrop); - this.subtitle.setText(R.string.menu_deaddrop_subtitle); - } else { - this.title.setText(dcChat.getName()); - String subtitle = "ErrSubtitle"; - - Context context = getContext(); - DcContext dcContext = DcHelper.getContext(context); - int[] chatContacts = dcContext.getChatContacts(chatId); - if( dcChat.isGroup() ) { - subtitle = context.getResources().getQuantityString(R.plurals.n_members, chatContacts.length, chatContacts.length); - } else if( chatContacts.length>=1 ) { - if( dcChat.isSelfTalk() ) { - subtitle = context.getString(R.string.chat_self_talk_subtitle); - } - else if( dcChat.isDeviceTalk() ) { - subtitle = context.getString(R.string.device_talk_subtitle); - } - else { - subtitle = dcContext.getContact(chatContacts[0]).getAddr(); - } - } - - this.subtitle.setText(subtitle); - } - - this.subtitle.setVisibility(showSubtitle? View.VISIBLE : View.GONE); - } }