Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
A
AloqaIM-Android
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Administrator
AloqaIM-Android
Commits
7d35b2ac
Commit
7d35b2ac
authored
Jul 19, 2017
by
Filipe de Lima Brito
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Improve failed message sync state
parent
dc2aa663
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
45 additions
and
17 deletions
+45
-17
AbstractMessageViewHolder.java
...roid/layouthelper/chatroom/AbstractMessageViewHolder.java
+9
-5
MessageRenderer.java
...in/java/chat/rocket/android/renderer/MessageRenderer.java
+7
-12
ic_error_black_24dp.xml
app/src/main/res/drawable/ic_error_black_24dp.xml
+9
-0
list_item_normal_message.xml
app/src/main/res/layout/list_item_normal_message.xml
+10
-0
list_item_system_message.xml
app/src/main/res/layout/list_item_system_message.xml
+10
-0
No files found.
app/src/main/java/chat/rocket/android/layouthelper/chatroom/AbstractMessageViewHolder.java
View file @
7d35b2ac
...
@@ -2,6 +2,7 @@ package chat.rocket.android.layouthelper.chatroom;
...
@@ -2,6 +2,7 @@ package chat.rocket.android.layouthelper.chatroom;
import
android.support.annotation.Nullable
;
import
android.support.annotation.Nullable
;
import
android.view.View
;
import
android.view.View
;
import
android.widget.ImageView
;
import
android.widget.TextView
;
import
android.widget.TextView
;
import
chat.rocket.android.R
;
import
chat.rocket.android.R
;
import
chat.rocket.android.helper.DateTime
;
import
chat.rocket.android.helper.DateTime
;
...
@@ -12,6 +13,7 @@ import chat.rocket.core.SyncState;
...
@@ -12,6 +13,7 @@ import chat.rocket.core.SyncState;
public
abstract
class
AbstractMessageViewHolder
extends
ModelViewHolder
<
PairedMessage
>
{
public
abstract
class
AbstractMessageViewHolder
extends
ModelViewHolder
<
PairedMessage
>
{
protected
final
RocketChatAvatar
avatar
;
protected
final
RocketChatAvatar
avatar
;
protected
final
ImageView
errorImageView
;
protected
final
TextView
username
;
protected
final
TextView
username
;
protected
final
TextView
subUsername
;
protected
final
TextView
subUsername
;
protected
final
TextView
timestamp
;
protected
final
TextView
timestamp
;
...
@@ -26,6 +28,7 @@ public abstract class AbstractMessageViewHolder extends ModelViewHolder<PairedMe
...
@@ -26,6 +28,7 @@ public abstract class AbstractMessageViewHolder extends ModelViewHolder<PairedMe
public
AbstractMessageViewHolder
(
View
itemView
,
AbsoluteUrl
absoluteUrl
)
{
public
AbstractMessageViewHolder
(
View
itemView
,
AbsoluteUrl
absoluteUrl
)
{
super
(
itemView
);
super
(
itemView
);
avatar
=
itemView
.
findViewById
(
R
.
id
.
user_avatar
);
avatar
=
itemView
.
findViewById
(
R
.
id
.
user_avatar
);
errorImageView
=
itemView
.
findViewById
(
R
.
id
.
errorImageView
);
username
=
itemView
.
findViewById
(
R
.
id
.
username
);
username
=
itemView
.
findViewById
(
R
.
id
.
username
);
subUsername
=
itemView
.
findViewById
(
R
.
id
.
sub_username
);
subUsername
=
itemView
.
findViewById
(
R
.
id
.
sub_username
);
timestamp
=
itemView
.
findViewById
(
R
.
id
.
timestamp
);
timestamp
=
itemView
.
findViewById
(
R
.
id
.
timestamp
);
...
@@ -39,11 +42,12 @@ public abstract class AbstractMessageViewHolder extends ModelViewHolder<PairedMe
...
@@ -39,11 +42,12 @@ public abstract class AbstractMessageViewHolder extends ModelViewHolder<PairedMe
* bind the view model.
* bind the view model.
*/
*/
public
final
void
bind
(
PairedMessage
pairedMessage
,
boolean
autoloadImages
)
{
public
final
void
bind
(
PairedMessage
pairedMessage
,
boolean
autoloadImages
)
{
if
(
pairedMessage
.
target
.
getSyncState
()
!=
SyncState
.
SYNCED
)
{
if
(
pairedMessage
.
target
.
getSyncState
()
==
SyncState
.
FAILED
)
{
itemView
.
setAlpha
(
0.6f
);
avatar
.
setVisibility
(
View
.
GONE
);
}
errorImageView
.
setVisibility
(
View
.
VISIBLE
);
else
{
}
else
{
itemView
.
setAlpha
(
1.0f
);
errorImageView
.
setVisibility
(
View
.
GONE
);
avatar
.
setVisibility
(
View
.
VISIBLE
);
}
}
bindMessage
(
pairedMessage
,
autoloadImages
);
bindMessage
(
pairedMessage
,
autoloadImages
);
...
...
app/src/main/java/chat/rocket/android/renderer/MessageRenderer.java
View file @
7d35b2ac
...
@@ -21,7 +21,6 @@ import java.util.List;
...
@@ -21,7 +21,6 @@ import java.util.List;
* Renderer for RealmMessage model.
* Renderer for RealmMessage model.
*/
*/
public
class
MessageRenderer
extends
AbstractRenderer
<
Message
>
{
public
class
MessageRenderer
extends
AbstractRenderer
<
Message
>
{
private
final
UserRenderer
userRenderer
;
private
final
UserRenderer
userRenderer
;
private
final
boolean
autoloadImages
;
private
final
boolean
autoloadImages
;
...
@@ -39,17 +38,13 @@ public class MessageRenderer extends AbstractRenderer<Message> {
...
@@ -39,17 +38,13 @@ public class MessageRenderer extends AbstractRenderer<Message> {
return
this
;
return
this
;
}
}
switch
(
object
.
getSyncState
()){
if
(
object
.
getSyncState
()
!=
SyncState
.
FAILED
)
{
case
SyncState
.
FAILED
:
if
(
TextUtils
.
isEmpty
(
object
.
getAvatar
()))
{
userRenderer
.
avatarInto
(
rocketChatAvatar
,
absoluteUrl
,
true
);
userRenderer
.
avatarInto
(
rocketChatAvatar
,
absoluteUrl
);
break
;
// Avatar from oauth providers
default
:
}
else
{
if
(
TextUtils
.
isEmpty
(
object
.
getAvatar
()))
{
rocketChatAvatar
.
loadImage
(
object
.
getAvatar
());
userRenderer
.
avatarInto
(
rocketChatAvatar
,
absoluteUrl
,
false
);
}
}
else
{
rocketChatAvatar
.
loadImage
(
object
.
getAvatar
());
}
break
;
}
}
return
this
;
return
this
;
}
}
...
...
app/src/main/res/drawable/ic_error_black_24dp.xml
0 → 100644
View file @
7d35b2ac
<vector
xmlns:android=
"http://schemas.android.com/apk/res/android"
android:width=
"24dp"
android:height=
"24dp"
android:viewportWidth=
"24.0"
android:viewportHeight=
"24.0"
>
<path
android:fillColor=
"#FF000000"
android:pathData=
"M12,2C6.48,2 2,6.48 2,12s4.48,10 10,10 10,-4.48 10,-10S17.52,2 12,2zM13,17h-2v-2h2v2zM13,13h-2L11,7h2v6z"
/>
</vector>
app/src/main/res/layout/list_item_normal_message.xml
View file @
7d35b2ac
<?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: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"
...
@@ -19,6 +20,15 @@
...
@@ -19,6 +20,15 @@
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"
...
...
app/src/main/res/layout/list_item_system_message.xml
View file @
7d35b2ac
<?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: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"
...
@@ -18,6 +19,15 @@
...
@@ -18,6 +19,15 @@
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"
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment