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
fe4bbdbc
Commit
fe4bbdbc
authored
Sep 17, 2017
by
Filipe de Lima Brito
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Delete dialog/RoomUserAdapter.java
parent
eb180b7a
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
0 additions
and
83 deletions
+0
-83
RoomUserAdapter.java
...android/layouthelper/chatroom/dialog/RoomUserAdapter.java
+0
-83
No files found.
app/src/main/java/chat/rocket/android/layouthelper/chatroom/dialog/RoomUserAdapter.java
deleted
100644 → 0
View file @
eb180b7a
package
chat
.
rocket
.
android
.
layouthelper
.
chatroom
.
dialog
;
import
android.content.Context
;
import
android.support.v7.widget.RecyclerView
;
import
android.view.LayoutInflater
;
import
android.view.View
;
import
android.view.ViewGroup
;
import
java.util.List
;
import
chat.rocket.android.R
;
import
chat.rocket.android.helper.TextUtils
;
import
chat.rocket.android.widget.AbsoluteUrl
;
import
chat.rocket.core.models.User
;
import
chat.rocket.persistence.realm.models.ddp.RealmUser
;
import
chat.rocket.persistence.realm.RealmHelper
;
import
chat.rocket.android.renderer.UserRenderer
;
/**
* RecyclerView adapter for UsersOfRooms.
*/
public
class
RoomUserAdapter
extends
RecyclerView
.
Adapter
<
RoomUserViewHolder
>
{
private
final
Context
context
;
private
final
LayoutInflater
inflater
;
private
final
RealmHelper
realmHelper
;
private
final
AbsoluteUrl
absoluteUrl
;
private
final
String
hostname
;
private
List
<
String
>
usernames
;
/**
* Constructor with required parameters.
*/
public
RoomUserAdapter
(
Context
context
,
RealmHelper
realmHelper
,
AbsoluteUrl
absoluteUrl
,
String
hostname
)
{
this
.
context
=
context
;
this
.
inflater
=
LayoutInflater
.
from
(
context
);
this
.
realmHelper
=
realmHelper
;
this
.
absoluteUrl
=
absoluteUrl
;
this
.
hostname
=
hostname
;
}
@Override
public
RoomUserViewHolder
onCreateViewHolder
(
ViewGroup
parent
,
int
viewType
)
{
View
itemView
=
inflater
.
inflate
(
R
.
layout
.
listitem_room_user
,
parent
,
false
);
return
new
RoomUserViewHolder
(
itemView
);
}
@Override
public
void
onBindViewHolder
(
RoomUserViewHolder
holder
,
int
position
)
{
String
username
=
usernames
.
get
(
position
);
if
(
TextUtils
.
isEmpty
(
username
))
{
return
;
}
RealmUser
realmUser
=
realmHelper
.
executeTransactionForRead
(
realm
->
realm
.
where
(
RealmUser
.
class
).
equalTo
(
RealmUser
.
USERNAME
,
username
).
findFirst
());
if
(
realmUser
==
null
)
{
User
user
=
User
.
builder
()
.
setId
(
"some-local-is"
)
.
setUsername
(
username
)
.
setUtcOffset
(
0
)
.
build
();
UserRenderer
userRenderer
=
new
UserRenderer
(
user
);
userRenderer
.
showAvatar
(
holder
.
avatar
,
hostname
);
userRenderer
.
showUsername
(
holder
.
username
);
}
else
{
UserRenderer
userRenderer
=
new
UserRenderer
(
realmUser
.
asUser
());
userRenderer
.
showAvatar
(
holder
.
avatar
,
hostname
);
userRenderer
.
showUsername
(
holder
.
username
);
userRenderer
.
showStatusColor
(
holder
.
status
);
}
}
@Override
public
int
getItemCount
()
{
return
usernames
!=
null
?
usernames
.
size
()
:
0
;
}
public
void
setUsernames
(
List
<
String
>
usernames
)
{
this
.
usernames
=
usernames
;
notifyDataSetChanged
();
}
}
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