Fix layout issues & Add lock icon to room

Signed-off-by: Mario Danic <mario@lovelyhq.com>
This commit is contained in:
Mario Danic 2018-08-04 21:44:03 +02:00
Родитель d5c582efb7
Коммит 4df3284a37
5 изменённых файлов: 154 добавлений и 82 удалений

Просмотреть файл

@ -113,7 +113,7 @@ public class ConversationItem extends AbstractFlexibleItem<ConversationItem.Conv
if (conversation.getUnreadMessages() < 10) {
holder.dialogUnreadBubble.setText(Long.toString(conversation.getUnreadMessages()));
} else {
holder.dialogUnreadBubble.setText("+");
holder.dialogUnreadBubble.setText("9+");
}
if (conversation.isUnreadMention()) {
@ -127,6 +127,18 @@ public class ConversationItem extends AbstractFlexibleItem<ConversationItem.Conv
String authorDisplayName = "";
if (conversation.isHasPassword()) {
holder.passwordProtectedRoomImageView.setVisibility(View.VISIBLE);
} else {
holder.passwordProtectedRoomImageView.setVisibility(View.GONE);
}
if (conversation.isPinned()) {
holder.pinnedConversationImageView.setVisibility(View.VISIBLE);
} else {
holder.pinnedConversationImageView.setVisibility(View.GONE);
}
if (conversation.getLastMessage() != null) {
holder.dialogDate.setVisibility(View.VISIBLE);
holder.dialogDate.setText(DateUtils.getRelativeTimeSpanString(conversation.getLastActivity() * 1000L,
@ -153,7 +165,7 @@ public class ConversationItem extends AbstractFlexibleItem<ConversationItem.Conv
spannableString.setSpan(boldStyleSpan, 0, fullString.indexOf(":") + 1, Spannable
.SPAN_INCLUSIVE_INCLUSIVE);
holder.dialogLastMessage.setText(spannableString, TextView.BufferType.SPANNABLE);
holder.dialogLastMessage.setText(spannableString);
holder.dialogLastMessageUserAvatar.setVisibility(View.VISIBLE);
int smallAvatarSize = Math.round(context.getResources().getDimension(R.dimen.small_item_height));
@ -280,6 +292,10 @@ public class ConversationItem extends AbstractFlexibleItem<ConversationItem.Conv
TextView dialogUnreadBubble;
@BindView(R.id.onlineIndicator)
ImageView onlineIndicator;
@BindView(R.id.passwordProtectedRoomImageView)
ImageView passwordProtectedRoomImageView;
@BindView(R.id.pinnedConversationImageView)
ImageView pinnedConversationImageView;
ConversationItemViewHolder(View view, FlexibleAdapter adapter) {
super(view, adapter);

Просмотреть файл

@ -26,6 +26,6 @@
android:width="2dp"
android:color="@color/white" />
<size
android:width="20dp"
android:height="20dp" />
android:width="24dp"
android:height="24dp" />
</shape>

Просмотреть файл

@ -26,6 +26,6 @@
android:width="2dp"
android:color="@color/white" />
<size
android:width="20dp"
android:height="20dp" />
android:width="24dp"
android:height="24dp" />
</shape>

Просмотреть файл

@ -0,0 +1,26 @@
<!--
~ 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/>.
-->
<vector android:autoMirrored="true" android:height="24dp"
android:viewportHeight="24.0" android:viewportWidth="24.0"
android:width="24dp" xmlns:android="http://schemas.android.com/apk/res/android">
<path android:fillColor="#000000"
android:pathData="M18,8h-1L17,6c0,-2.76 -2.24,-5 -5,-5S7,3.24 7,6v2L6,8c-1.1,0 -2,0.9 -2,2v10c0,1.1 0.9,2 2,2h12c1.1,0 2,-0.9 2,-2L20,10c0,-1.1 -0.9,-2 -2,-2zM12,17c-1.1,0 -2,-0.9 -2,-2s0.9,-2 2,-2 2,0.9 2,2 -0.9,2 -2,2zM15.1,8L8.9,8L8.9,6c0,-1.71 1.39,-3.1 3.1,-3.1 1.71,0 3.1,1.39 3.1,3.1v2z"/>
</vector>

Просмотреть файл

@ -25,94 +25,124 @@
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginEnd="16dp"
android:layout_margin="16dp">
android:layout_height="wrap_content">
<FrameLayout
android:layout_width="@dimen/avatar_size"
android:layout_height="@dimen/avatar_size"
android:layout_centerVertical="true"
android:id="@+id/dialogAvatarFrameLayout">
<ImageView
android:id="@id/dialogAvatar"
android:layout_width="@dimen/avatar_size"
android:layout_height="@dimen/avatar_size"/>
<ImageView
android:id="@+id/onlineIndicator"
android:layout_width="12dp"
android:layout_height="12dp"
android:layout_gravity="top|end"
android:background="@drawable/shape_bubble_online"
/>
</FrameLayout>
<TextView
android:id="@id/dialogName"
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_alignTop="@id/dialogAvatarFrameLayout"
android:layout_marginStart="8dp"
android:layout_toEndOf="@id/dialogAvatarFrameLayout"
android:layout_toStartOf="@id/dialogDate"
android:ellipsize="end"
android:fontFamily="@string/font_fontFamily_medium"
android:includeFontPadding="false"
android:maxLines="1"/>
android:layout_margin="16dp">
<TextView
android:id="@id/dialogDate"
<FrameLayout
android:layout_width="@dimen/avatar_size"
android:layout_height="@dimen/avatar_size"
android:layout_centerVertical="true"
android:id="@+id/dialogAvatarFrameLayout">
<ImageView
android:id="@id/dialogAvatar"
android:layout_width="@dimen/avatar_size"
android:layout_height="@dimen/avatar_size"/>
<ImageView
android:id="@+id/onlineIndicator"
android:layout_width="12dp"
android:layout_height="12dp"
android:layout_gravity="top|end"
android:background="@drawable/shape_bubble_online"
/>
</FrameLayout>
<TextView
android:id="@id/dialogName"
android:layout_width="match_parent"
android:layout_height="wrap_content"
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"/>
<TextView
android:id="@id/dialogDate"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentEnd="true"
android:ellipsize="end"
android:maxLines="1"/>
<RelativeLayout
android:id="@+id/dialogLastMessageLayout"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_below="@id/dialogName"
android:layout_marginStart="8dp"
android:layout_marginTop="8dp"
android:layout_toEndOf="@id/dialogAvatarFrameLayout">
<ImageView
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"/>
<TextView
android:id="@id/dialogLastMessage"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_centerVertical="true"
android:layout_toEndOf="@id/dialogLastMessageUserAvatar"
android:layout_toStartOf="@id/dialogUnreadBubble"
android:ellipsize="end"
android:gravity="top"
android:singleLine="false"
android:maxLines="2"/>
<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_marginStart="8dp"
android:background="@drawable/bubble_circle_unread"
android:gravity="center"
android:textAlignment="center"
android:lines="1"
android:textColor="@color/white"/>
</RelativeLayout>
</RelativeLayout>
<RelativeLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentEnd="true"
android:ellipsize="end"
android:maxLines="1"/>
<RelativeLayout
android:id="@+id/dialogLastMessageLayout"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_below="@id/dialogName"
android:layout_marginStart="8dp"
android:layout_marginTop="8dp"
android:layout_toEndOf="@id/dialogAvatarFrameLayout">
android:layout_alignParentBottom="true"
android:layout_marginEnd="8dp">
<ImageView
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:id="@+id/passwordProtectedRoomImageView"
android:layout_width="12dp"
android:layout_height="12dp"
android:layout_marginBottom="4dp"
android:layout_toStartOf="@id/pinnedConversationImageView"
android:src="@drawable/ic_lock_black_24px"
android:visibility="visible"/>
<TextView
android:id="@id/dialogLastMessage"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_centerVertical="true"
android:layout_toEndOf="@id/dialogLastMessageUserAvatar"
android:layout_toStartOf="@id/dialogUnreadBubble"
android:ellipsize="end"
android:gravity="top"
android:maxLines="2"/>
<TextView
android:id="@id/dialogUnreadBubble"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerInParent="true"
<ImageView
android:id="@+id/pinnedConversationImageView"
android:layout_width="12dp"
android:layout_height="12dp"
android:layout_marginBottom="4dp"
android:layout_alignParentEnd="true"
android:layout_marginStart="8dp"
android:background="@drawable/bubble_circle_unread"
android:ellipsize="end"
android:gravity="center"
android:textAlignment="center"
android:lines="1"
android:textColor="@color/white"/>
android:src="@drawable/ic_lock_black_24px"
android:visibility="visible"/>
</RelativeLayout>