+ }\r
+ \r
+ \r
+ /**\r
+ * {@inheritDoc}\r
+ */\r
+ @Override\r
+ public void onDirectoryClick(OCFile directory) {\r
+ pushDirname(directory);\r
+ ActionBar actionBar = getSupportActionBar();\r
+ actionBar.setDisplayHomeAsUpEnabled(true);\r
+ \r
+ if (mDualPane) {\r
+ // Resets the FileDetailsFragment on Tablets so that it always displays\r
+ FileDetailFragment fileDetails = (FileDetailFragment) getSupportFragmentManager().findFragmentByTag(FileDetailFragment.FTAG);\r
+ if (fileDetails != null) {\r
+ FragmentTransaction transaction = getSupportFragmentManager().beginTransaction();\r
+ transaction.remove(fileDetails);\r
+ transaction.add(R.id.file_details_container, new FileDetailFragment(null, null));\r
+ transaction.commit();\r
+ }\r
+ }\r
+ }\r
+ \r
+ \r
+ /**\r
+ * {@inheritDoc}\r
+ */\r
+ @Override\r
+ public void onFileClick(OCFile file) {\r
+ \r
+ // If we are on a large device -> update fragment\r
+ if (mDualPane) {\r
+ FileDetailFragment fileDetails = (FileDetailFragment) getSupportFragmentManager().findFragmentByTag(FileDetailFragment.FTAG);\r
+ if (fileDetails == null) {\r
+ // first selected file since the current directory was listed\r
+ FragmentTransaction transaction = getSupportFragmentManager().beginTransaction();\r
+ transaction.replace(R.id.file_details_container, new FileDetailFragment(file, AccountUtils.getCurrentOwnCloudAccount(this)), FileDetailFragment.FTAG);\r
+ transaction.setTransition(FragmentTransaction.TRANSIT_FRAGMENT_FADE);\r
+ transaction.commit();\r
+ } else {\r
+ // another select file\r
+ fileDetails.updateFileDetails(file, AccountUtils.getCurrentOwnCloudAccount(this));\r
+ } \r
+ \r
+ } else { // small or medium screen device -> new Activity\r
+ Intent showDetailsIntent = new Intent(this, FileDetailActivity.class);\r
+ showDetailsIntent.putExtra(FileDetailFragment.EXTRA_FILE, file);\r
+ showDetailsIntent.putExtra(FileDownloader.EXTRA_ACCOUNT, AccountUtils.getCurrentOwnCloudAccount(this));\r
+ startActivity(showDetailsIntent);\r
+ }\r
+ }\r
+ \r
+ /**\r
+ * Operations in this method should be preferably performed in onCreate to have a lighter onResume method. \r
+ * \r
+ * But we need to delay them to onResume for the first start of the application, when no account exists and the login activity must be shown; and \r
+ * put instead the ugly view that shows the 'Setup' button to restart the login activity. \r
+ * \r
+ * In other way, if the users cancels or presses BACK in the login page that first time (users can be cruel sometimes) would show a blank view (the \r
+ * FragmentList view empty).\r
+ * \r
+ * This is temporal, until we found out how to get a result in this activity after launching the ADD_ACCOUNT Intent with startActivityForResult (not trivial)\r
+ */\r
+ private void initDelayedTilAccountAvailabe() {\r
+ setContentView(mLayoutView); \r
+ mDualPane = (findViewById(R.id.file_details_container) != null);\r
+ if (mDualPane && getSupportFragmentManager().findFragmentByTag(FileDetailFragment.FTAG) == null) {\r
+ FragmentTransaction transaction = getSupportFragmentManager().beginTransaction();\r
+ transaction.replace(R.id.file_details_container, new FileDetailFragment(null, null)); // empty FileDetailFragment\r
+ transaction.commit();\r
+ }\r
+\r
+ }\r
+\r
+ \r