Просмотр исходного кода

Stuff with removing online presence

Signed-off-by: Mario Danic <mario@lovelyhq.com>
Mario Danic 6 лет назад
Родитель
Сommit
1961947b91

+ 0 - 17
app/src/main/java/com/nextcloud/talk/adapters/items/ConversationItem.java

@@ -206,18 +206,6 @@ public class ConversationItem extends AbstractFlexibleItem<ConversationItem.Conv
 
         switch (conversation.getType()) {
             case ROOM_TYPE_ONE_TO_ONE_CALL:
-                holder.onlineIndicator.setVisibility(View.VISIBLE);
-
-                if (conversation.getCount() > 0) {
-                    if (conversation.getCount() == 2 || (conversation.getCount() == 1 &&
-                            conversation.getSessionId().equals("0"))) {
-                        holder.onlineIndicator.setBackground(context.getDrawable(R.drawable.shape_bubble_online));
-                    } else {
-                        holder.onlineIndicator.setBackground(context.getDrawable(R.drawable.shape_bubble_offline));
-                    }
-                } else {
-                    holder.onlineIndicator.setBackground(context.getDrawable(R.drawable.shape_bubble_offline));
-                }
 
                 if (!TextUtils.isEmpty(conversation.getName())) {
                     GlideUrl glideUrl = new GlideUrl(ApiUtils.getUrlForAvatarWithName(userEntity.getBaseUrl(),
@@ -240,7 +228,6 @@ public class ConversationItem extends AbstractFlexibleItem<ConversationItem.Conv
                 }
                 break;
             case ROOM_GROUP_CALL:
-                holder.onlineIndicator.setVisibility(View.GONE);
 
                 GlideApp.with(context)
                         .asBitmap()
@@ -252,7 +239,6 @@ public class ConversationItem extends AbstractFlexibleItem<ConversationItem.Conv
                         .into(holder.dialogAvatar);
                 break;
             case ROOM_PUBLIC_CALL:
-                holder.onlineIndicator.setVisibility(View.GONE);
                 GlideApp.with(context)
                         .asBitmap()
                         .diskCacheStrategy(DiskCacheStrategy.NONE)
@@ -264,7 +250,6 @@ public class ConversationItem extends AbstractFlexibleItem<ConversationItem.Conv
 
                 break;
             default:
-                holder.onlineIndicator.setVisibility(View.GONE);
                 holder.dialogAvatar.setVisibility(View.GONE);
         }
 
@@ -290,8 +275,6 @@ public class ConversationItem extends AbstractFlexibleItem<ConversationItem.Conv
         TextView dialogLastMessage;
         @BindView(R.id.dialogUnreadBubble)
         TextView dialogUnreadBubble;
-        @BindView(R.id.onlineIndicator)
-        ImageView onlineIndicator;
         @BindView(R.id.passwordProtectedRoomImageView)
         ImageView passwordProtectedRoomImageView;
         @BindView(R.id.favoriteConversationImageView)

+ 1 - 1
app/src/main/java/com/nextcloud/talk/controllers/CallNotificationController.java

@@ -450,7 +450,7 @@ public class CallNotificationController extends BaseController {
                                             hsv[2] *= 0.75f;
                                             color = Color.HSVToColor(hsv);
                                         }
-                                        
+
                                         constraintLayout.setBackgroundColor(color);
                                     }
                                 }

+ 0 - 13
app/src/main/res/drawable/shape_bubble_offline.xml

@@ -1,13 +0,0 @@
-<shape xmlns:android="http://schemas.android.com/apk/res/android"
-       android:shape="oval">
-
-    <solid android:color="#AAAAAA"/>
-
-    <stroke
-        android:width="2dp"
-        android:color="@color/white"/>
-
-    <size
-        android:width="20dp"
-        android:height="20dp"/>
-</shape>

+ 0 - 13
app/src/main/res/drawable/shape_bubble_online.xml

@@ -1,13 +0,0 @@
-<shape xmlns:android="http://schemas.android.com/apk/res/android"
-       android:shape="oval">
-
-    <solid android:color="#38C059"/>
-
-    <stroke
-        android:width="2dp"
-        android:color="@color/white"/>
-
-    <size
-        android:width="20dp"
-        android:height="20dp"/>
-</shape>

+ 30 - 0
app/src/main/res/drawable/shape_favorite_bubble.xml

@@ -0,0 +1,30 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+  ~ Nextcloud Talk application
+  ~
+  ~ @author Mario Danic
+  ~ Copyright (C) 2017-2018 Mario Danic <mario@lovelyhq.com>
+  ~
+  ~ 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/>.
+  -->
+
+<layer-list xmlns:android="http://schemas.android.com/apk/res/android">
+    <item>
+        <shape
+            android:shape="oval">
+            <solid android:color="@color/white"/>
+        </shape>
+    </item>
+    <item android:drawable="@drawable/ic_star_grey600_24dp"/>
+</layer-list>

+ 30 - 0
app/src/main/res/drawable/shape_lock_bubble.xml

@@ -0,0 +1,30 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+  ~ Nextcloud Talk application
+  ~
+  ~ @author Mario Danic
+  ~ Copyright (C) 2017-2018 Mario Danic <mario@lovelyhq.com>
+  ~
+  ~ 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/>.
+  -->
+
+<layer-list xmlns:android="http://schemas.android.com/apk/res/android">
+    <item>
+        <shape
+            android:shape="oval">
+            <solid android:color="@color/white"/>
+        </shape>
+    </item>
+    <item android:drawable="@drawable/ic_lock_grey600_24px"/>
+</layer-list>

+ 22 - 45
app/src/main/res/layout/rv_item_conversation_with_last_message.xml

@@ -34,10 +34,10 @@
         android:layout_margin="16dp">
 
         <FrameLayout
+            android:id="@+id/dialogAvatarFrameLayout"
             android:layout_width="@dimen/avatar_size"
             android:layout_height="@dimen/avatar_size"
-            android:layout_centerVertical="true"
-            android:id="@+id/dialogAvatarFrameLayout">
+            android:layout_centerVertical="true">
 
             <ImageView
                 android:id="@id/dialogAvatar"
@@ -45,28 +45,33 @@
                 android:layout_height="@dimen/avatar_size"/>
 
             <ImageView
-                android:id="@+id/onlineIndicator"
+                android:id="@+id/passwordProtectedRoomImageView"
                 android:layout_width="12dp"
                 android:layout_height="12dp"
-                android:layout_gravity="top|end"
-                android:background="@drawable/shape_bubble_online"
-                />
+                android:layout_gravity="bottom|end"
+                android:background="@drawable/shape_lock_bubble"/>
 
+            <ImageView
+                android:id="@+id/favoriteConversationImageView"
+                android:layout_width="12dp"
+                android:layout_height="12dp"
+                android:layout_gravity="top|end"
+                android:background="@drawable/shape_favorite_bubble"/>
         </FrameLayout>
 
         <TextView
             android:id="@id/dialogName"
             android:layout_width="match_parent"
             android:layout_height="wrap_content"
-            android:textColor="@color/nc_incoming_text_default"
-            android:textSize="16sp"
             android:layout_alignTop="@id/dialogAvatarFrameLayout"
             android:layout_marginStart="8dp"
             android:layout_toEndOf="@id/dialogAvatarFrameLayout"
             android:layout_toStartOf="@id/dialogDate"
             android:ellipsize="end"
             android:includeFontPadding="false"
-            android:maxLines="1"/>
+            android:maxLines="1"
+            android:textColor="@color/nc_incoming_text_default"
+            android:textSize="16sp"/>
 
         <TextView
             android:id="@id/dialogDate"
@@ -74,8 +79,8 @@
             android:layout_height="wrap_content"
             android:layout_alignParentEnd="true"
             android:ellipsize="end"
-            android:textColor="@color/warm_grey_two"
-            android:maxLines="1"/>
+            android:maxLines="1"
+            android:textColor="@color/warm_grey_two"/>
 
         <RelativeLayout
             android:id="@+id/dialogLastMessageLayout"
@@ -90,8 +95,8 @@
                 android:id="@id/dialogLastMessageUserAvatar"
                 android:layout_width="@dimen/small_item_height"
                 android:layout_height="@dimen/small_item_height"
-                android:layout_marginEnd="8dp"
-                android:layout_centerVertical="true"/>
+                android:layout_centerVertical="true"
+                android:layout_marginEnd="8dp"/>
 
             <TextView
                 android:id="@id/dialogLastMessage"
@@ -100,54 +105,26 @@
                 android:layout_centerVertical="true"
                 android:layout_toEndOf="@id/dialogLastMessageUserAvatar"
                 android:layout_toStartOf="@id/dialogUnreadBubble"
-                android:textColor="@color/warm_grey_four"
                 android:ellipsize="end"
                 android:gravity="top"
+                android:maxLines="2"
                 android:singleLine="false"
-                android:maxLines="2"/>
+                android:textColor="@color/warm_grey_four"/>
 
             <TextView
                 android:id="@id/dialogUnreadBubble"
                 android:layout_width="wrap_content"
                 android:layout_height="wrap_content"
-                android:layout_centerVertical="true"
                 android:layout_alignParentEnd="true"
+                android:layout_centerVertical="true"
                 android:layout_marginStart="8dp"
                 android:background="@drawable/bubble_circle_unread"
                 android:gravity="center"
-                android:textAlignment="center"
                 android:lines="1"
+                android:textAlignment="center"
                 android:textColor="@color/white"/>
 
         </RelativeLayout>
 
     </RelativeLayout>
-
-    <RelativeLayout
-        android:layout_width="wrap_content"
-        android:layout_height="wrap_content"
-        android:layout_alignParentEnd="true"
-        android:layout_alignParentBottom="true"
-        android:layout_marginEnd="8dp">
-
-        <ImageView
-            android:id="@+id/passwordProtectedRoomImageView"
-            android:layout_width="12dp"
-            android:layout_height="12dp"
-            android:layout_marginBottom="4dp"
-            android:layout_toStartOf="@id/favoriteConversationImageView"
-            android:src="@drawable/ic_lock_grey600_24px"
-            android:visibility="visible"/>
-
-        <ImageView
-            android:id="@+id/favoriteConversationImageView"
-            android:layout_width="12dp"
-            android:layout_height="12dp"
-            android:layout_marginBottom="4dp"
-            android:layout_alignParentEnd="true"
-            android:src="@drawable/ic_star_grey600_24dp"
-            android:visibility="visible"/>
-
-    </RelativeLayout>
-
 </RelativeLayout>