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
94949958
Commit
94949958
authored
May 24, 2018
by
aniket
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
supports infinite scrolling for search results
parent
89aad912
Changes
5
Show whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
23 additions
and
20 deletions
+23
-20
AddMembersPresenter.kt
...ateChannel/addMembers/presentation/AddMembersPresenter.kt
+2
-2
AddMembersActivity.kt
...android/createChannel/addMembers/ui/AddMembersActivity.kt
+17
-14
CreateNewChannelActivity.kt
...cket/android/createChannel/ui/CreateNewChannelActivity.kt
+0
-1
MembersFragment.kt
...in/java/chat/rocket/android/members/ui/MembersFragment.kt
+0
-1
activity_add_members.xml
app/src/main/res/layout/activity_add_members.xml
+4
-2
No files found.
app/src/main/java/chat/rocket/android/createChannel/addMembers/presentation/AddMembersPresenter.kt
View file @
94949958
...
@@ -22,13 +22,13 @@ class AddMembersPresenter @Inject constructor(
...
@@ -22,13 +22,13 @@ class AddMembersPresenter @Inject constructor(
val
serverUrl
:
String
?
=
serverInteractor
.
get
()
val
serverUrl
:
String
?
=
serverInteractor
.
get
()
private
val
client
=
if
(
serverUrl
!=
null
)
factory
.
create
(
serverUrl
)
else
null
private
val
client
=
if
(
serverUrl
!=
null
)
factory
.
create
(
serverUrl
)
else
null
fun
queryUsersFromRegex
(
queryParam
:
String
)
{
fun
queryUsersFromRegex
(
queryParam
:
String
,
offset
:
Long
=
0
)
{
if
(
client
!=
null
)
{
if
(
client
!=
null
)
{
view
.
showLoading
()
view
.
showLoading
()
launchUI
(
strategy
)
{
launchUI
(
strategy
)
{
try
{
try
{
val
allMembers
=
retryIO
(
"queryUsers($queryParam)"
)
{
val
allMembers
=
retryIO
(
"queryUsers($queryParam)"
)
{
client
.
queryUsers
(
queryParam
)
client
.
queryUsers
(
queryParam
,
60
,
offset
)
}
}
val
memberViewModelMapper
=
mapper
.
mapToViewModelList
(
allMembers
.
result
)
val
memberViewModelMapper
=
mapper
.
mapToViewModelList
(
allMembers
.
result
)
view
.
showMembers
(
memberViewModelMapper
,
allMembers
.
total
)
view
.
showMembers
(
memberViewModelMapper
,
allMembers
.
total
)
...
...
app/src/main/java/chat/rocket/android/createChannel/addMembers/ui/AddMembersActivity.kt
View file @
94949958
...
@@ -6,12 +6,14 @@ import android.os.Bundle
...
@@ -6,12 +6,14 @@ import android.os.Bundle
import
android.support.design.chip.Chip
import
android.support.design.chip.Chip
import
android.support.v7.app.AppCompatActivity
import
android.support.v7.app.AppCompatActivity
import
android.support.v7.widget.LinearLayoutManager
import
android.support.v7.widget.LinearLayoutManager
import
android.support.v7.widget.RecyclerView
import
android.view.MenuItem
import
android.view.MenuItem
import
android.widget.EditText
import
android.widget.EditText
import
android.widget.Toast
import
android.widget.Toast
import
chat.rocket.android.R
import
chat.rocket.android.R
import
chat.rocket.android.createChannel.addMembers.presentation.AddMembersPresenter
import
chat.rocket.android.createChannel.addMembers.presentation.AddMembersPresenter
import
chat.rocket.android.createChannel.addMembers.presentation.AddMembersView
import
chat.rocket.android.createChannel.addMembers.presentation.AddMembersView
import
chat.rocket.android.helper.EndlessRecyclerViewScrollListener
import
chat.rocket.android.members.adapter.MembersAdapter
import
chat.rocket.android.members.adapter.MembersAdapter
import
chat.rocket.android.members.viewmodel.MemberViewModel
import
chat.rocket.android.members.viewmodel.MemberViewModel
import
chat.rocket.android.util.extensions.setVisible
import
chat.rocket.android.util.extensions.setVisible
...
@@ -31,6 +33,7 @@ class AddMembersActivity : AppCompatActivity(), AddMembersView {
...
@@ -31,6 +33,7 @@ class AddMembersActivity : AppCompatActivity(), AddMembersView {
@Inject
@Inject
lateinit
var
presenter
:
AddMembersPresenter
lateinit
var
presenter
:
AddMembersPresenter
private
lateinit
var
queryParam
:
String
private
var
membersToAdd
:
ArrayList
<
String
>
=
ArrayList
()
private
var
membersToAdd
:
ArrayList
<
String
>
=
ArrayList
()
private
val
adapter
:
MembersAdapter
=
MembersAdapter
{
memberViewModel
->
private
val
adapter
:
MembersAdapter
=
MembersAdapter
{
memberViewModel
->
if
(!
membersToAdd
.
contains
(
memberViewModel
.
username
))
{
if
(!
membersToAdd
.
contains
(
memberViewModel
.
username
))
{
...
@@ -54,9 +57,10 @@ class AddMembersActivity : AppCompatActivity(), AddMembersView {
...
@@ -54,9 +57,10 @@ class AddMembersActivity : AppCompatActivity(), AddMembersView {
setInitialChips
()
setInitialChips
()
observableFromSearchView
(
search_view
)
observableFromSearchView
(
search_view
)
.
debounce
(
300
,
TimeUnit
.
MILLISECONDS
)
.
debounce
(
300
,
TimeUnit
.
MILLISECONDS
)
.
filter
{
item
->
item
.
length
>
1
}
.
filter
{
item
->
item
.
isNotEmpty
()
}
.
observeOn
(
AndroidSchedulers
.
mainThread
())
.
observeOn
(
AndroidSchedulers
.
mainThread
())
.
subscribe
{
query
->
.
subscribe
{
query
->
queryParam
=
query
run
{
run
{
adapter
.
reAllocateArrayList
()
adapter
.
reAllocateArrayList
()
presenter
.
queryUsersFromRegex
(
query
)
presenter
.
queryUsersFromRegex
(
query
)
...
@@ -78,19 +82,18 @@ class AddMembersActivity : AppCompatActivity(), AddMembersView {
...
@@ -78,19 +82,18 @@ class AddMembersActivity : AppCompatActivity(), AddMembersView {
override
fun
showMembers
(
dataSet
:
List
<
MemberViewModel
>,
total
:
Long
)
{
override
fun
showMembers
(
dataSet
:
List
<
MemberViewModel
>,
total
:
Long
)
{
if
(
adapter
.
itemCount
==
0
)
{
if
(
adapter
.
itemCount
==
0
)
{
adapter
.
prependData
(
dataSet
)
adapter
.
prependData
(
dataSet
)
//TODO work on this part after adding support for count and offset in sdk
if
(
dataSet
.
size
>=
59
)
{
// if (dataSet.size >= 59) { // TODO Check why the API retorns the specified count -1
search_results
.
addOnScrollListener
(
object
:
// search_results.addOnScrollListener(object :
EndlessRecyclerViewScrollListener
(
linearLayoutManager
)
{
// EndlessRecyclerViewScrollListener(linearLayoutManager) {
override
fun
onLoadMore
(
// override fun onLoadMore(
page
:
Int
,
// page: Int,
totalItemsCount
:
Int
,
// totalItemsCount: Int,
recyclerView
:
RecyclerView
?
// recyclerView: RecyclerView?
)
{
// ) {
presenter
.
queryUsersFromRegex
(
queryParam
,
page
*
60L
)
// presenter.loadChatRoomsMembers(chatRoomId, chatRoomType, page * 60L)
}
// }
})
// })
}
// }
}
else
{
}
else
{
adapter
.
appendData
(
dataSet
)
adapter
.
appendData
(
dataSet
)
}
}
...
...
app/src/main/java/chat/rocket/android/createChannel/ui/CreateNewChannelActivity.kt
View file @
94949958
...
@@ -7,7 +7,6 @@ import android.os.Bundle
...
@@ -7,7 +7,6 @@ import android.os.Bundle
import
android.support.design.chip.Chip
import
android.support.design.chip.Chip
import
android.support.v7.app.AppCompatActivity
import
android.support.v7.app.AppCompatActivity
import
android.view.MenuItem
import
android.view.MenuItem
import
android.widget.Toast
import
chat.rocket.android.R
import
chat.rocket.android.R
import
chat.rocket.android.createChannel.addMembers.ui.AddMembersActivity
import
chat.rocket.android.createChannel.addMembers.ui.AddMembersActivity
import
chat.rocket.android.createChannel.presentation.CreateNewChannelPresenter
import
chat.rocket.android.createChannel.presentation.CreateNewChannelPresenter
...
...
app/src/main/java/chat/rocket/android/members/ui/MembersFragment.kt
View file @
94949958
...
@@ -2,7 +2,6 @@ package chat.rocket.android.members.ui
...
@@ -2,7 +2,6 @@ package chat.rocket.android.members.ui
import
android.os.Bundle
import
android.os.Bundle
import
android.support.v4.app.Fragment
import
android.support.v4.app.Fragment
import
android.support.v7.app.AppCompatActivity
import
android.support.v7.widget.LinearLayoutManager
import
android.support.v7.widget.LinearLayoutManager
import
android.support.v7.widget.RecyclerView
import
android.support.v7.widget.RecyclerView
import
android.view.LayoutInflater
import
android.view.LayoutInflater
...
...
app/src/main/res/layout/activity_add_members.xml
View file @
94949958
...
@@ -65,8 +65,10 @@
...
@@ -65,8 +65,10 @@
<android.support.v7.widget.RecyclerView
<android.support.v7.widget.RecyclerView
android:id=
"@+id/search_results"
android:id=
"@+id/search_results"
android:layout_width=
"match_parent"
android:layout_width=
"match_parent"
android:layout_height=
"
wrap_content
"
android:layout_height=
"
0dp
"
android:layout_margin=
"8dp"
android:layout_margin=
"8dp"
app:layout_constraintTop_toBottomOf=
"@id/separator_1"
/>
android:scrollbars=
"vertical"
app:layout_constraintTop_toBottomOf=
"@id/separator_1"
app:layout_constraintBottom_toBottomOf=
"parent"
/>
</android.support.constraint.ConstraintLayout>
</android.support.constraint.ConstraintLayout>
</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