Signed-off-by: Mario Danic <mario@lovelyhq.com>
This commit is contained in:
Mario Danic 2019-01-17 12:32:38 +01:00
parent 0e6d531a47
commit a9a4dd0289
2 changed files with 21 additions and 7 deletions

View File

@ -146,15 +146,26 @@ public class ConversationItem extends AbstractFlexibleItem<ConversationItem.Conv
holder.dialogLastMessageUserAvatar.setVisibility(View.GONE); holder.dialogLastMessageUserAvatar.setVisibility(View.GONE);
holder.dialogLastMessage.setText(conversation.getLastMessage().getText()); holder.dialogLastMessage.setText(conversation.getLastMessage().getText());
} else { } else {
conversation.getLastMessage().setActiveUserId(userEntity.getUserId());
String authorDisplayName = ""; String authorDisplayName = "";
conversation.getLastMessage().setActiveUserId(userEntity.getUserId());
String text;
if (conversation.getLastMessage().getMessageType().equals(ChatMessage.MessageType.REGULAR_TEXT_MESSAGE)) { if (conversation.getLastMessage().getMessageType().equals(ChatMessage.MessageType.REGULAR_TEXT_MESSAGE)) {
authorDisplayName = !TextUtils.isEmpty(conversation.getLastMessage().getActorDisplayName()) ? if (conversation.getLastMessage().getActorId().equals(conversation.getLastMessage().getActiveUserId())) {
conversation.getLastMessage().getActorDisplayName() + ": " : text = String.format(context.getString(R.string.nc_formatted_message_you), conversation.getLastMessage().getLastMessageDisplayText();
NextcloudTalkApplication.getSharedApplication().getString(R.string.nc_guest) + ": "; } else {
authorDisplayName = !TextUtils.isEmpty(conversation.getLastMessage().getActorDisplayName()) ?
conversation.getLastMessage().getActorDisplayName() :
"guests".equals(conversation.getLastMessage().getActorType()) ?
NextcloudTalkApplication.getSharedApplication().getString(R.string.nc_guest) : "";
text = String.format(context.getString(R.string.nc_formatted_message),
authorDisplayName,
conversation.getLastMessage().getLastMessageDisplayText());
}
} else {
text = conversation.getLastMessage().getLastMessageDisplayText();
} }
holder.dialogLastMessage.setText(authorDisplayName + conversation.getLastMessage().getLastMessageDisplayText()); holder.dialogLastMessage.setText(text);
int smallAvatarSize = Math.round(context.getResources().getDimension(R.dimen.small_item_height)); int smallAvatarSize = Math.round(context.getResources().getDimension(R.dimen.small_item_height));

View File

@ -18,7 +18,7 @@
~ along with this program. If not, see <http://www.gnu.org/licenses/>. ~ along with this program. If not, see <http://www.gnu.org/licenses/>.
--> -->
<resources> <resources xmlns:tools="http://schemas.android.com/tools">
<!-- Bottom Navigation --> <!-- Bottom Navigation -->
<string name="nc_settings">Settings</string> <string name="nc_settings">Settings</string>
@ -185,12 +185,15 @@
<string name="nc_sent_an_audio" formatted="true">%1$s sent an audio.</string> <string name="nc_sent_an_audio" formatted="true">%1$s sent an audio.</string>
<string name="nc_sent_a_video" formatted="true">%1$s sent a video.</string> <string name="nc_sent_a_video" formatted="true">%1$s sent a video.</string>
<string name="nc_sent_an_image" formatted="true">%1$s sent an image.</string> <string name="nc_sent_an_image" formatted="true">%1$s sent an image.</string>
<string name="nc_sent_a_link_you">You sent a link.</string> <string name="nc_sent_a_link_you" tools:ignore="ExtraTranslation">You sent a link.</string>
<string name="nc_sent_a_gif_you">You sent a GIF.</string> <string name="nc_sent_a_gif_you">You sent a GIF.</string>
<string name="nc_sent_an_attachment_you">You sent an attachment.</string> <string name="nc_sent_an_attachment_you">You sent an attachment.</string>
<string name="nc_sent_an_audio_you">You sent an audio.</string> <string name="nc_sent_an_audio_you">You sent an audio.</string>
<string name="nc_sent_a_video_you">You sent a video.</string> <string name="nc_sent_a_video_you">You sent a video.</string>
<string name="nc_sent_an_image_you">You sent an image.</string> <string name="nc_sent_an_image_you">You sent an image.</string>
<string name="nc_formatted_message" translatable="false">%1$s: %2$s</string>
<!-- When translating to German, please use non-formal variant -->
<string name="nc_formatted_message_you">You: %1$s</string>
<!-- Contacts endless loading --> <!-- Contacts endless loading -->
<string name="nc_no_more_load_retry">No more items to load. Refresh to retry.</string> <string name="nc_no_more_load_retry">No more items to load. Refresh to retry.</string>