Merge pull request #1133 from nextcloud/chatInputSeparator

Optimize chat input separator for dark theme + message quote optimizations
This commit is contained in:
Marcel Hibbe 2021-04-19 11:05:56 +02:00 committed by GitHub
commit b970b20151
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
13 changed files with 88 additions and 96 deletions

View file

@ -78,10 +78,6 @@ class MagicIncomingTextMessageViewHolder(incomingView: View) : MessageHolders
@BindView(R.id.quotedChatMessageView)
var quotedChatMessageView: RelativeLayout? = null
@JvmField
@BindView(R.id.quotedUserAvatar)
var quotedUserAvatar: ImageView? = null
@JvmField
@BindView(R.id.quotedMessageAuthor)
var quotedUserName: EmojiTextView? = null
@ -94,10 +90,6 @@ class MagicIncomingTextMessageViewHolder(incomingView: View) : MessageHolders
@BindView(R.id.quotedMessage)
var quotedMessage: EmojiTextView? = null
@JvmField
@BindView(R.id.quotedMessageTime)
var quotedMessageTime: TextView? = null
@JvmField
@BindView(R.id.quoteColoredView)
var quoteColoredView: View? = null
@ -236,10 +228,6 @@ class MagicIncomingTextMessageViewHolder(incomingView: View) : MessageHolders
if (!message.isDeleted && message.parentMessage != null) {
var parentChatMessage = message.parentMessage
parentChatMessage.activeUser = message.activeUser
quotedUserAvatar?.load(parentChatMessage.user.avatar) {
addHeader("Authorization", ApiUtils.getCredentials(message.activeUser.username, message.activeUser.token))
transformations(CircleCropTransformation())
}
parentChatMessage.imageUrl?.let {
quotedMessagePreview?.visibility = View.VISIBLE
quotedMessagePreview?.load(it) {
@ -254,9 +242,12 @@ class MagicIncomingTextMessageViewHolder(incomingView: View) : MessageHolders
quotedUserName?.setTextColor(context!!.resources.getColor(R.color.textColorMaxContrast))
quotedMessageTime?.text = DateFormatter.format(parentChatMessage.createdAt, DateFormatter.Template.TIME)
quotedMessageTime?.setTextColor(context!!.resources.getColor(R.color.warm_grey_four))
if(parentChatMessage.actorId?.equals(message.activeUser.userId) == true) {
quoteColoredView?.setBackgroundResource(R.color.colorPrimary)
} else {
quoteColoredView?.setBackgroundResource(R.color.textColorMaxContrast)
}
quotedChatMessageView?.visibility = View.VISIBLE
} else {
quotedChatMessageView?.visibility = View.GONE

View file

@ -65,10 +65,6 @@ class MagicOutcomingTextMessageViewHolder(itemView: View) : OutcomingTextMessage
@BindView(R.id.quotedChatMessageView)
var quotedChatMessageView: RelativeLayout? = null
@JvmField
@BindView(R.id.quotedUserAvatar)
var quotedUserAvatar: ImageView? = null
@JvmField
@BindView(R.id.quotedMessageAuthor)
var quotedUserName: EmojiTextView? = null
@ -81,10 +77,6 @@ class MagicOutcomingTextMessageViewHolder(itemView: View) : OutcomingTextMessage
@BindView(R.id.quotedMessage)
var quotedMessage: EmojiTextView? = null
@JvmField
@BindView(R.id.quotedMessageTime)
var quotedMessageTime: TextView? = null
@JvmField
@BindView(R.id.quoteColoredView)
var quoteColoredView: View? = null
@ -165,10 +157,6 @@ class MagicOutcomingTextMessageViewHolder(itemView: View) : OutcomingTextMessage
if (!message.isDeleted && message.parentMessage != null) {
var parentChatMessage = message.parentMessage
parentChatMessage.activeUser = message.activeUser
quotedUserAvatar?.load(parentChatMessage.user.avatar) {
transformations(CircleCropTransformation())
addHeader("Authorization", ApiUtils.getCredentials(message.activeUser.username, message.activeUser.token))
}
parentChatMessage.imageUrl?.let {
quotedMessagePreview?.visibility = View.VISIBLE
quotedMessagePreview?.load(it) {
@ -183,8 +171,6 @@ class MagicOutcomingTextMessageViewHolder(itemView: View) : OutcomingTextMessage
quotedMessage?.setTextColor(context!!.resources.getColor(R.color.nc_outcoming_text_default))
quotedUserName?.setTextColor(context!!.resources.getColor(R.color.nc_grey))
quotedMessageTime?.text = DateFormatter.format(parentChatMessage.createdAt, DateFormatter.Template.TIME)
quotedMessageTime?.setTextColor(context!!.resources.getColor(R.color.white60))
quoteColoredView?.setBackgroundResource(R.color.white)
quotedChatMessageView?.visibility = View.VISIBLE

View file

@ -1459,17 +1459,11 @@ class ChatController(args: Bundle) : BaseController(args), MessagesListAdapter
messageInputView?.findViewById<EmojiTextView>(R.id.quotedMessage)?.maxLines = 2
messageInputView?.findViewById<EmojiTextView>(R.id.quotedMessage)?.ellipsize = TextUtils.TruncateAt.END
messageInputView?.findViewById<EmojiTextView>(R.id.quotedMessage)?.text = it.text
messageInputView?.findViewById<TextView>(R.id.quotedMessageTime)?.text = DateFormatter.format(it.createdAt, DateFormatter.Template.TIME)
messageInputView?.findViewById<EmojiTextView>(R.id.quotedMessageAuthor)?.text = it.actorDisplayName
?: context!!.getText(R.string.nc_nick_guest)
conversationUser?.let { currentUser ->
messageInputView?.findViewById<ImageView>(R.id.quotedUserAvatar)?.load(it.user.avatar) {
addHeader("Authorization", credentials!!)
transformations(CircleCropTransformation())
}
chatMessage.imageUrl?.let { previewImageUrl ->
messageInputView?.findViewById<ImageView>(R.id.quotedMessageImage)?.visibility = View.VISIBLE

View file

@ -66,8 +66,6 @@
android:layout_width="match_parent"
android:layout_height="1dp"
android:layout_above="@+id/messageInputView"
android:layout_marginLeft="16dp"
android:layout_marginRight="16dp"
android:background="@color/controller_chat_separator" />
<com.stfalcon.chatkit.messages.MessageInput
@ -132,6 +130,7 @@
android:layout_above="@+id/separator"
android:layout_centerHorizontal="true"
android:layout_margin="16dp"
android:paddingStart="0dp"
android:paddingEnd="8dp"
app:pb_backgroundColor="@color/colorPrimary"
app:pb_icon="@drawable/ic_baseline_arrow_downward_24px"

View file

@ -65,7 +65,6 @@
<androidx.appcompat.widget.AppCompatTextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:paddingStart="@dimen/standard_half_padding"
android:text="@string/scope_private_description"
android:textColor="@color/textColorMaxContrast"
android:textSize="14sp" />

View file

@ -1,4 +1,25 @@
<?xml version="1.0" encoding="utf-8"?>
<?xml version="1.0" encoding="utf-8"?><!--
~ Nextcloud Talk application
~
~ @author Mario Danic
~ @author Andy Scherzinger
~ Copyright (C) 2021 Andy Scherzinger <info@andy-scherzinger.de>
~ Copyright (C) 2020 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/>.
-->
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
@ -14,36 +35,27 @@
android:layout_alignBottom="@id/flexboxQuoted"
android:layout_alignParentStart="true"
android:layout_marginEnd="4dp"
android:background="@color/colorPrimary"></View>
<ImageView
android:id="@+id/quotedUserAvatar"
android:layout_width="16dp"
android:layout_height="16dp"
android:layout_alignParentTop="true"
android:layout_marginEnd="4dp"
android:layout_toEndOf="@id/quoteColoredView"
tools:src="@tools:sample/avatars[0]" />
android:background="@color/colorPrimary" />
<androidx.emoji.widget.EmojiTextView
android:id="@+id/quotedMessageAuthor"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignBottom="@id/quotedUserAvatar"
android:layout_alignParentTop="true"
android:layout_marginEnd="8dp"
android:layout_toEndOf="@id/quotedUserAvatar"
android:layout_toEndOf="@id/quoteColoredView"
android:ellipsize="end"
android:textSize="12sp"
tools:text="Mario" />
tools:text="Jane Doe" />
<com.google.android.flexbox.FlexboxLayout
android:id="@+id/flexboxQuoted"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="@id/quotedUserAvatar"
android:layout_alignStart="@id/quotedUserAvatar"
android:layout_toStartOf="@id/cancelReplyButton"
android:layout_below="@id/quotedMessageAuthor"
android:layout_alignStart="@id/quotedMessageAuthor"
android:layout_marginTop="4dp"
android:layout_toStartOf="@id/cancelReplyButton"
android:orientation="vertical"
app:alignContent="stretch"
app:alignItems="stretch"
@ -55,6 +67,7 @@
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:adjustViewBounds="true"
android:contentDescription="@null"
android:scaleType="fitCenter"
app:layout_alignSelf="flex_start"
app:layout_flexGrow="1"
@ -66,7 +79,7 @@
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="@id/quotedMessageImage"
android:layout_alignStart="@id/quotedUserAvatar"
android:layout_alignStart="@id/quotedMessageAuthor"
android:lineSpacingMultiplier="1.2"
android:textSize="14sp"
app:layout_alignSelf="flex_start"
@ -74,27 +87,20 @@
app:layout_wrapBefore="true"
tools:text="Hello, this is me!" />
<TextView
android:id="@+id/quotedMessageTime"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="8dp"
android:textSize="12sp"
app:layout_alignSelf="center"
tools:text="16:08" />
</com.google.android.flexbox.FlexboxLayout>
<ImageButton
android:id="@+id/cancelReplyButton"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:visibility="gone"
android:layout_alignParentEnd="true"
android:layout_centerVertical="true"
android:layout_marginStart="8dp"
android:layout_marginEnd="8dp"
android:layout_centerVertical="true"
android:layout_alignParentEnd="true"
android:background="@drawable/ic_cancel_black_24dp"
android:backgroundTint="@color/grey_600"
android:id="@+id/cancelReplyButton"/>
android:contentDescription="@string/nc_message_quote_cancel_reply"
android:visibility="gone"
tools:visibility="visible" />
</RelativeLayout>

View file

@ -19,9 +19,10 @@
-->
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="wrap_content"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_margin="@dimen/double_margin_between_elements"
android:background="@color/bg_default">
@ -38,17 +39,18 @@
<ImageView
android:id="@+id/fileFavoriteImageView"
android:layout_width="8dp"
android:layout_height="8dp"
android:layout_width="16dp"
android:layout_height="16dp"
android:layout_below="@id/file_icon"
android:layout_alignEnd="@id/file_icon"
android:contentDescription="@string/starred"
android:src="@drawable/ic_star_black_24dp"
app:tint="@color/grey_600" />
app:tint="@color/favorite_icon_tint" />
<ImageView
android:id="@+id/fileEncryptedImageView"
android:layout_width="8dp"
android:layout_height="8dp"
android:layout_width="16dp"
android:layout_height="16dp"
android:layout_below="@id/file_icon"
android:layout_alignStart="@+id/file_icon"
android:src="@drawable/ic_lock_grey600_24px" />
@ -66,7 +68,9 @@
android:marqueeRepeatLimit="1"
android:paddingBottom="6dp"
android:singleLine="true"
android:textSize="12sp" />
android:textColor="@color/textColorMaxContrast"
android:textSize="12sp"
tools:text="3 minutes ago" />
<TextView
android:id="@+id/filename_text_view"
@ -80,7 +84,9 @@
android:marqueeRepeatLimit="1"
android:paddingTop="6dp"
android:singleLine="true"
android:textSize="16sp" />
android:textColor="@color/conversation_item_header"
android:textSize="@dimen/two_line_primary_text_size"
tools:text="filename.md" />
<com.facebook.drawee.view.SimpleDraweeView
android:id="@+id/file_icon"

View file

@ -21,33 +21,32 @@
-->
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="72dp"
android:layout_height="wrap_content"
android:layout_margin="@dimen/standard_margin">
<FrameLayout
android:id="@+id/frame_layout"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_width="@dimen/small_item_height"
android:layout_height="@dimen/small_item_height"
android:layout_centerVertical="true"
android:layout_marginEnd="@dimen/margin_between_elements">
<ImageView
android:id="@+id/password_protected_image_view"
android:layout_width="10dp"
android:layout_height="10dp"
android:layout_width="16dp"
android:layout_height="16dp"
android:layout_gravity="bottom|end"
android:layout_marginEnd="6dp"
android:layout_marginBottom="6dp"
android:contentDescription="@string/password_protected"
android:src="@drawable/ic_lock_white_24px"
android:visibility="visible" />
<com.facebook.drawee.view.SimpleDraweeView xmlns:app="http://schemas.android.com/apk/res-auto"
<com.facebook.drawee.view.SimpleDraweeView
android:id="@+id/avatar_image"
android:layout_width="@dimen/small_item_height"
android:layout_height="@dimen/small_item_height"
android:layout_margin="@dimen/margin_between_elements"
app:roundAsCircle="true" />
</FrameLayout>
@ -55,7 +54,7 @@
<ImageButton
android:id="@+id/more_menu"
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:layout_height="@dimen/small_item_height"
android:layout_alignParentEnd="true"
android:layout_centerVertical="true"
android:layout_marginStart="@dimen/standard_margin"
@ -78,7 +77,8 @@
android:layout_height="wrap_content"
android:ellipsize="middle"
android:singleLine="true"
android:textAppearance="?android:attr/textAppearanceListItem"
android:textColor="@color/conversation_item_header"
android:textSize="@dimen/two_line_primary_text_size"
tools:text="Call item text" />
<androidx.emoji.widget.EmojiTextView
@ -86,7 +86,8 @@
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:singleLine="true"
android:textColor="?android:attr/textColorSecondary"
android:textColor="@color/textColorMaxContrast"
android:textSize="14sp"
tools:text="A week ago" />
</LinearLayout>

View file

@ -38,7 +38,8 @@
android:layout_height="12dp"
android:layout_gravity="bottom|end"
android:background="@drawable/shape_lock_bubble"
android:visibility="gone" />
android:visibility="gone"
tools:visibility="visible" />
<ImageView
android:id="@+id/videoCallImageView"
@ -46,7 +47,8 @@
android:layout_height="12dp"
android:layout_gravity="top|end"
android:background="@drawable/shape_favorite_bubble"
android:visibility="gone" />
android:visibility="gone"
tools:visibility="visible" />
<com.facebook.drawee.view.SimpleDraweeView
android:id="@+id/simple_drawee_view"

View file

@ -51,16 +51,18 @@
android:layout_width="16dp"
android:layout_height="16dp"
android:layout_gravity="bottom|end"
android:background="@drawable/shape_lock_bubble" />
android:background="@drawable/shape_lock_bubble"
android:contentDescription="@string/password_protected" />
<ImageView
android:id="@+id/favoriteConversationImageView"
android:layout_width="16dp"
android:layout_height="16dp"
android:layout_gravity="top|end"
android:contentDescription="@string/starred"
android:src="@drawable/ic_star_black_24dp"
app:tint="@color/favorite_icon_tint"
app:tintMode="src_in"/>
app:tintMode="src_in" />
</FrameLayout>

View file

@ -48,6 +48,8 @@
<color name="conversation_unread_bubble">#373737</color>
<color name="conversation_unread_bubble_text">#D8D8D8</color>
<color name="controller_chat_separator">#484848</color>
<!-- Chat window incoming message text & informational -->
<color name="nc_incoming_text_default">#D8D8D8</color>
<color name="nc_grey">@android:color/holo_purple</color>

View file

@ -271,6 +271,7 @@
<string name="nc_sent_a_video_you">You sent a video.</string>
<string name="nc_sent_an_image_you">You sent an image.</string>
<string name="nc_formatted_message" translatable="false">%1$s: %2$s</string>
<string name="nc_message_quote_cancel_reply">Cancel reply</string>
<!-- When translating to German, please use non-formal variant -->
<string name="nc_formatted_message_you">You: %1$s</string>
@ -361,6 +362,9 @@
<string name="nc_phone_book_integration_chat_via">Chat via %s</string>
<string name="nc_phone_book_integration_account_not_found">Account not found</string>
<string name="starred">Favorite</string>
<string name="password_protected">Password protected</string>
<string name="avatar">Avatar</string>
<string name="account_icon">Account icon</string>
<string name="userinfo_no_info_headline">No personal info set</string>

View file

@ -1,2 +1,2 @@
DO NOT TOUCH; GENERATED BY DRONE
<span class="mdl-layout-title">Lint Report: 3 errors and 126 warnings</span>
<span class="mdl-layout-title">Lint Report: 3 errors and 117 warnings</span>