FolderPickerActivity.java 23 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611
  1. /*
  2. * ownCloud Android client application
  3. *
  4. * Copyright (C) 2016 ownCloud Inc.
  5. *
  6. * This program is free software: you can redistribute it and/or modify
  7. * it under the terms of the GNU General Public License version 2,
  8. * as published by the Free Software Foundation.
  9. *
  10. * This program is distributed in the hope that it will be useful,
  11. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  12. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  13. * GNU General Public License for more details.
  14. *
  15. * You should have received a copy of the GNU General Public License
  16. * along with this program. If not, see <http://www.gnu.org/licenses/>.
  17. *
  18. */
  19. package com.owncloud.android.ui.activity;
  20. import android.accounts.AuthenticatorException;
  21. import android.app.Activity;
  22. import android.content.BroadcastReceiver;
  23. import android.content.Context;
  24. import android.content.Intent;
  25. import android.content.IntentFilter;
  26. import android.content.res.ColorStateList;
  27. import android.content.res.Resources.NotFoundException;
  28. import android.graphics.PorterDuff;
  29. import android.graphics.drawable.Drawable;
  30. import android.os.Bundle;
  31. import android.os.Parcelable;
  32. import android.util.Log;
  33. import android.view.ActionMode;
  34. import android.view.Menu;
  35. import android.view.MenuInflater;
  36. import android.view.MenuItem;
  37. import android.view.View;
  38. import android.view.View.OnClickListener;
  39. import com.google.android.material.button.MaterialButton;
  40. import com.nextcloud.client.di.Injectable;
  41. import com.nextcloud.client.preferences.AppPreferences;
  42. import com.owncloud.android.R;
  43. import com.owncloud.android.datamodel.FileDataStorageManager;
  44. import com.owncloud.android.datamodel.OCFile;
  45. import com.owncloud.android.lib.common.operations.RemoteOperation;
  46. import com.owncloud.android.lib.common.operations.RemoteOperationResult;
  47. import com.owncloud.android.lib.common.operations.RemoteOperationResult.ResultCode;
  48. import com.owncloud.android.lib.common.utils.Log_OC;
  49. import com.owncloud.android.operations.CreateFolderOperation;
  50. import com.owncloud.android.operations.RefreshFolderOperation;
  51. import com.owncloud.android.syncadapter.FileSyncAdapter;
  52. import com.owncloud.android.ui.dialog.CreateFolderDialogFragment;
  53. import com.owncloud.android.ui.dialog.SortingOrderDialogFragment;
  54. import com.owncloud.android.ui.fragment.FileFragment;
  55. import com.owncloud.android.ui.fragment.OCFileListFragment;
  56. import com.owncloud.android.utils.DataHolderUtil;
  57. import com.owncloud.android.utils.DisplayUtils;
  58. import com.owncloud.android.utils.ErrorMessageAdapter;
  59. import com.owncloud.android.utils.FileSortOrder;
  60. import com.owncloud.android.utils.ThemeUtils;
  61. import java.io.File;
  62. import java.util.ArrayList;
  63. import javax.inject.Inject;
  64. import androidx.appcompat.app.ActionBar;
  65. import androidx.fragment.app.Fragment;
  66. import androidx.fragment.app.FragmentManager;
  67. import androidx.fragment.app.FragmentTransaction;
  68. public class FolderPickerActivity extends FileActivity implements FileFragment.ContainerActivity,
  69. OnClickListener,
  70. OnEnforceableRefreshListener,
  71. Injectable,
  72. SortingOrderDialogFragment.OnSortingOrderListener {
  73. public static final String EXTRA_FOLDER = FolderPickerActivity.class.getCanonicalName() + ".EXTRA_FOLDER";
  74. public static final String EXTRA_FILES = FolderPickerActivity.class.getCanonicalName() + ".EXTRA_FILES";
  75. public static final String EXTRA_ACTION = FolderPickerActivity.class.getCanonicalName() + ".EXTRA_ACTION";
  76. public static final String EXTRA_CURRENT_FOLDER = FolderPickerActivity.class.getCanonicalName() +
  77. ".EXTRA_CURRENT_FOLDER";
  78. public static final String MOVE = "MOVE";
  79. public static final String COPY = "COPY";
  80. private SyncBroadcastReceiver mSyncBroadcastReceiver;
  81. private static final String TAG = FolderPickerActivity.class.getSimpleName();
  82. protected static final String TAG_LIST_OF_FOLDERS = "LIST_OF_FOLDERS";
  83. private boolean mSyncInProgress;
  84. private boolean mSearchOnlyFolders;
  85. private boolean mDoNotEnterEncryptedFolder;
  86. protected MaterialButton mCancelBtn;
  87. protected MaterialButton mChooseBtn;
  88. private String caption;
  89. @Inject AppPreferences preferences;
  90. @Override
  91. protected void onCreate(Bundle savedInstanceState) {
  92. Log_OC.d(TAG, "onCreate() start");
  93. super.onCreate(savedInstanceState);
  94. if (this instanceof FilePickerActivity) {
  95. setContentView(R.layout.files_picker);
  96. } else {
  97. setContentView(R.layout.files_folder_picker);
  98. }
  99. // sets callback listeners for UI elements
  100. initControls();
  101. // Action bar setup
  102. setupToolbar();
  103. if (getIntent().getStringExtra(EXTRA_ACTION) != null) {
  104. switch (getIntent().getStringExtra(EXTRA_ACTION)) {
  105. case MOVE:
  106. caption = getResources().getText(R.string.move_to).toString();
  107. mSearchOnlyFolders = true;
  108. mDoNotEnterEncryptedFolder = true;
  109. break;
  110. case COPY:
  111. caption = getResources().getText(R.string.copy_to).toString();
  112. mSearchOnlyFolders = true;
  113. mDoNotEnterEncryptedFolder = true;
  114. break;
  115. default:
  116. caption = ThemeUtils.getDefaultDisplayNameForRootFolder(this);
  117. break;
  118. }
  119. } else {
  120. caption = ThemeUtils.getDefaultDisplayNameForRootFolder(this);
  121. }
  122. if (getIntent().getParcelableExtra(EXTRA_CURRENT_FOLDER) != null) {
  123. setFile(getIntent().getParcelableExtra(EXTRA_CURRENT_FOLDER));
  124. }
  125. if (savedInstanceState == null) {
  126. createFragments();
  127. }
  128. if (getSupportActionBar() != null) {
  129. getSupportActionBar().setDisplayShowTitleEnabled(true);
  130. ThemeUtils.setColoredTitle(getSupportActionBar(), caption, this);
  131. }
  132. showProgressBar(mSyncInProgress);
  133. // always AFTER setContentView(...) ; to work around bug in its implementation
  134. // sets message for empty list of folders
  135. setBackgroundText();
  136. Log_OC.d(TAG, "onCreate() end");
  137. }
  138. @Override
  139. public void onActionModeStarted(ActionMode mode) {
  140. super.onActionModeStarted(mode);
  141. if (getAccount() != null) {
  142. updateFileFromDB();
  143. OCFile folder = getFile();
  144. if (folder == null || !folder.isFolder()) {
  145. // fall back to root folder
  146. setFile(getStorageManager().getFileByPath(OCFile.ROOT_PATH));
  147. folder = getFile();
  148. }
  149. OCFileListFragment listOfFolders = getListOfFilesFragment();
  150. listOfFolders.listDirectory(folder, false, false);
  151. startSyncFolderOperation(folder, false);
  152. updateNavigationElementsInActionBar();
  153. }
  154. }
  155. private Activity getActivity() {
  156. return this;
  157. }
  158. protected void createFragments() {
  159. OCFileListFragment listOfFiles = new OCFileListFragment();
  160. Bundle args = new Bundle();
  161. args.putBoolean(OCFileListFragment.ARG_ONLY_FOLDERS_CLICKABLE, true);
  162. args.putBoolean(OCFileListFragment.ARG_HIDE_FAB, true);
  163. args.putBoolean(OCFileListFragment.ARG_HIDE_ITEM_OPTIONS, true);
  164. args.putBoolean(OCFileListFragment.ARG_SEARCH_ONLY_FOLDER, mSearchOnlyFolders);
  165. listOfFiles.setArguments(args);
  166. FragmentTransaction transaction = getSupportFragmentManager().beginTransaction();
  167. transaction.add(R.id.fragment_container, listOfFiles, TAG_LIST_OF_FOLDERS);
  168. transaction.commit();
  169. }
  170. /**
  171. * Show a text message on screen view for notifying user if content is loading or folder is empty
  172. */
  173. private void setBackgroundText() {
  174. OCFileListFragment listFragment = getListOfFilesFragment();
  175. if (listFragment != null) {
  176. if (!mSyncInProgress) {
  177. listFragment.setMessageForEmptyList(
  178. R.string.file_list_empty_headline,
  179. R.string.file_list_empty_moving,
  180. R.drawable.ic_list_empty_create_folder,
  181. true
  182. );
  183. } else {
  184. listFragment.setEmptyListLoadingMessage();
  185. }
  186. } else {
  187. Log.e(TAG, "OCFileListFragment is null");
  188. }
  189. }
  190. protected OCFileListFragment getListOfFilesFragment() {
  191. Fragment listOfFiles = getSupportFragmentManager().findFragmentByTag(FolderPickerActivity.TAG_LIST_OF_FOLDERS);
  192. if (listOfFiles != null) {
  193. return (OCFileListFragment) listOfFiles;
  194. }
  195. Log_OC.e(TAG, "Access to non existing list of files fragment!!");
  196. return null;
  197. }
  198. /**
  199. * {@inheritDoc}
  200. * <p>
  201. * Updates action bar and second fragment, if in dual pane mode.
  202. */
  203. @Override
  204. public void onBrowsedDownTo(OCFile directory) {
  205. setFile(directory);
  206. updateNavigationElementsInActionBar();
  207. // Sync Folder
  208. startSyncFolderOperation(directory, false);
  209. }
  210. @Override
  211. public void onSavedCertificate() {
  212. startSyncFolderOperation(getCurrentDir(), false);
  213. }
  214. public void startSyncFolderOperation(OCFile folder, boolean ignoreETag) {
  215. long currentSyncTime = System.currentTimeMillis();
  216. mSyncInProgress = true;
  217. // perform folder synchronization
  218. RemoteOperation refreshFolderOperation = new RefreshFolderOperation(folder,
  219. currentSyncTime,
  220. false,
  221. ignoreETag,
  222. getStorageManager(),
  223. getAccount(),
  224. getApplicationContext());
  225. refreshFolderOperation.execute(getAccount(), this, null, null);
  226. showProgressBar(true);
  227. setBackgroundText();
  228. }
  229. @Override
  230. protected void onResume() {
  231. super.onResume();
  232. Log_OC.e(TAG, "onResume() start");
  233. // refresh list of files
  234. refreshListOfFilesFragment(false);
  235. // Listen for sync messages
  236. IntentFilter syncIntentFilter = new IntentFilter(FileSyncAdapter.EVENT_FULL_SYNC_START);
  237. syncIntentFilter.addAction(FileSyncAdapter.EVENT_FULL_SYNC_END);
  238. syncIntentFilter.addAction(FileSyncAdapter.EVENT_FULL_SYNC_FOLDER_CONTENTS_SYNCED);
  239. syncIntentFilter.addAction(RefreshFolderOperation.EVENT_SINGLE_FOLDER_CONTENTS_SYNCED);
  240. syncIntentFilter.addAction(RefreshFolderOperation.EVENT_SINGLE_FOLDER_SHARES_SYNCED);
  241. mSyncBroadcastReceiver = new SyncBroadcastReceiver();
  242. registerReceiver(mSyncBroadcastReceiver, syncIntentFilter);
  243. Log_OC.d(TAG, "onResume() end");
  244. }
  245. @Override
  246. protected void onPause() {
  247. Log_OC.e(TAG, "onPause() start");
  248. if (mSyncBroadcastReceiver != null) {
  249. unregisterReceiver(mSyncBroadcastReceiver);
  250. //LocalBroadcastManager.getInstance(this).unregisterReceiver(mSyncBroadcastReceiver);
  251. mSyncBroadcastReceiver = null;
  252. }
  253. Log_OC.d(TAG, "onPause() end");
  254. super.onPause();
  255. }
  256. @Override
  257. public boolean onCreateOptionsMenu(Menu menu) {
  258. MenuInflater inflater = getMenuInflater();
  259. inflater.inflate(R.menu.activity_folder_picker, menu);
  260. return true;
  261. }
  262. @Override
  263. public boolean onOptionsItemSelected(MenuItem item) {
  264. boolean retval = true;
  265. switch (item.getItemId()) {
  266. case R.id.action_create_dir: {
  267. CreateFolderDialogFragment dialog = CreateFolderDialogFragment.newInstance(getCurrentFolder());
  268. dialog.show(getSupportFragmentManager(), CreateFolderDialogFragment.CREATE_FOLDER_FRAGMENT);
  269. break;
  270. }
  271. case android.R.id.home: {
  272. OCFile currentDir = getCurrentFolder();
  273. if (currentDir != null && currentDir.getParentId() != 0) {
  274. onBackPressed();
  275. }
  276. break;
  277. }
  278. case R.id.action_sort: {
  279. FragmentManager fm = getSupportFragmentManager();
  280. FragmentTransaction ft = fm.beginTransaction();
  281. ft.addToBackStack(null);
  282. SortingOrderDialogFragment mSortingOrderDialogFragment = SortingOrderDialogFragment.newInstance(
  283. preferences.getSortOrderByFolder(getListOfFilesFragment().getCurrentFile()));
  284. mSortingOrderDialogFragment.show(ft, SortingOrderDialogFragment.SORTING_ORDER_FRAGMENT);
  285. break;
  286. }
  287. default:
  288. retval = super.onOptionsItemSelected(item);
  289. break;
  290. }
  291. return retval;
  292. }
  293. protected OCFile getCurrentFolder() {
  294. OCFile currentFile = getFile();
  295. OCFile finalFolder = null;
  296. FileDataStorageManager storageManager = getStorageManager();
  297. // If the file is null, take the root folder to avoid any error in functions depending on this one
  298. if (currentFile != null) {
  299. if (currentFile.isFolder()) {
  300. finalFolder = currentFile;
  301. } else if (currentFile.getRemotePath() != null) {
  302. String parentPath = new File(currentFile.getRemotePath()).getParent();
  303. finalFolder = storageManager.getFileByPath(parentPath);
  304. }
  305. } else {
  306. finalFolder = storageManager.getFileByPath(OCFile.ROOT_PATH);
  307. }
  308. return finalFolder;
  309. }
  310. public void refreshListOfFilesFragment(boolean fromSearch) {
  311. OCFileListFragment fileListFragment = getListOfFilesFragment();
  312. if (fileListFragment != null) {
  313. fileListFragment.listDirectory(false, fromSearch);
  314. }
  315. }
  316. public void browseToRoot() {
  317. OCFileListFragment listOfFiles = getListOfFilesFragment();
  318. if (listOfFiles != null) { // should never be null, indeed
  319. OCFile root = getStorageManager().getFileByPath(OCFile.ROOT_PATH);
  320. listOfFiles.listDirectory(root, false, false);
  321. setFile(listOfFiles.getCurrentFile());
  322. updateNavigationElementsInActionBar();
  323. startSyncFolderOperation(root, false);
  324. }
  325. }
  326. @Override
  327. public void onBackPressed() {
  328. OCFileListFragment listOfFiles = getListOfFilesFragment();
  329. if (listOfFiles != null) { // should never be null, indeed
  330. int levelsUp = listOfFiles.onBrowseUp();
  331. if (levelsUp == 0) {
  332. finish();
  333. return;
  334. }
  335. setFile(listOfFiles.getCurrentFile());
  336. updateNavigationElementsInActionBar();
  337. }
  338. }
  339. protected void updateNavigationElementsInActionBar() {
  340. OCFile currentDir = getCurrentFolder();
  341. ActionBar actionBar = getSupportActionBar();
  342. if (actionBar != null) {
  343. boolean atRoot = currentDir == null || currentDir.getParentId() == 0;
  344. actionBar.setDisplayHomeAsUpEnabled(!atRoot);
  345. actionBar.setHomeButtonEnabled(!atRoot);
  346. ThemeUtils.tintBackButton(actionBar, this);
  347. ThemeUtils.setColoredTitle(getSupportActionBar(), atRoot ? caption : currentDir.getFileName(), this);
  348. }
  349. }
  350. /**
  351. * Set per-view controllers
  352. */
  353. private void initControls() {
  354. mCancelBtn = findViewById(R.id.folder_picker_btn_cancel);
  355. mChooseBtn = findViewById(R.id.folder_picker_btn_choose);
  356. if (mChooseBtn != null) {
  357. mChooseBtn.setBackgroundTintMode(PorterDuff.Mode.SRC_ATOP);
  358. mChooseBtn.setBackgroundTintList(ColorStateList.valueOf(ThemeUtils.primaryColor(this, true)));
  359. mChooseBtn.setOnClickListener(this);
  360. }
  361. if (mCancelBtn != null) {
  362. mCancelBtn.setTextColor(ThemeUtils.primaryColor(this, true));
  363. mCancelBtn.setOnClickListener(this);
  364. }
  365. }
  366. @Override
  367. public void onClick(View v) {
  368. if (v.equals(mCancelBtn)) {
  369. finish();
  370. } else if (v.equals(mChooseBtn)) {
  371. Intent i = getIntent();
  372. ArrayList<Parcelable> targetFiles = i.getParcelableArrayListExtra(FolderPickerActivity.EXTRA_FILES);
  373. Intent data = new Intent();
  374. data.putExtra(EXTRA_FOLDER, getCurrentFolder());
  375. data.putParcelableArrayListExtra(EXTRA_FILES, targetFiles);
  376. setResult(RESULT_OK, data);
  377. finish();
  378. }
  379. }
  380. @Override
  381. public void onRemoteOperationFinish(RemoteOperation operation, RemoteOperationResult result) {
  382. super.onRemoteOperationFinish(operation, result);
  383. if (operation instanceof CreateFolderOperation) {
  384. onCreateFolderOperationFinish((CreateFolderOperation) operation, result);
  385. }
  386. }
  387. /**
  388. * Updates the view associated to the activity after the finish of an operation trying to create a new folder.
  389. *
  390. * @param operation Creation operation performed.
  391. * @param result Result of the creation.
  392. */
  393. private void onCreateFolderOperationFinish(
  394. CreateFolderOperation operation, RemoteOperationResult result
  395. ) {
  396. if (result.isSuccess()) {
  397. refreshListOfFilesFragment(false);
  398. } else {
  399. try {
  400. DisplayUtils.showSnackMessage(
  401. this, ErrorMessageAdapter.getErrorCauseMessage(result, operation, getResources())
  402. );
  403. } catch (NotFoundException e) {
  404. Log_OC.e(TAG, "Error while trying to show fail message ", e);
  405. }
  406. }
  407. }
  408. private class SyncBroadcastReceiver extends BroadcastReceiver {
  409. /**
  410. * {@link BroadcastReceiver} to enable syncing feedback in UI
  411. */
  412. @Override
  413. public void onReceive(Context context, Intent intent) {
  414. try {
  415. String event = intent.getAction();
  416. Log_OC.d(TAG, "Received broadcast " + event);
  417. String accountName = intent.getStringExtra(FileSyncAdapter.EXTRA_ACCOUNT_NAME);
  418. String syncFolderRemotePath = intent.getStringExtra(FileSyncAdapter.EXTRA_FOLDER_PATH);
  419. RemoteOperationResult syncResult = (RemoteOperationResult)
  420. DataHolderUtil.getInstance().retrieve(intent.getStringExtra(FileSyncAdapter.EXTRA_RESULT));
  421. boolean sameAccount = getAccount() != null && accountName.equals(getAccount().name)
  422. && getStorageManager() != null;
  423. if (sameAccount) {
  424. if (FileSyncAdapter.EVENT_FULL_SYNC_START.equals(event)) {
  425. mSyncInProgress = true;
  426. } else {
  427. OCFile currentFile = (getFile() == null) ? null :
  428. getStorageManager().getFileByPath(getFile().getRemotePath());
  429. OCFile currentDir = (getCurrentFolder() == null) ? null :
  430. getStorageManager().getFileByPath(getCurrentFolder().getRemotePath());
  431. if (currentDir == null) {
  432. // current folder was removed from the server
  433. DisplayUtils.showSnackMessage(getActivity(),
  434. R.string.sync_current_folder_was_removed,
  435. getCurrentFolder().getFileName());
  436. browseToRoot();
  437. } else {
  438. if (currentFile == null && !getFile().isFolder()) {
  439. // currently selected file was removed in the server, and now we know it
  440. currentFile = currentDir;
  441. }
  442. if (currentDir.getRemotePath().equals(syncFolderRemotePath)) {
  443. OCFileListFragment fileListFragment = getListOfFilesFragment();
  444. if (fileListFragment != null) {
  445. fileListFragment.listDirectory(currentDir, false, false);
  446. }
  447. }
  448. setFile(currentFile);
  449. }
  450. mSyncInProgress = (!FileSyncAdapter.EVENT_FULL_SYNC_END.equals(event) &&
  451. !RefreshFolderOperation.EVENT_SINGLE_FOLDER_SHARES_SYNCED.equals(event));
  452. if (RefreshFolderOperation.EVENT_SINGLE_FOLDER_CONTENTS_SYNCED.equals(event) &&
  453. /// TODO refactor and make common
  454. syncResult != null && !syncResult.isSuccess()) {
  455. if (ResultCode.UNAUTHORIZED.equals(syncResult.getCode()) || (syncResult.isException()
  456. && syncResult.getException() instanceof AuthenticatorException)) {
  457. requestCredentialsUpdate(context);
  458. } else if (RemoteOperationResult.ResultCode.SSL_RECOVERABLE_PEER_UNVERIFIED
  459. .equals(syncResult.getCode())) {
  460. showUntrustedCertDialog(syncResult);
  461. }
  462. }
  463. }
  464. removeStickyBroadcast(intent);
  465. DataHolderUtil.getInstance().delete(intent.getStringExtra(FileSyncAdapter.EXTRA_RESULT));
  466. Log_OC.d(TAG, "Setting progress visibility to " + mSyncInProgress);
  467. showProgressBar(mSyncInProgress);
  468. setBackgroundText();
  469. }
  470. } catch (RuntimeException e) {
  471. // avoid app crashes after changing the serial id of RemoteOperationResult
  472. // in owncloud library with broadcast notifications pending to process
  473. removeStickyBroadcast(intent);
  474. DataHolderUtil.getInstance().delete(intent.getStringExtra(FileSyncAdapter.EXTRA_RESULT));
  475. }
  476. }
  477. }
  478. @Override
  479. public void showDetails(OCFile file) {
  480. // not used at the moment
  481. }
  482. @Override
  483. public void showDetails(OCFile file, int activeTab) {
  484. // not used at the moment
  485. }
  486. /**
  487. * {@inheritDoc}
  488. */
  489. @Override
  490. public void onTransferStateChanged(OCFile file, boolean downloading, boolean uploading) {
  491. // not used at the moment
  492. }
  493. @Override
  494. public void onRefresh() {
  495. refreshList(true);
  496. }
  497. @Override
  498. public void onRefresh(boolean enforced) {
  499. refreshList(enforced);
  500. }
  501. private void refreshList(boolean ignoreETag) {
  502. OCFileListFragment listOfFiles = getListOfFilesFragment();
  503. if (listOfFiles != null) {
  504. OCFile folder = listOfFiles.getCurrentFile();
  505. if (folder != null) {
  506. startSyncFolderOperation(folder, ignoreETag);
  507. }
  508. }
  509. }
  510. public boolean isDoNotEnterEncryptedFolder() {
  511. return mDoNotEnterEncryptedFolder;
  512. }
  513. @Override
  514. public void onSortingOrderChosen(FileSortOrder selection) {
  515. getListOfFilesFragment().sortFiles(selection);
  516. }
  517. }