Add locale time formatting to system messages

Signed-off-by: Andy Scherzinger <info@andy-scherzinger.de>
This commit is contained in:
Andy Scherzinger 2022-12-15 08:55:24 +01:00
parent e9d0fca9d8
commit 2fca50cc9b
No known key found for this signature in database
GPG key ID: 6CADC7E3523C308B

View file

@ -31,6 +31,7 @@ import android.view.ViewGroup;
import com.nextcloud.talk.R; import com.nextcloud.talk.R;
import com.nextcloud.talk.application.NextcloudTalkApplication; import com.nextcloud.talk.application.NextcloudTalkApplication;
import com.nextcloud.talk.models.json.chat.ChatMessage; import com.nextcloud.talk.models.json.chat.ChatMessage;
import com.nextcloud.talk.utils.DateUtils;
import com.nextcloud.talk.utils.DisplayUtils; import com.nextcloud.talk.utils.DisplayUtils;
import com.nextcloud.talk.utils.preferences.AppPreferences; import com.nextcloud.talk.utils.preferences.AppPreferences;
import com.stfalcon.chatkit.messages.MessageHolders; import com.stfalcon.chatkit.messages.MessageHolders;
@ -53,6 +54,9 @@ public class SystemMessageViewHolder extends MessageHolders.IncomingTextMessageV
@Inject @Inject
Context context; Context context;
@Inject
DateUtils dateUtils;
protected ViewGroup background; protected ViewGroup background;
public SystemMessageViewHolder(View itemView) { public SystemMessageViewHolder(View itemView) {
@ -101,6 +105,10 @@ public class SystemMessageViewHolder extends MessageHolders.IncomingTextMessageV
text.setText(messageString); text.setText(messageString);
if (time != null) {
time.setText(dateUtils.getLocalTimeStringFromTimestamp(message.getTimestamp()));
}
itemView.setTag(REPLYABLE_VIEW_TAG, message.getReplyable()); itemView.setTag(REPLYABLE_VIEW_TAG, message.getReplyable());
} }
} }