|
@@ -744,9 +744,10 @@ public class FileDisplayActivity extends FileActivity
|
|
getSupportActionBar().setDisplayHomeAsUpEnabled(true);
|
|
getSupportActionBar().setDisplayHomeAsUpEnabled(true);
|
|
mDrawerToggle.syncState();
|
|
mDrawerToggle.syncState();
|
|
|
|
|
|
- if (getListOfFilesFragment() != null) {
|
|
|
|
- getListOfFilesFragment().setSearchFragment(false);
|
|
|
|
- getListOfFilesFragment().refreshDirectory();
|
|
|
|
|
|
+ OCFileListFragment ocFileListFragment = getListOfFilesFragment();
|
|
|
|
+ if (ocFileListFragment != null) {
|
|
|
|
+ ocFileListFragment.setSearchFragment(false);
|
|
|
|
+ ocFileListFragment.refreshDirectory();
|
|
}
|
|
}
|
|
} else {
|
|
} else {
|
|
searchView.post(() -> searchView.setQuery("", true));
|
|
searchView.post(() -> searchView.setQuery("", true));
|
|
@@ -797,7 +798,11 @@ public class FileDisplayActivity extends FileActivity
|
|
break;
|
|
break;
|
|
}
|
|
}
|
|
case R.id.action_select_all: {
|
|
case R.id.action_select_all: {
|
|
- getListOfFilesFragment().selectAllFiles(true);
|
|
|
|
|
|
+ OCFileListFragment fragment = getListOfFilesFragment();
|
|
|
|
+
|
|
|
|
+ if (fragment != null) {
|
|
|
|
+ fragment.selectAllFiles(true);
|
|
|
|
+ }
|
|
break;
|
|
break;
|
|
}
|
|
}
|
|
default:
|
|
default:
|
|
@@ -1028,7 +1033,9 @@ public class FileDisplayActivity extends FileActivity
|
|
searchView.clearFocus();
|
|
searchView.clearFocus();
|
|
|
|
|
|
// Remove the list to the original state
|
|
// Remove the list to the original state
|
|
- listOfFiles.performSearch("", true);
|
|
|
|
|
|
+ if (listOfFiles != null) {
|
|
|
|
+ listOfFiles.performSearch("", true);
|
|
|
|
+ }
|
|
|
|
|
|
hideSearchView(getCurrentDir());
|
|
hideSearchView(getCurrentDir());
|
|
|
|
|
|
@@ -1081,7 +1088,10 @@ public class FileDisplayActivity extends FileActivity
|
|
Log_OC.v(TAG, "onResume() start");
|
|
Log_OC.v(TAG, "onResume() start");
|
|
super.onResume();
|
|
super.onResume();
|
|
// Instead of onPostCreate, starting the loading in onResume for children fragments
|
|
// Instead of onPostCreate, starting the loading in onResume for children fragments
|
|
- getListOfFilesFragment().setLoading(mSyncInProgress);
|
|
|
|
|
|
+ OCFileListFragment ocFileListFragment = getListOfFilesFragment();
|
|
|
|
+ if (ocFileListFragment != null) {
|
|
|
|
+ ocFileListFragment.setLoading(mSyncInProgress);
|
|
|
|
+ }
|
|
syncAndUpdateFolder(false);
|
|
syncAndUpdateFolder(false);
|
|
|
|
|
|
OCFile startFile = null;
|
|
OCFile startFile = null;
|
|
@@ -1093,16 +1103,17 @@ public class FileDisplayActivity extends FileActivity
|
|
// refresh list of files
|
|
// refresh list of files
|
|
if (searchView != null && !TextUtils.isEmpty(searchQuery)) {
|
|
if (searchView != null && !TextUtils.isEmpty(searchQuery)) {
|
|
searchView.setQuery(searchQuery, false);
|
|
searchView.setQuery(searchQuery, false);
|
|
- } else if (getListOfFilesFragment() != null && !getListOfFilesFragment().isSearchFragment()
|
|
|
|
- && startFile == null) {
|
|
|
|
|
|
+ } else if (ocFileListFragment != null && !ocFileListFragment.isSearchFragment() && startFile == null) {
|
|
updateListOfFilesFragment(false);
|
|
updateListOfFilesFragment(false);
|
|
} else {
|
|
} else {
|
|
- getListOfFilesFragment().listDirectory(startFile, false, false);
|
|
|
|
|
|
+ if (ocFileListFragment != null) {
|
|
|
|
+ ocFileListFragment.listDirectory(startFile, false, false);
|
|
|
|
+ }
|
|
updateActionBarTitleAndHomeButton(startFile);
|
|
updateActionBarTitleAndHomeButton(startFile);
|
|
}
|
|
}
|
|
|
|
|
|
// Listen for sync messages
|
|
// Listen for sync messages
|
|
- if (getListOfFilesFragment() != null && !getListOfFilesFragment().isSearchFragment()) {
|
|
|
|
|
|
+ if (ocFileListFragment != null && !ocFileListFragment.isSearchFragment()) {
|
|
IntentFilter syncIntentFilter = new IntentFilter(FileSyncAdapter.EVENT_FULL_SYNC_START);
|
|
IntentFilter syncIntentFilter = new IntentFilter(FileSyncAdapter.EVENT_FULL_SYNC_START);
|
|
syncIntentFilter.addAction(FileSyncAdapter.EVENT_FULL_SYNC_END);
|
|
syncIntentFilter.addAction(FileSyncAdapter.EVENT_FULL_SYNC_END);
|
|
syncIntentFilter.addAction(FileSyncAdapter.EVENT_FULL_SYNC_FOLDER_CONTENTS_SYNCED);
|
|
syncIntentFilter.addAction(FileSyncAdapter.EVENT_FULL_SYNC_FOLDER_CONTENTS_SYNCED);
|
|
@@ -1110,8 +1121,6 @@ public class FileDisplayActivity extends FileActivity
|
|
syncIntentFilter.addAction(RefreshFolderOperation.EVENT_SINGLE_FOLDER_SHARES_SYNCED);
|
|
syncIntentFilter.addAction(RefreshFolderOperation.EVENT_SINGLE_FOLDER_SHARES_SYNCED);
|
|
mSyncBroadcastReceiver = new SyncBroadcastReceiver();
|
|
mSyncBroadcastReceiver = new SyncBroadcastReceiver();
|
|
registerReceiver(mSyncBroadcastReceiver, syncIntentFilter);
|
|
registerReceiver(mSyncBroadcastReceiver, syncIntentFilter);
|
|
- //LocalBroadcastManager.getInstance(this).registerReceiver(mSyncBroadcastReceiver,
|
|
|
|
- // syncIntentFilter);
|
|
|
|
}
|
|
}
|
|
|
|
|
|
// Listen for upload messages
|
|
// Listen for upload messages
|
|
@@ -1120,8 +1129,7 @@ public class FileDisplayActivity extends FileActivity
|
|
registerReceiver(mUploadFinishReceiver, uploadIntentFilter);
|
|
registerReceiver(mUploadFinishReceiver, uploadIntentFilter);
|
|
|
|
|
|
// Listen for download messages
|
|
// Listen for download messages
|
|
- IntentFilter downloadIntentFilter = new IntentFilter(
|
|
|
|
- FileDownloader.getDownloadAddedMessage());
|
|
|
|
|
|
+ IntentFilter downloadIntentFilter = new IntentFilter(FileDownloader.getDownloadAddedMessage());
|
|
downloadIntentFilter.addAction(FileDownloader.getDownloadFinishMessage());
|
|
downloadIntentFilter.addAction(FileDownloader.getDownloadFinishMessage());
|
|
mDownloadFinishReceiver = new DownloadFinishReceiver();
|
|
mDownloadFinishReceiver = new DownloadFinishReceiver();
|
|
registerReceiver(mDownloadFinishReceiver, downloadIntentFilter);
|
|
registerReceiver(mDownloadFinishReceiver, downloadIntentFilter);
|
|
@@ -1146,7 +1154,7 @@ public class FileDisplayActivity extends FileActivity
|
|
setDrawerMenuItemChecked(menuItemId);
|
|
setDrawerMenuItemChecked(menuItemId);
|
|
}
|
|
}
|
|
|
|
|
|
- if (getListOfFilesFragment() instanceof PhotoFragment) {
|
|
|
|
|
|
+ if (ocFileListFragment instanceof PhotoFragment) {
|
|
updateActionBarTitleAndHomeButtonByString(getString(R.string.drawer_item_photos));
|
|
updateActionBarTitleAndHomeButtonByString(getString(R.string.drawer_item_photos));
|
|
}
|
|
}
|
|
|
|
|
|
@@ -1177,7 +1185,10 @@ public class FileDisplayActivity extends FileActivity
|
|
|
|
|
|
@Override
|
|
@Override
|
|
public void onSortingOrderChosen(FileSortOrder selection) {
|
|
public void onSortingOrderChosen(FileSortOrder selection) {
|
|
- getListOfFilesFragment().sortFiles(selection);
|
|
|
|
|
|
+ OCFileListFragment ocFileListFragment = getListOfFilesFragment();
|
|
|
|
+ if (ocFileListFragment != null) {
|
|
|
|
+ ocFileListFragment.sortFiles(selection);
|
|
|
|
+ }
|
|
}
|
|
}
|
|
|
|
|
|
@Override
|
|
@Override
|
|
@@ -1283,7 +1294,10 @@ public class FileDisplayActivity extends FileActivity
|
|
DataHolderUtil.getInstance().delete(intent.getStringExtra(FileSyncAdapter.EXTRA_RESULT));
|
|
DataHolderUtil.getInstance().delete(intent.getStringExtra(FileSyncAdapter.EXTRA_RESULT));
|
|
|
|
|
|
Log_OC.d(TAG, "Setting progress visibility to " + mSyncInProgress);
|
|
Log_OC.d(TAG, "Setting progress visibility to " + mSyncInProgress);
|
|
- getListOfFilesFragment().setLoading(mSyncInProgress);
|
|
|
|
|
|
+ OCFileListFragment ocFileListFragment = getListOfFilesFragment();
|
|
|
|
+ if (ocFileListFragment != null) {
|
|
|
|
+ ocFileListFragment.setLoading(mSyncInProgress);
|
|
|
|
+ }
|
|
setBackgroundText();
|
|
setBackgroundText();
|
|
}
|
|
}
|
|
}
|
|
}
|
|
@@ -1407,7 +1421,10 @@ public class FileDisplayActivity extends FileActivity
|
|
// TODO what about other kind of previews?
|
|
// TODO what about other kind of previews?
|
|
}
|
|
}
|
|
}
|
|
}
|
|
- getListOfFilesFragment().setLoading(false);
|
|
|
|
|
|
+ OCFileListFragment ocFileListFragment = getListOfFilesFragment();
|
|
|
|
+ if (ocFileListFragment != null) {
|
|
|
|
+ ocFileListFragment.setLoading(false);
|
|
|
|
+ }
|
|
} finally {
|
|
} finally {
|
|
if (intent != null) {
|
|
if (intent != null) {
|
|
removeStickyBroadcast(intent);
|
|
removeStickyBroadcast(intent);
|
|
@@ -1838,7 +1855,7 @@ public class FileDisplayActivity extends FileActivity
|
|
getFileOperationsHelper().openFile(renamedFile);
|
|
getFileOperationsHelper().openFile(renamedFile);
|
|
}
|
|
}
|
|
} else if (details instanceof PreviewTextFragment &&
|
|
} else if (details instanceof PreviewTextFragment &&
|
|
- renamedFile.equals(details.getFile())) {
|
|
|
|
|
|
+ renamedFile.equals(details.getFile())) {
|
|
((PreviewTextFileFragment) details).updateFile(renamedFile);
|
|
((PreviewTextFileFragment) details).updateFile(renamedFile);
|
|
if (PreviewTextFileFragment.canBePreviewed(renamedFile)) {
|
|
if (PreviewTextFileFragment.canBePreviewed(renamedFile)) {
|
|
startTextPreview(renamedFile, true);
|
|
startTextPreview(renamedFile, true);
|
|
@@ -1848,7 +1865,8 @@ public class FileDisplayActivity extends FileActivity
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
- if (getStorageManager().getFileById(renamedFile.getParentId()).equals(getCurrentDir())) {
|
|
|
|
|
|
+ OCFile file = getStorageManager().getFileById(renamedFile.getParentId());
|
|
|
|
+ if (file != null && file.equals(getCurrentDir())) {
|
|
updateListOfFilesFragment(false);
|
|
updateListOfFilesFragment(false);
|
|
}
|
|
}
|
|
|
|
|
|
@@ -2257,17 +2275,16 @@ public class FileDisplayActivity extends FileActivity
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
- private boolean isGridView() {
|
|
|
|
- return getListOfFilesFragment().isGridEnabled();
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
@Override
|
|
@Override
|
|
public void showFiles(boolean onDeviceOnly) {
|
|
public void showFiles(boolean onDeviceOnly) {
|
|
super.showFiles(onDeviceOnly);
|
|
super.showFiles(onDeviceOnly);
|
|
if (onDeviceOnly) {
|
|
if (onDeviceOnly) {
|
|
updateActionBarTitleAndHomeButtonByString(getString(R.string.drawer_item_on_device));
|
|
updateActionBarTitleAndHomeButtonByString(getString(R.string.drawer_item_on_device));
|
|
}
|
|
}
|
|
- getListOfFilesFragment().refreshDirectory();
|
|
|
|
|
|
+ OCFileListFragment ocFileListFragment = getListOfFilesFragment();
|
|
|
|
+ if (ocFileListFragment != null) {
|
|
|
|
+ ocFileListFragment.refreshDirectory();
|
|
|
|
+ }
|
|
}
|
|
}
|
|
|
|
|
|
@Subscribe(threadMode = ThreadMode.BACKGROUND)
|
|
@Subscribe(threadMode = ThreadMode.BACKGROUND)
|