Commit 77767114 authored by Hussein's avatar Hussein

Revert "P4A-1120 - Check if fragment is attached in OnGlobalLayoutListener"

This reverts commit f50e82cb.
parent 8fc39b58
......@@ -797,7 +797,17 @@ public class MessageListFragment extends PEpFragment implements ConfirmationDial
super.onResume();
showLoadingMessages();
startGlobalLayoutListener();
if(folderName == null) {
loadingView.getViewTreeObserver().addOnGlobalLayoutListener(new ViewTreeObserver.OnGlobalLayoutListener() {
@Override
public void onGlobalLayout() {
if(!LoaderManager.getInstance(MessageListFragment.this).hasRunningLoaders() && !anyAccountWasDeleted()) {
initializeLoaders();
}
loadingView.getViewTreeObserver().removeOnGlobalLayoutListener(this);
}
});
}
// Check if we have connectivity. Cache the value.
if (hasConnectivity == null) {
......@@ -839,23 +849,6 @@ public class MessageListFragment extends PEpFragment implements ConfirmationDial
}
}
private void startGlobalLayoutListener() {
if (folderName == null) {
loadingView.getViewTreeObserver().addOnGlobalLayoutListener(new ViewTreeObserver.OnGlobalLayoutListener() {
@Override
public void onGlobalLayout() {
if (loadingView.getViewTreeObserver().isAlive()) {
loadingView.getViewTreeObserver().removeOnGlobalLayoutListener(this);
}
if (isAdded() && !anyAccountWasDeleted() &&
!LoaderManager.getInstance(MessageListFragment.this).hasRunningLoaders()) {
initializeLoaders();
}
}
});
}
}
private void restartLoader() {
if (cursorValid == null) {
return;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment