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
a3e1058c
Commit
a3e1058c
authored
May 14, 2019
by
Filipe de Lima Brito
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Improve code.
parent
c0b2083b
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
30 additions
and
23 deletions
+30
-23
ChatRoomFragment.kt
.../java/chat/rocket/android/chatroom/ui/ChatRoomFragment.kt
+30
-23
No files found.
app/src/main/java/chat/rocket/android/chatroom/ui/ChatRoomFragment.kt
View file @
a3e1058c
...
...
@@ -809,39 +809,46 @@ class ChatRoomFragment : Fragment(), ChatRoomView, EmojiKeyboardListener, EmojiR
recycler_view
.
addOnScrollListener
(
fabScrollListener
)
if
(!
isReadOnly
)
{
val
touchCallback
:
ItemTouchHelper
.
SimpleCallback
=
object
:
ItemTouchHelper
.
SimpleCallback
(
0
,
ItemTouchHelper
.
LEFT
)
{
override
fun
onMove
(
recyclerView
:
RecyclerView
,
viewHolder
:
RecyclerView
.
ViewHolder
,
target
:
RecyclerView
.
ViewHolder
):
Boolean
{
return
true
}
val
touchCallback
:
ItemTouchHelper
.
SimpleCallback
=
object
:
ItemTouchHelper
.
SimpleCallback
(
0
,
ItemTouchHelper
.
LEFT
)
{
override
fun
onMove
(
recyclerView
:
RecyclerView
,
viewHolder
:
RecyclerView
.
ViewHolder
,
target
:
RecyclerView
.
ViewHolder
):
Boolean
{
return
true
}
override
fun
onSwiped
(
viewHolder
:
RecyclerView
.
ViewHolder
,
direction
:
Int
)
{
var
replyId
:
String
?
=
null
override
fun
onSwiped
(
viewHolder
:
RecyclerView
.
ViewHolder
,
direction
:
Int
)
{
var
replyId
:
String
?
=
null
when
(
viewHolder
)
{
is
MessageViewHolder
->
replyId
=
viewHolder
.
data
?.
messageId
is
AttachmentViewHolder
->
replyId
=
viewHolder
.
data
?.
messageId
}
when
(
viewHolder
)
{
is
MessageViewHolder
->
replyId
=
viewHolder
.
data
?.
messageId
is
AttachmentViewHolder
->
replyId
=
viewHolder
.
data
?.
messageId
}
replyId
?.
let
{
citeMessage
(
chatRoomName
,
chatRoomType
,
it
,
true
)
}
replyId
?.
let
{
citeMessage
(
chatRoomName
,
chatRoomType
,
it
,
true
)
adapter
.
notifyItemChanged
(
viewHolder
.
adapterPosition
)
}
adapter
.
notifyItemChanged
(
viewHolder
.
adapterPosition
)
}
override
fun
getSwipeDirs
(
recyclerView
:
RecyclerView
,
viewHolder
:
RecyclerView
.
ViewHolder
):
Int
{
// Currently enable swipes for text and attachment messages only
override
fun
getSwipeDirs
(
recyclerView
:
RecyclerView
,
viewHolder
:
RecyclerView
.
ViewHolder
):
Int
{
// Currently enable swipes for text and attachment messages only
if
(
viewHolder
is
MessageViewHolder
||
viewHolder
is
AttachmentViewHolder
)
{
return
super
.
getSwipeDirs
(
recyclerView
,
viewHolder
)
}
if
(
viewHolder
is
MessageViewHolder
||
viewHolder
is
AttachmentViewHolder
)
{
return
super
.
getSwipeDirs
(
recyclerView
,
viewHolder
)
return
0
}
return
0
}
}
val
itemTouchHelper
=
ItemTouchHelper
(
touchCallback
)
itemTouchHelper
.
attachToRecyclerView
(
recycler_view
)
ItemTouchHelper
(
touchCallback
).
attachToRecyclerView
(
recycler_view
)
}
}
...
...
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