FolderPickerActivity.java 23 KB

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