PreviewImageActivity.java 23 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630
  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 hd 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.preview;
  21. import android.annotation.SuppressLint;
  22. import android.content.BroadcastReceiver;
  23. import android.content.ComponentName;
  24. import android.content.Context;
  25. import android.content.Intent;
  26. import android.content.IntentFilter;
  27. import android.content.ServiceConnection;
  28. import android.os.Build;
  29. import android.os.Bundle;
  30. import android.os.Handler;
  31. import android.os.IBinder;
  32. import android.os.Message;
  33. import android.support.v4.view.GravityCompat;
  34. import android.support.v4.view.ViewPager;
  35. import android.support.v4.widget.DrawerLayout;
  36. import android.support.v7.app.ActionBar;
  37. import android.view.MenuItem;
  38. import android.view.View;
  39. import android.view.Window;
  40. import com.ortiz.touch.ExtendedViewPager;
  41. import com.owncloud.android.R;
  42. import com.owncloud.android.authentication.AccountUtils;
  43. import com.owncloud.android.datamodel.FileDataStorageManager;
  44. import com.owncloud.android.datamodel.OCFile;
  45. import com.owncloud.android.files.services.FileDownloader;
  46. import com.owncloud.android.files.services.FileDownloader.FileDownloaderBinder;
  47. import com.owncloud.android.files.services.FileUploader;
  48. import com.owncloud.android.files.services.FileUploader.FileUploaderBinder;
  49. import com.owncloud.android.lib.common.operations.OnRemoteOperationListener;
  50. import com.owncloud.android.lib.common.operations.RemoteOperation;
  51. import com.owncloud.android.lib.common.operations.RemoteOperationResult;
  52. import com.owncloud.android.lib.common.operations.RemoteOperationResult.ResultCode;
  53. import com.owncloud.android.lib.common.utils.Log_OC;
  54. import com.owncloud.android.operations.CreateShareViaLinkOperation;
  55. import com.owncloud.android.operations.CreateShareWithShareeOperation;
  56. import com.owncloud.android.operations.RemoveFileOperation;
  57. import com.owncloud.android.operations.SynchronizeFileOperation;
  58. import com.owncloud.android.operations.UnshareOperation;
  59. import com.owncloud.android.ui.activity.FileActivity;
  60. import com.owncloud.android.ui.activity.FileDisplayActivity;
  61. import com.owncloud.android.ui.activity.ShareActivity;
  62. import com.owncloud.android.ui.fragment.FileFragment;
  63. /**
  64. * Holds a swiping galley where image files contained in an ownCloud directory are shown
  65. */
  66. public class PreviewImageActivity extends FileActivity implements
  67. FileFragment.ContainerActivity,
  68. ViewPager.OnPageChangeListener, OnRemoteOperationListener {
  69. public static final int DIALOG_SHORT_WAIT = 0;
  70. public static final String TAG = PreviewImageActivity.class.getSimpleName();
  71. public static final String KEY_WAITING_TO_PREVIEW = "WAITING_TO_PREVIEW";
  72. private static final String KEY_WAITING_FOR_BINDER = "WAITING_FOR_BINDER";
  73. private static final int INITIAL_HIDE_DELAY = 0; // immediate hide
  74. private ExtendedViewPager mViewPager;
  75. private PreviewImagePagerAdapter mPreviewImagePagerAdapter;
  76. private int mSavedPosition = 0;
  77. private boolean mHasSavedPosition = false;
  78. private boolean mRequestWaitingForBinder;
  79. private DownloadFinishReceiver mDownloadFinishReceiver;
  80. private View mFullScreenAnchorView;
  81. @Override
  82. protected void onCreate(Bundle savedInstanceState) {
  83. requestWindowFeature(Window.FEATURE_ACTION_BAR_OVERLAY);
  84. super.onCreate(savedInstanceState);
  85. setContentView(R.layout.preview_image_activity);
  86. // Navigation Drawer
  87. initDrawer();
  88. // ActionBar
  89. ActionBar actionBar = getSupportActionBar();
  90. updateActionBarTitleAndHomeButton(null);
  91. actionBar.hide();
  92. // Make sure we're running on Honeycomb or higher to use FullScreen and
  93. // Immersive Mode
  94. if (isHoneycombOrHigher()) {
  95. mFullScreenAnchorView = getWindow().getDecorView();
  96. // to keep our UI controls visibility in line with system bars
  97. // visibility
  98. mFullScreenAnchorView.setOnSystemUiVisibilityChangeListener
  99. (new View.OnSystemUiVisibilityChangeListener() {
  100. @SuppressLint("InlinedApi")
  101. @Override
  102. public void onSystemUiVisibilityChange(int flags) {
  103. boolean visible = (flags & View.SYSTEM_UI_FLAG_HIDE_NAVIGATION) == 0;
  104. ActionBar actionBar = getSupportActionBar();
  105. if (visible) {
  106. actionBar.show();
  107. mDrawerLayout.setDrawerLockMode(DrawerLayout.LOCK_MODE_UNLOCKED);
  108. } else {
  109. actionBar.hide();
  110. mDrawerLayout.setDrawerLockMode(DrawerLayout.LOCK_MODE_LOCKED_CLOSED);
  111. }
  112. }
  113. });
  114. if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
  115. getWindow().setStatusBarColor(getResources().getColor(R.color.owncloud_blue_dark_transparent));
  116. }
  117. }
  118. if (savedInstanceState != null) {
  119. mRequestWaitingForBinder = savedInstanceState.getBoolean(KEY_WAITING_FOR_BINDER);
  120. } else {
  121. mRequestWaitingForBinder = false;
  122. }
  123. }
  124. private void initViewPager() {
  125. // get parent from path
  126. String parentPath = getFile().getRemotePath().substring(0,
  127. getFile().getRemotePath().lastIndexOf(getFile().getFileName()));
  128. OCFile parentFolder = getStorageManager().getFileByPath(parentPath);
  129. if (parentFolder == null) {
  130. // should not be necessary
  131. parentFolder = getStorageManager().getFileByPath(OCFile.ROOT_PATH);
  132. }
  133. // TODO Enable when "On Device" is recovered ?
  134. mPreviewImagePagerAdapter = new PreviewImagePagerAdapter(getSupportFragmentManager(),
  135. parentFolder, getAccount(), getStorageManager()/*, MainApp.getOnlyOnDevice()*/);
  136. mViewPager = (ExtendedViewPager) findViewById(R.id.fragmentPager);
  137. int position = mHasSavedPosition ? mSavedPosition :
  138. mPreviewImagePagerAdapter.getFilePosition(getFile());
  139. position = (position >= 0) ? position : 0;
  140. mViewPager.setAdapter(mPreviewImagePagerAdapter);
  141. mViewPager.setOnPageChangeListener(this);
  142. mViewPager.setCurrentItem(position);
  143. if (position == 0 && !getFile().isDown()) {
  144. // this is necessary because mViewPager.setCurrentItem(0) just after setting the
  145. // adapter does not result in a call to #onPageSelected(0)
  146. mRequestWaitingForBinder = true;
  147. }
  148. }
  149. protected void onPostCreate(Bundle savedInstanceState) {
  150. super.onPostCreate(savedInstanceState);
  151. // Trigger the initial hide() shortly after the activity has been
  152. // created, to briefly hint to the user that UI controls
  153. // are available
  154. delayedHide(INITIAL_HIDE_DELAY);
  155. }
  156. Handler mHideSystemUiHandler = new Handler() {
  157. @Override
  158. public void handleMessage(Message msg) {
  159. if (isHoneycombOrHigher()) {
  160. hideSystemUI(mFullScreenAnchorView);
  161. }
  162. getSupportActionBar().hide();
  163. }
  164. };
  165. private void delayedHide(int delayMillis) {
  166. mHideSystemUiHandler.removeMessages(0);
  167. mHideSystemUiHandler.sendEmptyMessageDelayed(0, delayMillis);
  168. }
  169. /// handle Window Focus changes
  170. @Override
  171. public void onWindowFocusChanged(boolean hasFocus) {
  172. super.onWindowFocusChanged(hasFocus);
  173. // When the window loses focus (e.g. the action overflow is shown),
  174. // cancel any pending hide action.
  175. if (!hasFocus) {
  176. mHideSystemUiHandler.removeMessages(0);
  177. }
  178. }
  179. @Override
  180. public void onStart() {
  181. super.onStart();
  182. }
  183. @Override
  184. protected void onSaveInstanceState(Bundle outState) {
  185. super.onSaveInstanceState(outState);
  186. outState.putBoolean(KEY_WAITING_FOR_BINDER, mRequestWaitingForBinder);
  187. }
  188. @Override
  189. public void onRemoteOperationFinish(RemoteOperation operation, RemoteOperationResult result) {
  190. super.onRemoteOperationFinish(operation, result);
  191. if (operation instanceof CreateShareViaLinkOperation ||
  192. operation instanceof CreateShareWithShareeOperation) {
  193. onCreateShareOperationFinish(result);
  194. } else if (operation instanceof UnshareOperation) {
  195. onUnshareLinkOperationFinish((UnshareOperation) operation, result);
  196. } else if (operation instanceof RemoveFileOperation) {
  197. finish();
  198. } else if (operation instanceof SynchronizeFileOperation) {
  199. onSynchronizeFileOperationFinish((SynchronizeFileOperation) operation, result);
  200. }
  201. }
  202. private void onUnshareLinkOperationFinish(UnshareOperation operation,
  203. RemoteOperationResult result) {
  204. if (result.isSuccess()) {
  205. OCFile file = getStorageManager().getFileByPath(getFile().getRemotePath());
  206. if (file != null) {
  207. setFile(file);
  208. }
  209. invalidateOptionsMenu();
  210. } else if (result.getCode() == ResultCode.SHARE_NOT_FOUND) {
  211. backToDisplayActivity();
  212. }
  213. }
  214. private void onCreateShareOperationFinish(RemoteOperationResult result) {
  215. if (result.isSuccess()) {
  216. OCFile file = getStorageManager().getFileByPath(getFile().getRemotePath());
  217. if (file != null) {
  218. setFile(file);
  219. }
  220. invalidateOptionsMenu();
  221. }
  222. }
  223. private void onSynchronizeFileOperationFinish(SynchronizeFileOperation operation,
  224. RemoteOperationResult result) {
  225. if (result.isSuccess()) {
  226. invalidateOptionsMenu();
  227. }
  228. }
  229. @Override
  230. protected ServiceConnection newTransferenceServiceConnection() {
  231. return new PreviewImageServiceConnection();
  232. }
  233. /** Defines callbacks for service binding, passed to bindService() */
  234. private class PreviewImageServiceConnection implements ServiceConnection {
  235. @Override
  236. public void onServiceConnected(ComponentName component, IBinder service) {
  237. if (component.equals(new ComponentName(PreviewImageActivity.this,
  238. FileDownloader.class))) {
  239. mDownloaderBinder = (FileDownloaderBinder) service;
  240. if (mRequestWaitingForBinder) {
  241. mRequestWaitingForBinder = false;
  242. Log_OC.d(TAG, "Simulating reselection of current page after connection " +
  243. "of download binder");
  244. onPageSelected(mViewPager.getCurrentItem());
  245. }
  246. } else if (component.equals(new ComponentName(PreviewImageActivity.this,
  247. FileUploader.class))) {
  248. Log_OC.d(TAG, "Upload service connected");
  249. mUploaderBinder = (FileUploaderBinder) service;
  250. } else {
  251. return;
  252. }
  253. }
  254. @Override
  255. public void onServiceDisconnected(ComponentName component) {
  256. if (component.equals(new ComponentName(PreviewImageActivity.this,
  257. FileDownloader.class))) {
  258. Log_OC.d(TAG, "Download service suddenly disconnected");
  259. mDownloaderBinder = null;
  260. } else if (component.equals(new ComponentName(PreviewImageActivity.this,
  261. FileUploader.class))) {
  262. Log_OC.d(TAG, "Upload service suddenly disconnected");
  263. mUploaderBinder = null;
  264. }
  265. }
  266. };
  267. @Override
  268. public void onStop() {
  269. super.onStop();
  270. }
  271. @Override
  272. public void onDestroy() {
  273. super.onDestroy();
  274. }
  275. @Override
  276. public boolean onOptionsItemSelected(MenuItem item) {
  277. boolean returnValue = false;
  278. switch(item.getItemId()){
  279. case android.R.id.home:
  280. if (mDrawerLayout.isDrawerOpen(GravityCompat.START)) {
  281. mDrawerLayout.closeDrawer(GravityCompat.START);
  282. } else {
  283. backToDisplayActivity();
  284. }
  285. returnValue = true;
  286. break;
  287. default:
  288. returnValue = super.onOptionsItemSelected(item);
  289. }
  290. return returnValue;
  291. }
  292. @Override
  293. protected void onResume() {
  294. super.onResume();
  295. mDownloadFinishReceiver = new DownloadFinishReceiver();
  296. IntentFilter filter = new IntentFilter(FileDownloader.getDownloadFinishMessage());
  297. filter.addAction(FileDownloader.getDownloadAddedMessage());
  298. registerReceiver(mDownloadFinishReceiver, filter);
  299. }
  300. @Override
  301. protected void onPostResume() {
  302. super.onPostResume();
  303. }
  304. @Override
  305. public void onPause() {
  306. if (mDownloadFinishReceiver != null){
  307. unregisterReceiver(mDownloadFinishReceiver);
  308. mDownloadFinishReceiver = null;
  309. }
  310. super.onPause();
  311. }
  312. private void backToDisplayActivity() {
  313. finish();
  314. }
  315. @Override
  316. public void showDetails(OCFile file) {
  317. Intent showDetailsIntent = new Intent(this, FileDisplayActivity.class);
  318. showDetailsIntent.setAction(FileDisplayActivity.ACTION_DETAILS);
  319. showDetailsIntent.putExtra(FileActivity.EXTRA_FILE, file);
  320. showDetailsIntent.putExtra(FileActivity.EXTRA_ACCOUNT,
  321. AccountUtils.getCurrentOwnCloudAccount(this));
  322. startActivity(showDetailsIntent);
  323. int pos = mPreviewImagePagerAdapter.getFilePosition(file);
  324. file = mPreviewImagePagerAdapter.getFileAt(pos);
  325. }
  326. private void requestForDownload(OCFile file) {
  327. if (mDownloaderBinder == null) {
  328. Log_OC.d(TAG, "requestForDownload called without binder to download service");
  329. } else if (!mDownloaderBinder.isDownloading(getAccount(), file)) {
  330. Intent i = new Intent(this, FileDownloader.class);
  331. i.putExtra(FileDownloader.EXTRA_ACCOUNT, getAccount());
  332. i.putExtra(FileDownloader.EXTRA_FILE, file);
  333. startService(i);
  334. }
  335. }
  336. /**
  337. * This method will be invoked when a new page becomes selected. Animation is not necessarily
  338. * complete.
  339. *
  340. * @param position Position index of the new selected page
  341. */
  342. @Override
  343. public void onPageSelected(int position) {
  344. mSavedPosition = position;
  345. mHasSavedPosition = true;
  346. if (mDownloaderBinder == null) {
  347. mRequestWaitingForBinder = true;
  348. } else {
  349. OCFile currentFile = mPreviewImagePagerAdapter.getFileAt(position);
  350. getSupportActionBar().setTitle(currentFile.getFileName());
  351. mDrawerToggle.setDrawerIndicatorEnabled(false);
  352. if (!currentFile.isDown()) {
  353. if (!mPreviewImagePagerAdapter.pendingErrorAt(position)) {
  354. requestForDownload(currentFile);
  355. }
  356. }
  357. // Call to reset image zoom to initial state
  358. ((PreviewImagePagerAdapter) mViewPager.getAdapter()).resetZoom();
  359. }
  360. }
  361. /**
  362. * Called when the scroll state changes. Useful for discovering when the user begins dragging,
  363. * when the pager is automatically settling to the current page. when it is fully stopped/idle.
  364. *
  365. * @param state The new scroll state (SCROLL_STATE_IDLE, _DRAGGING, _SETTLING
  366. */
  367. @Override
  368. public void onPageScrollStateChanged(int state) {
  369. }
  370. /**
  371. * This method will be invoked when the current page is scrolled, either as part of a
  372. * programmatically initiated smooth scroll or a user initiated touch scroll.
  373. *
  374. * @param position Position index of the first page currently being displayed.
  375. * Page position+1 will be visible if positionOffset is
  376. * nonzero.
  377. *
  378. * @param positionOffset Value from [0, 1) indicating the offset from the page
  379. * at position.
  380. * @param positionOffsetPixels Value in pixels indicating the offset from position.
  381. */
  382. @Override
  383. public void onPageScrolled(int position, float positionOffset, int positionOffsetPixels) {
  384. }
  385. /**
  386. * Class waiting for broadcast events from the {@link FileDownloader} service.
  387. *
  388. * Updates the UI when a download is started or finished, provided that it is relevant for the
  389. * folder displayed in the gallery.
  390. */
  391. private class DownloadFinishReceiver extends BroadcastReceiver {
  392. @Override
  393. public void onReceive(Context context, Intent intent) {
  394. String accountName = intent.getStringExtra(FileDownloader.ACCOUNT_NAME);
  395. String downloadedRemotePath = intent.getStringExtra(FileDownloader.EXTRA_REMOTE_PATH);
  396. if (getAccount().name.equals(accountName) &&
  397. downloadedRemotePath != null) {
  398. OCFile file = getStorageManager().getFileByPath(downloadedRemotePath);
  399. int position = mPreviewImagePagerAdapter.getFilePosition(file);
  400. boolean downloadWasFine = intent.getBooleanExtra(
  401. FileDownloader.EXTRA_DOWNLOAD_RESULT, false);
  402. //boolean isOffscreen = Math.abs((mViewPager.getCurrentItem() - position))
  403. // <= mViewPager.getOffscreenPageLimit();
  404. if (position >= 0 &&
  405. intent.getAction().equals(FileDownloader.getDownloadFinishMessage())) {
  406. if (downloadWasFine) {
  407. mPreviewImagePagerAdapter.updateFile(position, file);
  408. } else {
  409. mPreviewImagePagerAdapter.updateWithDownloadError(position);
  410. }
  411. mPreviewImagePagerAdapter.notifyDataSetChanged(); // will trigger the creation
  412. // of new fragments
  413. } else {
  414. Log_OC.d(TAG, "Download finished, but the fragment is offscreen");
  415. }
  416. }
  417. removeStickyBroadcast(intent);
  418. }
  419. }
  420. @SuppressLint("InlinedApi")
  421. public void toggleFullScreen() {
  422. if (isHoneycombOrHigher()) {
  423. boolean visible = (mFullScreenAnchorView.getSystemUiVisibility()
  424. & View.SYSTEM_UI_FLAG_HIDE_NAVIGATION) == 0;
  425. if (visible) {
  426. hideSystemUI(mFullScreenAnchorView);
  427. // actionBar.hide(); // propagated through
  428. // OnSystemUiVisibilityChangeListener()
  429. } else {
  430. showSystemUI(mFullScreenAnchorView);
  431. // actionBar.show(); // propagated through
  432. // OnSystemUiVisibilityChangeListener()
  433. }
  434. } else {
  435. ActionBar actionBar = getSupportActionBar();
  436. if (!actionBar.isShowing()) {
  437. actionBar.show();
  438. mDrawerLayout.setDrawerLockMode(DrawerLayout.LOCK_MODE_UNLOCKED);
  439. } else {
  440. actionBar.hide();
  441. mDrawerLayout.setDrawerLockMode(DrawerLayout.LOCK_MODE_LOCKED_CLOSED);
  442. }
  443. }
  444. }
  445. @Override
  446. protected void onAccountSet(boolean stateWasRecovered) {
  447. super.onAccountSet(stateWasRecovered);
  448. if (getAccount() != null) {
  449. OCFile file = getFile();
  450. /// Validate handled file (first image to preview)
  451. if (file == null) {
  452. throw new IllegalStateException("Instanced with a NULL OCFile");
  453. }
  454. if (!file.isImage()) {
  455. throw new IllegalArgumentException("Non-image file passed as argument");
  456. }
  457. // Update file according to DB file, if it is possible
  458. if (file.getFileId() > FileDataStorageManager.ROOT_PARENT_ID)
  459. file = getStorageManager().getFileById(file.getFileId());
  460. if (file != null) {
  461. /// Refresh the activity according to the Account and OCFile set
  462. setFile(file); // reset after getting it fresh from storageManager
  463. getSupportActionBar().setTitle(getFile().getFileName());
  464. //if (!stateWasRecovered) {
  465. initViewPager();
  466. //}
  467. } else {
  468. // handled file not in the current Account
  469. finish();
  470. }
  471. }
  472. }
  473. @Override
  474. public void onBrowsedDownTo(OCFile folder) {
  475. // TODO Auto-generated method stub
  476. }
  477. @Override
  478. public void onTransferStateChanged(OCFile file, boolean downloading, boolean uploading) {
  479. // TODO Auto-generated method stub
  480. }
  481. @SuppressLint("InlinedApi")
  482. private void hideSystemUI(View anchorView) {
  483. anchorView.setSystemUiVisibility(
  484. View.SYSTEM_UI_FLAG_HIDE_NAVIGATION // hides NAVIGATION BAR; Android >= 4.0
  485. | View.SYSTEM_UI_FLAG_FULLSCREEN // hides STATUS BAR; Android >= 4.1
  486. | View.SYSTEM_UI_FLAG_IMMERSIVE // stays interactive; Android >= 4.4
  487. | View.SYSTEM_UI_FLAG_LAYOUT_STABLE // draw full window; Android >= 4.1
  488. | View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN // draw full window; Android >= 4.1
  489. | View.SYSTEM_UI_FLAG_LAYOUT_HIDE_NAVIGATION // draw full window; Android >= 4.1
  490. );
  491. }
  492. @SuppressLint("InlinedApi")
  493. private void showSystemUI(View anchorView) {
  494. anchorView.setSystemUiVisibility(
  495. View.SYSTEM_UI_FLAG_LAYOUT_STABLE // draw full window; Android >= 4.1
  496. | View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN // draw full window; Android >= 4.1
  497. | View.SYSTEM_UI_FLAG_LAYOUT_HIDE_NAVIGATION // draw full window; Android >= 4.1
  498. );
  499. }
  500. /**
  501. * Checks if OS version is Honeycomb one or higher
  502. *
  503. * @return boolean
  504. */
  505. private boolean isHoneycombOrHigher() {
  506. if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.HONEYCOMB) {
  507. return true;
  508. }
  509. return false;
  510. }
  511. @Override
  512. public void allFilesOption(){
  513. backToDisplayActivity();
  514. super.allFilesOption();
  515. }
  516. }