Commit 2884d2dc authored by Filipe de Lima Brito's avatar Filipe de Lima Brito

Better SyncState.FAILED handling.

parent 9b8ae5be
...@@ -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,11 +71,12 @@ public abstract class AbstractMessageViewHolder extends ModelViewHolder<PairedMe ...@@ -73,11 +71,12 @@ 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) {
if (sequential) if (sequential)
......
...@@ -38,14 +38,12 @@ public class MessageRenderer extends AbstractRenderer<Message> { ...@@ -38,14 +38,12 @@ 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;
} }
......
...@@ -20,15 +20,6 @@ ...@@ -20,15 +20,6 @@
android:layout_height="32dp" android:layout_height="32dp"
android:layout_margin="8dp" /> 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 <LinearLayout
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
...@@ -72,6 +63,21 @@ ...@@ -72,6 +63,21 @@
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:enabled="false" android:enabled="false"
tools:text="12:34" /> 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> </LinearLayout>
<chat.rocket.android.widget.message.RocketChatMessageLayout <chat.rocket.android.widget.message.RocketChatMessageLayout
......
...@@ -19,15 +19,6 @@ ...@@ -19,15 +19,6 @@
android:layout_height="32dp" android:layout_height="32dp"
android:layout_margin="8dp" /> 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 <LinearLayout
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
...@@ -60,6 +51,21 @@ ...@@ -60,6 +51,21 @@
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:enabled="false" android:enabled="false"
tools:text="12:34" /> 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> </LinearLayout>
<TextView <TextView
......
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