First steps towards fixing german

Signed-off-by: Mario Danic <mario@lovelyhq.com>
This commit is contained in:
Mario Danic 2019-01-16 02:07:17 +01:00
parent 1d862831d2
commit ce1d5cd47b
3 changed files with 55 additions and 38 deletions

View File

@ -21,12 +21,8 @@
package com.nextcloud.talk.adapters.items;
import android.content.Context;
import android.graphics.Typeface;
import android.text.Spannable;
import android.text.SpannableString;
import android.text.TextUtils;
import android.text.format.DateUtils;
import android.text.style.StyleSpan;
import android.view.View;
import android.widget.ImageView;
import android.widget.TextView;
@ -128,7 +124,6 @@ public class ConversationItem extends AbstractFlexibleItem<ConversationItem.Conv
holder.dialogUnreadBubble.setVisibility(View.GONE);
}
String authorDisplayName;
if (conversation.isHasPassword()) {
holder.passwordProtectedRoomImageView.setVisibility(View.VISIBLE);
@ -151,29 +146,15 @@ public class ConversationItem extends AbstractFlexibleItem<ConversationItem.Conv
holder.dialogLastMessageUserAvatar.setVisibility(View.GONE);
holder.dialogLastMessage.setText(conversation.getLastMessage().getText());
} else {
if (conversation.getLastMessage().getActorId().equals(userEntity.getUserId())) {
authorDisplayName = context.getString(R.string.nc_chat_you);
} else {
if (!TextUtils.isEmpty(conversation.getLastMessage().getActorDisplayName())) {
authorDisplayName = conversation.getLastMessage().getActorDisplayName();
} else {
authorDisplayName = context.getString(R.string.nc_nick_guest);
}
}
conversation.getLastMessage().setActiveUserId(userEntity.getUserId());
String authorDisplayName = "";
if (conversation.getLastMessage().getMessageType().equals(ChatMessage.MessageType.REGULAR_TEXT_MESSAGE)) {
authorDisplayName += ": ";
} else {
authorDisplayName += " ";
authorDisplayName = !TextUtils.isEmpty(conversation.getLastMessage().getActorDisplayName()) ?
conversation.getLastMessage().getActorDisplayName() + ": " :
NextcloudTalkApplication.getSharedApplication().getString(R.string.nc_guest) + ": ";
}
String fullString = authorDisplayName + conversation.getLastMessage().getLastMessageDisplayText();
Spannable spannableString = new SpannableString(fullString);
final StyleSpan boldStyleSpan = new StyleSpan(Typeface.BOLD);
spannableString.setSpan(boldStyleSpan, 0, authorDisplayName.length(), Spannable
.SPAN_INCLUSIVE_INCLUSIVE);
holder.dialogLastMessage.setText(spannableString);
holder.dialogLastMessage.setText(authorDisplayName + conversation.getLastMessage().getLastMessageDisplayText());
int smallAvatarSize = Math.round(context.getResources().getDimension(R.dimen.small_item_height));

View File

@ -20,6 +20,7 @@
package com.nextcloud.talk.models.json.chat;
import android.text.TextUtils;
import android.util.Log;
import com.bluelinelabs.logansquare.annotation.JsonField;
import com.bluelinelabs.logansquare.annotation.JsonIgnore;
@ -197,17 +198,47 @@ public class ChatMessage implements IMessage, MessageContentType, MessageContent
if (getMessageType().equals(MessageType.SINGLE_LINK_GIPHY_MESSAGE)
|| getMessageType().equals(MessageType.SINGLE_LINK_TENOR_MESSAGE)
|| getMessageType().equals(MessageType.SINGLE_LINK_GIF_MESSAGE)) {
return (NextcloudTalkApplication.getSharedApplication().getString(R.string.nc_sent_a_gif));
if (getActorId().equals(getActiveUserId())) {
return (NextcloudTalkApplication.getSharedApplication().getString(R.string.nc_sent_a_gif_you));
} else {
return (String.format(NextcloudTalkApplication.getSharedApplication().getResources().getString(R.string.nc_sent_a_gif),
!TextUtils.isEmpty(getActorDisplayName()) ? getActorDisplayName() : NextcloudTalkApplication.getSharedApplication().getString(R.string.nc_guest)));
}
} else if (getMessageType().equals(MessageType.SINGLE_NC_ATTACHMENT_MESSAGE)) {
return (NextcloudTalkApplication.getSharedApplication().getString(R.string.nc_sent_an_attachment));
if (getActorId().equals(getActiveUserId())) {
return (NextcloudTalkApplication.getSharedApplication().getString(R.string.nc_sent_an_attachment_you));
} else {
return (String.format(NextcloudTalkApplication.getSharedApplication().getResources().getString(R.string.nc_sent_an_attachment),
!TextUtils.isEmpty(getActorDisplayName()) ? getActorDisplayName() : NextcloudTalkApplication.getSharedApplication().getString(R.string.nc_guest)));
}
} else if (getMessageType().equals(MessageType.SINGLE_LINK_MESSAGE)) {
return (NextcloudTalkApplication.getSharedApplication().getString(R.string.nc_sent_a_link));
if (getActorId().equals(getActiveUserId())) {
return (NextcloudTalkApplication.getSharedApplication().getString(R.string.nc_sent_a_link_you));
} else {
return (String.format(NextcloudTalkApplication.getSharedApplication().getResources().getString(R.string.nc_sent_a_link),
!TextUtils.isEmpty(getActorDisplayName()) ? getActorDisplayName() : NextcloudTalkApplication.getSharedApplication().getString(R.string.nc_guest)));
}
} else if (getMessageType().equals(MessageType.SINGLE_LINK_AUDIO_MESSAGE)) {
return (NextcloudTalkApplication.getSharedApplication().getString(R.string.nc_sent_an_audio));
if (getActorId().equals(getActiveUserId())) {
return (NextcloudTalkApplication.getSharedApplication().getString(R.string.nc_sent_an_audio_you));
} else {
return (String.format(NextcloudTalkApplication.getSharedApplication().getResources().getString(R.string.nc_sent_an_audio),
!TextUtils.isEmpty(getActorDisplayName()) ? getActorDisplayName() : NextcloudTalkApplication.getSharedApplication().getString(R.string.nc_guest)));
}
} else if (getMessageType().equals(MessageType.SINGLE_LINK_VIDEO_MESSAGE)) {
return (NextcloudTalkApplication.getSharedApplication().getString(R.string.nc_sent_a_video));
if (getActorId().equals(getActiveUserId())) {
return (NextcloudTalkApplication.getSharedApplication().getString(R.string.nc_sent_a_video_you));
} else {
return (String.format(NextcloudTalkApplication.getSharedApplication().getResources().getString(R.string.nc_sent_a_video),
!TextUtils.isEmpty(getActorDisplayName()) ? getActorDisplayName() : NextcloudTalkApplication.getSharedApplication().getString(R.string.nc_guest)));
}
} else if (getMessageType().equals(MessageType.SINGLE_LINK_IMAGE_MESSAGE)) {
return (NextcloudTalkApplication.getSharedApplication().getString(R.string.nc_sent_an_image));
if (getActorId().equals(getActiveUserId())) {
return (NextcloudTalkApplication.getSharedApplication().getString(R.string.nc_sent_an_image_you));
} else {
return (String.format(NextcloudTalkApplication.getSharedApplication().getResources().getString(R.string.nc_sent_an_image),
!TextUtils.isEmpty(getActorDisplayName()) ? getActorDisplayName() : NextcloudTalkApplication.getSharedApplication().getString(R.string.nc_guest)));
}
}
}

View File

@ -180,13 +180,18 @@
<string name="nc_new_messages">New messages</string>
<string name="nc_no_messages_yet">No messages yet</string>
<string name="nc_chat_you">You</string>
<string name="nc_sent_a_link">sent a link.</string>
<string name="nc_sent_a_gif">sent a GIF.</string>
<string name="nc_sent_an_attachment">sent an attachment.</string>
<string name="nc_sent_an_audio">sent an audio.</string>
<string name="nc_sent_a_video">sent a video.</string>
<string name="nc_sent_an_image">sent an image.</string>
<string name="nc_sent_a_link" formatted="true">%1$s sent a link.</string>
<string name="nc_sent_a_gif" formatted="true">%1$s sent a GIF.</string>
<string name="nc_sent_an_attachment" formatted="true">%1$s sent an attachment.</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_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_gif_you">You sent a GIF.</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_a_video_you">You sent a video.</string>
<string name="nc_sent_an_image_you">You sent an image.</string>
<!-- Contacts endless loading -->
<string name="nc_no_more_load_retry">No more items to load. Refresh to retry.</string>