mirror of
https://github.com/nextcloud/android.git
synced 2024-12-18 23:11:58 +03:00
- search view shows data again
- no crash while rotation during search view is populated
This commit is contained in:
parent
f1dc6fb89c
commit
f9b6417f48
3 changed files with 11 additions and 21 deletions
|
@ -251,7 +251,7 @@ public class FileDataStorageManager {
|
|||
return overriden;
|
||||
}
|
||||
|
||||
public long saveFileWithParent(OCFile file, Context context) {
|
||||
public OCFile saveFileWithParent(OCFile file, Context context) {
|
||||
if (file.getParentId() != 0 || file.getRemotePath().equals("/")) {
|
||||
saveFile(file);
|
||||
|
||||
|
@ -261,7 +261,7 @@ public class FileDataStorageManager {
|
|||
|
||||
OCFile parentFile = getFileByPath(parentPath);
|
||||
|
||||
long fileId;
|
||||
OCFile returnFile;
|
||||
if (parentFile == null) {
|
||||
// remote request
|
||||
ReadRemoteFileOperation operation = new ReadRemoteFileOperation(parentPath);
|
||||
|
@ -269,20 +269,20 @@ public class FileDataStorageManager {
|
|||
if (result.isSuccess()) {
|
||||
OCFile remoteFolder = FileStorageUtils.fillOCFile((RemoteFile) result.getData().get(0));
|
||||
|
||||
fileId = saveFileWithParent(remoteFolder, context);
|
||||
returnFile = saveFileWithParent(remoteFolder, context);
|
||||
} else {
|
||||
fileId = -1;
|
||||
returnFile = null;
|
||||
Log_OC.e(TAG, "Error during saving file with parents: " + file.getRemotePath());
|
||||
}
|
||||
} else {
|
||||
fileId = saveFileWithParent(parentFile, context);
|
||||
returnFile = saveFileWithParent(parentFile, context);
|
||||
}
|
||||
|
||||
file.setParentId(fileId);
|
||||
file.setParentId(returnFile.getFileId());
|
||||
saveFile(file);
|
||||
}
|
||||
|
||||
return getFileByPath(file.getRemotePath()).getFileId();
|
||||
return file;
|
||||
}
|
||||
|
||||
public void saveNewFile(OCFile newFile) {
|
||||
|
|
|
@ -561,8 +561,8 @@ public class FileListListAdapter extends BaseAdapter {
|
|||
for (int i = 0; i < objects.size(); i++) {
|
||||
OCFile ocFile = FileStorageUtils.fillOCFile((RemoteFile) objects.get(i));
|
||||
searchForLocalFileInDefaultPath(ocFile);
|
||||
mStorageManager.saveFileWithParent(ocFile, mContext);
|
||||
mStorageManager.saveVirtual(type, mStorageManager.getFileByPath(ocFile.getRemotePath()));
|
||||
ocFile = mStorageManager.saveFileWithParent(ocFile, mContext);
|
||||
mStorageManager.saveVirtual(type, ocFile);
|
||||
}
|
||||
|
||||
mFiles.addAll(mStorageManager.getVirtualFolderContent(type, onlyImages));
|
||||
|
|
|
@ -251,10 +251,6 @@ public class OCFileListFragment extends ExtendedListFragment implements OCFileLi
|
|||
public void onResume() {
|
||||
super.onResume();
|
||||
|
||||
if (remoteOperationAsyncTask != null) {
|
||||
remoteOperationAsyncTask.cancel(true);
|
||||
}
|
||||
|
||||
if (getActivity() != null) {
|
||||
AnalyticsUtils.setCurrentScreenName(getActivity(), SCREEN_NAME, TAG);
|
||||
}
|
||||
|
@ -322,7 +318,7 @@ public class OCFileListFragment extends ExtendedListFragment implements OCFileLi
|
|||
}
|
||||
|
||||
searchEvent = Parcels.unwrap(getArguments().getParcelable(OCFileListFragment.SEARCH_EVENT));
|
||||
if (searchEvent != null) {
|
||||
if (searchEvent != null && searchFragment) {
|
||||
onMessageEvent(searchEvent);
|
||||
}
|
||||
}
|
||||
|
@ -971,10 +967,6 @@ public class OCFileListFragment extends ExtendedListFragment implements OCFileLi
|
|||
public void refreshDirectory() {
|
||||
searchFragment = false;
|
||||
|
||||
if (remoteOperationAsyncTask != null) {
|
||||
remoteOperationAsyncTask.cancel(true);
|
||||
}
|
||||
|
||||
setFabEnabled(true);
|
||||
listDirectory(getCurrentFile(), MainApp.isOnlyOnDevice(), false);
|
||||
}
|
||||
|
@ -1455,8 +1447,6 @@ public class OCFileListFragment extends ExtendedListFragment implements OCFileLi
|
|||
} else {
|
||||
new Handler(Looper.getMainLooper()).post(switchViewsRunnable);
|
||||
}
|
||||
|
||||
searchEvent = null;
|
||||
}
|
||||
|
||||
private void setTitle(@StringRes int title) {
|
||||
|
@ -1480,7 +1470,7 @@ public class OCFileListFragment extends ExtendedListFragment implements OCFileLi
|
|||
public void onRefresh() {
|
||||
super.onRefresh();
|
||||
|
||||
if (searchEvent != null) {
|
||||
if (searchEvent != null && searchFragment) {
|
||||
onMessageEvent(searchEvent);
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue