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
67b15ad9
Commit
67b15ad9
authored
Jul 17, 2017
by
Filipe de Lima Brito
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Coding style improvement
parent
24d4fd72
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
36 additions
and
21 deletions
+36
-21
Avatar.java
app/src/main/java/chat/rocket/android/helper/Avatar.java
+3
-2
AbstractMessageViewHolder.java
...roid/layouthelper/chatroom/AbstractMessageViewHolder.java
+4
-2
MessageRenderer.java
...in/java/chat/rocket/android/renderer/MessageRenderer.java
+23
-14
UserViewHolder.java
...roid/widget/message/autocomplete/user/UserViewHolder.java
+6
-3
No files found.
app/src/main/java/chat/rocket/android/helper/Avatar.java
View file @
67b15ad9
...
...
@@ -86,10 +86,11 @@ public class Avatar {
* render avatar into RocketChatAvatar.
*/
public
void
into
(
final
RocketChatAvatar
rocketChatAvatar
,
boolean
showFailureImage
)
{
if
(
showFailureImage
)
if
(
showFailureImage
)
{
rocketChatAvatar
.
showFailureImage
();
else
}
else
{
rocketChatAvatar
.
loadImage
(
getImageUrl
());
}
}
public
Drawable
getTextDrawable
(
Context
context
)
{
...
...
app/src/main/java/chat/rocket/android/layouthelper/chatroom/AbstractMessageViewHolder.java
View file @
67b15ad9
...
...
@@ -39,10 +39,12 @@ public abstract class AbstractMessageViewHolder extends ModelViewHolder<PairedMe
* bind the view model.
*/
public
final
void
bind
(
PairedMessage
pairedMessage
,
boolean
autoloadImages
)
{
if
(
pairedMessage
.
target
.
getSyncState
()
!=
SyncState
.
SYNCED
)
if
(
pairedMessage
.
target
.
getSyncState
()
!=
SyncState
.
SYNCED
)
{
itemView
.
setAlpha
(
0.6f
);
else
}
else
{
itemView
.
setAlpha
(
1.0f
);
}
bindMessage
(
pairedMessage
,
autoloadImages
);
renderNewDayAndSequential
(
pairedMessage
);
...
...
app/src/main/java/chat/rocket/android/renderer/MessageRenderer.java
View file @
67b15ad9
...
...
@@ -35,18 +35,20 @@ public class MessageRenderer extends AbstractRenderer<Message> {
* show Avatar image.
*/
public
MessageRenderer
avatarInto
(
RocketChatAvatar
rocketChatAvatar
,
AbsoluteUrl
absoluteUrl
)
{
if
(!
shouldHandle
(
rocketChatAvatar
))
if
(!
shouldHandle
(
rocketChatAvatar
))
{
return
this
;
}
switch
(
object
.
getSyncState
()){
case
SyncState
.
FAILED
:
userRenderer
.
avatarInto
(
rocketChatAvatar
,
absoluteUrl
,
true
);
break
;
default
:
if
(
TextUtils
.
isEmpty
(
object
.
getAvatar
()))
if
(
TextUtils
.
isEmpty
(
object
.
getAvatar
()))
{
userRenderer
.
avatarInto
(
rocketChatAvatar
,
absoluteUrl
,
false
);
else
}
else
{
rocketChatAvatar
.
loadImage
(
object
.
getAvatar
());
}
break
;
}
return
this
;
...
...
@@ -58,10 +60,12 @@ public class MessageRenderer extends AbstractRenderer<Message> {
public
MessageRenderer
usernameInto
(
TextView
usernameTextView
,
TextView
subUsernameTextView
)
{
if
(
TextUtils
.
isEmpty
(
object
.
getAlias
()))
{
userRenderer
.
usernameInto
(
usernameTextView
);
if
(
subUsernameTextView
!=
null
)
if
(
subUsernameTextView
!=
null
)
{
subUsernameTextView
.
setVisibility
(
View
.
GONE
);
}
else
}
}
else
{
aliasAndUsernameInto
(
usernameTextView
,
subUsernameTextView
);
}
return
this
;
}
...
...
@@ -69,8 +73,9 @@ public class MessageRenderer extends AbstractRenderer<Message> {
* show timestamp in textView.
*/
public
MessageRenderer
timestampInto
(
TextView
textView
)
{
if
(!
shouldHandle
(
textView
))
if
(!
shouldHandle
(
textView
))
{
return
this
;
}
switch
(
object
.
getSyncState
())
{
case
SyncState
.
SYNCING
:
...
...
@@ -93,8 +98,9 @@ public class MessageRenderer extends AbstractRenderer<Message> {
* show body in RocketChatMessageLayout.
*/
public
MessageRenderer
bodyInto
(
RocketChatMessageLayout
rocketChatMessageLayout
)
{
if
(!
shouldHandle
(
rocketChatMessageLayout
))
if
(!
shouldHandle
(
rocketChatMessageLayout
))
{
return
this
;
}
rocketChatMessageLayout
.
setText
(
object
.
getMessage
());
return
this
;
...
...
@@ -104,13 +110,14 @@ public class MessageRenderer extends AbstractRenderer<Message> {
* show urls in RocketChatMessageUrlsLayout.
*/
public
MessageRenderer
urlsInto
(
RocketChatMessageUrlsLayout
urlsLayout
)
{
if
(!
shouldHandle
(
urlsLayout
))
if
(!
shouldHandle
(
urlsLayout
))
{
return
this
;
}
List
<
WebContent
>
webContents
=
object
.
getWebContents
();
if
(
webContents
==
null
||
webContents
.
size
()
==
0
)
if
(
webContents
==
null
||
webContents
.
size
()
==
0
)
{
urlsLayout
.
setVisibility
(
View
.
GONE
);
else
{
}
else
{
urlsLayout
.
setVisibility
(
View
.
VISIBLE
);
urlsLayout
.
setUrls
(
webContents
,
autoloadImages
);
}
...
...
@@ -125,9 +132,9 @@ public class MessageRenderer extends AbstractRenderer<Message> {
return
this
;
List
<
Attachment
>
attachments
=
object
.
getAttachments
();
if
(
attachments
==
null
||
attachments
.
size
()
==
0
)
if
(
attachments
==
null
||
attachments
.
size
()
==
0
)
{
attachmentsLayout
.
setVisibility
(
View
.
GONE
);
else
{
}
else
{
attachmentsLayout
.
setVisibility
(
View
.
VISIBLE
);
attachmentsLayout
.
setAbsoluteUrl
(
absoluteUrl
);
attachmentsLayout
.
setAttachments
(
attachments
,
autoloadImages
);
...
...
@@ -136,15 +143,17 @@ public class MessageRenderer extends AbstractRenderer<Message> {
}
private
void
aliasAndUsernameInto
(
TextView
aliasTextView
,
TextView
usernameTextView
)
{
if
(
shouldHandle
(
aliasTextView
))
if
(
shouldHandle
(
aliasTextView
))
{
aliasTextView
.
setText
(
object
.
getAlias
());
}
if
(
shouldHandle
(
usernameTextView
))
{
if
(
object
.
getUser
()
!=
null
)
{
usernameTextView
.
setText
(
"@"
+
object
.
getUser
().
getUsername
());
usernameTextView
.
setVisibility
(
View
.
VISIBLE
);
}
else
}
else
{
usernameTextView
.
setVisibility
(
View
.
GONE
);
}
}
}
...
...
rocket-chat-android-widgets/src/main/java/chat/rocket/android/widget/message/autocomplete/user/UserViewHolder.java
View file @
67b15ad9
...
...
@@ -54,14 +54,17 @@ public class UserViewHolder extends AutocompleteViewHolder<UserItem> {
final
String
suggestion
=
userItem
.
getSuggestion
();
if
(
titleTextView
!=
null
)
if
(
titleTextView
!=
null
)
{
titleTextView
.
setText
(
suggestion
);
}
if
(
avatar
!=
null
)
if
(
avatar
!=
null
)
{
avatar
.
loadImage
(
getImageUrl
(
suggestion
,
userItem
.
getAbsoluteUrl
()));
}
if
(
status
!=
null
)
if
(
status
!=
null
)
{
status
.
setImageResource
(
userItem
.
getStatusResId
());
}
}
@Override
...
...
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