Signed-off-by: Mario Danic <mario@lovelyhq.com>
This commit is contained in:
Mario Danic 2018-06-12 10:07:27 +02:00
parent c5d3fd10c0
commit 01348f07ea

View File

@ -570,46 +570,44 @@ public class ContactsController extends BaseController implements SearchView.OnQ
adapter.onLoadMoreComplete(null); adapter.onLoadMoreComplete(null);
} }
getActivity().runOnUiThread(() -> { searchItem.setVisible(newUserItemList.size() > 0);
searchItem.setVisible(newUserItemList.size() > 0); swipeRefreshLayout.setRefreshing(false);
swipeRefreshLayout.setRefreshing(false);
if (isNewConversationView) { if (isNewConversationView) {
checkAndHandleBottomButtons(); checkAndHandleBottomButtons();
} }
});
} }
;
} }
@Override @Override
public void onError(Throwable e) { public void onError(Throwable e) {
getActivity().runOnUiThread(() -> { if (searchItem != null) {
if (searchItem != null) { searchItem.setVisible(false);
searchItem.setVisible(false); }
}
if (e instanceof HttpException) { if (e instanceof HttpException) {
HttpException exception = (HttpException) e; HttpException exception = (HttpException) e;
switch (exception.code()) { switch (exception.code()) {
case 401: case 401:
if (getParentController() != null && if (getParentController() != null &&
getParentController().getRouter() != null) { getParentController().getRouter() != null) {
getParentController().getRouter().pushController((RouterTransaction.with getParentController().getRouter().pushController((RouterTransaction.with
(new WebViewLoginController(currentUser.getBaseUrl(), (new WebViewLoginController(currentUser.getBaseUrl(),
true)) true))
.pushChangeHandler(new VerticalChangeHandler()) .pushChangeHandler(new VerticalChangeHandler())
.popChangeHandler(new VerticalChangeHandler()))); .popChangeHandler(new VerticalChangeHandler())));
} }
break; break;
default: default:
break; break;
}
} }
swipeRefreshLayout.setRefreshing(false); swipeRefreshLayout.setRefreshing(false);
}); }
;
dispose(contactsQueryDisposable); dispose(contactsQueryDisposable);
@ -617,7 +615,7 @@ public class ContactsController extends BaseController implements SearchView.OnQ
@Override @Override
public void onComplete() { public void onComplete() {
getActivity().runOnUiThread(() -> swipeRefreshLayout.setRefreshing(false)); swipeRefreshLayout.setRefreshing(false);
dispose(contactsQueryDisposable); dispose(contactsQueryDisposable);
alreadyFetching = false; alreadyFetching = false;