UploadFilesActivity.java 23 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603
  1. /**
  2. * ownCloud Android client application
  3. *
  4. * @author David A. Velasco
  5. * Copyright (C) 2015 ownCloud Inc.
  6. *
  7. * This program is free software: you can redistribute it and/or modify
  8. * it under the terms of the GNU General Public License version 2,
  9. * as published by the Free Software Foundation.
  10. *
  11. * This program is distributed in the hope that it will be useful,
  12. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  13. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  14. * GNU General Public License for more details.
  15. *
  16. * You should have received a copy of the GNU General Public License
  17. * along with this program. If not, see <http://www.gnu.org/licenses/>.
  18. *
  19. */
  20. package com.owncloud.android.ui.activity;
  21. import android.accounts.Account;
  22. import android.app.Activity;
  23. import android.content.Intent;
  24. import android.graphics.PorterDuff;
  25. import android.os.AsyncTask;
  26. import android.os.Bundle;
  27. import android.os.Environment;
  28. import android.support.annotation.NonNull;
  29. import android.support.annotation.Nullable;
  30. import android.support.v4.app.DialogFragment;
  31. import android.support.v4.app.Fragment;
  32. import android.support.v4.app.FragmentManager;
  33. import android.support.v4.app.FragmentTransaction;
  34. import android.support.v7.app.ActionBar;
  35. import android.support.v7.widget.AppCompatButton;
  36. import android.view.Menu;
  37. import android.view.MenuItem;
  38. import android.view.View;
  39. import android.view.View.OnClickListener;
  40. import android.view.ViewGroup;
  41. import android.widget.ArrayAdapter;
  42. import android.widget.Button;
  43. import android.widget.Spinner;
  44. import android.widget.TextView;
  45. import com.owncloud.android.R;
  46. import com.owncloud.android.db.PreferenceManager;
  47. import com.owncloud.android.lib.common.utils.Log_OC;
  48. import com.owncloud.android.ui.dialog.ConfirmationDialogFragment;
  49. import com.owncloud.android.ui.dialog.ConfirmationDialogFragment.ConfirmationDialogFragmentListener;
  50. import com.owncloud.android.ui.dialog.IndeterminateProgressDialog;
  51. import com.owncloud.android.ui.dialog.SortingOrderDialogFragment;
  52. import com.owncloud.android.ui.fragment.ExtendedListFragment;
  53. import com.owncloud.android.ui.fragment.LocalFileListFragment;
  54. import com.owncloud.android.utils.FileSortOrder;
  55. import com.owncloud.android.utils.FileStorageUtils;
  56. import com.owncloud.android.utils.ThemeUtils;
  57. import java.io.File;
  58. import java.util.ArrayList;
  59. import java.util.List;
  60. import static com.owncloud.android.db.PreferenceManager.getSortOrder;
  61. /**
  62. * Displays local files and let the user choose what of them wants to upload
  63. * to the current ownCloud account.
  64. */
  65. public class UploadFilesActivity extends FileActivity implements
  66. LocalFileListFragment.ContainerActivity, ActionBar.OnNavigationListener,
  67. OnClickListener, ConfirmationDialogFragmentListener, SortingOrderDialogFragment.OnSortingOrderListener {
  68. private static final String SORT_ORDER_DIALOG_TAG = "SORT_ORDER_DIALOG";
  69. private ArrayAdapter<String> mDirectories;
  70. private File mCurrentDir = null;
  71. private boolean mSelectAll = false;
  72. private boolean mLocalFolderPickerMode = false;
  73. private LocalFileListFragment mFileListFragment;
  74. protected Button mUploadBtn;
  75. private Spinner mBehaviourSpinner;
  76. private Account mAccountOnCreation;
  77. private DialogFragment mCurrentDialog;
  78. private Menu mOptionsMenu;
  79. public static final String EXTRA_CHOSEN_FILES =
  80. UploadFilesActivity.class.getCanonicalName() + ".EXTRA_CHOSEN_FILES";
  81. public static final String EXTRA_ACTION = UploadFilesActivity.class.getCanonicalName() + ".EXTRA_ACTION";
  82. public final static String KEY_LOCAL_FOLDER_PICKER_MODE = UploadFilesActivity.class.getCanonicalName()
  83. + ".LOCAL_FOLDER_PICKER_MODE";
  84. public static final int RESULT_OK_AND_MOVE = RESULT_FIRST_USER;
  85. public static final int RESULT_OK_AND_DO_NOTHING = 2;
  86. public static final int RESULT_OK_AND_DELETE = 3;
  87. public static final String KEY_DIRECTORY_PATH =
  88. UploadFilesActivity.class.getCanonicalName() + ".KEY_DIRECTORY_PATH";
  89. private static final String KEY_ALL_SELECTED =
  90. UploadFilesActivity.class.getCanonicalName() + ".KEY_ALL_SELECTED";
  91. private static final String TAG = "UploadFilesActivity";
  92. private static final String WAIT_DIALOG_TAG = "WAIT";
  93. private static final String QUERY_TO_MOVE_DIALOG_TAG = "QUERY_TO_MOVE";
  94. @Override
  95. public void onCreate(Bundle savedInstanceState) {
  96. Log_OC.d(TAG, "onCreate() start");
  97. super.onCreate(savedInstanceState);
  98. Bundle extras = getIntent().getExtras();
  99. if (extras != null) {
  100. mLocalFolderPickerMode = extras.getBoolean(KEY_LOCAL_FOLDER_PICKER_MODE, false);
  101. }
  102. if(savedInstanceState != null) {
  103. mCurrentDir = new File(savedInstanceState.getString(UploadFilesActivity.KEY_DIRECTORY_PATH, Environment
  104. .getExternalStorageDirectory().getAbsolutePath()));
  105. mSelectAll = savedInstanceState.getBoolean(UploadFilesActivity.KEY_ALL_SELECTED, false);
  106. } else {
  107. mCurrentDir = Environment.getExternalStorageDirectory();
  108. }
  109. mAccountOnCreation = getAccount();
  110. /// USER INTERFACE
  111. // Drop-down navigation
  112. mDirectories = new CustomArrayAdapter<>(this, R.layout.support_simple_spinner_dropdown_item);
  113. File currDir = mCurrentDir;
  114. while(currDir != null && currDir.getParentFile() != null) {
  115. mDirectories.add(currDir.getName());
  116. currDir = currDir.getParentFile();
  117. }
  118. mDirectories.add(File.separator);
  119. // Inflate and set the layout view
  120. setContentView(R.layout.upload_files_layout);
  121. if (mLocalFolderPickerMode) {
  122. findViewById(R.id.upload_options).setVisibility(View.GONE);
  123. ((AppCompatButton) findViewById(R.id.upload_files_btn_upload))
  124. .setText(R.string.uploader_btn_alternative_text);
  125. }
  126. mFileListFragment = (LocalFileListFragment) getSupportFragmentManager().findFragmentById(R.id.local_files_list);
  127. // Set input controllers
  128. findViewById(R.id.upload_files_btn_cancel).setOnClickListener(this);
  129. mUploadBtn = (AppCompatButton) findViewById(R.id.upload_files_btn_upload);
  130. mUploadBtn.getBackground().setColorFilter(ThemeUtils.primaryAccentColor(this), PorterDuff.Mode.SRC_ATOP);
  131. mUploadBtn.setOnClickListener(this);
  132. int localBehaviour = PreferenceManager.getUploaderBehaviour(this);
  133. // file upload spinner
  134. mBehaviourSpinner = findViewById(R.id.upload_files_spinner_behaviour);
  135. List<String> behaviours = new ArrayList<>();
  136. behaviours.add(getString(R.string.uploader_upload_files_behaviour_move_to_nextcloud_folder,
  137. ThemeUtils.getDefaultDisplayNameForRootFolder(this)));
  138. behaviours.add(getString(R.string.uploader_upload_files_behaviour_only_upload));
  139. behaviours.add(getString(R.string.uploader_upload_files_behaviour_upload_and_delete_from_source));
  140. ArrayAdapter<String> behaviourAdapter = new ArrayAdapter<>(this, android.R.layout.simple_spinner_item,
  141. behaviours);
  142. behaviourAdapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);
  143. mBehaviourSpinner.setAdapter(behaviourAdapter);
  144. mBehaviourSpinner.setSelection(localBehaviour);
  145. // setup the toolbar
  146. setupToolbar();
  147. // Action bar setup
  148. ActionBar actionBar = getSupportActionBar();
  149. actionBar.setHomeButtonEnabled(true); // mandatory since Android ICS, according to the
  150. // official documentation
  151. actionBar.setDisplayHomeAsUpEnabled(mCurrentDir != null && mCurrentDir.getName() != null);
  152. actionBar.setDisplayShowTitleEnabled(false);
  153. actionBar.setNavigationMode(ActionBar.NAVIGATION_MODE_LIST);
  154. actionBar.setListNavigationCallbacks(mDirectories, this);
  155. // wait dialog
  156. if (mCurrentDialog != null) {
  157. mCurrentDialog.dismiss();
  158. mCurrentDialog = null;
  159. }
  160. Log_OC.d(TAG, "onCreate() end");
  161. }
  162. /**
  163. * Helper to launch the UploadFilesActivity for which you would like a result when it finished.
  164. * Your onActivityResult() method will be called with the given requestCode.
  165. *
  166. * @param activity the activity which should call the upload activity for a result
  167. * @param account the account for which the upload activity is called
  168. * @param requestCode If >= 0, this code will be returned in onActivityResult()
  169. */
  170. public static void startUploadActivityForResult(Activity activity, Account account, int requestCode) {
  171. Intent action = new Intent(activity, UploadFilesActivity.class);
  172. action.putExtra(EXTRA_ACCOUNT, (account));
  173. activity.startActivityForResult(action, requestCode);
  174. }
  175. @Override
  176. public boolean onCreateOptionsMenu(Menu menu) {
  177. mOptionsMenu = menu;
  178. getMenuInflater().inflate(R.menu.upload_files_picker, menu);
  179. if(!mLocalFolderPickerMode) {
  180. MenuItem selectAll = menu.findItem(R.id.action_select_all);
  181. setSelectAllMenuItem(selectAll, mSelectAll);
  182. }
  183. MenuItem switchView = menu.findItem(R.id.action_switch_view);
  184. switchView.setTitle(isGridView() ? R.string.action_switch_list_view : R.string.action_switch_grid_view);
  185. return super.onCreateOptionsMenu(menu);
  186. }
  187. @Override
  188. public boolean onOptionsItemSelected(MenuItem item) {
  189. boolean retval = true;
  190. switch (item.getItemId()) {
  191. case android.R.id.home: {
  192. if(mCurrentDir != null && mCurrentDir.getParentFile() != null){
  193. onBackPressed();
  194. }
  195. break;
  196. }
  197. case R.id.action_select_all: {
  198. item.setChecked(!item.isChecked());
  199. mSelectAll = item.isChecked();
  200. setSelectAllMenuItem(item, mSelectAll);
  201. mFileListFragment.selectAllFiles(item.isChecked());
  202. break;
  203. }
  204. case R.id.action_sort: {
  205. FragmentManager fm = getSupportFragmentManager();
  206. FragmentTransaction ft = fm.beginTransaction();
  207. ft.addToBackStack(null);
  208. SortingOrderDialogFragment mSortingOrderDialogFragment = SortingOrderDialogFragment.newInstance(
  209. getSortOrder(this, null));
  210. mSortingOrderDialogFragment.show(ft, SORT_ORDER_DIALOG_TAG);
  211. break;
  212. }
  213. case R.id.action_switch_view: {
  214. if (isGridView()) {
  215. item.setTitle(getString(R.string.action_switch_grid_view));
  216. item.setIcon(R.drawable.ic_view_module);
  217. mFileListFragment.switchToListView();
  218. } else {
  219. item.setTitle(getApplicationContext().getString(R.string.action_switch_list_view));
  220. item.setIcon(R.drawable.ic_view_list);
  221. mFileListFragment.switchToGridView();
  222. }
  223. break;
  224. }
  225. default:
  226. retval = super.onOptionsItemSelected(item);
  227. break;
  228. }
  229. return retval;
  230. }
  231. @Override
  232. public void onSortingOrderChosen(FileSortOrder selection) {
  233. mFileListFragment.sortFiles(selection);
  234. }
  235. @Override
  236. public boolean onNavigationItemSelected(int itemPosition, long itemId) {
  237. int i = itemPosition;
  238. while (i-- != 0) {
  239. onBackPressed();
  240. }
  241. // the next operation triggers a new call to this method, but it's necessary to
  242. // ensure that the name exposed in the action bar is the current directory when the
  243. // user selected it in the navigation list
  244. if (itemPosition != 0) {
  245. getSupportActionBar().setSelectedNavigationItem(0);
  246. }
  247. return true;
  248. }
  249. @Override
  250. public void onBackPressed() {
  251. if (mDirectories.getCount() <= 1) {
  252. finish();
  253. return;
  254. }
  255. popDirname();
  256. mFileListFragment.onNavigateUp();
  257. mCurrentDir = mFileListFragment.getCurrentDirectory();
  258. if (mCurrentDir.getParentFile() == null) {
  259. ActionBar actionBar = getSupportActionBar();
  260. if (actionBar != null) {
  261. actionBar.setDisplayHomeAsUpEnabled(false);
  262. }
  263. }
  264. // invalidate checked state when navigating directories
  265. if(!mLocalFolderPickerMode) {
  266. setSelectAllMenuItem(mOptionsMenu.findItem(R.id.action_select_all), false);
  267. }
  268. }
  269. @Override
  270. protected void onSaveInstanceState(Bundle outState) {
  271. // responsibility of restore is preferred in onCreate() before than in
  272. // onRestoreInstanceState when there are Fragments involved
  273. Log_OC.d(TAG, "onSaveInstanceState() start");
  274. super.onSaveInstanceState(outState);
  275. outState.putString(UploadFilesActivity.KEY_DIRECTORY_PATH, mCurrentDir.getAbsolutePath());
  276. if (mOptionsMenu != null && mOptionsMenu.findItem(R.id.action_select_all) != null) {
  277. outState.putBoolean(UploadFilesActivity.KEY_ALL_SELECTED,
  278. mOptionsMenu.findItem(R.id.action_select_all).isChecked());
  279. } else {
  280. outState.putBoolean(UploadFilesActivity.KEY_ALL_SELECTED, false);
  281. }
  282. Log_OC.d(TAG, "onSaveInstanceState() end");
  283. }
  284. /**
  285. * Pushes a directory to the drop down list
  286. * @param directory to push
  287. * @throws IllegalArgumentException If the {@link File#isDirectory()} returns false.
  288. */
  289. public void pushDirname(File directory) {
  290. if(!directory.isDirectory()){
  291. throw new IllegalArgumentException("Only directories may be pushed!");
  292. }
  293. mDirectories.insert(directory.getName(), 0);
  294. mCurrentDir = directory;
  295. }
  296. /**
  297. * Pops a directory name from the drop down list
  298. * @return True, unless the stack is empty
  299. */
  300. public boolean popDirname() {
  301. mDirectories.remove(mDirectories.getItem(0));
  302. return !mDirectories.isEmpty();
  303. }
  304. private void setSelectAllMenuItem(MenuItem selectAll, boolean checked) {
  305. selectAll.setChecked(checked);
  306. if(checked) {
  307. selectAll.setIcon(R.drawable.ic_select_none);
  308. } else {
  309. selectAll.setIcon(ThemeUtils.tintDrawable(R.drawable.ic_select_all, ThemeUtils.primaryColor(this)));
  310. }
  311. }
  312. /**
  313. * Custom array adapter to override text colors
  314. */
  315. private class CustomArrayAdapter<T> extends ArrayAdapter<T> {
  316. public CustomArrayAdapter(UploadFilesActivity ctx, int view) {
  317. super(ctx, view);
  318. }
  319. public @NonNull View getView(int position, @Nullable View convertView, @NonNull ViewGroup parent) {
  320. View v = super.getView(position, convertView, parent);
  321. ((TextView) v).setTextColor(getResources().getColorStateList(
  322. android.R.color.white));
  323. return v;
  324. }
  325. public View getDropDownView(int position, View convertView, @NonNull ViewGroup parent) {
  326. View v = super.getDropDownView(position, convertView, parent);
  327. ((TextView) v).setTextColor(getResources().getColorStateList(
  328. android.R.color.white));
  329. return v;
  330. }
  331. }
  332. /**
  333. * {@inheritDoc}
  334. */
  335. @Override
  336. public void onDirectoryClick(File directory) {
  337. if(!mLocalFolderPickerMode) {
  338. // invalidate checked state when navigating directories
  339. MenuItem selectAll = mOptionsMenu.findItem(R.id.action_select_all);
  340. setSelectAllMenuItem(selectAll, false);
  341. }
  342. pushDirname(directory);
  343. ActionBar actionBar = getSupportActionBar();
  344. actionBar.setDisplayHomeAsUpEnabled(true);
  345. }
  346. /**
  347. * {@inheritDoc}
  348. */
  349. @Override
  350. public void onFileClick(File file) {
  351. // nothing to do
  352. }
  353. /**
  354. * {@inheritDoc}
  355. */
  356. @Override
  357. public File getInitialDirectory() {
  358. return mCurrentDir;
  359. }
  360. /**
  361. * {@inheritDoc}
  362. */
  363. @Override
  364. public boolean isFolderPickerMode() {
  365. return mLocalFolderPickerMode;
  366. }
  367. /**
  368. * Performs corresponding action when user presses 'Cancel' or 'Upload' button
  369. *
  370. * TODO Make here the real request to the Upload service ; will require to receive the account and
  371. * target folder where the upload must be done in the received intent.
  372. */
  373. @Override
  374. public void onClick(View v) {
  375. if (v.getId() == R.id.upload_files_btn_cancel) {
  376. setResult(RESULT_CANCELED);
  377. finish();
  378. } else if (v.getId() == R.id.upload_files_btn_upload) {
  379. if(mLocalFolderPickerMode) {
  380. Intent data = new Intent();
  381. if(mCurrentDir != null) {
  382. data.putExtra(EXTRA_CHOSEN_FILES, mCurrentDir.getAbsolutePath());
  383. }
  384. setResult(RESULT_OK, data);
  385. finish();
  386. } else {
  387. new CheckAvailableSpaceTask().execute(mBehaviourSpinner.getSelectedItemPosition() == 0);
  388. }
  389. }
  390. }
  391. /**
  392. * Asynchronous task checking if there is space enough to copy all the files chosen
  393. * to upload into the ownCloud local folder.
  394. *
  395. * Maybe an AsyncTask is not strictly necessary, but who really knows.
  396. */
  397. private class CheckAvailableSpaceTask extends AsyncTask<Boolean, Void, Boolean> {
  398. /**
  399. * Updates the UI before trying the movement.
  400. */
  401. @Override
  402. protected void onPreExecute () {
  403. /// progress dialog and disable 'Move' button
  404. mCurrentDialog = IndeterminateProgressDialog.newInstance(R.string.wait_a_moment, false);
  405. mCurrentDialog.show(getSupportFragmentManager(), WAIT_DIALOG_TAG);
  406. }
  407. /**
  408. * Checks the available space.
  409. *
  410. * @param params boolean flag if storage calculation should be done.
  411. * @return 'True' if there is space enough or doesn't have to be calculated
  412. */
  413. @Override
  414. protected Boolean doInBackground(Boolean... params) {
  415. if(params[0]) {
  416. String[] checkedFilePaths = mFileListFragment.getCheckedFilePaths();
  417. long total = 0;
  418. for (int i = 0; checkedFilePaths != null && i < checkedFilePaths.length; i++) {
  419. String localPath = checkedFilePaths[i];
  420. File localFile = new File(localPath);
  421. total += localFile.length();
  422. }
  423. return FileStorageUtils.getUsableSpace(mAccountOnCreation.name) >= total;
  424. }
  425. return true;
  426. }
  427. /**
  428. * Updates the activity UI after the check of space is done.
  429. *
  430. * If there is not space enough. shows a new dialog to query the user if wants to move the
  431. * files instead of copy them.
  432. *
  433. * @param result 'True' when there is space enough to copy all the selected files.
  434. */
  435. @Override
  436. protected void onPostExecute(Boolean result) {
  437. if(mCurrentDialog != null) {
  438. mCurrentDialog.dismiss();
  439. mCurrentDialog = null;
  440. }
  441. if (result) {
  442. // return the list of selected files (success)
  443. Intent data = new Intent();
  444. data.putExtra(EXTRA_CHOSEN_FILES, mFileListFragment.getCheckedFilePaths());
  445. // set result code
  446. switch (mBehaviourSpinner.getSelectedItemPosition()) {
  447. case 0: // move to nextcloud folder
  448. setResult(RESULT_OK_AND_MOVE, data);
  449. break;
  450. case 1: // only upload
  451. setResult(RESULT_OK_AND_DO_NOTHING, data);
  452. break;
  453. case 2: // upload and delete from source
  454. setResult(RESULT_OK_AND_DELETE, data);
  455. break;
  456. }
  457. // store behaviour
  458. PreferenceManager.setUploaderBehaviour(getApplicationContext(),
  459. mBehaviourSpinner.getSelectedItemPosition());
  460. finish();
  461. } else {
  462. // show a dialog to query the user if wants to move the selected files
  463. // to the ownCloud folder instead of copying
  464. String[] args = {getString(R.string.app_name)};
  465. ConfirmationDialogFragment dialog = ConfirmationDialogFragment.newInstance(
  466. R.string.upload_query_move_foreign_files, args, 0, R.string.common_yes, -1,
  467. R.string.common_no
  468. );
  469. dialog.setOnConfirmationListener(UploadFilesActivity.this);
  470. dialog.show(getSupportFragmentManager(), QUERY_TO_MOVE_DIALOG_TAG);
  471. }
  472. }
  473. }
  474. @Override
  475. public void onConfirmation(String callerTag) {
  476. Log_OC.d(TAG, "Positive button in dialog was clicked; dialog tag is " + callerTag);
  477. if (callerTag.equals(QUERY_TO_MOVE_DIALOG_TAG)) {
  478. // return the list of selected files to the caller activity (success),
  479. // signaling that they should be moved to the ownCloud folder, instead of copied
  480. Intent data = new Intent();
  481. data.putExtra(EXTRA_CHOSEN_FILES, mFileListFragment.getCheckedFilePaths());
  482. setResult(RESULT_OK_AND_MOVE, data);
  483. finish();
  484. }
  485. }
  486. @Override
  487. public void onNeutral(String callerTag) {
  488. Log_OC.d(TAG, "Phantom neutral button in dialog was clicked; dialog tag is " + callerTag);
  489. }
  490. @Override
  491. public void onCancel(String callerTag) {
  492. /// nothing to do; don't finish, let the user change the selection
  493. Log_OC.d(TAG, "Negative button in dialog was clicked; dialog tag is " + callerTag);
  494. }
  495. @Override
  496. protected void onAccountSet(boolean stateWasRecovered) {
  497. super.onAccountSet(stateWasRecovered);
  498. if (getAccount() != null) {
  499. if (!mAccountOnCreation.equals(getAccount())) {
  500. setResult(RESULT_CANCELED);
  501. finish();
  502. }
  503. } else {
  504. setResult(RESULT_CANCELED);
  505. finish();
  506. }
  507. }
  508. private boolean isGridView() {
  509. return getListOfFilesFragment().isGridEnabled();
  510. }
  511. private ExtendedListFragment getListOfFilesFragment() {
  512. Fragment listOfFiles = mFileListFragment;
  513. if (listOfFiles != null) {
  514. return (ExtendedListFragment) listOfFiles;
  515. }
  516. Log_OC.e(TAG, "Access to unexisting list of files fragment!!");
  517. return null;
  518. }
  519. }