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
07a613d3
Commit
07a613d3
authored
Mar 13, 2018
by
Leonardo Aramaki
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add adapter check before accepting a new suggestion provider
parent
c101b39a
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
5 additions
and
0 deletions
+5
-0
ChatRoomSuggestionViewModel.kt
...troom/viewmodel/suggestion/ChatRoomSuggestionViewModel.kt
+0
-0
PeopleSuggestionViewModel.kt
...hatroom/viewmodel/suggestion/PeopleSuggestionViewModel.kt
+0
-0
SuggestionsView.kt
...ocket/android/widget/autocompletion/ui/SuggestionsView.kt
+5
-0
No files found.
app/src/main/java/chat/rocket/android/chatroom/viewmodel/
ChatRoom
ViewModel.kt
→
app/src/main/java/chat/rocket/android/chatroom/viewmodel/
suggestion/ChatRoomSuggestion
ViewModel.kt
View file @
07a613d3
File moved
app/src/main/java/chat/rocket/android/chatroom/viewmodel/
People
ViewModel.kt
→
app/src/main/java/chat/rocket/android/chatroom/viewmodel/
suggestion/PeopleSuggestion
ViewModel.kt
View file @
07a613d3
File moved
app/src/main/java/chat/rocket/android/widget/autocompletion/ui/SuggestionsView.kt
View file @
07a613d3
...
...
@@ -22,6 +22,7 @@ import android.widget.FrameLayout
import
chat.rocket.android.R
import
chat.rocket.android.widget.autocompletion.model.SuggestionModel
import
java.lang.ref.WeakReference
import
java.util.concurrent.CopyOnWriteArrayList
import
java.util.concurrent.atomic.AtomicInteger
/**
...
...
@@ -31,6 +32,7 @@ private const val NO_STATE_INDEX = 0
class
SuggestionsView
:
FrameLayout
,
TextWatcher
{
private
val
recyclerView
:
RecyclerView
private
val
registeredTokens
=
CopyOnWriteArrayList
<
String
>()
// Maps tokens to their respective adapters.
private
val
adaptersByToken
=
hashMapOf
<
String
,
SuggestionsAdapter
<
out
BaseSuggestionViewHolder
>>()
private
val
externalProvidersByToken
=
hashMapOf
<
String
,
((
query
:
String
)
->
Unit
)>()
...
...
@@ -160,6 +162,9 @@ class SuggestionsView : FrameLayout, TextWatcher {
}
fun
addSuggestionProviderAction
(
token
:
String
,
provider
:
(
query
:
String
)
->
Unit
):
SuggestionsView
{
if
(
adaptersByToken
[
token
]
==
null
)
{
throw
IllegalStateException
(
"token \"$token\" suggestion provider added without adapter"
)
}
externalProvidersByToken
.
getOrPut
(
token
,
{
provider
})
return
this
}
...
...
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