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
66d709c3
Commit
66d709c3
authored
Jul 24, 2017
by
Filipe de Lima Brito
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add hostname attribute/parameter
parent
d27a602a
Changes
10
Hide whitespace changes
Inline
Side-by-side
Showing
10 changed files
with
49 additions
and
41 deletions
+49
-41
RoomFragment.java
...a/chat/rocket/android/fragment/chatroom/RoomFragment.java
+2
-2
UsersOfRoomDialogFragment.java
...d/fragment/chatroom/dialog/UsersOfRoomDialogFragment.java
+1
-1
SidebarMainFragment.java
.../rocket/android/fragment/sidebar/SidebarMainFragment.java
+4
-4
AddDirectMessageDialogFragment.java
...agment/sidebar/dialog/AddDirectMessageDialogFragment.java
+1
-1
AbstractMessageViewHolder.java
...roid/layouthelper/chatroom/AbstractMessageViewHolder.java
+3
-1
MessageListAdapter.java
...ket/android/layouthelper/chatroom/MessageListAdapter.java
+6
-4
MessageNormalViewHolder.java
...ndroid/layouthelper/chatroom/MessageNormalViewHolder.java
+9
-9
MessageSystemViewHolder.java
...ndroid/layouthelper/chatroom/MessageSystemViewHolder.java
+6
-7
RoomUserAdapter.java
...android/layouthelper/chatroom/dialog/RoomUserAdapter.java
+11
-8
SuggestUserAdapter.java
...droid/layouthelper/sidebar/dialog/SuggestUserAdapter.java
+6
-4
No files found.
app/src/main/java/chat/rocket/android/fragment/chatroom/RoomFragment.java
View file @
66d709c3
...
...
@@ -188,7 +188,7 @@ public class RoomFragment extends AbstractChatRoomFragment implements
protected
void
onSetupView
()
{
messageRecyclerView
=
rootView
.
findViewById
(
R
.
id
.
messageRecyclerView
);
messageListAdapter
=
new
MessageListAdapter
(
getContext
());
messageListAdapter
=
new
MessageListAdapter
(
getContext
()
,
hostname
);
messageRecyclerView
.
setAdapter
(
messageListAdapter
);
messageListAdapter
.
setOnItemClickListener
(
this
);
messageListAdapter
.
setOnItemLongClickListener
(
this
);
...
...
@@ -369,7 +369,7 @@ public class RoomFragment extends AbstractChatRoomFragment implements
new
DefaultTempSpotlightUserCaller
(
methodCallHelper
)
),
pair
.
first
.
get
(),
RocketChatUserStatusProvider
.
getInstance
()
,
RocketChatUserStatusProvider
.
INSTANCE
,
AndroidSchedulers
.
from
(
BackgroundLooper
.
get
()),
AndroidSchedulers
.
mainThread
()
)
...
...
app/src/main/java/chat/rocket/android/fragment/chatroom/dialog/UsersOfRoomDialogFragment.java
View file @
66d709c3
...
...
@@ -117,7 +117,7 @@ public class UsersOfRoomDialogFragment extends AbstractChatRoomDialogFragment {
RecyclerView
recyclerView
=
(
RecyclerView
)
getDialog
().
findViewById
(
R
.
id
.
recyclerview
);
recyclerView
.
setLayoutManager
(
new
GridLayoutManager
(
getContext
(),
2
));
recyclerView
.
setAdapter
(
new
RoomUserAdapter
(
getContext
(),
realmHelper
,
rocketChatAbsoluteUrlOptional
.
get
()));
new
RoomUserAdapter
(
getContext
(),
realmHelper
,
rocketChatAbsoluteUrlOptional
.
get
()
,
hostname
));
}
private
void
requestGetUsersOfRoom
()
{
...
...
app/src/main/java/chat/rocket/android/fragment/sidebar/SidebarMainFragment.java
View file @
66d709c3
...
...
@@ -224,10 +224,10 @@ public class SidebarMainFragment extends AbstractFragment implements SidebarMain
private
void
onRenderCurrentUser
(
User
user
,
RocketChatAbsoluteUrl
absoluteUrl
)
{
if
(
user
!=
null
&&
absoluteUrl
!=
null
)
{
new
UserRenderer
(
getContext
(),
user
)
.
avatarInto
(
rootView
.
findViewById
(
R
.
id
.
current_user_avatar
),
absoluteUrl
)
.
usernameInto
(
rootView
.
findViewById
(
R
.
id
.
current_user_name
))
.
statusColorInto
(
rootView
.
findViewById
(
R
.
id
.
current_user_status
));
UserRenderer
userRenderer
=
new
UserRenderer
(
user
);
userRenderer
.
showAvatar
(
rootView
.
findViewById
(
R
.
id
.
current_user_avatar
),
hostname
);
userRenderer
.
showUsername
(
rootView
.
findViewById
(
R
.
id
.
current_user_name
));
userRenderer
.
showStatusColor
(
rootView
.
findViewById
(
R
.
id
.
current_user_status
));
}
}
...
...
app/src/main/java/chat/rocket/android/fragment/sidebar/dialog/AddDirectMessageDialogFragment.java
View file @
66d709c3
...
...
@@ -97,7 +97,7 @@ public class AddDirectMessageDialogFragment extends AbstractAddRoomDialogFragmen
(
realm
,
text
)
->
realm
.
where
(
RealmUser
.
class
)
.
contains
(
RealmUser
.
USERNAME
,
text
,
Case
.
INSENSITIVE
)
.
findAllSorted
(
RealmUser
.
USERNAME
),
context
->
new
SuggestUserAdapter
(
context
,
rocketChatAbsoluteUrlOptional
.
get
()));
context
->
new
SuggestUserAdapter
(
context
,
rocketChatAbsoluteUrlOptional
.
get
()
,
hostname
));
autoCompleteTextView
.
setAdapter
(
adapter
);
}
...
...
app/src/main/java/chat/rocket/android/layouthelper/chatroom/AbstractMessageViewHolder.java
View file @
66d709c3
...
...
@@ -19,13 +19,14 @@ public abstract class AbstractMessageViewHolder extends ModelViewHolder<PairedMe
protected
final
TextView
timestamp
;
protected
final
View
userAndTimeContainer
;
protected
final
AbsoluteUrl
absoluteUrl
;
protected
final
String
hostname
;
protected
final
View
newDayContainer
;
protected
final
TextView
newDayText
;
/**
* constructor WITH hostname.
*/
public
AbstractMessageViewHolder
(
View
itemView
,
AbsoluteUrl
absoluteUrl
)
{
public
AbstractMessageViewHolder
(
View
itemView
,
AbsoluteUrl
absoluteUrl
,
String
hostname
)
{
super
(
itemView
);
avatar
=
itemView
.
findViewById
(
R
.
id
.
user_avatar
);
errorImageView
=
itemView
.
findViewById
(
R
.
id
.
errorImageView
);
...
...
@@ -36,6 +37,7 @@ public abstract class AbstractMessageViewHolder extends ModelViewHolder<PairedMe
newDayContainer
=
itemView
.
findViewById
(
R
.
id
.
newday_container
);
newDayText
=
itemView
.
findViewById
(
R
.
id
.
newday_text
);
this
.
absoluteUrl
=
absoluteUrl
;
this
.
hostname
=
hostname
;
}
/**
...
...
app/src/main/java/chat/rocket/android/layouthelper/chatroom/MessageListAdapter.java
View file @
66d709c3
...
...
@@ -22,14 +22,16 @@ public class MessageListAdapter extends ExtModelListAdapter<Message, PairedMessa
private
static
final
int
VIEW_TYPE_NORMAL_MESSAGE
=
1
;
private
static
final
int
VIEW_TYPE_SYSTEM_MESSAGE
=
2
;
private
String
hostname
;
private
AbsoluteUrl
absoluteUrl
;
private
boolean
autoloadImages
=
false
;
private
boolean
hasNext
;
private
boolean
isLoaded
;
public
MessageListAdapter
(
Context
context
)
{
public
MessageListAdapter
(
Context
context
,
String
hostname
)
{
super
(
context
);
this
.
hostname
=
hostname
;
}
public
void
setAbsoluteUrl
(
AbsoluteUrl
absoluteUrl
)
{
...
...
@@ -92,11 +94,11 @@ public class MessageListAdapter extends ExtModelListAdapter<Message, PairedMessa
protected
AbstractMessageViewHolder
onCreateRealmModelViewHolder
(
int
viewType
,
View
itemView
)
{
switch
(
viewType
)
{
case
VIEW_TYPE_NORMAL_MESSAGE:
return
new
MessageNormalViewHolder
(
itemView
,
absoluteUrl
);
return
new
MessageNormalViewHolder
(
itemView
,
absoluteUrl
,
hostname
);
case
VIEW_TYPE_SYSTEM_MESSAGE:
return
new
MessageSystemViewHolder
(
itemView
,
absoluteUrl
);
return
new
MessageSystemViewHolder
(
itemView
,
absoluteUrl
,
hostname
);
default
:
return
new
AbstractMessageViewHolder
(
itemView
,
absoluteUrl
)
{
return
new
AbstractMessageViewHolder
(
itemView
,
absoluteUrl
,
hostname
)
{
@Override
protected
void
bindMessage
(
PairedMessage
pairedMessage
,
boolean
autoloadImages
)
{}
};
...
...
app/src/main/java/chat/rocket/android/layouthelper/chatroom/MessageNormalViewHolder.java
View file @
66d709c3
...
...
@@ -19,8 +19,8 @@ public class MessageNormalViewHolder extends AbstractMessageViewHolder {
/**
* constructor WITH hostname.
*/
public
MessageNormalViewHolder
(
View
itemView
,
AbsoluteUrl
absoluteUrl
)
{
super
(
itemView
,
absoluteUrl
);
public
MessageNormalViewHolder
(
View
itemView
,
AbsoluteUrl
absoluteUrl
,
String
hostname
)
{
super
(
itemView
,
absoluteUrl
,
hostname
);
body
=
itemView
.
findViewById
(
R
.
id
.
message_body
);
urls
=
itemView
.
findViewById
(
R
.
id
.
message_urls
);
attachments
=
itemView
.
findViewById
(
R
.
id
.
message_attachments
);
...
...
@@ -28,12 +28,12 @@ public class MessageNormalViewHolder extends AbstractMessageViewHolder {
@Override
protected
void
bindMessage
(
PairedMessage
pairedMessage
,
boolean
autoloadImages
)
{
new
MessageRenderer
(
itemView
.
getContext
(),
pairedMessage
.
target
,
autoloadImages
)
.
avatarInto
(
avatar
,
absoluteUrl
)
.
usernameInto
(
username
,
subUsername
)
.
timestampInto
(
timestamp
)
.
bodyInto
(
body
)
.
urlsInto
(
urls
)
.
attachmentsInto
(
attachments
,
absoluteUrl
);
MessageRenderer
messageRenderer
=
new
MessageRenderer
(
pairedMessage
.
target
,
autoloadImages
);
messageRenderer
.
showAvatar
(
avatar
,
hostname
);
messageRenderer
.
showUsername
(
username
,
subUsername
);
messageRenderer
.
showTimestampOrMessageState
(
timestamp
);
messageRenderer
.
showBody
(
body
);
messageRenderer
.
showUrl
(
urls
);
messageRenderer
.
showAttachment
(
attachments
,
absoluteUrl
);
}
}
app/src/main/java/chat/rocket/android/layouthelper/chatroom/MessageSystemViewHolder.java
View file @
66d709c3
...
...
@@ -16,18 +16,17 @@ public class MessageSystemViewHolder extends AbstractMessageViewHolder {
/**
* constructor WITH hostname.
*/
public
MessageSystemViewHolder
(
View
itemView
,
AbsoluteUrl
absoluteUrl
)
{
super
(
itemView
,
absoluteUrl
);
public
MessageSystemViewHolder
(
View
itemView
,
AbsoluteUrl
absoluteUrl
,
String
hostname
)
{
super
(
itemView
,
absoluteUrl
,
hostname
);
body
=
itemView
.
findViewById
(
R
.
id
.
message_body
);
}
@Override
protected
void
bindMessage
(
PairedMessage
pairedMessage
,
boolean
autoloadImages
)
{
new
MessageRenderer
(
itemView
.
getContext
(),
pairedMessage
.
target
,
autoloadImages
)
.
avatarInto
(
avatar
,
absoluteUrl
)
.
usernameInto
(
username
,
subUsername
)
.
timestampInto
(
timestamp
);
MessageRenderer
messageRenderer
=
new
MessageRenderer
(
pairedMessage
.
target
,
autoloadImages
);
messageRenderer
.
showAvatar
(
avatar
,
hostname
);
messageRenderer
.
showUsername
(
username
,
subUsername
);
messageRenderer
.
showTimestampOrMessageState
(
timestamp
);
if
(
pairedMessage
.
target
!=
null
)
{
body
.
setText
(
MessageType
.
parse
(
pairedMessage
.
target
.
getType
())
.
getString
(
body
.
getContext
(),
pairedMessage
.
target
));
...
...
app/src/main/java/chat/rocket/android/layouthelper/chatroom/dialog/RoomUserAdapter.java
View file @
66d709c3
...
...
@@ -24,16 +24,18 @@ public class RoomUserAdapter extends RecyclerView.Adapter<RoomUserViewHolder> {
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
)
{
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
...
...
@@ -57,14 +59,15 @@ public class RoomUserAdapter extends RecyclerView.Adapter<RoomUserViewHolder> {
.
setUsername
(
username
)
.
setUtcOffset
(
0
)
.
build
();
new
UserRenderer
(
context
,
user
)
.
avatarInto
(
holder
.
avatar
,
absoluteUrl
)
.
usernameInto
(
holder
.
username
);
UserRenderer
userRenderer
=
new
UserRenderer
(
user
);
userRenderer
.
showAvatar
(
holder
.
avatar
,
hostname
);
userRenderer
.
showUsername
(
holder
.
username
);
}
else
{
new
UserRenderer
(
context
,
realmUser
.
asUser
())
.
statusColorInto
(
holder
.
status
)
.
avatarInto
(
holder
.
avatar
,
absoluteUrl
)
.
usernameInto
(
holder
.
username
);
UserRenderer
userRenderer
=
new
UserRenderer
(
realmUser
.
asUser
());
userRenderer
.
showAvatar
(
holder
.
avatar
,
hostname
);
userRenderer
.
showUsername
(
holder
.
username
);
userRenderer
.
showStatusColor
(
holder
.
status
);
}
}
...
...
app/src/main/java/chat/rocket/android/layouthelper/sidebar/dialog/SuggestUserAdapter.java
View file @
66d709c3
...
...
@@ -16,17 +16,19 @@ import chat.rocket.android.renderer.UserRenderer;
*/
public
class
SuggestUserAdapter
extends
RealmAutoCompleteAdapter
<
RealmUser
>
{
private
final
AbsoluteUrl
absoluteUrl
;
private
final
String
hostname
;
public
SuggestUserAdapter
(
Context
context
,
AbsoluteUrl
absoluteUrl
)
{
public
SuggestUserAdapter
(
Context
context
,
AbsoluteUrl
absoluteUrl
,
String
hostname
)
{
super
(
context
,
R
.
layout
.
listitem_room_user
,
R
.
id
.
room_user_name
);
this
.
absoluteUrl
=
absoluteUrl
;
this
.
hostname
=
hostname
;
}
@Override
protected
void
onBindItemView
(
View
itemView
,
RealmUser
user
)
{
new
UserRenderer
(
itemView
.
getContext
(),
user
.
asUser
())
.
statusColorInto
(
itemView
.
findViewById
(
R
.
id
.
room_user_status
))
.
avatarInto
(
itemView
.
findViewById
(
R
.
id
.
room_user_avatar
),
absoluteUrl
);
UserRenderer
userRenderer
=
new
UserRenderer
(
user
.
asUser
());
userRenderer
.
showStatusColor
(
itemView
.
findViewById
(
R
.
id
.
room_user_status
));
userRenderer
.
showAvatar
(
itemView
.
findViewById
(
R
.
id
.
room_user_avatar
),
hostname
);
}
@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