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
c8a365ae
Commit
c8a365ae
authored
Mar 11, 2018
by
Leonardo Aramaki
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Clear scrapped reaction views and fix layout
parent
1f108732
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
18 additions
and
4 deletions
+18
-4
BaseViewHolder.kt
...va/chat/rocket/android/chatroom/adapter/BaseViewHolder.kt
+10
-3
MessageReactionsAdapter.kt
...ocket/android/chatroom/adapter/MessageReactionsAdapter.kt
+6
-0
ChatRoomFragment.kt
.../java/chat/rocket/android/chatroom/ui/ChatRoomFragment.kt
+1
-0
message_url_preview.xml
app/src/main/res/layout/message_url_preview.xml
+1
-1
No files found.
app/src/main/java/chat/rocket/android/chatroom/adapter/BaseViewHolder.kt
View file @
c8a365ae
...
@@ -32,13 +32,20 @@ abstract class BaseViewHolder<T : BaseViewModel<*>>(
...
@@ -32,13 +32,20 @@ abstract class BaseViewHolder<T : BaseViewModel<*>>(
private
fun
bindReactions
()
{
private
fun
bindReactions
()
{
data
?.
let
{
data
?.
let
{
val
recyclerView
=
itemView
.
findViewById
(
R
.
id
.
recycler_view_reactions
)
as
RecyclerView
val
adapter
:
MessageReactionsAdapter
if
(
recyclerView
.
adapter
==
null
)
{
adapter
=
MessageReactionsAdapter
()
}
else
{
adapter
=
recyclerView
.
adapter
as
MessageReactionsAdapter
adapter
.
clear
()
}
if
(
it
.
nextDownStreamMessage
==
null
)
{
if
(
it
.
nextDownStreamMessage
==
null
)
{
val
recyclerView
=
itemView
.
findViewById
(
R
.
id
.
recycler_view_reactions
)
as
RecyclerView
val
adapter
=
MessageReactionsAdapter
()
val
manager
=
GridLayoutManager
(
itemView
.
context
,
6
)
val
manager
=
GridLayoutManager
(
itemView
.
context
,
6
)
recyclerView
.
layoutManager
=
manager
recyclerView
.
layoutManager
=
manager
recyclerView
.
adapter
=
adapter
recyclerView
.
adapter
=
adapter
adapter
.
addReactions
(
it
.
reactions
)
adapter
.
addReactions
(
it
.
reactions
.
filterNot
{
it
.
shortname
.
startsWith
(
":"
)
}
)
}
}
}
}
}
}
...
...
app/src/main/java/chat/rocket/android/chatroom/adapter/MessageReactionsAdapter.kt
View file @
c8a365ae
...
@@ -34,6 +34,12 @@ class MessageReactionsAdapter : RecyclerView.Adapter<MessageReactionsViewHolder>
...
@@ -34,6 +34,12 @@ class MessageReactionsAdapter : RecyclerView.Adapter<MessageReactionsViewHolder>
notifyItemRangeInserted
(
0
,
reactions
.
size
)
notifyItemRangeInserted
(
0
,
reactions
.
size
)
}
}
fun
clear
()
{
val
oldSize
=
reactions
.
size
reactions
.
clear
()
notifyItemRangeRemoved
(
0
,
oldSize
)
}
class
MessageReactionsViewHolder
(
view
:
View
)
:
RecyclerView
.
ViewHolder
(
view
)
{
class
MessageReactionsViewHolder
(
view
:
View
)
:
RecyclerView
.
ViewHolder
(
view
)
{
@Inject
lateinit
var
localRepository
:
LocalRepository
@Inject
lateinit
var
localRepository
:
LocalRepository
...
...
app/src/main/java/chat/rocket/android/chatroom/ui/ChatRoomFragment.kt
View file @
c8a365ae
...
@@ -171,6 +171,7 @@ class ChatRoomFragment : Fragment(), ChatRoomView, EmojiKeyboardPopup.Listener {
...
@@ -171,6 +171,7 @@ class ChatRoomFragment : Fragment(), ChatRoomView, EmojiKeyboardPopup.Listener {
val
oldMessagesCount
=
adapter
.
itemCount
val
oldMessagesCount
=
adapter
.
itemCount
adapter
.
appendData
(
dataSet
)
adapter
.
appendData
(
dataSet
)
recycler_view
.
scrollToPosition
(
92
)
if
(
oldMessagesCount
==
0
&&
dataSet
.
isNotEmpty
())
{
if
(
oldMessagesCount
==
0
&&
dataSet
.
isNotEmpty
())
{
recycler_view
.
scrollToPosition
(
0
)
recycler_view
.
scrollToPosition
(
0
)
}
}
...
...
app/src/main/res/layout/message_url_preview.xml
View file @
c8a365ae
...
@@ -48,6 +48,6 @@
...
@@ -48,6 +48,6 @@
android:layout_width=
"0dp"
android:layout_width=
"0dp"
android:layout_height=
"wrap_content"
android:layout_height=
"wrap_content"
app:layout_constraintEnd_toEndOf=
"@+id/text_description"
app:layout_constraintEnd_toEndOf=
"@+id/text_description"
app:layout_constraintStart_toStartOf=
"@+id/
text_description
"
app:layout_constraintStart_toStartOf=
"@+id/
image_preview
"
app:layout_constraintTop_toBottomOf=
"@+id/text_description"
/>
app:layout_constraintTop_toBottomOf=
"@+id/text_description"
/>
</android.support.constraint.ConstraintLayout>
</android.support.constraint.ConstraintLayout>
\ No newline at end of file
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