瀏覽代碼

improve conversation list layout and dark-theme-colors

Signed-off-by: Andy Scherzinger <info@andy-scherzinger.de>
Andy Scherzinger 4 年之前
父節點
當前提交
adac29d756

+ 26 - 6
app/src/main/java/com/nextcloud/talk/adapters/items/ConversationItem.java

@@ -2,6 +2,8 @@
  * Nextcloud Talk application
  *
  * @author Mario Danic
+ * @author Andy Scherzinger
+ * Copyright (C) 2021 Andy Scherzinger <info@andy-scherzinger.de>
  * Copyright (C) 2017-2018 Mario Danic <mario@lovelyhq.com>
  *
  * This program is free software: you can redistribute it and/or modify
@@ -21,6 +23,8 @@
 package com.nextcloud.talk.adapters.items;
 
 import android.content.Context;
+import android.graphics.Color;
+import android.graphics.Typeface;
 import android.graphics.drawable.BitmapDrawable;
 import android.graphics.drawable.Drawable;
 import android.graphics.drawable.LayerDrawable;
@@ -30,14 +34,15 @@ import android.view.View;
 import android.widget.ImageView;
 import android.widget.TextView;
 
+import androidx.core.content.ContextCompat;
 import androidx.emoji.widget.EmojiTextView;
 
 import butterknife.BindView;
 import butterknife.ButterKnife;
-import com.amulyakhare.textdrawable.TextDrawable;
 import com.facebook.drawee.backends.pipeline.Fresco;
 import com.facebook.drawee.interfaces.DraweeController;
 import com.facebook.drawee.view.SimpleDraweeView;
+import com.google.android.material.chip.Chip;
 import com.nextcloud.talk.R;
 import com.nextcloud.talk.application.NextcloudTalkApplication;
 import com.nextcloud.talk.models.database.UserEntity;
@@ -113,17 +118,32 @@ public class ConversationItem extends AbstractFlexibleItem<ConversationItem.Conv
         }
 
         if (conversation.getUnreadMessages() > 0) {
+            holder.dialogName.setTypeface(
+                    holder.dialogName.getTypeface(),
+                    Typeface.BOLD
+            );
+            holder.dialogDate.setTypeface(
+                    holder.dialogDate.getTypeface(),
+                    Typeface.BOLD
+            );
+            holder.dialogLastMessage.setTypeface(
+                    holder.dialogLastMessage.getTypeface(),
+                    Typeface.BOLD
+            );
             holder.dialogUnreadBubble.setVisibility(View.VISIBLE);
-            if (conversation.getUnreadMessages() < 100) {
+            if (conversation.getUnreadMessages() < 1000) {
                 holder.dialogUnreadBubble.setText(Long.toString(conversation.getUnreadMessages()));
             } else {
-                holder.dialogUnreadBubble.setText("99+");
+                holder.dialogUnreadBubble.setText(R.string.tooManyUnreadMessages);
             }
 
             if (conversation.isUnreadMention() || conversation.type == Conversation.ConversationType.ROOM_TYPE_ONE_TO_ONE_CALL) {
-                holder.dialogUnreadBubble.setBackground(context.getDrawable(R.drawable.bubble_circle_unread_mention));
+                holder.dialogUnreadBubble.setChipBackgroundColorResource(R.color.colorPrimary);
+                holder.dialogUnreadBubble.setTextColor(Color.WHITE);
             } else {
-                holder.dialogUnreadBubble.setBackground(context.getDrawable(R.drawable.bubble_circle_unread));
+                holder.dialogUnreadBubble.setChipBackgroundColorResource(R.color.conversation_unread_bubble);
+                holder.dialogUnreadBubble.setTextColor(
+                        ContextCompat.getColor(context, R.color.conversation_unread_bubble_text));
             }
         } else {
             holder.dialogUnreadBubble.setVisibility(View.GONE);
@@ -254,7 +274,7 @@ public class ConversationItem extends AbstractFlexibleItem<ConversationItem.Conv
         @BindView(R.id.dialogLastMessage)
         EmojiTextView dialogLastMessage;
         @BindView(R.id.dialogUnreadBubble)
-        TextView dialogUnreadBubble;
+        Chip dialogUnreadBubble;
         @BindView(R.id.passwordProtectedRoomImageView)
         ImageView passwordProtectedRoomImageView;
         @BindView(R.id.favoriteConversationImageView)

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

@@ -2,6 +2,8 @@
   ~ Nextcloud Talk application
   ~
   ~ @author Mario Danic
+  ~ @author Andy Scherzinger
+  ~ Copyright (C) 2021 Andy Scherzinger <info@andy-scherzinger.de>
   ~ Copyright (C) 2017-2018 Mario Danic <mario@lovelyhq.com>
   ~
   ~ This program is free software: you can redistribute it and/or modify
@@ -46,17 +48,19 @@
 
             <ImageView
                 android:id="@+id/passwordProtectedRoomImageView"
-                android:layout_width="@dimen/margin_between_elements"
-                android:layout_height="@dimen/margin_between_elements"
+                android:layout_width="16dp"
+                android:layout_height="16dp"
                 android:layout_gravity="bottom|end"
                 android:background="@drawable/shape_lock_bubble" />
 
             <ImageView
                 android:id="@+id/favoriteConversationImageView"
-                android:layout_width="@dimen/margin_between_elements"
-                android:layout_height="@dimen/margin_between_elements"
+                android:layout_width="16dp"
+                android:layout_height="16dp"
                 android:layout_gravity="top|end"
-                android:background="@drawable/shape_favorite_bubble" />
+                android:src="@drawable/ic_star_black_24dp"
+                app:tint="@color/favorite_icon_tint"
+                app:tintMode="src_in"/>
 
         </FrameLayout>
 
@@ -64,7 +68,7 @@
             android:layout_width="match_parent"
             android:layout_height="wrap_content"
             android:layout_below="@id/dialogName"
-            android:layout_marginTop="8dp"
+            android:layout_marginTop="6dp"
             android:layout_toEndOf="@id/dialogAvatarFrameLayout">
 
             <androidx.emoji.widget.EmojiTextView
@@ -73,28 +77,31 @@
                 android:layout_height="wrap_content"
                 android:layout_centerVertical="true"
                 android:layout_toStartOf="@id/dialogUnreadBubble"
-                android:layout_toEndOf="@id/dialogLastMessageUserAvatar"
                 android:ellipsize="end"
                 android:gravity="top"
                 android:lines="1"
                 android:singleLine="true"
                 android:textColor="@color/textColorMaxContrast"
+                android:textSize="14sp"
                 tools:text="This is the last message\nof an incredibly long two line  conversation text" />
 
-            <TextView
-                android:id="@id/dialogUnreadBubble"
+            <com.google.android.material.chip.Chip
+                android:id="@+id/dialogUnreadBubble"
+                style="@style/Widget.MaterialComponents.Chip.Choice"
                 android:layout_width="wrap_content"
-                android:layout_height="wrap_content"
+                android:layout_height="18dp"
                 android:layout_alignParentEnd="true"
                 android:layout_marginStart="8dp"
-                android:background="@drawable/bubble_circle_unread"
-                android:gravity="center"
+                android:gravity="top"
                 android:lines="1"
-                android:textAlignment="center"
-                android:textColor="@color/conversation_unread_bubble"
-                android:textSize="12sp"
-                tools:background="@drawable/bubble_circle_unread"
-                tools:text="99+" />
+                android:textAppearance="@style/ChipUnreadMessagesTextAppearance"
+                android:textColor="@color/conversation_unread_bubble_text"
+                app:chipBackgroundColor="@color/conversation_unread_bubble"
+                app:chipEndPadding="-1dp"
+                app:chipMinTouchTargetSize="0dp"
+                app:chipStartPadding="-3dp"
+                app:ensureMinTouchTargetSize="false"
+                tools:text="999+" />
 
         </RelativeLayout>
 
@@ -103,9 +110,12 @@
             android:layout_width="wrap_content"
             android:layout_height="wrap_content"
             android:layout_alignParentEnd="true"
+            android:layout_marginTop="2dp"
             android:ellipsize="end"
             android:maxLines="1"
-            android:textColor="@color/textColorMaxContrast" />
+            android:textSize="14sp"
+            android:textColor="@color/textColorMaxContrast"
+            tools:text="yesterday"/>
 
         <androidx.emoji.widget.EmojiTextView
             android:id="@id/dialogName"
@@ -114,6 +124,7 @@
             android:layout_alignTop="@id/dialogAvatarFrameLayout"
             android:layout_toStartOf="@id/dialogDate"
             android:layout_toEndOf="@id/dialogAvatarFrameLayout"
+            android:layout_marginTop="2dp"
             android:ellipsize="end"
             android:includeFontPadding="false"
             android:maxLines="1"

+ 11 - 6
app/src/main/res/values-night/colors.xml

@@ -2,10 +2,12 @@
 <!--
   ~ Nextcloud Talk application
   ~
-  ~ @author Mario Danic
-  ~ Copyright (C) 2017-2019 Mario Danic <mario@lovelyhq.com>
+  ~ @author Andy Scherzinger
   ~ @author Daniel Bailey
+  ~ @author Mario Danic
+  ~ Copyright (C) 2021 Andy Scherzinger <info@andy-scherzinger.de>
   ~ Copyright (C) 2019 Daniel Bailey <db@grappleIT.co.uk>
+  ~ Copyright (C) 2017-2019 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
@@ -22,16 +24,19 @@
   -->
 
 <resources>
-    <color name="conversation_item_header">#ffffff</color>
+    <color name="conversation_item_header">#deffffff</color>
 
-    <color name="bg_default">#222222</color>
-    <color name="bg_alt">#222222</color>
+    <color name="bg_default">#121212</color>
+    <color name="bg_alt">#121212</color>
     <color name="nc_darkGreen">#00AA00</color>
 
+    <color name="conversation_unread_bubble">#373737</color>
+    <color name="conversation_unread_bubble_text">#D8D8D8</color>
+
     <!-- Chat window incoming message text & informational -->
     <color name="nc_incoming_text_default">#D8D8D8</color>
     <color name="nc_grey">@android:color/holo_purple</color>
-    <color name="bg_bottom_sheet">#222222</color>
+    <color name="bg_bottom_sheet">#121212</color>
     <color name="bg_message_list_incoming_bubble">#484848</color>
     <color name="bg_message_list_incoming_bubble_deleted">#66484848</color>
 

+ 5 - 2
app/src/main/res/values/colors.xml

@@ -3,6 +3,8 @@
   ~ Nextcloud Talk application
   ~
   ~ @author Mario Danic
+  ~ @author Andy Scherzinger
+  ~ Copyright (C) 2021 Andy Scherzinger <info@andy-scherzinger.de>
   ~ Copyright (C) 2017-2019 Mario Danic <mario@lovelyhq.com>
   ~
   ~ This program is free software: you can redistribute it and/or modify
@@ -30,7 +32,8 @@
 
     <!-- Name of person or group for the chat conversation -->
     <color name="conversation_item_header">#000000</color>
-    <color name="conversation_unread_bubble">#FFFFFF</color>
+    <color name="conversation_unread_bubble">#DBDBDB</color>
+    <color name="conversation_unread_bubble_text">#222222</color>
 
     <color name="nc_darkRed">#D32F2F</color>
     <color name="nc_darkGreen">#006400</color>
@@ -59,5 +62,5 @@
     <color name="bg_bottom_sheet">#46ffffff</color>
 
     <color name="call_buttons_background">#BF999999</color>
-
+    <color name="favorite_icon_tint">#FFCC00</color>
 </resources>

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

@@ -2,6 +2,8 @@
   ~ Nextcloud Talk application
   ~
   ~ @author Mario Danic
+  ~ @author Andy Scherzinger
+  ~ Copyright (C) 2021 Andy Scherzinger <info@andy-scherzinger.de>
   ~ Copyright (C) 2017-2018 Mario Danic <mario@lovelyhq.com>
   ~
   ~ This program is free software: you can redistribute it and/or modify
@@ -356,4 +358,5 @@
     <!-- Non-translatable strings -->
     <string name="path_password_strike_through" translatable="false"
         tools:override="true">M3.27,4.27L19.74,20.74</string>
+    <string name="tooManyUnreadMessages" translatable="false">999+</string>
 </resources>

+ 8 - 0
app/src/main/res/values/styles.xml

@@ -2,6 +2,8 @@
   ~ Nextcloud Talk application
   ~
   ~ @author Mario Danic
+  ~ @author Andy Scherzinger
+  ~ Copyright (C) 2021 Andy Scherzinger <info@andy-scherzinger.de>
   ~ Copyright (C) 2017-2019 Mario Danic <mario@lovelyhq.com>
   ~
   ~ This program is free software: you can redistribute it and/or modify
@@ -26,6 +28,7 @@
         <item name="colorPrimary">@color/colorPrimary</item>
         <item name="colorPrimaryDark">@color/colorPrimary</item>
         <item name="colorAccent">@color/colorPrimary</item>
+        <item name="android:windowBackground">@color/bg_default</item>
         <item name="android:panelFullBackground">@color/colorPrimary</item>
         <item name="android:itemBackground">@color/nc_outcoming_text_default</item>
         <item name="android:textColor">@color/nc_incoming_text_default</item>
@@ -55,6 +58,11 @@
         <item name="android:textColor">@color/colorPrimary</item>
     </style>
 
+    <style name="ChipUnreadMessagesTextAppearance" parent="TextAppearance.MaterialComponents.Chip">
+        <item name="android:textSize">14sp</item>
+        <item name="android:textStyle">bold</item>
+    </style>
+
     <style name="appActionBarStyle" parent="@style/Widget.MaterialComponents.ActionBar.Solid">
         <item name="android:colorPrimary">@color/fg_inverse</item>
         <item name="android:textColor">@color/fg_inverse</item>