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
5bf0a6e2
Commit
5bf0a6e2
authored
Sep 09, 2017
by
Lucio Maciel
Committed by
GitHub
Sep 09, 2017
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'develop' into develop
parents
986d56fd
4fb39f89
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
16 additions
and
13 deletions
+16
-13
SidebarMainFragment.java
.../rocket/android/fragment/sidebar/SidebarMainFragment.java
+16
-13
No files found.
app/src/main/java/chat/rocket/android/fragment/sidebar/SidebarMainFragment.java
View file @
5bf0a6e2
...
...
@@ -43,16 +43,18 @@ import com.jakewharton.rxbinding2.support.v7.widget.RxSearchView;
import
com.jakewharton.rxbinding2.widget.RxCompoundButton
;
import
io.reactivex.android.schedulers.AndroidSchedulers
;
import
io.reactivex.disposables.Disposable
;
import
java.util.ArrayList
;
import
java.util.List
;
public
class
SidebarMainFragment
extends
AbstractFragment
implements
SidebarMainContract
.
View
{
private
SidebarMainContract
.
Presenter
presenter
;
private
RoomListAdapter
adapter
;
private
RecyclerView
recyclerView
;
private
SearchView
searchView
;
private
TextView
loadMoreResultsText
;
private
List
<
RoomSidebar
>
roomSidebarList
;
private
Disposable
spotlightDisposable
;
private
String
hostname
;
private
static
final
String
HOSTNAME
=
"hostname"
;
...
...
@@ -139,7 +141,7 @@ public class SidebarMainFragment extends AbstractFragment implements SidebarMain
}
});
recyclerView
=
rootView
.
findViewById
(
R
.
id
.
room_list_container
);
RecyclerView
recyclerView
=
rootView
.
findViewById
(
R
.
id
.
room_list_container
);
recyclerView
.
setLayoutManager
(
new
LinearLayoutManager
(
getContext
(),
LinearLayoutManager
.
VERTICAL
,
false
));
recyclerView
.
setAdapter
(
adapter
);
...
...
@@ -148,15 +150,17 @@ public class SidebarMainFragment extends AbstractFragment implements SidebarMain
RxSearchView
.
queryTextChanges
(
searchView
)
.
observeOn
(
AndroidSchedulers
.
mainThread
())
.
subscribe
(
charSequence
->
{
adapter
.
setMode
(
RoomListAdapter
.
MODE_ROOM
);
if
(
spotlightDisposable
!=
null
&&
!
spotlightDisposable
.
isDisposed
())
{
spotlightDisposable
.
dispose
();
}
presenter
.
disposeSubscriptions
();
if
(
charSequence
.
length
()
==
0
)
{
loadMoreResultsText
.
setVisibility
(
View
.
GONE
);
adapter
.
setMode
(
RoomListAdapter
.
MODE_ROOM
);
presenter
.
bindView
(
this
);
recyclerView
.
setVisibility
(
View
.
VISIBLE
);
}
else
{
presenter
.
disposeSubscriptions
();
filterRoomSidebarList
(
charSequence
);
}
}
else
{
filterRoomSidebarList
(
charSequence
);
}
});
loadMoreResultsText
.
setOnClickListener
(
view
->
loadMoreResults
());
...
...
@@ -179,16 +183,16 @@ public class SidebarMainFragment extends AbstractFragment implements SidebarMain
}
if
(
filteredRoomSidebarList
.
isEmpty
())
{
recyclerView
.
setVisibility
(
View
.
GONE
);
loadMoreResults
(
);
}
else
{
recyclerView
.
setVisibility
(
View
.
VISIBLE
);
loadMoreResultsText
.
setVisibility
(
View
.
VISIBLE
);
adapter
.
setMode
(
RoomListAdapter
.
MODE_ROOM
);
adapter
.
setRoomSidebarList
(
filteredRoomSidebarList
);
}
loadMoreResultsText
.
setVisibility
(
View
.
VISIBLE
);
}
private
void
loadMoreResults
()
{
presenter
.
searchSpotlight
(
searchView
.
getQuery
().
toString
())
spotlightDisposable
=
presenter
.
searchSpotlight
(
searchView
.
getQuery
().
toString
())
.
toObservable
()
.
observeOn
(
AndroidSchedulers
.
mainThread
())
.
subscribe
(
this
::
showSearchSuggestions
);
...
...
@@ -198,7 +202,6 @@ public class SidebarMainFragment extends AbstractFragment implements SidebarMain
loadMoreResultsText
.
setVisibility
(
View
.
GONE
);
adapter
.
setMode
(
RoomListAdapter
.
MODE_SPOTLIGHT
);
adapter
.
setSpotlightList
(
spotlightList
);
recyclerView
.
setVisibility
(
View
.
VISIBLE
);
}
@SuppressLint
(
"RxLeakedSubscription"
)
...
...
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