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
7f4982bd
Commit
7f4982bd
authored
May 14, 2019
by
Filipe de Lima Brito
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Update ChatRoomFragment
parent
113721ab
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
22 additions
and
24 deletions
+22
-24
ChatRoomFragment.kt
.../java/chat/rocket/android/chatroom/ui/ChatRoomFragment.kt
+22
-24
No files found.
app/src/main/java/chat/rocket/android/chatroom/ui/ChatRoomFragment.kt
View file @
7f4982bd
...
...
@@ -159,7 +159,7 @@ class ChatRoomFragment : Fragment(), ChatRoomView, EmojiKeyboardListener, EmojiR
lateinit
var
analyticsManager
:
AnalyticsManager
@Inject
lateinit
var
navigator
:
ChatRoomNavigator
private
lateinit
var
a
dapter
:
ChatRoomAdapter
private
lateinit
var
chatRoomA
dapter
:
ChatRoomAdapter
internal
lateinit
var
chatRoomId
:
String
private
lateinit
var
chatRoomName
:
String
internal
lateinit
var
chatRoomType
:
String
...
...
@@ -292,7 +292,7 @@ class ChatRoomFragment : Fragment(), ChatRoomView, EmojiKeyboardListener, EmojiR
}
?:
requireNotNull
(
arguments
)
{
"no arguments supplied when the fragment was instantiated"
}
a
dapter
=
ChatRoomAdapter
(
chatRoomA
dapter
=
ChatRoomAdapter
(
roomId
=
chatRoomId
,
roomType
=
chatRoomType
,
roomName
=
chatRoomName
,
...
...
@@ -391,7 +391,7 @@ class ChatRoomFragment : Fragment(), ChatRoomView, EmojiKeyboardListener, EmojiR
override
fun
showMessages
(
dataSet
:
List
<
BaseUiModel
<*
>>,
clearDataSet
:
Boolean
)
{
ui
{
if
(
clearDataSet
)
{
a
dapter
.
clearData
()
chatRoomA
dapter
.
clearData
()
}
if
(
dataSet
.
isNotEmpty
())
{
...
...
@@ -432,22 +432,22 @@ class ChatRoomFragment : Fragment(), ChatRoomView, EmojiKeyboardListener, EmojiR
}
}
val
oldMessagesCount
=
a
dapter
.
itemCount
a
dapter
.
appendData
(
dataSet
)
val
oldMessagesCount
=
chatRoomA
dapter
.
itemCount
chatRoomA
dapter
.
appendData
(
dataSet
)
if
(
oldMessagesCount
==
0
&&
dataSet
.
isNotEmpty
())
{
recycler_view
.
scrollToPosition
(
0
)
verticalScrollOffset
.
set
(
0
)
}
empty_chat_view
.
isVisible
=
a
dapter
.
itemCount
==
0
empty_chat_view
.
isVisible
=
chatRoomA
dapter
.
itemCount
==
0
dismissEmojiKeyboard
()
}
}
override
fun
showSearchedMessages
(
dataSet
:
List
<
BaseUiModel
<*
>>)
{
recycler_view
.
removeOnScrollListener
(
endlessRecyclerViewScrollListener
)
a
dapter
.
clearData
()
a
dapter
.
prependData
(
dataSet
)
empty_chat_view
.
isVisible
=
a
dapter
.
itemCount
==
0
chatRoomA
dapter
.
clearData
()
chatRoomA
dapter
.
prependData
(
dataSet
)
empty_chat_view
.
isVisible
=
chatRoomA
dapter
.
itemCount
==
0
dismissEmojiKeyboard
()
}
...
...
@@ -530,7 +530,7 @@ class ChatRoomFragment : Fragment(), ChatRoomView, EmojiKeyboardListener, EmojiR
override
fun
showNewMessage
(
message
:
List
<
BaseUiModel
<*
>>,
isMessageReceived
:
Boolean
)
{
ui
{
a
dapter
.
prependData
(
message
)
chatRoomA
dapter
.
prependData
(
message
)
if
(
isMessageReceived
&&
button_fab
.
isVisible
)
{
newMessageCount
++
if
(
newMessageCount
<=
99
)
{
...
...
@@ -543,7 +543,7 @@ class ChatRoomFragment : Fragment(), ChatRoomView, EmojiKeyboardListener, EmojiR
recycler_view
.
scrollToPosition
(
0
)
}
verticalScrollOffset
.
set
(
0
)
empty_chat_view
.
isVisible
=
a
dapter
.
itemCount
==
0
empty_chat_view
.
isVisible
=
chatRoomA
dapter
.
itemCount
==
0
dismissEmojiKeyboard
()
}
}
...
...
@@ -553,9 +553,9 @@ class ChatRoomFragment : Fragment(), ChatRoomView, EmojiKeyboardListener, EmojiR
// TODO - investigate WHY we get a empty list here
if
(
message
.
isEmpty
())
return
@ui
if
(
a
dapter
.
updateItem
(
message
.
last
()))
{
if
(
chatRoomA
dapter
.
updateItem
(
message
.
last
()))
{
if
(
message
.
size
>
1
)
{
a
dapter
.
prependData
(
listOf
(
message
.
first
()))
chatRoomA
dapter
.
prependData
(
listOf
(
message
.
first
()))
}
}
else
{
showNewMessage
(
message
,
true
)
...
...
@@ -566,7 +566,7 @@ class ChatRoomFragment : Fragment(), ChatRoomView, EmojiKeyboardListener, EmojiR
override
fun
dispatchDeleteMessage
(
msgId
:
String
)
{
ui
{
a
dapter
.
removeItem
(
msgId
)
chatRoomA
dapter
.
removeItem
(
msgId
)
}
}
...
...
@@ -796,10 +796,13 @@ class ChatRoomFragment : Fragment(), ChatRoomView, EmojiKeyboardListener, EmojiR
}
}
recycler_view
.
adapter
=
adapter
recycler_view
.
addOnScrollListener
(
fabScrollListener
)
<<<<<<<
HEAD
with
(
recycler_view
)
{
adapter
=
chatRoomAdapter
addOnScrollListener
(
endlessRecyclerViewScrollListener
)
addOnLayoutChangeListener
(
layoutChangeListener
)
addOnScrollListener
(
onScrollListener
)
addOnScrollListener
(
fabScrollListener
)
}
if
(!
isReadOnly
)
{
val
touchCallback
:
ItemTouchHelper
.
SimpleCallback
=
object
:
ItemTouchHelper
.
SimpleCallback
(
0
,
ItemTouchHelper
.
LEFT
)
{
...
...
@@ -823,7 +826,7 @@ class ChatRoomFragment : Fragment(), ChatRoomView, EmojiKeyboardListener, EmojiR
citeMessage
(
chatRoomName
,
chatRoomType
,
it
,
true
)
}
a
dapter
.
notifyItemChanged
(
viewHolder
.
adapterPosition
)
chatRoomA
dapter
.
notifyItemChanged
(
viewHolder
.
adapterPosition
)
}
override
fun
getSwipeDirs
(
...
...
@@ -842,11 +845,6 @@ class ChatRoomFragment : Fragment(), ChatRoomView, EmojiKeyboardListener, EmojiR
ItemTouchHelper
(
touchCallback
).
attachToRecyclerView
(
recycler_view
)
}
=======
recycler_view
.
addOnScrollListener
(
endlessRecyclerViewScrollListener
)
recycler_view
.
addOnLayoutChangeListener
(
layoutChangeListener
)
recycler_view
.
addOnScrollListener
(
onScrollListener
)
>>>>>>>
723
d155d8ddb338969a1b784cc5273eadfeb5b0b
}
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