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
import chat.rocket.android.widget.RocketChatAvatar
import java.net.URLEncoder
class Avatar(val absoluteUrl: AbsoluteUrl, val username: String) {
class Avatar(val absoluteUrl: AbsoluteUrl?, val username: String) {
val imageUrl: String
/** REMARK
* This is often a SVG image (see Rocket.Chat:server/startup/avatar.js)
*/
get() {
val avatarUrl = "/avatar/" + URLEncoder.encode(username, "UTF-8")
if (absoluteUrl == null) {
return avatarUrl
}
return absoluteUrl.from("/avatar/" + URLEncoder.encode(username, "UTF-8"))
}
......
......@@ -43,11 +43,9 @@ public abstract class AbstractMessageViewHolder extends ModelViewHolder<PairedMe
*/
public final void bind(PairedMessage pairedMessage, boolean autoloadImages) {
if (pairedMessage.target.getSyncState() == SyncState.FAILED) {
avatar.setVisibility(View.GONE);
errorImageView.setVisibility(View.VISIBLE);
} else {
errorImageView.setVisibility(View.GONE);
avatar.setVisibility(View.VISIBLE);
}
bindMessage(pairedMessage, autoloadImages);
......@@ -73,11 +71,12 @@ public abstract class AbstractMessageViewHolder extends ModelViewHolder<PairedMe
private void setSequential(boolean sequential) {
if (avatar != null) {
if (sequential)
if (sequential) {
avatar.setVisibility(View.GONE);
else
} else {
avatar.setVisibility(View.VISIBLE);
}
}
if (userAndTimeContainer != null) {
if (sequential)
......
......@@ -38,14 +38,12 @@ public class MessageRenderer extends AbstractRenderer<Message> {
return this;
}
if(object.getSyncState() != SyncState.FAILED) {
if (TextUtils.isEmpty(object.getAvatar())) {
userRenderer.avatarInto(rocketChatAvatar, absoluteUrl);
// Avatar from oauth providers
} else {
rocketChatAvatar.loadImage(object.getAvatar());
}
}
return this;
}
......
......@@ -28,7 +28,7 @@
android:id="@+id/activity_main_container"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@color/white"
android:background="@android:color/white"
app:layout_behavior="@string/appbar_scrolling_view_behavior" />
</android.support.design.widget.CoordinatorLayout>
......
......@@ -9,7 +9,7 @@
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:background="@color/white"
android:background="@android:color/white"
android:minWidth="288dp"
android:orientation="vertical"
android:padding="@dimen/margin_24">
......
......@@ -8,6 +8,7 @@
android:id="@+id/messageRecyclerView"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:scrollbars="vertical"
android:layout_above="@+id/messageComposer" />
<chat.rocket.android.widget.message.MessageFormLayout
......
......@@ -9,7 +9,7 @@
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:background="@color/white"
android:background="@android:color/white"
android:minWidth="288dp"
android:orientation="vertical"
android:padding="@dimen/margin_24">
......
......@@ -20,15 +20,6 @@
android:layout_height="32dp"
android:layout_margin="8dp" />
<ImageView
android:id="@+id/errorImageView"
android:layout_width="32dp"
android:layout_height="32dp"
android:layout_margin="8dp"
android:tint="@color/colorAccent"
app:srcCompat="@drawable/ic_error_black_24dp"
android:visibility="gone" />
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
......@@ -72,6 +63,21 @@
android:layout_height="wrap_content"
android:enabled="false"
tools:text="12:34" />
<View
android:layout_width="0dp"
android:layout_height="0dp"
android:layout_weight="1" />
<ImageView
android:id="@+id/errorImageView"
android:layout_width="wrap_content"
android:layout_height="16dp"
android:layout_gravity="end"
android:gravity="end"
android:tint="@color/colorRed400"
app:srcCompat="@drawable/ic_error_black_24dp"
android:visibility="gone" />
</LinearLayout>
<chat.rocket.android.widget.message.RocketChatMessageLayout
......
......@@ -19,15 +19,6 @@
android:layout_height="32dp"
android:layout_margin="8dp" />
<ImageView
android:id="@+id/errorImageView"
android:layout_width="32dp"
android:layout_height="32dp"
android:layout_margin="8dp"
android:tint="@color/colorAccent"
app:srcCompat="@drawable/ic_error_black_24dp"
android:visibility="gone" />
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
......@@ -60,6 +51,21 @@
android:layout_height="wrap_content"
android:enabled="false"
tools:text="12:34" />
<View
android:layout_width="0dp"
android:layout_height="0dp"
android:layout_weight="1" />
<ImageView
android:id="@+id/errorImageView"
android:layout_width="wrap_content"
android:layout_height="16dp"
android:layout_gravity="end"
android:gravity="end"
android:tint="@color/colorRed400"
app:srcCompat="@drawable/ic_error_black_24dp"
android:visibility="gone" />
</LinearLayout>
<TextView
......
......@@ -7,5 +7,5 @@
<color name="colorAccentDark">#FF287DD7</color>
<color name="colorAccent_a40">#662D91FA</color>
<color name="textColorLink">#008ce3</color>
<color name="white">#FFFEFEFF</color>
<color name="colorRed400">#FFEF5350</color>
</resources>
\ No newline at end of file
......@@ -2,7 +2,7 @@
<resources>
<style name="Widget.RocketChat.RoomToolbar" parent="Widget.AppCompat.Toolbar">
<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 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