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
1fd253cc
Unverified
Commit
1fd253cc
authored
May 14, 2019
by
Filipe Brito
Committed by
GitHub
May 14, 2019
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #2287 from RobotJINI/develop
[IMPROVEMENT] Immediate message loading
parents
475f195e
ccec99f5
Changes
2
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
163 additions
and
123 deletions
+163
-123
ChatRoomPresenter.kt
...rocket/android/chatroom/presentation/ChatRoomPresenter.kt
+156
-106
ChatRoomFragment.kt
.../java/chat/rocket/android/chatroom/ui/ChatRoomFragment.kt
+7
-17
No files found.
app/src/main/java/chat/rocket/android/chatroom/presentation/ChatRoomPresenter.kt
View file @
1fd253cc
This diff is collapsed.
Click to expand it.
app/src/main/java/chat/rocket/android/chatroom/ui/ChatRoomFragment.kt
View file @
1fd253cc
...
@@ -429,25 +429,12 @@ class ChatRoomFragment : Fragment(), ChatRoomView, EmojiKeyboardListener, EmojiR
...
@@ -429,25 +429,12 @@ class ChatRoomFragment : Fragment(), ChatRoomView, EmojiKeyboardListener, EmojiR
}
}
}
}
if
(
recycler_view
.
adapter
==
null
)
{
recycler_view
.
adapter
=
adapter
if
(
dataSet
.
size
>=
30
)
{
recycler_view
.
addOnScrollListener
(
endlessRecyclerViewScrollListener
)
}
recycler_view
.
addOnLayoutChangeListener
(
layoutChangeListener
)
recycler_view
.
addOnScrollListener
(
onScrollListener
)
// Load just once, on the first page...
presenter
.
loadActiveMembers
(
chatRoomId
,
chatRoomType
,
filterSelfOut
=
true
)
}
val
oldMessagesCount
=
adapter
.
itemCount
val
oldMessagesCount
=
adapter
.
itemCount
adapter
.
appendData
(
dataSet
)
adapter
.
appendData
(
dataSet
)
if
(
oldMessagesCount
==
0
&&
dataSet
.
isNotEmpty
())
{
if
(
oldMessagesCount
==
0
&&
dataSet
.
isNotEmpty
())
{
recycler_view
.
scrollToPosition
(
0
)
recycler_view
.
scrollToPosition
(
0
)
verticalScrollOffset
.
set
(
0
)
verticalScrollOffset
.
set
(
0
)
}
}
presenter
.
loadActiveMembers
(
chatRoomId
,
chatRoomType
,
filterSelfOut
=
true
)
empty_chat_view
.
isVisible
=
adapter
.
itemCount
==
0
empty_chat_view
.
isVisible
=
adapter
.
itemCount
==
0
dismissEmojiKeyboard
()
dismissEmojiKeyboard
()
}
}
...
@@ -469,10 +456,8 @@ class ChatRoomFragment : Fragment(), ChatRoomView, EmojiKeyboardListener, EmojiR
...
@@ -469,10 +456,8 @@ class ChatRoomFragment : Fragment(), ChatRoomView, EmojiKeyboardListener, EmojiR
setupMessageComposer
(
roomUiModel
)
setupMessageComposer
(
roomUiModel
)
isBroadcastChannel
=
roomUiModel
.
broadcast
isBroadcastChannel
=
roomUiModel
.
broadcast
isFavorite
=
roomUiModel
.
favorite
.
orFalse
()
isFavorite
=
roomUiModel
.
favorite
.
orFalse
()
if
(
isBroadcastChannel
&&
!
roomUiModel
.
canModerate
)
{
disableMenu
=
(
roomUiModel
.
broadcast
&&
!
roomUiModel
.
canModerate
)
disableMenu
=
true
activity
?.
invalidateOptionsMenu
()
activity
?.
invalidateOptionsMenu
()
}
}
}
}
}
...
@@ -807,7 +792,12 @@ class ChatRoomFragment : Fragment(), ChatRoomView, EmojiKeyboardListener, EmojiR
...
@@ -807,7 +792,12 @@ class ChatRoomFragment : Fragment(), ChatRoomView, EmojiKeyboardListener, EmojiR
presenter
.
loadMessages
(
chatRoomId
,
chatRoomType
,
page
*
30L
)
presenter
.
loadMessages
(
chatRoomId
,
chatRoomType
,
page
*
30L
)
}
}
}
}
recycler_view
.
adapter
=
adapter
recycler_view
.
addOnScrollListener
(
fabScrollListener
)
recycler_view
.
addOnScrollListener
(
fabScrollListener
)
recycler_view
.
addOnScrollListener
(
endlessRecyclerViewScrollListener
)
recycler_view
.
addOnLayoutChangeListener
(
layoutChangeListener
)
recycler_view
.
addOnScrollListener
(
onScrollListener
)
}
}
private
fun
setupFab
()
{
private
fun
setupFab
()
{
...
...
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