mirror of
https://github.com/nextcloud/android.git
synced 2024-11-26 23:28:42 +03:00
Merge pull request #7210 from nextcloud/populateList
Only do UI manipulation if visible
This commit is contained in:
commit
74edac558a
1 changed files with 16 additions and 9 deletions
|
@ -77,6 +77,7 @@ import androidx.annotation.VisibleForTesting;
|
|||
import androidx.core.content.res.ResourcesCompat;
|
||||
import androidx.fragment.app.Fragment;
|
||||
import androidx.fragment.app.FragmentActivity;
|
||||
import androidx.lifecycle.Lifecycle;
|
||||
import androidx.recyclerview.widget.LinearLayoutManager;
|
||||
import androidx.recyclerview.widget.RecyclerView;
|
||||
import androidx.swiperefreshlayout.widget.SwipeRefreshLayout;
|
||||
|
@ -364,7 +365,9 @@ public class FileDetailActivitiesFragment extends Fragment implements
|
|||
}
|
||||
|
||||
activity.runOnUiThread(() -> {
|
||||
populateList(activitiesAndVersions, lastGiven == -1);
|
||||
if (getLifecycle().getCurrentState().isAtLeast(Lifecycle.State.RESUMED)) {
|
||||
populateList(activitiesAndVersions, lastGiven == -1);
|
||||
}
|
||||
});
|
||||
} else {
|
||||
Log_OC.d(TAG, result.getLogMessage());
|
||||
|
@ -375,8 +378,10 @@ public class FileDetailActivitiesFragment extends Fragment implements
|
|||
}
|
||||
final String finalLogMessage = logMessage;
|
||||
activity.runOnUiThread(() -> {
|
||||
setErrorContent(finalLogMessage);
|
||||
isLoadingActivities = false;
|
||||
if (getLifecycle().getCurrentState().isAtLeast(Lifecycle.State.RESUMED)) {
|
||||
setErrorContent(finalLogMessage);
|
||||
isLoadingActivities = false;
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
|
@ -451,13 +456,15 @@ public class FileDetailActivitiesFragment extends Fragment implements
|
|||
|
||||
private void hideRefreshLayoutLoader(FragmentActivity activity) {
|
||||
activity.runOnUiThread(() -> {
|
||||
if (swipeListRefreshLayout != null) {
|
||||
swipeListRefreshLayout.setRefreshing(false);
|
||||
if (getLifecycle().getCurrentState().isAtLeast(Lifecycle.State.RESUMED)) {
|
||||
if (swipeListRefreshLayout != null) {
|
||||
swipeListRefreshLayout.setRefreshing(false);
|
||||
}
|
||||
if (swipeEmptyListRefreshLayout != null) {
|
||||
swipeEmptyListRefreshLayout.setRefreshing(false);
|
||||
}
|
||||
isLoadingActivities = false;
|
||||
}
|
||||
if (swipeEmptyListRefreshLayout != null) {
|
||||
swipeEmptyListRefreshLayout.setRefreshing(false);
|
||||
}
|
||||
isLoadingActivities = false;
|
||||
});
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue