فهرست منبع

show user statuses in conversation list

Signed-off-by: Marcel Hibbe <dev@mhibbe.de>
Marcel Hibbe 3 سال پیش
والد
کامیت
6057306ab3

+ 55 - 24
app/src/main/java/com/nextcloud/talk/adapters/items/ConversationItem.java

@@ -46,6 +46,8 @@ import com.nextcloud.talk.models.database.CapabilitiesUtil;
 import com.nextcloud.talk.models.database.UserEntity;
 import com.nextcloud.talk.models.json.chat.ChatMessage;
 import com.nextcloud.talk.models.json.conversations.Conversation;
+import com.nextcloud.talk.models.json.status.Status;
+import com.nextcloud.talk.models.json.status.StatusType;
 import com.nextcloud.talk.utils.ApiUtils;
 import com.nextcloud.talk.utils.DisplayUtils;
 
@@ -66,26 +68,29 @@ import eu.davidea.flexibleadapter.utils.FlexibleUtils;
 import eu.davidea.viewholders.FlexibleViewHolder;
 
 public class ConversationItem extends AbstractFlexibleItem<ConversationItem.ConversationItemViewHolder> implements ISectionable<ConversationItem.ConversationItemViewHolder, GenericTextHeaderItem>,
-        IFilterable<String> {
+    IFilterable<String> {
 
 
     private Conversation conversation;
     private UserEntity userEntity;
     private Context context;
     private GenericTextHeaderItem header;
+    private Status status;
 
-    public ConversationItem(Conversation conversation, UserEntity userEntity, Context activityContext) {
+    public ConversationItem(Conversation conversation, UserEntity userEntity, Context activityContext, Status status) {
         this.conversation = conversation;
         this.userEntity = userEntity;
         this.context = activityContext;
+        this.status = status;
     }
 
     public ConversationItem(Conversation conversation, UserEntity userEntity,
-                            Context activityContext, GenericTextHeaderItem genericTextHeaderItem) {
+                            Context activityContext, GenericTextHeaderItem genericTextHeaderItem, Status status) {
         this.conversation = conversation;
         this.userEntity = userEntity;
         this.context = activityContext;
         this.header = genericTextHeaderItem;
+        this.status = status;
     }
 
     @Override
@@ -120,7 +125,7 @@ public class ConversationItem extends AbstractFlexibleItem<ConversationItem.Conv
     @Override
     public void bindViewHolder(FlexibleAdapter<IFlexible> adapter, ConversationItemViewHolder holder, int position, List<Object> payloads) {
         Context appContext =
-                NextcloudTalkApplication.Companion.getSharedApplication().getApplicationContext();
+            NextcloudTalkApplication.Companion.getSharedApplication().getApplicationContext();
         holder.dialogAvatar.setController(null);
 
         holder.dialogName.setTextColor(ResourcesCompat.getColor(context.getResources(),
@@ -129,8 +134,8 @@ public class ConversationItem extends AbstractFlexibleItem<ConversationItem.Conv
 
         if (adapter.hasFilter()) {
             FlexibleUtils.highlightText(holder.dialogName, conversation.getDisplayName(),
-                    String.valueOf(adapter.getFilter(String.class)), NextcloudTalkApplication.Companion.getSharedApplication()
-                            .getResources().getColor(R.color.colorPrimary));
+                                        String.valueOf(adapter.getFilter(String.class)), NextcloudTalkApplication.Companion.getSharedApplication()
+                                            .getResources().getColor(R.color.colorPrimary));
         } else {
             holder.dialogName.setText(conversation.getDisplayName());
         }
@@ -147,19 +152,19 @@ public class ConversationItem extends AbstractFlexibleItem<ConversationItem.Conv
 
             ColorStateList lightBubbleFillColor = ColorStateList.valueOf(
                 ContextCompat.getColor(context,
-                R.color.conversation_unread_bubble));
+                                       R.color.conversation_unread_bubble));
             int lightBubbleTextColor = ContextCompat.getColor(
                 context,
                 R.color.conversation_unread_bubble_text);
             ColorStateList lightBubbleStrokeColor = ColorStateList.valueOf(
                 ContextCompat.getColor(context,
-                R.color.colorPrimary));
+                                       R.color.colorPrimary));
 
             if (conversation.type == Conversation.ConversationType.ROOM_TYPE_ONE_TO_ONE_CALL) {
                 holder.dialogUnreadBubble.setChipBackgroundColorResource(R.color.colorPrimary);
                 holder.dialogUnreadBubble.setTextColor(Color.WHITE);
             } else if (conversation.isUnreadMention()) {
-                if (CapabilitiesUtil.hasSpreedFeatureCapability(userEntity, "direct-mention-flag")){
+                if (CapabilitiesUtil.hasSpreedFeatureCapability(userEntity, "direct-mention-flag")) {
                     if (conversation.getUnreadMentionDirect()) {
                         holder.dialogUnreadBubble.setChipBackgroundColorResource(R.color.colorPrimary);
                         holder.dialogUnreadBubble.setTextColor(Color.WHITE);
@@ -192,10 +197,25 @@ public class ConversationItem extends AbstractFlexibleItem<ConversationItem.Conv
             holder.pinnedConversationImageView.setVisibility(View.GONE);
         }
 
+        if (status != null && status.getStatus().equals(StatusType.DND.getString())) {
+            setOnlineStateIcon(holder, R.drawable.ic_user_status_dnd_with_border);
+        } else if (status != null && status.getIcon() != null && !status.getIcon().isEmpty()) {
+            holder.userStatusOnlineState.setVisibility(View.GONE);
+            holder.userStatusEmoji.setVisibility(View.VISIBLE);
+            holder.userStatusEmoji.setText(status.getIcon());
+        } else if (status != null && status.getStatus().equals(StatusType.AWAY.getString())) {
+            setOnlineStateIcon(holder, R.drawable.ic_user_status_away_with_border);
+        } else if (status != null && status.getStatus().equals(StatusType.ONLINE.getString())) {
+            setOnlineStateIcon(holder, R.drawable.online_status_with_border);
+        } else {
+            holder.userStatusEmoji.setVisibility(View.GONE);
+            holder.userStatusOnlineState.setVisibility(View.GONE);
+        }
+
         if (conversation.getLastMessage() != null) {
             holder.dialogDate.setVisibility(View.VISIBLE);
             holder.dialogDate.setText(DateUtils.getRelativeTimeSpanString(conversation.getLastActivity() * 1000L,
-                    System.currentTimeMillis(), 0, DateUtils.FORMAT_ABBREV_RELATIVE));
+                                                                          System.currentTimeMillis(), 0, DateUtils.FORMAT_ABBREV_RELATIVE));
 
             if (!TextUtils.isEmpty(conversation.getLastMessage().getSystemMessage()) || Conversation.ConversationType.ROOM_SYSTEM.equals(conversation.getType())) {
                 holder.dialogLastMessage.setText(conversation.getLastMessage().getText());
@@ -206,14 +226,14 @@ public class ConversationItem extends AbstractFlexibleItem<ConversationItem.Conv
                 if (conversation.getLastMessage().getMessageType().equals(ChatMessage.MessageType.REGULAR_TEXT_MESSAGE)) {
                     if (conversation.getLastMessage().getActorId().equals(userEntity.getUserId())) {
                         text = String.format(appContext.getString(R.string.nc_formatted_message_you),
-                                conversation.getLastMessage().getLastMessageDisplayText());
+                                             conversation.getLastMessage().getLastMessageDisplayText());
                     } else {
                         authorDisplayName = !TextUtils.isEmpty(conversation.getLastMessage().getActorDisplayName()) ?
-                                conversation.getLastMessage().getActorDisplayName() :
-                                "guests".equals(conversation.getLastMessage().getActorType()) ? appContext.getString(R.string.nc_guest) : "";
+                            conversation.getLastMessage().getActorDisplayName() :
+                            "guests".equals(conversation.getLastMessage().getActorType()) ? appContext.getString(R.string.nc_guest) : "";
                         text = String.format(appContext.getString(R.string.nc_formatted_message),
-                                authorDisplayName,
-                                conversation.getLastMessage().getLastMessageDisplayText());
+                                             authorDisplayName,
+                                             conversation.getLastMessage().getLastMessageDisplayText());
                     }
                 } else {
                     text = conversation.getLastMessage().getLastMessageDisplayText();
@@ -266,22 +286,22 @@ public class ConversationItem extends AbstractFlexibleItem<ConversationItem.Conv
                 case ROOM_TYPE_ONE_TO_ONE_CALL:
                     if (!TextUtils.isEmpty(conversation.getName())) {
                         DraweeController draweeController = Fresco.newDraweeControllerBuilder()
-                                .setOldController(holder.dialogAvatar.getController())
-                                .setAutoPlayAnimations(true)
-                                .setImageRequest(DisplayUtils.getImageRequestForUrl(ApiUtils.getUrlForAvatarWithName(userEntity.getBaseUrl(), conversation.getName(), R.dimen.avatar_size), userEntity))
-                                .build();
+                            .setOldController(holder.dialogAvatar.getController())
+                            .setAutoPlayAnimations(true)
+                            .setImageRequest(DisplayUtils.getImageRequestForUrl(ApiUtils.getUrlForAvatarWithName(userEntity.getBaseUrl(), conversation.getName(), R.dimen.avatar_size), userEntity))
+                            .build();
                         holder.dialogAvatar.setController(draweeController);
                     } else {
                         holder.dialogAvatar.setVisibility(View.GONE);
                     }
                     break;
                 case ROOM_GROUP_CALL:
-                        holder.dialogAvatar.setImageDrawable(ContextCompat.getDrawable(context,
-                                                                                       R.drawable.ic_circular_group));
+                    holder.dialogAvatar.setImageDrawable(ContextCompat.getDrawable(context,
+                                                                                   R.drawable.ic_circular_group));
                     break;
                 case ROOM_PUBLIC_CALL:
-                        holder.dialogAvatar.setImageDrawable(ContextCompat.getDrawable(context,
-                                                                                       R.drawable.ic_circular_link));
+                    holder.dialogAvatar.setImageDrawable(ContextCompat.getDrawable(context,
+                                                                                   R.drawable.ic_circular_link));
                     break;
                 default:
                     holder.dialogAvatar.setVisibility(View.GONE);
@@ -289,10 +309,16 @@ public class ConversationItem extends AbstractFlexibleItem<ConversationItem.Conv
         }
     }
 
+    private void setOnlineStateIcon(ConversationItemViewHolder holder, int icon) {
+        holder.userStatusEmoji.setVisibility(View.GONE);
+        holder.userStatusOnlineState.setVisibility(View.VISIBLE);
+        holder.userStatusOnlineState.setImageDrawable(ContextCompat.getDrawable(context, icon));
+    }
+
     @Override
     public boolean filter(String constraint) {
         return conversation.getDisplayName() != null &&
-                Pattern.compile(constraint, Pattern.CASE_INSENSITIVE | Pattern.LITERAL).matcher(conversation.getDisplayName().trim()).find();
+            Pattern.compile(constraint, Pattern.CASE_INSENSITIVE | Pattern.LITERAL).matcher(conversation.getDisplayName().trim()).find();
     }
 
     @Override
@@ -318,6 +344,11 @@ public class ConversationItem extends AbstractFlexibleItem<ConversationItem.Conv
         Chip dialogUnreadBubble;
         @BindView(R.id.favoriteConversationImageView)
         ImageView pinnedConversationImageView;
+        @BindView(R.id.userStatusEmoji)
+        com.vanniktech.emoji.EmojiEditText userStatusEmoji;
+        @BindView(R.id.userStatusOnlineState)
+        ImageView userStatusOnlineState;
+
 
         ConversationItemViewHolder(View view, FlexibleAdapter adapter) {
             super(view, adapter);

+ 5 - 0
app/src/main/java/com/nextcloud/talk/api/NcApi.java

@@ -41,6 +41,7 @@ import com.nextcloud.talk.models.json.search.ContactsByNumberOverall;
 import com.nextcloud.talk.models.json.signaling.SignalingOverall;
 import com.nextcloud.talk.models.json.signaling.settings.SignalingSettingsOverall;
 import com.nextcloud.talk.models.json.status.StatusOverall;
+import com.nextcloud.talk.models.json.statuses.StatusesOverall;
 import com.nextcloud.talk.models.json.userprofile.UserProfileFieldsOverall;
 import com.nextcloud.talk.models.json.userprofile.UserProfileOverall;
 
@@ -478,4 +479,8 @@ public interface NcApi {
     Observable<GenericOverall> setStatusType(@Header("Authorization") String authorization,
                                                       @Url String url,
                                                       @Field("statusType") String statusType);
+
+    @GET
+    Observable<StatusesOverall> getUserStatuses(@Header("Authorization") String authorization, @Url String url);
+
 }

+ 42 - 3
app/src/main/java/com/nextcloud/talk/controllers/ConversationsListController.java

@@ -81,6 +81,8 @@ import com.nextcloud.talk.jobs.UploadAndShareFilesWorker;
 import com.nextcloud.talk.models.database.CapabilitiesUtil;
 import com.nextcloud.talk.models.database.UserEntity;
 import com.nextcloud.talk.models.json.conversations.Conversation;
+import com.nextcloud.talk.models.json.status.Status;
+import com.nextcloud.talk.models.json.statuses.StatusesOverall;
 import com.nextcloud.talk.ui.dialog.ChooseAccountDialogFragment;
 import com.nextcloud.talk.ui.dialog.ConversationsListBottomDialog;
 import com.nextcloud.talk.utils.ApiUtils;
@@ -128,6 +130,7 @@ import butterknife.BindView;
 import eu.davidea.flexibleadapter.FlexibleAdapter;
 import eu.davidea.flexibleadapter.common.SmoothScrollLinearLayoutManager;
 import eu.davidea.flexibleadapter.items.AbstractFlexibleItem;
+import io.reactivex.Observer;
 import io.reactivex.android.schedulers.AndroidSchedulers;
 import io.reactivex.disposables.Disposable;
 import io.reactivex.schedulers.Schedulers;
@@ -214,6 +217,8 @@ public class ConversationsListController extends BaseController implements Searc
 
     private ConversationsListBottomDialog conversationsListBottomDialog;
 
+    private HashMap<String, Status> userStatuses = new HashMap<>();
+
     public ConversationsListController(Bundle bundle) {
         super();
         setHasOptionsMenu(true);
@@ -467,6 +472,37 @@ public class ConversationsListController extends BaseController implements Searc
 
     @SuppressLint("LongLogTag")
     public void fetchData() {
+        fetchUserStatuses();
+    }
+
+    private void fetchUserStatuses() {
+        ncApi.getUserStatuses(credentials, ApiUtils.getUrlForUserStatuses(currentUser.getBaseUrl()))
+            .subscribe(new Observer<StatusesOverall>() {
+                @Override
+                public void onSubscribe(@io.reactivex.annotations.NonNull Disposable d) {
+                }
+
+                @Override
+                public void onNext(@NonNull StatusesOverall statusesOverall) {
+                    for (Status status : statusesOverall.getOcs().getData()) {
+                        userStatuses.put(status.getUserId(), status);
+                    }
+                    fetchRooms();
+                }
+
+                @Override
+                public void onError(@io.reactivex.annotations.NonNull Throwable e) {
+                    Log.e(TAG, "failed to fetch user statuses", e);
+                }
+
+                @Override
+                public void onComplete() {
+                }
+            });
+
+    }
+
+    private void fetchRooms() {
         dispose(null);
 
         isRefreshing = true;
@@ -525,14 +561,16 @@ public class ConversationsListController extends BaseController implements Searc
                             ConversationItem conversationItem = new ConversationItem(
                                 conversation,
                                 currentUser,
-                                getActivity());
+                                getActivity(),
+                                userStatuses.get(conversation.name));
                             conversationItems.add(conversationItem);
 
                             ConversationItem conversationItemWithHeader = new ConversationItem(
                                 conversation,
                                 currentUser,
                                 getActivity(),
-                                callHeaderItems.get(headerTitle));
+                                callHeaderItems.get(headerTitle),
+                                userStatuses.get(conversation.name));
                             conversationItemsWithHeader.add(conversationItemWithHeader);
                         }
                     }
@@ -604,7 +642,8 @@ public class ConversationsListController extends BaseController implements Searc
                             conversation,
                             currentUser,
                             getActivity(),
-                            callHeaderItems.get(headerTitle));
+                            callHeaderItems.get(headerTitle),
+                            userStatuses.get(conversation.name));
 
                         openConversationItems.add(conversationItem);
                     }

+ 71 - 0
app/src/main/java/com/nextcloud/talk/models/json/statuses/StatusesOCS.java

@@ -0,0 +1,71 @@
+/*
+ *
+ *   Nextcloud Talk application
+ *
+ *   @author Tim Krüger
+ *   Copyright (C) 2021 Tim Krüger <t@timkrueger.me>
+ *
+ *   This program is free software: you can redistribute it and/or modify
+ *   it under the terms of the GNU General Public License as published by
+ *   the Free Software Foundation, either version 3 of the License, or
+ *   at your option) any later version.
+ *
+ *   This program is distributed in the hope that it will be useful,
+ *   but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *   GNU General Public License for more details.
+ *
+ *   You should have received a copy of the GNU General Public License
+ *   along with this program.  If not, see <http://www.gnu.org/licenses/>.
+ */
+package com.nextcloud.talk.models.json.statuses;
+
+import com.bluelinelabs.logansquare.annotation.JsonField;
+import com.bluelinelabs.logansquare.annotation.JsonObject;
+import com.nextcloud.talk.models.json.generic.GenericOCS;
+import com.nextcloud.talk.models.json.status.Status;
+
+import java.util.List;
+import java.util.Objects;
+
+@JsonObject
+public class StatusesOCS extends GenericOCS {
+    @JsonField(name = "data")
+    public List<Status> data;
+
+    public List<Status> getData() {
+        return this.data;
+    }
+
+    public void setData(List<Status> data) {
+        this.data = data;
+    }
+
+    @Override
+    public boolean equals(Object o) {
+        if (this == o) {
+            return true;
+        }
+        if (o == null || getClass() != o.getClass()) {
+            return false;
+        }
+        if (!super.equals(o)) {
+            return false;
+        }
+        StatusesOCS that = (StatusesOCS) o;
+        return Objects.equals(data, that.data);
+    }
+
+    @Override
+    public int hashCode() {
+        return Objects.hash(super.hashCode(), data);
+    }
+
+    @Override
+    public String toString() {
+        return "StatusesOCS{" +
+            "data=" + data +
+            '}';
+    }
+
+}

+ 64 - 0
app/src/main/java/com/nextcloud/talk/models/json/statuses/StatusesOverall.java

@@ -0,0 +1,64 @@
+/*
+ *
+ *   Nextcloud Talk application
+ *
+ *   @author Tim Krüger
+ *   Copyright (C) 2021 Tim Krüger <t@timkrueger.me>
+ *
+ *   This program is free software: you can redistribute it and/or modify
+ *   it under the terms of the GNU General Public License as published by
+ *   the Free Software Foundation, either version 3 of the License, or
+ *   at your option) any later version.
+ *
+ *   This program is distributed in the hope that it will be useful,
+ *   but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *   GNU General Public License for more details.
+ *
+ *   You should have received a copy of the GNU General Public License
+ *   along with this program.  If not, see <http://www.gnu.org/licenses/>.
+ */
+package com.nextcloud.talk.models.json.statuses;
+
+import com.bluelinelabs.logansquare.annotation.JsonField;
+import com.bluelinelabs.logansquare.annotation.JsonObject;
+
+import java.util.Objects;
+
+@JsonObject
+public class StatusesOverall {
+    @JsonField(name = "ocs")
+    public StatusesOCS ocs;
+
+    public StatusesOCS getOcs() {
+        return this.ocs;
+    }
+
+    public void setOcs(StatusesOCS ocs) {
+        this.ocs = ocs;
+    }
+
+    @Override
+    public boolean equals(Object o) {
+        if (this == o) {
+            return true;
+        }
+        if (o == null || getClass() != o.getClass()) {
+            return false;
+        }
+        StatusesOverall that = (StatusesOverall) o;
+        return Objects.equals(ocs, that.ocs);
+    }
+
+    @Override
+    public int hashCode() {
+        return Objects.hash(ocs);
+    }
+
+    @Override
+    public String toString() {
+        return "StatusesOverall{" +
+            "ocs=" + ocs +
+            '}';
+    }
+}

+ 4 - 0
app/src/main/java/com/nextcloud/talk/utils/ApiUtils.java

@@ -440,4 +440,8 @@ public class ApiUtils {
     public static String getUrlForSetCustomStatus(String baseUrl) {
         return baseUrl + ocsApiVersion + "/apps/user_status/api/v1/user_status/message/custom";
     }
+
+    public static String getUrlForUserStatuses(String baseUrl) {
+        return baseUrl + ocsApiVersion + "/apps/user_status/api/v1/statuses";
+    }
 }

+ 43 - 0
app/src/main/res/drawable/ic_user_status_away_with_border.xml

@@ -0,0 +1,43 @@
+<!--
+  Nextcloud Android client application
+
+  @author Tobias Kaminsky
+  Copyright (C) 2020 Tobias Kaminsky
+  Copyright (C) 2020 Nextcloud GmbH
+
+  This program is free software; you can redistribute it and/or
+  modify it under the terms of the GNU AFFERO GENERAL PUBLIC LICENSE
+  License as published by the Free Software Foundation; either
+  version 3 of the License, or any later version.
+
+  This program is distributed in the hope that it will be useful,
+  but WITHOUT ANY WARRANTY; without even the implied warranty of
+  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+  GNU AFFERO GENERAL PUBLIC LICENSE for more details.
+
+  You should have received a copy of the GNU Affero General Public
+  License along with this program.  If not, see <http://www.gnu.org/licenses/>.
+-->
+<vector xmlns:tools="http://schemas.android.com/tools"
+    android:autoMirrored="true"
+    android:height="24dp"
+    android:viewportHeight="24"
+    android:viewportWidth="24"
+    android:width="24dp"
+    xmlns:android="http://schemas.android.com/apk/res/android"
+    tools:ignore="VectorRaster">
+
+    <path
+        android:fillColor="@color/bg_default"
+        android:pathData="m12,2c-5.52,0 -10,4.48 -10,10s4.48,10 10,10 10,-4.48 10,-10 -4.48,-10 -10,-10z"
+        android:strokeWidth="4"
+        android:strokeColor="@color/bg_default"/>
+
+    <path
+        android:fillColor="@color/bg_default"
+        android:pathData="m12,2c-5.52,0 -10,4.48 -10,10s4.48,10 10,10 10,-4.48 10,-10 -4.48,-10 -10,-10z" />
+
+    <path
+        android:fillColor="#f4a331"
+        android:pathData="m10.615,2.1094c-4.8491,0.6811 -8.6152,4.8615 -8.6152,9.8906 0,5.5 4.5,10 10,10 5.0292,0 9.2096,-3.7661 9.8906,-8.6152 -1.4654,1.601 -3.5625,2.6152 -5.8906,2.6152 -4.4,0 -8,-3.6 -8,-8 0,-2.3281 1.0143,-4.4252 2.6152,-5.8906z" />
+</vector>

+ 41 - 0
app/src/main/res/drawable/ic_user_status_dnd_with_border.xml

@@ -0,0 +1,41 @@
+<!--
+  Nextcloud Android client application
+
+  @author Tobias Kaminsky
+  Copyright (C) 2020 Tobias Kaminsky
+  Copyright (C) 2020 Nextcloud GmbH
+
+  This program is free software; you can redistribute it and/or
+  modify it under the terms of the GNU AFFERO GENERAL PUBLIC LICENSE
+  License as published by the Free Software Foundation; either
+  version 3 of the License, or any later version.
+
+  This program is distributed in the hope that it will be useful,
+  but WITHOUT ANY WARRANTY; without even the implied warranty of
+  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+  GNU AFFERO GENERAL PUBLIC LICENSE for more details.
+
+  You should have received a copy of the GNU Affero General Public
+  License along with this program.  If not, see <http://www.gnu.org/licenses/>.
+-->
+<vector xmlns:tools="http://schemas.android.com/tools"
+    android:autoMirrored="true"
+    android:height="24dp"
+    android:viewportHeight="24"
+    android:viewportWidth="24"
+    android:width="24dp"
+    xmlns:android="http://schemas.android.com/apk/res/android"
+    tools:ignore="VectorRaster">
+    <path
+        android:fillColor="#ed484c"
+        android:pathData="m12,2c-5.52,0 -10,4.48 -10,10s4.48,10 10,10 10,-4.48 10,-10 -4.48,-10 -10,-10z"
+        android:strokeWidth="2"
+        android:strokeColor="@color/bg_default"/>
+
+    <path
+        android:fillColor="#fdffff"
+        android:pathData="m8,10h8c1.108,0 2,0.892 2,2s-0.892,2 -2,2h-8c-1.108,0 -2,-0.892 -2,-2s0.892,-2 2,-2z"
+        android:strokeLineCap="round"
+        android:strokeLineJoin="round"
+        android:strokeWidth="2" />
+</vector>

+ 26 - 0
app/src/main/res/drawable/online_status_with_border.xml

@@ -0,0 +1,26 @@
+<?xml version="1.0" encoding="utf-8"?><!--
+    Nextcloud Android client application
+
+    @author Andy Scherzinger
+    Copyright (C) 2019 Andy Scherzinger
+
+    This program is free software: you can redistribute it and/or modify
+    it under the terms of the GNU Affero General Public License as published by
+    the Free Software Foundation, either version 3 of the License, or
+    (at your option) any later version.
+
+    This program is distributed in the hope that it will be useful,
+    but WITHOUT ANY WARRANTY; without even the implied warranty of
+    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+    GNU Affero General Public License for more details.
+
+    You should have received a copy of the GNU Affero General Public License
+    along with this program. If not, see <http://www.gnu.org/licenses/>.
+-->
+<shape xmlns:android="http://schemas.android.com/apk/res/android"
+    android:shape="oval">
+    <solid android:color="#00ff00" />
+
+    <stroke android:width="1.3dp"
+        android:color="@color/bg_default"/>
+</shape>

+ 18 - 0
app/src/main/res/layout/rv_item_conversation_with_last_message.xml

@@ -56,6 +56,24 @@
             app:tint="@color/favorite_icon_tint"
             app:tintMode="src_in" />
 
+        <com.vanniktech.emoji.EmojiEditText
+            android:id="@+id/userStatusEmoji"
+            android:layout_width="wrap_content"
+            android:layout_height="wrap_content"
+            android:layout_gravity="bottom|end"
+            android:background="@color/transparent"
+            android:cursorVisible="false"
+            android:gravity="center"
+            android:text="@string/default_emoji"
+            android:textSize="16sp" />
+
+        <ImageView
+            android:id="@+id/userStatusOnlineState"
+            android:layout_width="16dp"
+            android:layout_height="16dp"
+            android:layout_gravity="bottom|end"
+            android:contentDescription="@null"
+            android:src="@drawable/online_status"/>
     </FrameLayout>
 
     <RelativeLayout

+ 1 - 0
app/src/main/res/values/strings.xml

@@ -457,6 +457,7 @@
     <string name="nc_phone_book_integration_account_not_found">Account not found</string>
 
     <string name="starred">Favorite</string>
+    <string name="user_status">Status</string>
     <string name="encrypted">Encrypted</string>
     <string name="password_protected">Password protected</string>