mirror of
https://github.com/nextcloud/android.git
synced 2024-12-20 07:52:18 +03:00
get storage manager, stop if null (this happens while a long async thread, e.g. photo fetching, is cancelled by device orientation changing)
This commit is contained in:
parent
b1f60cb63b
commit
399ff5802f
2 changed files with 8 additions and 4 deletions
|
@ -487,13 +487,13 @@ public class FileListListAdapter extends BaseAdapter {
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setData(ArrayList<Object> objects, ExtendedListFragment.SearchType searchType, FileDataStorageManager storageManager) {
|
public void setData(ArrayList<Object> objects, ExtendedListFragment.SearchType searchType, FileDataStorageManager storageManager) {
|
||||||
if (storageManager != null) {
|
if (storageManager != null && mStorageManager == null) {
|
||||||
mStorageManager = storageManager;
|
mStorageManager = storageManager;
|
||||||
}
|
}
|
||||||
mFiles = new Vector<>();
|
mFiles = new Vector<>();
|
||||||
|
|
||||||
// early exit
|
// early exit
|
||||||
if (objects.size() > 0) {
|
if (objects.size() > 0 && mStorageManager != null) {
|
||||||
if (searchType.equals(ExtendedListFragment.SearchType.SHARED_FILTER)) {
|
if (searchType.equals(ExtendedListFragment.SearchType.SHARED_FILTER)) {
|
||||||
parseShares(objects);
|
parseShares(objects);
|
||||||
} else {
|
} else {
|
||||||
|
|
|
@ -1390,10 +1390,14 @@ public class OCFileListFragment extends ExtendedListFragment implements OCFileLi
|
||||||
if (getContext() != null && !isCancelled()) {
|
if (getContext() != null && !isCancelled()) {
|
||||||
RemoteOperationResult remoteOperationResult = remoteOperation.execute(currentAccount, getContext());
|
RemoteOperationResult remoteOperationResult = remoteOperation.execute(currentAccount, getContext());
|
||||||
|
|
||||||
|
FileDataStorageManager storageManager = null;
|
||||||
|
if (mContainerActivity != null && mContainerActivity.getStorageManager() != null) {
|
||||||
|
storageManager = mContainerActivity.getStorageManager();
|
||||||
|
}
|
||||||
|
|
||||||
if (remoteOperationResult.isSuccess() && remoteOperationResult.getData() != null
|
if (remoteOperationResult.isSuccess() && remoteOperationResult.getData() != null
|
||||||
&& !isCancelled() && searchFragment) {
|
&& !isCancelled() && searchFragment) {
|
||||||
mAdapter.setData(remoteOperationResult.getData(), currentSearchType,
|
mAdapter.setData(remoteOperationResult.getData(), currentSearchType, storageManager);
|
||||||
mContainerActivity.getStorageManager());
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return remoteOperationResult.isSuccess();
|
return remoteOperationResult.isSuccess();
|
||||||
|
|
Loading…
Reference in a new issue