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
60132da4
Commit
60132da4
authored
Aug 29, 2017
by
Filipe de Lima Brito
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Update RoomListItemViewHolder.java
parent
d9bbcd40
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
64 additions
and
15 deletions
+64
-15
RoomListItemViewHolder.java
...ayouthelper/chatroom/roomlist/RoomListItemViewHolder.java
+64
-15
No files found.
app/src/main/java/chat/rocket/android/layouthelper/chatroom/roomlist/RoomListItemViewHolder.java
View file @
60132da4
...
...
@@ -5,42 +5,91 @@ import android.support.v7.widget.RecyclerView;
import
chat.rocket.android.widget.internal.RoomListItemView
;
import
chat.rocket.core.models.Room
;
import
chat.rocket.core.models.Spotlight
;
import
chat.rocket.core.models.User
;
public
class
RoomListItemViewHolder
extends
RecyclerView
.
ViewHolder
{
public
RoomListItemViewHolder
(
RoomListItemView
itemView
,
RoomListAdapter
.
OnItemClickListener
listener
)
{
private
RoomListItemView
itemView
;
public
RoomListItemViewHolder
(
RoomListItemView
itemView
,
RoomListAdapter
.
OnItemClickListener
listener
)
{
super
(
itemView
);
this
.
itemView
=
itemView
;
itemView
.
setOnClickListener
(
view
->
{
if
(
listener
!=
null
)
{
Object
tag
=
view
.
getTag
();
if
(
tag
instanceof
Room
)
{
listener
.
onItemClick
((
Room
)
view
.
getTag
());
}
else
if
(
tag
instanceof
Spotlight
)
{
listener
.
onItemClick
((
Spotlight
)
view
.
getTag
());
}
Object
object
=
view
.
getTag
();
if
(
object
instanceof
Room
)
{
listener
.
onItemClick
((
Room
)
object
);
}
else
if
(
object
instanceof
Spotlight
)
{
listener
.
onItemClick
((
Spotlight
)
object
);
}
});
}
public
void
bind
(
Room
room
)
{
((
RoomListItemView
)
itemView
)
itemView
.
setRoomId
(
room
.
getRoomId
())
.
setRoomName
(
room
.
getName
())
.
setRoomType
(
room
.
getType
())
.
setAlert
(
room
.
isAlert
())
.
setUnreadCount
(
room
.
getUnread
())
.
setTag
(
room
);
showRoomIcon
(
room
.
getType
());
}
public
void
bind
(
Spotlight
spotlight
)
{
((
RoomListItemView
)
itemView
)
itemView
.
setRoomId
(
spotlight
.
getId
())
.
setRoomName
(
spotlight
.
getName
())
.
setRoomType
(
spotlight
.
getType
())
.
setAlert
(
false
)
.
setUnreadCount
(
0
)
.
setTag
(
spotlight
);
showRoomIcon
(
spotlight
.
getType
());
}
/**
* Only shows the room icon if it is a PRIVATE CHANNEL or PUBLIC CHANNEL, otherwise you should use {@link #bind(User)} to show the correct icon.
* @param roomType The type of Room.
* @see Room
*/
private
void
showRoomIcon
(
String
roomType
)
{
if
(!
roomType
.
equals
(
Room
.
TYPE_DIRECT_MESSAGE
))
{
switch
(
roomType
)
{
case
Room
.
TYPE_CHANNEL
:
itemView
.
showPublicChannelIcon
();
break
;
case
Room
.
TYPE_PRIVATE
:
itemView
.
showPrivateChannelIcon
();
break
;
}
}
}
/**
* Shows the user status icon.
* @param user The user to show its status.
* @see User
*/
public
void
bind
(
User
user
)
{
String
userStatus
=
user
.
getStatus
();
if
(
userStatus
==
null
)
{
itemView
.
showOfflineUserStatusIcon
();
}
else
{
switch
(
user
.
getStatus
())
{
case
User
.
STATUS_ONLINE
:
itemView
.
showOnlineUserStatusIcon
();
break
;
case
User
.
STATUS_BUSY
:
itemView
.
showBusyUserStatusIcon
();
break
;
case
User
.
STATUS_AWAY
:
itemView
.
showAwayUserStatusIcon
();
break
;
default
:
itemView
.
showOfflineUserStatusIcon
();
break
;
}
}
}
}
}
\ No newline at end of file
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