Commit bff56d0d authored by Filipe de Lima Brito's avatar Filipe de Lima Brito

Merge branch 'develop' of https://github.com/RocketChat/Rocket.Chat.Android into ux

parents 2bef3fd7 e33a2b19
...@@ -4,13 +4,17 @@ import chat.rocket.android.widget.AbsoluteUrl ...@@ -4,13 +4,17 @@ import chat.rocket.android.widget.AbsoluteUrl
import chat.rocket.android.widget.RocketChatAvatar import chat.rocket.android.widget.RocketChatAvatar
import java.net.URLEncoder import java.net.URLEncoder
class Avatar(val absoluteUrl: AbsoluteUrl, val username: String) { class Avatar(val absoluteUrl: AbsoluteUrl?, val username: String) {
val imageUrl: String val imageUrl: String
/** REMARK /** REMARK
* This is often a SVG image (see Rocket.Chat:server/startup/avatar.js) * This is often a SVG image (see Rocket.Chat:server/startup/avatar.js)
*/ */
get() { get() {
val avatarUrl = "/avatar/" + URLEncoder.encode(username, "UTF-8")
if (absoluteUrl == null) {
return avatarUrl
}
return absoluteUrl.from("/avatar/" + URLEncoder.encode(username, "UTF-8")) return absoluteUrl.from("/avatar/" + URLEncoder.encode(username, "UTF-8"))
} }
......
...@@ -43,11 +43,9 @@ public abstract class AbstractMessageViewHolder extends ModelViewHolder<PairedMe ...@@ -43,11 +43,9 @@ public abstract class AbstractMessageViewHolder extends ModelViewHolder<PairedMe
*/ */
public final void bind(PairedMessage pairedMessage, boolean autoloadImages) { public final void bind(PairedMessage pairedMessage, boolean autoloadImages) {
if (pairedMessage.target.getSyncState() == SyncState.FAILED) { if (pairedMessage.target.getSyncState() == SyncState.FAILED) {
avatar.setVisibility(View.GONE);
errorImageView.setVisibility(View.VISIBLE); errorImageView.setVisibility(View.VISIBLE);
} else { } else {
errorImageView.setVisibility(View.GONE); errorImageView.setVisibility(View.GONE);
avatar.setVisibility(View.VISIBLE);
} }
bindMessage(pairedMessage, autoloadImages); bindMessage(pairedMessage, autoloadImages);
...@@ -73,10 +71,11 @@ public abstract class AbstractMessageViewHolder extends ModelViewHolder<PairedMe ...@@ -73,10 +71,11 @@ public abstract class AbstractMessageViewHolder extends ModelViewHolder<PairedMe
private void setSequential(boolean sequential) { private void setSequential(boolean sequential) {
if (avatar != null) { if (avatar != null) {
if (sequential) if (sequential) {
avatar.setVisibility(View.GONE); avatar.setVisibility(View.GONE);
else } else {
avatar.setVisibility(View.VISIBLE); avatar.setVisibility(View.VISIBLE);
}
} }
if (userAndTimeContainer != null) { if (userAndTimeContainer != null) {
......
...@@ -38,13 +38,11 @@ public class MessageRenderer extends AbstractRenderer<Message> { ...@@ -38,13 +38,11 @@ public class MessageRenderer extends AbstractRenderer<Message> {
return this; return this;
} }
if(object.getSyncState() != SyncState.FAILED) { if (TextUtils.isEmpty(object.getAvatar())) {
if (TextUtils.isEmpty(object.getAvatar())) { userRenderer.avatarInto(rocketChatAvatar, absoluteUrl);
userRenderer.avatarInto(rocketChatAvatar, absoluteUrl); // Avatar from oauth providers
// Avatar from oauth providers } else {
} else { rocketChatAvatar.loadImage(object.getAvatar());
rocketChatAvatar.loadImage(object.getAvatar());
}
} }
return this; return this;
} }
......
...@@ -28,7 +28,7 @@ ...@@ -28,7 +28,7 @@
android:id="@+id/activity_main_container" android:id="@+id/activity_main_container"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="match_parent" android:layout_height="match_parent"
android:background="@color/white" android:background="@android:color/white"
app:layout_behavior="@string/appbar_scrolling_view_behavior" /> app:layout_behavior="@string/appbar_scrolling_view_behavior" />
</android.support.design.widget.CoordinatorLayout> </android.support.design.widget.CoordinatorLayout>
......
...@@ -9,7 +9,7 @@ ...@@ -9,7 +9,7 @@
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_gravity="center" android:layout_gravity="center"
android:background="@color/white" android:background="@android:color/white"
android:minWidth="288dp" android:minWidth="288dp"
android:orientation="vertical" android:orientation="vertical"
android:padding="@dimen/margin_24"> android:padding="@dimen/margin_24">
......
...@@ -5,15 +5,16 @@ ...@@ -5,15 +5,16 @@
android:layout_height="match_parent"> android:layout_height="match_parent">
<android.support.v7.widget.RecyclerView <android.support.v7.widget.RecyclerView
android:id="@+id/messageRecyclerView" android:id="@+id/messageRecyclerView"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="match_parent" android:layout_height="match_parent"
android:layout_above="@+id/messageComposer" /> android:scrollbars="vertical"
android:layout_above="@+id/messageComposer" />
<chat.rocket.android.widget.message.MessageFormLayout <chat.rocket.android.widget.message.MessageFormLayout
android:id="@+id/messageComposer" android:id="@+id/messageComposer"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_alignParentBottom="true" android:layout_alignParentBottom="true"
android:theme="@style/Theme.AppCompat.Light" /> android:theme="@style/Theme.AppCompat.Light" />
</RelativeLayout> </RelativeLayout>
\ No newline at end of file
...@@ -9,7 +9,7 @@ ...@@ -9,7 +9,7 @@
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_gravity="center" android:layout_gravity="center"
android:background="@color/white" android:background="@android:color/white"
android:minWidth="288dp" android:minWidth="288dp"
android:orientation="vertical" android:orientation="vertical"
android:padding="@dimen/margin_24"> android:padding="@dimen/margin_24">
......
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto" xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools" xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:orientation="vertical" android:orientation="vertical"
android:theme="@style/AppTheme"> android:theme="@style/AppTheme">
<include layout="@layout/list_item_message_newday" /> <include layout="@layout/list_item_message_newday" />
<FrameLayout <FrameLayout
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_marginBottom="2dp"> android:layout_marginBottom="2dp">
<chat.rocket.android.widget.RocketChatAvatar <chat.rocket.android.widget.RocketChatAvatar
android:id="@+id/user_avatar" android:id="@+id/user_avatar"
android:layout_width="32dp" android:layout_width="32dp"
android:layout_height="32dp" android:layout_height="32dp"
android:layout_margin="8dp" /> android:layout_margin="8dp" />
<ImageView <LinearLayout
android:id="@+id/errorImageView" android:layout_width="match_parent"
android:layout_width="32dp" android:layout_height="wrap_content"
android:layout_height="32dp" android:layout_marginEnd="8dp"
android:layout_margin="8dp" android:layout_marginStart="48dp"
android:tint="@color/colorAccent" android:orientation="vertical"
app:srcCompat="@drawable/ic_error_black_24dp" android:layout_marginRight="8dp"
android:visibility="gone" /> android:layout_marginLeft="48dp">
<LinearLayout
android:id="@+id/user_and_timestamp_container"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal">
<LinearLayout <TextView
android:layout_width="match_parent" android:id="@+id/username"
android:layout_height="wrap_content" android:layout_width="wrap_content"
android:layout_marginEnd="8dp" android:layout_height="wrap_content"
android:layout_marginStart="48dp" android:textAppearance="@style/TextAppearance.RocketChat.Message.Username"
android:orientation="vertical" tools:text="John Doe" />
android:layout_marginRight="8dp"
android:layout_marginLeft="48dp">
<LinearLayout <Space
android:id="@+id/user_and_timestamp_container" android:layout_width="4dp"
android:layout_width="match_parent" android:layout_height="wrap_content" />
android:layout_height="wrap_content"
android:orientation="horizontal">
<TextView <TextView
android:id="@+id/username" android:id="@+id/sub_username"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:textAppearance="@style/TextAppearance.RocketChat.Message.Username" android:textAppearance="@style/TextAppearance.RocketChat.Message.SubUsername"
tools:text="John Doe" /> tools:text="\@John Doe" />
<Space <Space
android:layout_width="4dp" android:layout_width="@dimen/margin_8"
android:layout_height="wrap_content" /> android:layout_height="wrap_content" />
<TextView <TextView
android:id="@+id/sub_username" android:id="@+id/timestamp"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:textAppearance="@style/TextAppearance.RocketChat.Message.SubUsername" android:enabled="false"
tools:text="\@John Doe" /> tools:text="12:34" />
<Space <View
android:layout_width="@dimen/margin_8" android:layout_width="0dp"
android:layout_height="wrap_content" /> android:layout_height="0dp"
android:layout_weight="1" />
<TextView <ImageView
android:id="@+id/timestamp" android:id="@+id/errorImageView"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="16dp"
android:enabled="false" android:layout_gravity="end"
tools:text="12:34" /> android:gravity="end"
</LinearLayout> android:tint="@color/colorRed400"
app:srcCompat="@drawable/ic_error_black_24dp"
android:visibility="gone" />
</LinearLayout>
<chat.rocket.android.widget.message.RocketChatMessageLayout <chat.rocket.android.widget.message.RocketChatMessageLayout
android:id="@+id/message_body" android:id="@+id/message_body"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" /> android:layout_height="wrap_content" />
<chat.rocket.android.widget.message.RocketChatMessageUrlsLayout <chat.rocket.android.widget.message.RocketChatMessageUrlsLayout
android:id="@+id/message_urls" android:id="@+id/message_urls"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" /> android:layout_height="wrap_content" />
<chat.rocket.android.widget.message.RocketChatMessageAttachmentsLayout <chat.rocket.android.widget.message.RocketChatMessageAttachmentsLayout
android:id="@+id/message_attachments" android:id="@+id/message_attachments"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" /> android:layout_height="wrap_content" />
</LinearLayout> </LinearLayout>
</FrameLayout> </FrameLayout>
</LinearLayout> </LinearLayout>
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto" xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools" xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical"
android:theme="@style/AppTheme">
<include layout="@layout/list_item_message_newday" />
<FrameLayout
android:layout_width="match_parent"
android:layout_height="wrap_content">
<chat.rocket.android.widget.RocketChatAvatar
android:id="@+id/user_avatar"
android:layout_width="32dp"
android:layout_height="32dp"
android:layout_margin="8dp" />
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginEnd="8dp"
android:layout_marginStart="48dp"
android:orientation="vertical"
android:layout_marginRight="8dp"
android:layout_marginLeft="48dp">
<LinearLayout
android:id="@+id/user_and_timestamp_container"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:orientation="vertical" android:orientation="horizontal">
android:theme="@style/AppTheme">
<TextView
android:id="@+id/username"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textAppearance="@style/TextAppearance.RocketChat.Message.Username"
tools:text="John Doe" />
<include layout="@layout/list_item_message_newday" /> <Space
android:layout_width="@dimen/margin_8"
android:layout_height="wrap_content" />
<FrameLayout <TextView
android:layout_width="match_parent" android:id="@+id/timestamp"
android:layout_height="wrap_content"> android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:enabled="false"
tools:text="12:34" />
<chat.rocket.android.widget.RocketChatAvatar <View
android:id="@+id/user_avatar" android:layout_width="0dp"
android:layout_width="32dp" android:layout_height="0dp"
android:layout_height="32dp" android:layout_weight="1" />
android:layout_margin="8dp" />
<ImageView <ImageView
android:id="@+id/errorImageView" android:id="@+id/errorImageView"
android:layout_width="32dp" android:layout_width="wrap_content"
android:layout_height="32dp" android:layout_height="16dp"
android:layout_margin="8dp" android:layout_gravity="end"
android:tint="@color/colorAccent" android:gravity="end"
android:tint="@color/colorRed400"
app:srcCompat="@drawable/ic_error_black_24dp" app:srcCompat="@drawable/ic_error_black_24dp"
android:visibility="gone" /> android:visibility="gone" />
</LinearLayout>
<LinearLayout <TextView
android:layout_width="match_parent" android:id="@+id/message_body"
android:layout_height="wrap_content" android:layout_width="match_parent"
android:layout_marginEnd="8dp" android:layout_height="wrap_content"
android:layout_marginStart="48dp" android:textAppearance="@style/TextAppearance.AppCompat.Body1"
android:orientation="vertical" android:textStyle="italic"
android:layout_marginRight="8dp" android:enabled="false" />
android:layout_marginLeft="48dp"> </LinearLayout>
</FrameLayout>
<LinearLayout
android:id="@+id/user_and_timestamp_container"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal">
<TextView
android:id="@+id/username"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textAppearance="@style/TextAppearance.RocketChat.Message.Username"
tools:text="John Doe" />
<Space
android:layout_width="@dimen/margin_8"
android:layout_height="wrap_content" />
<TextView
android:id="@+id/timestamp"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:enabled="false"
tools:text="12:34" />
</LinearLayout>
<TextView
android:id="@+id/message_body"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:textAppearance="@style/TextAppearance.AppCompat.Body1"
android:textStyle="italic"
android:enabled="false" />
</LinearLayout>
</FrameLayout>
</LinearLayout> </LinearLayout>
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<resources> <resources>
<color name="colorPrimary">#044b76</color> <color name="colorPrimary">#044b76</color>
<color name="colorPrimaryDark">#FF04436a</color> <color name="colorPrimaryDark">#FF04436a</color>
<color name="colorAccent">#FF2D91FA</color> <color name="colorAccent">#FF2D91FA</color>
<color name="colorAccentLight">#FF6CB1FA</color> <color name="colorAccentLight">#FF6CB1FA</color>
<color name="colorAccentDark">#FF287DD7</color> <color name="colorAccentDark">#FF287DD7</color>
<color name="colorAccent_a40">#662D91FA</color> <color name="colorAccent_a40">#662D91FA</color>
<color name="textColorLink">#008ce3</color> <color name="textColorLink">#008ce3</color>
<color name="white">#FFFEFEFF</color> <color name="colorRed400">#FFEF5350</color>
</resources> </resources>
\ No newline at end of file
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
<resources> <resources>
<style name="Widget.RocketChat.RoomToolbar" parent="Widget.AppCompat.Toolbar"> <style name="Widget.RocketChat.RoomToolbar" parent="Widget.AppCompat.Toolbar">
<item name="titleTextAppearance">@style/TextAppearance.Widget.RocketChat.RoomToolbar.Title</item> <item name="titleTextAppearance">@style/TextAppearance.Widget.RocketChat.RoomToolbar.Title</item>
<item name="android:background">@color/white</item> <item name="android:background">@android:color/white</item>
</style> </style>
<style name="TextAppearance.Widget.RocketChat.RoomToolbar.Title" <style name="TextAppearance.Widget.RocketChat.RoomToolbar.Title"
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment