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
Show 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,11 +86,12 @@ public class Avatar {
...
@@ -86,11 +86,12 @@ public class Avatar {
* render avatar into RocketChatAvatar.
* render avatar into RocketChatAvatar.
*/
*/
public
void
into
(
final
RocketChatAvatar
rocketChatAvatar
,
boolean
showFailureImage
)
{
public
void
into
(
final
RocketChatAvatar
rocketChatAvatar
,
boolean
showFailureImage
)
{
if
(
showFailureImage
)
if
(
showFailureImage
)
{
rocketChatAvatar
.
showFailureImage
();
rocketChatAvatar
.
showFailureImage
();
else
}
else
{
rocketChatAvatar
.
loadImage
(
getImageUrl
());
rocketChatAvatar
.
loadImage
(
getImageUrl
());
}
}
}
public
Drawable
getTextDrawable
(
Context
context
)
{
public
Drawable
getTextDrawable
(
Context
context
)
{
if
(
username
==
null
)
{
if
(
username
==
null
)
{
...
...
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
...
@@ -39,10 +39,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
.
SYNCED
)
{
itemView
.
setAlpha
(
0.6f
);
itemView
.
setAlpha
(
0.6f
);
else
}
else
{
itemView
.
setAlpha
(
1.0f
);
itemView
.
setAlpha
(
1.0f
);
}
bindMessage
(
pairedMessage
,
autoloadImages
);
bindMessage
(
pairedMessage
,
autoloadImages
);
renderNewDayAndSequential
(
pairedMessage
);
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> {
...
@@ -35,18 +35,20 @@ public class MessageRenderer extends AbstractRenderer<Message> {
* show Avatar image.
* show Avatar image.
*/
*/
public
MessageRenderer
avatarInto
(
RocketChatAvatar
rocketChatAvatar
,
AbsoluteUrl
absoluteUrl
)
{
public
MessageRenderer
avatarInto
(
RocketChatAvatar
rocketChatAvatar
,
AbsoluteUrl
absoluteUrl
)
{
if
(!
shouldHandle
(
rocketChatAvatar
))
if
(!
shouldHandle
(
rocketChatAvatar
))
{
return
this
;
return
this
;
}
switch
(
object
.
getSyncState
()){
switch
(
object
.
getSyncState
()){
case
SyncState
.
FAILED
:
case
SyncState
.
FAILED
:
userRenderer
.
avatarInto
(
rocketChatAvatar
,
absoluteUrl
,
true
);
userRenderer
.
avatarInto
(
rocketChatAvatar
,
absoluteUrl
,
true
);
break
;
break
;
default
:
default
:
if
(
TextUtils
.
isEmpty
(
object
.
getAvatar
()))
if
(
TextUtils
.
isEmpty
(
object
.
getAvatar
()))
{
userRenderer
.
avatarInto
(
rocketChatAvatar
,
absoluteUrl
,
false
);
userRenderer
.
avatarInto
(
rocketChatAvatar
,
absoluteUrl
,
false
);
else
}
else
{
rocketChatAvatar
.
loadImage
(
object
.
getAvatar
());
rocketChatAvatar
.
loadImage
(
object
.
getAvatar
());
}
break
;
break
;
}
}
return
this
;
return
this
;
...
@@ -58,10 +60,12 @@ public class MessageRenderer extends AbstractRenderer<Message> {
...
@@ -58,10 +60,12 @@ public class MessageRenderer extends AbstractRenderer<Message> {
public
MessageRenderer
usernameInto
(
TextView
usernameTextView
,
TextView
subUsernameTextView
)
{
public
MessageRenderer
usernameInto
(
TextView
usernameTextView
,
TextView
subUsernameTextView
)
{
if
(
TextUtils
.
isEmpty
(
object
.
getAlias
()))
{
if
(
TextUtils
.
isEmpty
(
object
.
getAlias
()))
{
userRenderer
.
usernameInto
(
usernameTextView
);
userRenderer
.
usernameInto
(
usernameTextView
);
if
(
subUsernameTextView
!=
null
)
if
(
subUsernameTextView
!=
null
)
{
subUsernameTextView
.
setVisibility
(
View
.
GONE
);
subUsernameTextView
.
setVisibility
(
View
.
GONE
);
}
else
}
}
else
{
aliasAndUsernameInto
(
usernameTextView
,
subUsernameTextView
);
aliasAndUsernameInto
(
usernameTextView
,
subUsernameTextView
);
}
return
this
;
return
this
;
}
}
...
@@ -69,8 +73,9 @@ public class MessageRenderer extends AbstractRenderer<Message> {
...
@@ -69,8 +73,9 @@ public class MessageRenderer extends AbstractRenderer<Message> {
* show timestamp in textView.
* show timestamp in textView.
*/
*/
public
MessageRenderer
timestampInto
(
TextView
textView
)
{
public
MessageRenderer
timestampInto
(
TextView
textView
)
{
if
(!
shouldHandle
(
textView
))
if
(!
shouldHandle
(
textView
))
{
return
this
;
return
this
;
}
switch
(
object
.
getSyncState
())
{
switch
(
object
.
getSyncState
())
{
case
SyncState
.
SYNCING
:
case
SyncState
.
SYNCING
:
...
@@ -93,8 +98,9 @@ public class MessageRenderer extends AbstractRenderer<Message> {
...
@@ -93,8 +98,9 @@ public class MessageRenderer extends AbstractRenderer<Message> {
* show body in RocketChatMessageLayout.
* show body in RocketChatMessageLayout.
*/
*/
public
MessageRenderer
bodyInto
(
RocketChatMessageLayout
rocketChatMessageLayout
)
{
public
MessageRenderer
bodyInto
(
RocketChatMessageLayout
rocketChatMessageLayout
)
{
if
(!
shouldHandle
(
rocketChatMessageLayout
))
if
(!
shouldHandle
(
rocketChatMessageLayout
))
{
return
this
;
return
this
;
}
rocketChatMessageLayout
.
setText
(
object
.
getMessage
());
rocketChatMessageLayout
.
setText
(
object
.
getMessage
());
return
this
;
return
this
;
...
@@ -104,13 +110,14 @@ public class MessageRenderer extends AbstractRenderer<Message> {
...
@@ -104,13 +110,14 @@ public class MessageRenderer extends AbstractRenderer<Message> {
* show urls in RocketChatMessageUrlsLayout.
* show urls in RocketChatMessageUrlsLayout.
*/
*/
public
MessageRenderer
urlsInto
(
RocketChatMessageUrlsLayout
urlsLayout
)
{
public
MessageRenderer
urlsInto
(
RocketChatMessageUrlsLayout
urlsLayout
)
{
if
(!
shouldHandle
(
urlsLayout
))
if
(!
shouldHandle
(
urlsLayout
))
{
return
this
;
return
this
;
}
List
<
WebContent
>
webContents
=
object
.
getWebContents
();
List
<
WebContent
>
webContents
=
object
.
getWebContents
();
if
(
webContents
==
null
||
webContents
.
size
()
==
0
)
if
(
webContents
==
null
||
webContents
.
size
()
==
0
)
{
urlsLayout
.
setVisibility
(
View
.
GONE
);
urlsLayout
.
setVisibility
(
View
.
GONE
);
else
{
}
else
{
urlsLayout
.
setVisibility
(
View
.
VISIBLE
);
urlsLayout
.
setVisibility
(
View
.
VISIBLE
);
urlsLayout
.
setUrls
(
webContents
,
autoloadImages
);
urlsLayout
.
setUrls
(
webContents
,
autoloadImages
);
}
}
...
@@ -125,9 +132,9 @@ public class MessageRenderer extends AbstractRenderer<Message> {
...
@@ -125,9 +132,9 @@ public class MessageRenderer extends AbstractRenderer<Message> {
return
this
;
return
this
;
List
<
Attachment
>
attachments
=
object
.
getAttachments
();
List
<
Attachment
>
attachments
=
object
.
getAttachments
();
if
(
attachments
==
null
||
attachments
.
size
()
==
0
)
if
(
attachments
==
null
||
attachments
.
size
()
==
0
)
{
attachmentsLayout
.
setVisibility
(
View
.
GONE
);
attachmentsLayout
.
setVisibility
(
View
.
GONE
);
else
{
}
else
{
attachmentsLayout
.
setVisibility
(
View
.
VISIBLE
);
attachmentsLayout
.
setVisibility
(
View
.
VISIBLE
);
attachmentsLayout
.
setAbsoluteUrl
(
absoluteUrl
);
attachmentsLayout
.
setAbsoluteUrl
(
absoluteUrl
);
attachmentsLayout
.
setAttachments
(
attachments
,
autoloadImages
);
attachmentsLayout
.
setAttachments
(
attachments
,
autoloadImages
);
...
@@ -136,16 +143,18 @@ public class MessageRenderer extends AbstractRenderer<Message> {
...
@@ -136,16 +143,18 @@ public class MessageRenderer extends AbstractRenderer<Message> {
}
}
private
void
aliasAndUsernameInto
(
TextView
aliasTextView
,
TextView
usernameTextView
)
{
private
void
aliasAndUsernameInto
(
TextView
aliasTextView
,
TextView
usernameTextView
)
{
if
(
shouldHandle
(
aliasTextView
))
if
(
shouldHandle
(
aliasTextView
))
{
aliasTextView
.
setText
(
object
.
getAlias
());
aliasTextView
.
setText
(
object
.
getAlias
());
}
if
(
shouldHandle
(
usernameTextView
))
{
if
(
shouldHandle
(
usernameTextView
))
{
if
(
object
.
getUser
()
!=
null
)
{
if
(
object
.
getUser
()
!=
null
)
{
usernameTextView
.
setText
(
"@"
+
object
.
getUser
().
getUsername
());
usernameTextView
.
setText
(
"@"
+
object
.
getUser
().
getUsername
());
usernameTextView
.
setVisibility
(
View
.
VISIBLE
);
usernameTextView
.
setVisibility
(
View
.
VISIBLE
);
}
else
}
else
{
usernameTextView
.
setVisibility
(
View
.
GONE
);
usernameTextView
.
setVisibility
(
View
.
GONE
);
}
}
}
}
}
}
}
\ No newline at end of file
rocket-chat-android-widgets/src/main/java/chat/rocket/android/widget/message/autocomplete/user/UserViewHolder.java
View file @
67b15ad9
...
@@ -54,15 +54,18 @@ public class UserViewHolder extends AutocompleteViewHolder<UserItem> {
...
@@ -54,15 +54,18 @@ public class UserViewHolder extends AutocompleteViewHolder<UserItem> {
final
String
suggestion
=
userItem
.
getSuggestion
();
final
String
suggestion
=
userItem
.
getSuggestion
();
if
(
titleTextView
!=
null
)
if
(
titleTextView
!=
null
)
{
titleTextView
.
setText
(
suggestion
);
titleTextView
.
setText
(
suggestion
);
}
if
(
avatar
!=
null
)
if
(
avatar
!=
null
)
{
avatar
.
loadImage
(
getImageUrl
(
suggestion
,
userItem
.
getAbsoluteUrl
()));
avatar
.
loadImage
(
getImageUrl
(
suggestion
,
userItem
.
getAbsoluteUrl
()));
}
if
(
status
!=
null
)
if
(
status
!=
null
)
{
status
.
setImageResource
(
userItem
.
getStatusResId
());
status
.
setImageResource
(
userItem
.
getStatusResId
());
}
}
}
@Override
@Override
public
void
showAsEmpty
()
{
public
void
showAsEmpty
()
{
...
...
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