Try to fix

Signed-off-by: Mario Danic <mario@lovelyhq.com>
This commit is contained in:
Mario Danic 2018-06-01 15:44:06 +02:00
parent c2a4c6f006
commit 62147fb5f6

View File

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